Skip to content

Instantly share code, notes, and snippets.

@mclavan
mclavan / padding.py
Created November 5, 2014 02:44
Padding Example
import pymel.core as pm
# Select joint chain.
# On selected joints.
# Create a local oriented control.
joint_system = pm.ls(selection=True, dag=True)
last_control = None
# Loop through selected joints
@mclavan
mclavan / connecting.py
Last active May 17, 2024 06:08
Connecting Nodes with pymel.
'''
This script will create an attribute called joint_vis on the first selected and then connect it to the visibility to the second selected.
You wll need to have two object in your scene selected to make this example work.
Mainly this script is a demo of connecting and disconecting attributes using pymel.
'''
import pymel.core as pm
selected = pm.ls(selection=True)
@mclavan
mclavan / copyPivotToolPM.py
Last active August 29, 2015 14:08
Copy Pivot Tool - PyMel
'''
Copy Pivot
by TELIMS
How to Work:
Select object with pivot you want to change too.
Select object who's pivot you want to change.
If selecting multiple objects, the first selected object will
@mclavan
mclavan / aaron_color_icon2.py
Created November 16, 2014 04:34
Aaron's Color Control Script
'''
TELIMS - Color Curves
How to Use:
import telims_color_curves_wireframe
reload(telims_color_curves_wireframe)
Select 1 or multiple curves > run Script
Enter Yellow, Red or blue
@mclavan
mclavan / controls.py
Created November 17, 2014 17:33
Establishing an icons folder
'''
controls.py
Michael Clavan
import controls
reload(controls)
'''
import pymel.core as pm
selected_material = pm.ls(selection=True)[0]
# Printing out the material type will give you the information you want to compare.
print selected_material.type()
# Here is a comparison check between the mental ray material and your target.
# selected_material.type() == 'mia_material_x'
@mclavan
mclavan / shannonPoly.py
Created February 10, 2015 00:11
Point On Poly Constraint
import pymel.core as pm
selected_vtx = pm.ls(selection=True)[0]
locator_1 = pm.spaceLocator(name='name_locator')
locator_2 = pm.spaceLocator(name='name_locatorChild')
# Select the driver (vtx) and the driven locator 1.
pm.select(selected_vtx, locator_1, r=True)
def get_icon_path(icon_name, icon_folder='icons'):
'''
The point of this function is ot return the location of
a icon in an adjacent folder next to the script.
Make sure ot import this script into the scirpt you want to use it.
Then you can use the path_tools.get_icon_path('icon.png') anywhere you
need to implant an image path.
How to Run:
@mclavan
mclavan / getIcons.py
Created February 24, 2015 14:48
Get Control Icons
import pymel.core as pm
current_transforms = pm.ls(selection=True, dag=True, type='transform')
controls = []
for transform_node in current_transforms:
if transform_node.getShapes():
controls.append(transform_node)
print 'You got {0} controls'.format(controls)
@mclavan
mclavan / pyside_session2_part2_notes.py
Last active June 22, 2016 13:54
PySide Session - Part 2 - Notes
'''
PySide Session 2 - Notes
'''
'''
Packages
'''
# Window flags