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; pass 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"
}

ראה גם

 עברית