How Can We Help?

aiUserData – Tips

You are here:
< Back to Wiki

In order for Arnold use use a with a custom attribute the attribute needs:

  • Attribute name starts with mtoa_constant_*customName*
  • Added to the shape node not the transform.
  • aiUserDataInt piped into your material nodes only used the *customName* portion.

Example
I have a geo piece named :

  • Box01
    • Box01.shape
      • Extra Attribute
        • mtoa_constant_textureSelect
  • AiSwitch01 INT node I want to change
    • Attribute
      • textureSelect
//To add these to a lot of mesh objects use the script below

import pymel.core as pmc

peoples = pmc.selected()

for people in peoples:
    people.select()
    peopleShape = pmc.listRelatives(people, children=True, shapes=True, type="mesh")

    try:
        peopleShape =  pmc.addAttr(peopleShape,at='long', ln='mtoa_constant_textureSelect', nn='Texture Select')
        print ( "Added: " + peopleShape )
    except:
		print ( "FAILED: " + peopleShape )	
        pass

Type of attributes
https://help.autodesk.com/cloudhelp/2017/ENU/Maya-Tech-Docs/CommandsPython/addAttr.html

Leave a Reply

Table of Contents