Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creates a game asset and supporting directories for 3DS Max
/*
Created by Corey Wolff
Creates an asset at a specified location and sets the units up, it also creates all the supporting directories for things like animation.
*/
DrvLibGame()
StudioLib()
unitList = #("CM", "Inches", "Meters")
_classList = #()
_classlist[1] = "Character"
_classlist[2] = "Environment"
_classlist[3] = "Prop"
_classlist[4] = "FX"
_classListAbv = #()
_classListAbv[1] = "CHR"
_classListAbv[2] = "ENV"
_classListAbv[3] = "PRP"
_classListAbv[4] = "FX"
fn GetPrjDir _prjPath = ( --gets all possible projects
_fullDirPaths = getdirectories (_prjPath + @"\*")
_prjNames = #()
for i = 1 to _fullDirPaths.count do (
_nameArray = filterstring _fullDirPaths[i] @"\"
_prjNames[i] = _nameArray[_nameArray.count]
)
return _prjNames
)
_thePrjList = getPrjDir prjDrv
Rollout _newShot "Create New Asset"(
dropdownList _prjInput "Project" items:_thePrjList
dropDownList _classInput "Class" items: _classList
editText _assetInput "Asset Name:" text:"Asset"
spinner _startFrame "Start Frame: " type: #integer range:[0,1000,0]
spinner _endFrame "End Frame: " type: #integer range:[1,1000,1]
dropdownlist _units "Units" items:unitList
Button _doTheThing "Create Shot"
on _doTheThing pressed do (
--get inputs
PRJ = _prjInput.selected
CLS = _classInput.selected
AST = _assetInput.text
--set units scale
if _units.selection == 1 do (units.systemType = #centimeters )
if _units.selection == 2 do (units.systemType = #inches )
if _units.selection == 3 do (units.systemType = #meters)
--set framerate and resolution
framerate = fps
renderWidth = res[1]
renderHeight = res[2]
--set Frame Range
animationrange = interval _startFrame.value _endFrame.value
--Pathing bits
theFilePath = #()
if(_classInput.selection == 1 or _classInput.selection == 2 or _classInput.selection == 3) then (
theFileName = PRJ + "_" + CLS + "_" + AST + "_GEO"+ "_v001_t001.max"
theFilePath[1] = prjDrv +@"\" + prj + @"\" +@"Meshes\" + CLS + @"\" + AST + @"\Model\"
theFilePath[2] = prjDrv +@"\" + prj + @"\" +@"Meshes\" + CLS + @"\" + AST + @"\Rig\"
theFilePath[3] = prjDrv +@"\" + prj + @"\" +@"Meshes\" + CLS + @"\" + AST + @"\Textures\"
theFilePath[4] = prjDrv +@"\" + prj + @"\" +@"Meshes\" + CLS + @"\" + AST + @"\Animation\"
)
if(_classInput.selection == 4) then (
theFileName = PRJ + "_" + CLS + "_" + AST + "_FX"+ "_v001_t001.max"
theFilePath[1] = prjDrv +@"\" + prj + @"\" + CLS + @"\" + AST + @"\FX\"
theFilePath[2] = prjDrv +@"\" + prj + @"\" + CLS + @"\" + AST + @"\Textures\"
theFilePath[3] = prjDrv +@"\" + prj + @"\" + CLS + @"\" + AST + @"\Cache\"
)
for i = 1 to theFilePath.Count do (
makeDir theFilePath[i]
)
saveMaxFile (theFilePath[1] + theFileName)
)
)
createdialog _newShot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.