I would like to make an HDA in Maya to have certain "Asset Options" set by default. Typing the following in the MEL script editor works:
setAttr myHdaName1.splitGeosByGroup 1
If i type the following in the Python script editor it also works:
cmds.setAttr("myHdaName1.splitGeosByGroup", 1)
Now, I would like the HDA to set that automatically, or have a button on the HDA that sets it for the user. There is some documentation, but I guess I am missing some basic steps. Here is what I tried:
Adding Callback script to button:
hou.phm().turnToggleOn()
#Button needs Callback Script: #hou.phm().turnToggleOn() def turnToggleOn(): me = hou.pwd() me.setParms({"myToggle": 1}) print ("Turned Toggle on")
It works for the areas in green, but does not for the red area.
How can I do this with the "Asset Option" splitGeosByGroup?
I tried a lot of uneducated nonsense here, none of that worked for me:
def groupToggle():
import maya.cmds as cmds
import maya.mel as mel
import hou
cmds.setAttr("TA_cmarzy__maya__groups_example__1_21.splitGeosByGroup", 1)
mel.setAttr("TA_cmarzy__maya__groups_example__1_21.splitGeosByGroup", 1)
As you can see I did not even figure out how to reference the current HDA itself. The documentation on https://www.sidefx.com/docs/maya/_maya__scripting.html [www.sidefx.com] does not convey the basic steps to me. Could anyone explain what I am doing wrong?