Scene class in Aspose.3D serves as the root container for 3D content, managing top-level objects and enabling parent/child relationship management for the scene hierarchy. It provides access to root nodes and sub-scenes, forming the entry point for loading, constructing, and saving 3D scenes.
Scene class can be instantiated with no arguments to create an empty scene, or with optional parameters.
| | |
|---|
name | str | Optional name of the scene |
entity | Entity | Optional entity to attach to the root node on creation |
parent_scene | Scene | Optional parent scene (for sub-scenes) |
Metode klase
| Return Type | |
|---|
Scene.from_file(file_path) | Scene | Loads a scene from the specified file path, detecting the format automatically. |
Scene.from_file(file_path, options) | Scene | Loads a scene with format-specific load options. |
root_node and other scene-level attributes are properties; access them without parentheses.
| | |
|---|
root_node | Node | Root node of the scene hierarchy. Access as a property: scene.root_node |
sub_scenes | list[Scene] | Sub-scenes nested within this scene |
asset_info | AssetInfo | Asset metadata such as author, creation date, and units |
animation_clips | list[AnimationClip] | Animation clips defined in the scene |
current_animation_clip | `AnimationClip | None` |
library | list[CustomObject] | Korisnički definirani objekti metapodataka priloženi sceni. |
name | str | Naziv objekta scene |
properties | PropertyCollection | Prilagođena svojstva priložena sceni |
| Tip povratne vrijednosti | |
|---|
save(file_path) | None | Spremi scenu u datoteku; format se zaključuje iz ekstenzije |
save(file_path, format) | None | Spremi scenu u datoteku u navedenom FileFormat |
save(file_path, options) | None | Spremi scenu koristeći opcije specifične za format |
get_property(name) | Any | Dohvaća vrijednost svojstva po imenu |
find_property(name) | Optional[Property] | Pronalaže svojstvo po imenu |
create_animation_clip(name) | AnimationClip | Stvara novi animacijski isječak s imenom i dodaje ga u scenu |
get_animation_clip(name) | `AnimationClip | None` |
clear() | None | Čisti sav sadržaj iz scene |
Napomena: root_node je svojstvo na Scene klasi, a ne metodi. Nemojte pisati scene.root_node(); ispravan pristup je scene.root_node.
Stvorite scenu, dodajte mesh čvor i spremite u GLB:
Vidi također