This file contains hidden or 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 | |
eps = 1E-5 | |
sel = mc.ls( sl=1 ) | |
while sel: | |
v = mc.xform( sel[0], q=1, rp=1, ws=1 ) |
This file contains hidden or 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 | |
selection = OpenMaya.MSelectionList() | |
OpenMaya.MGlobal.getActiveSelectionList( selection ) | |
iterSel = OpenMaya.MItSelectionList(selection, OpenMaya.MFn.kMesh) | |
while not iterSel.isDone(): | |
dag_path_object = OpenMaya.MDagPath() | |
iterSel.getDagPath( dag_path_object ) |
This file contains hidden or 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 PySide import QtCore, QtGui | |
from shiboken import wrapInstance | |
import maya.OpenMayaUI as mui | |
mainWin = wrapInstance(long(mui.MQtUtil.mainWindow()), QtGui.QWidget) | |
action = QtGui.QAction(mainWin) | |
action.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Tab)) | |
action.setShortcutContext(QtCore.Qt.ApplicationShortcut) |
This file contains hidden or 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 cmds | |
faces = cmds.filterExpand(sm=34, ex=True) | |
verts = cmds.ls((cmds.polyListComponentConversion(faces, ff=True, tv=True)), flatten=True) | |
normals = [[], [], []] | |
for v in verts: | |
conFaces = cmds.ls(cmds.polyListComponentConversion(v, fv=True, tf=True), flatten=True) | |
shaFaces = list(set(conFaces).intersection(set(faces))) |
This file contains hidden or 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 | |
sel = mc.ls( sl=1 ) | |
sUV = mc.polyUVSet( sel[-1], q=1, cuv=1 )[0] | |
for d in sel[:-1]: | |
mc.transferAttributes( sel[-1], d, uvs=1, suv=sUV, tuv=mc.polyUVSet( d, q=1, cuv=1 )[0], col=0, spa=0, sm=3, fuv=0, clb=0, pos=0, nml=0 ) |
This file contains hidden or 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
# Latest version, uses Tumble Pivot Point viewport | |
# feature, and proprietary algorithm, works in all recent | |
# versions of Maya, Python 2.7 / 3+. Gives more predictable | |
# and stable results. | |
# Pavel Sevets 2022 | |
import maya.cmds as mc | |
import maya.api.OpenMaya as om | |
from math import pi |
This file contains hidden or 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
// SCRIPT NAME: MatFaceFinder.mel v1.1 (Maya2009 version) | |
// AUTHOR: Thomas Hamilton | |
// LAST UPDATED: November 16, 2009 | |
// www.thomashamilton.org | |
//DESCRIPTION: | |
//Select one face on an object. Run MatFaceFinder. This script will select all of the faces | |
//strictly on that object which share the same material assignment as the first face. |
This file contains hidden or 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 string | |
def PS_Attach( objs ): | |
def dag_par( obj ): | |
if isinstance( obj, basestring ): | |
return string.join( mc.listRelatives( obj, pa=1, f=1 )[0].split('|')[:-1], '|' ) |
This file contains hidden or 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 cmds | |
if not cmds.pluginInfo( 'ehm_flattenDeformer2.py', l=1, q=1 ): | |
if cmds.loadPlugin( 'ehm_flattenDeformer2.py') == None: | |
cmds.warning('Failed to load plugin.') | |
# Apply the deformer | |
cmds.deformer( name="Flatten_Deform", type='ehm_flattenDeformer2' ) |
This file contains hidden or 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 | |
import maya.cmds as cmds | |
def expandSelection(): | |
sel = om.MSelectionList() | |
om.MGlobal.getActiveSelectionList(sel) | |
dag = om.MDagPath() | |
obj = om.MObject() | |
# get the active object (dag) and its selected components (obj) | |
sel.getDagPath(0, dag, obj) |