PDA

View Full Version : My FBX batch import script crashes until i change random line in code


doCHtor
04-14-2008, 11:50 AM
Hi,
I have written a script for batch importing fbx files and then saving max files and bip files.
Only problem I have is that when i run the script in freshly started max, it will crash until i reinstall it. Running it twice doesn't help. Only reinstalling helps.

Script is crashing on a function where i'm configuring fbx importer with error: >> MAXScript Rollout Handler Exception: -- Type error: Call needs function or class, got: undefined <<

and this is the line where the scripts ends: FbxImporterSetParam "Mode" "exmerge"


This is the script:

try(destroyDialog ImporterIzer)catch()
rollout ImporterIzer "ImporterIzer™" width:300 height:255
(
local ImportOn
local ImportPath
local ExportPath
local ImportFiles
local filename
--UI DEFINITION
Group "Files:"
(
Label LabImportOn "Import on:" across:3 align:#left
.
.
)
Group "Options:"
(
Label LabExportToExportSubfolder "Export files to Export sub-folder in Import folder:" across:2 align:#left
.
.
)
Group "Progress:"
(
ProgressBar ProgImportProgress "ProgressBar" color:[255,135,7]
)

fn ImportFbxSettings =
(
pluginManager.loadClass FBXIMP
FbxImporterSetParam "Mode" "exmerge" -- Import options
FbxImporterSetParam "Geometries" false -- whether to import geometries
FbxImporterSetParam "Skin" false -- whether to import scene's skin
.
.
.
)

on ButDoTheMagic pressed do
(
if ImportOn != undefined then
if (getFiles ImportOn).count != 0 then
if ImportPath != undefined then
if (getDirectories ImportPath).count != 0 then
if CheckExportToExportSubfolder.tristate != 2 or CheckExportToExportSubfolder.tristate == 2 and (getDirectories ExportPath).count != 0 then
(
ImportFiles = getFiles (ImportPath + "\\*.fbx" )
if ImportFiles.count > 0 then
(
for I=1 to ImportFiles.count do
(
loadMaxFile ImportOn useFileUnits:true quiet:true

ImportFbxSettings()
filename = getFilenameFile ImportFiles[i]

if CheckExportToExportSubfolder.tristate == 1 then
(
MakeDir (ImportPath + "\\Export")
ExportPath = (ImportPath + "\\Export")
)
else if CheckExportToExportSubfolder.tristate == 0 then
ExportPath = ImportPath

importFile ImportFiles[I] #noPrompt using:importerPlugin.classes[5]

if CheckSaveBip.tristate == 1 then SaveBip()
if CheckResetPinePos.tristate == 1 then ResetPinePos()

saveMaxFile (ExportPath + "\\" + filename + ".max")

ProgImportProgress.value = 100.0*I/ImportFiles.count
)
Messagebox "Hey boss, the job is done!" title:"Terrible success!"
)
else messagebox "There are NO files to import in the specified Import folder" title:"Horrible error!"
)
else messagebox "Export path no longer exists" title:"Horrible error!"
else messagebox "Import path no longer exists" title:"Horrible error!"
else messagebox "Import folder was not specified" title:"Horrible error!"
else messagebox "Import on file no longer exists" title:"Horrible error!"
else messagebox "Import on file was not specified" title:"Horrible error!"
)
)

createdialog ImporterIzer


I have left out the parts of the code with "on button pressed do", if needed, I can post the whole script.

Any ideas what I'm doing wrong? Some bad declaration?

Also, FbxImporterSetParam "YUpZUp" <bool> doesn't seem to work.

Thanks.

shibumenon
04-14-2008, 01:09 PM
I did face similar problems when using fbx, both import and export options.
It seems like you have the older version of the fbx plugin (FBX200611_1), which I found to be having trouble if initialized thro maxscript. It never used to set the flags like the ones you mentioned.

I think the new version of the fbx plugin (FBX200611_2) has these issues fixed, though I haven't tested them fully ..
Install the newer version of the fbx plugin appropriate for your max version, and things should be fine .. You can download it from the autodesk site here:
http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=10776012

cheers

doCHtor
04-14-2008, 04:57 PM
Hi, thanks for the help.

In work i already tried the updated plugin (without knowing that it really should fix the problem), but it didn't work (32b max 9). Now at home I have read your post so i tried it again, this time on 64b max 2008 and it seems to work. Tomorrow when I get to work i will try to reinstall the updated plugin, maybe something went wrong there.

Thanks

EDIT:
Too bad, seems that what I thought did work was only one of those cases when it worked because of specific constellation of stars :D ... so, unfortunately, it still doesn't work, even with the updated plugin. I think I'm doing something wrong in my script :sad:

Zbuffer
04-16-2008, 12:15 PM
Hi, Seams to work fine here (Max2008)

maybe posting the complete script could help...

for
FbxImporterSetParam "YUpZUp" <bool>

try using:

FbxImporterSetParam "AxisConversion" true
FbxImporterSetParam "UpAxis" "Z"

doCHtor
04-16-2008, 04:55 PM
Hi,

FbxImporterSetParam "YUpZUp" <bool> = FbxImporterSetParam "UpAxis" "Z"

I would never guessed that :( , will try this, but still I have that exception error.. I will post the script later.

Thanks

CGTalk Moderation
04-16-2008, 04:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.