Hello. The one and only GlaphanKing here.
As most of you know, I am building a script to import models to max, edit them and then export them back as originally used or how ever you want. Since I am more of a programmer and not a 3d programmer, I would like some advice and or help.
My biggest wall has been bones and animating them. I can import every single mesh file (o3d), but the bones (chr) and animation (ani) are giving me problems.
I will gladly hand this tool out to everyone once its completed but I sadly can't get this part right.
If anyone has experience with max or even how the files work, please post it here and I will hopefully get this working.
I can offer you all this early version to get mesh files to load as well as their textures to display. Except for Clockworks. Its texture is wrong for some reason.
[Only registered and activated users can see links. Click Here To Register...]
Don't worry, the file is clean but the script itself is encrypted until its release. if you want to look at my problems here is the parts that need fixing.
I hope this gets fixed soon. Its making me want to stop this project.
As most of you know, I am building a script to import models to max, edit them and then export them back as originally used or how ever you want. Since I am more of a programmer and not a 3d programmer, I would like some advice and or help.
My biggest wall has been bones and animating them. I can import every single mesh file (o3d), but the bones (chr) and animation (ani) are giving me problems.
I will gladly hand this tool out to everyone once its completed but I sadly can't get this part right.
If anyone has experience with max or even how the files work, please post it here and I will hopefully get this working.
I can offer you all this early version to get mesh files to load as well as their textures to display. Except for Clockworks. Its texture is wrong for some reason.
[Only registered and activated users can see links. Click Here To Register...]
Don't worry, the file is clean but the script itself is encrypted until its release. if you want to look at my problems here is the parts that need fixing.
Code:
on btnChr pressed do ( chr = ClsBoneData() f = getOpenFileName caption: "Import Bones" types: "Bone Definitions(*.chr)|*.chr" version = undefined ReadCHR f &chr &version CreateArray &BoneSet chr.BoneCount For I=1 To chr.BoneCount Do ( if chr.Parents[I] != 0 Then ( BoneSet[I] = BoneSys.CreateBone (point3 0 0 0) Z_Axis Y_Axis --BoneSet[I] = BoneSys.CreateBone pos1 pos2 Y_Axis BoneSet[I].name = chr.Names[I] BoneSet[I].width = 0.05 as Float BoneSet[I].height = 0.05 as Float BoneSet[I].Parent = BoneSet[chr.Parents[I]] BoneSet[I].transform = chr.TM[I] * chr.LocalTM[I] --BoneSet[I].pos = chr.TM[I][4] --BoneSet[I].length = distance BoneSet[I].Position BoneSet[chr.Parents[I]].Position ) ) For BoneID = 1 To chr.Names.Count Do ( obj = getnodebyname chr.Names[BoneID] if obj != undefined Then ( obpar = obj.parent if obpar != undefined Then obj.length = distance obj.pos obpar.pos ) ) ) on btnAniImport pressed do ( f = getOpenFileName caption: "Import Animation" types: "Animation (*.ani)|*.ani" ReadANI f &Animation /* * For BoneID = 1 To Animation.BoneData.names.Count Do * ( * obj = getnodebyname Animation.BoneData.names[BoneID] * if obj != undefined Then * ( * If Animation.BoneTM[BoneID] == undefined Then * ( * tm = Animation.BoneTM[BoneID] * * For FrameID = 1 To Animation.FrameCount Do * ( * rot = obj.rotation - Animation.BoneFrame[BoneID][FrameID].Rotation * trans = obj.position - Animation.BoneFrame[BoneID][FrameID].Translation * * animate on * ( * at time FrameID (obj.pos = trans; obj.rotation = rot) * ) * ) * -- get each translation keyframe * anim_keys = #() * for i in obj.controller.position.controller.keys do append anim_keys i.time * * -- get each rotation keyframe * for i in obj.controller.rotation.controller.keys do append anim_keys i.time * * -- store the bone transform for every frame there is a key * anim_transforms = #() * for i in anim_keys do * ( * at time i * ( * if obj.parent == undefined then * ( * -- world space transform * append anim_transforms obj.transform * ) else ( * -- parent space transform * append anim_transforms (obj.transform * inverse obj.parent.transform) * ) * ) * ) * print anim_transforms * * For J = 1 To Animation.FrameCount Do * ( * at time J ( if obj.parent == undefined then obj.transform = anim_transforms[J] else obj.transform = (anim_transforms[J] * obj.parent.transform)) * ) * * /* For FrameID = 1 To Animation.FrameCount Do * ( * animate on ( at time FrameID ( if obj.parent == undefined then obj.transform = anim_transforms[FrameID] else obj.transform = (anim_transforms[FrameID] * obj.parent.transform ) ) * ) * * ) * ) * ) */ )