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 CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2014
Issues with Duplicated Hierarchies

Hello,

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:

locator1
   ->pCube1
   locator2
   >pCube1


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')
rl.adjustments.connections(p=True)
# Result: [Attribute(u'blinn1.color'),
 Attribute(u'group1|pSphere1.inheritsTransform'),
 Attribute(u'group2|pSphere1.inheritsTransform'),
 Attribute(u'group3|pSphere1.inheritsTransform')] # 


David
__________________
http://www.djx.com.au
 
  01 January 2014
Thanks!

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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 12:27 PM.


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