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 (7)
Comment policy
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.
.
Try to optimize the script in the part where the instanced objets are processed.
Alternatif solution
Hi fajar,
i will try your script and post the result here later, thank you for your help :)
.
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?
.
Your code not works properly, beause you use:
for o in selection do
contains alls elected objects and when you select another object the
is changed.
When you apply modifier to an object this object become selected and the for loop stops working, because
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.