Notifications
Clear all

[Closed] MAXScript Grabage Collection Error

Hi all! I use max sdk batch process *.max,and sdk call maxscript file.

gp->ExecuteFileScript(tchFileName)

When probably process twenty max files pop-up "MAXScript Grabage Collection Error" how to  solution?

[img] http://www.cgsir.com/upload/upfile/script_error.png [/img]
thanks !

MaxScript code
------------------------------------------

–Search Vertexs of no bind bones , then set bones weight to index vertex 1 0.0

– init
max modify mode
if (classof $.modifiers[1])== Skin do
(
local modi = $.modifiers[1]
local nBones = skinOps.GetNumberBones modi
local nVertexs = skinOps.GetNumberVertices modi
local vecBoneSets = #();
for idx = 1 to nBones do
(
append vecBoneSets 0
)

– search no Weight Bones
for i = 1 to nVertexs do
(
local nVexBones = skinOps.GetVertexWeightCount modi i

        if nVexBones > 0 do
        (
            for j = 1 to nvexBones do
            (
                local idxBone = skinOps.GetVertexWeightBoneID modi i j
                skinOps.SelectBone modi idxBone
                vecBoneSets[idxBone] = vecBoneSets[idxBone] + 1
            )
        )
    )

–Set Bones Weight 0.0
for i = 1 to vecBoneSets.count do
(
if vecBoneSets[i] == 0 do
(
–Set Bone: 0.0
local vertIdx = 1
local fWeight = 0.0
skinOps.SelectVertices modi vertIdx
skinOps.SelectBone modi i
skinOps.SetWeight modi 0.001
skinOps.SetWeight modi fWeight
)
)
)