Golaem Digital Asset Python API

Golaem Crowd is shipped with a SWIG generated glm.devkit Python module. The GDA Python API allows to query and manipulate the GDA file structure including creating, importing, editing and exporting a GDA file.

Including the GDA API file in a project

The GDA API can be added to a project by importing the module:

import glm.devkit as devkit

Initialize the GDA Python API

The GDA Python API is part of the Golaem Python API, which must be initialized first using:

devkit.initGolaem()

Then the GDA API can be initialized specifically:

devkit.initGda()

Uninitialize the GDA Python API

The GDA Python API must be uninitialized using:

devkit.finishGda()

After which, the Golaem Pyhton API can be uninitialized:

devkit.finishGolaem()

Available GDA Node types

(C) = GDA Container

Simulation
PopulationTool
EntityType
GroupType
        # environments
Terrain
Physics
Flock
Traffic
TrafficCrossing
TrafficRoad
Container (C)
        # behaviors
Behavior
BehaviorContainer (C)
ParallelOpBehavior (C)
LoopOpBehavior (C)
NoOrderOpBehavior (C)
AlternativeOpBehavior
AnchorOpBehavior
BlockOpBehavior
RandomOpBehavior

PlayAnimationBehavior
SyncAnimationBehavior
LocomotionBehavior
NavigationBehavior
NavAndLocoBehavior
GotoBehavior
PhysicalizeBehavior
ForceBehavior
FlockBehavior
SteerBehavior
PerchOnBehavior
MasterSlaveBehavior
TrafficBehavior
TrafficGotoBehavior
EmitBehavior
DetachBehavior
GroundAdaptBehavior
LookAtBehavior
IKBehavior
ClothBehavior
KillBehavior
MassSpringBehavior
CharacterControllerBehavior
ChannelOperatorBehavior
ActivateSensorBehavior
AdaptPositionBehavior
AdaptOrientationBehavior
SetFormationBehavior
GeometryBehavior
SetBoneBehavior
SetTerrainBehavior
UnsupportedBehavior
        # channel operators
ChannelOperator
ChOpInput
ChOpSensorInput
ChOpOperation
ChOpMultiplexer
ChOpConverter
ChOpAccu
ChOpOutput
        # triggers
Trigger
TriggerContainer (C)
RandomTrigger
PolygonZoneTrigger
BooleanTrigger
LogicalOperatorTrigger
AccuOpTrigger
MotionTimeTrigger
ScalarComparisonTrigger
DistanceTrigger
BehaviorTimeTrigger
CollisionTrigger
ExpressionTrigger
FadeTrigger
UnsupportedTrigger
        # misc
MotionClip
RigidBody
Ramp
Sensor

Available GDA Attribute types

int32
int64
uint32
uint64
float
vec3
vec4
string
mesh
int32Array
int64Array
uint32Array
uint64Array
floatArray
vec3Array
vec4Array
meshArray

Attribute types also include node types

Available GDA Attribute data types

GDA Attribute data types are used for automatic unit conversions for DCCs.

none
distance
angle
mass
speed
acceleration
color
force
direction

GDA Type functions

GDAGetNodeTypeId

GDAGetNodeTypeId(nodeTypeName: str) -> int

Returns the GDA Node type id from it's type name or -1 if the type name is unknown. The available node types are listed above.

Parameter name Type Properties
nodeTypeName str Name of the GDA Node type.

 

GDAGetNodeTypeName

GDAGetNodeTypeName(nodeType: int) -> str

Returns the GDA Node type name from it's id or an empty string if the type id is unknown.

Parameter name Type Properties
nodeType int Id of the GDA Node type.

 

GDAGetAttributeTypeId

GDAGetAttributeTypeId(attributeTypeName: str) -> int

Returns the GDA Attribute type id from it's type name or -1 if the type name is unknown. The available attribute types are listed above. Attribute types also include node types

Parameter name Type Properties
attributeTypeName str Name of the GDA Attribute type.

 

GDAGetAttributeTypeName

GDAGetAttributeTypeName(attributeType: int) -> str

Returns the GDA Attribute type name from it's id or an empty string if the type id is unknown.

Parameter name Type Properties
attributeType int Id of the GDA Attribute type.

 

GDA Attribute functions

GDAAttributeCreate

GDAAttributeCreate(name: str, type: str, dimension = 0: int, sizes = None: devkit.sizetArray) -> int

Creates a GDA Attribute and returns its id. The id can be used to query or manipulate the attribute with API functions.

Parameter name Type Properties
name str Name of the attribute to create.
type str Type of the attribute to create. The available types are listed above.
dimension int Dimension of the attribute. Defaults to 0. Indicates the dimension of the array of values for the attribute (0 - single value, 1 - one-dimensional array, etc.)
sizes devkit.sizetArray An array with the size for each dimension of the attribute. Defaults to None.

 

