ValueMap.Get operator

Introduced

v9.0 (2011)

Categories

ICE Shaders

Description

Returns the value that matches the specified name.

Warning: If the value is undefined, this method throws an error. You can work around this limitation by accessing the names and values array using the same index (see the example below).

Scripting Syntax

oReturn = ValueMap.Get( in_name );

Parameters

Parameter Type Description
in_name String The name of the value to retrieve.

Examples

1. Python Example

# See the example under the ValueMap.Remove method

2. Python Example

#
# 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

See Also

ValueMap.Set ValueMap.Names ValueMap.Values