Open 3D Engine EditorPythonBindings Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
EditorPythonBindings::CustomTypeBindingNotifications Class Referenceabstract

#include <CustomTypeBindingBus.h>

Inherits AZ::EBusTraits.

Public Types

using BusIdType = AZ::TypeId
 
using ValueHandle = std::intptr_t
 
using AllocationHandle = AZStd::optional< AZStd::pair< ValueHandle, AZ::BehaviorObject > >
 Allocate a default value for the supplied type.
 

Public Member Functions

virtual AllocationHandle AllocateDefault ()=0
 
virtual AZStd::optional< ValueHandlePythonToBehavior (PyObject *pyObj, AZ::BehaviorParameter::Traits traits, AZ::BehaviorArgument &outValue)=0
 This method converts an incoming Python value into a behavior value; it should fill out the outValue fields.
 
virtual AZStd::optional< ValueHandleBehaviorToPython (const AZ::BehaviorArgument &behaviorValue, PyObject *&outPyObj)=0
 This method convert an incoming behavior value into a Python value; it should fill out the outPyObj pointer.
 
virtual bool CanConvertPythonToBehavior (AZ::BehaviorParameter::Traits traits, PyObject *pyObj) const =0
 
virtual void CleanUpValue (ValueHandle handle)=0
 

Static Public Attributes

static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple
 
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById
 

Detailed Description

A team can define custom generic types to be created for a TypeId The handler will need to allocate, deallocate, and convert behavior data to Python values NOTE: if the TypeId is registered with the Behavior Context then that will be used instead of this custom binding

Member Typedef Documentation

◆ ValueHandle

This handle is used to identify the allocations an external module used to prepare the value After the EPB gem is done with the conversion, this handle will be sent back via the CleanUpValue() notification to indicate that the module should clean up the allocations for that value conversion

Member Function Documentation

◆ CanConvertPythonToBehavior()

virtual bool EditorPythonBindings::CustomTypeBindingNotifications::CanConvertPythonToBehavior ( AZ::BehaviorParameter::Traits  traits,
PyObject *  pyObj 
) const
pure virtual

This method is used to determine that the behavior value can be processed using the Python object type as input NOTE: it should not actually do the conversion only detect IF it can be done with the supplied Python type

◆ CleanUpValue()

virtual void EditorPythonBindings::CustomTypeBindingNotifications::CleanUpValue ( ValueHandle  handle)
pure virtual

This is used to deallocate the value used by the PythonToBehavior() or BehaviorToPython() methods The notification module is responsible for mapping the handle to the value's allocation(s)


The documentation for this class was generated from the following file: