Skip to content

Instantly share code, notes, and snippets.

View hogjonny's full-sized avatar

Jonny K Galloway hogjonny

View GitHub Profile
# -------------------------------------------------------------------------
# walkUp
# -------------------------------------------------------------------------
def walkUp(inPath, dirTag='foo'):
'''
Mimic something like os.walk, but walks up the directory tree
Walks Up from the inPath looking for a dir with the name dirTag
inPath: the path to start in
dirTag: the name of diretory above us we are looking for
import maya.cmds as mc
filePath = mc.file(q=True, sceneName=True)
parentDir = os.path.abspath(os.path.join(filePath, os.pardir))
selSet= mc.ls( selection=True )
for thing in selSet:
selThing = mc.select(thing)
newFile = os.path.abspath(os.path.join(parentDir, '{0}.ma'.format(thing)))
@hogjonny
hogjonny / HDR_to_RGBM.py
Last active March 15, 2024 11:31
Converts an input .HDR file, to a RGBM format output as a 8-bit (per-channel), RGBA .tga file. Iteration 1, didn't work so well (looked horrible) so I made some adjustments. This now takes input args, so it can be run from the commandline.
#!/usr/bin/python
#coding:utf-8
# -- This line is 75 characters -------------------------------------------
"""
This script will convert a .HDR (radiance) into a RGBM file,
then save it back out as a 8bit (per-channel) .tga
"""
__author__ = 'HogJonny'
# -------------------------------------------------------------------------
# fast easy work around for rendering hardware2/viewport2.0 sequence frames in Maya 2016
# you still need to setup for animation in the 'Render Settings'
# Change 'Frame/Animation ext:' pull down, so that each frame will be written out
# with name frame padding, etc.
import maya.cmds as cmds
# Settings
startFrame = int(cmds.playbackOptions(q=True, min=True))
endFrame = int(cmds.playbackOptions(q=True, max=True))
@hogjonny
hogjonny / substancePythonBatch.py
Created February 25, 2015 18:13
Basic python formatting for a working example of accessing Allegorithmic Substance BatchTools via script.
#!/usr/bin/env python
#coding:utf-8
# -- This line is 75 characters -------------------------------------------
__author__ = 'HogJonny'
import os, sys
import subprocess
#!/usr/bin/env python
#coding:utf-8
#--------------------------------------------------------------------------
def synthesize(inst, name, value, readonly=False):
'''
This is a convenience method for OOP
synthesizes the creation of attr with convenience methods:
x.attrbute
x._attribute # attribute storage
@hogjonny
hogjonny / fileDDS.py
Created December 18, 2014 23:24
Simple DDS file loader ... load a DDS file as a QImage
#!/usr/bin/env python
#coding:utf-8
__author__ = '[email protected]'
## reference: https://gist.github.com/bjorn/4635382
# -- This line is 75 characters -------------------------------------------
# example code
@hogjonny
hogjonny / dirFileListModel.py
Created December 15, 2014 22:15
Pyside --> Filtered (pattern), directory file list (via: QtCore.QAbstractListModel)
#!/usr/bin/env python
#coding:utf-8
# -- This line is 75 characters -------------------------------------------
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# version: 0.1
# date: 12/15/2014
# author: jGalloway
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# bp_newTool.py
# Tool for blah, blah, blah
# version: 1.0
# date: 5/1/2013
# author: jGalloway
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
#!/usr/bin/env python
#coding:utf-8
# -- This line is 75 characters -------------------------------------------
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# fileTemplate.py
# This is a template formatting for new files.
# version: 0.1