Saturday 29 October 2011

Maya Tool Settings disappeared

I fire up Maya 2012 this morning and the Tool Settings widget is gone. It seemed to have shrunk to nothing whilst docked in the default left side of the window. Fixed it like this:
import maya.cmds as mc
mc.dockControl( "dockControl5", e=True, area="right" )
This moves it to the right side of the window like in older versions of Maya, from there it can be moved around as normal.

Tuesday 18 October 2011

Handling HasNoEffect state on a plugin node.

If you're writing a Maya plugin node, you might want to handle the case where the user sets the node state to HasNoEffect. The state is an input attribute that is implicitly defined for any node. You can query it in a similar way to any other input attribute:
stateHnd = dataBlock.inputValue( self.state ) #MDataHandle
if stateHnd.asInt() == 1 :
inMeshHnd = dataBlock.inputValue( self.inMesh )
outMeshHnd = dataBlock.outputValue( self.outMesh )
inMeshObj = inMeshHnd.asMesh() # MObject
outMeshHnd.setMObject( inMeshObj )
dataBlock.setClean( plug )
return OpenMaya.MStatus.kSuccess

Thursday 13 October 2011

Wing IDE up and running!

Got Wing IDE set up and debugging Maya. This page was very useful for that: Mel Wiki. However I had to change something to get it to send hi-lighted text from the editor to Maya. The line:
af, socktype, proto, canonname, sa = res[0]
became:
af, socktype, proto, canonname, sa = res[1]