Questions tagged [maya-api]

This tag deals with [tag:maya] API questions, as opposed to Maya scripting interfaces.

is a subtag for Maya that deals with the API questions. C++ Application Programmer Interface provides better performance than MEL or Python. You can add new objects to Maya using the API, and code executes approximately ten times faster than when you perform the same task using MEL. Also, you are able to execute MEL commands from the API.

169 questions
1
vote
1 answer

Maya - Center Object Pivot to Locator/Cluster

I'm trying to move the selected object pivot to the center of a selection of vertices. I have gotten to the point where I have the xform defined, but can't seem to move the object (defined as obj) pivot to this point import maya.cmds as cmds sel =…
Bastart
  • 21
  • 1
  • 4
1
vote
2 answers

Maya C++ Plugin MPxImagePlane

I'm creating an MPxImagePlane plugin in maya's c++ api. It works great in the legacy viewport, but I'm not finding any reference to extend it to viewport 2.0.…
chribis
  • 277
  • 7
  • 26
1
vote
0 answers

How to undo deleting meshes using the Maya API?

I'm trying to write a Maya plugin using the C++ API that will identify meshes in the selection, (compute something), delete them and then insert a new mesh into the scene. I'm gathering the selected meshes by the same manner as the objExporter…
Alec Jacobson
  • 6,032
  • 5
  • 51
  • 88
1
vote
1 answer

Importing animation keytracks into Maya

I have a human bipedal animation file format that I would like to programmatically read into Maya using the C++ API. The animation file format is similar to that of the Open Asset Importer's per-node animation structure. For every joint, there is a…
user3105833
  • 63
  • 1
  • 8
1
vote
2 answers

Optimizing MPxLocatorNode draw

I created an MPxLocatorNode with Maya api in c++. The node doesn't have a compute method, it just has different styles of shapes that is drawn with open gl in the draw method. One style it draws is the cross, exactly the same as a locator. So I went…
Green Cell
  • 4,677
  • 2
  • 18
  • 49
1
vote
1 answer

maya python iterating a big number of vertex

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…
1
vote
3 answers

Using maya python api - how do I change selected object name into upper case?

I have the following code: import maya.cmds as cmds list = cmds.ls(sl=True) my_list = [object.upper() for object in list] print(my_list) However, it doesn't change the name of the objects even though it prints out upper case names in the print…
epadilla
  • 21
  • 4
1
vote
1 answer

Extract/Identify NodeType by Name (or string - identifier)

Hi! I'm writing a "simple" Maya command in C++, in witch I need to select from the scene (like the ls command in MEL). But I don't know how to identify an MFn::Type data based on a string name like "gpuCache". Actually my (very stupid) parser does a…
Andrea Rastelli
  • 617
  • 2
  • 11
  • 26
1
vote
1 answer

Maya C++ API equivalent of MEL setKeyframe

Is there an equivalent of the MEL setKeyframe command in the Maya C++ API? It seems to exist for python (maya.cmds.setKeyframe) but I grepped the C++ include directory and didn't find anything relevant. Nor have I found any hints in the SDK…
Avi Ginsburg
  • 10,323
  • 3
  • 29
  • 56
1
vote
1 answer

Maya API add/remove vertices/edges from existing mesh

Is there a way to add/remove vertices, edges and faces from existing meshes with Python API? I found a few question around the web about this, but all without answer.
Jiloc
  • 3,338
  • 3
  • 24
  • 38
1
vote
1 answer

Maya API frame rate

Is there a way to query the frame rate during playback? I'm writing a simple HUD node and I'd like to include the frame rate, similar to the default maya one found in >> Display/Heads Up Display/Frame Rate.
cnp
  • 11
  • 3
1
vote
1 answer

Specify the size of Attribute Array on custom Node in maya python 2.0 API

I'm relatively new to node writing and Maya's Python 2.0 API and am creating a custom node to do some computation using a pre-determined number of input points. For our purposes, we'll say 7 points. I've successfully added the Compound Array…
stowaway
  • 77
  • 9
1
vote
1 answer

Maya API (C++) - Class Static Member Variable and Its Individuality in the Other Instances

I'm coding in Maya API (C++) these days, first thing that I was a little bit confused is that when you define a class in your header file, apparently you only have to make static member variable (attributes), so all the instances share common data.…
glitchzone
  • 17
  • 4
1
vote
1 answer

Maya Python: Check to see if the attribute has any keyframes

I am trying to write a python script for Maya that will copy keyframes from one rig to another. I have found objects and matched them up. What I am trying to do now is copy the keys from the original objects if the original objects have keys to be…
jspada
  • 481
  • 1
  • 6
  • 24
0
votes
1 answer

Loading Python script as plug-in in Maya not working

I am trying to make a plug-in that loads a menu with a simple print command attached to a button. I got two files: test_menu.py import maya.cmds as cmds import maya.mel as mel def say_hello(): print('hello') def menuui(): …
RogerP
  • 1
  • 1