diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2016-11-16 19:01:19 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2016-11-16 19:04:21 +0300 |
commit | 2bcb1b208a4193fb28f1e0c4408b733f5ee2c028 (patch) | |
tree | 8b9260ffd9fb7b371dc66955903c7b0c7f4e7bf9 /source/blender/editors | |
parent | 930f999f6ea683d02ac490026a52817f1d965377 (diff) | |
parent | 2a2eb0c463bd96d42f7306eb17f88cad87f73aea (diff) |
Merge remote-tracking branch 'origin/master' into blender2.8
Diffstat (limited to 'source/blender/editors')
22 files changed, 139 insertions, 273 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index d7899061218..c0d6963acbb 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -57,6 +57,7 @@ #include "ED_anim_api.h" #include "ED_screen.h" #include "ED_sequencer.h" +#include "ED_util.h" #include "anim_intern.h" @@ -263,7 +264,8 @@ static void ANIM_OT_change_frame(wmOperatorType *ot) ot->poll = change_frame_poll; /* flags */ - ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR | OPTYPE_UNDO_GROUPED; + ot->undo_group = "FRAME_CHANGE"; /* rna */ ot->prop = RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME); diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index ece0f18e96e..47e73f9b777 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1328,6 +1328,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; ED_armature_sync_selection(arm->edbo); + BKE_pose_tag_recalc(CTX_data_main(C), obedit->pose); WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 5015829f868..322476dcca0 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -626,7 +626,7 @@ void POSE_OT_flip_names(wmOperatorType *ot) /* api callbacks */ ot->exec = pose_flip_names_exec; - ot->poll = ED_operator_posemode; + ot->poll = ED_operator_posemode_local; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index cd0ea23e2d3..8e8345d34c9 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -685,6 +685,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case LEFTMOUSE: /* confirm */ case RETKEY: + case PADENTER: { /* return to normal cursor and header status */ ED_area_headerprint(pso->sa, NULL); diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 7dcbe2cc24c..ae83e899649 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -84,7 +84,8 @@ static int gp_data_add_exec(bContext *C, wmOperator *op) { bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); - + ToolSettings *ts = CTX_data_tool_settings(C); + if (gpd_ptr == NULL) { BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go"); return OPERATOR_CANCELLED; @@ -95,6 +96,15 @@ static int gp_data_add_exec(bContext *C, wmOperator *op) id_us_min(&gpd->id); *gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil")); + + /* if not exist brushes, create a new set */ + if (ts) { + if (BLI_listbase_is_empty(&ts->gp_brushes)) { + /* create new brushes */ + BKE_gpencil_brush_init_presets(ts); + } + } + } /* notifiers */ @@ -174,7 +184,8 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot) static int gp_layer_add_exec(bContext *C, wmOperator *op) { bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); - + ToolSettings *ts = CTX_data_tool_settings(C); + /* if there's no existing Grease-Pencil data there, add some */ if (gpd_ptr == NULL) { BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go"); @@ -183,6 +194,14 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op) if (*gpd_ptr == NULL) *gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil")); + /* if not exist brushes, create a new set */ + if (ts) { + if (BLI_listbase_is_empty(&ts->gp_brushes)) { + /* create new brushes */ + BKE_gpencil_brush_init_presets(ts); + } + } + /* add new layer now */ BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 6a558d1c185..ec09add56b8 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -183,6 +183,7 @@ int ED_operator_uvmap(struct bContext *C); int ED_operator_posemode_exclusive(struct bContext *C); int ED_operator_posemode_context(struct bContext *C); int ED_operator_posemode(struct bContext *C); +int ED_operator_posemode_local(struct bContext *C); int ED_operator_mask(struct bContext *C); diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index f5968397f65..a4afa958450 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -52,6 +52,8 @@ void ED_OT_flush_edits(struct wmOperatorType *ot); /* undo.c */ void ED_undo_push(struct bContext *C, const char *str); void ED_undo_push_op(struct bContext *C, struct wmOperator *op); +void ED_undo_grouped_push(struct bContext *C, const char *str); +void ED_undo_grouped_push_op(struct bContext *C, struct wmOperator *op); void ED_undo_pop_op(struct bContext *C, struct wmOperator *op); void ED_undo_pop(struct bContext *C); void ED_undo_redo(struct bContext *C); diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 31598a44b09..d7f06b7db13 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -1083,6 +1083,15 @@ static int depthdropper_poll(bContext *C) return 1; } } + else { + RegionView3D *rv3d = CTX_wm_region_view3d(C); + if (rv3d && rv3d->persp == RV3D_CAMOB) { + View3D *v3d = CTX_wm_view3d(C); + if (v3d->camera && v3d->camera->data && !ID_IS_LINKED_DATABLOCK(v3d->camera->data)) { + return 1; + } + } + } return 0; } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 02812f6a842..650ef4d012e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -213,173 +213,6 @@ static void viconutil_set_point(GLint pt[2], int x, int y) pt[1] = y; } -static void viconutil_draw_tri(GLint(*pts)[2]) -{ - glBegin(GL_TRIANGLES); - glVertex2iv(pts[0]); - glVertex2iv(pts[1]); - glVertex2iv(pts[2]); - glEnd(); -} - -static void viconutil_draw_lineloop(GLint(*pts)[2], int numPoints) -{ - int i; - - glBegin(GL_LINE_LOOP); - for (i = 0; i < numPoints; i++) { - glVertex2iv(pts[i]); - } - glEnd(); -} - -static void viconutil_draw_lineloop_smooth(GLint(*pts)[2], int numPoints) -{ - glEnable(GL_LINE_SMOOTH); - viconutil_draw_lineloop(pts, numPoints); - glDisable(GL_LINE_SMOOTH); -} - -static void viconutil_draw_points(GLint(*pts)[2], int numPoints, int pointSize) -{ - int i; - - glBegin(GL_QUADS); - for (i = 0; i < numPoints; i++) { - int x = pts[i][0], y = pts[i][1]; - - glVertex2i(x - pointSize, y - pointSize); - glVertex2i(x + pointSize, y - pointSize); - glVertex2i(x + pointSize, y + pointSize); - glVertex2i(x - pointSize, y + pointSize); - } - glEnd(); -} - -/* Drawing functions */ - -static void vicon_x_draw(int x, int y, int w, int h, float alpha) -{ - x += 3; - y += 3; - w -= 6; - h -= 6; - - glEnable(GL_LINE_SMOOTH); - - glLineWidth(2.5); - - glColor4f(0.0, 0.0, 0.0, alpha); - glBegin(GL_LINES); - glVertex2i(x, y); - glVertex2i(x + w, y + h); - glVertex2i(x + w, y); - glVertex2i(x, y + h); - glEnd(); - - glDisable(GL_LINE_SMOOTH); -} - -static void vicon_view3d_draw(int x, int y, int w, int h, float alpha) -{ - int cx = x + w / 2; - int cy = y + h / 2; - int d = MAX2(2, h / 3); - - glColor4f(0.5, 0.5, 0.5, alpha); - glBegin(GL_LINES); - glVertex2i(x, cy - d); - glVertex2i(x + w, cy - d); - glVertex2i(x, cy + d); - glVertex2i(x + w, cy + d); - - glVertex2i(cx - d, y); - glVertex2i(cx - d, y + h); - glVertex2i(cx + d, y); - glVertex2i(cx + d, y + h); - glEnd(); - - glColor4f(0.0, 0.0, 0.0, alpha); - glBegin(GL_LINES); - glVertex2i(x, cy); - glVertex2i(x + w, cy); - glVertex2i(cx, y); - glVertex2i(cx, y + h); - glEnd(); -} - -static void vicon_edit_draw(int x, int y, int w, int h, float alpha) -{ - GLint pts[4][2]; - - viconutil_set_point(pts[0], x + 3, y + 3); - viconutil_set_point(pts[1], x + w - 3, y + 3); - viconutil_set_point(pts[2], x + w - 3, y + h - 3); - viconutil_set_point(pts[3], x + 3, y + h - 3); - - glColor4f(0.0, 0.0, 0.0, alpha); - viconutil_draw_lineloop(pts, 4); - - glColor3f(1, 1, 0.0); - viconutil_draw_points(pts, 4, 1); -} - -static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha) -{ - GLint pts[3][2]; - - viconutil_set_point(pts[0], x + w / 2, y + h - 2); - viconutil_set_point(pts[1], x + 3, y + 4); - viconutil_set_point(pts[2], x + w - 3, y + 4); - - glColor4f(0.5, 0.5, 0.5, alpha); - viconutil_draw_tri(pts); - - glColor4f(0.0, 0.0, 0.0, 1); - viconutil_draw_lineloop_smooth(pts, 3); - - glColor3f(1, 1, 0.0); - viconutil_draw_points(pts, 3, 1); -} - -static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(alpha)) -{ - GLint pts[3][2]; - - viconutil_set_point(pts[0], x + w / 2, y + h - 2); - viconutil_set_point(pts[1], x + 3, y + 4); - viconutil_set_point(pts[2], x + w - 3, y + 4); - - glColor4f(0.0f, 0.0f, 0.0f, 1); - viconutil_draw_lineloop_smooth(pts, 3); - - glColor3f(0.9f, 0.9f, 0.9f); - viconutil_draw_points(pts, 3, 1); -} - -static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) -{ - GLint pts[3][2]; - int cx = x + w / 2; - int cy = y + w / 2; - int d = w / 3, d2 = w / 5; - - viconutil_set_point(pts[0], cx - d2, cy + d); - viconutil_set_point(pts[1], cx - d2, cy - d); - viconutil_set_point(pts[2], cx + d2, cy); - - glBegin(GL_TRIANGLES); - glColor4f(0.8f, 0.8f, 0.8f, alpha); - glVertex2iv(pts[0]); - glVertex2iv(pts[1]); - glColor4f(0.3f, 0.3f, 0.3f, alpha); - glVertex2iv(pts[2]); - glEnd(); - - glColor4f(0.0f, 0.0f, 0.0f, 1); - viconutil_draw_lineloop_smooth(pts, 3); -} - static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; @@ -400,63 +233,6 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float glEnd(); } -static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha) -{ - GLint pts[3][2]; - int cx = x + w / 2; - int cy = y + w / 2; - int d = w / 3, d2 = w / 5; - - viconutil_set_point(pts[0], cx + d, cy + d2); - viconutil_set_point(pts[1], cx - d, cy + d2); - viconutil_set_point(pts[2], cx, cy - d2); - - glBegin(GL_TRIANGLES); - glColor4f(0.8f, 0.8f, 0.8f, alpha); - glVertex2iv(pts[0]); - glVertex2iv(pts[1]); - glColor4f(0.3f, 0.3f, 0.3f, alpha); - glVertex2iv(pts[2]); - glEnd(); - - glColor4f(0.0f, 0.0f, 0.0f, 1); - viconutil_draw_lineloop_smooth(pts, 3); -} - -static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha)) -{ - int d = -2; - - glEnable(GL_LINE_SMOOTH); - glLineWidth(1); - glColor3f(0.0, 0.0, 0.0); - - glBegin(GL_LINE_STRIP); - glVertex2i(x + w / 2 - d * 2, y + h / 2 + d); - glVertex2i(x + w / 2, y + h / 2 - d + 1); - glVertex2i(x + w / 2 + d * 2, y + h / 2 + d); - glEnd(); - - glDisable(GL_LINE_SMOOTH); -} - -static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)) -{ - int d = 2; - - glEnable(GL_LINE_SMOOTH); - glLineWidth(1); - glColor3f(0.0, 0.0, 0.0); - - glBegin(GL_LINE_STRIP); - glVertex2i(x + w / 2 - d * 2, y + h / 2 + d); - glVertex2i(x + w / 2, y + h / 2 - d - 1); - glVertex2i(x + w / 2 + d * 2, y + h / 2 + d); - glEnd(); - - glDisable(GL_LINE_SMOOTH); -} - static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, short key_type) { /* init dummy theme state for Action Editor - where these colors are defined @@ -781,15 +557,6 @@ static void init_internal_icons(void) } } - def_internal_vicon(VICO_VIEW3D_VEC, vicon_view3d_draw); - def_internal_vicon(VICO_EDIT_VEC, vicon_edit_draw); - def_internal_vicon(VICO_EDITMODE_VEC_DEHLT, vicon_editmode_dehlt_draw); - def_internal_vicon(VICO_EDITMODE_VEC_HLT, vicon_editmode_hlt_draw); - def_internal_vicon(VICO_DISCLOSURE_TRI_RIGHT_VEC, vicon_disclosure_tri_right_draw); - def_internal_vicon(VICO_DISCLOSURE_TRI_DOWN_VEC, vicon_disclosure_tri_down_draw); - def_internal_vicon(VICO_MOVE_UP_VEC, vicon_move_up_draw); - def_internal_vicon(VICO_MOVE_DOWN_VEC, vicon_move_down_draw); - def_internal_vicon(VICO_X_VEC, vicon_x_draw); def_internal_vicon(VICO_SMALL_TRI_RIGHT_VEC, vicon_small_tri_right_draw); def_internal_vicon(VICO_KEYTYPE_KEYFRAME_VEC, vicon_keytype_keyframe_draw); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index bdd492beb1e..73a9ea928cc 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -2799,17 +2799,21 @@ void init_userdef_do_versions(void) } } + if (!USER_VERSION_ATLEAST(278, 3)) { + for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) { + /* Keyframe Indicators (were using wrong alpha) */ + btheme->tv3d.time_keyframe[3] = btheme->tv3d.time_gp_keyframe[3] = 255; + btheme->ttime.time_keyframe[3] = btheme->ttime.time_gp_keyframe[3] = 255; + } + } + /** * Include next version bump. * * (keep this block even if it becomes empty). */ { - for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) { - /* Keyframe Indicators (were using wrong alpha) */ - btheme->tv3d.time_keyframe[3] = btheme->tv3d.time_gp_keyframe[3] = 255; - btheme->ttime.time_keyframe[3] = btheme->ttime.time_gp_keyframe[3] = 255; - } + } if (U.pixelsize == 0.0f) diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index e31e4096ded..e05ce727e22 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -496,7 +496,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u } /* face should never exist */ - BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == false); + BLI_assert(!BM_face_exists(f_verts, f_verts[3] ? 4 : 3)); f = BM_face_create_verts(bm, f_verts, f_verts[3] ? 4 : 3, f_example, BM_CREATE_NOP, true); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 7e31deba2c7..c57b0215d46 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1561,6 +1561,18 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) /* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, true); BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true); + + const int tot_rotate = BMO_slot_buffer_count(bmop.slots_out, "edges.out"); + const int tot_failed = tot - tot_rotate; + if (tot_failed != 0) { + /* If some edges fail to rotate, we need to re-select them, + * otherwise we can end up with invalid selection + * (unselected edge between 2 selected faces). */ + BM_mesh_elem_hflag_enable_test(em->bm, BM_EDGE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG); + + BKE_reportf(op->reports, RPT_WARNING, "Unable to rotate %d edge(s)", tot_failed); + } + EDBM_selectmode_flush(em); if (!EDBM_op_finish(em, &bmop, op, true)) { diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 4fc61e0912e..438c3acdb11 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1139,7 +1139,6 @@ BMEdge *EDBM_verts_mirror_get_edge(BMEditMesh *em, BMEdge *e) BMFace *EDBM_verts_mirror_get_face(BMEditMesh *em, BMFace *f) { - BMFace *f_mirr = NULL; BMVert **v_mirr_arr = BLI_array_alloca(v_mirr_arr, f->len); BMLoop *l_iter, *l_first; @@ -1152,8 +1151,7 @@ BMFace *EDBM_verts_mirror_get_face(BMEditMesh *em, BMFace *f) } } while ((l_iter = l_iter->next) != l_first); - BM_face_exists(v_mirr_arr, f->len, &f_mirr); - return f_mirr; + return BM_face_exists(v_mirr_arr, f->len); } void EDBM_verts_mirror_cache_clear(BMEditMesh *em, BMVert *v) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 82da6f58912..56f59dca9a1 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -886,7 +886,7 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum) const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); /* warning, this lookup is _not_ fast */ - if (cd_dvert_offset != -1) { + if (cd_dvert_offset != -1 && vertnum < em->bm->totvert) { BMVert *eve; BM_mesh_elem_table_ensure(em->bm, BM_VERT); eve = BM_vert_at_index(em->bm, vertnum); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 9d9ccf2f3ba..16842efb436 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -315,6 +315,12 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr) RE_render_result_rect_from_ibuf(rr, &scene->r, out, oglrender->view_id); IMB_freeImBuf(out); } + else if (gpd){ + /* If there are no strips, Grease Pencil still needs a buffer to draw on */ + ImBuf *out = IMB_allocImBuf(oglrender->sizex, oglrender->sizey, 32, IB_rect); + RE_render_result_rect_from_ibuf(rr, &scene->r, out, oglrender->view_id); + IMB_freeImBuf(out); + } if (gpd) { int i; @@ -479,23 +485,24 @@ static void add_gpencil_renderpass(OGLRender *oglrender, RenderResult *rr, Rende /* copy image data from rectf */ // XXX: Needs conversion. unsigned char *src = (unsigned char *)RE_RenderViewGetById(rr, oglrender->view_id)->rect32; - float *dest = rp->rect; - - int x, y, rectx, recty; - rectx = rr->rectx; - recty = rr->recty; - for (y = 0; y < recty; y++) { - for (x = 0; x < rectx; x++) { - unsigned char *pixSrc = src + 4 * (rectx * y + x); - if (pixSrc[3] > 0) { - float *pixDest = dest + 4 * (rectx * y + x); - float float_src[4]; - srgb_to_linearrgb_uchar4(float_src, pixSrc); - addAlphaOverFloat(pixDest, float_src); + if (src != NULL) { + float *dest = rp->rect; + + int x, y, rectx, recty; + rectx = rr->rectx; + recty = rr->recty; + for (y = 0; y < recty; y++) { + for (x = 0; x < rectx; x++) { + unsigned char *pixSrc = src + 4 * (rectx * y + x); + if (pixSrc[3] > 0) { + float *pixDest = dest + 4 * (rectx * y + x); + float float_src[4]; + srgb_to_linearrgb_uchar4(float_src, pixSrc); + addAlphaOverFloat(pixDest, float_src); + } } } } - /* back layer status */ i = 0; for (bGPDlayer *gph = gpd->layers.first; gph; gph = gph->next) { diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 860a865466a..c69e01422e0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -442,6 +442,17 @@ int ED_operator_posemode(bContext *C) return 0; } +int ED_operator_posemode_local(bContext *C) +{ + if (ED_operator_posemode(C)) { + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); + bArmature *arm = ob->data; + return !(ID_IS_LINKED_DATABLOCK(&ob->id) || + ID_IS_LINKED_DATABLOCK(&arm->id)); + } + return false; +} + /* wrapper for ED_space_image_show_uvedit */ int ED_operator_uvedit(bContext *C) { @@ -2136,7 +2147,8 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) ot->exec = frame_offset_exec; ot->poll = ED_operator_screenactive_norender; - ot->flag = 0; + ot->flag = OPTYPE_UNDO_GROUPED; + ot->undo_group = "FRAME_CHANGE"; /* rna */ RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); @@ -2189,7 +2201,8 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot) ot->exec = frame_jump_exec; ot->poll = ED_operator_screenactive_norender; - ot->flag = OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO_GROUPED; + ot->undo_group = "FRAME_CHANGE"; /* rna */ RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range"); @@ -2295,7 +2308,8 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) ot->exec = keyframe_jump_exec; ot->poll = ED_operator_screenactive_norender; - ot->flag = OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO_GROUPED; + ot->undo_group = "FRAME_CHANGE"; /* properties */ RNA_def_boolean(ot->srna, "next", true, "Next Keyframe", ""); @@ -2357,7 +2371,8 @@ static void SCREEN_OT_marker_jump(wmOperatorType *ot) ot->exec = marker_jump_exec; ot->poll = ED_operator_screenactive_norender; - ot->flag = OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO_GROUPED; + ot->undo_group = "FRAME_CHANGE"; /* properties */ RNA_def_boolean(ot->srna, "next", true, "Next Marker", ""); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index fe0fb3f5035..53434b18d06 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4688,7 +4688,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st sculpt_restore_mesh(sd, ob); if (sd->flags & SCULPT_DYNTOPO_DETAIL_CONSTANT) { - BKE_pbvh_bmesh_detail_size_set(ss->pbvh, sd->constant_detail / 100.0f); + BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail); } else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) { BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * sd->detail_percent / 100.0f); @@ -5406,7 +5406,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) if (!ts->sculpt->detail_percent) ts->sculpt->detail_percent = 25; if (ts->sculpt->constant_detail == 0.0f) - ts->sculpt->constant_detail = 30.0f; + ts->sculpt->constant_detail = 3.0f; /* Set sane default tiling offsets */ if (!ts->sculpt->paint.tile_offset[0]) ts->sculpt->paint.tile_offset[0] = 1.0f; @@ -5543,7 +5543,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *UNUSED(op)) size = max_fff(bb_max[0], bb_max[1], bb_max[2]); /* update topology size */ - BKE_pbvh_bmesh_detail_size_set(ss->pbvh, sd->constant_detail / 100.0f); + BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail); sculpt_undo_push_begin("Dynamic topology flood fill"); sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_COORDS); @@ -5608,7 +5608,8 @@ static void sample_detail(bContext *C, int ss_co[2]) ray_start, ray_normal, false); if (srd.hit) { - sd->constant_detail = srd.detail * 100.0f; + /* convert edge length to detail resolution */ + sd->constant_detail = 1.0f / srd.detail; } } diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index d72b7dbd8dc..87cf0e8c9e3 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -537,6 +537,8 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS last_category = user->category; } + + UI_block_flag_enable(block, UI_BLOCK_NO_FLIP); } void uiTemplateTextureUser(uiLayout *layout, bContext *C) diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 6af36ea6778..83469a48165 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2510,7 +2510,7 @@ static void filelist_readjob_do( * Using an atomic operation to avoid having to lock thread... * Note that we do not really need this here currently, since there is a single listing thread, but better * remain consistent about threading! */ - *((uint32_t *)entry->uuid) = atomic_add_uint32((uint32_t *)filelist->filelist_intern.curr_uuid, 1); + *((uint32_t *)entry->uuid) = atomic_add_and_fetch_uint32((uint32_t *)filelist->filelist_intern.curr_uuid, 1); /* Only thing we change in direntry here, so we need to free it first. */ MEM_freeN(entry->relpath); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 7ff66c21af5..489f3776c78 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3392,7 +3392,9 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) } protectedTransBits(td->protectflag, vec); - add_v3_v3v3(td->loc, td->iloc, vec); + if (td->loc) { + add_v3_v3v3(td->loc, td->iloc, vec); + } constraintTransLim(t, td); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 6271f80570a..f5b5faa4ad2 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5413,7 +5413,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, if (tmode == TFM_TRANSLATION) { do_loc = true; } - else if (tmode == TFM_ROTATION) { + else if (ELEM(tmode, TFM_ROTATION, TFM_TRACKBALL)) { if (v3d->around == V3D_AROUND_ACTIVE) { if (ob != OBACT) do_loc = true; @@ -5558,7 +5558,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o else do_loc = true; } - else if (tmode == TFM_ROTATION) { + else if (ELEM(tmode, TFM_ROTATION, TFM_TRACKBALL)) { if (ELEM(v3d->around, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) do_loc = true; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 805238bd2af..7fd67849414 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -205,6 +205,19 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) return OPERATOR_FINISHED; } +void ED_undo_grouped_push(bContext *C, const char *str) +{ + /* do nothing if previous undo task is the same as this one (or from the same undo group) */ + const char *last_undo = BKE_undo_get_name_last(); + + if (last_undo && STREQ(str, last_undo)) { + return; + } + + /* push as usual */ + ED_undo_push(C, str); +} + void ED_undo_pop(bContext *C) { ed_undo_step(C, 1, NULL); @@ -220,6 +233,16 @@ void ED_undo_push_op(bContext *C, wmOperator *op) ED_undo_push(C, op->type->name); } +void ED_undo_grouped_push_op(bContext *C, wmOperator *op) +{ + if (op->type->undo_group[0] != '\0') { + ED_undo_grouped_push(C, op->type->undo_group); + } + else { + ED_undo_grouped_push(C, op->type->name); + } +} + void ED_undo_pop_op(bContext *C, wmOperator *op) { /* search back a couple of undo's, in case something else added pushes */ |