Questions tagged [pymel]

PyMEL makes python scripting with Maya work the way it should. It builds on the cmds module by organizing many of its commands into a class hierarchy, and by customizing them to operate in a more succinct and intuitive way.

PyMEL according to its website, makes python scripting with Maya work the way it should. Maya's command module is a direct translation of mel commands into python commands.

The result is a very awkward and unpythonic syntax which does not take advantage of python's strengths (particulary, a flexible, object-oriented design).

PyMEL builds on the cmds module by organizing many of its commands into a class hierarchy, and by customizing them to operate in a more succinct and intuitive way.

185 questions
0
votes
1 answer

How can I change command function using checkbox in pymel

I want to use a checkbox to control the ratio multiplied in slider function. First I try to change the variable directly, but failed. Then I try to change the dragCommand, but also failed. How can I control it? import pymel.core as pm import…
Chenxing Zheng
  • 117
  • 1
  • 2
  • 10
0
votes
1 answer

How to create .obj and .mtl exporter in maya

I have a task in school to create an custom .obj and .mtl exporter in maya but the documentation is really hard to understand and use. Found a blogpost that looked about like this, the code works but i would like to know more about what it actually…
Hamaro
  • 49
  • 9
0
votes
1 answer

Maya: Having trouble writing a script to cut a mesh into equal pieces

I want to split a mesh into sections based on a number of vertices. Essentially, I want a mesh cut into sections of 300 verts each with a remainder section of whatever is left over. I've done this for the most part (i can get verts/faces, etc) but…
Rymbrant
  • 17
  • 1
  • 4
0
votes
1 answer

How to make a class that returns a child from the hierarchy?

I'm trying to make a class find the type of the object with which it was initialized and I want it to become the object class that corresponds to the type of the object 'typ' that was sent in. So if if were to do something like the following…
Arturo
  • 171
  • 1
  • 17
0
votes
1 answer

PyMel Maya Python - Set Joint location

I am very new to PyMel (Done Python before) and I found the documentation available very complicated, and in times simply being still MEL and not Python. Very frustrating to do anything here. I am looking for a way to set the absolute location of…
He.Kin
  • 3
  • 2
0
votes
1 answer

"Render Current Frame" in Maya with Python

How can I use pymel, or just python in general, to render the current frame with whatever settings are given? I've looked into pymel.core.rendering, but all I can find are render specific commands. I tried the basic cmds.render() but it didn't do…
anon
  • 123
  • 5
0
votes
3 answers

Best way to get Shape from a Transform

Using ls -sl returns a transform. The only way I can find to get the shape of a transform is to use getRelatives but this seems wonky compared to other workflows. Is there a better more standard way to get a Shape from a Transform?
Rymbrant
  • 17
  • 1
  • 4
0
votes
1 answer

How to access PyNode from a PyNode list?

I ran this example code with 2 polyCubes in scene. import pymel.core as pymel pymel.select('pCube1', 'blinn1') print pymel.ls(sl = True) print pymel.ls(sl = True)[0] and this is my output [nt.Transform(u'pCube1'), nt.Blinn(u'blinn1')] pCube1 I…
0
votes
1 answer

mel2pyStr fails when selecting group of objects

I am trying to convert a bunch of MEL code into Python in Maya 2015 like this: mel2py.mel2pyStr(melCmd,pymelNamespace='pm', verbosity=4, forceCompatibility=True) where melCmd is a multi-line code. But it fails when converting the following line: …
Anie
  • 1
0
votes
1 answer

pymel.core.workspace.getcwd() doesn't return project directory as intended

I try to make simple tools in maya. I use this script to get the current project directory: pymel.core.workspace.getcwd() Sometimes this script is going well. But sometimes the results were not appropriate, like this :…
Aditya
  • 31
  • 5
0
votes
0 answers

Pymel insertInput method misses connections

I'm trying to use the inserInput method of Attribute class from pymel 1.0.6 under Maya 2015. But it's not working as expected: from pymel.core import * nodeA = createNode('transform') nodeB = createNode('transform') nodeC =…
Mathcom
  • 1
  • 1
0
votes
5 answers

How to collect all cameras in Maya using Python?

How can I collect all the cameras in a Maya scene excluding the default 'perspective, top, front, side' cameras? I only want to collect the user created cameras. cameras = cmds.ls(type=('camera'), l=True) or [] print cameras Do I need to do…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
0
votes
1 answer

Load preset directory in Maya with python/MEL?

I have a folder where I'm storing some maya presets (specifically nCloth presets) and I would like to make this directory available to all of the users on my current network. To do this, I would like to have this folder added to the MAYA_PRESET_PATH…
barrt051
  • 242
  • 3
  • 13
0
votes
1 answer

Pymel: How do I extract these vector floats from a complex .TXT file?

I am having trouble wrapping my head around how I would extract the float values from a complex text file in Pymel. I am not a programmer, I am an artist, however I am in need of creating a script for a specific workflow process and I have a…
S.Angel
  • 3
  • 2
0
votes
0 answers

parenting do not cause translate offset - strange behaviour

I'm setting the object as a child of another object. Usually it's [0,0,0] translation point is then set to the pivot of the parent object and the child gains some offset in location to maintain position. I do not know it does not work like that in…
Kowalski Paweł
  • 594
  • 1
  • 6
  • 27