Material.AddProperty

導入

v4.0

詳細

UserDataBlobまたはCustomPropertyを作成し、Material オブジェクトに追加します。

スクリプト 構文

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

戻り値

CustomPropertyUserDataBlobUserDataMapまたは(使用されたプリセットによる)

パラメータ

パラメータ タイプ 詳細
プリセット String この引数には、Property Preset の名前またはファイル名やプリセット ファイルへの完全パスを含む文字列が格納されます。

注: マテリアルには、CustomProperty PresetsUserDataBlob Presets、および UserDataMap Presets だけが有効です。

作成されるプロパティのタイプはこの引数により決定されます。たとえば、"CustomProperty" は空のCustomPropertyを作成し、"UserDataBlob" はUserDataBlobを作成します。
BranchFlag Boolean False は、唯一のサポートされる値です。

デフォルト値: False

Name String 新しいプロパティの名前を表します(SIObject.Nameを参照)。名前を指定しない場合には、オブジェクトは Preset引数に基づいて名前が付けられます。

JScript の例

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

関連項目

SceneItem.AddProperty Material.Properties