Skip to content

Instantly share code, notes, and snippets.

View gfxhacks's full-sized avatar

Gfxhacks gfxhacks

View GitHub Profile
@gfxhacks
gfxhacks / AfterEffectsTemplate.py
Last active May 14, 2020 17:34
After Effects Project Template. More at: gfxhacks.com/project-folder-templates-in-finder-using-python
# cd to folder in Terminal, then run script using python.
import os
def createFolder(folder):
try:
if not os.path.exists(folder):
os.makedirs(folder)
except OSError:
print ('Error creating folder: ' + folder)
@gfxhacks
gfxhacks / MotionGraphicsTemplate.py
Last active May 14, 2020 17:34
A complete motion graphics project template, ready to customize... More at: gfxhacks.com/project-folder-templates-in-finder-using-python
# cd to folder in Terminal, then run script.
import os
def createFolder(folder):
try:
if not os.path.exists(folder):
os.makedirs(folder)
except OSError:
print ('Error creating folder: ' + folder)
@gfxhacks
gfxhacks / myProjectTemplate.py
Created May 14, 2020 17:33
Example of how to use at: gfxhacks.com/project-folder-templates-in-finder-using-python
import os
def createFolder(folder):
try:
if not os.path.exists(folder):
os.makedirs(folder)
except OSError:
print('Error creating folder: ' + folder)
createFolder('My New Folder')
@gfxhacks
gfxhacks / ae-total-render-time.py
Last active August 15, 2020 13:38
Calculate the Total Render Time of your completed After Effects renders. More Info: https://gfxhacks.com/ae-render-logs-total-render-time
#!/usr/bin/env python3
# Command Line Usage: python3 ae-total-render-time.py /path/to/AERenderLogsFolder/
# Title: ae-total-render-time.py
# Description: Calculate the Total Render Time of your completed After Effects renders.
# Author: gfxhacks.com
# More Info: https://gfxhacks.com/ae-render-logs-total-render-time
import os
import hou
# get node (find the path in your node's info panel)
n = hou.node("/path/to/node")
# get existing list of parameters for the specified node
g = n.parmTemplateGroup()
# define folders and parameters
f = [
# define new folder
f = hou.FolderParmTemplate("myFolder", "My Folder")
# define new simple folder (no tab)
f = hou.FolderParmTemplate("myFolder", "My Folder", folder_type=hou.folderType.Simple)
# add parameter at bottom of folder
f.addParmTemplate(p)
# remove item from folder (same as for group)
# float
p = hou.FloatParmTemplate("float1", "Float 1", 1)
# button
p = hou.ButtonParmTemplate(
"btn1",
"Button 1",
script_callback='print("Hello World!")',
script_callback_language=hou.scriptLanguage.Python
),
# get node (find the path in your node's info panel)
n = hou.node("/path/to/node")
# get existing list of parameters for the specified node
g = n.parmTemplateGroup()
# define new float parameter ("id", "Label", components/input fields, default values)
p = hou.FloatParmTemplate("myParm", "My Parameter", 3, default_value=[1, 1, 1])
# append the new parameter to the list
@gfxhacks
gfxhacks / queryEditParameters.py
Last active June 19, 2020 17:06
Snippets to query and edit Parameters in Houdini with Python: https://gfxhacks.com/create-parameters-in-houdini-with-python
# edit a parameter using replace
oldParm = "oldParmId"
newParm = hou.FloatParmTemplate("newParmId", "NewParmLabel", 3, default_value=[1, 1, 1])
g.replace(oldParm, newParm)
# if you defined a parameter earlier
g.remove(p)
# ...otherwise remove by id - useful to remove existing parameters
@gfxhacks
gfxhacks / metaDateRenamer.sh
Created July 4, 2020 01:48
Rename a file from a specified date metadata value in OSX. More info: https://gfxhacks.com/renaming-files-by-date-from-metadata
#!/bin/bash
#Cmd Usage: sh metaDateRenamer.sh file.ext kMDItemName
# Title: metaDateRenamer.sh
# Desc: Rename a file from a specified date metadata value.
# Author: gfxhacks.com
# More Info: https://gfxhacks.com/renaming-files-by-date-from-metadata
# kMDItem DATE descriptor options:
# Common Metadata Attributes:
# kMDItemContentCreationDate