12-05-2017, 07:06 PM
I've been searching quite a bit for a way to import Megadimension Neptunia VII's models into Blender, other than the ones posted here. The moderator Random Talking Bush has a 3DS Max import script for the game's *.ism2 model format. Seeing as I don't use 3DS Max, but rather Blender, and having a background in Python scripting, I decided to research Blender's scripting API and try and rewrite his import script for it.
MaxScript's syntax seems fairly straightforward. Most of the time, I need only look up what a function does in Autodesk's API reference for it if I don't understand the use of some function call. However, there is something that doesn't make sense to me at all, something that should result in a script error for referencing an out of scope variable I'd think, but maybe MaxScript is obtuse with what I've come to expect with coding languages and scoping rules.
There is a variable called 'SectionType' that is repeatedly referenced throughout the script code, but from what I see, the variable is defined in a for-loop, with no definitions elsewhere for a variable with that name. I'm not sure if the script code works, but I'd normally assume MaxScript would get confused outside of that for-loop, not knowing otherwise what 'SectionType' is. If this script is indeed functional, then I would have no idea what value 'SectionType' has outside of the for-loop scope. My best guess is the value of the last loop?
Here's a little snippet to illustrate:
MaxScript's syntax seems fairly straightforward. Most of the time, I need only look up what a function does in Autodesk's API reference for it if I don't understand the use of some function call. However, there is something that doesn't make sense to me at all, something that should result in a script error for referencing an out of scope variable I'd think, but maybe MaxScript is obtuse with what I've come to expect with coding languages and scoping rules.
There is a variable called 'SectionType' that is repeatedly referenced throughout the script code, but from what I see, the variable is defined in a for-loop, with no definitions elsewhere for a variable with that name. I'm not sure if the script code works, but I'd normally assume MaxScript would get confused outside of that for-loop, not knowing otherwise what 'SectionType' is. If this script is indeed functional, then I would have no idea what value 'SectionType' has outside of the for-loop scope. My best guess is the value of the last loop?
Here's a little snippet to illustrate:
Code:
-- line 156
for b = 1 to SectionCount do(
SectionType = readlong f #unsigned
printDebug("SectionType: " + SectionType as string)
SectionOffset = readlong f #unsigned -- defined here, no other var by this name outside of this loop
append SectionType_array SectionType
append SectionOffset_array SectionOffset
)
-- ...
if SectionType == 76 do(
-- ...
if SectionType == 91 do(
-- ... etc, etc