maya

Maya: Defer a script until after VRay is registered?

a 夏天 提交于 2019-12-25 04:27:50
问题 I'm trying to delay a part of my pipeline tool (which runs during the startup of Maya) to run after VRay has been registered. I'm currently delaying the initialization of the tool in a userSetup.py like so: def run_my_tool(): import my_tool reload(my_tool) mc.evalDeferred("run_my_tool()") I've tried using evalDeferred within the tool to delay the execution of the render_settings script, but it keeps running before VRay has been registered. Any thoughts on how to create a listener for the VRay

Maya 2018, python, move and rotate extracted face

限于喜欢 提交于 2019-12-25 01:32:43
问题 Trying to write part of the python code in Maya to extract the face from object then move it and rotate it. I tried parameters of polyChipOff itself, tried xform and move and rotate functions. Problem is the same. If rotation is after translation face rotates against the previous position not the current one. Am I understand some concepts completely wrong? Code below shows the problem. Simply create a pCube and start the script. From my perspective this code should move face away and then

Make input and run loop to create custom number of objects

删除回忆录丶 提交于 2019-12-25 00:58:26
问题 I have been trying to learn how to code for Maya for a while. And here I am making a rock generator using reduce face, quad-mesh, smooth in a loop. Now I would like to make an input so user can specify how many rock they want to make. Like if you input 5, it would make 5 rocks. However I am currently stuck with the naming, like if I created the polyPlatonicSolid with rock#, the loop got confused and said something like rock# is invalid , so I am just looking for a simple solution for that.

About the super() function

北战南征 提交于 2019-12-24 19:22:35
问题 I'm using QtDesign to create my own UI and convert it to python version. So after subclass the UI python file, i had written some function to implement mouseEvent for QGraphicsView. Just one small question. How can i call the super() function for the QGraphicsView? class RigModuleUi(QtGui.QMainWindow,Ui_RiggingModuleUI): def __init__(self,parent = None): super(RigModuleUi,self).__init__(parent = parent) self.GraphicsView.mousePressEvent = self.qView_mousePressEvent def qView_mousePressEvent

QAbstratctTableModel - removeRows

安稳与你 提交于 2019-12-24 18:27:59
问题 Code is almost complete. Here's the deal: It is python and PySide. I have a QAbstractTableModel and a QTableView. I cant get deleting rows correctly. I think the problem is somewhere in the indexes of the rows onde I delete one of them... here is the button delegate I use: class ButtonDelegate(QItemDelegate): def __init__(self, parent): QItemDelegate.__init__(self, parent) def paint(self, painter, option, index): widget = QWidget() layout = QHBoxLayout() widget.setLayout(layout) btn =

subprocess a program using another version of python

痴心易碎 提交于 2019-12-24 14:14:32
问题 I am trying to open a maya file in maya from my python application on osx. The problem seems to be that since maya is also python based, and uses its own version of python, when it tries to open in the environment of my python app, it behaves unreliably (random errors, python script editor stops working, doesn't really open the intended maya file, etc etc). I have tried: subprocess.Popen(argList, close_fds = True) => maya opens with errors subprocess.Popen(argList, close_fds = True, shell

Project 2D points to 3D sphere, single object for every country

℡╲_俬逩灬. 提交于 2019-12-24 10:46:18
问题 I'm using Maya and I'm trying to create a 3D sphere of the earth with all countries separated by objects, so I can later export the file to Unity. With this code i create planes that represent the Earth. I managed to create a plane of the Earth with 2D geojson points of all contries. And now I am trying to project those points to 3D sphere. With this code I create a plane Earth # EXAMPLE OF THE POINTS FORMAT d = {"type":"FeatureCollection","features":[ {"type":"Feature","id":"ALB","properties

In a PySide2 app, how can I get the ID for a QWindow?

前提是你 提交于 2019-12-24 07:58:13
问题 In the version of PySide2 that ships with Maya2017, the winId method on the QWindow class seems to be missing: w.winId() Error: AttributeError: file <maya console> line 1: 'PySide2.QtGui.QWindow' object has no attribute 'winId' # Is there a way to get this value from an existing instance of QWindow? 回答1: I used Maya 2018 for macOS 10.11.6. Try this code. It works. from maya import OpenMayaUI as omui try: from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import *

Does Maya Mel have a good API to a IDE? [closed]

穿精又带淫゛_ 提交于 2019-12-24 06:25:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm developing in MAYA and looking for a good API to connect my models and to be able to control them programatically. thanks. 回答1: hye oded, you can use MEL or python scripting for control objects and doing simple actions, and you can use the c++ or Python via maya api to create complex tasks or heavy duty tasks,

Maya Python - Set object pivot to selection center

坚强是说给别人听的谎言 提交于 2019-12-24 05:47:08
问题 I'm trying to move the selected object pivot to the center of the objects selected vertices. When I run the code I don't recieve any errors and almost everything works as intended, However the pivot of (obj)my selected object doesn't seem to set itself to the locator xform(piv). import maya.cmds as cmds sel = cmds.ls(sl=True) print sel obj = cmds.ls(*sel, o=True) print obj selVerts = cmds.ls(sl=True) tempClstr = cmds.cluster() pos = cmds.xform(tempClstr[1], q=True, ws=True, rp=True) loc =