A3DObject, SceneObject, CustomObject — Aspose.3D FOSS for Java
Paketas: com.aspose.threed (aspose-3d-foss 26.1.0)
Šios trys klasės sudaro Aspose.3D klasės hierarchijos pagrindą. Kiekvienas viešas objektas bibliotekoje paveldi iš A3DObject, kuri suteikia pavadinimą ir dinaminę savybių kolekciją. SceneObject plečia A3DObject su scenos narystės sekimu. CustomObject yra lengvas konkretus po‑klasis, skirtas saugoti bet kokius naudotojo metaduomenis.
A3DObject
Pagrindinė bazinė klasė visiems Aspose.3D valdomiems objektams. Kiekvienas pavadintas objektas bibliotekoje — Node, Mesh, AnimationClip, Material, ir t.t. – paveldi iš A3DObject.
import com.aspose.threed.A3DObject;Example
| Example | Example | Example | Example | Example |
|---|---|---|---|---|
name | String | getName() | setName(String) | Žmogui skaitomas objekto pavadinimas. Pagal numatytuosius nustatymus – tuščia eilutė. |
properties | PropertyCollection | getProperties() | – | Dinaminė savybių kolekcija, prisegta prie šio objekto. Iteruokite ją arba naudokite findProperty() pavadinimų paieškai. |
Example
findProperty(String propertyName)
Ieškokite pavadintos savybės šiame objekte PropertyCollection ir grąžinkite Property instance, arba null jei nerasta.
| Example | Example | Example |
|---|---|---|
propertyName | String | Vardas, kurio ieškoti. |
Grąžina: Property arba 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)
Grąžinkite nurodytos savybės dabartinę reikšmę, arba null jei savybės nėra.
| Example | Example | Example |
|---|---|---|
property | String | Savybės pavadinimas. |
Grąžina: Object
Object val = node.getProperty("name");
System.out.println(val); // "origin"setProperty(String property, Object value)
Nustato pavadintos savybės reikšmę. Sukuria savybę, jei ji dar neegzistuoja.
| Example | Example | Example |
|---|---|---|
property | String | Savybės pavadinimas. |
value | Object | Nauja reikšmė. |
Grąžina: void
node.setProperty("layer", 3);
System.out.println(node.getProperty("layer")); // 3removeProperty(String property)
Pašalina pavadintą savybę iš kolekcijos.
| Example | Example | Example |
|---|---|---|
property | String arba Property | Savybės pavadinimas arba Property objektas pašalinimui. |
Grąžina: boolean – true jei savybė buvo rasta ir pašalinta.
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 su nuoroda į savininką Scene. Node, Entity, ir susijusios klasės paveldi iš SceneObject.
import com.aspose.threed.SceneObject;Example
A3DObject -> SceneObject
Papildoma savybė
| Example | Example | Example | Example | Example |
|---|---|---|---|---|
scene | Scene | getScene() | setScene(Scene) | Example Scene priklauso šiam objektui, arba null jei dar neprisegta. |
import com.aspose.threed.Scene;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("child");
System.out.println(node.getScene() == scene); // trueCustomObject
Lengvo svorio betono subklasė, priklausanti A3DObject kuris nešioja tik pavadinimą ir bet kokį PropertyCollection. Naudokite jį, kad scenai pridėtumėte laisvos formos metaduomenis nesukuriant jokios subklasės jokio entiteto tipo.
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