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().
| Example | Example | Example |
|---|---|---|
name | String | שם המאפיין |
value | Object | ערך ראשוני (אופציונלי) |
Example
| Example | Example | Example | Example | Example |
|---|---|---|---|---|
name | String | getName() | – | שם קריאה בלבד של המאפיין |
value | Object | getValue() | setValue(Object) | ערך נוכחי; ניתן לקריאה ולכתיבה |
valueType | Class<?> | 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"
}