Self explanatory really. Arrays sort of scare me but I'll get them down eventually but I'm sure this is a case where I can collect the Modifiers.name and then send that to the object name resulting in a final result for the objects name to be "Ball_Mod_Noise" "'Ball_Mod_UVW Map" etc.
My efforts so far collect modifiers array:
ModCollect = with printAllElements on sort (for c in modifier.classes collect if c.creatable then (c()).name else c.localizedname) as string-------------------------------
This code though below works to rename the objects but not good when there are so many modifiers, need something more dynamic. If I could replace
uvwmap here with something for the
o.namethen that would be great.
NewMaxFileName = "MAX"
modPrefix = "_Mod"
for o in objects where classof o.modifiers[1] == uvwmap do o.name = NewMaxFileName + modPrefix + "_UVWMap" as string= MAX_Mod_UVWMap
Thanks in advance.
-----------------------SOLUTION---------------------------
for o in objects do (
for m in o.modifiers do (
if classof m != undefined do (
o.name = o.modifiers[1].name
)
)
)Probably could be shortened but I'm hapy for now :D
By
Comments (3)
Comment policy
Collect object that have modifier and its modifier
--arr: array source
--modStored : total amount of object that have modifier that will stored --in array + its modifier
Thanks, I'm sure I'll come back to this code for future reference. Thanks but I managed to work out a solution.
See scrrenshot of example. It get the first modifier in the stack and appends to the filename. And also names ON or OFF depending on if the modifiers enabled.
Attachments
Can...
someone tell me why this collected everything in the scene. I wanted to collect just objects with modifiers: