Skip to content

Instantly share code, notes, and snippets.

Material = cmds.ls(sl=1)
ObjsWithMatSG = cmds.listConnections(Material,type='shadingEngine')
ObjsWithMat = cmds.listConnections(ObjsWithMatSG,type='shape')
@SEVEZ
SEVEZ / timeDragger.py
Created May 11, 2016 20:15 — forked from lapaev/timeDragger.py
Smooth Time Scrubber
'''
timeDragger 1.0
29/03/2015
Tom Bailey
'''
import maya.cmds as cmds
import maya.mel as mel
'''
@SEVEZ
SEVEZ / explode_meshes.py
Created May 11, 2016 20:04 — forked from danbradham/explode_meshes.py
Explode a bunch of meshes
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))
# 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
@SEVEZ
SEVEZ / getUvShells.py
Last active November 20, 2020 20:45 — forked from paulwinex/getUvShells.py
Get all UV shells from mesh object
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()
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)
@SEVEZ
SEVEZ / edgesIsSmooth.py
Created May 11, 2016 19:41 — forked from paulwinex/edgesIsSmooth.py
Return array of smoothed/harded edges by index
import maya.OpenMaya as om
import maya.cmds as cmds
def edgesIsSmooth(name, edgeArray):
selList = om.MSelectionList()
selList.add(name)
selListIter = om.MItSelectionList(selList, om.MFn.kMesh)
pathToShape = om.MDagPath()
selListIter.getDagPath(pathToShape)
shapeFn = om.MFnMesh(pathToShape)
'''
This is the default UndeadLabs maya UserSetup.py. It should be copied into
one of the user's MAYA_SCRIPT_DIR folders (typically, the one for the
current version, like '2014x64', but it works in the generic one as well)
'''
import os
import site
import sys
ZIP_NAME = os.environ.get('MAYA_ZIP', 'ulmaya.zip')
@SEVEZ
SEVEZ / dyn_shelf_launcher.py
Created May 11, 2016 19:15 — forked from yamahigashi/dyn_shelf_launcher.py
指定パス以下の スクリプトを元にシェルフを動的作成 for maya
"""coding: utf-8"""
#
# 指定パス以下の スクリプトを元にシェルフを動的作成 for maya
#
# ├─dyn_shelf_root
# │ ├─hoge_tab
# │ │ └─ スクリプト1.py
# │ │ └─ スクリプト2.py
# │ └─mage_tab
# └─ スクリプト3.py
@SEVEZ
SEVEZ / selectEnclosedFaces.py
Created May 11, 2016 19:11 — forked from r4inm4ker/selectEnclosedFaces.py
Select enclosed faces by edge loop and one inner vertex in Maya
import maya.cmds as cmds
import re
import maya.OpenMaya as om
def getComponentId(component):
"""get id number from a component (i.e. pCube.vtx[12]) , and return as int (i.e. 12 ) ."""
tokens = re.split('[\[\]]',str(component))
try:
return int(tokens[1])