unreal.LayersSubsystem

class unreal.LayersSubsystem(outer=None, name='None')

Bases: unreal.EditorSubsystem

Layers Subsystem

C++ Source:

  • Module: UnrealEd

  • File: LayersSubsystem.h

add_actor_to_layer(actor, layer_name)bool

Adds the actor to the named layer.

Parameters
  • actor (Actor) – The actor to add to the named layer

  • layer_name (Name) – The name of the layer to add the actor to

Returns

true if the actor was added. false is returned if the actor already belongs to the layer.

Return type

bool

add_actor_to_layers(actor, layer_names)bool

Adds the provided actor to the named layers.

Parameters
  • actor (Actor) – The actor to add to the provided layers

  • layer_names (Array(Name)) – A valid list of layer names.

Returns

true if the actor was added to at least one of the provided layers.

Return type

bool

add_actors_to_layer(actors, layer_name)bool

Add the actors to the named layer

Parameters
  • actors (Array(Actor)) – The actors to add to the named layer

  • layer_name (Name) – The name of the layer to add to

Returns

true if at least one actor was added to the layer. false is returned if all the actors already belonged to the layer.

Return type

bool

add_actors_to_layers(actors, layer_names)bool

Add the actors to the named layers

Parameters
  • actors (Array(Actor)) – The actors to add to the named layers

  • layer_names (Array(Name)) – A valid list of layer names.

Returns

true if at least one actor was added to at least one layer. false is returned if all the actors already belonged to all specified layers.

Return type

bool

add_all_layer_names_to()

Gets all known layers and appends their names to the provide array

Returns

out_layer_names (Array(Name)):

Return type

Array(Name)

add_all_layers_to()

Gets all known layers and appends them to the provided array

Returns

out_layers (Array(Layer)):

Return type

Array(Layer)

add_level_layer_information(level)None

Aggregates any information regarding layers associated with the level and it contents

Parameters

level (Level) – The process

add_selected_actors_to_layer(layer_name)bool

Adds selected actors to the named layer.

Parameters

layer_name (Name) – A layer name.

Returns

true if at least one actor was added. false is returned if all selected actors already belong to the named layer.

Return type

bool

add_selected_actors_to_layers(layer_names)bool

Adds selected actors to the named layers.

Parameters

layer_names (Array(Name)) – A valid list of layer names.

Returns

true if at least one actor was added. false is returned if all selected actors already belong to the named layers.

Return type

bool

append_actors_from_layer(layer_name)

Appends all the actors associated with the specified layer.

Parameters

layer_name (Name) – The layer to find actors for.

Returns

out_actors (Array(Actor)): The list to append the found actors to.

Return type

Array(Actor)

append_actors_from_layers(layer_names)

Appends all the actors associated with ANY of the specified layers.

Parameters

layer_names (Array(Name)) – The layers to find actors for.

Returns

out_actors (Array(Actor)): The list to append the found actors to.

Return type

Array(Actor)

create_layer(layer_name)Layer

Creates a ULayer Object for the named layer

Parameters

layer_name (Name) – The name of the layer to create

Returns

The newly created ULayer Object for the named layer

Return type

Layer

delete_layer(layer_to_delete)None

Deletes the provided layer, disassociating all actors from them

Parameters

layer_to_delete (Name) – A valid layer name

delete_layers(layers_to_delete)None

Deletes all of the provided layers, disassociating all actors from them

Parameters

layers_to_delete (Array(Name)) – A valid list of layer names.

disassociate_actor_from_layers(actor)bool

Disassociates an Actor’s layers from the layer system, general used before deleting the Actor

Parameters

actor (Actor) – The actor to disassociate from the layer system

Returns

Return type

bool

editor_map_change()None

Delegate handler for FEditorDelegates::MapChange. It internally calls LayersChanged.Broadcast.

editor_refresh_layer_browser()None

