This file contains 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 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
// Toggle wireframe | |
global proc NS_toggleWF() | |
{ | |
string $currentPanel = `getPanel -withFocus`; | |
if ("" != $currentPanel && ("modelPanel" == `getPanel -to $currentPanel`)) | |
{ | |
string $myToggle = `modelEditor -q -displayAppearance $currentPanel`; |
This file contains 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 math | |
import maya.api.OpenMaya as om | |
from pymel.core import * | |
from pymel.core.datatypes import * | |
def createBoundingCircle(meshfn): | |
"""Parameter: meshfn - MFnMesh | |
Represent a face by a center and radius, i.e. | |
center = [center1u, center1v, center2u, center2v, ... ] | |
radius = [radius1, radius2, ... ] |
This file contains 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
// Preview online | |
// http://www.deathbysoftware.com/colors/index.html | |
function rgb2ryb ( iRed, iGreen, iBlue ) | |
{ | |
// Remove the white from the color | |
var iWhite = Math.min( iRed, iGreen, iBlue ); | |
iRed -= iWhite; | |
iGreen -= iWhite; |
This file contains 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 | |
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) |
This file contains 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
# WORKS ONLY IN LEGACY VIEWPORT | |
import maya.OpenMaya as om | |
import maya.OpenMayaMPx as mpx | |
import sys | |
kPluginCtxName = 'myContext' | |
kPluginCmdName = 'myContextCmd' |
This file contains 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 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 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 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 | |
import pymel.core as pm | |
import maya.api.OpenMaya as om | |
import maya.api.OpenMayaUI as omui | |
class SamsClass(): | |
def __init__(self): | |
pass |
NewerOlder