PDA

View Full Version : Flip hierarchy in OM?


Newstream
11-05-2006, 03:26 PM
Hi Gang,

Lets say you're setting up a bunch of profile splines to go under a LoftNurbs object or...inside a ClonerObject and you suddenly realize that the splines are in the wrong order and need to be reversed. Apart from manually dragging them in the desired order, is there a quicker way / script / plugin / technique to vertically mirror the order in the hierarchy and thereby save time?

http://www.badtastic.com/misc/hierarchy.jpg

Tips highly appreciated :)

Cheers / Alex

Kuroyume0161
11-05-2006, 03:56 PM
A simple COFFEE plug should handle that.

* Get the selected root object
* Go through the children (top to bottom is default), remove, insert (at end).
* Hey presto, they are reversed. :)

Add this to a COFFEE tag on the root object:

main(doc,op)
{
var obj;
var next;
for (obj = op->GetDown(); obj; obj = obj->GetNext())
{
if (!obj->GetNext()) break;
}
var last = obj;
for (obj = op->GetDown(); obj; obj = next)
{
next = obj->GetNext();
obj->Remove();
doc->InsertObject(obj, op, NULL);
if (obj == last) break;
}
}

And "Execute"

tonare
11-05-2006, 04:09 PM
Very cool, Robert!
Thanks.:D

Newstream
11-05-2006, 06:52 PM
Hey Thanks a lot Robert :thumbsup:

I took the liberty of adding an icon to your script so that one can dock it into the UI or add a keyboard shortcut.

http://www.badtastic.com/misc/hierarchy2.jpg

It can be downloaded from here (http://www.badtastic.com/misc/script.zip)

Cheers / Alex

Kuroyume0161
11-05-2006, 07:25 PM
Cool! Thanks, Alex!

I don't play with COFFEE too much and especially not the Script Manager. :)

Robert

CGTalk Moderation
11-05-2006, 07:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.