maya

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

virtualenv and Maya

安稳与你 提交于 2019-12-08 00:15:20
问题 I'm trying to set up virtualenv to point at Maya 2013's executable so I can run unit tests inside it from the shell. Maya uses a custom python 2.6 executable located at /usr/autodesk/maya/bin/mayapy . I get these errors: $ virtualenv -p /usr/autodesk/maya/bin/mayapy mayapy Running virtualenv with interpreter /usr/autodesk/maya/bin/mayapy PYTHONHOME is set. You *must* activate the virtualenv before using it Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages

Maya python connect attributes of selection

徘徊边缘 提交于 2019-12-07 21:26:18
问题 I've been trying to make a simple script that will take 2 viewport selections and then basically connect the rotation of the second to the first, I'm not sure how to create the variables for the objects from the viewport selection correctly. Here is my attempt that is not working import maya.cmds as cmds sel = cmds.ls( selection=True, sl=True ) print sel[0] print sel[0].rotate print sel[1] cmds.connectAttr( 'sel[0].rotate', 'sel[1].rotate' ) Any ideas how to make this work? 回答1: it's just a

How do you get Maya to communicate through the localhost IP?

半世苍凉 提交于 2019-12-07 19:10:32
问题 What I have been researching with no luck, is how to get Autodesk Maya to communicate though the web on the localhost ip (preferably TCP). My goal is to control maya with a quick java application I wrote to manipulate curve selecting and such. If there is a way to do it in mel scripting, that would be awesome. 回答1: Maya includes the commandPort command which will listen for incoming connections on a socket and run either mel or python scripts on the incoming data examples: http://fredrik

Maya to three.js with animation

强颜欢笑 提交于 2019-12-07 11:49:59
问题 I have a rigged (skeleton and soft bind) model in Maya. The model is all one seamless low poly with a single jpeg texture mapped. There is simple animation of the skeleton. (joint rotation). I need to get it to work with ThreeJs (webGL). Do I try to export an OBJ with Morph Targets some how? I can do OBJ but how do I get the morph targets? Can the developer that I am working with read Maya's baked animation file (.MC or .XML) in webGL. Do I export a Collada DAE? Any help that can steer us in

Segmentation Fault Catch

不问归期 提交于 2019-12-07 08:34:05
问题 I have a python script and it will loop through bunch of maya files and do some stuff. But some time maya get seg fault and my script will stop there. I tried with signal and multiprocess. But both failed import os, optparse, glob, json, signal import maya.standalone import maya.cmds as cmds from multiprocessing import Process, Queue def loadMayaBd(): maya.standalone.initialize(name='python') def sig_handler(signum, frame): print "segfault" def doSome(args, options): signal.signal(signal

GLSL 4.1 with gl_ModelViewProjectionMatrix

吃可爱长大的小学妹 提交于 2019-12-07 05:47:41
问题 I am working on a glsl shader program as part of a plugin that runs inside a "closed source" application. The application (maya) is written using opengl 2.1, but our graphics cards support opengl/glsl 4.1 and I want to use tessellation and geometry shaders in my program. The application sets up the opengl viewport and the traditional model/view matrix stack and I do not have control over that part of the code. My pass-through vertex shader uses GLSL 1.2 and works fine: // GLSL VERTEX SHADER

Way to iterate two items at a time in a list?

家住魔仙堡 提交于 2019-12-07 03:19:26
问题 I am wondering if there is a better way to iterate two items at a time in a list. I work with Maya a lot, and one of its commands (listConnections) returns a list of alternating values. The list will look like [connectionDestination, connectionSource, connectionDestination, connectionSource]. To do anything with this list, I would ideally like to do something similar to: for destination, source in cmds.listConnections(): print source, destination You could, of course just iterate every other

How to get Node class instance from MObject in Maya API

限于喜欢 提交于 2019-12-06 08:10:24
In a cpp plugin I am developing in Maya API, I register a custom MPxTransform Node in the initializePlugin function: status=pluginFn.registerTransform("mympxtransform", myMPxTransformClass::id, &myMPxTransformClass::creator, &myMPxTransformClass::initialize, &myMPxTransformMatrixClass::creator, myMPxTransformMatrixClass::id); And then create the node programmatically: MDagModifier mdagmod; MObject MyMObject; MyMObject=mdagmod.createNode("mympxtransform",MObject::kNullObj,&status); I can see the node properly created in the outliner. But now, how can I access my custom myMPxTransformClass from