ValueMap
 
 
 

ValueMap

Object Hierarchy | Related C++ Class: ValueMap

Inheritance

SIObject

ValueMap

Introduced

v9.0 (2011)

Description

A Value Map is set of name-value pairs defined for a ShaderDef, a ShaderParamDef, a ShaderArrayParamDef, or a MetaShaderRendererDef. This is the equivalent of a dictionary or associative array.

Tip: There is no Count property implemented on this object, so if you want to access the number of entries (for example, if you wanted to iterate over the entire set), you should use the ValueMap.Names property to get the list of names defined in this ValueMap and then get the length of that safeArray.

Methods

Get operator IsClassOf operator IsEqualTo operator Remove operator
Set operator      
       

Properties

Application Categories FullName operator Help
Name operator Names operator NestedObjects Origin
OriginPath Parent Type operator Values operator

Examples

1. Python Example

# See the example under the ValueMap.Remove method

2. JScript Example

/* 
        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

See Also

ShaderDef.Attributes ShaderParamDef.Attributes ShaderArrayParamDef.ItemInitialValues MetaShaderRendererDef.RendererOptions