unreal.SmartObjectSubsystem

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

Bases: unreal.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

claim(request_result) SmartObjectClaimHandle

Claim smart object from a valid request result.

Parameters

request_result (SmartObjectRequestResult) – Valid request result for given smart object and slot index. Ensure when called with an invalid result.

Returns

A claim handle binding the claimed smart object, its use index and a user id.

Return type

SmartObjectClaimHandle

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 the octree

Return type

SmartObjectRequestResult

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 for given pair of user and smart object. Error will be reported if the handle is invalid.

  • 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

SmartObjectBehaviorDefinition

get_slot_location(claim_handle) Vector or None

Returns the position (in world space) of the slot associated to the given claim handle. note: Method will ensure on invalid FSmartObjectClaimHandle.

Parameters

claim_handle (SmartObjectClaimHandle) – A valid handle (ClaimHandle.IsValid() returns true) 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_transform(claim_handle) Transform or None

Returns the transform (in world space) of the slot associated to the given claim handle. note: Method will ensure on invalid FSmartObjectClaimHandle.

Parameters

claim_handle (SmartObjectClaimHandle) – A valid handle (ClaimHandle.IsValid() returns true) 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_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) – Valid handle to a claimed smart object slot

Returns

A pointer to the USmartObjectComponent* associated to the handle.

Return type

SmartObjectComponent

release(claim_handle) bool

Release claim on a smart object.

Parameters

claim_handle (SmartObjectClaimHandle) – Handle for given pair of user and smart object. Does nothing if the handle is invalid.

Returns

Whether the claim was successfully released or not

Return type

bool

use(claim_handle, definition_class) SmartObjectBehaviorDefinition

Start using a claimed smart object slot.

Parameters
  • claim_handle (SmartObjectClaimHandle) – Handle for given pair of user and smart object. Error will be reported if the handle is invalid.

  • 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

SmartObjectBehaviorDefinition