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. It does so, by calling exported methods of a dll binary. 

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

Python Connector Library

ReferenceThe commentslibrary 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 Init Step SetIntValue SetBoolValue SetStringValue SetFloatValue GetIntValue GetBoolValue GetStringValue GetFloatValue RegisterCallback ShutDown

    Constructor

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

    Parameters
      BinaryPath: 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
        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
          BindingSourceItem: Enum that specifies the binding source item. Enum is defined in scriptsGenerated/BindingSourceEnum.py Value: The integer value Returns Boolean if operation was successful

          SetBoolValue

          CopySets a simpliedbool versionvalue to documentationa (includingpredefined comments)databinding source item. 

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

            SetStringValue

            Sets a string to a predefined databinding source item. 

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

              SetFloatValue

              Sets a float value to a predefined databinding source item. 

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

                GetIntValue

                Gets an int value from a predefined databinding source item.

                Parameters
                  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
                    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
                      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
                        BindingSourceItem: Enum that specifies the binding source item. Enum is defined in Generated/BindingSourceEnum.py
                        Returns The float value