mel

How to measure the time of a Maya script?

巧了我就是萌 提交于 2019-12-12 01:47:36
问题 I have several methods implemented in MEL, and I would like to measure its performance. Is there any way to measure execution time of a fragment of code? Something equivalent to "getCurrentTime" in other languages. 回答1: the timerX() command will give you seconds since Maya was started, so you can grab that and do the math: float $start = timerX(); 回答2: Timer // Example 1: Simple timing // $startTime = `timerX`; // code that is being timed $totalTime = `timerX -startTime $startTime`; print (

How do I execute Maya script without lauching Maya?

家住魔仙堡 提交于 2019-12-11 05:59:28
问题 For example, I want to launch a script that creates a poly cube, export it to .stl or .fbx from the command line. I can do it in Python by using the Maya standalone but it cannot handle exporting to other formats than .ma apparently 回答1: Why of course you can. Here's how you'd do exactly that (for FBX): from os.path import join from maya.standalone import initialize import maya.cmds as cmds import maya.mel as mel initialize("python") cmds.loadPlugin("fbxmaya") my_cube = cmds.polyCube() cmds

Maya - Querying previous render information

喜夏-厌秋 提交于 2019-12-08 18:58:41
Does anyone know whether its possible to query the render time of the last render in maya via python or mel? Render time is stored in the render viewer window in the form of a string at the bottom of the image, I would like to access this time and retrieve for later use - is this possible? Thanks I know of no way to query it directly, but this solution works: Put the following in your Pre Render MEL (from the Render Settings): python "global last_render_time;import time;last_render_time=time.time()" Expanded for readability: global last_render_time # not needed when in module import time last

Maya - Querying previous render information

∥☆過路亽.° 提交于 2019-12-08 07:51:39
问题 Does anyone know whether its possible to query the render time of the last render in maya via python or mel? Render time is stored in the render viewer window in the form of a string at the bottom of the image, I would like to access this time and retrieve for later use - is this possible? Thanks 回答1: I know of no way to query it directly, but this solution works: Put the following in your Pre Render MEL (from the Render Settings): python "global last_render_time;import time;last_render_time

How to execute a Maya MEL procedure at regular intervals

时光毁灭记忆、已成空白 提交于 2019-12-08 06:43:00
问题 I would like one of my Maya MEL procedures to be executed every x seconds. Is there any way to do that ? 回答1: The mel setup would be scriptJob -e "idle" "yourScriptHere()"; However it's hard to get the time in seconds from Mel - system("time /t") will get you time to the minute but not to the second on windows. In Unix system("date +\"%H:%M:%S\"") would get you hours, minutes and seconds. The main drawback to scriptJob here is that idle events won't be processed when the user or a script is

How do I create a new syntax hilighting set for a language in Sublime text 2

荒凉一梦 提交于 2019-12-07 10:48:45
问题 I'm using the amazing Sublime Text 2 to write MEL (Maya Embedded Language) scripts for Maya, but it has no syntax highlighting for MEL. Right now I force it to interpret the text as Perl, which does an OK job, but its far from perfect. It would be handy to add Maya's commands. Does anybody know how I would create a syntax highlighting set for Sublime? 回答1: I have been using a MEL textmate bundle I found on github. I forked it, added some snippets and tweaked the language a little. The

How to store and then retreive parent-child dependency data (Maya MEL/Python script)

拈花ヽ惹草 提交于 2019-12-04 02:00:35
问题 I have a hierarchy that I need to: break apart doSomething() put it back together the same way it was before. I know how to break things for sure, and have plan about what I need to do when they are flat in hierarchy. The problem is how do I parent them back? Details This is related to my previous question: Freeze scale transform on a parent object with animated child (MAYA MEL/Python script) I need to freeze scale transforms on all nodes in a hierarchy. Problem is that nodes have translate

How to store and then retreive parent-child dependency data (Maya MEL/Python script)

泄露秘密 提交于 2019-12-01 13:20:45
I have a hierarchy that I need to: break apart doSomething() put it back together the same way it was before. I know how to break things for sure, and have plan about what I need to do when they are flat in hierarchy. The problem is how do I parent them back? Details This is related to my previous question: Freeze scale transform on a parent object with animated child (MAYA MEL/Python script) I need to freeze scale transforms on all nodes in a hierarchy. Problem is that nodes have translate animations on them, and if I try to freeze scale on a parent node, it's child animation gets weird.