fix bugs
- fix typing hint error in PyBMap - remove UNKNOWN_PF in PixelFormat enum in PyBMap.virtools_type. because it is a fallback value and should not be used directly. so when I apply it to Blender plugin, it cause a error.
This commit is contained in:
parent
8ed7df659d
commit
afd4abadbb
|
@ -1,4 +1,4 @@
|
||||||
import ctypes, os, sys
|
import ctypes, os, sys, typing
|
||||||
|
|
||||||
#region Type Defines
|
#region Type Defines
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@ except:
|
||||||
def is_bmap_available() -> bool:
|
def is_bmap_available() -> bool:
|
||||||
return _g_BMapModule is not None
|
return _g_BMapModule is not None
|
||||||
|
|
||||||
def _bmap_error_check(result: bm_bool, func, args):
|
def _bmap_error_check(result: bool, func, args):
|
||||||
if not result:
|
if not result:
|
||||||
raise BMapException("BMap operation failed.")
|
raise BMapException("BMap operation failed.")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _create_bmap_func(fct_name: str, fct_params: list[ctypes._SimpleCData]) -> ctypes._CFuncPtr:
|
def _create_bmap_func(fct_name: str, fct_params: list[typing.Any]) -> typing.Callable[..., bm_bool]:
|
||||||
if _g_BMapModule is None: return None
|
if _g_BMapModule is None: return None
|
||||||
|
|
||||||
cache: ctypes._CFuncPtr = getattr(_g_BMapModule, fct_name)
|
cache: typing.Callable[..., bm_bool] = getattr(_g_BMapModule, fct_name)
|
||||||
cache.argtypes = fct_params
|
cache.argtypes = fct_params
|
||||||
cache.restype = bm_bool
|
cache.restype = bm_bool
|
||||||
cache.errcheck = _bmap_error_check
|
cache.errcheck = _bmap_error_check
|
||||||
|
|
|
@ -188,7 +188,7 @@ class VX_PIXELFORMAT(enum.IntEnum):
|
||||||
"""!
|
"""!
|
||||||
Pixel format types.
|
Pixel format types.
|
||||||
"""
|
"""
|
||||||
UNKNOWN_PF = 0 ##< Unknown pixel format
|
#UNKNOWN_PF = 0 ##< Unknown pixel format
|
||||||
_32_ARGB8888 = 1 ##< 32-bit ARGB pixel format with alpha
|
_32_ARGB8888 = 1 ##< 32-bit ARGB pixel format with alpha
|
||||||
_32_RGB888 = 2 ##< 32-bit RGB pixel format without alpha
|
_32_RGB888 = 2 ##< 32-bit RGB pixel format without alpha
|
||||||
_24_RGB888 = 3 ##< 24-bit RGB pixel format
|
_24_RGB888 = 3 ##< 24-bit RGB pixel format
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import ctypes, os, sys
|
import ctypes, os, sys, typing
|
||||||
|
|
||||||
#region Type Defines
|
#region Type Defines
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@ except:
|
||||||
def is_bmap_available() -> bool:
|
def is_bmap_available() -> bool:
|
||||||
return _g_BMapModule is not None
|
return _g_BMapModule is not None
|
||||||
|
|
||||||
def _bmap_error_check(result: bm_bool, func, args):
|
def _bmap_error_check(result: bool, func, args):
|
||||||
if not result:
|
if not result:
|
||||||
raise BMapException("BMap operation failed.")
|
raise BMapException("BMap operation failed.")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _create_bmap_func(fct_name: str, fct_params: list[ctypes._SimpleCData]) -> ctypes._CFuncPtr:
|
def _create_bmap_func(fct_name: str, fct_params: list[typing.Any]) -> typing.Callable[..., bm_bool]:
|
||||||
if _g_BMapModule is None: return None
|
if _g_BMapModule is None: return None
|
||||||
|
|
||||||
cache: ctypes._CFuncPtr = getattr(_g_BMapModule, fct_name)
|
cache: typing.Callable[..., bm_bool] = getattr(_g_BMapModule, fct_name)
|
||||||
cache.argtypes = fct_params
|
cache.argtypes = fct_params
|
||||||
cache.restype = bm_bool
|
cache.restype = bm_bool
|
||||||
cache.errcheck = _bmap_error_check
|
cache.errcheck = _bmap_error_check
|
||||||
|
|
Loading…
Reference in New Issue
Block a user