BlenderKit: replace freebies category with free_only checkbox. Helps searching free models.

This commit is contained in:
Vilem Duha 2019-05-20 14:02:08 +02:00
parent b37ee1a95a
commit 81e8607179
3 changed files with 13 additions and 5 deletions

View File

@ -1063,6 +1063,9 @@ class BlenderKitModelSearchProps(PropertyGroup, BlenderKitCommonSearchProps):
update=search.search_update
)
free_only: BoolProperty(name="Free only", description="show only free models.",
default=False)
search_advanced: BoolProperty(name="Advanced Search Options", description="use advanced search properties",
default=False)

View File

@ -838,6 +838,10 @@ def build_query_model():
query["model_style"] = props.search_style
else:
query["model_style"] = props.search_style_other
if props.free_only:
query["is_free"] = True
if props.search_advanced:
if props.search_condition != 'UNSPECIFIED':
query["condition"] = props.search_condition
@ -1012,8 +1016,8 @@ def search(own=False, category='', get_next=False, free_only=False):
'get_next': get_next
}
if free_only:
query['keywords'] += '+is_free:true'
# if free_only:
# query['keywords'] += '+is_free:true'
add_search_process(query, params)
props.report = 'BlenderKit searching....'

View File

@ -280,6 +280,7 @@ def draw_panel_model_search(self, context):
layout.operator("wm.url_open", text="Check plans", icon='URL').url = paths.BLENDERKIT_PLANS
layout.prop(props, "search_style")
layout.prop(props, "free_only")
# if props.search_style == 'OTHER':
# layout.prop(props, "search_style_other")
# layout.prop(props, "search_engine")
@ -750,9 +751,9 @@ def draw_panel_categories(self, context):
op.category = ''
cats = categories.get_category(wm['bkit_categories'], cat_path=acat)
# draw freebies only in models parent category
if ui_props.asset_type == 'MODEL' and len(acat) == 1:
op = col.operator('view3d.blenderkit_asset_bar', text='freebies')
op.free_only = True
# if ui_props.asset_type == 'MODEL' and len(acat) == 1:
# op = col.operator('view3d.blenderkit_asset_bar', text='freebies')
# op.free_only = True
for c in cats['children']:
if c['assetCount'] > 0: