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
# -*- coding: utf-8 -* | |
import maya.OpenMaya as om | |
import pymel.core as pm | |
def is_mesh(trans): | |
if type(trans.getShape()) == pm.nodetypes.Mesh: | |
return True | |
return False |
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.mel | |
import pymel.core as pm | |
def beginDrag(*args): | |
mods = pm.getModifiers() | |
update = pm.timeControl( aPlayBackSliderPython, query=True, globalTime=True) | |
print update | |
if (mods & 1) > 0: print ' Shift' | |
if (mods & 2) > 0: print ' CapsLock' | |
if (mods & 4) > 0: print ' Ctrl' |
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.api.OpenMaya as om | |
import pymel.core as pm | |
def intersect_mesh(pos, vec, mesh_name): | |
selectionList = om.MSelectionList() | |
selectionList.add(mesh_name) | |
dagPath = selectionList.getDagPath(0) | |
fnMesh = om.MFnMesh(dagPath) |
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
def Dicer(xmany, ymany, zmany): | |
cs = cmds.ls(sl=True) | |
cpc = cmds.objectCenter(cs, gl=True) | |
cpcx = cpc[0] | |
cpcy = cpc[1] | |
cpcz = cpc[2] | |
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
Material = cmds.ls(sl=1) | |
ObjsWithMatSG = cmds.listConnections(Material,type='shadingEngine') | |
ObjsWithMat = cmds.listConnections(ObjsWithMatSG,type='shape') |
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
''' | |
timeDragger 1.0 | |
29/03/2015 | |
Tom Bailey | |
''' | |
import maya.cmds as cmds | |
import maya.mel as mel | |
''' |
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 time | |
from maya.api import OpenMaya | |
MVector = OpenMaya.MVector | |
def get_dagnode(mesh): | |
sel = OpenMaya.MSelectionList() | |
sel.add(mesh) | |
return OpenMaya.MFnDagNode(sel.getDagPath(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
# python api2.0 setWeights(),setWeight() | |
# http://ueta.hateblo.jp/entry/2015/08/24/102937 | |
import time | |
import maya.api.OpenMaya as OpenMaya2 | |
import maya.api.OpenMayaAnim as OpenMayaAnim2 | |
#_time = time.time | |
_time = time.clock |
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 getUvShelList(name): | |
selList = om.MSelectionList() | |
selList.add(name) | |
selListIter = om.MItSelectionList(selList, om.MFn.kMesh) | |
pathToShape = om.MDagPath() | |
selListIter.getDagPath(pathToShape) | |
meshNode = pathToShape.fullPathName() |
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
def check_faces_in_the_same_place(sel=False): | |
objs = ls(sl=sel, type='mesh') | |
errors = [] | |
for obj in objs: | |
areas = {} | |
for f in obj.f: | |
a = round(f.getArea(),5) | |
if a in areas: | |
areas[a].append(f) |