#
# This example demonstrates how to safely get a value,
# even if it's undefined
#
def GetValueIndex( in_name, in_map ) :
aNames = in_map.Names
aValues = in_map.Values
i=0
while i < len(in_map.Names) :
if (in_map.Names[i] == in_name) :
if (in_map.Values[i]) :
return i
i = i + 1
return -1
# Python example
app = Application
for shdef in app.ShaderDefinitions :
if (shdef.Attributes) :
if (len(shdef.Attributes.Names)) :
for n in shdef.Attributes.Names :
idx = GetValueIndex(n, shdef.Attributes)
app.LogMessage(shdef.Name+" has this attribute:\n\t- "+n+" == "+str(shdef.Attributes.Values[idx]))
else :
app.LogMessage("Could not get attributes for "+thing.Name)
# INFO : Softimage.soft_light.1.0 has this attribute:
# - {C535FA4D-E44A-45EB-AEE0-9F9AAEA91745} == None
# INFO : Softimage.material-lambert.1.0 has this attribute:
# - {C535FA4D-E44A-45EB-AEE0-9F9AAEA91745} == None
# INFO : Softimage.material-phong.1.0 has this attribute:
# - {C535FA4D-E44A-45EB-AEE0-9F9AAEA91745} == None
|