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
""" | |
VIS ATTR MAKER SCRIPT | |
# Open UI - Add this code to a button in Maya | |
--- | |
import vis_attr_maker | |
ui = vis_attr_maker.VisSwitchMakerUI() | |
ui.show() |
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 line_list(in_list): | |
""" Convert a list into formatted lines for error output. """ |
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 | |
# Get the user selection and iterate through it | |
for item in cmds.ls(selection=True): | |
# Get the current world space location of the item. This is not the same | |
# as the values in the channel box, but the true world space location | |
world_space = cmds.xform(item, scalePivot=True, query=True, worldSpace=True) | |
# Move the object to the world center | |
cmds.move(0,0,0,item, rotatePivotRelative = True) |
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 | |
# Iterate through everything in the user's selection | |
for item in cmds.ls(selection=True): | |
# Store the current position | |
orig_pos = cmds.xform(item, query=True, worldSpace=True, translation=True) | |
# Move the item to the origin. This will move where ever it's current |
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 re | |
fbx_properties = """ | |
# PATH: Import|PlugInGrp|PlugInUIWidth ( TYPE: Integer ) ( VALUE: 500 ) # | |
# PATH: Import|PlugInGrp|PlugInUIHeight ( TYPE: Integer ) ( VALUE: 500 ) # | |
# PATH: Import|PlugInGrp|PlugInUIXpos ( TYPE: Integer ) ( VALUE: 100 ) # | |
# PATH: Import|PlugInGrp|PlugInUIYpos ( TYPE: Integer ) ( VALUE: 100 ) # | |
# PATH: Import|PlugInGrp|UILIndex ( TYPE: Enum ) ( VALUE: "ENU" ) (POSSIBLE VALUES: "ENU" "DEU" "FRA" "JPN" "KOR" "CHS" "PTB" ) # | |
# PATH: Import|IncludeGrp|MergeMode ( TYPE: Enum ) ( VALUE: "Add and update animation" ) (POSSIBLE VALUES: "Add" "Add and update animation" "Update animation" ) # |
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 functools import wraps | |
import maya.cmds as cmds | |
def one_undo(func): | |
""" | |
Decorator - guarantee close chunk. | |
type: (function) -> function | |
""" |
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
""" | |
Implementation of a gif as tool tip for Autodesk Maya. | |
Modified from: https://stackoverflow.com/questions/60521848/how-to-show-tooltip-image-when-hover-on-button-pyqt5 | |
""" | |
import sys | |
from PySide2 import QtCore | |
from PySide2 import QtGui |
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 socket | |
HOST = '127.0.0.1' # the local host | |
PORT = 54321 # The same port as used by the server | |
ADDR = (HOST, PORT) | |
def send_command(): | |
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
client.connect(ADDR) |
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 | |
# Useage: Select the source object, then all of the target objects to copy to. | |
# Change this to True if you want to use Instances | |
make_instance = False | |
user_selection = pm.ls(selection=True) | |
if not len(user_selection) >= 2: |
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 | |
# Capture the user selection | |
user_selection = cmds.ls(selection=True) | |
# Create a duplicate of it | |
new_geo = cmds.duplicate(user_selection[0]) | |
# Create a twist deformed and two bend deformers. | |
twist_def, twist_handle = cmds.nonLinear(new_geo[0], type='twist') |
NewerOlder