[feat] promote experience about floor creation.
- change bl_options and rewrite invoke and draw functions to let floor creating window become more visual. credit: BLumia. - also change 3ds max align and flatten uv presentation after changing creating floor window. - seperate icon loader/unload module.
This commit is contained in:
30
ballance_blender_plugin/UTILS_icons_manager.py
Normal file
30
ballance_blender_plugin/UTILS_icons_manager.py
Normal file
@ -0,0 +1,30 @@
|
||||
import bpy
|
||||
import bpy.utils.previews
|
||||
import os
|
||||
from . import UTILS_constants
|
||||
|
||||
# ImagePreviewCollection ccreated by Blender
|
||||
floor_icons = None
|
||||
# a map. key is block name, value is loaded icon id
|
||||
floor_icons_map: dict = {}
|
||||
|
||||
def register_icons():
|
||||
global floor_icons, floor_icons_map
|
||||
|
||||
icon_path = os.path.join(os.path.dirname(__file__), "icons")
|
||||
floor_icons = bpy.utils.previews.new()
|
||||
for key, value in UTILS_constants.floor_blockDict.items():
|
||||
blockIconName = "Ballance_FloorIcon_" + key
|
||||
floor_icons.load(blockIconName, os.path.join(icon_path, "floor", value["BindingDisplayTexture"]), 'IMAGE')
|
||||
floor_icons_map[key] = floor_icons[blockIconName].icon_id
|
||||
|
||||
def unregister_icons():
|
||||
global floor_icons, floor_icons_map
|
||||
|
||||
bpy.utils.previews.remove(floor_icons)
|
||||
floor_icons_map.clear()
|
||||
|
||||
def get_floor_icon(floor_blk_name: str):
|
||||
global floor_icons_map
|
||||
|
||||
return floor_icons_map[floor_blk_name]
|
Reference in New Issue
Block a user