Small tools

Compile .ui to .py

UItoPY

The reason why I made this script is simple, to be able to quickly iterate PySide/PyQt .ui files. The only thing you need to do to compile a ui file is drag and drop it on the window and press enter. Here is a download link if you want to check it out, UiCompilerWithDrop

Software used

Written for Windows/PySide, written in python

UI built in Qt-designer and used with PySide

____________________________________________________________________________________________________________

Recursive maya search

A code snippet I wrote to search an maya hierarchy for transforms or other nodes.

Written for Maya, written in python

import maya.cmds as cmds

# Recursive maya transform search
transform = cmds.ls(sl=True, l =True)
def recursiveMaya(transform):
     transforms = cmds.listRelatives(transform, f=True)
     for eachTransform in transforms:
        if cmds.nodeType(eachTransform) == "transform":
            print "Transform: " + eachTransform
            recursiveMaya(eachTransform)
        else:
            print "Shape: " + eachTransform
            
recursiveMaya(transform)

____________________________________________________________________________________________________________

Reanimated Module

Written for Maya, written in python

Reanimated Module half a settings file, half a module. It holds a lot of paths and some functions we used often.
Most used in it was the logging class. It made it easy to write down/print out errors from our scripts. We used it for debug but also replaced used it instead of printing out messages, as this could give a lot more information easier.

Here is a snippet from it:

class taLogging():
    ''' returns the logger '''
    def getLogger(self, scriptname):
        loggpath = pathsModule().loggPath()
        logger = logging.getLogger(scriptname)
        logger.propagate=False
        if logger.handlers == []:
            handlerA = logging.handlers.RotatingFileHandler(loggpath, maxBytes=50000000, backupCount = 10)
            handlerA.setLevel(logging.ERROR)
            
            handlerB = logging.StreamHandler()
            handlerA.setLevel(logging.DEBUG)
            
            formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
            handlerA.setFormatter(formatter)
            handlerB.setFormatter(formatter)
            logger.addHandler(handlerA)
            logger.addHandler(handlerB)
        
        return logger

We used it like this:


import modules.taModule as ta
class demo():
    def __init__(self):
        self.logger = ta.taLogging().getLogger(__name__)

    def run():
        self.logger.warning("You have an error")

This would produce a warning in the Script Editor and also print it out to a file at “loggpath”.

____________________________________________________________________________________________________________

Remove Namespace

Written for Maya, written in python

Quick and dirty way to remove namespaces from a objects name.
(Note this doesn’t remove it from the scene, it can still be found in the Namespace Editor)


import pymel.core as pm
def rmvNsString():
    for node in pm.ls():
        try:
            nodeNameList = node.split(':')
            pm.rename(node, nodeNameList[-1])
        except:
            pass

____________________________________________________________________________________________________________

Simple Rename

Written for Maya, written in python

A simple tool I wrote to easy rename object in a scene. Option to show a annotation to more easy see what object you are renaming.

You can get it here.

____________________________________________________________________________________________________________

Color by Density

I made this tool for a school assignment, it colors a polygon object depending on its tri density. The color is customizable and there is also a option to show a annotation displaying an objects polycount.

The script can be downloaded here.

____________________________________________________________________________________________________________

Texture Setup

Written for Maya, written in python

TextureSetup The Texture Setup tool made it easy to hook up a new shader with all the different textures. You picked the location of you set, picked which set and picked a skybox if you want one then you click Create to make it.

____________________________________________________________________________________________________________

Basic Setup

Written for Maya, written in python

mayaBase The Maya Base, also called Basic setup, was a quick way to set up the name standard of an object that was going to be exported. Select the object, click enter and done.

____________________________________________________________________________________________________________

Reference Control

Written for Maya, written in python

referenceControll The Reference Control made it easier for the Level Designers to work with references. They could quickly, Duplicate, Delete, Replace, Unload and Reload a reference with a single click.