This file contains hidden or 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 pymel.core | |
def replaceReference(): | |
basicFilter = "*.mb" | |
f = pymel.core.fileDialog2(fileFilter=basicFilter, dialogStyle=1, fileMode=1) | |
if not f: |
This file contains hidden or 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 | |
for node in pymel.core.ls(selection=True): | |
grp1 = pymel.core.group(empty=True) | |
grp2 = pymel.core.group(empty=True) | |
pymel.core.delete(pymel.core.parentConstraint(node, grp1)) | |
pymel.core.delete(pymel.core.parentConstraint(node, grp2)) | |
pymel.core.parent(node, grp1) |
This file contains hidden or 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
Input this expression into the window scale u and v: | |
(root.format.w/root.format.h)/(haperture/vaperture) | |
Example: | |
set cut_paste_input [stack 0] | |
version 9.0 v7 | |
push $cut_paste_input | |
Camera2 { |
This file contains hidden or 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 | |
def ctr_dist(objA, objB): | |
Ax, Ay, Az = objA.getRotatePivot(space="world") | |
Bx, By, Bz = objB.getRotatePivot(space="world") | |
return ((Ax-Bx)**2 + (Ay-By)**2 + (Az-Bz)**2 )**0.5 | |
def get_closest_node(src, nodes): | |
This file contains hidden or 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 | |
drg = pymel.core.PyNode('defaultRenderGlobals') | |
# dict of attributes and values to set. | |
# needs to include node name as well. | |
# Note that time values are divided by the framerate, ei. 10 frame / 25 frame/sec = 0.4 sec | |
attrs = {'defaultRenderGlobals.startFrame': 0.4} | |
# iterate over the selected renderlayers. |
This file contains hidden or 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 | |
drg = pymel.core.PyNode('defaultRenderGlobals') | |
# iterate over the selected renderlayers. | |
# can select renderlayers through the outliner with "Display" > "DAG Objects Only" | |
data = {} | |
render_cams = [] | |
for layer in pymel.core.ls(selection=True, type='renderLayer'): |
This file contains hidden or 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
""" | |
This script will try to convert a point cache to transform animation. | |
Create a set called "driven" with the transforms to get animated, | |
and create a set called "driver" with the single pointcache. | |
Tolerance is for how far the sample points should be from each other. | |
""" | |
import re | |
import os |
This file contains hidden or 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 pymel.core as pm | |
pm.loadPlugin('AbcExport.mll', quiet=True) | |
pm.loadPlugin('AbcImport.mll', quiet=True) | |
root = r'L:\ethel_and_ernest_0001\sequences\q060\q060c005\fx\cache' | |
driven = pm.PyNode('driven').members() | |
re_sim = [] |
This file contains hidden or 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
set cut_paste_input [stack 0] | |
version 9.0 v7 | |
Camera2 { | |
inputs 0 | |
translate {{curve x1 -32.95905358 -32.95814868 -32.95544124 -32.95094221 -32.9446625 -32.93661304 -32.92680475 -32.91524855 -32.90195538 -32.88693616 -32.87020179 -32.85176322 -32.83163137 -32.80981718 -32.78633153 -32.76118537 -32.73438966 -32.70595525 -32.67589311 -32.6442142 -32.61092936 -32.57604955 -32.53958576 -32.5015488 -32.46194971 -32.42079923 -32.37810854 -32.33388843 -32.2881497 -32.24090353 -32.19216073 -32.14193206 -32.09022874 -32.03706156 -31.98244127 -31.92637912 -31.86888588 -31.8099723 -31.74964964 -31.68792865 -31.62482009 -31.56033524 -31.49448484 -31.42727962 -31.3587309 -31.28884939 -31.21764584 -31.14513156 -31.07131706 -30.99621392 -30.91983219 -30.84218322 -30.7632784 -30.68312774 -30.60174263 -30.51913445 -30.43531319 -30.35029024 -30.26407702 -30.17668347 -30.08812101 -29.99840107 -29.90753356 -29.8155299 -29.72240157 -29.62815841 -29.53281188 -29.43637346 -29.33885297 -29.24026189 -29.14061171 -29.03991222 -28.93817 |
This file contains hidden or 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
# limited random scaling | |
import nuke | |
import random | |
min_scale = 800 | |
max_scale = 1600 | |
for node in nuke.selectedNodes("Card2"): | |
scale = random.uniform(min_scale, max_scale) | |
node['uniform_scale'].setValue(scale) |