PDA

View Full Version : Apply modifier to selection, one modifier for multiple objects


MiranDMC
07-17-2011, 01:37 PM
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).

denisT
07-17-2011, 02:20 PM
modPanel.addModToSelection

MiranDMC
07-17-2011, 02:22 PM
That exactly I wanted to avoid.
modPanel is synonym of ugly code :)

denisT
07-17-2011, 02:43 PM
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.

MiranDMC
07-17-2011, 02:48 PM
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.

denisT
07-17-2011, 03:00 PM
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.

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

denisT
07-17-2011, 03:02 PM
I made it! This code flattening objects into single texture:
actionMan.executeAction 0 "40021" -- select all faces

that's an example of an ugly coding.

MiranDMC
07-17-2011, 03:14 PM
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.

denisT
07-17-2011, 03:31 PM
As I say above;)
But I don't know what to use instead...


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
)

CGTalk Moderation
07-17-2011, 03:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.