Re: [Maya-Python] Making_the_Script_Editor_spit_back_Python_code_instead_of_MEL
For pymel you can use the tools provided with it. Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor Put the pymelScrollFieldReporter into the plugins dir Replace the original scriptEditorPanel.mel file inside: Maya2012\scripts\startup with the one from the pymel tools folder you need to change a few lines though in the py file to make it work with maya 2011 and 2012: add: from pymel.tools.mel2py import melparse change : mparser = mel2py.MelParser() to: mparser = melparse.MelParser() As for maya python itself there should be a simmilar way but i have not looked into it. Note though that using the pymel script editor panel slows down your code quite a lot especially when printing. and some features are disabled in the script editor!!! 2011/10/21 Sahak Sahakian loves2anim...@gmail.com Hi guys. How wold one go about making ScriptEditor spit back its history in Python? cheers -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
RE: [Maya-Python] Re: Which editor do you use?
As with Jan, I also use Visual Studio with the PTVS integration. Generally I find it much cleaner and organised than eclipse. From: python_inside_maya@googlegroups.com [mailto:python_inside_maya@googlegroups.com] On Behalf Of Jan: Sent: 21 October 2011 13:05 To: python_inside_maya@googlegroups.com Subject: Re: [Maya-Python] Re: Which editor do you use? I just started to use visual studio with the python implementation that has been released recently. I must say its quite good. Just need to get the hang of using visual studio. Before that Eclipse/Pydev which worked really well. 2011/10/6 PixelMuncher pixeldr...@gmail.commailto:pixeldr...@gmail.com I'll put in my 2 cents for Eclipse/Pydev. Works great for me. I have the creative crash plugin working as far as communicating w/ Maya, but I don't think autocomplete will work with straight Python (ie cmds.command...). -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
[Maya-Python] Re: command to turn off automatically orient joints in the move tool?
thanks Tim.How did you find that command? I didn´t saw it in the help Hey mike,I wanted to disable it by command, not manually because it mess up my script if it is on by default. Cheers On Oct 20, 1:08 pm, Mike Malinowski (LIONHEAD) mich...@microsoft.com wrote: In the tool settings there should be a group called 'Joint Orient Settings', within that there is an 'Automatically Orient Joints' checkbox which you can disable ( in Maya 2012 ) [cid:image001@01CC8F20.FAF99D90] -Original Message- From: python_inside_maya@googlegroups.com [mailto:python_inside_maya@googlegroups.com] On Behalf Of rudi Sent: 20 October 2011 11:50 To: python_inside_maya Subject: [Maya-Python] command to turn off automatically orient joints in the move tool? Hi I don´t find any command to turn off automatically orient joints in the move tool. I can´t find in the help docs. Any idea about it? Thanks -- view archives:http://groups.google.com/group/python_inside_maya change your subscription settings:http://groups.google.com/group/python_inside_maya/subscribe image001.jpg 30KViewDownload -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
Re: [Maya-Python] Re: command to turn off automatically orient joints in the move tool?
Normally I'd turn on Echo All in the script editor and see what gets spit out. Sometimes you have to look for anything obvious there and then maybe poke around the mel scripts a bit. So for this one, if you turn off the option in the tool settings window you get something like: setTRSOrientJoint MayaWindow|MainToolSettingsLayout|tabLayout1|manipMove {0} Move; But all that layout stuff means it's really meant to only be called from the UI...so I do a: whatIs setTRSOrientJoint; To find that it's in setTRSOrientJoint.mel Looking there you see that it does a bit of checking for a few things, but then ends up calling manipMoveContext to actually disable it. The script uses the short names for the flags, which can sometimes be hard to guess what they stand for so you can quickly do a: help manipMoveContext; In the script editor to see the full name of the flag you're probably looking for is -orientJointEnabled on|off On Fri, Oct 21, 2011 at 8:54 AM, rudi rudiham...@hotmail.com wrote: thanks Tim.How did you find that command? I didn´t saw it in the help -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
[Maya-Python] Re: What's faster, API(2) or native Python?
Many thanks for the thorough explanation, that was quite some insight! Oh, and sure, my question was aimed for a general answer and not necessarily bound to the rad/deg conversions. :) Thanks again, cheers! -André On Oct 21, 12:42 am, T. D. Smith tagoresm...@gmail.com wrote: On Oct 17, 6:05 am, André Adam a_adam_li...@gmx.de wrote: Hi there, in general, are the Maya API(2) classes considered to be faster than calling equivalent native Python classes? Like, using the MAngle class for radian to degree conversion instead of Python's math.degree()? I am calling that per frame, so performance is a factor here. Thanks in advance for any insight you can share! Cheers! I agree with other advice in this thread: you need to profile to find out. If performance is really important you are going to want to do more than use the Python profiler too. In order to get a full picture of where the time is going you're also going to have get a look at what is happening in all the C/C++ code that the Python profiler can't look into. Beyond that, instrumenting profilers can be problematic. I'd suggest using an external sampling profiler in conjunction with the Python profiler. I've been using Very Sleepy with some success. Profiling is a bit of a black art, and trying to profile Python code running in Maya can get pretty tricky. I'd also suggest that you not worry about performance until you know that it is a problem, and not worry about the performance differences between approaches until you know that that's where your bottleneck lies. I would be surprised to find that the difference between using the MAngle class's method and the Python equivalent was the bottleneck in a practical application (though I have been known to be wrong ;) ). I've been working on a plug-in for Maya for... well, quite a while now. We developed the algorithms it uses in Python, outside of Maya, first in 2D using PyGame and then in 3D using visual. Our initial Python implementation was, literally, several thousand times slower than we needed. Then we moved to Maya, and re-implemented the plug-in in Python there (this is a bit different from the most usual use-case for Python in Maya in that we were implementing a plugin rather than writing scripts, fro the most part.) We made some changes that made things run a bit faster in Python, just so we could use the thing without pulling all of our hair out, but it was still painfully slow. Once we had things working we started rewriting the most expensive parts of it in highly optimized C, compiling that to a DLL, and calling it from Python using ctypes. And I made an interesting discovery: creating and destroying Maya API types (like MPoints and MVectors) in Python from the data produced by the C was as expensive as doing what we had moved to C had been in Python. In other words, having to translate the results from C into Python objects was as expensive as doing lots and lots of trig and vector math had been in Python. An awful lot of gory delving into Swig, pointers, machine representation of Maya objects, etc., ensued. It turns out that the CPython implementation (which is what is embedded in Maya) is very inefficient at creating and destroying objects. On the other hand CPython can be pretty quick at other things if you understand its quirks- you want to push things onto the C implementation as early as possible. Using things like map, and list comprehensions, over Python loops, just as an example, can make a dramatic difference. If you write Python code with that in mind the amount of garbage you create is going to absolutely dominate things like converting degrees to radians anyway (by garbage I mean objects that will have to be garbage collected.) I'm finding it hard to imagine a case in which a PyMel script is bottlenecked converting degrees to radians, and even harder to imagine a case in which the difference the MAngle methd and the Python math module's method is enough to remove the bottleneck. Anything I can imagine that fits that description should probably not be a Python script, or at least should call out to something written in C. You might object that your question is more general than converting between degrees and radians, but I would answer that optimization is, necessarily, about specifics. This is one reason you should avoid optimizing till you are sure you must. I don't believe that Maya does any GPGPU stuff at all, though I might be mistaken. The GPGPU world is just starting to mature to a point where it is reasonable to use it if you have to support a wide customer base, and it requires really rethinking the structure of your code to make good use of. We've looked at things like OpenCL for our product, and if it is successful I'm pretty sure we will eventually make use of it. But our decision so far has been to ignore it even though we are doing something that is pretty computationally
[Maya-Python] Re: Making_the_Script_Editor_spit_back_Python_code_instead_of_MEL
Hi Jan, I followed your instructions but my script editor is still spitting out MEL. I made sure that pymelScrollFieldReporter.py is both loaded and auto loaded in Maya's Plug-in Manager but its still showing MEL. When I start up Maya these warnings are shown in the Output Window: WARNING: No t_error rule is defined WARNING: Token 'COMMENT_BLOCK' defined, but not used WARNING: Token 'COMMENT' defined, but not used WARNING: There are 2 unused tokens WARNING: no p_error() function is defined WARNING: Symbol 'element_list' is unreachable Also, let me walk you through what I did to see if I followed your instructions correctly: 1. Copy Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor \pymelScrollFieldReporter.py to Maya2012\bin\plug-ins 2. Replace Maya2012\scripts\startup\scriptEditorPanel.mel with Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor \scriptEditorPanel.mel 3. Within Maya2012\bin\plug-ins\pymelScrollFieldReporter.py: add: from pymel.tools.mel2py import melparse change: mparser = mel2py.MelParser() to mparser = melparse.MelParser() Thanks for any help you can provide, Eric On Oct 21, 8:00 am, Jan: jan@gmail.com wrote: For pymel you can use the tools provided with it. Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor Put the pymelScrollFieldReporter into the plugins dir Replace the original scriptEditorPanel.mel file inside: Maya2012\scripts\startup with the one from the pymel tools folder you need to change a few lines though in the py file to make it work with maya 2011 and 2012: add: from pymel.tools.mel2py import melparse change : mparser = mel2py.MelParser() to: mparser = melparse.MelParser() As for maya python itself there should be a simmilar way but i have not looked into it. Note though that using the pymel script editor panel slows down your code quite a lot especially when printing. and some features are disabled in the script editor!!! 2011/10/21 Sahak Sahakian loves2anim...@gmail.com Hi guys. How wold one go about making ScriptEditor spit back its history in Python? cheers -- view archives:http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
[Maya-Python] Contexts and program flow
Hi, I'm currently trying to wrap my head around contexts. What I have so far is a context that lets me create selections by clicking on things. What I don't quite get, is there any chance to stop the script calling this context from moving on until the context is completed (user pressed return or aborted the context)? Or am I bound to using the MPxToolCommand from within my context if I want to use the user action as an input to a script? Example: import maya maya.cmds.TestContextCommand('Test1') maya.cmds.setToolTo('Test1') print 'Hi' This script prints Hi immediately after switching to the context and is not waiting for the user to finish his inputs. Thanks for any insights, cheers! -André -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
Re: [Maya-Python] Re: Making_the_Script_Editor_spit_back_Python_code_instead_of_MEL
oh sorry forgot to mention one thing. in the script editor goto: History - HistoryOutput - Convert mel to Python. That should do the trick. 2011/10/21 Eric Nersesian eric.nerses...@my3dti.com Hi Jan, I followed your instructions but my script editor is still spitting out MEL. I made sure that pymelScrollFieldReporter.py is both loaded and auto loaded in Maya's Plug-in Manager but its still showing MEL. When I start up Maya these warnings are shown in the Output Window: WARNING: No t_error rule is defined WARNING: Token 'COMMENT_BLOCK' defined, but not used WARNING: Token 'COMMENT' defined, but not used WARNING: There are 2 unused tokens WARNING: no p_error() function is defined WARNING: Symbol 'element_list' is unreachable Also, let me walk you through what I did to see if I followed your instructions correctly: 1. Copy Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor \pymelScrollFieldReporter.py to Maya2012\bin\plug-ins 2. Replace Maya2012\scripts\startup\scriptEditorPanel.mel with Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor \scriptEditorPanel.mel 3. Within Maya2012\bin\plug-ins\pymelScrollFieldReporter.py: add: from pymel.tools.mel2py import melparse change: mparser = mel2py.MelParser() to mparser = melparse.MelParser() Thanks for any help you can provide, Eric On Oct 21, 8:00 am, Jan: jan@gmail.com wrote: For pymel you can use the tools provided with it. Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor Put the pymelScrollFieldReporter into the plugins dir Replace the original scriptEditorPanel.mel file inside: Maya2012\scripts\startup with the one from the pymel tools folder you need to change a few lines though in the py file to make it work with maya 2011 and 2012: add: from pymel.tools.mel2py import melparse change : mparser = mel2py.MelParser() to: mparser = melparse.MelParser() As for maya python itself there should be a simmilar way but i have not looked into it. Note though that using the pymel script editor panel slows down your code quite a lot especially when printing. and some features are disabled in the script editor!!! 2011/10/21 Sahak Sahakian loves2anim...@gmail.com Hi guys. How wold one go about making ScriptEditor spit back its history in Python? cheers -- view archives:http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
[Maya-Python] Re: Making_the_Script_Editor_spit_back_Python_code_instead_of_MEL
Yup, that did it for me. Thanks for the help! This is an awesome way to just do the full conversion to python mentally for me. On Oct 21, 10:31 am, Jan: jan@gmail.com wrote: oh sorry forgot to mention one thing. in the script editor goto: History - HistoryOutput - Convert mel to Python. That should do the trick. 2011/10/21 Eric Nersesian eric.nerses...@my3dti.com Hi Jan, I followed your instructions but my script editor is still spitting out MEL. I made sure that pymelScrollFieldReporter.py is both loaded and auto loaded in Maya's Plug-in Manager but its still showing MEL. When I start up Maya these warnings are shown in the Output Window: WARNING: No t_error rule is defined WARNING: Token 'COMMENT_BLOCK' defined, but not used WARNING: Token 'COMMENT' defined, but not used WARNING: There are 2 unused tokens WARNING: no p_error() function is defined WARNING: Symbol 'element_list' is unreachable Also, let me walk you through what I did to see if I followed your instructions correctly: 1. Copy Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor \pymelScrollFieldReporter.py to Maya2012\bin\plug-ins 2. Replace Maya2012\scripts\startup\scriptEditorPanel.mel with Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor \scriptEditorPanel.mel 3. Within Maya2012\bin\plug-ins\pymelScrollFieldReporter.py: add: from pymel.tools.mel2py import melparse change: mparser = mel2py.MelParser() to mparser = melparse.MelParser() Thanks for any help you can provide, Eric On Oct 21, 8:00 am, Jan: jan@gmail.com wrote: For pymel you can use the tools provided with it. Maya2012\Python\lib\site-packages\pymel\tools\scriptEditor Put the pymelScrollFieldReporter into the plugins dir Replace the original scriptEditorPanel.mel file inside: Maya2012\scripts\startup with the one from the pymel tools folder you need to change a few lines though in the py file to make it work with maya 2011 and 2012: add: from pymel.tools.mel2py import melparse change : mparser = mel2py.MelParser() to: mparser = melparse.MelParser() As for maya python itself there should be a simmilar way but i have not looked into it. Note though that using the pymel script editor panel slows down your code quite a lot especially when printing. and some features are disabled in the script editor!!! 2011/10/21 Sahak Sahakian loves2anim...@gmail.com Hi guys. How wold one go about making ScriptEditor spit back its history in Python? cheers -- view archives:http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives:http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
[Maya-Python] Re: command to turn off automatically orient joints in the move tool?
The thing is that I turned echo all command, and I actually so the setTrRorientJoint. I tried to use it as a command without success. So I left it. Next time I´ll do do what you did to get it right. Thanks for the explanation On Oct 21, 3:08 pm, Tim Fowler tim.fow...@gmail.com wrote: Normally I'd turn on Echo All in the script editor and see what gets spit out. Sometimes you have to look for anything obvious there and then maybe poke around the mel scripts a bit. So for this one, if you turn off the option in the tool settings window you get something like: setTRSOrientJoint MayaWindow|MainToolSettingsLayout|tabLayout1|manipMove {0} Move; But all that layout stuff means it's really meant to only be called from the UI...so I do a: whatIs setTRSOrientJoint; To find that it's in setTRSOrientJoint.mel Looking there you see that it does a bit of checking for a few things, but then ends up calling manipMoveContext to actually disable it. The script uses the short names for the flags, which can sometimes be hard to guess what they stand for so you can quickly do a: help manipMoveContext; In the script editor to see the full name of the flag you're probably looking for is -orientJointEnabled on|off On Fri, Oct 21, 2011 at 8:54 AM, rudi rudiham...@hotmail.com wrote: thanks Tim.How did you find that command? I didn´t saw it in the help -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
Re: [Maya-Python] Re: command to turn off automatically orient joints in the move tool?
No problem. Of course it's even easier when you sit next to the developer who did the feature (like I do)...then you just have to turn around and ask him what the command is :-) On Fri, Oct 21, 2011 at 11:45 AM, rudi rudiham...@hotmail.com wrote: The thing is that I turned echo all command, and I actually so the setTrRorientJoint. I tried to use it as a command without success. So I left it. Next time I´ll do do what you did to get it right. Thanks for the explanation -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
Re: [Maya-Python] Re: command to turn off automatically orient joints in the move tool?
If I could ask him a question, it rather would be why it's been made default when it shipped? Because it really changes the way the joint chains behaves by default after that. Nicolas 2011/10/21 Tim Fowler tim.fow...@gmail.com No problem. Of course it's even easier when you sit next to the developer who did the feature (like I do)...then you just have to turn around and ask him what the command is :-) On Fri, Oct 21, 2011 at 11:45 AM, rudi rudiham...@hotmail.com wrote: The thing is that I turned echo all command, and I actually so the setTrRorientJoint. I tried to use it as a command without success. So I left it. Next time I´ll do do what you did to get it right. Thanks for the explanation -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
Re: [Maya-Python] Re: command to turn off automatically orient joints in the move tool?
Actually, I'd love to know! 2011/10/21 Tim Fowler tim.fow...@gmail.com That would be a question for the designer as I doubt the developer would have chosen that on their own. I wasn't part of that discussion but I could ask if you're interested... On Fri, Oct 21, 2011 at 2:16 PM, Nicolas Combecave zezebubulon...@gmail.com wrote: If I could ask him a question, it rather would be why it's been made default when it shipped? Because it really changes the way the joint chains behaves by default after that. Nicolas 2011/10/21 Tim Fowler tim.fow...@gmail.com No problem. Of course it's even easier when you sit next to the developer who did the feature (like I do)...then you just have to turn around and ask him what the command is :-) On Fri, Oct 21, 2011 at 11:45 AM, rudi rudiham...@hotmail.com wrote: The thing is that I turned echo all command, and I actually so the setTrRorientJoint. I tried to use it as a command without success. So I left it. Next time I´ll do do what you did to get it right. Thanks for the explanation -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe