monkeyman192 / NMSDK

Custom Model importer for NMS
https://monkeyman192.github.io/NMSDK/
29 stars 9 forks source link

Make Blender location detection smarter #76

Closed kidheracles closed 3 years ago

kidheracles commented 3 years ago

The default Blender & Python variables weren't working for me - I have Blender in the default installation path, ie.:

%ProgramFiles%\Blender Foundation\Blender 2.83\blender.exe

NMSDK is in: %AppData%\Blender Foundation\Blender\2.83\scripts\addons\nmsdk

We should reasonably expect users to associate their .blend files.

(The default path needs to be quoted because it has spaces in it.)

You can make Blender associate .blend files with blender.exe -R

monkeyman192 commented 3 years ago

Nice! Would you be able to update the readme.md also to indicate that the blender used may need to be registered (and how to it) in case of multiple blender installations (for example on my system this code without running blender.exe -R will run the wrong blender executable

kidheracles commented 3 years ago

Ok README updated

kidheracles commented 3 years ago

Well, now this includes the bones changes.

MMD_Tools helped me greatly to understand good practice here. I took their bpyutils.py and used it to simplify scene management: switching modes, selecting objects, and linking objects to the scene. I modified other functions in import_scene to use this too, so that they would be easier to follow.

I added a new test which is a simple jelly with a simple animation. Passing that gave me confidence to tackle Toy Cube.

I can see why you have Toy Cube as the test for bones and animations. The issue was that in the Toy Cube model, there are some bones with zero transform And Blender appears to not like it if you create a bone with identical head and tail locations to another bone. What was especially hard with Toy Cube was that three bones in hierarchy were in the same location.

The add_bone_to_scene was extensively re-written.

Animations still don't animate the mesh, just the bones. That is the next step to tackle, for now, we've gotten as far as the current release.

kidheracles commented 3 years ago

Hey @monkeyman192 - I've reverted this commit so that the changed files are only the run_tests.sh and README.md as discussed. I will push the import_scene.py changes to a branch and create a new pull request with that.

monkeyman192 commented 3 years ago

I'm going to close this since the wrong branch is being merged in. I have updated this PR onto a different and I'll create a PR with that branch...