A check up script you might find useful

If you’re working with different people, it’s always important to make sure that everyone follows the same guidelines. There has been many a time where I’ve worked with interns or other people who use wildly different settings than I do in Maya. By the time a model was ready for export, it sometimes wasn’t usable at all in Unity. And it wasn’t because that person did something wrong. It just happened because settings between artists weren’t the same. And that caused a lot of headaches further down the line.

One of my amazing friends bought me Character Modeling 3 a couple of years ago for my birthday. Other than amazing art, there were a couple of screenshots of a script that was being used at Guerilla Games. It basically was a checklist inside of Maya that made sure every artist was on the same page. I thought it was a brilliant idea, because it kept everything right inside of Maya. Which meant that people didn’t have to search for printed out checklists. And it offered the opportunity to put in some handy one-click-and-done tools to make the life of the artist easier. So using the screenshots from Guerilla Games as a guide, I decided to make my own checklist script.

You can download it here

The UI for this script was made in QtDesigner and is loaded separately.

You need to change this line to reflect the location of .ui file on your computer

#Change this path to the location of the checkupScriptUI.ui file on your computer
uiFilePath = "D:/Maya Scripts/scripts/guerillaScript/checkupScriptUI.ui"

Put the script in your scripts folder:

Windows 7 and 8: \Users\{username}\Documents\maya\scripts
Mac OS X: ~{username}/Library/Preferences/Autodesk/maya/scripts
Linux: ~{username}/maya/scripts

You can save the following Python code to a shelve:

import checkupScript
checkupScript.CreateUI()

Screenshot_1

First things first: Please, for the love of whatever god you pray to, set up a project in Maya. It’s one of the most important things you should do when you’re working in a team. And even if you’re just working on your own it’s good practice. Setting up a project means that everything you do is contained to the exact same folder structure every time. This means that when you’re working on something and I have to come in after you and continue working on it, I can just open up your project and everything you’ve made it available to me. This means scenes, materials, textures, FBX files, renders, playblasts, referenced scenes… are all where they’re supposed to be. Maya can find them, someone else can find them, all is good.

Screenshot_2
The reason innocent little kittens die is because you’re hardlinking your texture files…

The first buttons in the script are for setting up a project, please do 🙂

The “Open file…” button tries to load the checklist file that might be saved with this scenes. You can use “File > Open…” but you’d have to manually load the checklist. There’s a button for that in the “Model Checklist” tab. The rest here is pretty self explanatory I think.

Scene Tools is a collection of things that might come in handy when you’re working your way down the checklist. That way you don’t necessarily have to dig your way through Maya’s UI to do simple stuff like deleting history or freezing transforms. And because you’re a Maya superstar already, you probably have this set up on 4 different shelves already 🙂

Screenshot_3

“Delete History” and “Freeze Transforms” are two buttons I always use right after each other. Keeping your history clean and your transforms frozen makes for happy exporting. “Pivot At Selected Vertex” does exactly what you think it does: select a vertex, click the button and the pivot point will be snapped to that location. “Check Naming” checks every object in your scene against a hardcoded list of “bad names”, or names you should avoid. These are standard names that Maya creates. Chances are that “pSphere” can probably be renamed to something a little more meaningful. In the beginning of the Python file you can find the list of these bad names, feel free to add more strings to the list as you see fit.


#if you want to add more "bad names" to check for, just add them to the list below
badNames = ["pSphere", "polySurface", "pCylinder", "pPlane", "pTorus", "pPyramid", "pPipe", "pCube", "pasted"]

Screenshot_4
A name like this is generally not something you want to find back in the game engine.

Screenshot_5

“Toggle Backface Culling” works on whatever viewport you have active, this isn’t a global setting. “Conform Normals” is on of those extremely handy Maya tools (it’s the same as under “Polygons > Normals > Conform Normals”) that makes all normals face the same direction as most normals are facing. I usually run this tool when I’m done modeling just to be sure that I don’t have any normals facing the wrong way.

