Skip to content

Instantly share code, notes, and snippets.

__author__ = 'ben.hearn'
"""
- File Runner is a handy Qt UI class that helps with constant batch processing on files or directories with a twist!
- You can apply any external script you have written to process the files
How to use:
- Simply drag in the directories you want to iterate over into the directories window
- Type in your desired file format
@ben-hearn-sb
ben-hearn-sb / file_runner.py
Created November 22, 2015 13:50
file runner revised. Patched up a couple of bugs Added if name = main functionality
__author__ = 'ben.hearn'
"""
- File Runner is a handy Qt UI class that helps with constant batch processing on files or directories with a twist!
- You can apply any external script you have written to process the files
How to use:
- Simply drag in the directories you want to iterate over into the directories window
- Type in your desired file format
def createReplacementCgfx(material='', texturePaths={}, cgfxChannels={}, cgfxShaderPath=''):
""" If we find a shaderFxShader type material we need to replace wiuth CGFX for export purposes """
print 'Replacing shader with CGFX'
#mel.eval('cgfxShader -fx "%s" ' %cgfxShaderPath)
matName = str(material)
shader = pm.listConnections(material, type='shadingEngine')[0]
members = list(set(shader.members(flatten=True)))
pm.delete(matName)
print 'got members'
def addMenuItem(parentMenu=None, labelName='', callback=None, sub=False, tearable=False):
if callback == None:
newMenu = pm.menuItem(parent=parentMenu, label=labelName, subMenu=sub, tearOff=tearable)
return newMenu
else:
pm.menuItem(p=parentMenu, label=labelName, command=pm.Callback(callback))
def main():
#app = QtGui.QApplication(sys.argv)
winName = 'COLLADA_EXPORTER'
if pm.windows.window(winName, exists=True):
print 'Already exists, passing'
pass
else:
window = ColladaExporterUI()
window.setObjectName(winName)
window.show()
def closeEvent(self, event):
print 'CLOSED'
del self.mainDialog
del self
event.accept()
from PySide import QtGui, QtCore
import sys
class ExampleUI(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
# Main dialog that houses all our widgets and info
self.mainDialog = QtGui.QDialog()
self.mainDialog.resize(650, 550)
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
pluginCommandName = 'getObjsUnderNode'
flagExactNameShort = '-en'
flagExactNameLong = '-exactName'
flagFilterNameShort = '-fn'
flagFilterNameLong = '-filterName'
@ben-hearn-sb
ben-hearn-sb / master_launcher.bat
Last active July 3, 2016 17:09
master batch file launcher
@echo off
setlocal enabledelayedexpansion
set CYGWIN=nodosfilewarning
set TRUNK=%1
set PROJECT_TRUNK=%2
set SOURCE_DIR=%3
set MAYA_STARTUP_IMAGES=%4
set PROJECT_APP_DIR=%5
@ben-hearn-sb
ben-hearn-sb / child_launcher.bat
Created July 3, 2016 17:09
child launcher for our master batch file from prev gist
@echo off
setlocal enabledelayedexpansion
set CYGWIN=nodosfilewarning
set TRUNK=my_trunk
set PROJECT_TRUNK=my_trunk
set SOURCE_DIR=my_asset_source
set MAYA_ICONS=maya_startup_images_my_project
set PROJECT_APP_DIR=_MY_PROJECT_SETTINGS_