This is perfect!!! I have been trying to solve this problem by running some 
functions in line (procedurally) and having a call to all VRayMtls and 
adding vray_material_id to them all then executing another function to 
assign appropriate IDs to VRayMtls.

E.g.,

assignVrayMaterialIDs()
assignCustomIDsToMaterials()

but your solution using the format() method is soooo much better!!!

Thanks!
Dillon

On Monday, November 4, 2013 4:34:58 AM UTC-5, johan Borgström wrote:
>
> Hi,
>
> I ended up using the snippet from my previous post. And it seems to work 
> great. Thanks for all input. Here is the snippet for completion of the 
> thread.
> (Out of curiosity, is it possible to mark your own post as complete ?)
>
> mat = 'VRayMtl1'
> id = 4
> mel.eval('vray addAttributesFromGroup {0} vray_material_id 1;'.format(mat
> ))
> mel.eval('vrayAddAttr {0} vrayMaterialId;'.format(mat))
> cmds.setAttr (('{0}.vrayMaterialId'.format(mat)), id)
>
> Best Regards,
> Johan
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4f5c5b0e-fcbc-4580-9fdf-99bd3c5bd6f2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to