Game Editing > Scripts & Support
[MD5] EXPORT script for Blender 2.6x (OPEN)
kat:
The NLA is more of a 'global' animation system in that you can track and animate objects and items, it's basically to top level system where objects and events are animated rather than bones and armatures - you can animate characters using it but it's messy as it's not easy to drill down into the working data. For example you could rig a 'walk' anim for a character, armature legs and body move, but no actual forward motion. Using the NLA would then allow you to move the character forward in *object* mode - you'd *never* do this for an actual game character though, I just use it as an example of how the NLA can be used.
Because of the way I rig my characters, I've never yet had a need to use anything other than the Action Editor, messing with IPO data and what have you has never seemed that intuitive to me.
So in answer to 1) yes (I've got some tutorials in mind to explain why but finding the time as always). 2) As far as I understand, yes, Blender works and relies on those Datablocks, so you're correct.. if there are no connections to them they tend to just sit there - you have to re-load and save the file a couple of times to get rid of them. And again yes, if there are no connections to the datablock they can't be exported from what I understand.
And I agree, Outliner for the win (certainly the way it used to list everything), I often find myself referring to that to see what's in the file and connected to what.. especially the OPPS Schematic of pre 2.49.
keless:
Here is the first pass at exporting the .md5anim data ( http://dl.dropbox.com/u/1556553/io_export_md5.9-17-2010.py )
I'm just using the currently active 'action' and ignoring any others that may be in memory-- to export a series of .md5anims right now, you'd have to select each animation and perform the export one by one.
It seems to output a file in the correct format, however running the file shows the bone matrix values are corrupted. My frog character looks like a twisted mess.
The code in question should be local to:
--- Code: --- for bonename in thearmature.data.bones.keys():
posebonemat = mathutils.Matrix(pose.bones[bonename].matrix ) # @ivar poseMatrix: The total transformation of this PoseBone including constraints. -- different from localMatrix
try:
bone = BONES[bonename] #look up md5bone
except:
print( "found a posebone animating a bone that is not part of the exported armature: " + bonename )
continue
if bone.parent: # need parentspace-matrix
parentposemat = mathutils.Matrix(pose.bones[bone.parent.name].matrix ) # @ivar poseMatrix: The total transformation of this PoseBone including constraints. -- different from localMatrix
posebonemat = posebonemat*parentposemat.invert()
else:
posebonemat = posebonemat*thearmature.matrix_world
loc = [posebonemat[3][0],
posebonemat[3][1],
posebonemat[3][2],
]
rot = posebonemat.to_quat().normalize()
rot = [rot.w,rot.x,rot.y,rot.z]
animation.addkeyforbone(bone.id, time, loc, rot)
--- End code ---
and changing the .matrix values to .matrix_local changes the result, but its just a slightly different twisted mess.. perhaps something somewhere else is messed up.
kat:
Mesh exports OK.. no UVW issues from what I could tell. Will try other characters when I get a chance. Animations mess up quite bad as per your experiences, the bones seem to export OK as the rig looks sound without an animation loaded (into the MD5 viewer again). Loading in the *.md5anim 'breaks' the rig and splats the model all over the place.
keless:
Yay, squishbunny is squishy. Also, didn't I _just_ learn that matrix multiplication order got flipped in Blender 2.5?? Durrrr...
Problem solved, correct script is available at ( http://dl.dropbox.com/u/1556553/io_export_md5.9-17-2010.py ) pending rigorous testing.
There are plenty of bells and whistles that could be added to the script, like the ability to toggle mesh or anim generation off (if you only wanted to cut a new .md5anim file, for example), which I may or may not continue with-- anyone with the moxy is welcome to add their polish.
Also, my dropbox account may get cut off at some point in the future: if someone has a more stable place to host the script, I'd be obliged.
kat:
Works perfectly! Excellent work on this btw and don't worry about hosting, I'll sort that out here.
I'd be inclined to add the bells and whistles you can think of to avoid 'feature creep' added by other people, gets confusing sometimes trying to figure out which scripts to use sometimes when there are several version available. Speaking of which I can only really think of two... the export option you mentioned (export either/or/both). And exporting multiple Actions, not sure how that would work based on what you discovered during the development of this though.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version