Well actually, it wasn't really right in front of me.
I had a pretty good idea of what was causing it, but I had trouble determining which part was actually doing it. It wasn't related to deleting the animation objects. It was related to not clearing all of the temporary stuff whenever I load an object. It appeared to be whenever I deleted an object because of the way I had set up the test program. I just had a loop that if I pressed the "up" key, it would delete the currently loaded animation object and then reload it. Everytime I did that, I would see my memory drop. I finally determined that it was in the loading of objects by watching how much memory was taken every time I just loaded an object. It was about twice the memory as the file size. Deleting the object would clear out about the file size worth of memory. Once I determined that it was in the loading of objects (not deleting) then it was much easier to find.
I don't pretend to be a C++ guru (although I am getting better), and this has to do with some very messy pointer stuff. If nothing else, I am learning a LOT from this project!
I have the determined the approach that I am going to take with the animation portion of this now. Actually, the plugin will be broke up into 3 seperate groups of commands:
Object Control - Commands that effect your objects directly.
For example, here are some commands that I have included so far:
EnAn_ObjRenameLimb: Renames a limb of an object
EnAn_ObjTotalLimbs: Returns the total amount of limbs in an object
EnAn_ObjTotalFrames: Returns the total number of animation frames
EnAn_ObjFindLimbParent: Returns the parent limb of the passed limb
EnAn_ObjIsLimbChild: Returns if a given limb is a child of another limb
EnAn_ObjExtractAnimation: Saves the animation data of an object into the custom animation file format
EnAn_ObjSetLimbToFrame: Sets the limb of an object to the animation frame of a loaded animation object
Animation ID - Commands related to a loaded animation file
Animation files store limb hierarchy data and animation data
EnAn_AnimLoad - Load an animation file
EnAn_AnimDelete - Delete an animation file
EnAn_AnimGetParentLimb - Like EnAn_ObjFindLimbParent but for animation file
EnAn_AnimIsLimbChild - Like EnAn_ObjIsLimbChild but for animation file
EnAn_AnimGetTotalFrames - Total Frames of an animation object
EnAn_AnimGetTotalLimbs - Totla Limbs of an animation object
EnAn_AnimGetLimbRotKeys - Number of rotation keys for a limb
EnAn_AnimGetLimbPosKeys - Number of position keys for a limb
EnAn_AnimGetLimbScaleKeys - Number of scale keys for a limb
EnAn_AnimGetLimRotKeyTime - The time of a given rotation key
EnAn_AnimGetLimPosKeyTime - The time of a given position key
EnAn_AnimGetLimScaleKeyTime - The time of a given scale key
Also included are all of XYZ rotation, position and scale of each key.
I am going to try to include the ability to delete/add/modify both keys and limbs and also to re-save the data.
Object Animation Control - The animation command set.
This will allow you to add a loaded object to be controlled by an animation ID. Basicly, it will work like this:
You will use this command:
EnAn_oacCreate ObjID
This will allow you to control a DBpro object with the Animation ID's loaded above. For each limb of an object, there is "playing" animation information such as start frame, end frame, current frame, play speed, looping, reversing, ...etc. In addition to that, there is ANOTHER whole animation set for "transition" animations. Again, it includes the stuff above, but also a transition time. It will work like this. You set an animation to play (or loop). When you want to switch to a different animation, you set the "transition" animation to the new action and set a transition time for it to take place. As the transition time is used, the "playing" animation will be interpolated with the "transition" animation more and more. Once, the total transition time is used, then the "transition" animation will become the "playing" animation.
I hope that makes sense! I think it will offer a very clean, easy way to set up animation systems. Any thoughts or ideas are welcome!
-Ron
EZrotate!
TextureMax!
3D Character Maker!