Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom metadata support #19

Open
romanov6416 opened this issue Oct 18, 2021 · 2 comments
Open

Custom metadata support #19

romanov6416 opened this issue Oct 18, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@romanov6416
Copy link

Hi!

First, thank you for the library development.
I want to use this lib in my python project. In addition to 3D geometry (draco mesh) I have to serialize/deserialize custom metadata attached to the mesh in the draco file. I see that current version of DracoPy doesn't support custom metadata. So I decided to make my own implementation of this in DracoPy.pyx file. And here I bumped into the problem:

I implemented recursive metadata struct.
in DracoPy.h:

  struct MetadataObject {
    std::unordered_map<std::string, std::vector<uint8_t>> entries;
    std::unordered_map<std::string, MetadataObject> sub_metadatas;
  };

And DracoPy.pxd

cdef extern from "DracoPy.h" namespace "DracoFunctions":
    cdef struct MetadataObject:
        unordered_map[string, vector[uint8_t]] entries
        unordered_map[string, MetadataObject] sub_metadatas

Also I added a function (to DracoPy.h) parsing draco metadata to MetadataObject and pass it into encode_mesh function.

And when I try to compile my solution I got cython compilation error:
RecursionError: maximum recursion depth exceeded while calling a Python object

I know declaring recursive structures is possible in Cython.
But it seems impossible to declare EXTERNAL recursive structures in Cython (I didn't find anything about it in google)

So my question is do you have ideas how to forward draco structure Metadata to Python?

@romanov6416
Copy link
Author

Created PR #20 to support metadata

@william-silversmith
Copy link
Contributor

Thanks for the PR romanov, I'm off until Friday, but I'll try to take a look then!

@william-silversmith william-silversmith added the enhancement New feature or request label Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants