BVH Reader 2 is a BVH (BioVision Hierarcy) file reader written in Python 3. It is generated with Antlr4, starting from a grammar: .\BVH.g4.
NOTE: the number '2' in the name of this project is not a version number. It is a nostalgic addition, taken from my former project MD5 Reader 2, in which I implemented (manually) my first Lexer/Parser code.
The base scripts are built on top of Antlr4, therefore, you have to install the runtime package.
python -m pip install antlr4-python3-runtimeor just
pip install antlr4-python3-runtimeSome code in the ./blender/script directory, needs to be run inside of Blender, by opening the script inside the Blender Text Editor. To run a script inside the Text Editor press ALT-P or press the play button in the UI.
The Blender version I am currently using for this project is Blender 4.2.1 LTS.
To install the Antlr4 runtime in the Blender Python environment you should invoke the Python executable insalled inside your Blender installation directory.
On Windows 11, Blender installer places the application directory wherever you choose, though, the default directory shoud be C:\Program Files\, to which is appended .\Blender Foundation\Blender 4.2\ and, finally, Python stuff is inside .\4.2\python\. If you don't have permissions to install Python packages into the installation Blender directory, pip automaticaly falls back to C:\Users\<username>\AppData\Roaming\Python\Python311\Scripts, which is actually desiderable.
& "C:\Program Files\Blender Foundation\Blender 4.2\4.2\python\bin\python.exe" -m pip install antlr4-python3-runtimeTo extract the data from a BVH file you can use the BVHListener or the BVHVisitor. For more details on how to use Antlr4 listeners and visitors visit the Antlr4 official website.
./harness.py test script, should work this way:
python harness.py test.bvhIt outputs the Antrl4 tree.
This is a early implementation, I didn't test it myself, yet. Updates will come soon.
This project borns as an ancillary project of MPFB Extension for Blender. Official MPFB developer team are not involved (yet) in my effor/test, neither they have approved it. BVH Reader 2 is my own endeavour, to date.
