[Bf-blender-cvs] [3b06c42] blender2.8: Blender2.8 convert UI_view2d_constant_grid_draw to new immediate mode
Commit: 3b06c42616038f9a8e8353ca69b693efff5b27cd Author: Mike Erwin Date: Tue Nov 15 18:56:52 2016 -0500 Branches: blender2.8 https://developer.blender.org/rB3b06c42616038f9a8e8353ca69b693efff5b27cd Blender2.8 convert UI_view2d_constant_grid_draw to new immediate mode Convert UI_view2d_constant_grid_draw to new immediate mode. Part of T49043. Reviewers: merwin Reviewed By: merwin Tags: #bf_blender_2.8 Differential Revision: https://developer.blender.org/D2298 === M source/blender/editors/interface/view2d.c === diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 482b764..cd75207 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -49,6 +49,7 @@ #include "BKE_screen.h" #include "BKE_global.h" +#include "GPU_immediate.h" #include "WM_api.h" @@ -1391,32 +1392,65 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) /* Draw a constant grid in given 2d-region */ void UI_view2d_constant_grid_draw(View2D *v2d) { - float start, step = 25.0f; - - UI_ThemeColorShade(TH_BACK, -10); + float start_x, start_y, step = 25.0f; + int count_x, count_y; - start = v2d->cur.xmin - (float)fmod(v2d->cur.xmin, step); + start_x = v2d->cur.xmin; + if (start_x < 0.0) + start_x += -(float)fmod(v2d->cur.xmin, step); + else + start_x += (step - (float)fmod(v2d->cur.xmin, step)); + + if (start_x > v2d->cur.xmax) + count_x = 0; + else + count_x = (v2d->cur.xmax - start_x) / step + 1; + + start_y = v2d->cur.ymin; + if (start_y < 0.0) + start_y += -(float)fmod(v2d->cur.ymin, step); + else + start_y += (step - (float)fabs(fmod(v2d->cur.ymin, step))); + + if (start_y > v2d->cur.ymax) + count_y = 0; + else + count_y = (v2d->cur.ymax - start_y) / step + 1; - glBegin(GL_LINES); - for (; start < v2d->cur.xmax; start += step) { - glVertex2f(start, v2d->cur.ymin); - glVertex2f(start, v2d->cur.ymax); - } + if (count_x > 0 || count_y > 0) { + VertexFormat* format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + float theme_color[3]; - start = v2d->cur.ymin - (float)fmod(v2d->cur.ymin, step); - for (; start < v2d->cur.ymax; start += step) { - glVertex2f(v2d->cur.xmin, start); - glVertex2f(v2d->cur.xmax, start); - } + UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); + + immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); + immBegin(GL_LINES, count_x * 2 + count_y * 2 + 4); + + immAttrib3fv(color, theme_color); + for (int i = 0; i < count_x ; start_x += step, i++) { + immVertex2f(pos, start_x, v2d->cur.ymin); + immVertex2f(pos, start_x, v2d->cur.ymax); + } + + for (int i = 0; i < count_y; start_y += step, i++) { + immVertex2f(pos, v2d->cur.xmin, start_y); + immVertex2f(pos, v2d->cur.xmax, start_y); + } - /* X and Y axis */ - UI_ThemeColorShade(TH_BACK, -18); - glVertex2f(0.0f, v2d->cur.ymin); - glVertex2f(0.0f, v2d->cur.ymax); - glVertex2f(v2d->cur.xmin, 0.0f); - glVertex2f(v2d->cur.xmax, 0.0f); + /* X and Y axis */ + UI_GetThemeColorShade3fv(TH_BACK, -18, theme_color); + + immAttrib3fv(color, theme_color); + immVertex2f(pos, 0.0f, v2d->cur.ymin); + immVertex2f(pos, 0.0f, v2d->cur.ymax); + immVertex2f(pos, v2d->cur.xmin, 0.0f); + immVertex2f(pos, v2d->cur.xmax, 0.0f); - glEnd(); + immEnd(); + immUnbindProgram(); + } } /* Draw a multi-level grid in given 2d-region */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [edddd2c] blender2.8: Use new immediate mode for ED_region_grid_draw
Commit: e2c6f5059db8c2b1b702a4494ae6cb1e363c Author: Mike Erwin Date: Tue Nov 15 18:28:37 2016 -0500 Branches: blender2.8 https://developer.blender.org/rBe2c6f5059db8c2b1b702a4494ae6cb1e363c Use new immediate mode for ED_region_grid_draw Convert ED_region_grid_draw to new immediate mode. Part of T49043 Reviewers: merwin Reviewed By: merwin Tags: #bf_blender_2.8 Differential Revision: https://developer.blender.org/D2289 === M source/blender/editors/screen/area.c === diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index bd35a7d..7ad4df6 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2371,11 +2371,16 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) int x1, y1, x2, y2; /* the image is located inside (0, 0), (1, 1) as set by view2d */ - UI_ThemeColorShade(TH_BACK, 20); - UI_view2d_view_to_region(>v2d, 0.0f, 0.0f, , ); UI_view2d_view_to_region(>v2d, 1.0f, 1.0f, , ); - glRectf(x1, y1, x2, y2); + + VertexFormat* format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColorShade(TH_BACK, 20); + immRectf(pos, x1, y1, x2, y2); + immUnbindProgram(); /* gridsize adapted to zoom level */ gridsize = 0.5f * (zoomx + zoomy); @@ -2395,33 +2400,52 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) } } - /* the fine resolution level */ blendfac = 0.25f * gridsize - floorf(0.25f * gridsize); CLAMP(blendfac, 0.0f, 1.0f); - UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac))); - - fac = 0.0f; - glBegin(GL_LINES); - while (fac < 1.0f) { - glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac); - glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac); - glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1); - glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2); - fac += gridstep; - } - - /* the large resolution level */ - UI_ThemeColor(TH_BACK); - - fac = 0.0f; - while (fac < 1.0f) { - glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac); - glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac); - glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1); - glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2); - fac += 4.0f * gridstep; - } - glEnd(); + + int count_fine = 1.0f / gridstep; + int count_large = 1.0f / (4.0f * gridstep); + + if (count_fine > 0) { + VertexFormat_clear(format); + pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); + immBegin(GL_LINES, 4 * count_fine + 4 * count_large); + + float theme_color[3]; + UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - blendfac)), theme_color); + immAttrib3fv(color, theme_color); + fac = 0.0f; + + /* the fine resolution level */ + for (int i = 0; i < count_fine; i++) { + immVertex2f(pos, x1, y1 * (1.0f - fac) + y2 * fac); + immVertex2f(pos, x2, y1 * (1.0f - fac) + y2 * fac); + immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y1); + immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y2); + fac += gridstep; + } + + if (count_large > 0) { + UI_GetThemeColor3fv(TH_BACK, theme_color); + immAttrib3fv(color, theme_color); + fac = 0.0f; + + /* the large resolution level */ + for (int i = 0; i < count_large; i++) { + immVertex2f(pos, x1, y1 * (1.0f - fac) + y2 * fac); + immVertex2f(pos, x2, y1 * (1.0f - fac) + y2 * fac); + immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y1); + immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y2); + fac += 4.0f * gridstep; + } + } + + immEnd(); + immUnbindProgram(); + } } /* If the area has overlapping regions, it returns visible rect for Region *ar */ ___ Bf-blender-cvs mailing list
[Bf-blender-cvs] [fdb0d37] HMD_viewport: Remove scene level HMDVIEW_SESSION_RUNNING flag
Commit: fdb0d37bdfeaf5f8cb67ccb0abb3829fab30fb69 Author: Julian Eisel Date: Tue Nov 15 23:30:05 2016 +0100 Branches: HMD_viewport https://developer.blender.org/rBfdb0d37bdfeaf5f8cb67ccb0abb3829fab30fb69 Remove scene level HMDVIEW_SESSION_RUNNING flag Also separated HMD view drawing from stereo3d drawing some more. === M release/scripts/startup/bl_ui/properties_render_layer.py M source/blender/editors/space_view3d/view3d_draw.c M source/blender/makesdna/DNA_scene_types.h M source/blender/makesdna/DNA_screen_types.h M source/blender/makesrna/intern/rna_scene.c M source/blender/makesrna/intern/rna_screen.c M source/blender/makesrna/intern/rna_wm.c M source/blender/windowmanager/WM_api.h M source/blender/windowmanager/intern/wm_draw.c M source/blender/windowmanager/intern/wm_operators.c M source/blender/windowmanager/intern/wm_stereo.c M source/blender/windowmanager/wm.h === diff --git a/release/scripts/startup/bl_ui/properties_render_layer.py b/release/scripts/startup/bl_ui/properties_render_layer.py index a9602cc..16b7662 100644 --- a/release/scripts/startup/bl_ui/properties_render_layer.py +++ b/release/scripts/startup/bl_ui/properties_render_layer.py @@ -237,11 +237,11 @@ class RENDERLAYER_PT_hmd(RenderLayerButtonsPanel, Panel): scene = context.scene wm = context.window_manager +session_running = wm.is_hmd_session_running; -running = scene.hmd_running text_win = "Close HMD Window" if wm.has_hmd_window else "Open HMD Window" -text_run = "Stop Session" if running else "Start Session" -icon = 'PAUSE' if running else 'PLAY' +text_run = "Stop Session" if session_running else "Start Session" +icon = 'PAUSE' if session_running else 'PLAY' row = layout.row(align=True) row.operator("wm.hmd_view_toggle", text=text_win) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7a38409..00fe5ea 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -3608,7 +3608,7 @@ static bool view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d, if ((scene->r.scemode & R_MULTIVIEW) == 0) return false; - if (WM_stereo3d_enabled(C, win, true) == false) + if (WM_stereo3d_enabled(win, true) == false) return false; if ((v3d->camera == NULL) || (v3d->camera->type != OB_CAMERA) || rv3d->persp != RV3D_CAMOB) @@ -3626,10 +3626,10 @@ static bool view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d, #ifdef WITH_INPUT_HMD -static bool view3d_hmd_view_active(wmWindowManager *wm, wmWindow *win, Scene *scene) +static bool view3d_hmd_view_active(wmWindowManager *wm, wmWindow *win) { return ((wm->win_hmd == win) && - (scene->hmd_settings.flag & HMDVIEW_SESSION_RUNNING) && + (wm->win_hmd->screen->is_hmd_running) && (U.hmd_settings.device > -1)); } @@ -3774,7 +3774,7 @@ static void view3d_main_region_draw_objects( /* setup the view matrix */ #ifdef WITH_INPUT_HMD - if (view3d_hmd_view_active(CTX_wm_manager(C), win, scene)) { + if (view3d_hmd_view_active(CTX_wm_manager(C), win)) { view3d_hmd_view_setup(scene, v3d, ar); } else @@ -3984,7 +3984,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar) ED_region_pixelspace(ar); #ifdef WITH_INPUT_HMD - if (view3d_hmd_view_active(CTX_wm_manager(C), CTX_wm_window(C), scene)) { + if (view3d_hmd_view_active(CTX_wm_manager(C), CTX_wm_window(C))) { return; } #endif diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index d8e80be..765dd73 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1581,12 +1581,7 @@ typedef struct DisplaySafeAreas { */ struct HMDViewSettings { char view_shade; /* rna_enum_viewport_shade_items */ - char flag, pad[2]; -}; - -/* HMDViewSettings.flag */ -enum { - HMDVIEW_SESSION_RUNNING = (1 << 0), + char pad[3]; }; /* *** */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index e208ef3..2a5845c 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -69,7 +69,8 @@ typedef struct bScreen { char swap; /* indicator to survive swap-exchange systems */ char skip_handling;
[6397319] master: Fix T50023: Inverse Kinematics angle limits defaulting to 10313.2403124°
Commit: 6397319659cd8304f90f23832d42cdfd1f4f9fb3 Author: Joshua Leung Date: Wed Nov 16 11:09:02 2016 +1300 Branches: master https://developer.blender.org/rB6397319659cd8304f90f23832d42cdfd1f4f9fb3 Fix T50023: Inverse Kinematics angle limits defaulting to 10313.2403124° Regression from 2.77a. The units for the min/max limits were changed in RNA but the pose channels were still being initialised with in degrees. === M source/blender/blenkernel/intern/action.c === diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 470098f..dcbb667 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -433,8 +433,8 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) chan->scaleIn = chan->scaleOut = 1.0f; - chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -180.0f; - chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = 180.0f; + chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -M_PI; + chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = M_PI; chan->stiffness[0] = chan->stiffness[1] = chan->stiffness[2] = 0.0f; chan->ikrotweight = chan->iklinweight = 0.0f; unit_m4(chan->constinv); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8b29059] master: Fix T50026: "Only Insert Needed" doesn't work when using Trackball rotation
Commit: 8b2905952e9a82206f1a112e99ccc27a6acdde63 Author: Joshua Leung Date: Wed Nov 16 11:14:38 2016 +1300 Branches: master https://developer.blender.org/rB8b2905952e9a82206f1a112e99ccc27a6acdde63 Fix T50026: "Only Insert Needed" doesn't work when using Trackball rotation The rotation case here only covered rotation by the "Rotate" tool, but skipped the "Trackball" tool. === M source/blender/editors/transform/transform_conversions.c === diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 9c26689..ce3d903 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5583,7 +5583,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; @@ -5728,7 +5728,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; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0de157a] master: FIX T49899: Add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to classes that use eigen's data types , to force aligned on 16 byte boundaries.
Commit: 0de157a3204206a5d0d90daa00e7c6648e3c9674 Author: lazydodo Date: Tue Nov 15 13:21:01 2016 -0700 Branches: master https://developer.blender.org/rB0de157a3204206a5d0d90daa00e7c6648e3c9674 FIX T49899: Add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to classes that use eigen's data types , to force aligned on 16 byte boundaries. === M intern/iksolver/intern/IK_QSegment.h M intern/iksolver/intern/IK_Solver.cpp === diff --git a/intern/iksolver/intern/IK_QSegment.h b/intern/iksolver/intern/IK_QSegment.h index 74f157a..247807d 100644 --- a/intern/iksolver/intern/IK_QSegment.h +++ b/intern/iksolver/intern/IK_QSegment.h @@ -60,6 +60,7 @@ class IK_QSegment { public: + EIGEN_MAKE_ALIGNED_OPERATOR_NEW virtual ~IK_QSegment(); // start: a user defined translation diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp index cefb8c7..a00db4f 100644 --- a/intern/iksolver/intern/IK_Solver.cpp +++ b/intern/iksolver/intern/IK_Solver.cpp @@ -42,6 +42,7 @@ using namespace std; class IK_QSolver { public: + EIGEN_MAKE_ALIGNED_OPERATOR_NEW IK_QSolver() : root(NULL) { } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2653758] blender2.8: blender 2.8: OpenGL immediate mode: anim_draw
Commit: 2653758adcb241dfc7934f1af45f2f0700478a80 Author: Mike Erwin Date: Tue Nov 15 12:16:47 2016 -0500 Branches: blender2.8 https://developer.blender.org/rB2653758adcb241dfc7934f1af45f2f0700478a80 blender 2.8: OpenGL immediate mode: anim_draw Reviewers: merwin Reviewed By: merwin Maniphest Tasks: T49043 Differential Revision: https://developer.blender.org/D2353 === M source/blender/editors/animation/anim_draw.c === diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 33e44d7..58b9b8e 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -62,6 +62,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "GPU_immediate.h" + /* *** */ /* CURRENT FRAME DRAWING */ @@ -95,9 +97,16 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const x = cfra * xscale; y = 0.9f * U.widget_unit; + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + /* draw green box around/behind text */ - UI_ThemeColorShade(TH_CFRAME, 0); - glRectf(x, y, x + slen, y + 0.75f * U.widget_unit); + immUniformThemeColorShade(TH_CFRAME, 0); + + immRectf(pos, x, y, x + slen, y + 0.75f * U.widget_unit); + immUnbindProgram(); /* draw current frame number - black text */ UI_ThemeColor(TH_TEXT); @@ -112,17 +121,23 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) { Scene *scene = CTX_data_scene(C); - /* Draw a light green line to indicate current frame */ - UI_ThemeColor(TH_CFRAME); - const float x = (float)(scene->r.cfra * scene->r.framelen); glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); - glBegin(GL_LINES); - glVertex2f(x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ - glVertex2f(x, v2d->cur.ymax); - glEnd(); + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + /* Draw a light green line to indicate current frame */ + immUniformThemeColor(TH_CFRAME); + + immBegin(GL_LINES, 2); + immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ + immVertex2f(pos, x, v2d->cur.ymax); + immEnd(); + immUnbindProgram(); /* Draw current frame number in a little box */ if (flag & DRAWCFRA_SHOW_NUMBOX) { @@ -144,17 +159,24 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) if (PRVRANGEON) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glColor4f(0.0f, 0.0f, 0.0f, 0.4f); - + + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); + /* only draw two separate 'curtains' if there's no overlap between them */ if (PSFRA < PEFRA + end_frame_width) { - glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); - glRectf((float)(PEFRA + end_frame_width), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); + immRectf(pos, (float)(PEFRA + end_frame_width), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } else { - glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } - + + immUnbindProgram(); + glDisable(GL_BLEND); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b78ddd4] blender2.8: start using COMP_* instead of GL_* in viewport
Commit: b78ddd43a5af7810b9befb1cdf2be0528c721932 Author: Mike Erwin Date: Tue Nov 15 11:49:00 2016 -0500 Branches: blender2.8 https://developer.blender.org/rBb78ddd43a5af7810b9befb1cdf2be0528c721932 start using COMP_* instead of GL_* in viewport Gawain can accept either enum, but its own COMP_ values are recommended. === M source/blender/editors/space_view3d/view3d_draw.c M source/blender/editors/space_view3d/view3d_draw_legacy.c === diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index e843d3c..9184e47 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -506,9 +506,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) y2i = (int)(y2 + (1.0f - 0.0001f)); /* use the same program for everything */ - VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - + unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* passepartout, specified in camera edit buttons */ @@ -707,8 +705,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) static void drawrenderborder(ARegion *ar, View3D *v3d) { /* use the same program for everything */ - VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glLineWidth(1.0f); @@ -802,8 +799,8 @@ static void view3d_draw_background_gradient() glClear(GL_DEPTH_BUFFER_BIT); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); unsigned char col_hi[3], col_lo[3]; immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -1112,8 +1109,8 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** #endif VertexFormat* format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -1288,8 +1285,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3]; VertexFormat* format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -1376,8 +1373,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr /* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */ VertexFormat* format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + unsigned pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 8042890..86870d4 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -227,8 +227,8 @@ static void drawcursor(Scene *scene,
[Bf-blender-cvs] [44b691d] master: RNA Main API: set remove's do_unlink default value to true.
Commit: 44b691dc658db9d4ae0993546abe559223146b67 Author: Bastien Montagne Date: Tue Nov 15 17:12:18 2016 +0100 Branches: master https://developer.blender.org/rB44b691dc658db9d4ae0993546abe559223146b67 RNA Main API: set remove's do_unlink default value to true. On second and third thoughts, this should have been done that way since the begining, cases were you just delete a few data-blocks without any serious knowledge of their usages are much, much more frequent than cases where you are deleting thousands of data-blocks and are sure they are not used anywhere anymore... Own fault, but really frustrated that this topic was only raised the day after 2.78a was released. :( === M source/blender/makesrna/intern/rna_main_api.c === diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index cc290ea..594c175 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -585,7 +585,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); - RNA_def_boolean(func, "do_unlink", false, "", + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this camera before deleting it " "(WARNING: will also delete objects instancing that camera data)"); @@ -624,7 +624,7 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); - RNA_def_boolean(func, "do_unlink", false, "", "Unlink all usages of this scene before deleting it"); + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this scene before deleting it"); func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); @@ -665,7 +665,7 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); - RNA_def_boolean(func, "do_unlink", false, "", "Unlink all usages of this object before deleting it"); + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this object before deleting it"); func = RNA_def_function(srna, "tag", "rna_Main_objects_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); @@ -702,7 +702,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); - RNA_def_boolean(func, "do_unlink", false, "", "Unlink all usages of this material before deleting it"); + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this material before deleting it"); func = RNA_def_function(srna, "tag", "rna_Main_materials_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); @@ -746,7 +746,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); - RNA_def_boolean(func, "do_unlink", false, "", "Unlink all usages of this node tree before deleting it"); + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this node tree before deleting it"); func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); @@ -805,7 +805,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); - RNA_def_boolean(func, "do_unlink", false, "", + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this mesh before deleting it " "(WARNING: will also delete objects instancing that mesh data)"); @@
[Bf-blender-cvs] [f269067] master: Get rid of 'drivers unlinking' code in `BKE_libblock_free_data()`
Commit: f2690673ba4966542684d5b6f17d0fa329c33b82 Author: Bastien Montagne Date: Tue Nov 15 16:36:47 2016 +0100 Branches: master https://developer.blender.org/rBf2690673ba4966542684d5b6f17d0fa329c33b82 Get rid of 'drivers unlinking' code in `BKE_libblock_free_data()` This has nothing to do here (freeing is not unlinking/remapping!), and was actually redoing something already taken care of by `BKE_libblock_relink_ex()` call in `BKE_libblock_free_ex()`. Also, gives some noticeable speedup when removing datablocks with do_unlink=True, about 5 to 10% quicker e.g. when deleting all objects from a py console, in a big production file... === M source/blender/blenkernel/BKE_library.h M source/blender/blenkernel/intern/library_remap.c === diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index afe13b2..855eb10 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -68,7 +68,6 @@ void BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user) ATTR_NONNULL(); void BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_libblock_free_data(struct Main *bmain, struct ID *id) ATTR_NONNULL(); -void BKE_libblock_free_data_ex(struct Main *bmain, struct ID *id, const bool do_id_user) ATTR_NONNULL(); void BKE_libblock_delete(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 4133342..4e5ece1 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -691,20 +691,10 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata void BKE_libblock_free_data(Main *bmain, ID *id) { - BKE_libblock_free_data_ex(bmain, id, true); -} - -void BKE_libblock_free_data_ex(Main *bmain, ID *id, const bool do_id_user) -{ if (id->properties) { IDP_FreeProperty(id->properties); MEM_freeN(id->properties); } - - if (do_id_user) { - /* this ID may be a driver target! */ - BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id); - } } /** @@ -852,7 +842,7 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const b BLI_remlink(lb, id); - BKE_libblock_free_data_ex(bmain, id, do_id_user); + BKE_libblock_free_data(bmain, id); BKE_main_unlock(bmain); MEM_freeN(id); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [af0e6b3] master: Depsgraph: Fix frash with iTaSC solver
Commit: af0e6b31a5b06521ef541d8e2adc2b0777c880f9 Author: Sergey Sharybin Date: Tue Nov 15 16:18:59 2016 +0100 Branches: master https://developer.blender.org/rBaf0e6b31a5b06521ef541d8e2adc2b0777c880f9 Depsgraph: Fix frash with iTaSC solver This commit reverts part of a fix for T33275, but things are: - I can not reproduce the original issue at all, so doesn't seem to cause any regressions. - It is really bad idea to do delayed initialization in the threaded environment, it's a straight way to some nasty issues. - We can't do things like this anyway because we go more granular, meaning such a delayed initialization will fail in the case of having several IK solvers (unless they properly accommodate to changed bone head). - Verified the fix with various files from Mango project and all of them seems to work nice with new depednency graph now (old depsgraph has some flickering, but it's not related on DEG itself, but on an environment with lots of proxies and threaded evaluation and it is not a new behavior). === M source/blender/ikplugin/intern/itasc_plugin.cpp === diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index b8ed780..d583409 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1763,20 +1763,15 @@ void itasc_initialize_tree(struct Scene *scene, Object *ob, float ctime) } // if at least one tree, create the scenes from the PoseTree stored in the channels // postpone until execute_tree: this way the pose constraint are included - //if (count) - // create_scene(scene, ob, ctime); - //itasc_update_param(ob->pose); + if (count) + create_scene(scene, ob, ctime); + itasc_update_param(ob->pose); // make sure we don't rebuilt until the user changes something important ob->pose->flag &= ~POSE_WAS_REBUILT; } void itasc_execute_tree(struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { - if (!ob->pose->ikdata) { - // IK tree not yet created, no it now - create_scene(scene, ob, ctime); - itasc_update_param(ob->pose); - } if (ob->pose->ikdata) { IK_Data *ikdata = (IK_Data *)ob->pose->ikdata; bItasc *ikparam = (bItasc *) ob->pose->ikparam; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ccf5de8] HMD_viewport: Merge branch 'master' into HMD_viewport
Commit: ccf5de8a71a20b4d427d401b42da94f842b4 Author: Julian Eisel Date: Tue Nov 15 16:18:56 2016 +0100 Branches: HMD_viewport https://developer.blender.org/rBccf5de8a71a20b4d427d401b42da94f842b4 Merge branch 'master' into HMD_viewport Conflicts: source/blender/blenloader/intern/versioning_270.c source/blender/editors/interface/resources.c === === diff --cc source/blender/blenloader/intern/versioning_270.c index 173ebec,8133d04..147efe0 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@@ -1455,12 -1455,15 +1455,25 @@@ void blo_do_versions_270(FileData *fd, } } + /* constant detail for sculpting is now a resolution value instead of +* a percentage, we reuse old DNA struct member but convert it */ + for (Scene *scene = main->scene.first; scene != NULL; scene = scene->id.next) { + if (scene->toolsettings != NULL) { + ToolSettings *ts = scene->toolsettings; + if (ts->sculpt && ts->sculpt->constant_detail != 0.0f) { + ts->sculpt->constant_detail = 100.0f / ts->sculpt->constant_detail; + } + } + } + } ++ ++ { +#ifdef WITH_INPUT_HMD + if (!DNA_struct_elem_find(fd->filesdna, "Scene", "HMDViewSettings", "hmd_settings")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + BKE_scene_hmd_settings_default_init(scene); + } + } +#endif + } } diff --cc source/blender/editors/interface/resources.c index ed0a4ee,5392840..c21bba9 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@@ -2762,11 -2764,7 +2764,9 @@@ void init_userdef_do_versions(void * (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; - } - ++ U.hmd_settings.device = -1; ++ U.hmd_settings.flag = (USER_HMD_USE_DEVICE_IPD | USER_HMD_USE_DEVICE_ROT | USER_HMD_USE_LENSDIST_FX); ++ U.hmd_settings.custom_ipd = 0.061f; } if (U.pixelsize == 0.0f) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9019f8c] master: Revert "Proxy: Construct pchan hash when syncing armature proxy"
Commit: 9019f8ca95d3316cd45abe024ac71d21a9793044 Author: Sergey Sharybin Date: Tue Nov 15 16:13:24 2016 +0100 Branches: master https://developer.blender.org/rB9019f8ca95d3316cd45abe024ac71d21a9793044 Revert "Proxy: Construct pchan hash when syncing armature proxy" This reverts commit 9b5a32cbfb8a8565202bdccd232c53f98b62eeec. Apparently it is possible to have other thread mocking around with the hash. Needs deeper investigation, for the time being reverting to prevent crashes. === M source/blender/blenkernel/intern/armature.c === diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index badfeae..2b33394 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1781,7 +1781,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected BLI_duplicatelist(>agroups, >agroups); pose->active_group = frompose->active_group; - BKE_pose_channels_hash_make(frompose); for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { pchanp = BKE_pose_channel_find_name(frompose, pchan->name); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cb117f2] master: Fix menu inconsistencies
Commit: cb117f283bda615eb63b6767c77a361cea2b8992 Author: Aaron Carlisle Date: Tue Nov 15 15:55:54 2016 +0100 Branches: master https://developer.blender.org/rBcb117f283bda615eb63b6767c77a361cea2b8992 Fix menu inconsistencies This commit fixes two issues: - UV/Image editor uvs menu did not match the 3D View's which was changed in rB2b240b043078 - Circle select tool was missing in particle edit mode Reviewers: Severin Differential Revision: https://developer.blender.org/D2329 === M release/scripts/startup/bl_ui/space_image.py M release/scripts/startup/bl_ui/space_view3d.py === diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index b608718..04b4cef 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -259,6 +259,20 @@ class IMAGE_MT_uvs_showhide(Menu): layout.operator("uv.hide", text="Hide Unselected").unselected = True +class IMAGE_MT_uvs_proportional(Menu): +bl_label = "Proportional Editing" + +def draw(self, context): +layout = self.layout + +layout.props_enum(context.tool_settings, "proportional_edit") + +layout.separator() + +layout.label("Falloff:") +layout.props_enum(context.tool_settings, "proportional_edit_falloff") + + class IMAGE_MT_uvs_transform(Menu): bl_label = "Transform" @@ -360,8 +374,7 @@ class IMAGE_MT_uvs(Menu): layout.separator() -layout.prop_menu_enum(toolsettings, "proportional_edit") -layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") +layout.menu("IMAGE_MT_uvs_proportional") layout.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index bb5eb05..9de9376 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -710,6 +710,7 @@ class VIEW3D_MT_select_particle(Menu): layout = self.layout layout.operator("view3d.select_border") +layout.operator("view3d.select_circle") layout.separator() ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a828818] master: Cleanup: More explicit parentheses
Commit: a828818d59f0f8ea41900a12db703ba3fae075a7 Author: Sergey Sharybin Date: Tue Nov 15 16:01:21 2016 +0100 Branches: master https://developer.blender.org/rBa828818d59f0f8ea41900a12db703ba3fae075a7 Cleanup: More explicit parentheses === M source/blender/windowmanager/intern/wm_event_system.c === diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ad8a670..d2b0acd 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -727,12 +727,13 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat) /* we don't want to do undo pushes for operators that are being * called from operators that already do an undo push. usually * this will happen for python operators that call C operators */ - if (wm->op_undo_depth == 0) + if (wm->op_undo_depth == 0) { if (op->type->flag & OPTYPE_UNDO) ED_undo_push_op(C, op); else if (op->type->flag & OPTYPE_UNDO_GROUPED) ED_undo_grouped_push_op(C, op); - + } + if (repeat == 0) { if (G.debug & G_DEBUG_WM) { char *buf = WM_operator_pystring(C, op, false, true); @@ -1856,11 +1857,12 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand wm->op_undo_depth--; /* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */ - if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0) + if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0) { if (handler->op->type->flag & OPTYPE_UNDO) ED_undo_push_op(C, handler->op); else if (handler->op->type->flag & OPTYPE_UNDO_GROUPED) ED_undo_grouped_push_op(C, handler->op); + } if (handler->op->reports->list.first) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [85e51b0] master: Avoid driver target remapping when freeing the whole database
Commit: 85e51b063854d81b486d7099536bc21404fc627e Author: Sergey Sharybin Date: Tue Nov 15 15:38:03 2016 +0100 Branches: master https://developer.blender.org/rB85e51b063854d81b486d7099536bc21404fc627e Avoid driver target remapping when freeing the whole database Added BKE_libblock_free_data_ex() which takes special do_id_user argument which basically indicates whether main database was already taken care about not having "dead" pointers. Gives about 40% speedup of main database free with quadbot scene (3.4sec vs. 5.4 sec on quite powerful desktop). === M source/blender/blenkernel/BKE_library.h M source/blender/blenkernel/intern/library_remap.c === diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 1cc7014..39e8d71 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -68,6 +68,7 @@ void BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user) ATTR_NONNULL(); void BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_libblock_free_data(struct Main *bmain, struct ID *id) ATTR_NONNULL(); +void BKE_libblock_free_data_ex(struct Main *bmain, struct ID *id, const bool do_id_user) ATTR_NONNULL(); void BKE_libblock_delete(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index b468e64..4262972 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -691,13 +691,20 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata void BKE_libblock_free_data(Main *bmain, ID *id) { + BKE_libblock_free_data_ex(bmain, id, true); +} + +void BKE_libblock_free_data_ex(Main *bmain, ID *id, const bool do_id_user) +{ if (id->properties) { IDP_FreeProperty(id->properties); MEM_freeN(id->properties); } - - /* this ID may be a driver target! */ - BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id); + + if (do_id_user) { + /* this ID may be a driver target! */ + BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id); + } } /** @@ -840,7 +847,7 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user) BLI_remlink(lb, id); - BKE_libblock_free_data(bmain, id); + BKE_libblock_free_data_ex(bmain, id, do_id_user); BKE_main_unlock(bmain); MEM_freeN(id); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [625db1d] master: Avoid interface ID remapping when freeing the whole database
Commit: 625db1d86eab7d1a24f8ce01f12f7ffb945dea14 Author: Sergey Sharybin Date: Tue Nov 15 15:46:52 2016 +0100 Branches: master https://developer.blender.org/rB625db1d86eab7d1a24f8ce01f12f7ffb945dea14 Avoid interface ID remapping when freeing the whole database This makes heavy scenes to be freed almost instantly (so now quadbot scene takes only 0.06sec to free), === M source/blender/blenkernel/BKE_library.h M source/blender/blenkernel/intern/blendfile.c M source/blender/blenkernel/intern/library.c M source/blender/blenkernel/intern/library_remap.c === diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 39e8d71..afe13b2 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -65,7 +65,7 @@ struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_ /* library_remap.c (keep here since they're general functions) */ void BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL(); -void BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user) ATTR_NONNULL(); +void BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user) ATTR_NONNULL(); void BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL(); void BKE_libblock_free_data(struct Main *bmain, struct ID *id) ATTR_NONNULL(); void BKE_libblock_free_data_ex(struct Main *bmain, struct ID *id, const bool do_id_user) ATTR_NONNULL(); diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 6da6847..54f709a 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -407,9 +407,9 @@ bool BKE_blendfile_read_from_memfile( if (bfd) { /* remove the unused screens and wm */ while (bfd->main->wm.first) - BKE_libblock_free_ex(bfd->main, bfd->main->wm.first, true); + BKE_libblock_free_ex(bfd->main, bfd->main->wm.first, true, true); while (bfd->main->screen.first) - BKE_libblock_free_ex(bfd->main, bfd->main->screen.first, true); + BKE_libblock_free_ex(bfd->main, bfd->main->screen.first, true, true); setup_app_data(C, bfd, "", reports); } diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index e5b066a..3411eae 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1211,46 +1211,46 @@ void BKE_main_free(Main *mainvar) while ( (id = lb->first) ) { #if 1 - BKE_libblock_free_ex(mainvar, id, false); + BKE_libblock_free_ex(mainvar, id, false, false); #else /* errors freeing ID's can be hard to track down, * enable this so valgrind will give the line number in its error log */ switch (a) { - case 0: BKE_libblock_free_ex(mainvar, id, false); break; - case 1: BKE_libblock_free_ex(mainvar, id, false); break; - case 2: BKE_libblock_free_ex(mainvar, id, false); break; - case 3: BKE_libblock_free_ex(mainvar, id, false); break; - case 4: BKE_libblock_free_ex(mainvar, id, false); break; - case 5: BKE_libblock_free_ex(mainvar, id, false); break; - case 6: BKE_libblock_free_ex(mainvar, id, false); break; - case 7: BKE_libblock_free_ex(mainvar, id, false); break; - case 8: BKE_libblock_free_ex(mainvar, id, false); break; - case 9: BKE_libblock_free_ex(mainvar, id, false); break; - case 10: BKE_libblock_free_ex(mainvar, id, false); break; - case 11: BKE_libblock_free_ex(mainvar, id, false); break; - case 12: BKE_libblock_free_ex(mainvar, id, false); break; - case 13: BKE_libblock_free_ex(mainvar, id, false); break; - case 14: BKE_libblock_free_ex(mainvar, id, false); break; - case 15: BKE_libblock_free_ex(mainvar, id, false); break; - case 16: BKE_libblock_free_ex(mainvar, id, false); break; - case 17: BKE_libblock_free_ex(mainvar, id, false); break; - case 18: BKE_libblock_free_ex(mainvar, id,
[Bf-blender-cvs] [0cd1b5e] master: Fix T50022: "Mirror" in Dopesheet Crashes Blender
Commit: 0cd1b5ef85142cc3dcd69acdd5dbfc42a622ee3b Author: Julian Eisel Date: Tue Nov 15 15:27:22 2016 +0100 Branches: master https://developer.blender.org/rB0cd1b5ef85142cc3dcd69acdd5dbfc42a622ee3b Fix T50022: "Mirror" in Dopesheet Crashes Blender Just fixing crash itself. Actually operator shouldn't run in most editors (not in dopesheet either I guess), but don't want to spend time on that right now. === M source/blender/editors/transform/transform.c === diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ef6cff1..daf0aed 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); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [69470e3] master: Implement grouped undo option for operators
Commit: 69470e36d6b17042260b06f26ca3c2f702747324 Author: Dalai Felinto Date: Tue Nov 15 11:50:11 2016 +0100 Branches: master https://developer.blender.org/rB69470e36d6b17042260b06f26ca3c2f702747324 Implement grouped undo option for operators This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group. The main usage is for animation, so you can change frames to inspect the poses, and revert the previous pose without having to roll back tons of "change frame" operator, or even see the undo stack full. This complements rB13ee9b8e Design with help by Sergey Sharybin. Reviewers: sergey, mont29 Reviewed By: mont29, sergey Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker Differential Revision: https://developer.blender.org/D2330 === M source/blender/blenkernel/BKE_blender_undo.h M source/blender/blenkernel/intern/blender_undo.c M source/blender/editors/animation/anim_ops.c M source/blender/editors/include/ED_util.h M source/blender/editors/screen/screen_ops.c M source/blender/editors/util/undo.c M source/blender/makesrna/intern/rna_wm.c M source/blender/windowmanager/WM_types.h M source/blender/windowmanager/intern/wm_event_system.c === diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index 9547eeb..84a6d07 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -42,6 +42,7 @@ extern bool BKE_undo_is_valid(const char *name); extern void BKE_undo_reset(void); extern void BKE_undo_number(struct bContext *C, int nr); extern const char *BKE_undo_get_name(int nr, bool *r_active); +extern const char *BKE_undo_get_name_last(void); extern bool BKE_undo_save_file(const char *filename); extern struct Main *BKE_undo_get_main(struct Scene **r_scene); diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index d64bf7e..ce6d29b 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -319,6 +319,13 @@ const char *BKE_undo_get_name(int nr, bool *r_active) return NULL; } +/* return the name of the last item */ +const char *BKE_undo_get_name_last() +{ + UndoElem *uel = undobase.last; + return (uel ? uel->name : NULL); +} + /** * Saves .blend using undo buffer. * diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index d789906..c0d6963 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/include/ED_util.h b/source/blender/editors/include/ED_util.h index f596839..a4afa95 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -52,6 +52,8 @@ voidED_OT_flush_edits(struct wmOperatorType *ot); /* undo.c */ voidED_undo_push(struct bContext *C, const char *str); voidED_undo_push_op(struct bContext *C, struct wmOperator *op); +voidED_undo_grouped_push(struct bContext *C, const char *str); +voidED_undo_grouped_push_op(struct bContext *C, struct wmOperator *op); voidED_undo_pop_op(struct bContext *C, struct wmOperator *op); voidED_undo_pop(struct bContext *C); voidED_undo_redo(struct bContext *C); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 860a865..022b860 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2136,7 +2136,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 +2190,8 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot)
[Bf-blender-cvs] [445274f] master: Depsgraph: Fix typo in previous optimization commit
Commit: 445274fc4fd8d563de585c27711f8385ce4174be Author: Sergey Sharybin Date: Tue Nov 15 11:30:21 2016 +0100 Branches: master https://developer.blender.org/rB445274fc4fd8d563de585c27711f8385ce4174be Depsgraph: Fix typo in previous optimization commit Was a residue from another experiment, caused infinite loop when reporting dependency cycles. === M source/blender/depsgraph/intern/builder/deg_builder_cycle.cc === diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc index d84a590..9b37aaa 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc @@ -88,7 +88,7 @@ void deg_graph_detect_cycles(Depsgraph *graph) } while (!traversal_stack.empty()) { - StackEntry entry = traversal_stack.top(); + StackEntry& entry = traversal_stack.top(); OperationDepsNode *node = entry.node; bool all_child_traversed = true; for (int i = node->done; i < node->outlinks.size(); ++i) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a284d04] master: Atomics: Add some extra utility functions
Commit: a284d040939408a07def751db7d255e3a26e756b Author: Sergey Sharybin Date: Tue Nov 15 13:41:08 2016 +0100 Branches: master https://developer.blender.org/rBa284d040939408a07def751db7d255e3a26e756b Atomics: Add some extra utility functions Also fixed semantic of fetch-and-add in assembler implementation, it seemed to not match the naming. === M intern/atomic/atomic_ops.h M intern/atomic/intern/atomic_ops_ext.h M intern/atomic/intern/atomic_ops_msvc.h M intern/atomic/intern/atomic_ops_unix.h === diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h index c3926fd..1107ded 100644 --- a/intern/atomic/atomic_ops.h +++ b/intern/atomic/atomic_ops.h @@ -79,6 +79,8 @@ #if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8) ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x); ATOMIC_INLINE uint64_t atomic_sub_and_fetch_uint64(uint64_t *p, uint64_t x); +ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x); +ATOMIC_INLINE uint64_t atomic_fetch_and_sub_uint64(uint64_t *p, uint64_t x); ATOMIC_INLINE uint64_t atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new); #endif @@ -95,10 +97,14 @@ ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b); ATOMIC_INLINE size_t atomic_add_and_fetch_z(size_t *p, size_t x); ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x); +ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x); +ATOMIC_INLINE size_t atomic_fetch_and_sub_z(size_t *p, size_t x); ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new); ATOMIC_INLINE unsigned atomic_add_and_fetch_u(unsigned *p, unsigned x); ATOMIC_INLINE unsigned atomic_sub_and_fetch_u(unsigned *p, unsigned x); +ATOMIC_INLINE unsigned atomic_fetch_and_add_u(unsigned *p, unsigned x); +ATOMIC_INLINE unsigned atomic_fetch_and_sub_u(unsigned *p, unsigned x); ATOMIC_INLINE unsigned atomic_cas_u(unsigned *v, unsigned old, unsigned _new); /* WARNING! Float 'atomics' are really faked ones, those are actually closer to some kind of spinlock-sync'ed operation, diff --git a/intern/atomic/intern/atomic_ops_ext.h b/intern/atomic/intern/atomic_ops_ext.h index 74ed327..8421aa7 100644 --- a/intern/atomic/intern/atomic_ops_ext.h +++ b/intern/atomic/intern/atomic_ops_ext.h @@ -78,6 +78,28 @@ ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x) #endif } +ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x) +{ + assert(sizeof(size_t) == LG_SIZEOF_PTR); + +#if (LG_SIZEOF_PTR == 8) + return (size_t)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)x); +#elif (LG_SIZEOF_PTR == 4) + return (size_t)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)x); +#endif +} + +ATOMIC_INLINE size_t atomic_fetch_and_sub_z(size_t *p, size_t x) +{ + assert(sizeof(size_t) == LG_SIZEOF_PTR); + +#if (LG_SIZEOF_PTR == 8) + return (size_t)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)-((int64_t)x)); +#elif (LG_SIZEOF_PTR == 4) + return (size_t)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)-((int32_t)x)); +#endif +} + ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new) { assert(sizeof(size_t) == LG_SIZEOF_PTR); @@ -113,6 +135,28 @@ ATOMIC_INLINE unsigned atomic_sub_and_fetch_u(unsigned *p, unsigned x) #endif } +ATOMIC_INLINE unsigned atomic_fetch_and_add_u(unsigned *p, unsigned x) +{ + assert(sizeof(unsigned) == LG_SIZEOF_INT); + +#if (LG_SIZEOF_INT == 8) + return (unsigned)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)x); +#elif (LG_SIZEOF_INT == 4) + return (unsigned)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)x); +#endif +} + +ATOMIC_INLINE unsigned atomic_fetch_and_sub_u(unsigned *p, unsigned x) +{ + assert(sizeof(unsigned) == LG_SIZEOF_INT); + +#if (LG_SIZEOF_INT == 8) + return (unsigned)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)-((int64_t)x)); +#elif (LG_SIZEOF_INT == 4) + return (unsigned)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)-((int32_t)x)); +#endif +} + ATOMIC_INLINE unsigned atomic_cas_u(unsigned *v, unsigned old, unsigned _new) { assert(sizeof(unsigned) == LG_SIZEOF_INT); diff --git a/intern/atomic/intern/atomic_ops_msvc.h b/intern/atomic/intern/atomic_ops_msvc.h index e7aae4a..034ac1e 100644 --- a/intern/atomic/intern/atomic_ops_msvc.h +++ b/intern/atomic/intern/atomic_ops_msvc.h @@ -57,6 +57,16 @@ ATOMIC_INLINE uint64_t atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _ne { return InterlockedCompareExchange64((int64_t *)v, _new, old); } + +ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x) +{ + return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x); +} + +ATOMIC_INLINE uint64_t atomic_fetch_and_sub_uint64(uint64_t *p, uint64_t x) +{ +
[Bf-blender-cvs] [4ee08e9] master: Atomics: Make naming more obvious about which value is being returned
Commit: 4ee08e9533593b0e7cf7f50b3c4c61eb5598c13e Author: Sergey Sharybin Date: Tue Nov 15 12:16:26 2016 +0100 Branches: master https://developer.blender.org/rB4ee08e9533593b0e7cf7f50b3c4c61eb5598c13e Atomics: Make naming more obvious about which value is being returned === M intern/atomic/atomic_ops.h M intern/atomic/intern/atomic_ops_ext.h M intern/atomic/intern/atomic_ops_msvc.h M intern/atomic/intern/atomic_ops_unix.h M intern/cycles/kernel/kernel_passes.h M intern/cycles/util/util_atomic.h M intern/cycles/util/util_stats.h M intern/guardedalloc/intern/mallocn_guarded_impl.c M intern/guardedalloc/intern/mallocn_lockfree_impl.c M source/blender/blenkernel/intern/depsgraph.c M source/blender/blenkernel/intern/dynamicpaint.c M source/blender/blenkernel/intern/mesh_evaluate.c M source/blender/blenkernel/intern/pbvh.c M source/blender/blenlib/intern/task.c M source/blender/compositor/intern/COM_ExecutionGroup.cpp M source/blender/depsgraph/intern/eval/deg_eval.cc M source/blender/editors/space_file/filelist.c M source/gameengine/VideoTexture/VideoDeckLink.cpp === diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h index f78eab7..c3926fd 100644 --- a/intern/atomic/atomic_ops.h +++ b/intern/atomic/atomic_ops.h @@ -77,13 +77,13 @@ /* Function prototypes. */ #if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8) -ATOMIC_INLINE uint64_t atomic_add_uint64(uint64_t *p, uint64_t x); -ATOMIC_INLINE uint64_t atomic_sub_uint64(uint64_t *p, uint64_t x); +ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x); +ATOMIC_INLINE uint64_t atomic_sub_and_fetch_uint64(uint64_t *p, uint64_t x); ATOMIC_INLINE uint64_t atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new); #endif -ATOMIC_INLINE uint32_t atomic_add_uint32(uint32_t *p, uint32_t x); -ATOMIC_INLINE uint32_t atomic_sub_uint32(uint32_t *p, uint32_t x); +ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x); +ATOMIC_INLINE uint32_t atomic_sub_and_fetch_uint32(uint32_t *p, uint32_t x); ATOMIC_INLINE uint32_t atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _new); ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x); @@ -93,18 +93,18 @@ ATOMIC_INLINE uint32_t atomic_fetch_and_and_uint32(uint32_t *p, uint32_t x); ATOMIC_INLINE uint8_t atomic_fetch_and_or_uint8(uint8_t *p, uint8_t b); ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b); -ATOMIC_INLINE size_t atomic_add_z(size_t *p, size_t x); -ATOMIC_INLINE size_t atomic_sub_z(size_t *p, size_t x); +ATOMIC_INLINE size_t atomic_add_and_fetch_z(size_t *p, size_t x); +ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x); ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new); -ATOMIC_INLINE unsigned atomic_add_u(unsigned *p, unsigned x); -ATOMIC_INLINE unsigned atomic_sub_u(unsigned *p, unsigned x); +ATOMIC_INLINE unsigned atomic_add_and_fetch_u(unsigned *p, unsigned x); +ATOMIC_INLINE unsigned atomic_sub_and_fetch_u(unsigned *p, unsigned x); ATOMIC_INLINE unsigned atomic_cas_u(unsigned *v, unsigned old, unsigned _new); /* WARNING! Float 'atomics' are really faked ones, those are actually closer to some kind of spinlock-sync'ed operation, * which means they are only efficient if collisions are highly unlikely (i.e. if probability of two threads * working on the same pointer at the same time is very low). */ -ATOMIC_INLINE float atomic_add_fl(float *p, const float x); +ATOMIC_INLINE float atomic_add_and_fetch_fl(float *p, const float x); /**/ /* Include system-dependent implementations. */ diff --git a/intern/atomic/intern/atomic_ops_ext.h b/intern/atomic/intern/atomic_ops_ext.h index 4065299..74ed327 100644 --- a/intern/atomic/intern/atomic_ops_ext.h +++ b/intern/atomic/intern/atomic_ops_ext.h @@ -56,25 +56,25 @@ /**/ /* size_t operations. */ -ATOMIC_INLINE size_t atomic_add_z(size_t *p, size_t x) +ATOMIC_INLINE size_t atomic_add_and_fetch_z(size_t *p, size_t x) { assert(sizeof(size_t) == LG_SIZEOF_PTR); #if (LG_SIZEOF_PTR == 8) - return (size_t)atomic_add_uint64((uint64_t *)p, (uint64_t)x); + return (size_t)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)x); #elif (LG_SIZEOF_PTR == 4) - return (size_t)atomic_add_uint32((uint32_t *)p, (uint32_t)x); + return (size_t)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)x); #endif } -ATOMIC_INLINE size_t atomic_sub_z(size_t *p, size_t x) +ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x) { assert(sizeof(size_t) == LG_SIZEOF_PTR);