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) SmartObjectClaimHandle ¶
Claims smart object from a request result.
- Parameters:
request_result (SmartObjectRequestResult) – Request result for given smart object and slot index.
- Returns:
A handle binding the claimed smart object, its slot and a user id.
- Return type:
- find_smart_object(request) SmartObjectRequestResult ¶
Spatial lookup
- Parameters:
request (SmartObjectRequest) –
- 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) Array[SmartObjectRequestResult] or None ¶
Spatial lookup
- Parameters:
request (SmartObjectRequest) –
- Returns:
All valid smart objects in range.
out_results (Array[SmartObjectRequestResult]):
- Return type:
Array[SmartObjectRequestResult] or None
- 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_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) 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.
- Returns:
A pointer to the USmartObjectComponent* associated to the handle.
- Return type:
- get_smart_object_component_by_request_result(result) 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 .
- Returns:
A pointer to the USmartObjectComponent* associated to the handle.
- Return type:
- release(claim_handle) bool ¶
Release claim on a smart object.
- Parameters:
claim_handle (SmartObjectClaimHandle) – Handle to a claimed slot returned by any of the Claim methods.
- Returns:
Whether the claim was successfully released or not
- 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. 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_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 ¶
Start using a claimed smart object slot.
- 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 the user wants to use.
- Returns:
The base class pointer of the requested behavior definition class associated to the slot
- Return type: