Home Coding, Scripting, Shaders

Sequoia Meshing Hacksaw 3ds Maxscript Error

Hello everyone, apologies upfront as I lack the programming knowledge to understand the problem I am having. I have been trying to utilize Thinkbox Sequoia Meshing, the program comes with 3ds integration maxscript for loading Seq. .xmesh into 3ds.

Code on GITHUB:

They have provided a .ms file which I have loaded and run. This creates a toolbar button that loads the sequential xmesh files. Whenever I run the script and point the macro to the correct file, once I click load I get this error.

I do not understand what this means. If anyone could point me in the right direction it I would really appreciate it.

Listener Window:

-- MAXScript Rollout Handler Exception:
-- Type error: Call needs function or class, got: undefined
-- MAXScript callstack:
--    thread data: threadID:16252
--    ------------------------------------------------------
--    [stack level: 0]
--    In f loop; filename: C:\Users\jkcam\AppData\Local\Autodesk\3dsMax\2022 - 64bit\ENU\usermacros\Sequoia-LoadSQHacksaw.mcr; position: 9551; line: 261
--    member of: codeblock macroScript: Sequoia_LoadSQHacksaw
--        Parameters:
--            f: 1
--        Locals:
--            XMeshLoader: undefined
--            theCurrentFile: "D:\FULL SECTION-221201_1of9.xmesh"
--            f: 1
--            isExistingNode: undefined
--            theLoader: undefined
--            theTextures: undefined
--            theMat: undefined
--        Externals:
--            theFiles: Free:theFiles : #(#("D:\FULL SECTION-221201_1of9.xmesh", true, false), #("D:\FULL SECTION-221201_2of9.xmesh", true, false),
#("D:\FULL SECTION-221201_3of9.xmesh", true, false), #("D:\FULL SECTION-221201_4of9.xmesh", true, false),
#("D:\FULL SECTION-221201_5of9.xmesh", true, false), #("D:\FULL SECTION-221201_6of9.xmesh", true, false),
#("D:\FULL SECTION-221201_7of9.xmesh", true, false), #("D:\FULL SECTION-221201_8of9.xmesh", true, false),
#("D:\FULL SECTION-221201_9of9.xmesh", true, false))
--            Sequoia_LoadSQHacksaw: <CodeBlock:Sequoia_LoadSQHacksaw>
--            chk_showTextures: RolloutControl:chk_showTextures in rollout:LoadHacksawPartitions_Rollout : CheckBoxControl:chk_showTextures
--            endframe: Free:endframe : 9
--            chk_assignMaterials: RolloutControl:chk_assignMaterials in rollout:LoadHacksawPartitions_Rollout : CheckBoxControl:chk_assignMaterials
--            owner: <CodeBlock:Sequoia_LoadSQHacksaw>
--            getPossibleTextures: getPossibleTextures()
--            newObjects: Free:newObjects : #()
--            cnt: Free:cnt : 1
--            chk_selfIlluminated: RolloutControl:chk_selfIlluminated in rollout:LoadHacksawPartitions_Rollout : CheckBoxControl:chk_selfIlluminated
--            prg_progress: RolloutControl:prg_progress in rollout:LoadHacksawPartitions_Rollout : ProgressBar:prg_progress
--            startframe: Free:startframe : 1
--    ------------------------------------------------------
--    [stack level: 1]
--    called from btn_loadPartitions.pressed(); filename: C:\Users\jkcam\AppData\Local\Autodesk\3dsMax\2022 - 64bit\ENU\usermacros\Sequoia-LoadSQHacksaw.mcr; position: 10539; line: 285
--    member of: Rollout:LoadHacksawPartitions_Rollout
--        Locals:
--            theFiles: #(#("D:\FULL SECTION-221201_1of9.xmesh", true, false), #("D:FULL SECTION-221201_2of9.xmesh", true, false),
#("D:\FULL SECTION-221201_3of9.xmesh", true, false), #("D:\FULL SECTION-221201_4of9.xmesh", true, false),
#("D:\FULL SECTION-221201_5of9.xmesh", true, false), #("D:\FULL SECTION-221201_6of9.xmesh", true, false),
#("D:\FULL SECTION-221201_7of9.xmesh", true, false), #("D:\FULL SECTION-221201_8of9.xmesh", true, false),
27662
#("D:\FULL SECTION-221201_9of9.xmesh", true, false))
--            endframe: 9
--            newObjects: #()
--            cnt: 1
--            startframe: 1
--        Externals:
--            ddl_textureLimit: RolloutControl:ddl_textureLimit in rollout:LoadHacksawPartitions_Rollout : ComboBoxControl:ddl_textureLimit
--            spn_start: RolloutControl:spn_start in rollout:LoadHacksawPartitions_Rollout : SpinnerControl:spn_start
--            chk_loadSubset: RolloutControl:chk_loadSubset in rollout:LoadHacksawPartitions_Rollout : CheckBoxControl:chk_loadSubset
--            chk_assignMaterials: RolloutControl:chk_assignMaterials in rollout:LoadHacksawPartitions_Rollout : CheckBoxControl:chk_assignMaterials
--            owner: Rollout:LoadHacksawPartitions_Rollout
--            edt_file: RolloutControl:edt_file in rollout:LoadHacksawPartitions_Rollout : EditTextControl:edt_file
--            getAllPartitions: getAllPartitions()
--            spn_end: RolloutControl:spn_end in rollout:LoadHacksawPartitions_Rollout : SpinnerControl:spn_end
--            updateUI: updateUI()
--            prg_progress: RolloutControl:prg_progress in rollout:LoadHacksawPartitions_Rollout : ProgressBar:prg_progress
--            LoadHacksawPartitions_Rollout: Rollout:LoadHacksawPartitions_Rollout
--    ------------------------------------------------------
--    [stack level: 2]
--    called from top-level


Code:

        on btn_loadPartitions pressed do
        (
            local newObjects = #()
            with undo "LoadSQHacksaw" on
            (
                local theFiles = getAllPartitions edt_file.text
                local startFrame = 1
                local endFrame = theFiles.count
                if chk_loadSubset.checked do
                (
                    startFrame = spn_start.value
                    endFrame = spn_end.value
                )
                local cnt = 0
                for f = startFrame to endFrame do
                (
                    windows.processPostedMessages()
                    cnt += 1
                    prg_progress.value = 100.0*cnt/(endFrame-startFrame+1)
                    if theFiles[f][2] do
                    (
                        local theCurrentFile = theFiles[f][1]
                        local isExistingNode = getNodeByName ("XMesh_"+ getfilenamefile theCurrentFile)
                        if not isValidNode isExistingNode do
                        (
                            local theLoader = XMeshLoader()
                            theLoader.renderSequence = theCurrentFile
                            theLoader.name = "XMesh_"+getfilenamefile theCurrentFile
                            theLoader.loadSingleFrame = true
                            theLoader.useFileLengthUnit = true
                            theLoader.viewportSequenceID = 0
                            theLoader.showIcon = false
                            append newObjects theLoader
                            if chk_assignMaterials.checked do
                            (
                                local theTextures = getPossibleTextures theCurrentFile
                                if theTextures.count > 0 do
                                (
                                    local theMat = StandardMaterial name:("MAT_"+getFileNameFile theCurrentFile)
                                    theMat.diffusemap = bitmapTexture name:("MAP_"+getFileNameFile theCurrentFile) filename:theTextures[1]
                                    if chk_selfIlluminated.checked do theMat.selfIllumAmount = 100.0
                                    theLoader.material = theMat
                                    showTextureMap theMat chk_showTextures.checked
                                )
                            )
                            --max views redraw
                            max zoomext sel all
                        )--end if node does not exist
                    )--end if exists
                )
                if chk_assignMaterials.checked  do    NitrousGraphicsManager.SetTextureSizeLimit (ddl_textureLimit.selected as integer) true
                select newObjects
                max zoomext sel all
                prg_progress.value = 0
                updateUI()
            )--end undo
        )
        on LoadHacksawPartitions_Rollout moved pos do
        (
            setIniSetting (getDir #plugcfg+"//SQ_LoadHacksawPartitions.ini") "Dialog" "Position" (pos as string)
        )
    )
    val = execute (getIniSetting (getDir #plugcfg+"//SQ_LoadHacksawPartitions.ini") "Dialog" "Position" )
    if val != OK then
        createDialog LoadHacksawPartitions_Rollout 400 320 val.x val.y
    else
        createDialog LoadHacksawPartitions_Rollout 400 320
)

Thanks for any help. I know I pasted quite a bit, but I am still learning so I wanted to provide the context?

Replies

  • jkcam

    Sorry, I don't think I pasted that code correctly.... formatting doesn't look like other posts.

  • xXm0RpH3usXx
    Offline / Send Message
    xXm0RpH3usXx polycounter lvl 12

    its a bit late, but I didnt want to just go over this.

    do you know how to open the maxscript listener? it should give more explicit error messages than the pop up window.

    it means that somewhere in the sourcecode a method is called on an object that is neither a class nor a function. (most likely its undefined)

    for example it could be "theLoader.renderSequence", where "theLoader" hasnt been propperly assigned beforehand, so maxscript can not call the method. the listener should give you a line you can investigate more indepth.

Sign In or Register to comment.