Skip to content

Instantly share code, notes, and snippets.

View LiamHz's full-sized avatar

Liam Hinzman LiamHz

View GitHub Profile
@LiamHz
LiamHz / camera_notes_in_view.py
Created March 3, 2025 16:05
overlay_tools/viewport_camera_hud/camera_notes_in_view.py
"""
Shot notes display in camera view
"""
import bpy
import blf
import gpu
from gpu_extras.batch import batch_for_shader
from mathutils import Vector
import bpy
def create_assets_from_empty_children():
# Get all empties in the scene
empties = [obj for obj in bpy.data.objects if obj.type == 'EMPTY']
for empty in empties:
# Get direct mesh children
children = [obj for obj in empty.children if obj.type == 'MESH']
if len(children) < 1:
import maya.OpenMayaUI as mui
import shiboken2
from PySide2 import QtWidgets
def set_script_editor_wordwrap():
# Get Maya's main window
ptr = mui.MQtUtil.mainWindow()
main_window = shiboken2.wrapInstance(int(ptr), QtWidgets.QMainWindow)
# Find feedback panel using type instead of name
"""
Creates a marking menu to switch the active camera between a list of focal lengths
Opens on Cmd+Shift+MMB
"""
import maya.cmds as mc
MENU_NAME = "focalLengthMarkingMenu"
class FocalLengthMarkingMenu:
@LiamHz
LiamHz / set_attribute_all_cameras.py
Last active November 20, 2024 18:12
Set a specified attribute (e.g. overscan, gate mask color) on all cameras in group
import maya.cmds as cmds
gate_color = (0.0, 0.0, 0.0)
def get_cameras_in_group(group_name):
group_members = cmds.listRelatives(group_name, children=True)
# Filter out cameras
cameras = []
if group_members:
@LiamHz
LiamHz / ubercam.py
Last active October 28, 2024 23:55
Create an ubercam for the camera sequencer, delete the previous one if it exists, set its display options, move it into the cameras group, bake camera keys, and handle "EnableSteppedPreview"
import maya.cmds as cmds
camera_name = 'ubercam'
cameras_group = 'Cameras'
overscan_value = 1.2
gate_color = (0.0, 0.0, 0.0)
gate_opacity = 1.0
if cmds.objExists(camera_name):
@LiamHz
LiamHz / camera_marking_menu.py
Last active January 26, 2025 16:15
Creates a marking menu for switching between cameras (Maya script)
'''
Creates a marking menu for switching between cameras
Marking menu opens on Shift+MMB
Lists all cameras in a group named "Cameras"
Menu items will look through the selected camera
Menu item labels are created dynamically to match the order and names of your cameras
Marking menu code based on this blog post: http://bindpose.com/custom-marking-menu-maya-python/
'''
import maya.cmds as mc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.liamhinzman.arbtt</string>
<key>Program</key>
<string>/Users/liamhinzman/screenshot.sh</string>
<key>RunAtLoad</key>
<true/>
@LiamHz
LiamHz / backup_ppm.cpp
Created February 2, 2020 08:08
Store the intermediate of a ppm file
// Store a backup ppm after rendering every 100 rows
if (j % 100 == 0) {
ofs.close();
temp_filename = "./out_" + std::to_string(ny-j) + ".ppm";
std::ifstream src("out.ppm", std::ios::binary);
std::ofstream dst(temp_filename, std::ios::binary);
dst << src.rdbuf();
@LiamHz
LiamHz / karabiner.json
Created July 16, 2019 04:28
Map caps lock to l_control when used as modifier and esc when alone
{
"profiles": [
{
"name": "Default profile",
"selected": true,
"complex_modifications": {
"rules": [
{
"description": "A Modern Space Cadet (Steve Losh)",
"manipulators": [