ValueMap.Get operator

導入

v9.0 (2011)

カテゴリ

ICE シェーダ

詳細

指定された名前に一致する値を戻します。

警告:値が定義されていない場合は、このメソッドはエラーを発生させます。この制限を回避するには、同じインデックスを使用して名前と値の配列にアクセスします(以下の例を参照)。

スクリプト 構文

oReturn = ValueMap.Get( in_name );

パラメータ

パラメータ タイプ 詳細
in_name String 取得する値の名前。

1. Python の例

# See the example under the ValueMap.Remove method

2. Python の例

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

関連項目

ValueMap.Set ValueMap.Names ValueMap.Values