diff --git a/bbp_ng/PyBMap/bmap.py b/bbp_ng/PyBMap/bmap.py index 4ecce82..5926c8b 100644 --- a/bbp_ng/PyBMap/bmap.py +++ b/bbp_ng/PyBMap/bmap.py @@ -1,4 +1,4 @@ -import ctypes, os, sys +import ctypes, os, sys, typing #region Type Defines @@ -89,15 +89,15 @@ except: def is_bmap_available() -> bool: 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: raise BMapException("BMap operation failed.") 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 - cache: ctypes._CFuncPtr = getattr(_g_BMapModule, fct_name) + cache: typing.Callable[..., bm_bool] = getattr(_g_BMapModule, fct_name) cache.argtypes = fct_params cache.restype = bm_bool cache.errcheck = _bmap_error_check diff --git a/bbp_ng/raw_icons/bme/RibbonInnerCorner.png b/bbp_ng/raw_icons/bme/RibbonInnerCorner.png new file mode 100644 index 0000000..25dc741 Binary files /dev/null and b/bbp_ng/raw_icons/bme/RibbonInnerCorner.png differ diff --git a/bbp_ng/raw_jsons/borders.json b/bbp_ng/raw_jsons/borders.json index 02feca4..0b36e91 100644 --- a/bbp_ng/raw_jsons/borders.json +++ b/bbp_ng/raw_jsons/borders.json @@ -19,10 +19,6 @@ "field": "is_sink", "data": "False" }, - { - "field": "border_texture", - "data": "\"FloorTopBorderless\"" - }, { "field": "is_ribbon", "data": "False" @@ -45,26 +41,26 @@ ], "vertices": [ { - "skip": "False", + "skip": "not face[0]", "data": "(0, 0, 0)" }, { - "skip": "False", + "skip": "not face[0]", "data": "(0, 2.5, -sink)" }, { - "skip": "False", + "skip": "not face[0]", "data": "(length, 0, 0)" }, { - "skip": "False", + "skip": "not face[0]", "data": "(length, 2.5, -sink)" } ], "faces": [ { "skip": "not face[0]", - "texture": "border_texture", + "texture": "(\"FloorTopFlat\" if is_ribbon else \"FloorTopProfil\") if is_sink else \"FloorTopBorder\"", "indices": [0, 2, 3, 1], "uvs": [ "(0, 0)", @@ -193,7 +189,6 @@ "height": "height", "face": "face", "is_sink": "False", - "border_texture": "\"FloorTopBorder\"", "is_ribbon": "False" }, "transform": "ident()" @@ -257,7 +252,6 @@ "height": "height", "face": "face", "is_sink": "True", - "border_texture": "\"FloorTopProfil\"", "is_ribbon": "False" }, "transform": "ident()" @@ -321,7 +315,6 @@ "height": "height", "face": "face", "is_sink": "True", - "border_texture": "\"FloorTopFlat\"", "is_ribbon": "True" }, "transform": "ident()" diff --git a/bbp_ng/raw_jsons/corners.json b/bbp_ng/raw_jsons/corners.json new file mode 100644 index 0000000..e7d351c --- /dev/null +++ b/bbp_ng/raw_jsons/corners.json @@ -0,0 +1,468 @@ +[ + { + "identifier": "raw_floor_corner", + "showcase": null, + "params": [ + { + "field": "height", + "data": "5.0" + }, + { + "field": "face", + "data": "(True, False, False, False, False, False)" + }, + { + "field": "is_sink", + "data": "False" + }, + { + "field": "is_inner", + "data": "False" + }, + { + "field": "is_ribbon", + "data": "False" + } + ], + "skip": "False", + "vars": [ + { + "field": "PXPY_sink", + "data": "0.7 if (is_sink and (not is_inner)) else 0" + }, + { + "field": "NXNY_sink", + "data": "0.7 if (is_sink and is_inner) else 0" + }, + { + "field": "PXPY_uv", + "data": "(0 if is_inner else 0.5) * (2 if is_ribbon else 1)" + }, + { + "field": "NXNY_uv", + "data": "(0.5 if is_inner else 0) * (2 if is_ribbon else 1)" + }, + { + "field": "corner_texture", + "data": "(\"FloorTopFlat\" if is_ribbon else \"FloorTopProfil\") if is_sink else \"FloorTopBorder\"" + } + ], + "vertices": [ + { + "skip": "not face[0]", + "data": "(0, 0, -NXNY_sink)" + }, + { + "skip": "not face[0]", + "data": "(2.5, 0, -NXNY_sink)" + }, + { + "skip": "not face[0]", + "data": "(2.5, 2.5, -PXPY_sink)" + }, + { + "skip": "not face[0]", + "data": "(0, 2.5, -NXNY_sink)" + } + ], + "faces": [ + { + "skip": "not face[0]", + "texture": "corner_texture", + "indices": [0, 1, 2], + "uvs": [ + "(NXNY_uv, 0.5)", + "(NXNY_uv, 0)", + "(PXPY_uv, 0)" + ], + "normals": [ + "(0, PXPY_sink - NXNY_sink, 2.5)", + "(0, PXPY_sink - NXNY_sink, 2.5)", + "(0, PXPY_sink - NXNY_sink, 2.5)" + ] + }, + { + "skip": "not face[0]", + "texture": "corner_texture", + "indices": [0, 2, 3], + "uvs": [ + "(NXNY_uv, 0.5)", + "(PXPY_uv, 0)", + "(NXNY_uv, 0)" + ], + "normals": [ + "(PXPY_sink - NXNY_sink, 0, 2.5)", + "(PXPY_sink - NXNY_sink, 0, 2.5)", + "(PXPY_sink - NXNY_sink, 0, 2.5)" + ] + } + ], + "instances": [ + { + "identifier": "raw_floor_side", + "skip": "not face[4]", + "params": { + "height": "height", + "length": "2.5", + "is_left_sink": "NXNY_sink != 0", + "is_right_sink": "NXNY_sink != 0" + }, + "transform": "ident()" + }, + { + "identifier": "raw_floor_side", + "skip": "not face[2]", + "params": { + "height": "height", + "length": "2.5", + "is_left_sink": "NXNY_sink != 0", + "is_right_sink": "NXNY_sink != 0" + }, + "transform": "move(0, 2.5, 0) @ rot(0, 0, -90)" + }, + { + "identifier": "raw_floor_side", + "skip": "not face[3]", + "params": { + "height": "height", + "length": "2.5", + "is_left_sink": "NXNY_sink != 0", + "is_right_sink": "PXPY_sink != 0" + }, + "transform": "move(2.5, 0, 0) @ rot(0, 0, 90)" + }, + { + "identifier": "raw_floor_side", + "skip": "not face[5]", + "params": { + "height": "height", + "length": "2.5", + "is_left_sink": "PXPY_sink != 0", + "is_right_sink": "NXNY_sink != 0" + }, + "transform": "move(2.5, 2.5, 0) @ rot(0, 0, 180)" + }, + { + "identifier": "floor_bottom", + "skip": "not face[1]", + "params": { + "length": "2.5", + "width": "2.5" + }, + "transform": "move(0, 0, -height)" + } + ] + }, + { + "identifier": "floor_normal_inner_corner", + "showcase": { + "title": "Normal Inner Corner", + "icon": "NormalInnerCorner", + "type": "floor", + "cfgs": [ + { + "field": "height_", + "type": "float", + "title": "Height", + "desc": "The height of block.", + "default": "5.0" + }, + { + "field": "face_", + "type": "face", + "title": "Face", + "desc": "Whether has some faces.", + "default": "(True, False, False, False, False, False)" + } + ] + }, + "params": [ + { + "field": "height", + "data": "height_" + }, + { + "field": "face", + "data": "face_" + } + ], + "skip": "False", + "vars": [], + "vertices": [], + "faces": [], + "instances": [ + { + "identifier": "raw_floor_corner", + "skip": "False", + "params": { + "height": "height", + "face": "face", + "is_sink": "False", + "is_inner": "True", + "is_ribbon": "False" + }, + "transform": "ident()" + } + ] + }, + { + "identifier": "floor_sink_inner_corner", + "showcase": { + "title": "Sink Inner Corner", + "icon": "SinkInnerCorner", + "type": "floor", + "cfgs": [ + { + "field": "height_", + "type": "float", + "title": "Height", + "desc": "The height of block.", + "default": "5.0" + }, + { + "field": "face_", + "type": "face", + "title": "Face", + "desc": "Whether has some faces.", + "default": "(True, False, False, False, False, False)" + } + ] + }, + "params": [ + { + "field": "height", + "data": "height_" + }, + { + "field": "face", + "data": "face_" + } + ], + "skip": "False", + "vars": [], + "vertices": [], + "faces": [], + "instances": [ + { + "identifier": "raw_floor_corner", + "skip": "False", + "params": { + "height": "height", + "face": "face", + "is_sink": "True", + "is_inner": "True", + "is_ribbon": "False" + }, + "transform": "ident()" + } + ] + }, + { + "identifier": "floor_ribbon_inner_corner", + "showcase": { + "title": "Ribbon Inner Corner", + "icon": "RibbonInnerCorner", + "type": "floor", + "cfgs": [ + { + "field": "height_", + "type": "float", + "title": "Height", + "desc": "The height of block.", + "default": "5.0" + }, + { + "field": "face_", + "type": "face", + "title": "Face", + "desc": "Whether has some faces.", + "default": "(True, False, False, False, False, False)" + } + ] + }, + "params": [ + { + "field": "height", + "data": "height_" + }, + { + "field": "face", + "data": "face_" + } + ], + "skip": "False", + "vars": [], + "vertices": [], + "faces": [], + "instances": [ + { + "identifier": "raw_floor_corner", + "skip": "False", + "params": { + "height": "height", + "face": "face", + "is_sink": "True", + "is_inner": "True", + "is_ribbon": "True" + }, + "transform": "ident()" + } + ] + }, + { + "identifier": "floor_normal_outter_corner", + "showcase": { + "title": "Normal Outter Corner", + "icon": "NormalOutterCorner", + "type": "floor", + "cfgs": [ + { + "field": "height_", + "type": "float", + "title": "Height", + "desc": "The height of block.", + "default": "5.0" + }, + { + "field": "face_", + "type": "face", + "title": "Face", + "desc": "Whether has some faces.", + "default": "(True, False, True, False, True, False)" + } + ] + }, + "params": [ + { + "field": "height", + "data": "height_" + }, + { + "field": "face", + "data": "face_" + } + ], + "skip": "False", + "vars": [], + "vertices": [], + "faces": [], + "instances": [ + { + "identifier": "raw_floor_corner", + "skip": "False", + "params": { + "height": "height", + "face": "face", + "is_sink": "False", + "is_inner": "False", + "is_ribbon": "False" + }, + "transform": "ident()" + } + ] + }, + { + "identifier": "floor_sink_outter_corner", + "showcase": { + "title": "Sink Outter Corner", + "icon": "SinkOutterCorner", + "type": "floor", + "cfgs": [ + { + "field": "height_", + "type": "float", + "title": "Height", + "desc": "The height of block.", + "default": "5.0" + }, + { + "field": "face_", + "type": "face", + "title": "Face", + "desc": "Whether has some faces.", + "default": "(True, False, True, False, True, False)" + } + ] + }, + "params": [ + { + "field": "height", + "data": "height_" + }, + { + "field": "face", + "data": "face_" + } + ], + "skip": "False", + "vars": [], + "vertices": [], + "faces": [], + "instances": [ + { + "identifier": "raw_floor_corner", + "skip": "False", + "params": { + "height": "height", + "face": "face", + "is_sink": "True", + "is_inner": "False", + "is_ribbon": "False" + }, + "transform": "ident()" + } + ] + }, + { + "identifier": "floor_ribbon_outter_corner", + "showcase": { + "title": "Ribbon Outter Corner", + "icon": "RibbonOutterCorner", + "type": "floor", + "cfgs": [ + { + "field": "height_", + "type": "float", + "title": "Height", + "desc": "The height of block.", + "default": "5.0" + }, + { + "field": "face_", + "type": "face", + "title": "Face", + "desc": "Whether has some faces.", + "default": "(True, False, True, False, True, False)" + } + ] + }, + "params": [ + { + "field": "height", + "data": "height_" + }, + { + "field": "face", + "data": "face_" + } + ], + "skip": "False", + "vars": [], + "vertices": [], + "faces": [], + "instances": [ + { + "identifier": "raw_floor_corner", + "skip": "False", + "params": { + "height": "height", + "face": "face", + "is_sink": "True", + "is_inner": "False", + "is_ribbon": "True" + }, + "transform": "ident()" + } + ] + } +] \ No newline at end of file