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

ראה גם

 עברית