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().

ParameterTypeDescription
nameStringProperty name
valueObjectInitial value (optional)

Properties

NameTypeGetterSetterDescription
nameStringgetName()Read-only name of the property
valueObjectgetValue()setValue(Object)Current value; readable and writable
valueTypeClass<?>getValueType()Java Class of the current value

Methods

MethodReturn TypeDescription
getExtra(String name)ObjectGets a named extra metadata field stored on this property
setExtra(String name, Object value)voidSets a named extra metadata field
getBindPoint(AnimationNode anim, boolean create)BindPointReturns the animation bind point for this property in the given AnimationNode; pass true to create one if absent
getKeyframeSequence(AnimationNode anim, boolean create)KeyframeSequenceReturns 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"
}

See Also