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
from maya.app import renderSetup | |
import pprint | |
import maya.cmds as cmds | |
rs = renderSetup.model.renderSetup.instance() | |
ov = renderSetup.model.override | |
def addOverride(override_name, shader_name, node_names): | |
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
try: | |
# Python2 | |
from Tkinter import Tk | |
except ImportError: | |
# Python3 | |
from tkinter import Tk | |
def setClipboard(text): |
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
using UnityEngine; | |
using System.Collections; | |
public class RotateCar : MonoBehaviour { | |
public GameObject car; | |
public GameObject doorLeft; | |
public GameObject doorRight; | |
private float rotateInc = 45.0f; |
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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import sys | |
from PyQt5.QtWidgets import QWidget, QDesktopWidget, QApplication, QMainWindow, QFrame, QTableView, QVBoxLayout, QAbstractItemView | |
from PyQt5 import QtGui, QtCore | |
class MyTableView(QTableView): | |
# Model with activated DragDrop functionality |
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 math | |
grid_size = 20 | |
#oldMin, newMin, oldMax, newMax | |
def lerp(x0, y0, x1, y1, x): | |
return y0+(y1-y0)*(x-x0)/(x1-x0) | |
# t: current time, b: begInnIng value, c: change In value, d: duration | |
def easeInOutCubic(t, b, c, d): | |
t /= d/2 |
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 math | |
def fit_center_rect(total_length, item_length): | |
ret_list = [] | |
float_fit = float(total_length)/item_length | |
int_fit = int(math.ceil(float_fit)) | |
# add one to the count if we have an even number |
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 | |
import math | |
w = 200 | |
h = 200 | |
rw = 50 | |
rh = 50 | |
num_rect_width = float(w)/rw |
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 maya.api.OpenMaya as om | |
import pymel.core as pm | |
rot_order = 5 | |
kRotateOrders = [om.MEulerRotation.kXYZ, | |
om.MEulerRotation.kYZX, | |
om.MEulerRotation.kZXY, | |
om.MEulerRotation.kXZY, | |
om.MEulerRotation.kYXZ, |
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 | |
pm.newFile(f=True) | |
# create the ctrl, add attr and set som keys | |
ctrl, _ = pm.circle(n='ctrl') | |
ctrl.addAttr('anim', k=True) | |
pm.setKeyframe(ctrl, v=0, attribute='anim', t=1) | |
pm.setKeyframe(ctrl, v=10, attribute='anim', t=25) | |
pm.setKeyframe(ctrl, v=0, attribute='anim', t=50) |
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 maya.api.OpenMaya as om | |
import pymel.core as pm | |
def intersect_mesh(pos, vec, mesh_name): | |
selectionList = om.MSelectionList() | |
selectionList.add(mesh_name) | |
dagPath = selectionList.getDagPath(0) | |
fnMesh = om.MFnMesh(dagPath) |
NewerOlder