unreal.SmartObjectSubsystem
¶
- class unreal.SmartObjectSubsystem(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
WorldSubsystem
Subsystem that holds all registered smart object instances and offers the API for spatial queries and reservations.
C++ Source:
Plugin: SmartObjects
Module: SmartObjectsModule
File: SmartObjectSubsystem.h
- add_tag_to_instance(handle, tag) None ¶
Adds a single tag to the smart object instance represented by the provided handle.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
tag (GameplayTag) – Tag to add to the smart object instance.
- add_tag_to_slot(slot_handle, tag) None ¶
Adds a single tag to the smart object slot represented by the provided handle.
- Parameters:
slot_handle (SmartObjectSlotHandle) – Handle to the smart object slot.
tag (GameplayTag) – Tag to add to the smart object slot.
- claim(request_result, user_actor=None) SmartObjectClaimHandle ¶
Claim deprecated: Use MarkSmartObjectSlotAsClaimed instead.
- Parameters:
request_result (SmartObjectRequestResult) –
user_actor (Actor) –
- Return type:
- find_smart_object(request, user_actor=None) SmartObjectRequestResult ¶
Spatial lookup for first slot in range respecting request criteria and selection conditions.
- Parameters:
request (SmartObjectRequest) – Parameters defining the search area and criteria
user_actor (Actor) – Actor claiming the smart object used to evaluate selection conditions
- Returns:
First valid smart object in range. Not the closest one, just the one that happens to be retrieved first from space partition
- Return type:
- find_smart_objects(request, user_actor=None) Array[SmartObjectRequestResult] or None ¶
Find Smart Objects deprecated: The pure version is deprecated, place a new Find Smart Objects node and connect the exec pin
- Parameters:
request (SmartObjectRequest) –
user_actor (Actor) –
- Returns:
out_results (Array[SmartObjectRequestResult]):
- Return type:
Array[SmartObjectRequestResult] or None
- find_smart_objects_bp(request, user_actor=None) Array[SmartObjectRequestResult] or None ¶
Blueprint function for spatial lookup for slot candidates respecting request criteria and selection conditions.
- Parameters:
request (SmartObjectRequest) – Parameters defining the search area and criteria
user_actor (Actor) – Actor claiming the smart object
- Returns:
All valid smart objects in range.
out_results (Array[SmartObjectRequestResult]): List of smart object slot candidates
- Return type:
Array[SmartObjectRequestResult] or None
- get_all_slots(handle) Array[SmartObjectSlotHandle] ¶
Return all slots of a given smart object.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
- Returns:
out_slots (Array[SmartObjectSlotHandle]): All slots of the smart object
- Return type:
- get_behavior_definition(claim_handle, definition_class) SmartObjectBehaviorDefinition ¶
Return the behavior definition of a given type from a claimed object.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
definition_class (type(Class)) – The type of behavior definition.
- Returns:
The base class pointer of the requested behavior definition class associated to the slotClaim handle
- Return type:
- get_behavior_definition_by_request_result(request_result, definition_class) SmartObjectBehaviorDefinition ¶
Return the behavior definition of a given type from a request result.
- Parameters:
request_result (SmartObjectRequestResult) – A request result returned by any of the Find methods.
definition_class (type(Class)) – The type of behavior definition.
- Returns:
The base class pointer of the requested behavior definition class associated to the request result
- Return type:
- get_instance_tags(handle) GameplayTagContainer ¶
Returns the list of tags associated to the smart object instance represented by the provided handle.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
- Returns:
Container of tags associated to the smart object instance.
- Return type:
- get_slot_location(claim_handle) Vector or None ¶
Returns the position (in world space) of the slot associated to the given claim handle.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
Whether the location was found and assigned to ‘OutSlotLocation’
out_slot_location (Vector): Position (in world space) of the slot associated to ClaimHandle.
- Return type:
Vector or None
- get_slot_state(slot_handle) SmartObjectSlotState ¶
Returns the state of the given Smart Object Slot handle.
- Parameters:
slot_handle (SmartObjectSlotHandle) –
- Return type:
- get_slot_tags(slot_handle) GameplayTagContainer ¶
Returns the list of tags associated to the smart object slot represented by the provided handle.
- Parameters:
slot_handle (SmartObjectSlotHandle) – Handle to the smart object slot.
- Returns:
Container of tags associated to the smart object instance, or empty container if slot was not valid.
- Return type:
- get_slot_transform(claim_handle) Transform or None ¶
Returns the transform (in world space) of the slot associated to the given claim handle.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
Whether the transform was found and assigned to ‘OutSlotTransform’
out_slot_transform (Transform): Transform (in world space) of the slot associated to ClaimHandle.
- Return type:
Transform or None
- get_slot_transform_from_request_result(request_result) Transform or None ¶
Returns the transform (in world space) of the slot associated to the given RequestResult.
- Parameters:
request_result (SmartObjectRequestResult) – Result returned by any of the Find Smart Object(s) methods.
- Returns:
Whether the transform was found and assigned to ‘OutSlotTransform’
out_slot_transform (Transform): Transform (in world space) of the slot associated to the RequestResult.
- Return type:
Transform or None
- get_smart_object_component(claim_handle, try_spawn_actor_if_dehydrated=TrySpawnActorIfDehydrated.NO) SmartObjectComponent ¶
Returns the component associated to the claim handle if still accessible. In some scenarios the component may no longer exist but its smart object data could (e.g. streaming)
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
try_spawn_actor_if_dehydrated (TrySpawnActorIfDehydrated) – Indicates if the subsystem should try to spawn the actor/component associated to the smartobject if it is currently owned by an instanced actor.
- Returns:
A pointer to the USmartObjectComponent* associated to the handle.
- Return type:
- get_smart_object_component_by_request_result(result, try_spawn_actor_if_dehydrated=TrySpawnActorIfDehydrated.NO) SmartObjectComponent ¶
Returns the component associated to the given request result In some scenarios the component may no longer exist but its smart object data could (e.g. streaming)
- Parameters:
result (SmartObjectRequestResult) – A request result returned by any of the Find methods .
try_spawn_actor_if_dehydrated (TrySpawnActorIfDehydrated) – Indicates if the subsystem should try to spawn the actor/component associated to the smartobject if it is currently owned by an instanced actor.
- Returns:
A pointer to the USmartObjectComponent* associated to the handle.
- Return type:
- is_enabled(handle) bool ¶
Returns the enabled state of the smart object represented by the provided handle regardless of the disabled reason.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
- Returns:
True when associated smart object is found and set to be enabled. False otherwise.
- Return type:
- is_enabled_for_reason(handle, reason_tag) bool ¶
Returns the enabled state of the smart object represented by the provided handle based on a specific reason.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
reason_tag (GameplayTag) – Valid Tag to test if enabled for a specific reason. Method will ensure if not valid (i.e. None).
- Returns:
True when associated smart object is found and set to be enabled. False otherwise.
- Return type:
- release(claim_handle) bool ¶
Release deprecated: Use MarkSmartObjectSlotAsFree instead.
- Parameters:
claim_handle (SmartObjectClaimHandle) –
- Return type:
- remove_tag_from_instance(handle, tag) None ¶
Removes a single tag from the smartobject instance represented by the provided handle.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
tag (GameplayTag) – Tag to remove from the SmartObject instance.
- remove_tag_from_slot(slot_handle, tag) bool ¶
Removes a single tag from the smart object slot represented by the provided handle.
- Parameters:
slot_handle (SmartObjectSlotHandle) – Handle to the smart object slot.
tag (GameplayTag) – Tag to remove from the smart object slot.
- Returns:
True if the tag was removed.
- Return type:
- set_enabled(handle, enabled) bool ¶
Enables or disables the entire smart object represented by the provided handle using the default reason (i.e. Gameplay).. Delegate ‘OnEvent’ is broadcasted with ESmartObjectChangeReason::OnEnabled/ESmartObjectChangeReason::OnDisabled if state changed.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
enabled (bool) – If true enables the smart object, disables otherwise.
- Returns:
True when associated smart object is found and set (or already set) to desired state; false otherwise.
- Return type:
- set_enabled_for_reason(handle, reason_tag, enabled) bool ¶
Enables or disables the entire smart object represented by the provided handle using the specified reason. Delegate ‘OnEvent’ is broadcasted with ESmartObjectChangeReason::OnEnabled/ESmartObjectChangeReason::OnDisabled if state changed.
- Parameters:
handle (SmartObjectHandle) – Handle to the smart object.
reason_tag (GameplayTag) – Valid Tag to specify the reason for changing the enabled state of the object. Method will ensure if not valid (i.e. None).
enabled (bool) – If true enables the smart object, disables otherwise.
- Returns:
True when associated smart object is found and set (or already set) to desired state; false otherwise.
- Return type:
- set_slot_enabled(slot_handle, enabled) bool ¶
Enables or disables the smart object slot represented by the provided handle.
- Parameters:
slot_handle (SmartObjectSlotHandle) – Handle to the smart object slot.
enabled (bool) – If true enables the slot, if false, disables the slot.
- Returns:
Previous enabled state.
- Return type:
- use(claim_handle, definition_class) SmartObjectBehaviorDefinition ¶
Use deprecated: Use MarkSmartObjectSlotAsOccupied instead.
- Parameters:
claim_handle (SmartObjectClaimHandle) –
- Return type: