Skip to content

Instantly share code, notes, and snippets.

r"""
Module contains methods for setting up Dot Product relationships and vectorProduct nodes in Autodesk Maya.
Future features:
Cross Product implementation.
"""
import pymel.core as py
def create_dot_relationship(**kwargs):
def my_method( objects = [], dh = True, freeze = ( None, None, None ) ):
if not objects:
# Get selected objects
pass
if dh:
# Delete history
pass
if freeze == True:
import pymel.core
SKIN_CLUSTER_NAME = 'skinCluster1' # <-- Replace with 'name_of_my_skincluster' but keep the quotes!
# Get the skin cluster from the shape node
skin_cluster = pymel.core.PyNode(SKIN_CLUSTER_NAME)
# Get the objects associated with that skincluster (mostly bones)
influence_list = skin_cluster.influenceObjects()
def applyBtnCmd(self, *args):
# Grab and check info from UI lists and scroll areas.
attributes_to_mirror_list = self.driverScroll.getSelectItem()
driven_object_attribute_list = self.objAttrScroll.getSelectItem()
if len(attributes_to_mirror_list) < 1:
cmds.warning( 'No attribute to mirror selected' )
return False
if len(driven_object_attribute_list) < 1:
import maya.cmds as cmds
def wireframeSwitcher():
# Get the viewport object
viewport = cmds.getPanel( withFocus = True)
# If there is a model panel...
if 'modelPanel' in viewport:
currentState = cmds.modelEditor( viewport, q = True, displayAppearance= True )
if currentState.lower() == 'wireframe':
cmds.modelEditor( viewport, edit = True, displayAppearance = 'smoothShaded' )
@coxevan
coxevan / mobu_evaluate_decorator.py
Last active August 7, 2020 13:26
Gotcha Examples
def toggle_parallel_settings( func ):
def _wrapper( *args, **kwargs ):
# Store the initial values.
evaluate_manager = pyfbsdk.FBEvaluateManager()
p_evaluation = evaluate_manager.ParallelEvaluation
p_pipeline = evaluate_manager.ParallelPipeline
p_deformation = evaluate_manager.ParallelDeformation
# Turn them all off
evaluate_manager.ParallelEvaluation = False
'''
Utility methods for getting and setting reference properties ( aka - the blue properties ) in MotionBuilder.
'''
import pyfbsdk
def get_reference_property( obj, prop_name ):
'''
Gets a reference property from an object by name
#Establish a bit of chaos
import random
#Establish a bit of order
LIGHT_GODS = True
DARK_GODS = False
DIVINE_MAP = {True: 'Light', False: 'Dark'}
CELESTIAL_ODDS = (-20, 20)
COMMANDMENTS_LIST = [ 'Praise be to the {divine_order} Gods, begin your quest on frame {offering}.',
'For the {divine_order} Gods looked down and saw the animation, and it started on frame {offering}. It was okay.' ]
import maya.cmds
PARTICLE_DEFAULT_NAME = 'spring_particle'
def setup_spring(obj, time_range = None, spring_weight = 0.5):
'''
Sets up spring physics system around a given object
:param obj: obj to apply physics system to
:param time_range: time range of animation to process, tuple
import pymel.core as pm
def delete_keys_on_sel():
selected = pm.selected()
if not selected:
return False
nodes_to_delete = []
for obj in selected: