Material.AddProperty

Introduced

v4.0

Description

Creates and adds a UserDataBlob or CustomProperty to a Material object.

C# Syntax

Property Material.AddProperty( Object in_Preset, Boolean in_Branch, String in_name );

Scripting Syntax

oReturn = Material.AddProperty( Preset, [BranchFlag], [Name] );

Return Value

CustomProperty, UserDataBlob or UserDataMap, depending on the preset that was used.

Parameters

Parameter Type Description
Preset String This argument contains either the name of a Property Preset or a string with the filename or full path to a Preset file.

Note: Only CustomProperty Presets, UserDataBlob Presets, and UserDataMap Presets are valid for materials.

The type of property that is created is determined by this argument. For example, "CustomProperty" creates an empty CustomProperty and "UserDataBlob" creates a UserDataBlob.
BranchFlag Boolean False is the only supported value.

Default Value: False

Name String The name of the new property (see SIObject.Name). If no name is specified, the object is named based on the Preset argument.

Examples

JScript Example

/*
	This example shows how to add a CustomProperty to a Material
*/
NewScene( null,false ) ;
var oCone = ActiveSceneRoot.AddGeometry( "Cone", "MeshSurface" );
var oMaterial = oCone.AddMaterial( "Phong" );
// Annotation is a specific CustomProperty that is shipped with Softimage
var oMaterialPSet = oMaterial.AddProperty( "Annotation", false, "MaterialAnnotation" );
oMaterialPSet.Parameters("text").Value = "Annotation under a Material"
// You can access any CustomProperty under the Material using Material.Properties
Application.LogMessage( "Contents of annotation: " + oCone.Material.Properties("MaterialAnnotation").Text.Value ) ;
// Expected Results:
// INFO : "Contents of annotation: Annotation under a Material"

See Also

SceneItem.AddProperty Material.Properties