Message 1 of 1
How does python control the properties in the secondary window?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, everyone, how does python control the properties in the secondary window? I use (cmds.ls (SL = 1, Dag = 1, s = 1, type =' pgyetigroom') to perform object properties, and the result is No object matches name. How can I enter the secondary window through python?
I write a script for reporting errors.
import maya.cmds as cmds
import maya.mel as mel
def yeti_display_seting(option='brushRadius'):
sel = cmds.ls(sl=1, dag=1, s=1, type='pgYetiGroom')
if len(sel) > 0:
pgYetiGroom = sel
else:
pgYetiGroom = cmds.ls(type='pgYetiMaya')
for i in pgYetiGroom:
if option == 'brushRadius':
cmds.setAttr(i + '.brushRadius', 5)
cmds.window( title='reset')
cmds.columnLayout()
cmds.button(l='reset', c="yeti_display_seting(option='brushRadius')")
cmds.showWindow()
I found some code about this window in the plug-in script.
def pgYetiGroomContextProperties():
parent=str(cmds.toolPropertyWindow(q=1, location=1))
cmds.setParent(parent)
combContext=str(pm.mel.pgYetiGroomContextNameQuery())
# create a "global" tool collection for our tools
if cmds.toolCollection('pgYetiGroomToolCollection', exists=1):
cmds.deleteUI('pgYetiGroomToolCollection')
cmds.toolCollection('pgYetiGroomToolCollection', gl=True)
cmds.setUITemplate('OptionsTemplate', pushTemplate=1)
# create the top-level layout. This must have the
# same name as the string returned from getClassName
cmds.columnLayout('pgYetiGroomContext', adj=True)
parent+="|pgYetiGroomContext"
cmds.frameLayout('pgYetiGroomBrushFrame', cll=True, l="Brush", cl=False)
cmds.columnLayout('pgYetiGroomBrushLayout', adj=True)
cmds.floatSliderGrp('brushStrength', min=-1.0, cc=lambda *args: pm.mel.eval(("pgYetiGroomCtxCommand -e -brushStrength " + combContext)), max=1.0, ann="Brush Strength", label="Strength", field=1)
cmds.floatSliderGrp('brushRadius', min=0.0, cc=lambda *args: pm.mel.eval(("pgYetiGroomCtxCommand -e -brushRadius " + combContext)), max=10.0, ann="Brush Radius", label="Radius", field=1)
cmds.floatSliderGrp('brushSoftness', min=0.0, cc=lambda *args: pm.mel.eval(("pgYetiGroomCtxCommand -e -brushSoftness " + combContext)), max=1.0, ann="Brush Softness", label="Softness", field=1)
pgYetiGroomContextProperties()