Skip to content

Instantly share code, notes, and snippets.

Evan Cox coxevan

Block or report user

Report or block coxevan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View del_on_selected.py
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:
View maya_spring_animation.py
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
View divine_animation_generator.py
#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.' ]
View reference_properties.py
'''
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
View mobu_evaluate_decorator.py
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
View wireframe_toggler.py
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' )
View refactor_mirror.py
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:
View skin_cluster_print
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()
View gist:aaeb6f12447ff8dfabd3
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:
View MayaDotProduct
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):
You can’t perform that action at this time.