Notifications
Clear all
[Closed] How can I improve this script?
Jun 13, 2011 9:27 pm
I have written a script that copies one object in a scene and renames it…which is great.
The problem is I think it’s bloated. I had to add the count check because it loops endlessly if I don’t. How can this be optimized?
(
a = objects.count
i=1
for o in objects do
(
if i <= a do
(
select o
myName = o.name
b = copy o
b.name="Copy_" + myName
i+=1
)
)
)
Thanks!
2 Replies
1 Reply
copies = for node in (objects as array) collect (copy node name:("Copy_" + node.name))
it does do what you want and collects all new copies…
other way to do it is to use clone method… see mxs help -> [color=white]Collapse and Clone Nodes[/color]
Jun 13, 2011 9:27 pm
damn…you are the master, denisT. Thanks man.
Thanks for tip on Collapse as well. It looks like there is some awesome stuff in there!
Cheers