This file contains 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 | |
import pymel.core.general | |
# select materials | |
allMat = pm.ls(materials=True) | |
vrayID = {} | |
selectMaterial = True | |
for mat in allMat: |
This file contains 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
from PySide import QtCore, QtGui | |
from shiboken import wrapInstance | |
import maya.OpenMayaUI as apiUI | |
import sys | |
def getMayaWindow(): | |
""" | |
Get the main Maya window as a QtGui.QMainWindow instance | |
@return: QtGui.QMainWindow instance of the top level Maya windows | |
""" |
This file contains 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
from maya import cmds | |
from maya import OpenMayaUI | |
from PySide import QtCore | |
from PySide import QtGui | |
from shiboken import wrapInstance | |
import os | |
# testing to load a transparent 24 png from the script dir | |
usrScriptDir = cmds.internalVar(userScriptDir=True) | |
img_path = os.path.join(usrScriptDir, "lighthouse_24_alpha.png") |
This file contains 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
from maya import cmds | |
from maya import OpenMayaUI | |
from PySide import QtCore | |
from PySide import QtGui | |
from shiboken import wrapInstance | |
import os | |
# testing to load a transparent 24 png from the script dir | |
usrScriptDir = cmds.internalVar(userScriptDir=True) | |
img_path = os.path.join(usrScriptDir, "lighthouse_24_alpha.png") |
This file contains 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
L = thisComp.layer("Camera 1"); | |
u = fromWorldVec(L.toWorldVec([1,0,0])); | |
v = fromWorldVec(L.toWorldVec([0,1,0])); | |
w = normalize(fromWorldVec(L.toWorldVec([0,0,1]))); | |
sinb = clamp(w[0],-1,1); | |
b = Math.asin(sinb); | |
cosb = Math.cos(b); | |
if (Math.abs(cosb) > .0005){ | |
c = -Math.atan2(v[0],u[0]); |
This file contains 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 maya.cmds as cmds | |
import random | |
import math | |
def build_tiled_mesh_uv(mesh, num, t_offset, rot_scale, item_per_row_uv, item_per_row_xform): | |
#get the x and z spacing [ xmin ymin zmin xmax ymax zmax ] | |
bb = cmds.xform(mesh, q=True, bb=True) | |
x_dist = bb[3] - bb[0] | |
z_dist = bb[5] - bb[2] |
This file contains 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
// linear interpolation between position 100,100 to 500,500 | |
// from 0 to 3 seconds | |
linear(time,0,3,[100,100],[500,500]) | |
// drop the frame rate to 1fps on existing keyframes, | |
posterizeTime(1); | |
value; | |
// could use with the linear function (no keyframes needed) | |
posterizeTime(1); |
This file contains 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
def set_bool_knob(name, all=True, value=None): | |
if all: | |
node_list = nuke.allNodes() | |
else: | |
node_list = nuke.selectedNodes() | |
for node in node_list: | |
This file contains 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
from PySide import QtCore, QtGui | |
from shiboken import wrapInstance | |
import maya.OpenMayaUI as omui | |
def maya_main_window(): | |
main_window_ptr = omui.MQtUtil.mainWindow() | |
return wrapInstance(long(main_window_ptr), QtGui.QWidget) | |
This file contains 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 nuke | |
import os.path | |
sel_nodes = nuke.selectedNodes() | |
frame = nuke.frame() | |
node = sel_nodes[0] | |
file_path = nukescripts.replaceHashes( node['file'].value() ) % frame |
OlderNewer