LumaPictures / pymel

Python in Maya Done Right
Other
479 stars 130 forks source link

How to use the overrideModifier #344

Closed pmolodo closed 8 years ago

pmolodo commented 8 years ago

From pgrenier...@gmail.com on December 13, 2013 06:40:57

Hi, I run this script I got from this page (first example): http://download.autodesk.com/global/docs/maya2013/en_us/PyMel/generated/functions/pymel.core.windows/pymel.core.windows.overrideModifier.html And it doesn't seem to work.

I'm using Maya 2014 I'm working on Windows 7 Professionnal Service Pack1 64bit

I don't know which version of PyMEL I'm using. Where should I look for this?

The expected output is to get the "s" key, in maya, to act like the "Alt" key (navigation tool). It seems to have no effect other than giving me this message:

// Error: "overrideModifier -press Alt"; // // Error: Line 1.29: Syntax error // // Error: "overrideModifier -press Alt"; // // Error: Line 1.29: Syntax error //

Here is the code I'm trying to run:

import pymel.core as pm

import maya.cmds as cmds

Example 1.

#

Map the "a" key such that it behaves just like the "Alt" key.

# pm.nameCommand( 'alternateAltPressCommand', annotation='"Alternate Alt-press modifier key"', command='"overrideModifier -press Alt"' )

Result: u'alternateAltPressCommand'

pm.nameCommand( 'alternateAltReleaseCommand', annotation='"Alternate Alt-release modifier key"', command='"overrideModifier -release Alt"' )

Result: u'alternateAltReleaseCommand'

pm.hotkey( keyShortcut='s', name='alternateAltPressCommand' ) pm.hotkey( keyShortcut='s', releaseName='alternateAltPressCommand' )

Anyone has any idea?

Thanks.

Original issue: http://code.google.com/p/pymel/issues/detail?id=311

pmolodo commented 8 years ago

From elron...@gmail.com on February 08, 2014 07:49:01

So, the problem here is that our examples are auto-generated off of Autodesk's examples, from here: http://download.autodesk.com/global/docs/maya2013/en_us/PyMel/generated/functions/pymel.core.windows/pymel.core.windows.overrideModifier.html ...which are also incorrect, in the same ways:

1) it's double-quoting the command 2) it's never assigning the release command, but just the press command twice.

This should "work":

nameCommand -annotation "Alternate Alt-press modifier key" -command "overrideModifier -press Alt" alternateAltPressCommand; nameCommand -annotation "Alternate Alt-release modifier key" -command "overrideModifier -release Alt" alternateAltReleaseCommand; hotkey -keyShortcut "a" -name "alternateAltPressCommand"; hotkey -keyShortcut "a" -releaseName "alternateAltReleaseCommand";

...however, it seems that you still can't use the overrideModifier command to affect the window-navigation behavior... =/

If you want to get either the example fixed, or make the overrideModifier affect window-navigation, you'll need to go through autodesk, so I'm closing this bug...

Status: WontFix

pmolodo commented 8 years ago

From pgrenier...@gmail.com on February 10, 2014 05:22:03

Thanks for helping!