GDAAttributeResize

GDAAttributeResize(attributeId: int, dimension: int, sizes: devkit.sizetArray) -> None

Resizes a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
dimension int Dimension of the attribute. Indicates the dimension of the array of values for the attribute (0 - single value, 1 - one-dimensional array, etc.)
sizes devkit.sizetArray An array with the size for each dimension of the attribute.

 

GDAAttributeSetXXXValue

GDAAttributeSetInt32Value(attributeId: int, value: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetInt64Value(attributeId: int, value: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetUint32Value(attributeId: int, value: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetUint64Value(attributeId: int, value: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetFloatValue(attributeId: int, value: float, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetVec3Value(attributeId: int, value: devkit.floatArray, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetVec4Value(attributeId: int, value: devkit.floatArray, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetStringValue(attributeId: int, value: str, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetInt32ArrayValue(attributeId: int, value: devkit.int32Array, count: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetInt64ArrayValue(attributeId: int, value: devkit.int64Array, count: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetUint32ArrayValue(attributeId: int, value: devkit.uint32Array, count: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetUint64ArrayValue(attributeId: int, value: devkit.uint64Array, count: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetFloatArrayValue(attributeId: int, value: devkit.floatArray, count: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetVec3ArrayValue(attributeId: int, value: devkit.floatArray, count: int, indexes = None: devkit.sizetArray) -> None
GDAAttributeSetVec4ArrayValue(attributeId: int, value: devkit.floatArray, count: int, indexes = None: devkit.sizetArray) -> None

Sets the value of a GDA Attribute according to its type. Only the function matching the type of the attribute will have an effect.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
value (see signatures above) The value to set. 
count int In case of an array attribute, the number of elements to set
indexes devkit.sizetArray An array containing the indexes of each dimension in case of a multidimensional attribute

 

GDAAttributeGetXXXValue

GDAAttributeGetInt32Value(attributeId: int, indexes = None: devkit.sizetArray) -> int
GDAAttributeGetInt64Value(attributeId: int, indexes = None: devkit.sizetArray) -> int
GDAAttributeGetUint32Value(attributeId: int, indexes = None: devkit.sizetArray) -> int
GDAAttributeGetUint64Value(attributeId: int, indexes = None: devkit.sizetArray) -> int
GDAAttributeGetFloatValue(attributeId: int, indexes = None: devkit.sizetArray) -> float
GDAAttributeGetVec3Value(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[float*]
GDAAttributeGetVec4Value(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[float*]
GDAAttributeGetStringValue(attributeId: int, indexes = None: devkit.sizetArray) -> str
GDAAttributeGetInt32ArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[int*]
GDAAttributeGetInt64ArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[int*]
GDAAttributeGetUint32ArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[int*]
GDAAttributeGetUint64ArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[int*]
GDAAttributeGetFloatArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[float*]
GDAAttributeGetVec3ArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[float*]
GDAAttributeGetVec4ArrayValue(attributeId: int, indexes = None: devkit.sizetArray) -> SwigPyObject[float*]

Returns the value of a GDA Attribute according to its type. Only the function matching the type of the attribute will return a valid value.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
indexes devkit.sizetArray An array containing the indexes of each dimension in case of a multidimensional attribute

The SwigPyObject is an object generated by SWIG containing an array. It can be treated as a Python list.

 

GDAAttributeGetArraySize

GDAAttributeGetArraySize(attributeId: int, indexes = None: devkit.sizetArray) -> int

Returns the size of a GDA Attribute value array in case the attribute is an array type (int32Array, int64Array, uint32Array, uint64Array, floatArray, vec3Array or vec4Array).

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
indexes devkit.sizetArray An array containing the indexes of each dimension in case of a multidimensional attribute

 

GDAAttributeGetDimension

GDAAttributeGetDimension(attributeId: int) -> int

Returns the dimension of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetSizes

GDAAttributeGetSizes(attributeId: int) -> SwigPyObject[int*]

Returns an array containing the size of the GDA attribute for each dimension.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetName

GDAAttributeGetName(attributeId: int) -> str

Returns the name of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetType

GDAAttributeGetType(attributeId: int) -> str

Returns the type of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetTypeId

GDAAttributeGetTypeId(attributeId: int) -> int

Returns the type id of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetShortestUniqueName

GDAAttributeGetShortestUniqueName(attributeId: int) -> str

Returns the shortest unique name of a GDA Attribute, in the form [prefix].[attributeName]. The [prefix] part consists of at least the name of the GDA Node containing the attribute, but can also include GDA Containers above, like for example beOpParallelShape1.sitMotionShape.stoppingDurationMin.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetNode

GDAAttributeGetNode(attributeId: int) -> int

Returns the id of the GDA Node to which a GDA Attribute belongs, or -1 if the attribute is not associated to a node.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeIsPublic

GDAAttributeIsPublic(attributeId: int) -> bool

Returns True if a GDA Attribute is public.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeSetPublic

GDAAttributeSetPublic(attributeId: int, value: bool) -> None

Sets the public state of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
value bool True to set the attribute public (attributes are not public by default)

 

GDAAttributeGetDataType

GDAAttributeGetDataType(attributeId: int) -> str

Returns the data type of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeGetDataTypeId

GDAAttributeGetDataTypeId(attributeId: int) -> int

Returns the data type id of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.

 

GDAAttributeSetDataType

GDAAttributeSetDataType(attributeId: int, dataType: str) -> None

Sets the data type of a GDA Attribute. The available data types are listed above.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
dataType str The data type of the attribute

 

GDAAttributeSetDataTypeId

GDAAttributeSetDataTypeId(attributeId: int, dataTypeId: int) -> None

Sets the data type id of a GDA Attribute.

Parameter name Type Properties
attributeId int Id of the GDA Attribute.
dataTypeId int The data type id of the attribute

 

GDA Connection Functions

GDAConnectionCreate

GDAConnectionCreate(sourceAttributeId: int, destinationAttributeId: int, sourceIndex = None: devkit.sizetArray, destinationIndex = None: devkit.sizetArray) -> int

Creates a connection between two attributes and returns its id. The id can be used to query or manipulate the connection with API functions.

Parameter name Type Properties
sourceAttributeId int Id of the source GDA Attribute.
destinationAttributeId int Id of the destination GDA Attribute.
sourceIndex devkit.sizetArray In case of a multidimensional attribute, an array containing the indexes of each dimension of the source attribute. 
destinationIndex devkit.sizetArray In case of a multidimensional attribute, an array containing the indexes of each dimension of the destination attribute.

 

GDAConnectionIsValid

GDAConnectionIsValid(connectionId: int) -> bool

Returns True if a connection is valid. The connection is valid if its attributes belong to the same container or parent/ancestor container as the connection and if the attributes have compatible types (this usually means that they have the same type).

Parameter name Type Properties
connectionId int Id of the GDA Connection.

 

GDAConnectionGetContainer

GDAConnectionGetContainer(connectionId: int) -> int

Returns the id of the GDA Container to which a GDA Connection belongs, or -1 if the connection doesn't belong to a container.

Parameter name Type Properties
connectionId int Id of the GDA Connection.

 

GDA Node Functions

GDANodeCreate

GDANodeCreate(name: str, type: str) -> int

Creates a GDA Node and returns its id. The id can be used to query or manipulate the node with API functions.

Parameter name Type Properties
name str Name of the GDA Node to create.
type str Type of the GDA Node to create. The available types are listed above.

 

GDANodeAddAttribute

GDANodeAddAttribute(nodeId: int, attributeId: int) -> bool

Adds an existing GDA Attribute to a GDA Node. Returns True if the operation was successful, false otherwise.

Parameter name Type Properties
nodeId int Id of the GDA Node.
attributeId int Id of the GDA Attribute to add to the node

 

GDANodeGetName

GDANodeGetName(nodeId: int) -> str

Returns the name of a GDA Node.

Parameter name Type Properties
nodeId int Id of the GDA Node.

 

GDANodeGetType

GDANodeGetType(nodeId: int) -> str

Returns the type of a GDA Node.

Parameter name Type Properties
nodeId int Id of the GDA Node.

 

GDANodeGetTypeId

GDANodeGetTypeId(nodeId: int) -> int

Returns the type id of a GDA Node.

Parameter name Type Properties
nodeId int Id of the GDA Node.

 

GDANodeGetAttributesCount

GDANodeGetAttributesCount(nodeId: int) -> int

Returns the number of GDA Attributes that belong to a GDA Node.

Parameter name Type Properties
nodeId int Id of the GDA Node.

 

GDANodeGetAttribute

GDANodeGetAttribute(nodeId: int, index: int) -> int

Returns the id of the GDA Attribute in a GDA Node at the specified index.

Parameter name Type Properties
nodeId int Id of the GDA Node.
index int Index of the GDA Attribute

 

GDANodeFindAttribute

GDANodeFindAttribute(nodeId: int, name: str, printError = True: bool) -> int

Searches for the attribute with the given name belonging to a GDA Node and returns its id if found, or -1 otherwise.

Parameter name Type Properties
nodeId int Id of the GDA Node.
name str Name of the GDA Attribute to search for
printError bool If True, prints an error if the node doesn't have an attribute with the given name. Defaults to True

 

GDANodeGetContainer

GDANodeGetContainer(nodeId: int) -> int

Returns the id of the GDA Container to which a GDA Node belongs, or -1 if the node has no container.

Parameter name Type Properties
nodeId int Id of the GDA Node.

 

GDANodeIsContainer

GDANodeIsContainer(nodeId: int) -> bool

Returns True if a GDA Node is a container, False otherwise.

Parameter name Type Properties
nodeId int Id of the GDA Node.

 

GDA Container Functions

GDAContainerCreate

GDAContainerCreate(name: str, type: str) -> int

Creates a GDA Container and returns its id. The id can be used to query or manipulate the container with API functions.

Parameter name Type Properties
name str Name of the GDA Container to create.
type str Type of the GDA Container to create. The available types are listed above.

 

GDAContainerAddNode

GDAContainerAddNode(containerId: int, nodeId: int) -> bool

Adds an existing GDA Node to a GDA Container. Returns True if the operation was successful, false otherwise.

Parameter name Type Properties
containerId int Id of the GDA Container.
nodeId int Id of the GDA Node to add to the container

 

GDAContainerAddConnection

GDAContainerAddConnection(containerId: int, connectionId: int) -> bool

Adds an existing GDA Connection to a GDA Container. Returns True if the operation was successful, false otherwise.

Parameter name Type Properties
containerId int Id of the GDA Container.
nodeId int Id of the GDA Connection to add to the container

 

GDAContainerSaveToGdaFile

GDAContainerSaveToGdaFile(containerId: int, filePath: str) -> bool

Saves a GDA Container to a file. Returns True if the save was successful, False otherwise.

Parameter name Type Properties
containerId int Id of the GDA Container.
filePath str The file path to save the container to

 

GDAContainerLoadFromGdaFile

GDAContainerLoadFromGdaFile(containerId: int, filePath: str) -> bool

Loads a GDA Container from a file. Returns True if the load was successful, False otherwise.

Parameter name Type Properties
containerId int Id of the GDA Container.
filePath str The file path to load the container from

 

GDAContainerSetVersion

GDAContainerSetVersion(containerId: int, version: str) -> None

Sets the version of a GDA Container.

Parameter name Type Properties
containerId int Id of the GDA Container.
version str The version string to set

 

GDAContainerSetUpdateFramerate

GDAContainerSetUpdateFramerate(containerId: int, updateFramerate: float) -> None

Sets the update frame rate of a GDA Container. This is the update frame rate used when replaying the simulation in the Golaem Engine.

Parameter name Type Properties
containerId int Id of the GDA Container.
updateFramerate float The update frame rate to set

 

GDAContainerFindNode

GDAContainerFindNode(containerId: int, name: str, printError = True: bool) -> int

Searches for the node with the given name belonging to a GDA Container and returns its id if found, or -1 otherwise.

Parameter name Type Properties
nodeId int Id of the GDA Container.
name str Name of the GDA Node to search for
printError bool If True, prints an error if the container doesn't have a node with the given name. Defaults to True

 

GDAContainerGetNodesCount

GDAContainerGetNodesCount(containerId: int) -> int

Returns the number of GDA Nodes in a GDA Container.

Parameter name Type Properties
containerId int Id of the GDA Container.

 

GDAContainerGetNode

GDAContainerGetNode(containerId: int, index: int) -> int

Returns the id of the GDA Node in a GDA Container at the specified index.

Parameter name Type Properties
containerId int Id of the GDA Container.
index int Index of the GDA Node.

 

GDAContainerGetConnectionsCount

GDAContainerGetConnectionsCount(containerId: int) -> int

Returns the number of GDA Connections in a GDA Container.

Parameter name Type Properties
containerId int Id of the GDA Container.

 

GDAContainerGetConnection

GDAContainerGetConnection(containerId: int, index: int) -> int

Returns the id of the GDA Connection in a GDA Container at the specified index.

Parameter name Type Properties
containerId int Id of the GDA Container.
index int Index of the GDA Connection.

 

GDAContainerGetVersion

GDAContainerGetVersion(containerId: int) -> str

Returns the version string of a GDA Container.

Parameter name Type Properties
containerId int Id of the GDA Container.

 

GDAContainerComputeAttributesShortestUniqueNames

GDAContainerComputeAttributesShortestUniqueNames(containerId: int) -> None

Computes the shortest unique names of all the attributes in a GDA Container.

Parameter name Type Properties
containerId int Id of the GDA Container.

 

GDAContainerisContaminated

GDAContainerisContaminated(containerId: int) -> bool

Returns True if a GDA Container is contaminated by PLE.

Parameter name Type Properties
containerId int Id of the GDA Container.

 

Miscellaneous Functions

GDANodesEqual

GDANodesEqual(nodeId1: int, nodeId2: int, precision = 0.00001: float) -> bool

Compares two GDA Nodes and returns True if the nodes are equal.

Parameter name Type Properties
nodeId1 int Id of the first GDA Node.
nodeId2 int Id of the second GDA Node.
precision float The precision for comparing floating point attributes. Defaults to 0.00001