Delegate handler for FEditorDelegates::RefreshLayerBrowser. It internally calls UpdateAllActorsVisibility to refresh the actors of each layer.

get_actors_from_layer(layer_name)

Gets all the actors associated with the specified layer. Analog to AppendActorsFromLayer but it returns rather than appends the actors.

Parameters

layer_name (Name) – The layer to find actors for.

Returns

The list to assign the found actors to.

Return type

Array(Actor)

get_actors_from_layers(layer_names)

Gets all the actors associated with ANY of the specified layers. Analog to AppendActorsFromLayers but it returns rather than appends the actors.

Parameters

layer_names (Array(Name)) – The layers to find actors for.

Returns

The list to assign the found actors to.

Return type

Array(Actor)

get_layer(layer_name)Layer

Gets the ULayer Object of the named layer

Parameters

layer_name (Name) – The name of the layer whose ULayer Object is returned

Returns

The ULayer Object of the provided layer name

Return type

Layer

get_selected_actors()

Find and return the selected actors.

Returns

The selected AActor’s as a TArray.

Return type

Array(Actor)

get_world()World

Get the current UWorld object.

Returns

The UWorld* object

Return type

World

initialize_new_actor_layers(actor)bool

Synchronizes an newly created Actor’s layers with the layer system

Parameters

actor (Actor) – The actor to initialize

Returns

Return type

bool

is_actor_valid_for_layer(actor)bool

Checks to see if the specified actor is in an appropriate state to interact with layers

Parameters

actor (Actor) – The actor to validate

Returns

Return type

bool

is_layer(layer_name)bool

Checks whether the ULayer Object of the provided layer name exists.

Parameters

layer_name (Name) – The name of the layer whose ULayer Object to retrieve

Returns

If true a valid ULayer Object was found; if false, a valid ULayer object was not found

Return type

bool

make_all_layers_visible()None

Set the visibility of all layers to true

remove_actor_from_layer(actor, layer_to_remove, update_stats=True)bool

Removes an actor from the specified layer.

Parameters
  • actor (Actor) – The actor to remove from the provided layer

  • layer_to_remove (Name) – The name of the layer to remove the actor from

  • update_stats (bool) –

Returns

true if the actor was removed from the layer. false is returned if the actor already belonged to the layer.

Return type

bool

remove_actor_from_layers(actor, layer_names, update_stats=True)bool

Removes the provided actor from the named layers.

Parameters
  • actor (Actor) – The actor to remove from the provided layers

  • layer_names (Array(Name)) – A valid list of layer names.

  • update_stats (bool) –

Returns

true if the actor was removed from at least one of the provided layers.

Return type

bool

remove_actors_from_layer(actors, layer_name, update_stats=True)bool

Removes the actors from the specified layer.

Parameters
  • actors (Array(Actor)) – The actors to remove from the provided layer

  • layer_name (Name) –

  • update_stats (bool) –

Returns

true if at least one actor was removed from the layer. false is returned if all the actors already belonged to the layer.

Return type

bool

remove_actors_from_layers(actors, layer_names, update_stats=True)bool

Remove the actors to the named layers

Parameters
  • actors (Array(Actor)) – The actors to remove to the named layers

  • layer_names (Array(Name)) – A valid list of layer names.

  • update_stats (bool) –

Returns

true if at least one actor was removed from at least one layer. false is returned if none of the actors belonged to any of the specified layers.

Return type

bool

remove_level_layer_information(level)None

Purges any information regarding layers associated with the level and it contents

Parameters

level (Level) – The process

remove_selected_actors_from_layer(layer_name)bool

Removes the selected actors from the named layer.

Parameters

layer_name (Name) – A layer name.

Returns

true if at least one actor was added. false is returned if all selected actors already belong to the named layer.

Return type

bool

remove_selected_actors_from_layers(layer_names)bool

Removes selected actors from the named layers.

Parameters

layer_names (Array(Name)) – A valid list of layer names.

Returns

true if at least one actor was removed.

