[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59208] branches/soc-2013-ui_replay/source /blender: The custom icons are now in the RGN_TYPE_MENU_BAR instead of in their own region .
Vincent Akkermans
vincent at ack-err.net
Sat Aug 17 13:54:23 CEST 2013
Revision: 59208
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59208
Author: ack-err
Date: 2013-08-17 11:54:23 +0000 (Sat, 17 Aug 2013)
Log Message:
-----------
The custom icons are now in the RGN_TYPE_MENU_BAR instead of in their own region. The menubar region now snaps to once or twice the header size.
Modified Paths:
--------------
branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c
branches/soc-2013-ui_replay/source/blender/editors/include/ED_screen.h
branches/soc-2013-ui_replay/source/blender/editors/include/UI_interface.h
branches/soc-2013-ui_replay/source/blender/editors/include/UI_resources.h
branches/soc-2013-ui_replay/source/blender/editors/interface/interface_panel.c
branches/soc-2013-ui_replay/source/blender/editors/interface/resources.c
branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
branches/soc-2013-ui_replay/source/blender/editors/space_view3d/space_view3d.c
branches/soc-2013-ui_replay/source/blender/editors/space_view3d/view3d_intern.h
branches/soc-2013-ui_replay/source/blender/editors/space_view3d/view3d_toolbar.c
branches/soc-2013-ui_replay/source/blender/makesdna/DNA_screen_types.h
branches/soc-2013-ui_replay/source/blender/windowmanager/intern/wm_operators.c
Modified: branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c 2013-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/blenloader/intern/readfile.c 2013-08-17 11:54:23 UTC (rev 59208)
@@ -9523,56 +9523,37 @@
for (sc = main->screen.first; sc; sc = sc->id.next) {
ScrArea *sa;
- ARegion *r;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
ARegion *ar;
+ ARegion *after = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
- if (sa->spacetype == SPACE_VIEW3D) {
+ if (after && sa->spacetype == SPACE_VIEW3D) {
- /* The icon shelf is added first, right after the header region, which is assumed to be first in the list.
- * The menubar is then added after the header as well, and then ends up before the icon shelf.
- */
-
- /* add icon shelf */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_ICON_SHELF);
- if (ar == NULL) {
- ar = MEM_callocN(sizeof(ARegion), "tool operators icon shelf for view3d");
- BLI_insertlinkafter(&sa->regionbase, sa->regionbase.first, ar);
- ar->regiontype = RGN_TYPE_ICON_SHELF;
- ar->alignment = RGN_ALIGN_TOP;
- }
-
/* add operators menubar */
ar = BKE_area_find_region_type(sa, RGN_TYPE_MENU_BAR);
if (ar == NULL) {
ar = MEM_callocN(sizeof(ARegion), "tool operators menu bar for view3d");
- BLI_insertlinkafter(&sa->regionbase, sa->regionbase.first, ar);
+ BLI_insertlinkafter(&sa->regionbase, after, ar);
ar->regiontype = RGN_TYPE_MENU_BAR;
ar->alignment = RGN_ALIGN_TOP;
}
}
for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
+
+ ARegion *after = BKE_spacelink_find_region_type(sl, RGN_TYPE_TOOLS);
+
+ if (after && sl->spacetype == SPACE_VIEW3D) {
- /* add icon shelf */
- ar = BKE_spacelink_find_region_type(sl, RGN_TYPE_ICON_SHELF);
- if (ar == NULL) {
- ar = MEM_callocN(sizeof(ARegion), "tool operators icon shelf for view3d");
- BLI_insertlinkafter(&sl->regionbase, sl->regionbase.first, ar);
- ar->regiontype = RGN_TYPE_ICON_SHELF;
- ar->alignment = RGN_ALIGN_TOP;
- }
-
/* add operators menubar */
ar = BKE_spacelink_find_region_type(sl, RGN_TYPE_MENU_BAR);
if (ar == NULL) {
ar = MEM_callocN(sizeof(ARegion), "tool operators menu bar for view3d");
- BLI_insertlinkafter(&sl->regionbase, sl->regionbase.first, ar);
+ BLI_insertlinkafter(&sl->regionbase, after, ar);
ar->regiontype = RGN_TYPE_MENU_BAR;
ar->alignment = RGN_ALIGN_TOP;
}
Modified: branches/soc-2013-ui_replay/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/include/ED_screen.h 2013-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/editors/include/ED_screen.h 2013-08-17 11:54:23 UTC (rev 59208)
@@ -65,8 +65,6 @@
void ED_region_header(const struct bContext *C, struct ARegion *ar);
void ED_region_menubar(const struct bContext *C, struct ARegion *ar);
void ED_region_menubar_init(struct ARegion *ar);
-void ED_region_iconshelf(const struct bContext *C, struct ARegion *ar);
-void ED_region_iconshelf_init(struct ARegion *ar);
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
void ED_region_info_draw(struct ARegion *ar, const char *text, int block, float fill_color[4]);
void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
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-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/editors/include/UI_interface.h 2013-08-17 11:54:23 UTC (rev 59208)
@@ -671,6 +671,8 @@
* could use a good cleanup, though how they will function in 2.5 is
* not clear yet so we postpone that. */
+void uiCollapseAllPanels(struct ScrArea *sa, struct ARegion *ar, const char *context);
+
void uiBeginPanels(const struct bContext *C, struct ARegion *ar);
void uiEndPanels(const struct bContext *C, struct ARegion *ar, int *x, int *y);
void uiDrawPanels(const struct bContext *C, struct ARegion *ar);
Modified: branches/soc-2013-ui_replay/source/blender/editors/include/UI_resources.h
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/include/UI_resources.h 2013-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/editors/include/UI_resources.h 2013-08-17 11:54:23 UTC (rev 59208)
@@ -312,4 +312,6 @@
void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
+int UI_data_mode_icon(const struct bContext *C);
+
#endif /* __UI_RESOURCES_H__ */
Modified: branches/soc-2013-ui_replay/source/blender/editors/interface/interface_panel.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/interface/interface_panel.c 2013-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/editors/interface/interface_panel.c 2013-08-17 11:54:23 UTC (rev 59208)
@@ -157,21 +157,29 @@
/****************************** panels ******************************/
-static void panels_collapse_all(ScrArea *sa, ARegion *ar, Panel *from_pa)
+void uiCollapseAllPanels(ScrArea *sa, ARegion *ar, const char *context)
{
Panel *pa;
- PanelType *pt, *from_pt;
+ PanelType *pt;
int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
for (pa = ar->panels.first; pa; pa = pa->next) {
pt = pa->type;
- from_pt = from_pa->type;
/* close panels with headers in the same context */
- if (pt && from_pt && !(pt->flag & PNL_NO_HEADER))
- if (!pt->context[0] || strcmp(pt->context, from_pt->context) == 0)
- pa->flag = flag;
+ if (pt && context && !(pt->flag & PNL_NO_HEADER))
+ if (!pt->context[0] || strcmp(pt->context, context) == 0) {
+ pa->flag |= flag;
+ pa->ofsx = 0;
+ pa->ofsy = 0;
+ pa->sizex = 0;
+ pa->sizey = 0;
+ pa->runtime_flag |= PNL_NEW_ADDED;
+ }
+
}
+
+ ED_region_tag_redraw(ar);
}
@@ -1157,7 +1165,7 @@
/* collapse */
if (ctrl)
// TODO: CTRL AKEY doesn't seem to arrive here ~ ack-err
- panels_collapse_all(sa, ar, block->panel);
+ uiCollapseAllPanels(sa, ar, CTX_data_mode_string(C));
if (block->panel->flag & PNL_CLOSED) {
block->panel->flag &= ~PNL_CLOSED;
Modified: branches/soc-2013-ui_replay/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/interface/resources.c 2013-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/editors/interface/resources.c 2013-08-17 11:54:23 UTC (rev 59208)
@@ -40,6 +40,7 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_object_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -49,6 +50,7 @@
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_texture.h"
+#include "BKE_context.h"
#include "BIF_gl.h"
@@ -1357,6 +1359,29 @@
}
}
+int UI_data_mode_icon(const bContext *C)
+{
+ Object *obedit = CTX_data_edit_object(C);
+
+ if (obedit) {
+ return ICON_EDITMODE_HLT;
+ }
+ else {
+ Object *ob = CTX_data_active_object(C);
+
+ if (ob) {
+ if (ob->mode & OB_MODE_POSE) return ICON_POSE_HLT;
+ else if (ob->mode & OB_MODE_SCULPT) return ICON_SCULPTMODE_HLT;
+ else if (ob->mode & OB_MODE_WEIGHT_PAINT) return ICON_WPAINT_HLT;
+ else if (ob->mode & OB_MODE_VERTEX_PAINT) return ICON_VPAINT_HLT;
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT) return ICON_TPAINT_HLT;
+ else if (ob->mode & OB_MODE_PARTICLE_EDIT) return ICON_PARTICLEMODE;
+ }
+ }
+
+ return ICON_OBJECT_DATAMODE;
+}
+
/* ************************************************************* */
/* patching UserDef struct and Themes */
Modified: branches/soc-2013-ui_replay/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2013-ui_replay/source/blender/editors/screen/area.c 2013-08-17 11:49:18 UTC (rev 59207)
+++ branches/soc-2013-ui_replay/source/blender/editors/screen/area.c 2013-08-17 11:54:23 UTC (rev 59208)
@@ -950,6 +950,14 @@
if (ar->regiontype == RGN_TYPE_HEADER) {
prefsizey = ED_area_headersize();
}
+ else if (ar->regiontype == RGN_TYPE_MENU_BAR) {
+ /* quantize sizey to once or twice the headysize */
+ int headersize = ED_area_headersize();
+ if (ar->sizey > 0 && ar->sizey <= headersize)
+ prefsizey = headersize;
+ else if (ar->sizey > headersize)
+ prefsizey = 2 * headersize;
+ }
else if (ar->regiontype == RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
prefsizey = UI_UNIT_Y * 2 + (UI_UNIT_Y / 2);
}
@@ -1825,12 +1833,13 @@
{
uiStyle *style = UI_GetStyleDraw();
uiBlock *block;
- uiLayout *layout;
+ uiLayout *layout, *row;
MenuBarType *mbt;
MenuBar mb = {NULL};
int maxco, xco, yco;
- int headery = ED_area_headersize();
+ int headery = ED_area_headersize() * 2;
const char *context = CTX_data_mode_string(C);
+ OperatorListItem *oli;
/* clear */
UI_ThemeClearColor(TH_BACK);
@@ -1841,8 +1850,11 @@
xco = maxco = 0.4f * UI_UNIT_X;
yco = headery - floor(0.2f * UI_UNIT_Y);
+
+ block = uiBeginBlock(C, ar, "menubar menus", UI_EMBOSS);
+ layout = uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
- /* draw all menu bar types */
+ /* add all menubar types to the top bar */
for (mbt = ar->type->menubartypes.first; mbt; mbt = mbt->next) {
/* verify context */
@@ -1850,80 +1862,40 @@
if (mbt->context[0] && strcmp(context, mbt->context) != 0)
continue;
- block = uiBeginBlock(C, ar, mbt->idname, UI_EMBOSS);
- layout = uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
-
if (mbt->draw) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list