BlenderKit: optimize store_rating_local_empty
Add quality limit slider for models and materials search
This commit is contained in:
parent
7a871722ab
commit
0a34d11883
|
@ -569,6 +569,9 @@ class BlenderKitCommonSearchProps(object):
|
|||
|
||||
unrated_only: BoolProperty(name="Unrated only", description="Show only unrated models",
|
||||
default=False, update=search.search_update)
|
||||
quality_limit: IntProperty(name="Quality limit",
|
||||
description = 'Only show assets with a higher quality',
|
||||
default=0, min=0, max=10, update=search.search_update)
|
||||
|
||||
|
||||
def name_update(self, context):
|
||||
|
|
|
@ -70,8 +70,8 @@ def send_rating_to_thread_work_hours(url, ratings, headers):
|
|||
|
||||
def store_rating_local_empty(asset_id):
|
||||
context = bpy.context
|
||||
context.window_manager['asset ratings'] = context.window_manager.get('asset ratings', {})
|
||||
context.window_manager['asset ratings'][asset_id] = context.window_manager['asset ratings'].get(asset_id, {})
|
||||
ar = context.window_manager['asset ratings']
|
||||
ar[asset_id] = ar.get(asset_id, {})
|
||||
|
||||
|
||||
def store_rating_local(asset_id, type='quality', value=0):
|
||||
|
|
|
@ -1081,6 +1081,9 @@ def build_query_common(query, props):
|
|||
query_common["files_size_gte"] = props.search_file_size_min * 1024 * 1024
|
||||
query_common["files_size_lte"] = props.search_file_size_max * 1024 * 1024
|
||||
|
||||
if props.quality_limit > 0:
|
||||
query["quality_gte"] = props.quality_limit
|
||||
|
||||
query.update(query_common)
|
||||
|
||||
|
||||
|
@ -1106,6 +1109,7 @@ def build_query_model():
|
|||
# if props.search_advanced:
|
||||
if props.search_condition != 'UNSPECIFIED':
|
||||
query["condition"] = props.search_condition
|
||||
|
||||
if props.search_design_year:
|
||||
query["designYear_gte"] = props.search_design_year_min
|
||||
query["designYear_lte"] = props.search_design_year_max
|
||||
|
|
|
@ -819,6 +819,7 @@ class VIEW3D_PT_blenderkit_advanced_model_search(Panel):
|
|||
|
||||
# AGE
|
||||
layout.prop(props, "search_condition", text='Condition') # , text ='condition of object new/old e.t.c.')
|
||||
layout.prop(props, "quality_limit", slider=True) # , text ='condition of object new/old e.t.c.')
|
||||
|
||||
# layout.prop(props, "search_procedural", expand=True)
|
||||
# ADULT
|
||||
|
@ -867,7 +868,7 @@ class VIEW3D_PT_blenderkit_advanced_material_search(Panel):
|
|||
row = layout.row(align=True)
|
||||
row.prop(props, "search_file_size_min", text='Min')
|
||||
row.prop(props, "search_file_size_max", text='Max')
|
||||
|
||||
layout.prop(props, "quality_limit", slider=True)
|
||||
|
||||
class VIEW3D_PT_blenderkit_categories(Panel):
|
||||
bl_category = "BlenderKit"
|
||||
|
|
Loading…
Reference in New Issue