Screenshot_6

The next couple of buttons are extremely helpful. As a general rule of thumb, I always advise to model in the correct dimensions. That means that if you’re modeling a dumpster that’s 160cm high and 200cm wide, make the actual model in Maya the same dimensions. I know that as long as it’s proportionally correct it’s technically not that big of a deal, but it actually really is. Your tiny or gigantic object will be imported incorrectly in the game engine. And while the level artist can scale it up or down if needed, life is just so much easier if no one has to worry about that. Also, if your game engine automatically sets up weight for physics calculations based on object dimensions, it just makes sense to have everything the size it needs to be. If you click any of the “Show xm Object” it will always put a cube that exact size in your scene. Sorry Americans, but since Maya’s default units are centimeters I didn’t provide buttons you can use on your continent 🙂 Use the “Clear Scale Reference Objects” button to get rid of the reference objects and the layer they’re assigned to.

Screenshot_7
Tiny dumpster is tiny…

All the way at the bottom on the second tab you can set your units.

The third tab is the actual checklist where you can set what is done, isn’t done or still needs to be done.

Screenshot_9
This is what the checklist file might look like when an artist is completely done with a model.

On this tab you can mark your progress and leave extra comments or questions for anyone else opening this file. Let’s say you’re working on something and for whatever reason I need to come in after you and finish it. Maybe you didn’t have time to lay out the UVs or finish the textures. This way I can easily see how far along you are and what I need to do next. It’s also just a handy reminder of everything you need to take a look at. Lord knows I used to forget at least 43% of that list, now I no longer have to.

Feel free to add, change, copy, whatever with this script. Use it just the way you like. A shoutout to me is always appreciated though 🙂

This is the complete source code, sans UI file.


##############################################
#
#
# modelChecker.py
# This script provides you with some handy tools and a checklist you can use to make sure 
# your model is ready to export to your game engine.
#
# nielsvaes@gmail.com
#
#
##############################################



#PySide
from PySide.QtCore import * 
from PySide.QtGui import *
from PySide import QtGui as QTGui
from PySide.QtUiTools import *
from shiboken import wrapInstance

#Helpers
from stringBuilder import *

#Python std lib
import os
import getpass #used to find who's logged in on this machine

#Maya
import maya.cmds as cmds
import maya.mel as mel
import pymel.core as pm
from maya import OpenMayaUI as omui

ui = None

#Change this path to the location of the checkupScriptUI.ui file on your computer
#uiFilePath = "D:/Dropbox (LuGus Studios)/LuGus/LuGus Niels/Maya Scripts/scripts/guerillaScript/checkupScriptUI.ui"
uiFilePath = "D:/Maya Scripts/scripts/guerillaScript/checkupScriptUI.ui"


#if you want to add more "bad names" to check for, just add them to the list below
badNames = ["pSphere", "polySurface", "pCylinder", "pPlane", "pTorus", "pPyramid", "pPipe", "pCube", "pasted"]