Return type

bool

rename_layer(original_layer_name, new_layer_name)bool

Renames the provided originally named layer to the provided new name

Parameters
  • original_layer_name (Name) – The name of the layer to be renamed

  • new_layer_name (Name) – The new name for the layer to be renamed

Returns

Return type

bool

select_actors_in_layer(layer_name, select, notify, select_even_if_hidden=False)bool

Selects/de-selects actors belonging to the named layer.

Parameters
  • layer_name (Name) – A valid layer name.

  • select (bool) – If true actors are selected; if false, actors are deselected.

  • notify (bool) – If true the Editor is notified of the selection change; if false, the Editor will not be notified.

  • select_even_if_hidden (bool) – [optional] If true even hidden actors will be selected; if false, hidden actors won’t be selected.

Returns

true if at least one actor was selected/deselected.

Return type

bool

select_actors_in_layers(layer_names, select, notify, select_even_if_hidden=False)bool

Selects/de-selects actors belonging to the named layers.

Parameters
  • layer_names (Array(Name)) – A valid list of layer names.

  • select (bool) – If true actors are selected; if false, actors are deselected.

  • notify (bool) – If true the Editor is notified of the selection change; if false, the Editor will not be notified

  • select_even_if_hidden (bool) – [optional] If true even hidden actors will be selected; if false, hidden actors won’t be selected.

Returns

true if at least one actor was selected/deselected.

Return type

bool

set_layer_visibility(layer_name, is_visible)None

Changes the named layer’s visibility to the provided state

Parameters
  • layer_name (Name) – The name of the layer to affect.

  • is_visible (bool) – If true the layer will be visible; if false, the layer will not be visible.

set_layers_visibility(layer_names, is_visible)None

Changes visibility of the named layers to the provided state

Parameters
  • layer_names (Array(Name)) – The names of the layers to affect

  • is_visible (bool) – If true the layers will be visible; if false, the layers will not be visible

toggle_layer_visibility(layer_name)None

Toggles the named layer’s visibility

Parameters

layer_name (Name) – The name of the layer to affect

toggle_layers_visibility(layer_names)None

Toggles the visibility of all of the named layers

Parameters

layer_names (Array(Name)) – The names of the layers to affect

try_get_layer(layer_name)Layer or None

Attempts to get the ULayer Object of the provided layer name.

Parameters

layer_name (Name) – The name of the layer whose ULayer Object to retrieve

Returns

If true a valid ULayer Object was found and set to OutLayer; if false, a valid ULayer object was not found and invalid set to OutLayer

out_layer (Layer):

Return type

Layer or None

update_actor_all_views_visibility(actor)None

Updates per-view visibility for the given actor for all views

Parameters

actor (Actor) – Actor to update

update_actor_visibility(actor, notify_selection_change, redraw_viewports)(out_selection_changed=bool, out_actor_modified=bool) or None

Updates the provided actors visibility in the viewports

Parameters
  • actor (Actor) – Actor to update

  • notify_selection_change (bool) – If true the Editor is notified of the selection change; if false, the Editor will not be notified

  • redraw_viewports (bool) – If true the viewports will be redrawn; if false, they will not

Returns

out_selection_changed (bool): [OUT] Whether the Editors selection changed

out_actor_modified (bool): [OUT] Whether the actor was modified

Return type

tuple or None

update_all_actors_visibility(notify_selection_change, redraw_viewports)bool

Updates the visibility of all actors in the viewports

Parameters
  • notify_selection_change (bool) – If true the Editor is notified of the selection change; if false, the Editor will not be notified

  • redraw_viewports (bool) – If true the viewports will be redrawn; if false, they will not

Returns

Return type

bool

update_all_view_visibility(layer_that_changed)None

Updates the visibility for all actors for all views.

Parameters

layer_that_changed (Name) – If one layer was changed (toggled in view pop-up, etc), then we only need to modify actors that use that layer.