Skip to content

Instantly share code, notes, and snippets.

@tokejepsen
tokejepsen / mwe.py
Created December 10, 2016 22:32
Maya Widget Explorer
from PySide.QtCore import *
from PySide.QtGui import *
from shiboken import wrapInstance
from maya import cmds
from maya import mel
from maya import OpenMayaUI as omui
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin, MayaQWidgetDockableMixin
@tokejepsen
tokejepsen / pf.py
Created September 7, 2016 11:46
PyFileMaker fix
# PyFileMaker - Integrating FileMaker and Python
# (c) 2014-2016 Marcin Kawa, [email protected]
# (c) 2006-2008 Klokan Petr Pridal, [email protected]
# (c) 2002-2006 Pieter Claerhout, [email protected]
#
# http://code.google.com/p/pyfilemaker/
# http://www.yellowduck.be/filemaker/
# Import the main modules
import string
@tokejepsen
tokejepsen / pld.py
Created August 17, 2016 11:38
pyblish-lite debug
import pyblish_lite
from pyblish_lite import mock
import pyblish.api
for plugin in mock.plugins:
pyblish.api.register_plugin(plugin)
def instance_toggled(instance, new_value, old_value):
@tokejepsen
tokejepsen / mrm.py
Created July 11, 2016 08:26
Maya: Render Mattes
"""
Select the geometry to make the renderlayers from.
Will find all the materials (lambert), make a renderlayer per material only showing that material.
"""
import traceback
import pymel.core
selection = pymel.core.ls(selection=True)
@tokejepsen
tokejepsen / nrc.py
Last active July 8, 2016 15:38
Nuke: related code
# 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)
@tokejepsen
tokejepsen / ncp.txt
Last active July 8, 2016 14:17
Nuke: Card Placer
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
@tokejepsen
tokejepsen / at.py
Created May 6, 2016 11:31
alembic testing
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 = []
@tokejepsen
tokejepsen / mptt.py
Last active May 4, 2016 14:19
Maya: Pointcache to Transforms
"""
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
@tokejepsen
tokejepsen / mgaor.py
Last active May 18, 2022 02:22
Maya: Get Attribute On Renderlayer
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'):
@tokejepsen
tokejepsen / msaor.py
Last active April 14, 2016 08:59
Maya: Set Attribute On Renderlayer
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.