Property — Aspose.3D FOSS for Java

Example

Property 任意の対象に付随する、単一の名前付きで型付けされたメタデータフィールドを表します A3DObject (含む Node, Mesh, AnimationClip,、等)。プロパティは以下を通じてアクセスされます PropertyCollection が返す obj.getProperties().。プロパティを読み取り、書き込み、列挙することで、シーン要素と共にユーザー定義データを保存できます。.

Example: com.aspose.threed

import com.aspose.threed.Property;

Example

Property オブジェクトは通常、アプリケーションコードから直接構築されません。呼び出すことで作成されます A3DObject.getProperty() または、~を介して見つけられます A3DObject.findProperty().

ExampleExampleExample
nameStringプロパティ名
valueObject初期値(オプション)

Example

ExampleExampleExampleExampleExample
nameStringgetName()プロパティの読み取り専用名
valueObjectgetValue()setValue(Object)現在の値;読み取り可能で書き込み可能
valueTypeClass<?>getValueType()Java Class 現在の値の

Example

Example戻り値の型Example
getExtra(String name)Objectこのプロパティに格納されている名前付きの追加メタデータフィールドを取得します
setExtra(String name, Object value)void名前付きの追加メタデータフィールドを設定します
getBindPoint(AnimationNode anim, boolean create)BindPoint与えられた条件でこのプロパティのアニメーションバインドポイントを返します AnimationNode; パス true 存在しない場合は作成します
getKeyframeSequence(AnimationNode anim, boolean create)KeyframeSequence与えられた条件でこのプロパティのキーフレームシーケンスを返します AnimationNode

Example

import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.Property;
import com.aspose.threed.PropertyCollection;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("tagged_node");

// Access the property collection
PropertyCollection props = node.getProperties();

// Get a property by name (read raw value)
Object val = node.getProperty("name");
System.out.println(val);   // "tagged_node"

// Find a property object
Property prop = node.findProperty("name");
if (prop != null) {
    System.out.println(prop.getName());         // "name"
    System.out.println(prop.getValue());        // "tagged_node"
    System.out.println(prop.getValueType());    // class java.lang.String
}

// Enumerate all properties
for (Property p : props) {
    System.out.println("  " + p.getName() + " = " + p.getValue());
}

// Store a custom value on a property (extra metadata)
if (prop != null) {
    prop.setExtra("ui_label", "Scene Origin Node");
    Object label = prop.getExtra("ui_label");
    System.out.println(label);   // "Scene Origin Node"
}

参照

 日本語