PDA

View Full Version : request: auto layer setup


hibb
09-27-2009, 01:23 AM
hi, is there a way if u put objects to a eg. null object assigned to a specific layer, the child objects become the same layer automatically?

thanks in advance

MAN0
10-01-2009, 02:33 PM
sry for my impatience, but is there a way to do this? i guess this is pretty simple, but im just too unexperienced with xpresso or even coding.

kvb
10-01-2009, 03:22 PM
You can ctrl+drag the parent into the layer browser and it will include the children objects in that layer as well.

kvb

hibb
10-01-2009, 07:18 PM
thx for answer mate but i already know this :( i was lookin for an automatic solution :shrug:

Scott Ayers
10-02-2009, 10:01 PM
It's pretty strange how some people get lots of replies for questions. While others get completely ignored. Especially in such a slow forum as this one.:shrug:

I felt sorry for you not getting any help. So here's a quick bit of code to get you started.
It's very simple and crude. So if you need undo's and a more robust way of determing how objects get handled. I can't help because I'm just a novice with C.O.F.F.E.E.
I truthfully only know enough code to be dangerous.:blush:

-Open your script editor window.
-Create a new script and give it a name.
-Then copy and paste this code into the window. Then press the "Save All" button.
-Follow the directions at the top of the script to use it.

Maybe someone else could add error checking and undo's to it for you if you really need them.

// This very simple script makes an object the child of the next object down in the hierarchy
// Make sure the object is selected before running the script so it knows which object it needs to move
// After the object is moved. It will then add it to whatever layer is currently active
// There are no error checking or undo functions in this. So if you make a mistake you can't use the undo function to fix it.


var obj= doc->GetActiveObject();
var n = op->GetNext();

op->Remove();
op->InsertUnder(n);

CallCommand(100004736); // Add object to currently selected Layer


-ScottA

hibb
10-03-2009, 04:32 PM
hi scott,

dont worry, usually i get fast answers in c4d forum :). thanks for the script. i go check it out now.

cheers,

hibb

CGTalk Moderation
10-03-2009, 04:32 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.