Notifications
Clear all

[Closed] Apply modifier to selection, one modifier for multiple objects

When you select many nodes you can apply modifier for selected.
Then modifier works like all selected nodes are simple object.

I don’t know how to do it with maxscript and rather want to avoid code generated by recorder.
I wrote this code, but doesn’t works as I described above:


   unwrapMod= unwrap_UVW name:"Automatic Flatten UVs"
   addModifier (selection as array) unwrapMod
   

I want to perform flatten mapping on selelected objects, so they will share one texture later.
It is important to me the nodes keep separated, I won’t union them (pivots are important).

8 Replies

[ul]
[li]modPanel.addModToSelection[/li][/ul]

That exactly I wanted to avoid.
modPanel is synonym of ugly code

do you want to avoid the doing things the right way? the modpanel interface usually helps avoid the ugly coding.

I made it! This code flattening objects into single texture:


	local unwrapMod = unwrap_UVW name:"Automatic Flatten UVs"
	select objectsToMapp
	modPanel.addModToSelection unwrapMod ui:on
	subobjectLevel = 3 -- faces
	modPanel.setCurrentObject unwrapMod
	actionMan.executeAction 0 "40021" -- select all faces
	unwrapMod.flattenMap 60 #() 0 true 0 false true

Thinks usualy can be done batter and faster instead of modPanel or actionMan.
Pain of modPanel is fact that it have to be visible during working with it.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

if you want to use unwrap interface methods the unwrap modifier has to be active in modifiers panel any way.

that’s an example of an ugly coding.

As I say above;)
But I don’t know what to use instead.

unwrapMod.selectPolygons #{ 1..(unwrapMod.numberPolygons()) } -- select all faces

It doesn’t works.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

at least max select all is better.
but the right is:


(
	select objectsToMapp
	unwrapMod = unwrap_UVW name:"Automatic Flatten UVs"
	modPanel.addModToSelection unwrapMod ui:on
	modPanel.setCurrentObject unwrapMod
	select objectsToMapp
	unwrapMod.flattenMap 60 #() 0 true 0 false true
)