Re: [Maya-Python] getting a node's typeID

2010-09-24 Thread Jan Berger


I`m not sure I have enough info to give specific advice, I presume 
the node may not exist that you want to get the typeId for?
If MDGModifier does not do the job how about just creating one and 
then use MGlobal::deleteNode() to get rid of it?

Just a thought...

At 09:56 PM 9/22/2010, you wrote:


On Sep 22, 2010, at 9:39 PM, Jan Berger wrote:



there is MFnDependencyNode::typeId()
to get it for a specific node type I guess one would need to use 
the create function beforehand


yes, it's not a static/class method so the MFnDependencyNode class 
needs to be instantiated to use that method... meaning you need an 
existing node.  i've done some very nasty things using dg modifiers 
to create ghosedt nodes that do not yet exist to find out their 
type, the revert the dgmod, but i'd rather not have to do that.


-chad






At 08:26 PM 9/22/2010, you wrote:
i've searched for this before without avail, but it's biting me 
again in a different context, so i thought i'd check:


is there a way to get the typeId of a node without having an 
existing instance of the node?


i would expect a static method on MFnDependencyNode, like the following:

MFnDependencyNode.getTypeId('transform')

but i can't find anything

-chad


--
http://groups.google.com/group/python_inside_maya


Jan Berger
mailto:j...@janberger.dej...@janberger.de :: www.janberger.de

--
http://groups.google.com/group/python_inside_mayahttp://groups.google.com/group/python_inside_maya


--
http://groups.google.com/group/python_inside_maya


Jan Berger
j...@janberger.de :: www.janberger.de  


--
http://groups.google.com/group/python_inside_maya

Re: [Maya-Python] Re: render layer overrides

2010-09-24 Thread Dave Nunez
Hey guys, thanks for the help and this is the cmd that I was looking for:

rlayer = 'layer2'
rlOvrs = cmds.listConnections(rlayer + '.adjustments', p=True, c=True)


Cheers, -d


Should have paid closer attention to the hypergraph connections. :P



On Sat, Sep 4, 2010 at 4:24 PM, damon shelton damondshel...@gmail.com wrote:
 are you running :
 cmds.getAttr('layername.attributeOverrideScript')

 maybe try
 cmds.getAttr('layername.attributeOverrideScript, asString = True')

 I actually never seem to get any info when I use the
 cmds.editRenderLayerAdjustment


 On Sat, Sep 4, 2010 at 11:25 AM, Jesse Capper jesse.cap...@gmail.com
 wrote:

 Right, though I'm still getting nothing.
 I've got layer overrides enabled for multiple objects,
 cmds.editRenderLayerAdjustment will return overrides, I can see
 connections between the overridden attributes and the adj.plug
 attribute of the render layer, but still nothing from
 'renderLayer.attributeOverrideScript'.



 On Sep 4, 11:14 am, damon shelton damondshel...@gmail.com wrote:
  Jesse,
  the attribute override script will return None if there are no overrides
  turned on or off
  **so if all overrides are set to Scene(default)
 
  once you turn one of the attributes on, it adds that attribute=0 or
  attribute =1 to the attributeOverrideScript attr which is a string
  attribute
 
  On Fri, Sep 3, 2010 at 10:31 PM, Jesse Capper
  jesse.cap...@gmail.comwrote:
 
 
 
   Damon, I've never been able to get the attributeOverrideScript
   attribute to return anything but a None type :/
 
   Dave, check out the renderLayer attribute 'adjustments'.  It's a
   compound attribute with two child (is that the right word?) attrs
   'plug' and 'value':
 
      'plug' will return the connected attribute's current value
      'value' will return the attribute's render layer override value
 
   You can get all render layer overrides and their adjustment index by
   doing a listConnections on renderLayer.adjustments.  Someone might be
   able to tell you a cleaner way to do this, but it works for me (this
   is what I think renderLayer.attributeOverrideScript should do, but
   that just returns None for me)
 
   ###
   rlayer = 'layer1'
   rlOvrs = cmds.listConnections(rlayer + '.adjustments', p=True, c=True)
   for i in range(0, len(rlOvrs), 2):
      rlConn = rlOvrs[i]  # returns 'layer1.adjustments[#].plug'
      ovrAttr = rlOvrs[i+1]
      ovrIndex = rlConn.split(']')[0]
      ovrIndex = ovrIndex.split('[')[-1]
 
      ovrVal = cmds.getAttr(rlayer + '.adjustments[%s].value' %
   ovrIndex)
 
      print '%s = %s' % (ovrAttr, ovrVal)
 
   On Sep 3, 10:48 am, Dave Nunez nun...@gmail.com wrote:
Hey guys, have been trying to query layer overrides attrs and I
can't
find where the attribute overrides are.
 
from the docs,
 
# Query the current layer for the list of adjustments
cmds.editRenderLayerAdjustment( query=True, alg=True )
# castsShadows         nurbsSphereShape1.castsShadows
#                      pPlaneShape1.castsShadows
#                      pSphereShape1.castsShadows
# instObjGroups        pCylinderShape1.instObjGroups[0]
# motionBlurByFrame    defaultRenderGlobals.motionBlurByFrame
# receiveShadows       nurbsSphereShape1.receiveShadows
#                      pPlaneShape1.receiveShadows
#                      pSphereShape1.receiveShadows
# shadingSamples       defaultRenderQuality.shadingSamples
 
so from the example above, how would I get the
pPlaneShape1.castsShadows attr for that render layer.
 
I could switch layers using the gui and get the attrs that way but
that would take a long time.
 
Cheers, -d
 
--
When things get too complicated, it sometimes makes sense to stop
and
wonder: Have I asked the right question?
-Enrico Bombieri
 
   --
  http://groups.google.com/group/python_inside_maya

 --
 http://groups.google.com/group/python_inside_maya

 --
 http://groups.google.com/group/python_inside_maya



-- 
When things get too complicated, it sometimes makes sense to stop and
wonder: Have I asked the right question?
-Enrico Bombieri

-- 
http://groups.google.com/group/python_inside_maya