diff options
author | Germano <germano.costa@ig.com.br> | 2018-01-21 23:45:47 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-01-21 23:45:47 +0300 |
commit | 790025c01ed76c06e69e6054f1a718ca57771e28 (patch) | |
tree | 7461d495f199142172b0efa34e5ad75ea65def6a /source/blender/editors | |
parent | 99efebd2dd24a8e0827cf0f13bc40c2844946676 (diff) | |
parent | 8d671f6f6550605ac738f7a9727375a024614837 (diff) |
Merge branch 'master' into blender2.8
# Conflicts:
# intern/cycles/blender/blender_mesh.cpp
# source/blender/editors/screen/screen_ops.c
# source/blender/editors/space_view3d/drawobject.c
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_draw.c | 8 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 66 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 7 |
5 files changed, 47 insertions, 39 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index eeda0a25195..16525dfbc9e 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1485,7 +1485,7 @@ void ED_keymap_ui(wmKeyConfig *keyconf) * through until a suitable eyedropper for the active button is found */ WM_keymap_add_item(keymap, "UI_OT_eyedropper_color", EKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "UI_OT_eyedropper_colorband", EKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "UI_OT_eyedropper_colorband_point", EKEY, KM_PRESS , KM_ALT, 0); + WM_keymap_add_item(keymap, "UI_OT_eyedropper_colorband_point", EKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "UI_OT_eyedropper_id", EKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "UI_OT_eyedropper_depth", EKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 694770d088d..2e4e9127ed6 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -288,7 +288,7 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, unsigned int pos } /** - * Only for edge lines between areas, and the blended join arrows. + * Only for edge lines between areas. */ void ED_screen_draw_edges(wmWindow *win) { @@ -326,6 +326,12 @@ void ED_screen_draw_edges(wmWindow *win) screen->do_draw = false; } +/** + * The blended join arrows. + * + * \param sa1: Area from which the resultant originates. + * \param sa2: Target area that will be replaced. + */ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) { unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a69f9188f59..3c6c4058b84 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1470,8 +1470,6 @@ static void SCREEN_OT_area_move(wmOperatorType *ot) */ typedef struct sAreaSplitData { - int x, y; /* last used mouse position */ - int origval; /* for move areas */ int bigger, smaller; /* constraints for moving new edge */ int delta; /* delta move edge */ @@ -1718,9 +1716,6 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) sd = (sAreaSplitData *)op->customdata; - sd->x = event->x; - sd->y = event->y; - if (event->type == EVT_ACTIONZONE_AREA) { /* do the split */ @@ -1792,8 +1787,15 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) const int dir = RNA_property_enum_get(op->ptr, prop_dir); sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval; - if (sd->previewmode == 0) - area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, sd->do_snap); + + if (sd->previewmode == 0) { + if (sd->do_snap) { + const int snap_loc = area_snap_calc_location( + CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->bigger, sd->smaller); + sd->delta = snap_loc - sd->origval; + } + area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, false); + } else { if (sd->sarea) { ED_area_tag_redraw(sd->sarea); @@ -1802,7 +1804,26 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y); if (sd->sarea) { - ED_area_tag_redraw(sd->sarea); + ScrArea *sa = sd->sarea; + if (dir == 'v') { + sd->origsize = sa->winx; + sd->origmin = sa->totrct.xmin; + } + else { + sd->origsize = sa->winy; + sd->origmin = sa->totrct.ymin; + } + + if (sd->do_snap) { + sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1; + + const int snap_loc = area_snap_calc_location( + CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin); + + sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0; + sd->delta = snap_loc - sd->origval; + } + update_factor = true; } @@ -1836,8 +1857,6 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) RNA_property_enum_set(op->ptr, prop_dir, (dir == 'v') ? 'h' : 'v'); area_split_preview_update_cursor(C, op); update_factor = true; - - ED_area_tag_redraw(sd->sarea); } } } @@ -1857,31 +1876,12 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) if (update_factor) { const int dir = RNA_property_enum_get(op->ptr, prop_dir); - float fac; - - if (dir == 'v') { - sd->origsize = sd->sarea->winx; - sd->origmin = sd->sarea->totrct.xmin; - } - else { - sd->origsize = sd->sarea->winy; - sd->origmin = sd->sarea->totrct.ymin; - } - - if (sd->do_snap) { - ScrArea *sa = sd->sarea; - sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1; + float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize; + RNA_float_set(op->ptr, "factor", fac); - int snap_loc = area_snap_calc_location( - CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin); - - sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0; - fac = snap_loc - sd->origmin; - } - else { - fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin; + if (sd->sarea) { + ED_area_tag_redraw(sd->sarea); } - RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize); } return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 0e5c5ddc0c7..ce6ce802a5b 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2792,7 +2792,8 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op) DEG_relations_tag_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); WM_reportf(RPT_INFO, "Deleted %u drivers", deleted); - } else { + } + else { WM_report(RPT_INFO, "No drivers deleted"); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 3bc2481a608..51dc56bafaf 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1034,7 +1034,7 @@ static void drawcube_size(float size, unsigned pos) { size, size, size} }; - const GLubyte indices[24] = {0,1,1,3,3,2,2,0,0,4,4,5,5,7,7,6,6,4,1,5,3,7,2,6}; + const GLubyte indices[24] = {0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4, 5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6}; #if 0 glEnableClientState(GL_VERTEX_ARRAY); @@ -8065,7 +8065,7 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos) if (solid) { /* Adpated from "Optimizing Triangle Strips for Fast Rendering" by F. Evans, S. Skiena and A. Varshney * (http://www.cs.umd.edu/gvil/papers/av_ts.pdf). */ - static const GLubyte tris_strip_indices[14] = {0,1,3,2,6,1,5,0,4,3,7,6,4,5}; + static const GLubyte tris_strip_indices[14] = {0, 1, 3, 2, 6, 1, 5, 0, 4, 3, 7, 6, 4, 5}; immBegin(GWN_PRIM_TRI_STRIP, 14); for (int i = 0; i < 14; ++i) { immVertex3fv(pos, vec[tris_strip_indices[i]]); @@ -8073,7 +8073,8 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos) immEnd(); } else { - static const GLubyte line_indices[24] = {0,1,1,2,2,3,3,0,0,4,4,5,5,6,6,7,7,4,1,5,2,6,3,7}; + static const GLubyte line_indices[24] = + {0, 1, 1, 2, 2, 3, 3, 0, 0, 4, 4, 5, 5, 6, 6, 7, 7, 4, 1, 5, 2, 6, 3, 7}; immBegin(GWN_PRIM_LINES, 24); for (int i = 0; i < 24; ++i) { immVertex3fv(pos, vec[line_indices[i]]); |