unreal.SubobjectDataSubsystem

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

Bases: unreal.EngineSubsystem

The Subobject Data Subsystem will produce the reflected subobject data based on a given root object. A root object can be anything, an actor instance clicked on via the level editor, a UBlueprint* by opening an asset, or something piped in from python or other scripting languages.

C++ Source:

  • Module: SubobjectDataInterface

  • File: SubobjectDataSubsystem.h

add_new_subobject(params) -> (SubobjectDataHandle, fail_reason=Text)

Add a new subobject as a child to the given parent object

Parameters

params (AddNewSubobjectParams) – Options to consider when adding this subobject

Returns

FSubobjectDataHandle Handle to the newly created subobject, Invalid handle if creation failed

fail_reason (Text):

Return type

Text

attach_subobject(owner_handle, child_to_add_handle) bool

Add the given subobject to a new owner. This will remove the subobject from its previous owner if necessary.

Parameters
Returns

true if the child was added successfully

Return type

bool

can_copy_subobjects(handles) bool

Returns true if the given array of handles represents subobjects that can be copied.

Parameters

handles (Array(SubobjectDataHandle)) –

Return type

bool

can_paste_subobjects(root_handle, bp_context=None) bool

Can Paste Subobjects

Parameters
Return type

bool

change_subobject_class(handle, new_class) bool

Attempts to change the subclass of a native component

Parameters
  • handle (SubobjectDataHandle) – Handle to the subobject to change class of

  • new_class (type(Class)) – The new class that is desired for the given subobject

Returns

True if the class change was successful, false otherwise.

Return type

bool

copy_subobjects(handles, bp_context) None

Copy Subobjects

Parameters
classmethod create_new_bp_component(component_class, new_class_path, new_class_name)

Creates a new Blueprint component from the specified class type The user will be prompted to pick a new subclass name and a blueprint asset will be created

Parameters
  • component_class (type(Class)) –

  • new_class_path (str) –

  • new_class_name (str) –

Returns

The new class that was created

Return type

type(Class)

classmethod create_new_cpp_component(component_class, new_class_path, new_class_name)

Creates a new C++ component from the specified class type The user will be prompted to pick a new subclass name and code will be recompiled

Parameters
  • component_class (type(Class)) –

  • new_class_path (str) –

  • new_class_name (str) –

Returns

The new class that was created

Return type

type(Class)

delete_subobject(context_handle, subobject_to_delete, bp_context=None) int32

Attempts to delete the given subobject from its blueprint context

Parameters
  • context_handle (SubobjectDataHandle) – The owning context of the subobjects that should be removed

  • subobject_to_delete (SubobjectDataHandle) – The subobject handles that should be deleted

  • bp_context (Blueprint) – The blueprint context for the given

Returns

The number of subobjects successfully deleted

Return type

int32

delete_subobjects(context_handle, subobjects_to_delete, bp_context=None) int32

Attempts to delete the given array of subobjects from their context

Parameters
  • context_handle (SubobjectDataHandle) – The owning context of the subobjects that should be removed

  • subobjects_to_delete (Array(SubobjectDataHandle)) – Array of subobject handles that should be deleted

  • bp_context (Blueprint) – The blueprint context for the given

Returns

The number of subobjects successfully deleted

Return type

int32

detach_subobject(owner_handle, child_to_remove) bool

Remove the child subobject from the owner

Parameters
Returns

True if the child was successfully removed.

Return type

bool

find_handle_for_object(context, object_to_find, bp_context=None) SubobjectDataHandle

Attempt to find an existing handle for the given object.

Parameters
  • context (SubobjectDataHandle) – The context that the object to find is within

  • object_to_find (Object) – The object that you want to find the handle for within the context

  • bp_context (Blueprint) –

Returns

FSubobjectDataHandle The subobject handle for the object, Invalid handle if not found.

Return type

SubobjectDataHandle

is_valid_rename(handle, new_text) Text or None

Returns true if the given new text is a valid option to rename the subobject with the given handle. Populates the OutErrorMessage if it is not valid.

Parameters
  • handle (SubobjectDataHandle) – Handle to the subobject that is being checked

  • new_text (Text) – The new name that is desired

Returns

True if the rename is valid

out_error_message (Text): The reasoning for an invalid name

Return type

Text or None

k2_delete_subobject_from_instance(context_handle, subobject_to_delete) int32

Attempts to delete the given subobject from its context

Parameters
  • context_handle (SubobjectDataHandle) – The owning context of the subobjects that should be removed

  • subobject_to_delete (SubobjectDataHandle) – The subobject handles that should be deleted

Returns

The number of subobjects successfully deleted

Return type

int32

k2_delete_subobjects_from_instance(context_handle, subobjects_to_delete) int32

Attempts to delete the given array of subobjects from their context

Parameters
Returns

The number of subobjects successfully deleted

Return type

int32

k2_find_subobject_data_from_handle(handle) SubobjectData or None

Attempt to find the subobject data for a given handle. OutData will only be valid if the function returns true.

Parameters

handle (SubobjectDataHandle) – Handle of the subobject data you want to acquire

Returns

bool true if the data was found

out_data (SubobjectData): Reference to the subobject data to populate

Return type

SubobjectData or None

k2_gather_subobject_data_for_blueprint(context)

Gather all subobjects that the given Blueprint context has. Populates an array of handles that will have the given context and all it’s subobjects.

Parameters

context (Blueprint) – Object to gather subobjects for

Returns

out_array (Array(SubobjectDataHandle)): Array to populate (will be emptied first)

Return type

Array(SubobjectDataHandle)

k2_gather_subobject_data_for_instance(context)

Gather all subobjects that the given actor instance has. Populates an array of handles that will have the given context and all it’s subobjects.

Parameters

context (Actor) – Object to gather subobjects for

Returns

out_array (Array(SubobjectDataHandle)): Array to populate (will be emptied first)

Return type

Array(SubobjectDataHandle)

make_new_scene_root(context, new_scene_root, bp_context) bool

Make New Scene Root

Parameters
Return type

bool

rename_subobject(handle, new_name) bool

Attempts to rename the given subobject to the new name.

Parameters
  • handle (SubobjectDataHandle) – Handle to the subobject to rename

  • new_name (Text) – The new name that is desired for the given subobject

Returns

True if the rename was successful, false otherwise.

Return type

bool

classmethod rename_subobject_member_variable(bp_context, handle, new_name) None

Rename Subobject Member Variable

Parameters
reparent_subobject(params, to_reparent_handle) bool

Attempts to reparent the given subobject to the new parent

Parameters
Returns

True if the reparent was successful, false otherwise.

Return type

bool

reparent_subobjects(params, handles_to_move) bool

Attempts to reparent all subobjects in the HandlesToMove array to the new parent handle.

Parameters
Return type

bool