rotate difference in Mel and python

89 views
Skip to first unread message

Todd Widup

unread,
Feb 25, 2016, 4:19:13 PM2/25/16
to python_in...@googlegroups.com
mel and maya.cmds

rotate -r -os 0 45 0;

works different than

pymel

pm.rotate(0,45,0,r=1,os=1)

any ideas why and what is going on with it?


--
Todd Widup
Creature TD / Technical Artist
to...@toddwidup.com
todd....@gmail.com
www.toddwidup.com

Kurian O.S

unread,
Feb 25, 2016, 4:27:38 PM2/25/16
to python_in...@googlegroups.com
rotate take a list 


pm.rotate([0,45,0], r=1, os=1)

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABBPk34Ewu9_i_cTd48jB2GGMm11XNYjhOYmJAm-5o0SPn6-sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
--:: Kurian ::--

Todd Widup

unread,
Feb 25, 2016, 4:41:17 PM2/25/16
to python_in...@googlegroups.com
it works without it as well..atleast here is it and errors on a list


For more options, visit https://groups.google.com/d/optout.



--

Todd Widup

unread,
Feb 25, 2016, 4:42:44 PM2/25/16
to python_in...@googlegroups.com
the point being though...I can get it to work in either...but the same values actually rotate differently between mel/maya.cmds and pymel

damon shelton

unread,
Feb 25, 2016, 4:55:55 PM2/25/16
to python_in...@googlegroups.com

Todd Widup

unread,
Feb 25, 2016, 4:57:17 PM2/25/16
to python_in...@googlegroups.com
hye Damon, I would normally...was just testing something and found this bug/strange behavior


For more options, visit https://groups.google.com/d/optout.

Geordie Martinez

unread,
Feb 25, 2016, 5:36:21 PM2/25/16
to python_inside_maya

pm.rotate can take 3 floats or a dt.Vector(float,float,float) or just a tuple with three floats. pm.rotate((0,45,0),r=True, os=True)
it is flexible.


Todd Widup

unread,
Feb 25, 2016, 5:45:54 PM2/25/16
to python_in...@googlegroups.com
but the point is...try teh commands...pymel is rotating a node differently than maya.cmds or mel



For more options, visit https://groups.google.com/d/optout.

Geordie Martinez

unread,
Feb 26, 2016, 3:00:18 AM2/26/16
to python_inside_maya

try this:

import pymel.core as pm
pm.rotate((0,45,0),os=True,r=True)
# or
pm.selected()[0].rotate.set((0,45,0))
# or
pm.rotate(pm.selected()[0], 0,45,0,os=True,r=True)

These all work as expected. 


Martin Y

unread,
Feb 26, 2016, 5:30:56 AM2/26/16
to Python Programming for Autodesk Maya
In pm you need to put the coordinates in a list or tuple.

pm.rotate((0,45,0), os=True, r=True)
pm.rotate([0,45,0], os=True, r=True)

works fine

pm.rotate(0,45,0, os=True, r=True)

doesn't.

I tried the pymel examples where they aren't using lists or tuples and it doesn't work here even when I'm using the same pymel version.
I guess the pymel examples in the manuals are outdated.

Martin

Todd Widup

unread,
Feb 26, 2016, 10:33:49 AM2/26/16
to python_in...@googlegroups.com
hmmm strange...anyways..in a list here, it errors.  not sure whats going on..oh well...was just trying to figure out if this was a bug or not

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Todd Widup

unread,
Feb 26, 2016, 10:37:12 AM2/26/16
to python_in...@googlegroups.com
figured out what it is

if I do
pm.rotate(0,45,0,r=1,os=1)
its actually rotating 45 on x, not y..its thinking that first 0 is an object, but it still applies it to the selected node, so that is a bug

Geordie Martinez

unread,
Feb 26, 2016, 10:43:44 AM2/26/16
to python_in...@googlegroups.com
That's not a bug. 
The first argument is supposed to be an object. The docs say this function was modified to accept any iterable. 

In pymel youre in object-oriented mode so just use the method on the object to affect rotation. 

node.rotate.set((0,45,0))

If you're going to use pymel, take advantage of OOP.

Todd Widup

unread,
Feb 26, 2016, 11:04:00 AM2/26/16
to python_in...@googlegroups.com
no geordie..I dont want to lol :D


For more options, visit https://groups.google.com/d/optout.

Geordie Martinez

unread,
Feb 26, 2016, 11:12:16 AM2/26/16
to python_in...@googlegroups.com
Don't be afraid of change , Todd!
pm.iLoveYou().rotate.set((0,45,0)

Todd Widup

unread,
Feb 26, 2016, 11:32:39 AM2/26/16
to python_in...@googlegroups.com
lol  
well..didnt know you could do rotate.set...normally use setAttr for that part.  




For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages