McManning / McManning/Coherence
Add custom vertex data support for third party plugins
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 30
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Current API is specced as the following for Plugin:
def add_custom_vertex_data_stream(self, id: str, size: int, callback):
"""
Add a callback to be executed every time vertex data needs to be synced.
The callback must return a pointer to the custom vertex data, aligned *to loops*
for the given mesh.
`def callback(mesh: bpy.types.Mesh) -> ctypes.void_p`
Args:
id (str):
size (int): Number of bytes in the data stream per loop index
callback (callable): Callable that returns a pointer to the data stream
"""
pass
def remove_custom_vertex_data_stream(self, id: str):
"""Remove a previously registered vertex data stream
Args:
id (str):
"""
pass
Few thoughts:
- Currently requires loop alignment. Maybe it instead optionally can align to vertices so we don't need an extra
loops[i].vmapping in C#? - Need to better define how a third party plugin is fetching/generating that data. For Python-land it can be something like Numpy doing number crunching to spit out some values per vertex, but how does that look with other CDLLs?
- Will need to figure out some good method for stream reinterpretation on both the LibCoherence and Unity side of things. LibCoherence can at least do a memcmp for for each vertex's stride of bytes to determine if vertices need to be split or not. Unity - I guess can just reinterpret the byte stream however the 3rd party plugin wants?
- Still need specs on what this would look like for Unity. Are we letting people add data to the Mesh? Or use the data for something else (dump into a compute maybe...)? Weight paints would need to go into the Mesh directly.
- Space transforms? Is that just the responsibility of the 3rd party dev?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file or test is named. Start with the Plugin API methods in the issue and trace how vertex data crosses LibCoherence and Unity; resolve loop-versus-vertex alignment, stream reinterpretation, mesh or compute use, and transform ownership. Done requires agreed specifications and an implementation spanning the Python, LibCoherence, and Unity sides.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python, unity
- Domain
- api, computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100