diff options
author | Ton Roosendaal <ton@blender.org> | 2009-04-27 17:44:11 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-04-27 17:44:11 +0400 |
commit | 9b82d1474ff29a5ff246b53e75f12319a58bcdff (patch) | |
tree | 01e65fa09f6d6f06fade5a678f8f8061c407e653 /source/blender/editors/space_view3d | |
parent | 1d3c2b83a1ef5bcd002d3279f130a2475e2c0181 (diff) |
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
Diffstat (limited to 'source/blender/editors/space_view3d')
5 files changed, 89 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index b7682225fe3..0c41d6b4917 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -88,7 +88,34 @@ ARegion *view3d_has_buttons_region(ScrArea *sa) BLI_insertlinkafter(&sa->regionbase, ar, arnew); arnew->regiontype= RGN_TYPE_UI; - arnew->alignment= RGN_ALIGN_LEFT; + arnew->alignment= RGN_ALIGN_RIGHT; + + arnew->flag = RGN_FLAG_HIDDEN; + + return arnew; +} + +ARegion *view3d_has_tools_region(ScrArea *sa) +{ + ARegion *ar, *arnew; + + for(ar= sa->regionbase.first; ar; ar= ar->next) + if(ar->regiontype==RGN_TYPE_TOOLS) + return ar; + + /* add subdiv level; after header */ + for(ar= sa->regionbase.first; ar; ar= ar->next) + if(ar->regiontype==RGN_TYPE_HEADER) + break; + + /* is error! */ + if(ar==NULL) return NULL; + + arnew= MEM_callocN(sizeof(ARegion), "tools for view3d"); + + BLI_insertlinkafter(&sa->regionbase, ar, arnew); + arnew->regiontype= RGN_TYPE_TOOLS; + arnew->alignment= RGN_OVERLAP_LEFT; arnew->flag = RGN_FLAG_HIDDEN; @@ -96,6 +123,7 @@ ARegion *view3d_has_buttons_region(ScrArea *sa) } + /* ******************** default callbacks for view3d space ***************** */ static SpaceLink *view3d_new(const bContext *C) @@ -474,7 +502,7 @@ static void view3d_buttons_area_draw(const bContext *C, ARegion *ar) float col[3]; /* clear */ - UI_GetThemeColor3fv(TH_HEADER, col); + UI_GetThemeColor3fv(TH_BACK, col); glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); @@ -517,6 +545,40 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) } } +/* add handlers, stuff you only do once or on area/region changes */ +static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar) +{ + ListBase *keymap; + + keymap= WM_keymap_listbase(wm, "View2D Buttons List", 0, 0); + WM_event_add_keymap_handler(&ar->handlers, keymap); + keymap= WM_keymap_listbase(wm, "View3D Generic", SPACE_VIEW3D, 0); + WM_event_add_keymap_handler(&ar->handlers, keymap); + // XXX +20 temp... need init for this + UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx+20, ar->winy); +} + + +static void view3d_tools_area_draw(const bContext *C, ARegion *ar) +{ + float col[3]; + + /* clear */ + UI_GetThemeColor3fv(TH_BACK, col); + + glClearColor(col[0], col[1], col[2], 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* set view2d view matrix for scrolling (without scrollers) */ + UI_view2d_view_ortho(C, &ar->v2d); + + view3d_tools_area_defbuts(C, ar); + + /* restore view matrix? */ + UI_view2d_view_restore(C); +} + + /* * Returns true if the Object is a from an external blend file (libdata) */ @@ -788,6 +850,18 @@ void ED_spacetype_view3d(void) art->init= view3d_buttons_area_init; art->draw= view3d_buttons_area_draw; BLI_addhead(&st->regiontypes, art); + + /* regions: tool(bar) */ + art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region"); + art->regionid = RGN_TYPE_TOOLS; + art->minsizex= 120; // XXX + art->minsizey= 50; // XXX + art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES; + art->listener= view3d_buttons_area_listener; + art->init= view3d_tools_area_init; + art->draw= view3d_tools_area_draw; + BLI_addhead(&st->regiontypes, art); + /* regions: header */ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region"); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index f1a748dff3a..5dad3f8cc7d 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -984,7 +984,6 @@ static void view3d_panel_transform_spaces(const bContext *C, ARegion *ar, short for (index = V3D_MANIP_CUSTOM, ts = transform_spaces->first ; ts ; ts = ts->next, index++) { - UI_ThemeColor(TH_BUT_ACTION); if (v3d->twmode == index) { but = uiDefIconButS(block,ROW, B_REDR, ICON_CHECKBOX_HLT, xco,yco,XIC,YIC, &v3d->twmode, 5.0, (float)index, 0, 0, "Use this Custom Transform Orientation"); } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index ae77b4293bf..927773bf2ec 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -134,9 +134,12 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d); /* view3d_buttons.c */ void VIEW3D_OT_properties(struct wmOperatorType *ot); - void view3d_buttons_area_defbuts(const struct bContext *C, ARegion *ar); +/* view3d_buttons.c */ +void VIEW3D_OT_toolbar(struct wmOperatorType *ot); +void view3d_tools_area_defbuts(const struct bContext *C, ARegion *ar); + /* view3d_snap.c */ int minmax_verts(Object *obedit, float *min, float *max); @@ -150,6 +153,7 @@ void VIEW3D_OT_snap_menu(struct wmOperatorType *ot); /* space_view3d.c */ ARegion *view3d_has_buttons_region(ScrArea *sa); +ARegion *view3d_has_tools_region(ScrArea *sa); #endif /* ED_VIEW3D_INTERN_H */ diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index f4c8607d174..0ed43bead17 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -84,10 +84,12 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_setcameratoview); WM_operatortype_append(VIEW3D_OT_drawtype); WM_operatortype_append(VIEW3D_OT_editmesh_face_toolbox); - WM_operatortype_append(VIEW3D_OT_properties); WM_operatortype_append(VIEW3D_OT_localview); WM_operatortype_append(VIEW3D_OT_layers); + WM_operatortype_append(VIEW3D_OT_properties); + WM_operatortype_append(VIEW3D_OT_toolbar); + WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid); WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor); WM_operatortype_append(VIEW3D_OT_snap_selected_to_center); @@ -108,6 +110,7 @@ void view3d_keymap(wmWindowManager *wm) WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_toggle", TABKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_toolbar", TKEY, KM_PRESS, 0, 0); /* only for region 3D window */ keymap= WM_keymap_listbase(wm, "View3D", SPACE_VIEW3D, 0); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index d03586da2d5..9c4f0b576da 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -765,7 +765,7 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot) ot->poll= WM_operator_winactive; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_UNDO; RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); RNA_def_enum(ot->srna, "type", lasso_select_types, 0, "Type", ""); @@ -1546,7 +1546,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_UNDO; /* rna */ RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); @@ -1599,7 +1599,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_UNDO; /* properties */ RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", ""); @@ -1834,7 +1834,7 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_UNDO; RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); |