This is working fine. But can you give me one more example to connect 
something to an attribute? for example, if I want to connect a ramp or 
aiNoise to weight. Thanks in advance.

On Tuesday, June 26, 2018 at 9:39:16 AM UTC+5:30, Michael Boon wrote:
>
> I don't have Arnold installed here so I can't help a whole lot, but I can 
> use very similar script to set "diffuse" on a Lambert material. This works 
> for me:
> import pymel.core as pm
> name = 'CHROME'
> shaderType = 'lambert'
> name = pm.shadingNode(shaderType, asShader=True,  name=name)
> sg = pm.sets(renderable=True, noSurfaceShader=True, empty=True, name=
> '%sSG' %(name))
> pm.setAttr('%s.diffuse' %(name),0.25)
>
> I'd be looking at the attribute name. Is 'kd' a valid attribute on a 
> aiStandard material node? Maybe create the node and set the attribute using 
> Hypershade, then look in the Script Editor and see what MEL commands have 
> been printed.
>
>
> On Tuesday, 26 June 2018 13:46:39 UTC+10, AMAL ARJUN wrote:
>>
>> Not working. Still getting an error "# MayaAttributeError: Maya Attribute 
>> does not exist (or is not unique):: u'CHROME3.kd' # "
>>
>>
>> Script here:
>>
>> def createShader(shaderType='aiStandard', name='CHROME', shaderOutput = 
>> 'sg'):
>>     
>>     
>>     
>> #pm.setAttr('%s.%s.kd' %(name,shaderOutput),0.25) 
>> if name == '':
>> name = shaderType
>>     name = pm.shadingNode(shaderType, asShader=True,  name=name)
>>     sg = pm.sets(renderable=True, noSurfaceShader=True, empty=True, 
>> name='%sSG' %(name))
>>     pm.setAttr('%s.kd' %(name),0.25)
>>
>>
>>
>> please help
>>
>> On Friday, June 22, 2018 at 5:25:17 PM UTC+5:30, vince touache wrote:
>>>
>>> def createShader(shaderType='aiStandard', name='CHROME'):         
>>>             name = pm.shadingNode(shaderType, asShader=True,  name=name 
>>> or shaderType) 
>>>             sg = pm.sets(renderable=True, noSurfaceShader=True, 
>>> empty=True, name='%sSG' %(name)) 
>>>         pm.setAttr('%s.weight' %(name),0.25)        
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c486c41a-eefd-460c-b1b4-430dfcc46c6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to