def CreateUI():
	global ui
	global uiFilePath

	mayaMainWindowPtr = omui.MQtUtil.mainWindow()
	mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget)



	loader = QUiLoader()
	file = QFile(uiFilePath)
	file.open(QFile.ReadOnly)

	ui = loader.load(file, parentWidget = mayaMainWindow)
	file.close()

	#++++++++++++++++ region General File Tools buttons	

	ui.btnCreateNewProject.clicked.connect(CreateNewProject)
	ui.btnSetProject.clicked.connect(SetProject)

	ui.btnOpenFile.clicked.connect(OpenFile)
	ui.btnReferenceFile.clicked.connect(ReferenceFile)
	ui.btnSaveFile.clicked.connect(SaveFile)
	ui.btnSaveFileAs.clicked.connect(SaveFileAs)

	ui.btnExportSelection.clicked.connect(ExportSelection)

	ui.btnCloseFile.clicked.connect(CloseFile)

	#++++++++++++++++ endregion

	#++++++++++++++++ region General Scene Tools buttons

	ui.btnDeleteHistory.clicked.connect(DeleteHistory)
	ui.btnFreezeTransforms.clicked.connect(FreezeTransforms)
	ui.btnCenterPivot.clicked.connect(CenterPivot)
	ui.btnPivotAtSelectedVertex.clicked.connect(PivotAtSelectedVertex)
	ui.btnCheckNaming.clicked.connect(CheckNaming)
	
	ui.btnRotate90DegreesInX.clicked.connect(Rotate90DegreesInX)
	ui.btnRotate90DegreesInY.clicked.connect(Rotate90DegreesInY)
	ui.btnRotate90DegreesInZ.clicked.connect(Rotate90DegreesInZ)

	ui.btnScaleUp10.clicked.connect(ScaleUp10)
	ui.btnScaleUp100.clicked.connect(ScaleUp100)
	ui.btnScaleDown10.clicked.connect(ScaleDown10)
	ui.btnScaleDown100.clicked.connect(ScaleDown100)

	ui.btnBackfaceCulling.clicked.connect(ToggleBackfaceCulling)
	ui.btnConformNormals.clicked.connect(ConformNormals)

	ui.btnShow1mObject.clicked.connect(Show1mObject)
	ui.btnShow2mObject.clicked.connect(Show2mObject)
	ui.btnShow10mObject.clicked.connect(Show10mObject)
	ui.btnShow100mObject.clicked.connect(Show100mObject)
	ui.btnClearScaleReferenceObjects.clicked.connect(ClearScaleReferenceObjects)

	ui.radMillimeters.clicked.connect(SetUnitsToMillimeters)
	ui.radCentimeters.clicked.connect(SetUnitsToCentimeters)
	ui.radMeters.clicked.connect(SetUnitsToMeters)
	ui.radInches.clicked.connect(SetUnitsToInches)
	ui.radFeet.clicked.connect(SetUnitsToFeet)
	ui.radYards.clicked.connect(SetUnitsToYards)

	ui.radRadians.clicked.connect(SetUnitsToRadiands)
	ui.radDegrees.clicked.connect(SetUnitsToDegrees)

	ui.rad24fps.clicked.connect(SetUnitsTo24fps)
	ui.rad25fps.clicked.connect(SetUnitsTo25fps)
	ui.rad30fps.clicked.connect(SetUnitsTo30fps)
	ui.rad60fps.clicked.connect(SetUnitsTo60fps)

	ui.radYaxis.clicked.connect(SetWorldUpYaxis)
	ui.radZaxis.clicked.connect(SetWorldUpZaxis)

	#++++++++++++++++ endregion

	#++++++++++++++++ region Model Checklist

	ui.btnClearChecklist.clicked.connect(ClearChecklist)
	ui.btnReloadChecklist.clicked.connect(ReadChecklist)
	ui.btnGetUserName.clicked.connect(GetUserName)
	ui.btnGetTriangleCountOfSelectedObjects.clicked.connect(GetTriangleCountOfSelectedObjects)
	ui.btnSaveChecklist.clicked.connect(SaveChecklist)
	ui.btnDeleteChecklist.clicked.connect(DeleteChecklist)

	#++++++++++++++++ endregion

	ui.btnTest.clicked.connect(TEST)


	SetRadioButtons()

	ui.setWindowFlags(Qt.Window)
	ui.show()

def TEST():
	global ui

	CreateReferenceCubeLayer()

def Show1mObject():
	#
	CreateReferenceCube(1)

def Show2mObject():
	#
	CreateReferenceCube(2)

def Show10mObject():
	#
	CreateReferenceCube(10)

def Show100mObject():
	#
	CreateReferenceCube(100)

def ClearScaleReferenceObjects():
	sceneObjects = cmds.ls(type = "transform")

	for sceneObject in sceneObjects:
		if sceneObject.startswith("scale_reference_object_"):
			cmds.delete(sceneObject)

	layers = cmds.ls(type = "displayLayer")

	for layer in layers:
		if layer == "scale_reference_object_layer":
			cmds.delete(layer)

