Property — Aspose.3D FOSS for Java
Overview
Property represents a single named, typed metadata field attached to any A3DObject (including Node, Mesh, AnimationClip, etc.). Properties are accessed through the PropertyCollection returned by obj.getProperties(). You can read, write, and enumerate properties to store user-defined data alongside scene elements.
Package: com.aspose.threed
import com.aspose.threed.Property;Constructor
Property objects are not normally constructed directly by application code. They are created by calling A3DObject.getProperty() or found via A3DObject.findProperty().
| Parameter | Type | Description |
|---|---|---|
name | String | Property name |
value | Object | Initial value (optional) |
Properties
| Name | Type | Getter | Setter | Description |
|---|---|---|---|---|
name | String | getName() | – | Read-only name of the property |
value | Object | getValue() | setValue(Object) | Current value; readable and writable |
valueType | Class<?> | getValueType() | – | Java Class of the current value |
Methods
| Method | Return Type | Description |
|---|---|---|
getExtra(String name) | Object | Gets a named extra metadata field stored on this property |
setExtra(String name, Object value) | void | Sets a named extra metadata field |
getBindPoint(AnimationNode anim, boolean create) | BindPoint | Returns the animation bind point for this property in the given AnimationNode; pass true to create one if absent |
getKeyframeSequence(AnimationNode anim, boolean create) | KeyframeSequence | Returns the keyframe sequence for this property in the given 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"
}