Skip to content

Instantly share code, notes, and snippets.

# User specific aliases and functions
__PROMPT_COMMAND() {
local allOFF='\[\e[0m\]'
local underline='\[\e[4m\]'
local underlineOFF='\[\e[24m\]'
local italic='\[\e[3m\]'
local italicOFF='\[\e[23m\]'
local black_bg='\[\e[40m\]'
local black_fg='\[\e[30m\]'
local red_bg='\[\e[41m\]'
@Liametc
Liametc / group_frame_numbers.py
Created March 18, 2021 17:35
Group frame numbers by step and display as string
from itertools import chain, groupby
def group_frame_numbers(frame_range, range_char="-", step_char="x", sep=","):
"""
Take a list of frame numbers and group them according to step.
i.e [1, 4, 5, 6, 12, 15, 18, 22, 25, 29, 33] -> 1,4-6,12-18x3,22,25-33x4
:param frame_numbers: A list[int] of frame numbers representing a frame range.
@Liametc
Liametc / 2d_center_on_object_api_1.0.py
Last active April 20, 2024 05:50
Center maya camera 2D pan/zoom on object using python api 2.0
from maya import OpenMaya
# create selection
sel = OpenMaya.MSelectionList()
sel.add("locator1")
sel.add("camera1")
# get dag paths
loc_dag = OpenMaya.MDagPath()
sel.getDagPath(0, loc_dag)
@Liametc
Liametc / check_poly_normals.py
Last active August 12, 2024 01:47
Check polygon normals in maya using python api 2.0
import maya.api.OpenMaya as om
import maya.cmds
import time
def is_normal_reversed(poly, mesh):
"""
Check the normal faces in or out of the model by doing a simple ray cast and
count results. Evens face out, odds face in.