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].v mapping 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?
Current API is specced as the following for
Plugin
:Few thoughts:
loops[i].v
mapping in C#?