[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60071] branches/soc-2013-ui_replay/source /blender/editors: Added an option to pin the operator redo panel.

Vincent Akkermans vincent at ack-err.net
Thu Sep 12 14:51:54 CEST 2013


Revision: 60071
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60071
Author:   ack-err
Date:     2013-09-12 12:51:54 +0000 (Thu, 12 Sep 2013)
Log Message:
-----------
Added an option to pin the operator redo panel. When it is pinned it stays open when the toolbar is closed.

Modified Paths:
--------------
    branches/soc-2013-ui_replay/source/blender/editors/include/UI_interface.h
    branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
    branches/soc-2013-ui_replay/source/blender/editors/space_view3d/view3d_toolbar.c

Modified: branches/soc-2013-ui_replay/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/include/UI_interface.h	2013-09-12 12:09:14 UTC (rev 60070)
+++ branches/soc-2013-ui_replay/source/blender/editors/include/UI_interface.h	2013-09-12 12:51:54 UTC (rev 60071)
@@ -284,6 +284,7 @@
 #define PNL_NEW_ADDED       16
 #define PNL_FIRST           32
 #define PNL_CUSTOM_PANEL	64
+#define PNL_PINNED			128
 
 /* Drawing
  *

Modified: branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/screen/area.c	2013-09-12 12:09:14 UTC (rev 60070)
+++ branches/soc-2013-ui_replay/source/blender/editors/screen/area.c	2013-09-12 12:51:54 UTC (rev 60071)
@@ -1015,7 +1015,13 @@
 			/* Make sure we don't hide the tool props region when the toolbar is hidden.
 			 * This only works nicely with overlapping regions. */
 			if (ar->overlap && ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->prev && (ar->prev->flag & RGN_FLAG_HIDDEN || ar->prev->flag & RGN_FLAG_TOO_SMALL)) {
-					ar->winrct.xmax = prefsizex - 1;
+					Panel *pa = NULL;
+					for (pa = ar->panels.first; pa; pa = pa->next) {
+						if (pa->type && strcmp(pa->type->idname, "VIEW3D_PT_last_operator") == 0)
+							break;
+					}
+					if (pa && pa->flag & PNL_PINNED)
+						ar->winrct.xmax = prefsizex - 1;
 			}
 		}
 	}

Modified: branches/soc-2013-ui_replay/source/blender/editors/space_view3d/view3d_toolbar.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/space_view3d/view3d_toolbar.c	2013-09-12 12:09:14 UTC (rev 60070)
+++ branches/soc-2013-ui_replay/source/blender/editors/space_view3d/view3d_toolbar.c	2013-09-12 12:51:54 UTC (rev 60071)
@@ -90,6 +90,15 @@
 }
 
 /* TODO de-duplicate redo panel functions - campbell */
+static void view3d_panel_operator_redo_header(const bContext *UNUSED(C), Panel *pa)
+{
+	uiLayout *layout = pa->layout;
+	
+	uiBlockSetEmboss(uiLayoutGetBlock(layout), UI_EMBOSSN);
+	uiDefIconButBitS(uiLayoutGetBlock(layout), TOG, PNL_PINNED, 0, pa->flag & PNL_PINNED ? ICON_PINNED : ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &pa->flag, 0.f, 0.f, 0.f, 0.f, "When this panel is pinned it is not hidden when the toolbar is hidden");
+	uiBlockSetEmboss(uiLayoutGetBlock(layout), UI_EMBOSS);
+}
+
 static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
 {
 	wmOperator *op = WM_operator_last_redo(C);
@@ -344,6 +353,7 @@
 	strcpy(pt->idname, "VIEW3D_PT_last_operator");
 	strcpy(pt->label, N_("Last Operator"));
 	strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
+	pt->draw_header = view3d_panel_operator_redo_header;
 	pt->draw = view3d_panel_operator_redo;
 	BLI_addtail(&art->paneltypes, pt);
 }




More information about the Bf-blender-cvs mailing list