Files
BallanceBlenderHelper/scripts/common.py
yyc12345 9e65d258d7 refactor: use JSON5 instead of JSON for BME prototype.
- use JSON5 for BME prototype description file instead of JSON to make us have ability that make comment in declaration files (TBD in future).
- upgrade corresponding scripts.
- confirm the finish of upgrading script into modern Python.
2025-07-29 21:14:02 +08:00

43 lines
1.0 KiB
Python

import logging, enum, typing
from pathlib import Path
def get_root_folder() -> Path:
"""
Get the path to the root folder of this repository.
:return: The absolute path to the root folder of this repository.
"""
return Path(__file__).resolve().parent.parent
class AssetKind(enum.StrEnum):
Icons = 'icons'
Jsons = 'jsons'
Meshes = 'meshes'
def get_raw_assets_folder(kind: AssetKind) -> Path:
"""
Get the path to the raw assets folder of given kind.
:return: The absolute path to the raw assets folder of given kind.
"""
return get_root_folder() / 'assets' / str(kind)
def get_plugin_assets_folder(kind: AssetKind) -> Path:
"""
Get the path to the plugin assets folder of given kind.
:return: The absolute path to the plugin assets folder of given kind.
"""
return get_root_folder() / 'bbp_ng' / str(kind)
def setup_logging() -> None:
"""
Setup uniform style for logging module.
"""
logging.basicConfig(format='[%(levelname)s] %(message)s', level=logging.INFO)