eherr / vis_utils

Simple OpenGL renderer and scene graph for the data structures of the animation utilities.
MIT License
5 stars 2 forks source link

about python version #1

Open honda6 opened 4 years ago

honda6 commented 4 years ago

hi, is your library written in python3.6? and how can i install fbx sdk in python3.6?

eherr commented 4 years ago

Hi, python 3.6 is only required to use pygltflib. The other code should also work with python 3.5, if you disable the import of that library in vis_utils/io/init.py line 32.

We have also implemented a custom cython wrapper to import character models using the C++ FBX SDK that can be compiled to run with other python versions. If it would help, we can upload it to another repository.

honda6 commented 4 years ago

Thank you for your reply. The fbx sdk is very useful, and i'm looking forward to you uploading it, it will help me a lot, thanks~

eherr commented 4 years ago

Hi I have uploaded now a first version of the FBX SDK wrapper to the following repository: https://github.com/eherr/py_fbx_wrapper

It was only tested with files from MakeHuman that contain a character with a skeleton and will not work with most files.

honda6 commented 4 years ago

Thanks a lot~

eherr commented 4 years ago

You are welcome

gemlongman commented 4 years ago

Hi I have uploaded now a first version of the FBX SDK wrapper to the following repository: https://github.com/eherr/py_fbx_wrapper

It was only tested with files from MakeHuman that contain a character with a skeleton and will not work with most files.

It works well~By the way,It seems need to add "libxml2-md.lib;zlib-md.lib;" in for building. However, is there any fbx export SDK wrapper, for handling mesh animation.

eherr commented 4 years ago

Thanks for noticing the missing libs. I will update the project file.

Yes I have tested importing the animation using the official Python SDK and also had some code using the C++ SDK. The latter is, however, not yet integrated with the custom wrapper.

I will look for it and, if I find it, add it to the repository or alternatively post it as a gist.

eherr commented 4 years ago

Hi, you can find the animation importer code for the Python FBX SDK here: https://gist.github.com/eherr/ead35014d579a97754351482b807eca5

It should be possible to export an animation to BVH using this code and anim_utils:

import fbx_importer
from anim_utils.skeleton_builder import SkeletonBuilder
from anim_utils.motion_vector import MotionVector

fbx_skel, fbx_anims = fbx_importer.load_fbx_file(filename)
skel = SkeletonBuilder().load_from_fbx_data(fbx_skel)
mv = MotionVector()
mv.from_fbx_data(fbx_anims["name"])
mv.export(skel, out_filename)

I will try to add support for animations to the custom FBX SDK wrapper.

eherr commented 4 years ago

I have uploaded now a first version of the custom FBX SDK Wrapper that also returns the animation curves which can be used as follows:

import fbx_importer

data = fbx_importer.load_fbx_file(filename)

Data contains a "skeleton", "animations" and a "mesh_list". Each entry of the mesh list contains with vertices, normals, uvs, bone ids and weights. Each animation contains the "frame_time" and a "curves" dict that stores the joint names as keys and a list of frames with "local_translation" and "local_rotation" as keys.