[Bf-blender-cvs] [4d5b6409eeb] property-search-ui: Property Search: Expose layout flag to RNA, use for modifiers

Hans Goudey noreply at git.blender.org
Wed Jun 17 19:15:39 CEST 2020


Commit: 4d5b6409eebc94d95ee2a3981b3fb73ada04f84a
Author: Hans Goudey
Date:   Wed Jun 17 13:15:26 2020 -0400
Branches: property-search-ui
https://developer.blender.org/rB4d5b6409eebc94d95ee2a3981b3fb73ada04f84a

Property Search: Expose layout flag to RNA, use for modifiers

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/editors/interface/interface_layout.c
M	source/blender/makesrna/intern/rna_ui.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index e7536838199..54ae203ed43 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -39,6 +39,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.use_property_search = False
         layout.operator_menu_enum("object.modifier_add", "type")
         layout.template_modifiers()
 
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 944c3f1e1a7..b671b8b7fd8 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -140,7 +140,7 @@ enum {
    * Enabled by default, depends on 'UI_ITEM_PROP_SEP'. */
   UI_ITEM_PROP_DECORATE = 1 << 5,
   UI_ITEM_PROP_DECORATE_NO_PAD = 1 << 6,
-  UI_ITEM_USE_SEARCH_FILTER = 1 << 7, /* HANS-TODO: Expose to RNA, comment. */
+  UI_ITEM_USE_SEARCH_FILTER = 1 << 7,
 };
 
 typedef struct uiButtonItem {
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 5228f00d0de..bb343ab8e01 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -1151,6 +1151,16 @@ static void rna_UILayout_property_decorate_set(PointerRNA *ptr, bool value)
   uiLayoutSetPropDecorate(ptr->data, value);
 }
 
+static bool rna_UILayout_property_search_get(PointerRNA *ptr)
+{
+  return uiLayoutGetPropSearch(ptr->data);
+}
+
+static void rna_UILayout_property_search_set(PointerRNA *ptr, bool value)
+{
+  uiLayoutSetPropSearch(ptr->data, value);
+}
+
 #else /* RNA_RUNTIME */
 
 static void rna_def_ui_layout(BlenderRNA *brna)
@@ -1267,6 +1277,12 @@ static void rna_def_ui_layout(BlenderRNA *brna)
   prop = RNA_def_property(srna, "use_property_decorate", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_funcs(
       prop, "rna_UILayout_property_decorate_get", "rna_UILayout_property_decorate_set");
+
+  prop = RNA_def_property(srna, "use_property_search", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_funcs(
+      prop, "rna_UILayout_property_search_get", "rna_UILayout_property_search_set");
+  RNA_def_property_ui_text(
+      prop, "Use Property Search", "Whether to use the region's property search if available");
 }
 
 static void rna_def_panel(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list