Query and edit attributes in Golaem Editors

As Golaem Editors are QT based, it is possible to query or edit their controllers and attributes using the QT Python modules.

Access the Maya Main Window

import glm.mayaUtils as mutils
from glm.Qtpy.Qt import QtWidgets


# get the maya main qt window
mayaMainWnd = mutils.getMayaWindow()
# Result: <PySide2.QtWidgets.QWidget object at 0x00000284367EE8C8> #

List the Opened Golaem Editor IDs

In order to query the attributes of a Golaem Editor, its ID (aka QT objectName) is required first. Assuming the editor is opened, one can use the following to query the active windows IDs:

for widget in mayaMainWnd.findChildren(QtWidgets.QMainWindow):
   print(widget.windowTitle() + ' - ' + widget.objectName())
# Golaem Character Maker - GolaemCharacterMakerWnd
# Golaem Behavior Editor - GolaemBehaviorEditorWnd

Some editors are also dockable widgets such as the Visual Feedback or the Motion Clip Preview tool

for widget in mayaMainWnd.findChildren(QtWidgets.QDockWidget):
   print(widget.windowTitle() + ' - ' + widget.objectName())
# Golaem Visual Feedback - GolaemVisualFeedbackWnd
# Golaem Motion Clip Preview - GolaemMotionClipPreviewWnd

Access a Golaem Editor Window

glmWindow = mayaMainWnd.findChild(QtWidgets.QWidget, "GolaemCharacterMakerWnd")
# Result: <PySide2.QtWidgets.QMainWindow object at 0x0000028502A80C48> #

List the Golaem Editor Attribute IDs

In order to set or query an attribute of a Golaem Editor, its ID (aka QT objectName) is required first. One can use the following to query the attribute IDs. If the attribute is a button:

for widget in glmWindow.findChildren(QtWidgets.QAbstractButton):
   print(widget.text() + ' - ' + widget.objectName())
# Store Full Animation as Blind Data - specificAnimationInBlindDataCheckBox
# Fix Position/Orientation offset on blending frames only - checkBoxFixPosOriWithBlendingFrames

In order to set or query an attribute of a Golaem Editor, its ID (aka QT objectName) is required first. One can use the following to query the attribute IDs. If the attribute is a numerical value:

for widget in glmWindow.findChildren(QtWidgets.QDoubleSpinBox):
   print(widget.objectName() + ' - ' + widget.text())
# doubleSpinBoxFootprintSpeedThreshold - 1.00 m/s
# doubleSpinBoxFootprintGroundHeightThreshold - 0.30 m

Access a Golaem Attribute

glmAttr = glmWindow.findChild(QtWidgets.QWidget, "specificAnimationInBlindDataCheckBox")
# Result: <pyside2.qtwidgets.qcheckbox 0x0000028502a80c88="" at="" object=""> #

Once access, depending on the type, the value can be get or set the following way

# if the attribute is a checkbox
glmAttr.setChecked(True)
glmAttr.isChecked()

# if the attribute is a numerical spin box
glmAttr.setValue(2.0)
glmAttr.value()

Python Examples

# check the export animation blind data checkbox of the Character Maker
import glm.mayaUtils as mutils
from glm.Qtpy.Qt import QtWidgets

mayaMainWnd = mutils.getMayaWindow()
glmWindow = mayaMainWnd.findChild(QtWidgets.QWidget, "GolaemCharacterMakerWnd")
glmAttr = glmWindow.findChild(QtWidgets.QWidget, "specificAnimationInBlindDataCheckBox")
glmAttr.setChecked(True)