Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
SEVEZ / fitvertex.py
Created May 11, 2016 20:32 — forked from nrtkbb/fitvertex.py
OpenMaya版 2つのメッシュのバーテックスから、それぞれ一番近いやつを検索してきてフィットさせるやつ
# -*- 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
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'
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)
@SEVEZ
SEVEZ / dicer.py
Created May 11, 2016 20:15 — forked from lapaev/dicer.py
Dice It script for maya
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]
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)