CGTalk > Software > Autodesk Maya
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 01-10-2014, 01:06 AM   #1
New Member
Join Date: Jan 2014
Posts: 2
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:

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!
Old 01-10-2014, 02:12 PM   #2
Where's my pony?
djx's Avatar
David Johnson
vfx & creature td
Melbourne, Australia
Join Date: Jun 2003
Posts: 3,564
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')] #

Old 01-10-2014, 04:49 PM   #3
New Member
Join Date: Jan 2014
Posts: 2

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
Old 01-10-2014, 04:49 PM   #4
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:41 PM.

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