modules.scene#
- class modules.scene.SceneManager(context)#
Bases:
object- class Scene#
Bases:
TypedDictTypedef for a scene file
- ambient_color: List[float]#
- fog_color: List[float]#
- fog_density: float#
- fog_falloff: float#
- fog_height: float#
- gameObjects: List[_GameObject]#
- light_color: List[float]#
- name: str#
- procedural_ground_color: List[float]#
- procedural_horizon_color: List[float]#
- procedural_night_brightness: float#
- procedural_night_color: List[float]#
- procedural_sky_color: List[float]#
- procedural_sunset_color: List[float]#
- sky_type: Skybox.Type_#
- uid: str#
- __init__(context) None#
scene manager
- Parameters:
context (EmberEngine) – This is the main context of the application
- clearEditorScene()#
Clear the scene in the editor, prepares loading a new scene This removes gameObjects, clears editor GUI state, resets camera index.
- deserialize_export(name, data)#
- getCamera()#
Get the current default/start camera
- Returns:
The current scene default/start camera, False if this fails
- Return type:
Camera or bool
- getCurrentScene() Scene#
Get the current active scene
- Returns:
The current scene object, False if this fails
- Return type:
- getCurrentSceneUID() str#
Get the current scene UID.
- Returns:
The UID of the current scene, usualy this represents the filename of a .scene
- Return type:
str
- getDefaultScene() Scene#
Get reference to the default engine empty scene
- Returns:
reference to scene
- Return type:
- getScene(scene_filename: Path)#
Load and decode JSON from a scene file
- Parameters:
scene_filename (Path) – The filename of a .scene
- getSceneById(scene_id: int) Scene#
Get a scene by the index it is in the scenes List
- Parameters:
scene_id (int) – The index of the scene
- Returns:
The scene at that location, False if invalid
- Return type:
Scene or bool
- getSceneByUID(scene_uid: str) Scene#
Get a scene by the UID, which is the filename withouth .scene
- Parameters:
scene_uid – The name of the .scene file
- Returns:
The scene at that location, False if invalid
- Return type:
Scene or bool
- getScenes()#
search assets for .scene files, and calls the getScene to decode them
- getSun() GameObject#
Get the current sun
- Returns:
The current scene sun, False if this fails
- Return type:
GameObject or bool
- isSun(uuid: UUID) bool#
If the provided object the current sun
- Returns:
True if the it is the sun, False if not
- Return type:
Camera or bool
- loadDefaultScene()#
Load the default scene, meaing the engine empty scene
- loadGameObjectsRecursive(parent: GameObject = None, objects: List[_GameObject] = [], scene_id: int = -1)#
- loadScene(scene_uid: str) bool#
Load scene (does not work with multiple scenes yet), if this return false, the engine will proceed to load the default scene.
- Parameters:
scene_uid (str) – The name the scene is saved under, meaning the filename of .scene file.
- Returns:
True of the scene loaded succesfully, False if was not found or errors occured
- Return type:
bool
- newScene(name: str)#
Creates a new scene based on the engines default empty scene
- Parameters:
name (str) – The name of the scene, which is also sanitized and use as filename for the .scene file.
- postLoadScene() None#
- saveGameObjectRecursive(parent: GameObject = None, objects: Dict[UUID, GameObject] = [], _gameObjects: List[SceneManager._GameObject] = [])#
Recursivly iterate over gameObject and its children
- saveScene(scene_uid: str = False)#
Save a scene, only serialize things actually needed
- Parameters:
scene_uid (str, optional) – The name the scene is saved under, meaning the filename of .scene file. Use current scene name if this is empty
- saveSceneAs(name: str)#
Duplicate the current scene under a diffrent filename
- Parameters:
name (str) – The name of the scene, which is also sanitized and use as filename for the .scene file.
- setCamera(uuid: UUID, scene_id=-1)#
Set the current runtime camera based on gameObject uid
During game runtime, update the projection matrix a well.
- Parameters:
uid (int) – The uid of a Camera gameObject
scene_id (int, optional) – The index in scens List of the scene the camera is set on, current scene when empty
- setSun(uuid: UUID, scene_id=-1)#
- updateScriptonGameObjects(path: Path) None#
Re-initialize specific script on GameObjects
- Parameters:
path (Path) – The path to a .py script file