A3DObject / SceneObject / CustomObject

A3DObject, SceneObject, CustomObject — Aspose.3D FOSS for Java

Package: com.aspose.threed (aspose-3d-foss 26.1.0)

These three classes form the base of the Aspose.3D class hierarchy. Every public object in the library inherits from A3DObject, which provides a name and a dynamic property collection. SceneObject extends A3DObject with scene membership tracking. CustomObject is a lightweight concrete subclass for storing arbitrary user metadata.


A3DObject

The root base class for all Aspose.3D managed objects. Every named object in the library – Node, Mesh, AnimationClip, Material, and so on – inherits from A3DObject.

import com.aspose.threed.A3DObject;

Properties

PropertyTypeGetterSetterDescription
nameStringgetName()setName(String)Human-readable name of the object. Defaults to an empty string.
propertiesPropertyCollectiongetProperties()The dynamic property collection attached to this object. Iterate it or use findProperty() for named lookups.

Methods

findProperty(String propertyName)

Search for a named property in this object’s PropertyCollection and return the Property instance, or null if not found.

ParameterTypeDescription
propertyNameStringThe name to search for.

Returns: Property or null

import com.aspose.threed.Scene;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("origin");
Property prop = node.findProperty("name");
if (prop != null) {
    System.out.println(prop.getValue());   // "origin"
}

getProperty(String property)

Return the current value of a named property, or null if the property does not exist.

ParameterTypeDescription
propertyStringProperty name.

Returns: Object

Object val = node.getProperty("name");
System.out.println(val);   // "origin"

setProperty(String property, Object value)

Set the value of a named property. Creates the property if it does not already exist.

ParameterTypeDescription
propertyStringProperty name.
valueObjectNew value.

Returns: void

node.setProperty("layer", 3);
System.out.println(node.getProperty("layer"));   // 3

removeProperty(String property)

Remove a named property from the collection.

ParameterTypeDescription
propertyString or PropertyProperty name or Property instance to remove.

Returns: booleantrue if the property was found and removed.


Example

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

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

// Set and retrieve a custom property
node.setProperty("export_lod", 2);
System.out.println(node.getProperty("export_lod"));   // 2

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

// Find and inspect a specific property
Property p = node.findProperty("name");
if (p != null) {
    System.out.println(p.getValueType());   // java.lang.String
}

SceneObject

Extends A3DObject with a reference to the owning Scene. Node, Entity, and related classes inherit from SceneObject.

import com.aspose.threed.SceneObject;

Inheritance

A3DObject -> SceneObject

Additional property

PropertyTypeGetterSetterDescription
sceneScenegetScene()setScene(Scene)The Scene this object belongs to, or null if not yet attached.
import com.aspose.threed.Scene;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("child");
System.out.println(node.getScene() == scene);   // true

CustomObject

A lightweight concrete subclass of A3DObject that carries only a name and an arbitrary PropertyCollection. Use it to attach free-form metadata to a scene without subclassing any entity type.

import com.aspose.threed.CustomObject;

Inheritance

A3DObject -> CustomObject

Constructor

CustomObject()
CustomObject(String name)

Example

import com.aspose.threed.CustomObject;
import com.aspose.threed.Scene;

// Attach pipeline metadata to a scene as a custom object
CustomObject meta = new CustomObject("render_settings");
meta.setProperty("max_bounces", 8);
meta.setProperty("use_denoiser", true);

Scene scene = new Scene();
scene.getRootNode().setProperty("render_meta", meta.getName());
System.out.println(meta.getProperty("max_bounces"));   // 8

See Also