UPC-ViRVIG / pymotion

A Python library for working with motion data in numpy or PyTorch
MIT License
34 stars 2 forks source link

Can't run bvh.save() after bvh.get_data() #4

Closed dyp159 closed 4 months ago

dyp159 commented 4 months ago

As mentioned in the title, in the pymotion.io.bvh.BVH class, if you run bvh.get_data(), you can't immediately run bvh.save(), due to parents[0] = 0 # BVH sets root as None. The solution is to change 0 into None as you noticed.

I wonder if this is a bug, since it seems that your package is only used for BVH.

JLPM22 commented 4 months ago

Hi! Thank you for the feedback :)

This issue made me realize that it does not make much sense to have two separate representations for the root parent: in the BVH file, None was used to support Lists, while outside, a 0 was used to support np.arrays. Therefore, I have changed the BVH class to use np.array for the parents field; thus, 0 is now used as the parent of the root node everywhere. c5dea97119b23c36f6ff7ac584d10e7849821d83

Everything should work as expected now. Let me know if you need any other help.