I'm confused.
You said that there can be one of these shaders in a scene yet you're
talking about figuring out which geo connects to different shaders? I'm not
even sure exactly what you're trying to do, determine what geo is connected
to each of these shaders?
If you have the geo selected, use listConnections to find out which
uber_surface each geo is connected to. If it's a surface shader, the
geoShape's shadingEngine would be connected to outColor of the
surfaceShader. Compare the list returned by cmds.ls("*.iorFr") with
connected shaders. Wouldn't that solve your problem?
On Wednesday, October 24, 2012 8:43:08 AM UTC-7, Berg Jones wrote:
>
> I tried using that for an attribute that I have called .iorFr (index of
> refraction fresnel) and while it did return the uber_surface1/2/3 it wont
> specifiy which of those shaders belongs to which object. If I use
>
> cmds.ls("*.iorFr", sl=1)
>
>
> it returns an empty list. I got rid of the mat=true because the node
> doesnt get picked up as a maya material.
>
> Now, for example, if I have 3 objs in the scene, each with a unique
> uber_surface and I select two of them (plane and a sphere) and I want to
> get the correct attached shader. If I do this I get all the uber_surfaces
> in the scene, but no specifics.
>
> import maya.cmds as cmds
>
> objNames = cmds.ls(sl=1)
>
> for i in objNames:
>
> print i
>
> selected_uber_surface = cmds.ls("*.iorFr")
>
> print selected_uber_surface
>
> pSphere3
>
> [u'uber_surface3.iorFr', u'uber_surface2.iorFr', u'uber_surface1.iorFr']
>
> plane
>
> [u'uber_surface3.iorFr', u'uber_surface2.iorFr', u'uber_surface1.iorFr']
>
>
> if I do this and try to drill down to the selected obj in the list
>
> import maya.cmds as cmds
>
> objNames = cmds.ls(sl=1)
>
> for i in objNames:
>
> print i
>
> selected_uber_surface = cmds.ls("*.iorFr", sl=1)
>
> print selected_uber_surface
>
> pSphere3
>
> []
>
> plane
>
> []
>
>
>
>
>
> On Wednesday, October 24, 2012 4:39:52 AM UTC-4, Jesse Capper wrote:
>>
>> Is the uber_surface a plugin node? Does it have a unique nodeType? If so
>> you can look up nodes of that nodeType.
>>
>> You wouldn't want to use .diffuse in that ls lookup since it's a common
>> attribute shared by multiple materials. You can add your own attribute to a
>> shader though, like .myUberSurface, and use that to identify the shader.
>>
>> Then this will return just that shader:
>> cmds.ls("*.myUberSurface", o=True, mat=True)
>>
>>>
>>>>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe