bgfx-python icon indicating copy to clipboard operation
bgfx-python copied to clipboard

The correct way to use 'set_view_order' ?

Open cache-tlb opened this issue 5 years ago • 2 comments

Hi, I'm using the interface set_view_order as follows:

view_order = np.array([ 3, 1, 2, 0 ], dtype=np.uint16)
bgfx.set_view_order(0, 4, as_void_ptr(view_order))

and get a trace:

TypeError: set_view_order(): incompatible function arguments. The following argument types are supported:
    1. () -> None
    2. (_id: int) -> None
    3. (_id: int, _num: int) -> None
    4. (_id: int, _num: int, _remap: int) -> None

Invoked with: 0, 4, <capsule object NULL at 0x1ec75f090>

It seems that I should pass an int for the last parameter. But how could an int represent the remap table?

I also notice other interfaces like set_view_transform declare the parameter for an array as const void*. However in the case of set_view_interface, that parameter is declared as const unsigned short *. See bgfx_python.cpp, line 1339. May it be a bug here?

Thanks for your help!

cache-tlb avatar Oct 15 '20 07:10 cache-tlb

Hi @cache-tlb! Yes it's a bug, the mapping were generated automatically and sometimes it failed to interpret those types successfully. I've already implemented a fix for ImGUI with uses the same patterns and I will extend it also to these interfaces. Thanks for pointing it out!

fbertola avatar Oct 16 '20 07:10 fbertola

@cache-tlb I fixed the issue in the types_marshalling brach. If you're able to build it from source, that would be the fastest way to use it, as I would like to overhaul the types conversion first. Let me know if you need any help!

fbertola avatar Nov 01 '20 14:11 fbertola