Merge branch 'blender-v2.92-release'
This commit is contained in:
commit
45d82fde52
|
@ -696,12 +696,14 @@ class BlenderKitCommonUploadProps(object):
|
|||
category: EnumProperty(
|
||||
name="Category",
|
||||
description="main category to put into",
|
||||
items=categories.get_category_enums
|
||||
items=categories.get_category_enums,
|
||||
update=categories.update_category_enums
|
||||
)
|
||||
subcategory: EnumProperty(
|
||||
name="Subcategory",
|
||||
description="Subcategory to put into",
|
||||
items=categories.get_subcategory_enums
|
||||
items=categories.get_subcategory_enums,
|
||||
update=categories.update_subcategory_enums
|
||||
)
|
||||
subcategory1: EnumProperty(
|
||||
name="Subcategory lvl2",
|
||||
|
|
|
@ -106,6 +106,18 @@ def get_category(categories, cat_path=()):
|
|||
# asset_type = typemapper[type(self)]
|
||||
# return asset_type
|
||||
|
||||
def update_category_enums(self,context):
|
||||
'''Fixes if lower level is empty - sets it to None, because enum value can be higher.'''
|
||||
enums = get_subcategory_enums(self,context)
|
||||
if enums[0][0] == 'NONE' and self.subcategory != 'NONE':
|
||||
self.subcategory = 'NONE'
|
||||
|
||||
def update_subcategory_enums(self,context):
|
||||
'''Fixes if lower level is empty - sets it to None, because enum value can be higher.'''
|
||||
enums = get_subcategory1_enums(self,context)
|
||||
if enums[0][0] == 'NONE' and self.subcategory1 != 'NONE':
|
||||
self.subcategory1 = 'NONE'
|
||||
|
||||
|
||||
def get_category_enums(self, context):
|
||||
wm = bpy.context.window_manager
|
||||
|
@ -192,7 +204,10 @@ def fetch_categories(API_key, force = False):
|
|||
|
||||
tempdir = paths.get_temp_dir()
|
||||
categories_filepath = os.path.join(tempdir, 'categories.json')
|
||||
catfile_age = time.time() - os.path.getmtime(categories_filepath)
|
||||
if os.path.exists(categories_filepath):
|
||||
catfile_age = time.time() - os.path.getmtime(categories_filepath)
|
||||
else:
|
||||
catfile_age = 10000000
|
||||
|
||||
# global catfetch_counter
|
||||
# catfetch_counter += 1
|
||||
|
|
|
@ -1368,7 +1368,10 @@ def search(category='', get_next=False, author_id=''):
|
|||
return;
|
||||
|
||||
if category != '':
|
||||
query['category_subtree'] = category
|
||||
if utils.profile_is_validator():
|
||||
query['category'] = category
|
||||
else:
|
||||
query['category_subtree'] = category
|
||||
|
||||
if author_id != '':
|
||||
query['author_id'] = author_id
|
||||
|
|
|
@ -1592,9 +1592,9 @@ def draw_panel_categories(self, context):
|
|||
# op.free_only = True
|
||||
|
||||
for c in cats['children']:
|
||||
if c['assetCount'] > 0:
|
||||
if c['assetCount'] > 0 or utils.profile_is_validator():
|
||||
row = col.row(align=True)
|
||||
if len(c['children']) > 0 and c['assetCount'] > 15:
|
||||
if len(c['children']) > 0 and c['assetCount'] > 15 or utils.profile_is_validator():
|
||||
row = row.split(factor=.8, align=True)
|
||||
# row = split.split()
|
||||
ctext = '%s (%i)' % (c['name'], c['assetCount'])
|
||||
|
@ -1608,7 +1608,7 @@ def draw_panel_categories(self, context):
|
|||
op.keep_running = True
|
||||
op.category = c['slug']
|
||||
# TODO enable subcategories, now not working due to some bug on server probably
|
||||
if len(c['children']) > 0 and c['assetCount'] > 15:
|
||||
if len(c['children']) > 0 and c['assetCount'] > 15 or utils.profile_is_validator():
|
||||
# row = row.split()
|
||||
op = row.operator('view3d.blenderkit_set_category', text='>>')
|
||||
op.asset_type = ui_props.asset_type
|
||||
|
|
|
@ -564,12 +564,14 @@ class FastMetadata(bpy.types.Operator):
|
|||
category: EnumProperty(
|
||||
name="Category",
|
||||
description="main category to put into",
|
||||
items=categories.get_category_enums
|
||||
items=categories.get_category_enums,
|
||||
update=categories.update_category_enums
|
||||
)
|
||||
subcategory: EnumProperty(
|
||||
name="Subcategory",
|
||||
description="main category to put into",
|
||||
items=categories.get_subcategory_enums
|
||||
items=categories.get_subcategory_enums,
|
||||
update = categories.update_subcategory_enums
|
||||
)
|
||||
subcategory1: EnumProperty(
|
||||
name="Subcategory",
|
||||
|
@ -608,7 +610,9 @@ class FastMetadata(bpy.types.Operator):
|
|||
if self.category != 'NONE' and self.subcategory != 'NONE':
|
||||
layout.prop(self, 'subcategory')
|
||||
if self.subcategory != 'NONE' and self.subcategory1 != 'NONE':
|
||||
layout.prop(self, 'subcategory1')
|
||||
enums = categories.get_subcategory1_enums(self, context)
|
||||
if enums[0][0]!='NONE':
|
||||
layout.prop(self, 'subcategory1')
|
||||
layout.prop(self, 'name')
|
||||
layout.prop(self, 'description')
|
||||
layout.prop(self, 'tags')
|
||||
|
@ -668,7 +672,8 @@ class FastMetadata(bpy.types.Operator):
|
|||
self.subcategory = cat_path[2]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.message = f"Recategorize asset {asset_data['name']}"
|
||||
self.message = f"Fast edit metadata of {asset_data['name']}"
|
||||
self.message = str(cat_path)
|
||||
self.name = asset_data['displayName']
|
||||
self.description = asset_data['description']
|
||||
self.tags = ','.join(asset_data['tags'])
|
||||
|
@ -679,6 +684,7 @@ class FastMetadata(bpy.types.Operator):
|
|||
self.license = asset_data['license']
|
||||
|
||||
wm = context.window_manager
|
||||
|
||||
return wm.invoke_props_dialog(self, width = 600)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue