Object Hierarchy | 関連する C++クラス:ValueMap
ValueMap
v9.0 (2011)
ICE シェーダ
値マップはShaderDef、ShaderParamDef、ShaderArrayParamDef、またはMetaShaderRendererDefのために定義される名前と値の組み合わせのセットです。これは辞書または連想配列と同等です。
ヒント:このオブジェクトには Count
プロパティが実装されないため、エントリ数にアクセスする場合(セット全体に繰り返し処理行いたい場合など)は、ValueMap.Namesプロパティを使用してこの ValueMap
に定義されている名前のリストを取得してから、その SafeArrayの長さを取得する必要があります。
# See the example under the ValueMap.Remove method |
/*
This example demonstrates how to iterate over the ValueMap items
and extract the name-value pairs
*/
var app = Application;
var e = new Enumerator(app.ShaderDefinitions);
for (; !e.atEnd(); e.moveNext()) {
var oShaderDef = e.item();
if (oShaderDef.Attributes) {
// Get the list of names
var vbaNames = new VBArray(oShaderDef.Attributes.Names);
var aNames = vbaNames.toArray();
if (aNames.length) {
// Get the list of values
var vbaValues = new VBArray(oShaderDef.Attributes.Values);
var aValues = vbaValues.toArray();
app.LogMessage(oShaderDef.Name+" has "+aNames.length+" attribute name(s) and "+aValues.length+" value(s):");
for (var i=0; i<aNames.length; i++) {
var sName = aNames[i];
app.LogMessage("\t- "+sName+" == "+aValues[i]);
}
}
}
}
// INFO : Softimage.soft_light.1.0 has 1 attribute name(s) and 1 value(s):
// INFO : - {C535FA4D-E44A-45EB-AEE0-9F9AAEA91745} == undefined
// INFO : Softimage.material-lambert.1.0 has 1 attribute name(s) and 1 value(s):
// INFO : - {C535FA4D-E44A-45EB-AEE0-9F9AAEA91745} == undefined
// INFO : Softimage.material-phong.1.0 has 1 attribute name(s) and 1 value(s):
// INFO : - {C535FA4D-E44A-45EB-AEE0-9F9AAEA91745} == undefined
|