This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string $sels[] = `ls -sl`; | |
string $selsHistory[] = `listHistory $sels[0]`; | |
string $findBlend[] = `ls -typ blendShape $selsHistory`; | |
string $findWeights[] = `listAttr -m ($findBlend[0] + ".w")`; | |
int $k = 2; | |
for ( $s in $findWeights ) | |
{ | |
print ( $s + "\t" + $k + "\n" ); | |
$k ++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
import maya.mel as mel | |
sel = mc.ls( sl=1 ) | |
if len( sel ) > 1: | |
mc.polyExtrudeVertex( sel, ch=1, d=1, w=0.25 ) | |
mc.polyDelEdge( mc.polyListComponentConversion( mc.filterExpand( mc.polyListComponentConversion( sel, tf=1 ), ex=1, sm=34 ), te=1, internal=1 ), cv=1, ch=1 ) | |
mc.select( cl=1 ) | |
else: | |
mel.eval( 'polyChamferVtx 1 0.25 0' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.OpenMaya as OpenMaya | |
import maya.cmds as cmds | |
cmds.polySphere() | |
cmds.spaceLocator()[0] | |
selection_list = OpenMaya.MSelectionList() | |
selection_list.add('pSphereShape1') | |
shape = OpenMaya.MObject() | |
selection_list.getDependNode(0, shape) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.OpenMaya as om | |
# To remove duplicates: ids = list(set(ids)) | |
def get_selected_comp_ids(): | |
sel = om.MSelectionList() | |
om.MGlobal.getActiveSelectionList(sel) | |
li = 0 | |
path = om.MDagPath() | |
comp = om.MObject() | |
stat = sel.getDagPath(li, path, comp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.OpenMaya as om | |
sel = om.MSelectionList() | |
om.MGlobal.getActiveSelectionList(sel) | |
dag = om.MDagPath() | |
component = om.MObject() | |
sel.getDagPath(0, dag, component) | |
if not component.isNull(): | |
if component.hasFn(om.MFn.kMeshPolygonComponent): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.OpenMaya as OpenMaya | |
import maya.OpenMayaMPx as OpenMayaMPx | |
# Get the selection and create a selection list of all the nodes meshes | |
selection = OpenMaya.MSelectionList() | |
OpenMaya.MGlobal.getActiveSelectionList( selection ); | |
# Create an itorator to iterate over the selection | |
# Use the MFn class to as a filter to filter node types | |
iter = OpenMaya.MItSelectionList ( selection, OpenMaya.MFn.kGeometric ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
import maya.utils as mu | |
import threading | |
def check1(): | |
return mc.window('MayaWindow', ex=True ) | |
def check2(): | |
return 'TimeSliderMenu' in mc.lsUI('MayaWindow', typ="menu") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
sys.stdout = sys.__stdout__ | |
dir(sys.stdout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Ryan Roberts - Wrap Deformer | |
rr_wrap.py | |
Description: | |
Ryan Robers created a simple function to create a wrap deformer. | |
The wrap deformer needs a little more than the deform command to get working. | |
Michael Clavan | |
I wanted to have the function also return the deformer to the user. So, my contributions are pretty minor. | |
I converted the wrap deformer into a pynode object type pm.nt.Wrap. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds | |
def scene_has_referenced_namespace(): | |
"""Return True if scene has referenced namespace(s)""" | |
for reference in cmds.ls(type="reference"): | |
for node in cmds.referenceQuery(reference, nodes=True): | |
if ":" in node: | |
return True | |
return False |