def SetProject():
	#fileMode 3 means it's only showing folders
	# projectPath = cmds.fileDialog2(fileMode = 3, fileFilter = None, ds = 2)[0]

	# if projectPath:
	# 	cmds.workspace(projectPath) #, openWorkspace = True)


	mel.eval('setProject ""')

def CreateNewProject():
	#
	mel.eval('ProjectWindow;')

def SaveChecklist():
	stringBuilder = StringBuilder("")

	checkboxes = ui.tabWidget.findChildren(QTGui.QCheckBox)
	for checkbox in checkboxes:
		stringBuilder.AppendLine(str(checkbox.objectName()) + "=" + str(checkbox.isChecked()))

	lineEdits = ui.tabWidget.findChildren(QTGui.QLineEdit)
	for lineEdit in lineEdits:
		stringBuilder.AppendLine(str(lineEdit.objectName()) + "=" + str(lineEdit.text()))

	plainTextEdits = ui.tabWidget.findChildren(QTGui.QPlainTextEdit)
	for plainTextEdit in plainTextEdits:
		stringBuilder.AppendLine(str(plainTextEdit.objectName()) + "=" + str(plainTextEdit.toPlainText()))

	checklistFile = open(GetChecklistFile(), 'w')
	checklistFile.write(stringBuilder.text)
	checklistFile.close()

	stringBuilder.Flush()

	cmds.confirmDialog(title = "Checklist saved", message = "Checklist saved to the root of the current project.", icon = "information", button = ["Groovy!"])	

def DeleteChecklist():
	if os.path.exists(GetChecklistFile()):
		ClearChecklist()
		os.remove(GetChecklistFile())

def ReadChecklist():
	#first check if a checklist file exists
	#if not, time to get the hell out of this function
	if not os.path.exists(GetChecklistFile()):
		return

	#open the file for reading
	checklistFile = open(GetChecklistFile(), 'r')
	lines = checklistFile.readlines()

	#get a list of all checkboxes, lineedits and plaintextedits
	checkboxes = ui.tabWidget.findChildren(QTGui.QCheckBox)
	lineEdits = ui.tabWidget.findChildren(QTGui.QLineEdit)
	plainTextEdits = ui.tabWidget.findChildren(QTGui.QPlainTextEdit)

	for line in lines:
		#strip away any crap on the lines
		line = line.strip()

		#if the line doesn't contain "=", we're not really interested in it
		#so we're moving on to the next line
		if not "=" in line:
			continue

		lineParts = line.split('=')

		widgetName = lineParts[0].strip()
		value = lineParts[1].strip()

		for checkbox in checkboxes:
			if checkbox.objectName() == widgetName:
				checkbox.setChecked(StringToBoolean(value))

		for lineEdit in lineEdits:
			if lineEdit.objectName() == widgetName:
				lineEdit.setText(value)

		for plainTextEdit in plainTextEdits:
			if plainTextEdit.objectName() == widgetName:
				plainTextEdit.setPlainText(value)

def GetUserName():
	global ui

	userName = getpass.getuser()
	ui.txtCheckedBy.setText(userName)

def GetTriangleCountOfSelectedObjects():
	global ui

	triangleCount = "No objects selected"

	#if no object is selected, this will fail and the string above will
	#be placed in the textbox
	try:
		triangleCount = cmds.polyEvaluate(GetSelectedObjects(), triangle = True)
		ui.txtTriangleCount.setText(str(triangleCount))
	except:
		ui.txtTriangleCount.setText(str(triangleCount))

def SetWorldUpYaxis():
	#
	cmds.upAxis(axis = "y", rotateView = True)

def SetWorldUpZaxis():
	#
	cmds.upAxis(axis = "z", rotateView = True)	

def DeleteHistory():
	#
	cmds.delete(constructionHistory = True)

