Category Archives: Maya Tools

n_mirrorComponents

Download

Given a list of mesh components (as a valid selection or by
using the components argument), this class will return and/or
select the mirror components.

ARGUMENTS:
components = poly verts, faces or edges (I will expand to nurbs soon)
tolerance = error threshold for the search mechanism. The lower this value, the more precise the results,
but also the more prone to error in the case the mesh is not perfectly symmetrical
axis = 0 for x, 1 for y and 2 for z. No need to specify positive or negative
absolute = if True, the search will occur in world space
doSelect = should we select what we find? You may not always want this…
addToSelection = if True, the class returns a list of both initial components and mirroredComponents

USAGE:
#copy this file to your PYTHONPATH
from n_mirrorComponents import n_mirrorComponents

#Just return the results
#create a poly sphere and select a few verts, then run
mc = n_mirrorComponents()
mc.doIt()
print mc.mirroredComponents

#Select and return the results,
#specify some arguments
mc = n_mirrorComponents(axis = 0, doSelect = 1, addToSelection = 1)
mc.doIt()

#use a predefined components list instead of a selection
myList = ["pSphere1.vtx[258]", "pSphere1.vtx[238]"]
mc = n_mirrorComponents(components = myList, doSelect = 1)
mc.doIt()

NOTE1: Currently only poly meshes are supported (maybe I’ll
extend to nurbs too at some point)
NOTE2: Internally the search mechanism needs verts.
If the components are faces, edges or uvs, I am converting to verts,
do the work and then convert back to your initial components or selection,
based on the type of the first component. I may extend this functionality at some point if need be.


toMaya

Download

This python script allows you to talk to Maya
through a commandPort.
It works with both MEL and python and can be used in conjunction with
any script editors that can execute external commands and can provide
variables for the current scripts and the current selection.

Setup:
1. Copy toMaya.py to your PYTHONPATH
2. Setup your script editor
3. In Maya open port 6001

Examples:
Eclipse->External Tools Configurations:
Location: c:\Python26\python.exe
Arguments: *pathTo\toMaya.py "${resource_loc}" "${selected_text}"

EditPlus->Configure User Tools
Command: python *pathTo\toMaya.py
Argument: "$(FilePath)" "$(CurSel)"

UltraEdit->Tool Configuration
Command Line: *pathTo\python.exe *pathTo\toMaya.py "%F" "%sel%"

Enjoy and drop me a line if you have any questions.


n_mddExport

Download

Description:
MDD exporter for Maya.

Usage:
MEL:
n_mddExport -startFrame 1 -endFrame 10 -folder "d:/tmp/" "myMesh1" "myMesh2";

python:
from maya import cmds
cmds.n_mddExport(["myMesh", "myMesh2"], folder = "d:/tmp/", startFrame = 1, endFrame = 10)

Source code included.
Compiled for maya2011 -> win32 and win64

NOTE: Many thanks to modomotion (www.modomotion.com) for the idea

Enjoy and drop me a line if you have any questions.


n_loc

Download

Design your own locator!

Description:
N_loc is a maya locator that does not use predefined shapes.
Instead, using the provided nLoc.py, you can create any shape
using either your own presets, or simply objects (curves and/or meshes)
in your scene.
You can create an n_loc out of any number of curves and/or
meshes. As far as meshes goes though, keep in mind that
only quads and triangles are supported, nGons will be skipped.

Quick start:
1. Copy nLoc.py to your PYTHONPATH
2. Load the plugin (n_loc.mll on windows or n_loc.so on linux)
3. Python-import nLoc.py.
4. Draw a nurbsCurve or create a polyCube and make sure they are selected
5. Run:

import nLoc
loc = nLoc.nLoc()
loc.create()

Other usage examples:
Example 1: #tell the class which curves and/or meshes to use
loc = n_loc(curves = ["curve1", "curve2"], meshes = ["pCube1"], name = "locName")
loc.create()

Example 2: #use a preset
loc = nLoc(preset = "solidCube")
loc.create()

Example 3: #use a preset and change the orientation
loc = nLoc(preset = "solidCube", presetOrientation = [0, 90, 0])
loc.create()

NOTE1: Most importantly, because this locator is
not using static, predefined position values I need to store
these into attributes on the node itself, just like a nurbsCurve or
mesh would do.
In order to keep the computation to a minimum, these attributes
are being cached and the only way to refresh an n_loc is by
turning on the update attribute, which will re-compute
all attributes, including the boundingBox.
Don’t forget to turn it back off!!!

You will need to update each time you…:
1. change any of the lines, quads or tris attributes
2. change the localPosition and/or localScale attributes AND the useLocalOffset attribute is true

NOTE2: You can always extend the shape by adding
lines, quads or tris attributes and do an update, but if you need to
remove any of these, you’re better off recreating the node

NOTE3: Constantly reading the localPosition and
localScale attributes slows things down a little bit if you have a large
number of n_locs in the scene, so turn on the useLocalOffset attribute
only if you need it

Package contains:
1. Source code
2. Compiled plugins for Maya 2011 win32, win64 and linux64
3. Creation tools

Enjoy and drop me a line if you have any questions.