unreal.EditorLevelLibrary
¶
- class unreal.EditorLevelLibrary(outer=None, name='None')¶
Bases:
unreal.BlueprintFunctionLibrary
Utility class to do most of the common functionalities in the World Editor. The editor should not be in play in editor mode.
C++ Source:
Plugin: EditorScriptingUtilities
Module: EditorScriptingUtilities
File: EditorLevelLibrary.h
- classmethod convert_actors(actors, actor_class, static_mesh_package_path)¶
Replace in the level all Actors provided with a new actor of type ActorClass. Destroy all Actors provided.
- Parameters
- Returns
- Return type
- classmethod create_proxy_mesh_actor(actors_to_merge, merge_options) → StaticMeshActor or None¶
Build a proxy mesh actor that can replace a set of mesh actors.
- Parameters
actors_to_merge (Array(StaticMeshActor)) – List of actors to build a proxy for.
merge_options (EditorScriptingCreateProxyMeshActorOptions) –
- Returns
Success of the proxy creation
out_merged_actor (StaticMeshActor): generated actor if requested
- Return type
- classmethod destroy_actor(actor_to_destroy) → bool¶
Destroy the actor from the world editor. Notify the Editor that the actor got destroyed.
- classmethod editor_set_game_view(game_view) → None¶
Editor Set Game View
- Parameters
game_view (bool) –
- classmethod get_actor_reference(path_to_actor) → Actor¶
Attempts to find the actor specified by PathToActor in the current editor world
- classmethod get_all_level_actors()¶
Find all loaded Actors in the world editor. Exclude actor that are pending kill, in PIE, PreviewEditor, …
- classmethod get_all_level_actors_components()¶
Find all loaded ActorComponent own by an actor in the world editor. Exclude actor that are pending kill, in PIE, PreviewEditor, …
- Returns
List of found ActorComponent
- Return type
- classmethod get_editor_world() → World¶
Find the World in the world editor. It can then be used as WorldContext by other libraries like GameplayStatics.
- Returns
The World used by the world editor.
- Return type
- classmethod get_level_viewport_camera_info() → (camera_location=Vector, camera_rotation=Rotator) or None¶
Gets information about the camera position for the primary level editor viewport. In non-editor builds, these will be zeroed
- Returns
Whether or not we were able to get a camera for a level editing viewport
camera_location (Vector): (out) Current location of the level editing viewport camera, or zero if none found
camera_rotation (Rotator): (out) Current rotation of the level editing viewport camera, or zero if none found
- Return type
tuple or None
- classmethod get_pie_worlds(include_dedicated_server)¶
Get PIEWorlds
- classmethod get_selected_level_actors()¶
Find all loaded Actors that are selected in the world editor. Exclude actor that are pending kill, in PIE, PreviewEditor, …
- classmethod join_static_mesh_actors(actors_to_join, join_options) → Actor¶
Create a new Actor in the level that contains a duplicate of all the Actors Static Meshes Component. The ActorsToJoin need to be in the same Level. This will have a low impact on performance but may help the edition by grouping the meshes under a single Actor.
- Parameters
actors_to_join (Array(StaticMeshActor)) – List of Actors to join.
join_options (EditorScriptingJoinStaticMeshActorsOptions) – Options on how to join the actors.
- Returns
The new created actor.
- Return type
- classmethod load_level(asset_path) → bool¶
Close the current Persistent Level (without saving it). Loads the specified level.
- classmethod merge_static_mesh_actors(actors_to_merge, merge_options) → StaticMeshActor or None¶
Merge the meshes into a unique mesh with the provided StaticMeshActors. There are multiple options on how to merge the meshes and their materials. The ActorsToMerge need to be in the same Level. This may have a high impact on performance depending of the MeshMergingSettings options.
- Parameters
actors_to_merge (Array(StaticMeshActor)) – List of Actors to merge.
merge_options (EditorScriptingMergeStaticMeshActorsOptions) – Options on how to merge the actors.
- Returns
if the operation is successful.
out_merged_actor (StaticMeshActor): The new created actor, if requested.
- Return type
- classmethod new_level(asset_path) → bool¶
Close the current Persistent Level (without saving it). Create a new blank Level and save it. Load the new created level.
- classmethod new_level_from_template(asset_path, template_asset_path) → bool¶
Close the current Persistent Level (without saving it). Create a new Level base on another level and save it. Load the new created level.
- classmethod pilot_level_actor(actor_to_pilot) → None¶
Pilot Level Actor
- Parameters
actor_to_pilot (Actor) –
- classmethod replace_mesh_components_materials(mesh_components, material_to_be_replaced, new_material) → None¶
Find the references of the material MaterialToReplaced on all the MeshComponents provided and replace it by NewMaterial.
- Parameters
mesh_components (Array(MeshComponent)) – List of MeshComponent to search from.
material_to_be_replaced (MaterialInterface) – Material we want to replace.
new_material (MaterialInterface) – Material to replace MaterialToBeReplaced by.
- classmethod replace_mesh_components_materials_on_actors(actors, material_to_be_replaced, new_material) → None¶
Find the references of the material MaterialToReplaced on all the MeshComponents of all the Actors provided and replace it by NewMaterial.
- Parameters
material_to_be_replaced (MaterialInterface) – Material we want to replace.
new_material (MaterialInterface) – Material to replace MaterialToBeReplaced by.
- classmethod replace_mesh_components_meshes(mesh_components, mesh_to_be_replaced, new_mesh) → None¶
Find the references of the mesh MeshToBeReplaced on all the MeshComponents provided and replace it by NewMesh. The editor should not be in play in editor mode.
- Parameters
mesh_components (Array(StaticMeshComponent)) – List of MeshComponent to search from.
mesh_to_be_replaced (StaticMesh) – Mesh we want to replace.
new_mesh (StaticMesh) – Mesh to replace MeshToBeReplaced by.
- classmethod replace_mesh_components_meshes_on_actors(actors, mesh_to_be_replaced, new_mesh) → None¶
Find the references of the mesh MeshToBeReplaced on all the MeshComponents of all the Actors provided and replace it by NewMesh.
- Parameters
mesh_to_be_replaced (StaticMesh) – Mesh we want to replace.
new_mesh (StaticMesh) – Mesh to replace MeshToBeReplaced by.
- classmethod replace_selected_actors(asset_path) → None¶
Replaces the selected Actors with the same number of a different kind of Actor using the specified factory to spawn the new Actors note that only Location, Rotation, Drawscale, Drawscale3D, Tag, and Group are copied from the old Actors
- Parameters
asset_path (str) –
- classmethod save_all_dirty_levels() → bool¶
Saves all Level currently loaded by the World Editor.
- Returns
True if the operation succeeds.
- Return type
- classmethod save_current_level() → bool¶
Saves the specified Level. Must already be saved at lease once to have a valid path.
- Returns
True if the operation succeeds.
- Return type
- classmethod select_nothing() → None¶
Selects nothing in the editor (another way to clear the selection)
- classmethod set_actor_selection_state(actor, should_be_selected) → None¶
Set the selection state for the selected actor
- classmethod set_current_level_by_name(level_name) → bool¶
Set the current level used by the world editor. If more than one level shares the same name, the first one encounter of that level name will be used.
- classmethod set_level_viewport_camera_info(camera_location, camera_rotation) → None¶
Sets information about the camera position for the primary level editor viewport.
- classmethod set_selected_level_actors(actors_to_select) → None¶
Clear the current world editor selection and select the provided actors. Exclude actor that are pending kill, in PIE, PreviewEditor, …
- classmethod spawn_actor_from_class(actor_class, location, rotation=[0.0, 0.0, 0.0], transient=False) → Actor¶
Create an actor and place it in the world editor. Can be created from a Blueprint or a Class. The actor will be created in the current level and will be selected.
- classmethod spawn_actor_from_object(object_to_use, location, rotation=[0.0, 0.0, 0.0], transient=False) → Actor¶
Create an actor and place it in the world editor. The Actor can be created from a Factory, Archetype, Blueprint, Class or an Asset. The actor will be created in the current level and will be selected.