Game Editing > Scripts & Support

[MD5] EXPORT script for Blender 2.6x (OPEN)

<< < (43/46) > >>

oladitan:
Hello. I am using the Blender 2.63 MD5 export script. Everything seems to work fine when I export my model with the active animation together with the 'Mesh and Anim' option. however when I try to export other animation with the 'Anim Only' option. blender has an error. This error occurs in both blender 2.63 and 2.71


--- Code: ---location: <unknown location>:-1
Exporting selected objects...
root bone: Bone
Processing mesh: mesh1
created verts at A 80, B 0, C 88
<io_export_md5-263.MD5Animation object at 0x0000000009A026D8>
Traceback (most recent call last):
File "C:\Users\oladitan\AppData\Roaming\Blender Foundation\Blender\2.71\script
s\addons\io_export_md5-263.py", line 904, in execute
save_md5(settings)
File "C:\Users\oladitan\AppData\Roaming\Blender Foundation\Blender\2.71\script
s\addons\io_export_md5-263.py", line 854, in save_md5
generateboundingbox(objects, anim, [rangestart, rangeend])
File "C:\Users\oladitan\AppData\Roaming\Blender Foundation\Blender\2.71\script
s\addons\io_export_md5-263.py", line 559, in generateboundingbox
(min, max) = getminmax(corners)
File "C:\Users\oladitan\AppData\Roaming\Blender Foundation\Blender\2.71\script
s\addons\io_export_md5-263.py", line 514, in getminmax
if len(listofpoints[0]) == 0: return ([0,0,0],[0,0,0])
IndexError: list index out of range

--- End code ---

I followed the instructions on the page where I downloaded the ad don.

Do I need to change a line in plugin code or something. Thanks.

kat:
Which script did you use? The one authored by keless here, or the one by nemyax here? If you used keless' script that looks like a bounding-box issue so make sure you have the mesh selected even though you're only exporting the animation (also make sure its assigned to the Armature before export - it should be the active sequence).

oladitan:

--- Quote from: kat on August 26, 2014, 08:34:16 AM ---Which script did you use? The one authored by keless here, or the one by nemyax here? If you used keless' script that looks like a bounding-box issue so make sure you have the mesh selected even though you're only exporting the animation (also make sure its assigned to the Armature before export - it should be the active sequence).

--- End quote ---

Thanks kat. I was using the keles script. I have tried the nemyax script as well. It gives me this error when I try to the mesh or the animation : The


--- Code: ---The deforming armature has no bones in layer 5.
Add all of the bones you want to export to the armature's layer 5,
or change the reserved bone layer in the scene properties,
and retry export.

--- End code ---

All of the bones of the armature are on the first layer of the armature layers. the armature is on layer 1 of the scene. The object, in this case a cube, is parented to the armature and deforms. The animation that I want to export is active int the action editor.


I have attached a file that I made using blender 2.71. Maybe you can reproduce the error.

kat:
Hmm problem replicated in 2.71 using keless' script when exporting to "Anim only". Otherwise there are no issues. It looks like Blender can't determine the animations boundingbox area for some reason, not sure why.

The work-around for the moment (obviously aside from the script being fixed) is to just export each sequence with a copy of the mesh at the same time, that works without OK - just delete the unwanted mesh files once done.

Side note: generally speaking MD5 can't make use of animations with scaled/resized bones - if you do that, whilst you'll get data output, unless you specifically allow for it in the game engine you're using, nothing will happen on playback.

P.S. merged topics to keep everything in one place by the way.

Bitterman:
Long time ago in thread “[MD5] EXPORT script for Blender 2.6x (OPEN)” kat wrote (by answer to Rajveer):


--- Quote ---“Just to check this further the below is the first line from the 'bounds' block exporting the same (original) Bob file from each script corresponding version of Blender - before export MESH objects were reset so their size and origin were relative to Blenders grid-centre (used "Apply" to set Origin points at 0,0,0) - the bounding box values are calculated relative to that position (outwards).

It looks like either there's an error in the script or Blender itself (in terms of what it's doing relative to the script) after the significant change that happened Blender 2.60 onwards - looking at the numbers from 2.62 the bounds do indeed appear to be a flat box compared to prior that.”

--- End quote ---

Rajveer talk about problem with incorrect values inside “bounds” section into .md5anim.

This is not obvious problem because Blender and modelviewer (imho) don’t show ‘bounds’.

But if anyone try to test exported model in Doom 3 with ‘testmodel <name>/testanim <name>/r_showskel 1’ console commands then we see as md5 bounding box is offset and distorted along one of axis (Y-components in max [X,Y,Z] as I think).

Not sure but it’s may be bad for game physics (see pictures).

Take a look (this is “io_export_md5.py” for Blender 2.59+ but algorithm is same in 2.4x-2.6x):


--- Code: --->>> corners.append(point_by_matrix (v, matrix)) <<<
(min, max) = getminmax(corners)
md5animation.bounds.append((min[0]*scale, min[1]*scale, min[2]*scale, max[0]*scale, max[1]*scale, max[2]*scale))

--- End code ---

We see that ‘bounds’ based on ‘corners’ and ‘corners’ are mul by ‘matrix’ (few lines above):


--- Code: ---def generateboundingbox(objects, md5animation, framerange):
  …
        matrix = [[1.0,  0.0, 0.0, 0.0],
          [0.0,  1.0, 0.0, 0.0],
  >>> [0.0,  1.0, 1.0, 0.0], <<< there is two (not one) correction values!
          [0.0,  0.0, 0.0, 1.0],
          ]
--- End code ---
     
I belive this row (or column) >>> [0.0,  1.0, 1.0, 0.0] <<< give a distortion by added some value to Y-component (or other) in max[X,Y,Z] because:


--- Code: ---def point_by_matrix(p, m):

return [p[0] * m[0][0] + p[1] * m[1][0] + p[2] * m[2][0] + m[3][0],
          p[0] * m[0][1] + p[1] * m[1][1] + p[2] * m[2][1] + m[3][1],
          p[0] * m[0][2] + p[1] * m[1][2] + p[2] * m[2][2] + m[3][2]]

--- End code ---

Now try to solved (I hope):

1.   Open “io_export_md5.py” in editor (Notepad).
2.   Add “cornersb = []” after “corners = []”.
3.   Add “matrixb = [[1.0,  0.0, 0.0, 0.0],
          [0.0,  1.0, 0.0, 0.0],
          [0.0,  0.0, 1.0, 0.0], 
          [0.0,  0.0, 0.0, 1.0],
          ]”

after “matrix = […]”.

4.   Add “cornersb.append(point_by_matrix (v, matrixb))” after “corners.append(point_by_matrix (v, matrix))”.
5.   Change “(min, max) = getminmax(corners)” to “(min, max) = getminmax(cornersb)”.
6.   Save modified “io_export_md5.py” in same place (blender/…/scripts/addons).

After this I see correct (well… almost correct) values into ‘bounds’ (see pictures).
Not sure about others but it seems work.

Hope this help.

Bitterman.





Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version