Base Classes

Base Classes — Aspose.3D FOSS for Java

Пакет: com.aspose.threed (aspose-3d-foss 26.1.0)

Ці три класи утворюють основу ієрархії класів Aspose.3D. Кожен публічний об’єкт у бібліотеці успадковується від A3DObject, який надає ім’я та динамічну колекцію властивостей. SceneObject розширює A3DObject з відстеженням членства у сцені. CustomObject є легковаговим конкретним підкласом для зберігання довільних метаданих користувача.


A3DObject

Кореневий базовий клас для всіх керованих об’єктів Aspose.3D. Кожен іменований об’єкт у бібліотеці — Node, Mesh, AnimationClip, Material, і так далі – успадковується від A3DObject.

import com.aspose.threed.A3DObject;

Example

ClassDescription
A3DObjectRoot base class for all Aspose.3D managed objects. Provides a name property and a Properties collection for user-defined metadata.
SceneObjectBase class shared by Node and Entity . Provides the property collection interface used for user-defined metadata.
CustomObjectLightweight A3DObject subclass that carries only a name and an arbitrary PropertyCollection . Used for storing user-defined metadata on scene objects.
EntityBase class for all scene entities ( Mesh , Camera , Light , etc.). Attached to a Node via Node.addEntity() .
DeformerBase class for deformers that modify mesh geometry (e.g., skinning, morph targets).

Example

findProperty(String propertyName)

Шукайте іменовану властивість у цьому об’єкті PropertyCollection і поверніть Property екземпляр, або null якщо не знайдено.

Повертає: Property або 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)

Повернути поточне значення іменованої властивості, або null якщо властивість не існує.

Повертає: Object

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

setProperty(String property, Object value)

Встановлює значення іменованої властивості. Створює властивість, якщо вона ще не існує.

Повертає: void

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

removeProperty(String property)

Видаляє іменовану властивість із колекції.

Повертає: booleantrue якщо властивість була знайдена та видалена.


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

Example A3DObject з посиланням на власника Scene. Node, Entity, і пов’язані класи успадковують від SceneObject.

import com.aspose.threed.SceneObject;

Example

A3DObject -> SceneObject

Додаткова властивість

import com.aspose.threed.Scene;

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

CustomObject

Легковаговий конкретний підклас A3DObject яка містить лише ім’я та довільне PropertyCollection. Використовуйте його, щоб прикріпити вільно-формовані метадані до сцени без підкласування будь-якого типу сутності.

import com.aspose.threed.CustomObject;

Example

A3DObject -> CustomObject

Example

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

Див. також

 Українська