Skip to content

Commit

Permalink
Revamped UI for spawners into subpanels, and consistent Shift-A order
Browse files Browse the repository at this point in the history
See more info in #222
  • Loading branch information
TheDuckCow committed Jan 2, 2022
1 parent 318fb14 commit 83891b5
Show file tree
Hide file tree
Showing 2 changed files with 591 additions and 477 deletions.
29 changes: 14 additions & 15 deletions MCprep_addon/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# ADDON GLOBAL VARIABLES AND INITIAL SETTINGS
# -----------------------------------------------------------------------------


def init():

# -----------------------------------------------
Expand All @@ -41,10 +42,10 @@ def init():
dev = True

global v
v = True # $VERBOSE, UI setting
v = True # $VERBOSE, UI setting

global vv
vv = dev # $VERYVERBOSE
vv = dev # $VERYVERBOSE

# -----------------------------------------------
# JSON attributes
Expand All @@ -55,8 +56,8 @@ def init():
global data
# import json

global json_data # mcprep_data.json
json_data = None # later will load addon information etc
global json_data # mcprep_data.json
json_data = None # later will load addon information etc

# if existing json_data_update exists, overwrite it
global json_path
Expand Down Expand Up @@ -86,13 +87,11 @@ def init():
global preview_collections
preview_collections = {}


# -----------------------------------------------
# For initializing the custom icons
# -----------------------------------------------
icons_init()


# -----------------------------------------------
# For cross-addon lists
# -----------------------------------------------
Expand All @@ -104,15 +103,14 @@ def init():
loaded_all_spawners = False

global skin_list
skin_list = [] # each is: [ basename, path ]
skin_list = [] # each is: [ basename, path ]

global rig_categories
rig_categories = [] # simple list of directory names
rig_categories = [] # simple list of directory names

global entity_list
entity_list = []


# -----------------------------------------------
# Matieral sync cahce, to avoid repeat lib reads
# -----------------------------------------------
Expand All @@ -135,21 +133,22 @@ def icons_init():
global preview_collections
global v

collection_sets = ["main", "skins", "mobs", "entities", "blocks", "items", "materials"]
collection_sets = [
"main", "skins", "mobs", "entities", "blocks", "items", "materials"]

try:
for iconset in collection_sets:
preview_collections[iconset] = bpy.utils.previews.new()

script_path = bpy.path.abspath(os.path.dirname(__file__))
icons_dir = os.path.join(script_path,'icons')
icons_dir = os.path.join(script_path, 'icons')
preview_collections["main"].load(
"crafting_icon",
os.path.join(icons_dir, "crafting_icon.png"),
'IMAGE')
preview_collections["main"].load(
"grass_icon",
os.path.join(icons_dir, "grass_icon.png"),
"meshswap_icon",
os.path.join(icons_dir, "meshswap_icon.png"),
'IMAGE')
preview_collections["main"].load(
"spawner_icon",
Expand All @@ -169,7 +168,7 @@ def icons_init():
'IMAGE')
except Exception as e:
log("Old verison of blender, no custom icons available")
log("\t"+str(e))
log("\t" + str(e))
global use_icons
use_icons = False
for iconset in collection_sets:
Expand Down Expand Up @@ -202,7 +201,7 @@ def unregister():
try:
bpy.utils.previews.remove(pcoll)
except:
log('Issue clearing preview set '+str(pcoll))
log('Issue clearing preview set ' + str(pcoll))
preview_collections.clear()

global json_data
Expand Down

0 comments on commit 83891b5

Please sign in to comment.