[Bf-extensions-cvs] [1b1b58b2] master: BlenderKit: reorganize panels to subpanels

Vilém Duha noreply at git.blender.org
Wed Jul 1 16:13:04 CEST 2020


Commit: 1b1b58b2ab1c57171c160e0b0663acf9b1a61220
Author: Vilém Duha
Date:   Wed Jun 24 14:04:23 2020 +0200
Branches: master
https://developer.blender.org/rBA1b1b58b2ab1c57171c160e0b0663acf9b1a61220

BlenderKit: reorganize panels to subpanels

makes categories ando others foldable.
rename advanced search to search filters, these now work always when switched on (previously the 'advanced' option switched them all on/off)

===================================================================

M	blenderkit/search.py
M	blenderkit/ui_panels.py

===================================================================

diff --git a/blenderkit/search.py b/blenderkit/search.py
index cf662f4d..9dab75da 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -1003,23 +1003,23 @@ def build_query_common(query, props):
     if props.search_verification_status != 'ALL':
         query_common['verification_status'] = props.search_verification_status.lower()
 
-    if props.search_advanced:
-        if props.search_texture_resolution:
-            query["textureResolutionMax_gte"] = props.search_texture_resolution_min
-            query["textureResolutionMax_lte"] = props.search_texture_resolution_max
-
-        elif props.search_procedural == 'TEXTURE_BASED':
-            # todo this procedural hack should be replaced with the parameter
-            query["textureResolutionMax_gte"] = 0
-            # query["procedural"] = False
-
-        if props.search_procedural == "PROCEDURAL":
-            # todo this procedural hack should be replaced with the parameter
-            query["files_size_lte"] = 1024 * 1024
-            # query["procedural"] = True
-        elif props.search_file_size:
-            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.search_advanced:
+    if props.search_texture_resolution:
+        query["textureResolutionMax_gte"] = props.search_texture_resolution_min
+        query["textureResolutionMax_lte"] = props.search_texture_resolution_max
+
+    elif props.search_procedural == 'TEXTURE_BASED':
+        # todo this procedural hack should be replaced with the parameter
+        query["textureResolutionMax_gte"] = 0
+        # query["procedural"] = False
+
+    if props.search_procedural == "PROCEDURAL":
+        # todo this procedural hack should be replaced with the parameter
+        query["files_size_lte"] = 1024 * 1024
+        # query["procedural"] = True
+    elif props.search_file_size:
+        query_common["files_size_gte"] = props.search_file_size_min * 1024 * 1024
+        query_common["files_size_lte"] = props.search_file_size_max * 1024 * 1024
 
     query.update(query_common)
 
@@ -1042,15 +1042,15 @@ def build_query_model():
     if props.free_only:
         query["is_free"] = True
 
-    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
-        if props.search_polycount:
-            query["faceCount_gte"] = props.search_polycount_min
-            query["faceCount_lte"] = props.search_polycount_max
+    # 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
+    if props.search_polycount:
+        query["faceCount_gte"] = props.search_polycount_min
+        query["faceCount_lte"] = props.search_polycount_max
 
     build_query_common(query, props)
 
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index a1fb89d2..9ac11c54 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -332,60 +332,8 @@ def draw_panel_model_search(self, context):
     # layout.prop(props, 'append_link', expand=True, icon_only=False)
     # layout.prop(props, 'import_as', expand=True, icon_only=False)
 
-    layout.prop(props, "search_advanced")
-    if props.search_advanced:
-        layout.separator()
+    # draw_panel_categories(self, context)
 
-        # layout.label(text = "common searches keywords:")
-        # layout.prop(props, "search_global_keywords", text = "")
-        # layout.prop(props, "search_modifier_keywords")
-        # if props.search_engine == 'OTHER':
-        #     layout.prop(props, "search_engine_keyword")
-
-        # AGE
-        layout.prop(props, "search_condition", text='Condition')  # , text ='condition of object new/old e.t.c.')
-
-        # DESIGN YEAR
-        layout.prop(props, "search_design_year", text='designed in ( min - max )')
-        if props.search_design_year:
-            row = layout.row(align=True)
-            row.prop(props, "search_design_year_min", text='min')
-            row.prop(props, "search_design_year_max", text='max')
-
-        # POLYCOUNT
-        layout.prop(props, "search_polycount", text='Poly count in ( min - max )')
-        if props.search_polycount:
-            row = layout.row(align=True)
-            row.prop(props, "search_polycount_min", text='min')
-            row.prop(props, "search_polycount_max", text='max')
-
-        # TEXTURE RESOLUTION
-        layout.prop(props, "search_texture_resolution", text='texture resolution ( min - max )')
-        if props.search_texture_resolution:
-            row = layout.row(align=True)
-            row.prop(props, "search_texture_resolution_min", text='min')
-            row.prop(props, "search_texture_resolution_max", text='max')
-
-        # FILE SIZE
-        layout.prop(props, "search_file_size", text='File size ( min - max )')
-        if props.search_file_size:
-            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, "search_procedural", expand=True)
-        # ADULT
-        # layout.prop(props, "search_adult")  # , text ='condition of object new/old e.t.c.')
-
-    draw_panel_categories(self, context)
-
-    layout.separator()
-    layout.label(text='Import method:')
-    row = layout.row()
-    row.prop(props, 'append_method', expand=True, icon_only=False)
-    layout.prop(props, 'randomize_rotation')
-    if props.randomize_rotation:
-        layout.prop(props, 'randomize_rotation_amount')
 
 
 def draw_panel_scene_search(self, context):
