Issues with Duplicated Hierarchies

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  01 January 2014
Issues with Duplicated Hierarchies


I am working on a script to keep track of the material overrides for layers. The script works fine, but when I have a scene that has duplicated hierarchies, things become problematic.

Here's a quick setup:

  1. Take a scene and add a cube. Then make the cube a child of another object (I used a locator for the example).
  2. Duplicate the locator
It appears that Maya 2014 will not change the name of the children of the duplicated objects. So, I get this in my scene:


While performing an ls in the scripting editor, I get "locator1|pCube1"and "locator2|pCube1". That's fine and there's no problem. The problem begins with editRenderLayerAdjustment.

If I try to query with editRenderLayerAdjustment, and plug the results in PyMel, I get an error because editRenderLayerAdjustment does not prepend the name of the parent onto the adjustment, and Maya cannot decide which attribute belongs to which object because it is only providing the name of the object + the attribute (for example, pCube1.attributeName).

Has anyone run into issues like this before? If so, what are solutions that you have come up with? Thanks!
  01 January 2014
I have never understood why some maya commands do not return unique names. And "editRenderLayerAdjustment" is one of those commands. I guess the work around is going to depend on what you are trying to do. For the example you gave, you could just list the connection on the renderLayer... for example

import pymel.core as pm
rl = pm.PyNode('layer1')
# Result: [Attribute(u'blinn1.color'),
 Attribute(u'group3|pSphere1.inheritsTransform')] # 

  01 January 2014

I was originally using listAjustments() on the RenderLayer nodetype, but it looks like I'll have to roll my own function to make that safe. I'll check out your suggestion and cross my fingers.

Also, in case you're wondering, the offending code looks something like this:

from pymel.core import *
 render_layer = nt.RenderLayer("layer1")
 for get_adjustment in render_layer.listAdjustments():
 	print get_adjustment
  01 January 2014
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:51 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.