maya-api

Set highlighted range in Maya's Time Slider

眉间皱痕 提交于 2021-01-01 07:28:59
问题 It is easy to get the highligted range in the time slider using: import maya.cmds as cmds import maya.mel as mel aTimeSlider = mel.eval('$tmpVar=$gPlayBackSlider') timeRange = cmds.timeControl(aTimeSlider, q=True, rangeArray=True) Likewise the Qt widget can be accessed with from maya import mel from maya import OpenMayaUI as omui try: from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import * from PySide2 import __version__ from shiboken2 import wrapInstance

why i have some missing files when cmake generate build folder ? (Maya 2020 - CMake 3.16.4 - VS 2017)

两盒软妹~` 提交于 2020-03-25 18:38:58
问题 I exactly followed the instruction in API help to create visual studio project: The CMakeLists.txt File guide but I got this error: CMake Warning (dev) in CMakeLists.txt: No project() command is present. The top-level CMakeLists.txt file must contain a literal, direct call to the project() command. Add a line of code such as project(ProjectName) near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first line. This

Disconnecting/connecting plugs gives internal failure in compute()

做~自己de王妃 提交于 2019-12-25 04:28:51
问题 What's the right way to disconnect/connect plugs during MPxNode compute() method? I have a modified plugin that it's plugs are already connected to some other objects transform nodes, it always gives me the internal failure error when I want to update its plugs connection during the compute() method. Both MDGModifier connect and disconnect fails. Why do I keep getting this error? If this is not possible, is there a way I can update the connections before compute() kicks in? I've tried doing

Maya: duplicate AnimCurve in the API/C++

北战南征 提交于 2019-12-11 23:19:10
问题 Is there any easy way to copy any type of AnimCurve? I see using MFnAnimCurve it may become quite bloated. P.S.: using Maya 2013 right now. 回答1: All right - I knew nobody cares as this problem is quite needless for 99.9999% of all c0ders. The answer is NO . This is the API/C++ solution I chose: bool copyAnimCurve(MFnDependencyNode &srcDN, MFnDependencyNode &destDN, MObject &destNode) { MFnAnimCurve s( srcDN.object() ), d; MAngle a; double w; destNode = d.create( s.animCurveType() ); destDN

maya python iterating a big number of vertex

╄→гoц情女王★ 提交于 2019-12-11 11:20:19
问题 I am writing a script in python for maya to swap vertex position from one side to another. Since I want the flipping to be topology based I am using the topological symmetry selection tool to find the vertex correspondence. I managed to do that using filterExpand and xform. The problem is that it is quite slow on a large poly count mesh and I was wondering how this could be done using openMaya instead. import maya.cmds as cmds def flipMesh(): sel=cmds.ls(sl=1) axis={'x':0,'y':1,'z':2} reverse