def FreezeTransforms():
	#
	cmds.makeIdentity(apply = True, translate = True, rotate = True, scale = True, preserveNormals = True)
	
def CenterPivot():
	#
	cmds.xform(centerPivots = True)
	
def PivotAtSelectedVertex():
	print "selected vertex"
	selectedVertex = cmds.ls(selection = True)
	selectedVertexPositionList = cmds.pointPosition(selectedVertex)
	selectedShape = cmds.ls(objectsOnly = True, selection = True)
	selectedObject = cmds.listRelatives(selectedShape, parent = True)
	
	cmds.xform(selectedObject, pivots = (selectedVertexPositionList[0], selectedVertexPositionList[1], selectedVertexPositionList[2]), worldSpace = True)
	cmds.select(selectedObject)

def CheckNaming():
	allObjects = cmds.ls(transforms = True)
	global badNames
	

	#if you want to add more "bad names" to check for, just add them to the list below
	#badNames = ["pSphere", "polySurface", "pCylinder", "pPlane", "pTorus", "pPyramid", "pPipe", "pCube", "pasted"]

	for selectedObject in allObjects:
		for badName in badNames:
			#make everything lowercase for the check, just to be sure
			if badName.lower() in selectedObject.lower():
				cmds.select(selectedObject)
				cmds.confirmDialog(title = "Check naming", message = selectedObject + " should be changed to something more meaningful.", button = ["Yup"], icon = "warning")
				return
		if "scale_reference_object_" in selectedObject:
				cmds.confirmDialog(title = "Check naming", message = selectedObject + " is probably an object that's just here for scale referene.\nYou can probably delete this from the scene.", button = ["You're right"], icon = "warning")
				cmds.select(selectedObject)
				return			

	cmds.confirmDialog(title = "Check naming", message = "There are no standard name in the scene, great!", button = ["Groovy"], icon = "information")

def Rotate90DegreesInX():
	selectedObject = GetSelectedObject()
	rotXvalue = cmds.getAttr(selectedObject + "." + "rotateX")
	rotXvalue += 90
	
	cmds.rotate(rotXvalue, 0, 0)

def Rotate90DegreesInY():
	selectedObject = GetSelectedObject()
	rotYvalue = cmds.getAttr(selectedObject + "." + "rotateY")
	rotYvalue += 90
	
	cmds.rotate(0, rotYvalue, 0)
	
def Rotate90DegreesInZ():
	selectedObject = GetSelectedObject()
	rotZvalue = cmds.getAttr(selectedObject + "." + "rotateZ")
	rotZvalue += 90
	
	cmds.rotate(0, 0, rotZvalue)
	
def ScaleUp10():
	selectedObject = GetSelectedObject()
	scaleXvalue = cmds.getAttr(selectedObject + "." + "scaleX")
	scaleYvalue = cmds.getAttr(selectedObject + "." + "scaleY")
	scaleZvalue = cmds.getAttr(selectedObject + "." + "scaleZ")

	scaleXvalue *= 10
	scaleYvalue *= 10
	scaleZvalue *= 10
	
	cmds.scale(scaleXvalue, scaleYvalue, scaleZvalue)
	
def ScaleUp100():
	selectedObject = GetSelectedObject()
	scaleXvalue = cmds.getAttr(selectedObject + "." + "scaleX")
	scaleYvalue = cmds.getAttr(selectedObject + "." + "scaleY")
	scaleZvalue = cmds.getAttr(selectedObject + "." + "scaleZ")

	scaleXvalue *= 100
	scaleYvalue *= 100
	scaleZvalue *= 100
	
	cmds.scale(scaleXvalue, scaleYvalue, scaleZvalue)
	
def ScaleDown10():
	selectedObject = GetSelectedObject()
	scaleXvalue = cmds.getAttr(selectedObject + "." + "scaleX")
	scaleYvalue = cmds.getAttr(selectedObject + "." + "scaleY")
	scaleZvalue = cmds.getAttr(selectedObject + "." + "scaleZ")

	scaleXvalue /= 10
	scaleYvalue /= 10
	scaleZvalue /= 10
	
	cmds.scale(scaleXvalue, scaleYvalue, scaleZvalue)
	
