diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py index d69f3e0dde320fd953db01e7d14de23bfd6b3723..ceca7207edb3b38ff17845cf66e1d14e7a9f961a 100644 --- a/blenderkit/__init__.py +++ b/blenderkit/__init__.py @@ -682,9 +682,14 @@ class BlenderKitCommonUploadProps(object): ) subcategory: EnumProperty( name="Subcategory", - description="main category to put into", + description="Subcategory to put into", items=categories.get_subcategory_enums ) + subcategory1: EnumProperty( + name="Subcategory lvl2", + description="Subcategory to put into", + items=categories.get_subcategory1_enums + ) class BlenderKitRatingProps(PropertyGroup): diff --git a/blenderkit/categories.py b/blenderkit/categories.py index 43d6f2ba9b5305c4a6612faabf1122a2752c290e..abdfbe48aef58e287d2f35813431b8b592a5171f 100644 --- a/blenderkit/categories.py +++ b/blenderkit/categories.py @@ -112,8 +112,6 @@ def get_upload_asset_type(self): return asset_type - - def get_category_enums(self, context): wm = bpy.context.window_manager props = bpy.context.scene.blenderkitUI @@ -123,6 +121,8 @@ def get_category_enums(self, context): items = [] for c in asset_categories['children']: items.append((c['slug'], c['name'], c['description'])) + if len(items) == 0: + items.append(('NONE', '', 'no categories on this level defined')) return items def get_subcategory_enums(self, context): @@ -134,7 +134,9 @@ def get_subcategory_enums(self, context): asset_categories = get_category(wm['bkit_categories'], cat_path=(asset_type, self.category,)) for c in asset_categories['children']: items.append((c['slug'], c['name'], c['description'])) - + if len(items) == 0: + items.append(('NONE', '', 'no categories on this level defined')) + # print('subcategory', items) return items def get_subcategory1_enums(self, context): @@ -146,7 +148,8 @@ def get_subcategory1_enums(self, context): asset_categories = get_category(wm['bkit_categories'], cat_path=(asset_type, self.category, self.subcategory, )) for c in asset_categories['children']: items.append((c['slug'], c['name'], c['description'])) - + if len(items) == 0: + items.append(('NONE', '', 'no categories on this level defined')) return items def copy_categories(): diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py index 9d5777a1ad8cec010479e0c87a97c87bc9514c78..c4ed5e40e7be1761e826e21bdb6895bd9111be5a 100644 --- a/blenderkit/ui_panels.py +++ b/blenderkit/ui_panels.py @@ -110,7 +110,6 @@ def draw_upload_common(layout, props, asset_type, context): if props.upload_state != '': utils.label_multiline(layout, text=props.upload_state, width=context.region.width) if props.uploading: - print(bpy.context.scene.name) op = layout.operator('object.kill_bg_process', text="", icon='CANCEL') op.process_source = asset_type op.process_type = 'UPLOAD' @@ -142,10 +141,11 @@ def draw_upload_common(layout, props, asset_type, context): # row = layout.row() # row.enabled = False # row.prop(props, 'id', icon='FILE_TICK') - layout.prop(props, 'category') - if asset_type == 'MODEL' and props.subcategory != '': # by now block this for other asset types. + if props.category != 'NONE' and props.subcategory != 'NONE': layout.prop(props, 'subcategory') + if props.subcategory != 'NONE' and props.subcategory1 != 'NONE': + layout.prop(props, 'subcategory1') layout.prop(props, 'is_private', expand=True) if props.is_private == 'PUBLIC':