I'm having a problem with an old maxscript here at work that someone wrote a while ago and he's no longer here.
The purpose of the maxscript file is to upload new textures on a model and then save them out as a seperate max file which will then be put in the render farm.
However we're getting an error when we try to run it "group() requires a node or node collection, got:undefined
Because nobody here at work is too familiar with maxscript i was hoping someone could take a look and offer some suggestions.
I'll paste the maxscript code but because this is official work I'd rather not post the max file
Here's the maxscript:
utility mergeFiles "Merge Files" width:162 height:69
struct csvEntry ( mergePath, mergeFile, offsetX, offsetY, offsetZ, basePath, baseFile, matList, matLib, outputFile, renderSettings )
button btnGo "Go" pos:[20,15] width:74 height:47
fn openTheFiles path infoList = (
initialFile = path + infoList.basePath + infoList.baseFile
mergeFile = path + infoList.mergePath + infoList.mergeFile
max select all
group $ name:"__Base"
print ("Merge File: " + mergeFile)
base = getNodeByName "__Base"
max select all
group $ name:"__Sink"
sink = getNodeByName "__Sink"
offsets = [infoList.offsetX as float, infoList.offsetY as float, infoList.offsetZ as float]
move sink offsets
-- Looks through the materials section of the csv and changes the objects materials.
fn processMaterials info = (
-- matList, matLib
-- Load the material library.
if doesFileExist(info.matLib) then (
) else (
print (info.matLib + " not found")
if info.matList != "" and info.matList != undefined then (
matsToApply = filterString info.matList "="
theObject = getNodeByName matsToApply
if theObject != undefined then (
theMat = currentMaterialLibrary[matsToApply]
if theMat != undefined then (
-- Apply the material
theObject.material = theMat
-- Assigns the render settings from the csv file
fn processRenderSettings info = (
items = filterString info.renderSettings ";"
for i = 1 to items.count do (
nameAndValue = filterString items[i] "="
case nameAndValue of (
renderWidth = (nameAndValue as integer)
renderHeight = (nameAndValue as integer)
rendOutputFilename = nameAndValue
fn createFiles infoList fullPath = (
path = getFilenamePath fullPath
for i = 1 to infoList.count do (
openTheFiles path infoList[i]
saveMaxFile (path + infoList[i].outputFile)
-- Reads in the CSV and stores the information in an array of arrays
fn processCSV fullPath overwrite = (
infoList = #()
local curLine = 0
csvFile = openFile fullPath mode:"rt"
while not eof csvFile do (
curLine = curLine + 1
line = readLine csvFile
parts = filterString line ","
if parts.count >= 11 then (
tmp = csvEntry mergePath:parts mergeFile:parts offsetX:parts offsetY:parts offsetZ:parts basePath:parts baseFile:parts matList:parts matLib:parts outputFile:parts renderSettings:parts
append infoList tmp
) else (
print "Error on line: " + (curLine as string)
on btnGo pressed do (
source = "mergeList.csv" -- "C:\projects\Kohler\sinkmerge\mergelist.csv"
fullPath = getOpenFileName caption:"Open CSV File" filename:source types:"Comma Separated (*.csv)|*.csv|All Files (*.*)|*.*|"
if fullPath != undefined then (
if doesFileExist (fullPath) == true then (
infoList = processCSV fullPath overwrite
createFiles infoList fullPath
) else (
print "The user cancelled."
Anyway...if anyone could help I'd be ever so gratfull as this maxscript could save a lot of time