def ScaleDown100():
	selectedObject = GetSelectedObject()
	scaleXvalue = cmds.getAttr(selectedObject + "." + "scaleX")
	scaleYvalue = cmds.getAttr(selectedObject + "." + "scaleY")
	scaleZvalue = cmds.getAttr(selectedObject + "." + "scaleZ")

	scaleXvalue /= 100
	scaleYvalue /= 100
	scaleZvalue /= 100
	
	cmds.scale(scaleXvalue, scaleYvalue, scaleZvalue)
	
def ToggleBackfaceCulling():
	#this is a built in command, which is not documented as far as I could see
	cmds.ToggleBackfaceCulling()

def ConformNormals():
	#
	mel.eval('ConformPolygonNormals;')

def OpenFile():
	#dialogStyle2 -> the window will be a consistent style in Windows, MacOS and Linux
	#fileMode = 3 -> only show folder, not files
	#[0] -> index 0 of the selected folders
	# fileLocationPath = cmds.fileDialog2(fileMode = 1, fileFilter = None, dialogStyle = 2)[0]

	# if fileLocationPath: #if the string is not empty
	# 	cmds.file(fileLocationPath, open = True)
	cmds.OpenScene()

	#if the checklist file exists, open it for reading. 
	if os.path.exists(GetChecklistFile()):
		print "file is not none"
		checklistFile = open(GetChecklistFile(), 'r')
		ReadChecklist()
		checklistFile.close()
	else:
		cmds.confirmDialog(title = "Can't find checklist", message = "Can't find a checklist for this scene. Make sure you're working in the correct project or save the (empty) checklist.", button = ["Got it, dude"], icon = "warning")

def CloseFile():
	#
	ClearChecklist()
	cmds.file(newFile = True, force = True)

def SaveFile():
	#
	cmds.SaveScene()

def SaveFileAs():
	#
	mel.eval('SaveSceneAs;')

def ExportSelection():
	#
	mel.eval('ExportSelectionOptions;')

def ReferenceFile():
	#dialogStyle2 -> the window will be a consistent style in Windows, MacOS and Linux
	#fileMode = 1 -> only all files
	#[0] -> index 0 of the selected folders
	fileLocationPath = cmds.fileDialog2(fileMode = 1, fileFilter = None, dialogStyle = 2)[0]

	if fileLocationPath: #if the string is not empty
		cmds.file(fileLocationPath, reference = True, defaultNamespace = True, mergeNamespacesOnClash = True)

def SetRadioButtons():
	global ui

	upAxis = cmds.upAxis(query = True, axis = True)
	if upAxis == "y":
		ui.radYaxis.setChecked(True)
	else:
		ui.radZaxis.setChecked(True)

	linear = cmds.currentUnit(query = True, linear = True)
	print linear
	if linear == "mm":
		ui.radMillimeters.setChecked(True)
	elif linear == "cm":
		ui.radCentimeters.setChecked(True)
	elif linear == "m":
		ui.radMeters.setChecked(True)
	elif linear == "inch":
		ui.radInches.setChecked(True)
	elif linear == "foot":
		ui.radFeet.setChecked(True)
	elif linear == "yard":
		ui.radYards.setChecked(True)

	angle = cmds.currentUnit(query = True, angle = True)
	print angle
	if angle == "deg":
		ui.radDegrees.setChecked(True)
	elif angle == "rad":
		ui.radRadians.setChecked(True)

	time = cmds.currentUnit(query = True, time = True)
	print time
	if time == "film":
		ui.rad24fps.setChecked(True)
	elif time == "pal":
		ui.rad25fps.setChecked(True)
	elif time == "ntsc":
		ui.rad30fps.setChecked(True)
	elif time == "ntscf":
		ui.rad60fps.setChecked(True)

