[Bf-blender-cvs] [b16018f637b] master: Fix preview Template-ID broken in vertical layouts

Julian Eisel noreply at git.blender.org
Tue Nov 26 19:47:25 CET 2019


Commit: b16018f637b35ba17f0515111fe5c450c5476105
Author: Julian Eisel
Date:   Tue Nov 26 19:43:36 2019 +0100
Branches: master
https://developer.blender.org/rBb16018f637b35ba17f0515111fe5c450c5476105

Fix preview Template-ID broken in vertical layouts

Old code worked pure "by luck". I fixed an error in rB5bcb0c993503 that
made this "luck" go away. Special handling is needed for the preview
layout.

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

M	source/blender/editors/interface/interface_templates.c

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

diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 5788b741108..956fd4514af 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -156,6 +156,13 @@ static void template_add_button_search_menu(const bContext *C,
     const bool use_preview_icon = use_big_size || (id && (GS(id->name) != ID_SCR));
     const short width = UI_UNIT_X * (use_big_size ? 6 : 1.6f);
     const short height = UI_UNIT_Y * (use_big_size ? 6 : 1);
+    uiLayout *col = NULL;
+
+    if (use_big_size) {
+      /* Assume column layout here. To be more correct, we should check if the layout passed to
+       * template_id is a column one, but this should work well in practice. */
+      col = uiLayoutColumn(layout, true);
+    }
 
     but = uiDefBlockButN(block, block_func, block_argN, "", 0, 0, width, height, tip);
     if (use_preview_icon) {
@@ -171,7 +178,7 @@ static void template_add_button_search_menu(const bContext *C,
       UI_but_flag_enable(but, UI_BUT_DISABLED);
     }
     if (use_big_size) {
-      uiLayoutRow(layout, true);
+      uiLayoutRow(col ? col : layout, true);
     }
   }
   else {



More information about the Bf-blender-cvs mailing list