@@ -404,7 +352,7 @@ def draw_panel_scene_search(self, context):
     #     layout.prop(props, "search_style_other")
     # layout.prop(props, "search_engine")
     layout.separator()
-    draw_panel_categories(self, context)
+    # draw_panel_categories(self, context)
 
 
 class VIEW3D_PT_blenderkit_model_properties(Panel):
@@ -438,6 +386,7 @@ class VIEW3D_PT_blenderkit_model_properties(Panel):
             layout.label(text='Ratings:')
             draw_panel_model_rating(self, context)
 
+            layout.label(text='Asset tools:')
             draw_asset_context_menu(self, context, ad)
             # if 'rig' in ad['tags']:
             #     # layout.label(text = 'can make proxy')
@@ -539,7 +488,9 @@ class VIEW3D_PT_blenderkit_login(Panel):
 
 
 def draw_panel_model_rating(self, context):
-    o = bpy.context.active_object
+    # o = bpy.context.active_object
+    o = utils.get_active_model()
+    # print('ratings active',o)
     draw_ratings(self.layout, context)  # , props)
     # op.asset_type = 'MODEL'
 
@@ -614,32 +565,10 @@ def draw_panel_material_search(self, context):
     # if props.search_engine == 'OTHER':
     #     layout.prop(props, 'search_engine_other')
 
-    layout.prop(props, "search_advanced")
-    if props.search_advanced:
-        layout.separator()
-
-        layout.label(text='texture types')
-        col = layout.column()
-        col.prop(props, "search_procedural", expand=True)
-
-        if props.search_procedural == 'TEXTURE_BASED':
-            # TEXTURE RESOLUTION
-            layout.prop(props, "search_texture_resolution", text='texture resolution ( min - max )')
-            if props.search_texture_resolution:
-                row = layout.row(align=True)
-                row.prop(props, "search_texture_resolution_min", text='min')
-                row.prop(props, "search_texture_resolution_max", text='max')
 
-        # FILE SIZE
-        layout.prop(props, "search_file_size", text='File size ( min - max in mb)')
-        if props.search_file_size:
-            row = layout.row(align=True)
-            row.prop(props, "search_file_size_min", text='min')
-            row.prop(props, "search_file_size_max", text='max')
 
-    draw_panel_categories(self, context)
+    # draw_panel_categories(self, context)
 
-    layout.prop(props, 'automap')
 
 
 def draw_panel_material_ratings(self, context):
@@ -672,7 +601,7 @@ def draw_panel_brush_search(self, context):
     layout.prop(props, "own_only")
 
     label_multiline(layout, text=props.report)
-    draw_panel_categories(self, context)
+    # draw_panel_categories(self, context)
 
 
 def draw_panel_brush_ratings(self, context):
@@ -704,14 +633,18 @@ def draw_login_buttons(layout):
 class VIEW3D_PT_blenderkit_advanced_model_search(Panel):
     bl_category = "BlenderKit"
     bl_idname = "VIEW3D_PT_blenderkit_advanced_model_search"
-    # bl_parent_id = "VIEW3D_PT_blenderkit_unified"
+    bl_parent_id = "VIEW3D_PT_blenderkit_unified"
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'UI'
-    bl_label = "Advanced search options"
+    bl_label = "Search filters"
+    bl_options = {'DEFAULT_CLOSED'}
+
 
     @classmethod
     def poll(cls, context):
-        return True
+        s = context.scene
+        ui_props = s.blenderkitUI
+        return ui_props.down_up == 'SEARCH' and ui_props.asset_type =='MODEL'
 
     def draw(self, context):
         s = context.scene
@@ -761,6 +694,99 @@ class VIEW3D_PT_blenderkit_advanced_model_search(Panel):
         # ADULT
         # layout.prop(props, "search_adult")  # , text ='condition of object new/old e.t.c.')
 
+class VIEW3D_PT_blenderkit_advanced_material_search(Panel):
+    bl_category = "BlenderKit"
+    bl_idname = "VIEW3D_PT_blenderkit_advanced_material_search"
+    bl_parent_id = "VIEW3D_PT_blenderkit_unified"
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'UI'
+    bl_label = "Search filters"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        s = context.scene
+        ui_props = s.blenderkitUI
+        return ui_props.down_up == 'SEARCH' and ui_props.asset_type =='MATERIAL'
+
+    def draw(self, context):
+        s = co

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list