Apply uvwmapping to multiple object problem
Hi all, i want to make a mxscript that can apply box uvw mapping to multiple objects in my scene, the code i use below:
for i in selection do ( addModifier i (uvwmap()) i.modifiers[#UVW_Map].maptype = 4 i.modifiers[#UVW_Map].length = spn1.value i.modifiers[#UVW_Map].width = spn2.value i.modifiers[#UVW_Map].height = spn3.value )
it work fine for one object selected, but not working for more object selection, especially got instance object in the selction, it add more than one uvwmapping modifier on one object, please help! how can i apply just one uvwmapping to one object only even it is instance object with my script?
i hope you understand with my poor english.
Best regards,
Jackieteh
Comments
Hi miauu, the script work on
Hi miauu, the script work on the following situation:
1) select several instances objects
2) select several instances and not instances objects
but not working on
1) if i group several instances and not instances objects
2) if i group several instances objects only
3) if i group several not instance objects only
so the script only working on selected objects but not working on a group objects.
Regards,
Jackie Teh
website: https://www.sporadicstudio.com/
.
Try to optimize the script in the part where the instanced objets are processed.
Tools and Scripts for Autodesk 3dsMax
Alternatif solution
Hi fajar, i will try your
Hi fajar,
i will try your script and post the result here later, thank you for your help :)
Regards,
Jackie Teh
website: https://www.sporadicstudio.com/
.
Tools and Scripts for Autodesk 3dsMax
Hi miauu, it work better than
Hi miauu, it work better than what i expected.
i wonder why my first don't work as what i want?
and what is the function in your script work for?
Regards,
Jackie Teh
website: https://www.sporadicstudio.com/
.
Your code not works properly, beause you use:
for o in selection do
selection
contains alls elected objects and when you select another object theselection
is changed.When you apply modifier to an object this object become selected and the for loop stops working, because
selection
contains the object to which the modifier was applied.The function is to get only one object from all instances of this object. So, when you add the modifier to this object, all instances will receive the same modifier. This way the instances do not have several modifiers applied one after another.
Tools and Scripts for Autodesk 3dsMax