A3DObject, SceneObject, CustomObject — Aspose.3D FOSS for Java
Pakotne: com.aspose.threed (aspose-3d-foss 26.1.0)
Šīs trīs klases veido Aspose.3D klašu hierarhijas pamatu. Katrs publisks objekts bibliotēkā manto no A3DObject, kas nodrošina nosaukumu un dinamisku īpašību kolekciju. SceneObject paplašina A3DObject ar ainas piederības izsekošanu. CustomObject ir viegls konkrēts apakšklase, kas paredzēta patvaļīgu lietotāja metadatu glabāšanai.
A3DObject
Pamatklase saknē visiem Aspose.3D pārvaldītajiem objektiem. Katrs nosauktais objekts bibliotēkā – Node, Mesh, AnimationClip, Material, un tā tālāk – manto no A3DObject.
import com.aspose.threed.A3DObject;Example
| Example | Example | Example | Example | Example |
|---|---|---|---|---|
name | String | getName() | setName(String) | Cilvēkam lasāms objekta nosaukums. Noklusējuma vērtība ir tukša virkne. |
properties | PropertyCollection | getProperties() | – | Dinamiski īpašību kolekcija, kas pievienota šim objektam. Iterējiet to vai izmantojiet findProperty() nosauktām meklēšanām. |
Example
findProperty(String propertyName)
Meklēt nosauktu īpašību šī objekta PropertyCollection un atgriezt Property instanci, vai null ja nav atrasts.
| Example | Example | Example |
|---|---|---|
propertyName | String | Nosaukums, ko meklēt. |
Atgriež: Property vai 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)
Atgriež norādītā īpašuma pašreizējo vērtību, vai null ja īpašums neeksistē.
| Example | Example | Example |
|---|---|---|
property | String | Īpašuma nosaukums. |
Atgriež: Object
Object val = node.getProperty("name");
System.out.println(val); // "origin"setProperty(String property, Object value)
Iestata nosauktās īpašības vērtību. Izveido īpašību, ja tā vēl nepastāv.
| Example | Example | Example |
|---|---|---|
property | String | Īpašuma nosaukums. |
value | Object | Jauna vērtība. |
Atgriež: void
node.setProperty("layer", 3);
System.out.println(node.getProperty("layer")); // 3removeProperty(String property)
Noņem nosauktu īpašību no kolekcijas.
| Example | Example | Example |
|---|---|---|
property | String vai Property | Īpašības nosaukums vai Property instanci, ko noņemt. |
Atgriež: boolean – true ja īpašība tika atrasta un noņemta.
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 ar atsauci uz īpašnieku Scene. Node, Entity, un saistītās klases manto no SceneObject.
import com.aspose.threed.SceneObject;Example
A3DObject -> SceneObject
Papildu īpašība
| Example | Example | Example | Example | Example |
|---|---|---|---|---|
scene | Scene | getScene() | setScene(Scene) | Example Scene šim objektam pieder, vai null ja vēl nav pievienots. |
import com.aspose.threed.Scene;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("child");
System.out.println(node.getScene() == scene); // trueCustomObject
Vieglā betona apakšklase no A3DObject kas nes tikai nosaukumu un patvaļīgu PropertyCollection. Izmantojiet to, lai pievienotu brīvformas metadatus ainai, nepārsakot nevienu entītijas tipu.
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