Skip to content

Instantly share code, notes, and snippets.

@howiemnet
howiemnet / SetScreenLayout.py
Created January 27, 2017 15:18
Blender Screen hotkeys script
import bpy
class SetScreenLayout(bpy.types.Operator):
"""Switches to the screen layout of the given name."""
bl_idname="screen.set_layout"
bl_label="Switch to Screen Layout"
layoutNamme=bpy.props.StringProperty()
def execute(self,context):
bpy.context.window.screen=bpy.data.screens[self.layoutNamme]
return{'FINISHED'}
def invoke(self,context,event):
@howiemnet
howiemnet / Populate.py
Created March 7, 2017 07:13
Populate! a hacky, project-specific crowd animator
#
# POPULATE!
#
import bpy
import math
from bpy_extras import object_utils
from random import randint
from math import radians
@howiemnet
howiemnet / Populate.py
Created March 7, 2017 07:14
Populate! a hacky, project-specific crowd animator
#
# POPULATE!
#
import bpy
import math
from bpy_extras import object_utils
from random import randint
from math import radians
import sys
import bpy
from math import pi, sin, cos, sqrt, atan2, fabs
import socket
rad2deg = 180/3.14159265
UDP_IP = "127.0.0.1"
UDP_PORT = 4950
@howiemnet
howiemnet / Hacky_Houdini_to_AfterEffects.py
Created July 27, 2017 10:14
Houdini to After Effects animation exporter thingy
# first hacky attempt at getting camera / object animations into AE from Houdini.
# Stick this on a tool button on a shelf. Note the hard-coding below (!)
# A file will be created in your home folder; open it, copy to the clipboard, then go to AE and paste onto the cam/null of your choice
import hou
h = hou.node("/obj/geo1")
filename = "testfile.txt"
startFrame = 0
@howiemnet
howiemnet / AE_to_Houdini.py
Last active April 24, 2024 14:18
First attempt at getting AE camera data into Houdini (hacky woo)
# Ultra quick'n'hacky AE camera animation importer for Houdini.
# Create a new shelf, create a new tool, paste this into the script box.
#
# In AE, select the Orientation and/or Position keyframes, and Ctrl/Cmd-C them to the clipboard
# Open a new text file (Notepad or Textedit) and paste the clipboard contents in. There's your keyframes.
# Save the text file somewhere and amend the filename line below to suit
# In Houdini, create a camera (it's up to you to set the same zoom / aperture as the AE one).
# ... and run this script (well, press the shelf button you stuck this on)
@howiemnet
howiemnet / Houdini - copy camera animation data to clipboard.py
Created November 7, 2018 06:01
Houdini to AE camera animation clipboard exporter (now with Zoom! Woo!)
# Houdini to After Effects camera animation exporter
# This version: 7/11/2018, by Howard Matthews - h@howiem.net
# Copyright: CC-0 - use and abuse. Please pass on the knowledge.
# Note: there's no error-checking in this script, but it alters nothing within the Houdini scene, so it'll just
# fail with an error if you try running it without a camera selected. No harm done.
import hou
theNodes = hou.selectedNodes()
@howiemnet
howiemnet / infinity_blur.js
Last active January 7, 2019 04:58
Blur objects at infinity depending on camera settings - After Effects expression
//
// This expression, applied to the blur radius of a Lens blur effect, will calc the right amount of blur
// to apply to objects at infinity (eg star fields) depending on the focus dist / aperture of the current active camera
//
// For safety it maxes out at 100 px (!)
//
try {
focLen = (thisComp.activeCamera.cameraOption.zoom * 102.05) / thisComp.width;
blurDiam = (focLen * thisComp.activeCamera.cameraOption.aperture) / (thisComp.activeCamera.cameraOption.focusDistance - focLen);
Math.min(100,Math.abs(blurDiam)/2)
@howiemnet
howiemnet / Particle resizer.vex.cpp
Last active July 11, 2022 18:04
Houdini Particle distance resizer
// NOTE: ignore the .cpp extension on the filename - this is VEX
// but I couldn't find a gist-friendly way to syntax-hilight it
// ¯\_(ツ)_/¯
//
// h's magic adaptive point resizer for optimal
// rendering of tiny points/particles/wires
//
// 1/2/2018 h@howiem.net
// CC-0 - use and abuse
@howiemnet
howiemnet / DAWmidi.py
Created May 29, 2019 10:39
Houdini control from a Behringer X-Touch One using pygame
# h's super dodgy, super-hacky MIDI controller for Houdini code
#
# Designed to get a Behringer X-Touch One controller to control Houdini
# while feeding back current frame and status to the lights and readouts
# on the controller. Super cool.
#
# But this really, really, shouldn't be public. My Python-fu is a little raw.
# But it may give someone a useful starting point...