changing to 'move' mode during 'draggerContext' command

136 views
Skip to first unread message

e955...@gmail.com

unread,
Sep 28, 2014, 6:08:20 AM9/28/14
to python_in...@googlegroups.com
Hello,

im trying to create a sphere with an onPress() call and then when the user begins to drag the cursor i want the sphere to move like the central move manipulator had been selected.

However it seems i have to release the button press and then select the move tool and pyhsically grab the central move manipulator if i want to do it. I really need to be able to do the sphere creation and sphere positioning all in one 'click and drag' action.

hope this makes sense. the code is below. All i need is a command which will allow the newly created sphere to accept normal movement input from the mouse during the 'onDrag()' call.

####################################################
import maya.cmds as cmds

Context='Context'

#sphere is created at 0,0,0
def onPress():
cmds.polySphere()
cmds.refresh()

def onDrag():
#here: as the user drag the mouse the sphere should follow the movement of it.
cmds.refresh()

if cmds.draggerContext(Context, exists=True):
cmds.deleteUI(Context)
cmds.draggerContext(Context, pressCommand=onPress, dragCommand=onDrag, name=Context, cursor='crossHair')
cmds.setToolTo(Context)
##########################################################

thanks all, any help would be super
Sam

e955...@gmail.com

unread,
Sep 28, 2014, 9:20:05 AM9/28/14
to python_in...@googlegroups.com, e955...@gmail.com
i tried using

cmds.setToolTo('moveSuperContext')
cmds.refresh()

in the onDrag() function. This is basically what i want but with the cursor movements controlling the move pivot

Reply all
Reply to author
Forward
0 new messages