gomtuu / import_valkyria

Blender import script for Valkyria Chronicles 3D model files
GNU General Public License v3.0
20 stars 12 forks source link

Fix object positioning and other tweaks. #2

Closed angavrilov closed 5 years ago

angavrilov commented 5 years ago
gomtuu commented 5 years ago

Thanks! I'll take a look.

I've been working on import_valkyria recently to add VC4 support. I intended to revisit the bone calculations and normal vectors as well, but I hadn't gotten to them yet, so this is great timing!

angavrilov commented 5 years ago

Basically it seems the most straightforward way of interpreting xform data works: convert it all to 4x4 matrices, multiply parent chains, and use the resulting matrix to place objects. It seems you were already doing it for location and rotation, but many environment objects depend on scale and it broke down. Also, the 0 bone was for some reason excluded for parenting, which broke trees and the mill tower.

gomtuu commented 5 years ago

That makes sense! Not sure why I ignored scale.

Thanks again for the pull request!

angavrilov commented 5 years ago

From the code it seems you may have been trying to "naturally" place the objects via transforms of bones themselves, and rest pose has no scale. I changed it to just compute the correct matrix in python and force objects to have that transformation no matter how the bone itself is placed.