def GetSelectedObject():
	if len(cmds.ls(selection = True)) > 0:
		return cmds.ls(selection = True)[0]
	else:
		return "No objects selected"

def GetSelectedObjects():
	#
	return cmds.ls(selection = True)

def GetChecklistFile():
	#Find the checklist file that goes with this scene
	#
	#Get the path to the project
	projectPath = cmds.workspace(query = True, rootDirectory = True)
	#Get the scene name, without the path to it
	sceneName = cmds.file(query = True, sceneName = True, shortName = True)
	#concatenate to the get the path to checklist file
	fileToOpen = projectPath + sceneName + "_checklist.txt"

	return fileToOpen

	# if os.path.exists(fileToOpen):
	# 	return fileToOpen
	# else:
	# 	cmds.confirmDialog(title = "Can't find checklist", message = "Can't find a checklist for this scene. Make sure you're working in the correct project or save the (empty) checklist.", button = ["Got it, dude"], icon = "warning")
	# 	return None		

def ClearChecklist():
	checkboxes = ui.tabWidget.findChildren(QTGui.QCheckBox)
	lineEdits = ui.tabWidget.findChildren(QTGui.QLineEdit)
	plainTextEdits = ui.tabWidget.findChildren(QTGui.QPlainTextEdit)

	for checkbox in checkboxes:
		checkbox.setChecked(False)

	for lineEdit in lineEdits:
		lineEdit.setText("")

	for plainTextEdit in plainTextEdits:
		plainTextEdit.setPlainText("")

def CreateReferenceCube(size):
	#first create the layer
	CreateReferenceCubeLayer()

	#temporarily setting the linear working units to cm so we can easily build the required cube
	currentWorkingUnits = cmds.currentUnit(query = True, linear = True)
	cmds.currentUnit(linear = "m")

	cmds.polyCube(height = size, name = "scale_reference_object_" + str(size) + "_m")

	#set the current working units back to what we had before
	cmds.currentUnit(linear = currentWorkingUnits)

	#add the object to the layer
	cmds.editDisplayLayerMembers("scale_reference_object_layer", "scale_reference_object_" + str(size) + "_m")

def CreateReferenceCubeLayer():
	scaleReferenceLayerExists = False
	layers = cmds.ls(type = "displayLayer")


	#loop through all existing layers to see if the layer already exists
	for layer in layers:
		if layer == "scale_reference_object_layer":
			scaleReferenceLayerExists = True

	if not scaleReferenceLayerExists:
		cmds.createDisplayLayer(name = "scale_reference_object_layer")
		cmds.editDisplayLayerGlobals(currentDisplayLayer = "scale_reference_object_layer")

def StringToBoolean(value):
	value = value.strip()

	if value == 'True':
		return True
	elif value == 'False':
		return False
	else:
		return False

def SetUnitsToMillimeters():
	#
	cmds.currentUnit(linear = "mm")
def SetUnitsToCentimeters():
	#
	cmds.currentUnit(linear = "cm")
def SetUnitsToMeters():
	#
	cmds.currentUnit(linear = "m")
def SetUnitsToInches():
	#
	cmds.currentUnit(linear = "in")
def SetUnitsToFeet():
	#
	cmds.currentUnit(linear = "ft")
def SetUnitsToYards():
	#
	cmds.currentUnit(linear = "yd")
def SetUnitsToRadiands():
	#
	cmds.currentUnit(angle = "rad")
def SetUnitsToDegrees():
	#
	cmds.currentUnit(angle = "deg")
def SetUnitsTo24fps():
	#
	cmds.currentUnit(time = "film")
def SetUnitsTo25fps():
	#
	cmds.currentUnit(time = "pal")
def SetUnitsTo30fps():
	#
	cmds.currentUnit(time = "ntsc")
def SetUnitsTo60fps():
	#
	cmds.currentUnit(time = "ntscf")


#CreateUI()