MAXON CINEMA 4D: Cinema 4D Forum Adobe After Effects Forum

Automatically assign parent layer to all child objects?

COW Forums : Maxon Cinema 4D

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
John WillardAutomatically assign parent layer to all child objects?
by on Apr 28, 2016 at 2:28:47 pm

I have a parent node with lots of child objects. All child objects must belong to the same layer as the parent node. This can be achieved by ctrl+dragging the layer to the parent node. However, is there way that whenever I drop new objects below the parent node, that they are *automatically* assigned to the parent layer?


Return to posts index

Brian JonesRe: Automatically assign parent layer to all child objects?
by on Apr 28, 2016 at 3:17:20 pm

if you click and hold on a layer icon in the OM the cursor turns into a paint brush and you can 'paint' the layer to other objects. (at least in 17, don't know when that behaviour started).


Return to posts index

John WillardRe: Automatically assign parent layer to all child objects?
by on Apr 28, 2016 at 3:53:06 pm

Yes, that's correct, but when there are lots of objects and children, then that procedure is too time consuming.


Return to posts index


alan farkasRe: Automatically assign parent layer to all child objects?
by on Apr 28, 2016 at 5:02:22 pm

Great Q for a thread. Can I add this to it:

If I Solo a Layer, and then Group a handful of objects (children of a Parent belonging to the layer even), the new Null/Group is no longer part of the Layer. Same goes if I create a MoInstance.

This is extremely time-consuming and inefficient in a workflow. Is there a workaround for this?

Hope it makes sense to have piggy-backed this thread, thx


Return to posts index

John WillardRe: Automatically assign parent layer to all child objects?
by on May 1, 2016 at 6:43:11 am
Last Edited By John Willard on May 1, 2016 at 7:24:01 am

I've found the solution to my problem, and that is to create an Xpresso tag and place it on the parent node (e.g. called "GEOMETRY" which is set to the "GEOMETRY" layer). In the Xpresso editor I've place two nodes, an object node and a python node. The object node outputs are Object and Layer. The python node inputs are inObject and inLayer. In the python node code I wrote this:

#This script will set the layer to every
#child object to the same layer as the
#parent object (the object which contains
#the xpresso tag)

import c4d

def SetChildLayers(inObj):
for child in inObj.GetChildren():
child.SetLayerObject(inLayer)
SetChildLayers(child) #recursive

def main():
SetChildLayers(inObject)


Now, any time I place objects under the GEOMETRY node, their layers will automatically be set to the GEOMETRY layer. This works perfectly and is a real time saver!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]