Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Scene.Scene.Scene Class Reference

Public Member Functions

None __init__ (self)
None setMetaDataEntry (self, str key, Any entry)
 clearMetaData (self)
 getMetaData (self)
None setIgnoreSceneChanges (self, bool ignore_scene_changes)
SceneNode getRoot (self)
None setRoot (self, SceneNode node)
Optional[CameragetActiveCamera (self)
List[CameragetAllCameras (self)
None setActiveCamera (self, str name)
Optional[SceneNodefindObject (self, int object_id)
Optional[CamerafindCamera (self, str name)
None addWatchedFile (self, str file_path)
None removeWatchedFile (self, str file_path)
 reloadNodes (self, List["SceneNode"] nodes, str file_path, Optional[Callable] on_done=None)

Static Public Attributes

 rootChanged = Signal()
 sceneChanged = Signal()

Protected Member Functions

None _connectSignalsRoot (self)
None _disconnectSignalsRoot (self)
None _onFileChanged (self, str file_path)
None _reloadNodes (self, List["SceneNode"] nodes, str file_path, str message, str action, Optional[Callable] on_done=None)
None _reloadJobFinished (self, [SceneNode] replaced_nodes, ReadMeshJob job)

Protected Attributes

 _root = SceneNode(name = "Root")
Optional[Camera_active_camera = None
bool _ignore_scene_changes = False
 _lock = threading.Lock()
 _file_watcher = QFileSystemWatcher()
 _onFileChanged
Optional[Message_reload_message = None
Set[Callable] _callbacks = set()
dict _metadata = {}
 _reload_callback = functools.partial(self._reloadNodes, modified_nodes, file_path)

Detailed Description

Container object for the scene graph

The main purpose of this class is to provide the root SceneNode.

Member Function Documentation

◆ _onFileChanged()

None UM.Scene.Scene.Scene._onFileChanged ( self,
str file_path )
protected
Triggered whenever a file is changed that we currently have loaded.

◆ _reloadJobFinished()

None UM.Scene.Scene.Scene._reloadJobFinished ( self,
[SceneNode] replaced_nodes,
ReadMeshJob job )
protected
Triggered when reloading has finished.

This then puts the resulting mesh data in the nodes.
Objects in the scene that are not in the reloaded file will be kept. (same as in the ReloadAll action)

◆ _reloadNodes()

None UM.Scene.Scene.Scene._reloadNodes ( self,
List["SceneNode"] nodes,
str file_path,
str message,
str action,
Optional[Callable] on_done = None )
protected
Reloads a list of nodes after the user pressed the "Reload" button.

:param nodes: The list of nodes that needs to be reloaded.
:param file_path: The path to the file that was reloaded.
:param message: The message that triggered the action to reload them.
:param action: The button that triggered the action to reload them.
:param on_done: Optional callback to call when reloading is finished.

◆ addWatchedFile()

None UM.Scene.Scene.Scene.addWatchedFile ( self,
str file_path )
Add a file to be watched for changes.

:param file_path: The path to the file that must be watched.

◆ findObject()

Optional[SceneNode] UM.Scene.Scene.Scene.findObject ( self,
int object_id )
Find an object by id.

:param object_id: The id of the object to search for, as returned by the python id() method.

:return: The object if found, or None if not.

◆ getActiveCamera()

Optional[Camera] UM.Scene.Scene.Scene.getActiveCamera ( self)
Get the camera that should be used for rendering.

◆ getRoot()

SceneNode UM.Scene.Scene.Scene.getRoot ( self)
Get the root node of the scene.

◆ reloadNodes()

UM.Scene.Scene.Scene.reloadNodes ( self,
List["SceneNode"] nodes,
str file_path,
Optional[Callable] on_done = None )
Reloads a list of nodes.

:param nodes: The list of nodes that needs to be reloaded.
:param file_path: The path to the file that was reloaded.
:param on_done: Optional callback to call when reloading is finished.

◆ removeWatchedFile()

None UM.Scene.Scene.Scene.removeWatchedFile ( self,
str file_path )
Remove a file so that it will no longer be watched for changes.

:param file_path: The path to the file that must no longer be watched.

◆ setActiveCamera()

None UM.Scene.Scene.Scene.setActiveCamera ( self,
str name )
Set the camera that should be used for rendering.

:param name: The name of the camera to use.

◆ setRoot()

None UM.Scene.Scene.Scene.setRoot ( self,
SceneNode node )
Change the root node of the scene

The documentation for this class was generated from the following file:
  • UM/Scene/Scene.py