Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
SEVEZ / object_under_cursor.py
Created May 11, 2016 19:01 — forked from mottosso/object_under_cursor.py
Get object under cursor - Autodesk Maya
"""Illustration of how to retrieve the shape under the mouse cursor
Usage:
Run `start()` to start listening for when the mouse stops and to display a tooltip
Run `stop()` to stop listening
"""
from PySide import QtGui, QtCore
@SEVEZ
SEVEZ / hotkeys.py
Created May 11, 2016 18:58 — forked from danbradham/hotkeys.py
Autodesk Maya hotkeys with Python
import maya.cmds as cmds
import maya.mel as mel
from maya.utils import executeDeferred
from functools import wraps
import re
def defer(fn):
'''Delays execution of the decorated function until Maya is available.'''
@wraps(fn)
@SEVEZ
SEVEZ / unsmoothMesh.py
Created May 11, 2016 18:55 — forked from kanishk2391/unsmoothMesh.py
Reconstruct Subdiv for Maya
#---------Reconstruct Subdiv Script for Maya----------
#Script by - Kanishk Chouhan
#Email - [email protected]
#Blog - www.pixel-architect.blogspot.com
#Description -
#This script allows u to reverse the result of smooth operation in maya after deleting the history
#It also preserves the original UV of the mesh
#Select the mesh u want to unsmooth and execute the script
#Script might take some time to execute depending on the polycount...
@SEVEZ
SEVEZ / findskin.py
Created May 11, 2016 18:54 — forked from robomojo/findskin.py
find maya skincluster
def findSkinClusters ():
skins = []
shapes = pm.listRelatives(shapes=True, noIntermediate=True)
for shape in shapes:
skinClusters = pm.ls(type=pm.nodetypes.SkinCluster)
for skin in skinClusters:
mesh = pm.skinCluster(skin, q=True, g=True)
if mesh[0] == shape:
relatedSkinCluster = sc
skins.append(skin)
@SEVEZ
SEVEZ / softCluster.py
Created May 11, 2016 18:53 — forked from jhoolmans/softCluster.py
Maya create soft cluster
import maya.cmds as mc
import maya.OpenMaya as om
def softSelection():
selection = om.MSelectionList()
softSelection = om.MRichSelection()
om.MGlobal.getRichSelection(softSelection)
softSelection.getSelection(selection)
dagPath = om.MDagPath()
@SEVEZ
SEVEZ / MAYA_findFlippedUVs.py
Created May 11, 2016 18:52 — forked from hmasato/MAYA_findFlippedUVs.py
[Maya, python] _findFlippedUVs
# -*- coding: utf-8 -*-
import maya.OpenMaya as om
import maya.cmds as cmds
def _findFlippedUVs(nodesOnly=True):
ret = []
selList = om.MSelectionList()
@SEVEZ
SEVEZ / PS_keyOps.py
Last active September 7, 2017 17:49
PS_keyOps - use long or double hotkeys press for different commands execution #Final
'''
PS_keyOps - use long or double hotkeys press for different commands execution
Pavel Sevets 2016
[email protected]
USAGE:
1) Long key press
@SEVEZ
SEVEZ / MAYA_findFlippedUVs.py
Created May 10, 2016 20:16 — forked from Onefabis/MAYA_findFlippedUVs.py
[Maya, python] _findFlippedUVs
# -*- coding: utf-8 -*-
import maya.OpenMaya as om
import maya.cmds as cmds
def _findFlippedUVs(nodesOnly=True):
ret = []
selList = om.MSelectionList()
@SEVEZ
SEVEZ / proximity_scaleup_expression.mel
Created May 5, 2016 12:10
Apply scale expression to selected objects. They will scale up as locator1 approximates them.
$sel = `ls -sl`;
for ( $s in $sel )
{
$s = $s;
$loc = "locator1";
$constr = "$dx = " + $loc + ".tx - " + $s + ".tx; $dy = " + $loc + ".ty - " + $s + ".ty; $dz = " + $loc + ".tz - " + $s + ".tz; $vlen = sqrt( $dx * $dx + $dy * $dy + $dz * $dz ); if ( $vlen > 5 ) " + $s + ".scaleX = 1; else " + $s + ".scaleX = ( cos( ( $vlen - 1 ) / 5 * 3.141592 ) + 1 ) / 2 * 0.35 + 1;";
expression -s $constr -o $s -ae 1 -uc all ;
$constr = "$dx = " + $loc + ".tx - " + $s + ".tx; $dy = " + $loc + ".ty - " + $s + ".ty; $dz = " + $loc + ".tz - " + $s + ".tz; $vlen = sqrt( $dx * $dx + $dy * $dy + $dz * $dz ); if ( $vlen > 5 ) " + $s + ".scaleY = 1; else " + $s + ".scaleY = ( cos( ( $vlen - 1 ) / 5 * 3.141592 ) + 1 ) / 2 * 0.35 + 1;";
expression -s $constr -o $s -ae 1 -uc all ;
$constr = "$dx = " + $loc + ".tx - " + $s + ".tx; $dy = " + $loc + ".ty - " + $s + ".ty; $dz = " + $loc + ".tz - " + $s + ".tz; $vlen = sqrt( $dx * $dx + $dy * $dy + $dz * $dz ); if ( $vlen > 5 ) " + $s + ".scaleZ = 1; else " + $s + ".scaleZ = ( co
@SEVEZ
SEVEZ / dupMeshOnly.py
Created May 3, 2016 20:20
Duplicate only selected meshes without children, materials etc.
import maya.cmds as mc
sel = mc.ls( sl=1 )
def dupMeshOnly( obj ):
objShape = mc. listRelatives( obj, s=1 )
par = mc.duplicate( objShape[0], po=1 )
shape = mc.createNode( 'mesh', p=par[0] )
mc.connectAttr( objShape[0] + '.outMesh', shape + '.inMesh', f=1 )