Errors i cannot figure out

Hi. I want to make a script that moves selected clusters in the unwrap modifier with multiple objects selected.

I already have a script that does that but with only one object selected

$.modifiers[#unwrap_uvw].unwrap2.MoveSelected [1.0,0,0]

but when i try to apply that when multiple objects are selected i get problems.

sel = selection
obj = #()

sel.modifiers[#unwrap_uvw].unwrap2.getSelectedFaces ()
sel.modifiers[#unwrap_uvw].unwrap2.moveSelected [1.0,0,0]

i get this error

-- Unknown property: "modifiers" in $selection
-- Unknown property: "modifiers" in $selection

What am i doing wrong?

Thanks!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
DarkNemos's picture

I have found a solution to my

I have found a solution to my problem and it kinda goes like this

selectionSets["tempSel"] = selection

sel = selection

obj = #()

for i in sel do
(
append obj i
)

for i = 1 to obj.count do
(
select obj[i]

obj[i].modifiers[#unwrap_uvw].unwrap.edit ()

obj[i].modifiers[#unwrap_uvw].setTVSubObjectMode 3

face = obj[i].modifiers[#unwrap_uvw].getSelectedFaces

obj[i].modifiers[#unwrap_uvw].unwrap2.MoveSelected [0,-1,0]

clearSelection()

select selectionSets["tempSel"]

for i in sel do
(
i.modifiers[#unwrap_uvw].unwrap.edit ()
i.modifiers[#unwrap_uvw].setTVSubObjectMode 3
)
)

If anyone knows a better way to do exactly this i am open for suggestions :)

DarkNemos's picture

I had a script that does

I had a script that does something like that, puts it in a loop but it didn't work well

sel = selection
obj = #()
for i in sel do
(
i.modifiers[#unwrap_uvw].unwrap2.MoveSelected [1.0,0,0]
)

But this script depends on how many objects i have selected. For example if i have 3 objects selected it moves the selected clusters 3UV tiles. If i have 6 objects selected it moves the selected clusters 6 times. But i want to move only one tile when lots of objects are selected. Thats the point of the whole script.

Is there some way not to loop through objects but to treat the selected objects as one?

le1setreter's picture

i am max-less right now so

i am max-less right now so can not test but i think you cant put modifiers on the selection that is the object "array" at this point. you should loop through your objects that are in the selection.

also sometimes the operations you are doing while looping let max loose the selection so i would recommend to store the selection as extra array and loop through the new "safe" selection-array.

hope this helps a bit.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.