SKIN modifier issue or alternative
also in http://forums.cgsociety.org/showthread.php?f=98&t=936192
Hi, i have a big problem of crash when i utilize the skin modifier in my script
This is a small description of my script:
Struct MeshClass ( filename = "", Faces=#(),FacesIndex=#(),FacesName=#(),VertsData=#(),TVertsData=#(), WeightsData=#(), -- bone1_idx ; bone2_idx ; %bone1 NormalData=#(),BoneMesh=#(),BoundingSphere=#(),TextureData=#(),SkeletonData=#(), fn deleteProp = ( Faces=FacesIndex=FacesName=VertsData=TVertsData=NormalData= undefined ), fn AssignWeight Weight_Arrar Obj_Array= ( st = timeStamp() format "Drawing weight bone...\n" progressStart "Drawing weight bone" cont = Obj_Array.count listen = stringStream "" for i=1 to cont do ( progressUpdate ((i*100.0/cont) as integer) format "obj%\n" i obj = Obj_Array[i] weight = Weight_Arrar[i] if obj.numverts != weight.count do (MessageBox "Attention, error in the object" ; return False) theskin = Skin() theskin.rigid_vertices = false select obj max modify mode addModifier obj theskin skinops.buttonInclude theskin for i=1 to SkeletonData.count do ( skinOps.addbone theskin (getNodeByName SkeletonData[i].Bone.name ) 1 ) nbone = skinops.getNumberBones theskin obj.selectedVerts = #{1..obj.numverts} skinOps.resetSelectedVerts theskin nverts = skinops.getNumberVertices theskin for i = 1 to obj.numverts do skinOps.ReplaceVertexWeights theskin i 1 1.0 update obj geometry:true normals:true redrawViews() format "%\t%\t%" obj.name obj.modifiers[#Skin] nbone to:listen ) close listen format "%\n" (listen as string) ok ), fn readMesh = ( -- a function that import data from a binary file ), fn buildgeometry = ( -- after readMesh() i build the object with all information, only bone assignment must be assigned after, a "Weight_Arrar" and "Obj_Array" was generate to store all mesh and relative vertex's weight deleteProp() AssignWeight Weight_Arrar Obj_Array --enableSceneRedraw() --redrawViews() clearSelection() ) )
This script work, there aren't error message but when i clic on the scene there are a crash !!!
I have made a lot of variant but it crash everytime... so I decided starting my own skin modifier as a plugin ... but is very frustrating this issue
Comments
hmm..., I think something
hmm..., I think something about your first post currently
I found the problem, the cause are:
progressUpdate() , progressStart "" and progressEnd()
yes me too...
maybe you should be check one by one your script commands.
I suggest you try something into one object before assign into multiple objects
Here I found one a problem again
about addbone on your scripts
to ensure a command like this:
without '.bone'
hi, thanks for answer ! I
...
Twcenter.net modder and tool creater
i make a little check, this
i make a little check, this is the synthetic code:
Listener:
the problem is on second loop, the checkmod = modPanel.getCurrentObject() return undefined but is not possible... why max crash in the modifier pannel ????
Twcenter.net modder and tool creater
hi Jhon ... I think, you
hi Jhon ...
I think, you should do to ensure the selection/objects as array
Just a little rewrite :
NO SORRY, the problem isn't
NO SORRY, the problem isn't the ProgressBar...
i make the simple function:
the script don't make error, but the bone aren't added in the list and when i clic on object the 3dstudio crash !!!!
I don't undertand why... all is correct.
If i use the only function:
addModifier obj theskin
without all other "skinOps." function, 3dstudio don't crash... the problem is on "skinOps.addbone", it don't work !!!!
Twcenter.net modder and tool creater
in your code
in your code :
I think you should be get the node name correctly.
let's us focus to getNodeByName function :
are you sure for this ? because the result of SkeletonData[1].Bone.name should be as string of an object name. if it's not as string you will getting error.
then my solution is such as :
addbone is such as :
and that is working correctly for me to adding the bone into skin modifier,and then in the next command the skinops function will working correctly.
no, SkeletonData[1].Bone.name
no, SkeletonData[1].Bone.name is an array of bone, is correct...
I try this:
and it work correctly, so i don't understand why in my script this simple operation don't work... is very frustrating!
Twcenter.net modder and tool creater
---
I put my script in a essential version, the script apply the skin() modifier and if you clic ok in the queryBox the script add the bones in the skins witout error.
BUT:
when i clic on box objects the 3dstudio crash !?! WHY ???
Twcenter.net modder and tool creater
I've tried your scripts
I've tried your scripts Jhon.
as you said... that's right.
when I click on box objects the 3dstudio crash.
so why ?
I've got a clue, maybe it's can help you.
create bone by 'bone() methods in 3dsmax 4 and higher, it is not possible to create a bones system using IK controllers on the bones' nodes.
I guess you should look back on mxs reference for details.
if you addbone into skin modifier of box objects by manually then you can not find the bone objects in listbox.
I suggest you to using "BoneSys.create" methods, such:
simply to compare bone() vs BoneSys.create such as:
and it does'nt work correctly then the 3dsmax crash.
by this:
and it work correctly.
Perfect, thanks, in fact i
Perfect, thanks, in fact i utilized the Point() and work.
I can't utilize BoneSys because it have a fixed position, sometime the game bone system have a rotations and positions movement (free joint), the max BoneSys only relative rotations for children bone.
Twcenter.net modder and tool creater