Issue in DirectX Exporter Mod 1.3.2 script

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Nextor
Posts: 0
Joined: Tue Nov 08, 2005 8:17 pm
Location: Madrid-SPAIN

Issue in DirectX Exporter Mod 1.3.2 script

Post by Nextor »

Hi all!

I've been using Omari & Jox's script (DirectX Exporter Mod 1.3.2) for exporting Blender animated meshes a lot, and I've come across with an issue about vertex weights: they aren't calculated correctly, so the exported animated mesh gets wrong movements on some vertexes (those which have more than one weight assigned). The fact is that, if a vertex gets more than one influence, each of them are calculated as if they have the same value, no matter which values they actually have. In example, if 2 influences were aplied on a vertex, the 2 of them get a value of 0.5 in the exported mesh, no matter which values they have in Blender.

Well, I've fixed that issue myself but I wanted to share it with all of you who use this script too. And if Ben Omari or Jox are around here, maybe you guys want to fix it on your new release of that script.

In the block of code named "Write SkinWeight", I've replaced the following lines (I've had to put some --- because spaces/tabs doesn't work here):


-----len_infl = float(len(ver_infl))
-----if len_infl != 0.0:
-----------------infl = 1 / len_infl
-----else:
-----------------infl = 0.0


with these, which work correctly:


-----infl = 0.0
-----if len(ver_infl) != 0:
------------------sum = 0.0
------------------for bone_name, weight in ver_infl:
------------------------------if bone_name == name:
---------------------------------------------infl = weight
------------------------------sum += weight
------------------infl /= sum


Bye! :D

womanonfire
Posts: 0
Joined: Tue Oct 22, 2002 5:00 pm

Post by womanonfire »

That is a great X exporter script. Always works for me anyway. Very reliable.
If anyone can update it to work with 2.41 it would be much appreciated.

Post Reply