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 | |
def _null(*args): | |
pass | |
class _shelf(): | |
'''A simple class to build shelves in maya. Since the build method is empty, | |
it should be extended by the derived class to build the necessary shelf elements. |
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
from maya import cmds | |
def create_hud(label, separation=0, data=None, size="large"): | |
"""Creates a hud with given arguments | |
Args: | |
label: (String) Name of the HUD as it will be visible to user | |
separation: (Int) Margin from the top | |
data: (multiple) This can be any value or function. | |
size: (string) size of the label and data. Acceptable arguments are 'large', 'medium' and 'small' |
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
#patch maker | |
from glob import glob | |
import os | |
from maya import cmds | |
image_folder = "/your/image/folder/" | |
shader_type = "blinn" | |
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
from maya import cmds | |
import maya.OpenMayaAnim as oa | |
import maya.OpenMaya as om | |
def get_inbetween_values(blendshape_node, target_name): | |
# get the bs api mobject | |
bs_sel = om.MSelectionList() | |
bs_sel.add(blendshape_node) |
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
def get_selected_vertices(): | |
sel = cmds.ls(sl=True) | |
for x in sel: | |
if ":" not in x: | |
yield int(x[s.find("[")+1:x.find("]")]) | |
else: | |
start_v = int(x[x.index("[") + 1: x.index(":")]) | |
end_v = int(x[x.index(":") + 1:x.index("]")]) | |
for v in range(start_v, end_v+1): | |
yield v |
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
## Author: THOMAS HOLLIER | |
## Modified: Arda Kutlu | |
## http://relentlessplay.com/maya-frustum-visualizer/ | |
import maya.cmds as cmds | |
import math, sys | |
#--------- Gather relevant camera attributes | |
import maya.cmds as cmds | |
import math, sys |
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 os | |
import uuid | |
from maya import cmds | |
def obj_merge(obj_list, name=None, delete_originals=True): | |
# get the temp export location | |
if not name: | |
name = "%s_m" %obj_list[0] | |
unique_ns = "om%s" %str(uuid.uuid1()).lower().replace("-", "_") |
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
from maya import cmds | |
def whip(node_list, attr_holder=None, offset=5, diminish=0.8, attr_list=["rx", "ry", "rz"]): | |
if type(node_list) is not list: | |
cmds.error("node_list must be a list variable. duh...") | |
if len(node_list) < 2: | |
cmds.error("node_list must contain at least 2 elements. duh...") | |
if not attr_holder: | |
attr_holder = node_list[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 pymel.core as pm | |
from pprint import pprint | |
def get_file_info(obj=None, sg=None): | |
""" | |
Collects file node informations in a list of dictionaries | |
one of the obj or sg flags need to be defined. | |
obj: (String or PyMel Node) Transform object of the mesh. If this is defined, all shading groups |
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
from maya import cmds | |
def get_visible_meshes(): | |
meshes = cmds.ls(type="mesh", o=True, ni=True) | |
visible_meshes = list(meshes) | |
for mesh in meshes: | |
checklist = cmds.ls(mesh, long=True)[0].split('|')[1:-1] + [mesh] | |
for parent in checklist: | |
if (cmds.getAttr("%s.v" % parent) == 0): |
NewerOlder