Skip to main content

Python-based Data Binding

WORK IN PROGRESS

The Python Connector Library is a simple library written in python and c++ that provides functionality to start and load scene composer binary assets and interact with a predefined set of data binding items (Variant) through python scripting.

Building

On host, the project can be built, using the new cmake environment and by setting <cgi-studio-root>/cmake/Candera/PlayerConnector as source code location. To build the project, right-click PlayerConnectorDll in Visual Studio and click Build. When the build finished

//TODO

Python Connector Library

The library consists of a python class CanderaAppConnector. This class has the methods for getting and setting values to databinding items. Also callbacks can be registered that are invoked when a data binding value has been changed.

Constructor

Creates and instance of this class. Expects and absolute or relative path to the player connector binary as parameter.

Parameters
  1. BinaryPathBinaryLibraryPath: Absolute or relative path to the player connector binary

Init

Initializes the player with the provided asset path. Expects an absolute or relative path to the asset binary as parameter. Must be called before every other method. Returns a bool if the operation was successful.

Parameters
  1. AssetPath: Absolute or relative path to the asset binary
Returns Boolean if operation was successful

Step

Invokes the internal message processing and render loop execution. Needs to be called continuously. Databinding updates are reflected internally during the invocation of this method. Returns a bool if the operation was successful.

Parameters None
Returns Boolean if operation was successful

SetIntValue

Sets an integer value to a predefined databinding source item. 

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
  2. Value: The integer value
Returns Boolean if operation was successful

SetBoolValue

Sets a bool value to a predefined databinding source item. 

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
  2. Value: The bool value
Returns Boolean if operation was successful

SetStringValue

Sets a string to a predefined databinding source item. 

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
  2. Value: The string
Returns Boolean if operation was successful

SetFloatValue

Sets a float value to a predefined databinding source item. 

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
  2. Value: The float value
Returns Boolean if operation was successful

GetIntValue

Gets an int value from a predefined databinding source item.

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
Returns The integer value

GetBoolValue

Gets a bool value from a predefined databinding source item.

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
Returns The bool value

GetStringValue

Gets a string from a predefined databinding source item.

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
Returns The string

GetFloatValue

Gets a float value from a predefined databinding source item.

Parameters
  1. BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
Returns The float value

RegisterCallback

Registers a callback method. Multiple methods can be registered. Passed method must have two parameters. First param is  BindingSourceItem and second parameter is value.

Parameters
  1. CallbackFn: Callable type with two parameters
Returns Boolean if operation was successful

ShutDown

Shuts down the asset player and frees up allocated resources.

Parameters None
Returns Boolean if operation was successful