Skip to content

Commit

Permalink
Replaced UAS Categories with Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Aug 15, 2024
1 parent 396d36b commit 3014344
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 133 deletions.
157 changes: 91 additions & 66 deletions Mcblend Source/Assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,36 @@ def append_asset(asset_name, asset_category):
Absolute_Solver(tech_things=traceback.print_exc(), data=asset_name, error_name="Bad Asset Import", description="Can't Import {Data} Asset")

def update_assets():
items = bpy.context.scene.assetsproperties.asset_items
items.clear()

all_keys = []
# Assets

for category, assets in Assets.items():
for key in assets.keys():
all_keys.append(key)
items = bpy.context.scene.assetsproperties.asset_items
items.clear()

for key in sorted(all_keys):
dprint(sorted(Assets.keys()))
for key in sorted(Assets.keys()):
dprint(key)
item = items.add()
item.name = key

# Tags

tags = bpy.context.scene.assetsproperties.tags
tags.clear()
unique_tags = set()

for asset_data in Assets.values():
asset_tags = asset_data.get("Tags", [])
unique_tags.update(asset_tags)

unique_tags.add("All")
unique_tags = sorted(unique_tags)

for tag in unique_tags:
item = tags.add()
item.name = tag
if tag == "All":
item.enabled = True

def run_python_script(file_path):

Expand All @@ -70,71 +88,78 @@ def import_all_from_module(module_name, module_path=None):
Absolute_Solver(tech_things=traceback.print_exc(), data=file_path, error_name="Bad Script Execution", description="Can't Execute Script from {Data}")

Assets = {
"Rigs": {
"SRE V2.0": {
"Blender_version": "4.x.x",
"File_name": "Simple_edit_V2.0.blend",
"Collection_name": "SRE rig"
},

"SRE V2.0b732": {
"Blender_version": "3.6.x",
"File_name": "Simple_edit_V2.0b732.blend",
"Collection_name": "SRE rig"
},

"Creeper": {
"Blender_version": "4.x.x",
"File_name": "Creeper.blend",
"Collection_name": "Creeper"
},

"Allay": {
"Blender_version": "4.x.x",
"File_name": "Allay.blend",
"Collection_name": "Simple Allay"
},

"Axolotl": {
"Blender_version": "4.x.x",
"File_name": "Axolotl.blend",
"Collection_name": "Axolotl"
},

"Warden": {
"Blender_version": "4.x.x",
"File_name": "Warden.blend",
"Collection_name": "Warden"
},
"SRE V2.0": {
"Blender_version": "4.x.x",
"File_name": "Simple_edit_V2.0.blend",
"Collection_name": "SRE rig",
"Tags": ["Rig", "Vanilla"]
},

"Scripts": {
"SRE V2.0b732": {
"Blender_version": "3.6.x",
"File_name": "Simple_edit_V2.0b732.blend",
"Collection_name": "SRE rig",
"Tags": ["Rig", "Vanilla"]
},

"Sleep After Render": {
"File_name": "Sleep After Render.py",
},
"Creeper": {
"Blender_version": "4.x.x",
"File_name": "Creeper.blend",
"Collection_name": "Creeper",
"Tags": ["Rig", "Vanilla"]
},

"Convert DBSDF 2 PBSDF": {
"File_name": "Convert DBSDF 2 PBSDF.py",
},
"Allay": {
"Blender_version": "4.x.x",
"File_name": "Allay.blend",
"Collection_name": "Simple Allay",
"Tags": ["Rig", "Vanilla"]
},

"Fix Shade Auto Smooth": {
"Blender_version": "< 4.1.0",
"File_name": "Fix Shade Auto Smooth.py",
},
"Axolotl": {
"Blender_version": "4.x.x",
"File_name": "Axolotl.blend",
"Collection_name": "Axolotl",
"Tags": ["Rig", "Vanilla"]
},

"Warden": {
"Blender_version": "4.x.x",
"File_name": "Warden.blend",
"Collection_name": "Warden",
"Tags": ["Rig", "Vanilla"]
},

"Enable Jittered Shadows": {
"Blender_version": ">= 4.2.0",
"File_name": "Jittered Shadows.py",
},
"Sleep After Render": {
"File_name": "Sleep After Render.py",
"Tags": ["Script"]
},

"Convert DBSDF 2 PBSDF": {
"File_name": "Convert DBSDF 2 PBSDF.py",
"Tags": ["Script"]
},

"Enable Contact Shadows": {
"Blender_version": "< 4.2.0",
"File_name": "Contact Shadows.py",
},
"Fix Shade Auto Smooth": {
"Blender_version": "< 4.1.0",
"File_name": "Fix Shade Auto Smooth.py",
"Tags": ["Script"]
},

"Enable Jittered Shadows": {
"Blender_version": ">= 4.2.0",
"File_name": "Jittered Shadows.py",
"Tags": ["Script"]
},

"Enable Contact Shadows": {
"Blender_version": "< 4.2.0",
"File_name": "Contact Shadows.py",
"Tags": ["Script"]
},

"ACES Textures Fix": {
"File_name": "ACES Textures Fix.py",
},
"ACES Textures Fix": {
"File_name": "ACES Textures Fix.py",
"Tags": ["Script"]
},
}
}
35 changes: 26 additions & 9 deletions Mcblend Source/Properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,21 +754,38 @@ class UtilsProperties(PropertyGroup):



class AssetTagItem(bpy.types.PropertyGroup):
name: bpy.props.StringProperty()
enabled: bpy.props.BoolProperty(default=False)

class AssetsProperties(PropertyGroup):

asset_index: bpy.props.IntProperty(
default=0
)

def categories():
categories = [('All', "All", "")]
categories.extend([(cat, cat, "") for cat in Assets.keys()])
return categories
def get_tags():
unique_tags = set()

for asset_data in Assets.values():
tags = asset_data.get("Tags", [])
unique_tags.update(tags)

unique_tags = sorted(unique_tags)
return [('All', "All", "")] + [(tag, tag, "") for tag in unique_tags]

filters: bpy.props.BoolProperty(
name="Filters",
description="",
default=False
)

sort_by_version: bpy.props.BoolProperty(
name="Sort By Version",
description="",
default=True
)

asset_category: bpy.props.EnumProperty(
name="Category",
items=categories(),
default='All',
)
tags: bpy.props.CollectionProperty(type=AssetTagItem)

asset_items: bpy.props.CollectionProperty(type=PropertyGroup)
Loading

0 comments on commit 3014344

Please sign in to comment.