[Bf-blender-cvs] [c017e1cb676] master: Fix T80409: Walk rotation speed depends on view size
Commit: c017e1cb676314690a8c0b7da154a0815024171e Author: Campbell Barton Date: Thu Sep 3 14:31:26 2020 +1000 Branches: master https://developer.blender.org/rBc017e1cb676314690a8c0b7da154a0815024171e Fix T80409: Walk rotation speed depends on view size Use a fixed speed for rotating the view in walk mode, Keep the current behavior for tablet input and fly mode. === M source/blender/editors/space_view3d/view3d_walk.c === diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 2cc41097070..2fb44c29d2e 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -985,7 +985,8 @@ static float getVelocityZeroTime(const float gravity, const float velocity) static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) { -#define WALK_ROTATE_FAC 2.2f /* more is faster */ +#define WALK_ROTATE_RELATIVE_FAC 2.2f /* More is faster, relative to region size. */ +#define WALK_ROTATE_CONSTANT_FAC DEG2RAD(0.15f) /* More is faster, radians per-pixel. */ #define WALK_TOP_LIMIT DEG2RADF(85.0f) #define WALK_BOTTOM_LIMIT DEG2RADF(-80.0f) #define WALK_MOVE_SPEED base_speed @@ -1063,10 +1064,19 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) float y; /* relative offset */ - y = (float)moffset[1] / region->winy; + y = (float)moffset[1]; - /* speed factor */ - y *= WALK_ROTATE_FAC; + /* Speed factor. */ +#ifdef USE_TABLET_SUPPORT + if (walk->is_cursor_absolute) { +y /= region->winy; +y *= WALK_ROTATE_RELATIVE_FAC; + } + else +#endif + { +y *= WALK_ROTATE_CONSTANT_FAC; + } /* user adjustment factor */ y *= walk->mouse_speed; @@ -1103,10 +1113,19 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) } /* relative offset */ - x = (float)moffset[0] / region->winx; + x = (float)moffset[0]; - /* speed factor */ - x *= WALK_ROTATE_FAC; + /* Speed factor. */ +#ifdef USE_TABLET_SUPPORT + if (walk->is_cursor_absolute) { +x /= region->winx; +x *= WALK_ROTATE_RELATIVE_FAC; + } + else +#endif + { +x *= WALK_ROTATE_CONSTANT_FAC; + } /* user adjustment factor */ x *= walk->mouse_speed; @@ -1320,10 +1339,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) } return OPERATOR_FINISHED; -#undef WALK_ROTATE_FAC -#undef WALK_ZUP_CORRECT_FAC -#undef WALK_ZUP_CORRECT_ACCEL -#undef WALK_SMOOTH_FAC +#undef WALK_ROTATE_RELATIVE_FAC #undef WALK_TOP_LIMIT #undef WALK_BOTTOM_LIMIT #undef WALK_MOVE_SPEED ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [99c3ac17f20] master: Modifiers: default to exact boolean method ignoring build options
Commit: 99c3ac17f2011f8c554a98ed8f9010a7befc884c Author: Campbell Barton Date: Thu Sep 3 10:07:39 2020 +1000 Branches: master https://developer.blender.org/rB99c3ac17f2011f8c554a98ed8f9010a7befc884c Modifiers: default to exact boolean method ignoring build options This change doesn't impact release builds, in general avoid having defaults depend on build options since it means files from different builds won't match. === M source/blender/modifiers/intern/MOD_boolean.c === diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 1a6ceefe5e8..87489c90de3 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -76,11 +76,7 @@ static void initData(ModifierData *md) bmd->double_threshold = 1e-6f; bmd->operation = eBooleanModifierOp_Difference; -#ifdef WITH_GMP bmd->solver = eBooleanModifierSolver_Exact; -#else - bmd->solver = eBooleanModifierSolver_Fast; -#endif } static bool isDisabled(const struct Scene *UNUSED(scene), @@ -322,12 +318,12 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } #ifdef WITH_GMP -bool use_exact = bmd->solver == eBooleanModifierSolver_Exact; +const bool use_exact = bmd->solver == eBooleanModifierSolver_Exact; #else if (bmd->solver == eBooleanModifierSolver_Exact) { BKE_modifier_set_error(md, "Compiled without GMP, using fast solver"); } -bool use_exact = false; +const bool use_exact = false; #endif if (use_exact) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2820f7be763] master: Fix T80340: Crash with an empty text with Text on Curve
Commit: 2820f7be7637e0a4f7edb60f235a876bdc6f0360 Author: Campbell Barton Date: Thu Sep 3 12:37:24 2020 +1000 Branches: master https://developer.blender.org/rB2820f7be7637e0a4f7edb60f235a876bdc6f0360 Fix T80340: Crash with an empty text with Text on Curve Avoid divide by zero, based on D8780 by @lichtwerk. === M source/blender/blenkernel/intern/font.c === diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index bb1bf8a98c5..6eaa79d5062 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1273,7 +1273,13 @@ static bool vfont_to_curve(Object *ob, /* We put the x-coordinate exact at the curve, the y is rotated. */ /* length correction */ - distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / (maxx - minx); + float chartrans_size_x = maxx - minx; + if (UNLIKELY(chartrans_size_x == 0.0f)) { +/* Happens when there are no characters, + * the result isn't useful in this case, just avoid divide by zero. */ +chartrans_size_x = 1.0f; + } + distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / chartrans_size_x; timeofs = 0.0f; if (distfac > 1.0f) { @@ -1294,7 +1300,7 @@ static bool vfont_to_curve(Object *ob, distfac = 1.0; } - distfac /= (maxx - minx); + distfac /= chartrans_size_x; timeofs += distfac * cu->xof; /* not cyclic */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7ff7a9c8fdc] master: Cleanup: remove redundant Y bounds calculation for text on path
Commit: 7ff7a9c8fdc09f8baeebfcb63de144c7b8d88b3f Author: Campbell Barton Date: Thu Sep 3 12:26:46 2020 +1000 Branches: master https://developer.blender.org/rB7ff7a9c8fdc09f8baeebfcb63de144c7b8d88b3f Cleanup: remove redundant Y bounds calculation for text on path Also correct some comments. === M source/blender/blenkernel/intern/font.c === diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index dfbb8202093..bb1bf8a98c5 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1244,7 +1244,7 @@ static bool vfont_to_curve(Object *ob, if (cu->textoncurve->runtime.curve_cache != NULL && cu->textoncurve->runtime.curve_cache->path != NULL) { float distfac, imat[4][4], imat3[3][3], cmat[3][3]; - float minx, maxx, miny, maxy; + float minx, maxx; float timeofs, sizefac; if (ob != NULL) { @@ -1259,32 +1259,25 @@ static bool vfont_to_curve(Object *ob, mul_m3_m3m3(cmat, cmat, imat3); sizefac = normalize_v3(cmat[0]) / font_size; - minx = miny = 1.0e20f; - maxx = maxy = -1.0e20f; ct = chartransdata; - for (i = 0; i <= slen; i++, ct++) { + minx = maxx = ct->xof; + for (i = 1; i <= slen; i++, ct++) { if (minx > ct->xof) { minx = ct->xof; } if (maxx < ct->xof) { maxx = ct->xof; } -if (miny > ct->yof) { - miny = ct->yof; -} -if (maxy < ct->yof) { - maxy = ct->yof; -} } - /* we put the x-coordinaat exact at the curve, the y is rotated */ + /* We put the x-coordinate exact at the curve, the y is rotated. */ /* length correction */ distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / (maxx - minx); timeofs = 0.0f; if (distfac > 1.0f) { -/* path longer than text: spacemode involves */ +/* Path longer than text: space-mode is involved. */ distfac = 1.0f / distfac; if (cu->spacemode == CU_ALIGN_X_RIGHT) { @@ -1310,7 +1303,7 @@ static bool vfont_to_curve(Object *ob, float ctime, dtime, vec[4], tvec[4], rotvec[3]; float si, co; -/* rotate around center character */ +/* Rotate around center character. */ info = [i]; ascii = mem[i]; if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fc6b0c6f85f] master: Fix crash running remesh modifier without OpenVDB
Commit: fc6b0c6f85fa19856946b209a993d0054bef697c Author: Campbell Barton Date: Thu Sep 3 13:28:15 2020 +1000 Branches: master https://developer.blender.org/rBfc6b0c6f85fa19856946b209a993d0054bef697c Fix crash running remesh modifier without OpenVDB === M source/blender/modifiers/intern/MOD_remesh.c === diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index 2c554a6b1a0..7a58b985429 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -165,6 +165,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx) return NULL; } result = BKE_mesh_remesh_voxel_to_mesh_nomain(mesh, rmd->voxel_size, rmd->adaptivity, 0.0f); +if (result == NULL) { + return NULL; +} } else { /* Dualcon modes. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [14e2596d219] master: UI: pixel align axis navigation characters to resolve blurry text
Commit: 14e2596d219d9bc31b356c9ed6c46d68b8560f42 Author: Campbell Barton Date: Wed Sep 2 23:05:35 2020 +1000 Branches: master https://developer.blender.org/rB14e2596d219d9bc31b356c9ed6c46d68b8560f42 UI: pixel align axis navigation characters to resolve blurry text Also increase text size from 11 to 12 since the default font at 1.0 scale was a little fuzzy too. Reviewed by: @pablovazquez Ref D8781 === M source/blender/editors/space_view3d/view3d_gizmo_navigate.c M source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c === diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c index 533fba3795b..7a201d8841c 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c @@ -298,8 +298,8 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g if (show_rotate_gizmo) { gz = navgroup->gz_array[GZ_INDEX_ROTATE]; -gz->matrix_basis[3][0] = co_rotate[0]; -gz->matrix_basis[3][1] = co_rotate[1]; +gz->matrix_basis[3][0] = roundf(co_rotate[0]); +gz->matrix_basis[3][1] = roundf(co_rotate[1]); WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false); } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index d3294e4e5a9..5eb106a0d6b 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -247,6 +247,8 @@ static void axis_geom_draw(const wmGizmo *gz, #ifdef USE_AXIS_FONT struct { float matrix[4][4]; +float matrix_m3[3][3]; +float matrix_m3_invert[3][3]; int id; } font; @@ -254,7 +256,10 @@ static void axis_geom_draw(const wmGizmo *gz, font.id = blf_mono_font; BLF_disable(font.id, BLF_ROTATION | BLF_SHADOW | BLF_MATRIX | BLF_ASPECT | BLF_WORD_WRAP); BLF_color4fv(font.id, axis_black); -BLF_size(font.id, 11 * U.dpi_fac, 72); +BLF_size(font.id, 12 * U.dpi_fac, 72); + +/* The view matrix is used to position the text. */ +BLF_position(font.id, 0, 0, 0); /* Calculate the inverse of the (matrix_final * matrix_offset). * This allows us to use the final location, while reversing the rotation so fonts @@ -264,7 +269,9 @@ static void axis_geom_draw(const wmGizmo *gz, copy_m3_m4(m3, draw_info->matrix_final); copy_m3_m4(m3_offset, gz->matrix_offset); mul_m3_m3m3(m3, m3, m3_offset); +copy_m3_m3(font.matrix_m3_invert, m3); invert_m3(m3); +copy_m3_m3(font.matrix_m3, m3); copy_m4_m3(font.matrix, m3); } #endif @@ -441,27 +448,40 @@ static void axis_geom_draw(const wmGizmo *gz, /* Axis XYZ Character. */ if (show_axis_char && (select == false)) { #ifdef USE_AXIS_FONT +float axis_str_size[2] = {0}; +const char axis_str[2] = {'X' + axis, 0}; +BLF_width_and_height(font.id, axis_str, 2, _str_size[0], _str_size[1]); + +/* Calculate pixel aligned location, without this text draws fuzzy. */ +float v_final_px[3]; +mul_v3_m3v3(v_final_px, font.matrix_m3_invert, v_final); +/* Center the test and pixel align, it's important to round once + * otherwise the characters are noticeably not-centered. + * If this wasn't an issue we could use #BLF_position to place the text. */ +v_final_px[0] = roundf(v_final_px[0] - (axis_str_size[0] / 2.0f)); +v_final_px[1] = roundf(v_final_px[1] - (axis_str_size[1] / 2.0f)); +mul_m3_v3(font.matrix_m3, v_final_px); + immUnbindProgram(); GPU_matrix_push(); -GPU_matrix_translate_3fv(v_final); +GPU_matrix_translate_3fv(v_final_px); GPU_matrix_mul(font.matrix); -const char axis_str[2] = {'X' + axis, 0}; -float offset[2] = {0}; -BLF_width_and_height(font.id, axis_str, 2, [0], [1]); -BLF_position(font.id, roundf(offset[0] * -0.5f), roundf(offset[1] * -0.5f), 0); BLF_draw_ascii(font.id, axis_str, 2); GPU_blend(GPU_BLEND_ALPHA); /* XXX, blf disables */ GPU_matrix_pop(); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); #else +immUnbindProgram(); +immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); GPU_line_width(1.0f); float m3[3][3]; copy_m3_m4(m3, gz->matrix_offset); immUniformColor4fv(axis_black); draw_xyz_wire(pos_id, m3, v_final, 1.0, axis); +immUnbindProgram(); #endif } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [89cdf4f75dd] master: Fix Cloth Snake Hook brush not using pressure
Commit: 89cdf4f75dd0f2d7cfd993cff7797371b73627d0 Author: Pablo Dobarro Date: Wed Sep 2 22:33:05 2020 +0200 Branches: master https://developer.blender.org/rB89cdf4f75dd0f2d7cfd993cff7797371b73627d0 Fix Cloth Snake Hook brush not using pressure The Snake Hook deformation mode was using the same strength as grab (not supporting pressure), but this deformation mode supports pressure. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8724 === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7cb4f74282b..1078e97e7cf 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2273,10 +2273,13 @@ static float brush_strength(const Sculpt *sd, case SCULPT_TOOL_DISPLACEMENT_ERASER: return alpha * pressure * overlap * feather; case SCULPT_TOOL_CLOTH: - if (ELEM(brush->cloth_deform_type, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_SNAKE_HOOK)) { + if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_GRAB) { /* Grab deform uses the same falloff as a regular grab brush. */ return root_alpha * feather; } + else if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_SNAKE_HOOK) { +return root_alpha * feather * pressure * overlap; + } else if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_EXPAND) { /* Expand is more sensible to strength as it keeps expanding the cloth when sculpting over * the same vertices. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fb09bc3c35b] master: Fix T80311: Sculpt Filters not working when using vertical split
Commit: fb09bc3c35b7544c46c13cc322421419948a3d52 Author: Pablo Dobarro Date: Wed Sep 2 22:30:36 2020 +0200 Branches: master https://developer.blender.org/rBfb09bc3c35b7544c46c13cc322421419948a3d52 Fix T80311: Sculpt Filters not working when using vertical split All filters were using prevclicx, which is in screen coordinates and mval[0], which is in region coordinates to get the filter strength. This fixes the issue in all filters. Reviewed By: Severin Maniphest Tasks: T80311 Differential Revision: https://developer.blender.org/D8776 === M source/blender/editors/sculpt_paint/sculpt_cloth.c M source/blender/editors/sculpt_paint/sculpt_filter_color.c M source/blender/editors/sculpt_paint/sculpt_filter_mesh.c === diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index c3666c8aaad..a95e4f7008c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -1241,7 +1241,7 @@ static int sculpt_cloth_filter_modal(bContext *C, wmOperator *op, const wmEvent return OPERATOR_RUNNING_MODAL; } - float len = event->prevclickx - event->mval[0]; + const float len = event->prevclickx - event->x; filter_strength = filter_strength * -len * 0.001f * UI_DPI_FAC; SCULPT_vertex_random_access_ensure(ss); diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c index c5acf736f3e..89af836d095 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c @@ -228,7 +228,7 @@ static int sculpt_color_filter_modal(bContext *C, wmOperator *op, const wmEvent return OPERATOR_RUNNING_MODAL; } - float len = event->prevclickx - event->mval[0]; + const float len = event->prevclickx - event->x; filter_strength = filter_strength * -len * 0.001f; float fill_color[3]; diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index 619a1b975b6..1cbf9275a56 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -636,7 +636,7 @@ static int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, const wmEvent * return OPERATOR_RUNNING_MODAL; } - float len = event->prevclickx - event->mval[0]; + const float len = event->prevclickx - event->x; filter_strength = filter_strength * -len * 0.001f * UI_DPI_FAC; SCULPT_vertex_random_access_ensure(ss); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ba4a2a4c8b8] master: UI: Use instanced panel custom data instead of list index
Commit: ba4a2a4c8b827201b18e97d9dd025ef93a4db754 Author: Hans Goudey Date: Wed Sep 2 14:13:26 2020 -0500 Branches: master https://developer.blender.org/rBba4a2a4c8b827201b18e97d9dd025ef93a4db754 UI: Use instanced panel custom data instead of list index For modifier shortcuts we added a "custom_data" field to panels. This commit uses the same system for accessing the list data that corresponds to each panel. This way the context is only used once and the modifier for each panel can be accessed more easily later. This ends up being mostly a cleanup commit with a few small changes in interface_panel.c. The large changes in the UI functions are due to the fact that the panel custom data is now passed around as a single pointer instead of being created again for every panel. The list_index variable in Panel.runtime is removed as it's now unnecessary. Differential Revision: https://developer.blender.org/D8559 === M release/scripts/startup/bl_ui/properties_constraint.py M source/blender/editors/include/UI_interface.h M source/blender/editors/interface/interface_panel.c M source/blender/editors/interface/interface_templates.c M source/blender/editors/screen/area.c M source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c M source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h M source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c M source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c M source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c M source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c M source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c M source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c M source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c M source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c M source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c M source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c M source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c M source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c M source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c M source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c M source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c M source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c M source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c M source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c M source/blender/makesdna/DNA_screen_types.h M source/blender/makesrna/intern/rna_ui.c M source/blender/modifiers/intern/MOD_armature.c M source/blender/modifiers/intern/MOD_array.c M source/blender/modifiers/intern/MOD_bevel.c M source/blender/modifiers/intern/MOD_boolean.c M source/blender/modifiers/intern/MOD_build.c M source/blender/modifiers/intern/MOD_cast.c M source/blender/modifiers/intern/MOD_cloth.c M source/blender/modifiers/intern/MOD_collision.c M source/blender/modifiers/intern/MOD_correctivesmooth.c M source/blender/modifiers/intern/MOD_curve.c M source/blender/modifiers/intern/MOD_datatransfer.c M source/blender/modifiers/intern/MOD_decimate.c M source/blender/modifiers/intern/MOD_displace.c M source/blender/modifiers/intern/MOD_dynamicpaint.c M source/blender/modifiers/intern/MOD_edgesplit.c M source/blender/modifiers/intern/MOD_explode.c M source/blender/modifiers/intern/MOD_fluid.c M source/blender/modifiers/intern/MOD_hook.c M source/blender/modifiers/intern/MOD_laplaciandeform.c M source/blender/modifiers/intern/MOD_laplaciansmooth.c M source/blender/modifiers/intern/MOD_lattice.c M source/blender/modifiers/intern/MOD_mask.cc M source/blender/modifiers/intern/MOD_meshcache.c M source/blender/modifiers/intern/MOD_meshdeform.c M source/blender/modifiers/intern/MOD_meshsequencecache.c M source/blender/modifiers/intern/MOD_mirror.c M source/blender/modifiers/intern/MOD_multires.c M source/blender/modifiers/intern/MOD_normal_edit.c M source/blender/modifiers/intern/MOD_ocean.c M source/blender/modifiers/intern/MOD_particleinstance.c M source/blender/modifiers/intern/MOD_particlesystem.c M source/blender/modifiers/intern/MOD_remesh.c M source/blender/modifiers/intern/MOD_screw.c M source/blender/modifiers/intern/MOD_shrinkwrap.c M source/blender/modifiers/intern/MOD_simpledeform.c M source/blender/modifiers/intern/MOD_simulation.cc M source/blender/modifiers/intern/MOD_skin.c M source/blender/modifiers/intern/MOD_smooth.c M source/blender/modifiers/intern/MOD_softbody.c M source/blender/modifiers/intern/MOD_solidify.c M
[Bf-blender-cvs] [ff7d7423502] master: Quiet all warnings when building Bullet
Commit: ff7d74235023d0c927c0ad3f4d72d1c5dd41b240 Author: Sebastian Parborg Date: Wed Sep 2 21:06:02 2020 +0200 Branches: master https://developer.blender.org/rBff7d74235023d0c927c0ad3f4d72d1c5dd41b240 Quiet all warnings when building Bullet === M extern/bullet2/CMakeLists.txt === diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt index 648442e1bd9..2c63d76296c 100644 --- a/extern/bullet2/CMakeLists.txt +++ b/extern/bullet2/CMakeLists.txt @@ -20,11 +20,8 @@ # avoid noisy warnings if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - add_c_flag( -"-Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -Wno-reorder" - ) remove_cc_flag( -"-Wmissing-declarations" +"-Wall" ) endif() ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4446c3a593c] master: Sync Bullet to upstream
Commit: 4446c3a593c51603e135e38951607b9b668ddec5 Author: Sebastian Parborg Date: Wed Sep 2 20:41:30 2020 +0200 Branches: master https://developer.blender.org/rB4446c3a593c51603e135e38951607b9b668ddec5 Sync Bullet to upstream This syncs Bullet to the latest upstream git version as of writing this. (commit 47b0259b9700455022b5cf79b651cc1dc71dd59e). === M extern/bullet2/CMakeLists.txt D extern/bullet2/patches/blender.patch D extern/bullet2/patches/btPolyhedralConvexShape_Inertia_fix.patch A extern/bullet2/patches/inertia.patch D extern/bullet2/src/Bullet-C-Api.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h A extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvt.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvt.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btDispatcher.h D extern/bullet2/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp D extern/bullet2/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h M extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp M extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h M extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionConfiguration.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h A extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp A extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp M extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h M extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp M
[Bf-blender-cvs] [24a97299212] soc-2020-io-performance: Cleanup: comments and rna warning.
Commit: 24a97299212b4020d96ce6d5931f569bf2aca34d Author: Ankit Meel Date: Wed Sep 2 23:47:22 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB24a97299212b4020d96ce6d5931f569bf2aca34d Cleanup: comments and rna warning. === M source/blender/editors/io/io_obj.c M source/blender/io/wavefront_obj/intern/obj_exporter.cc === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index b52d3d84539..8107ccff1d6 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -333,7 +333,7 @@ void WM_OT_obj_export(struct wmOperatorType *ot) true, "Export Normals", "Export per-face normals if the face is flat-shaded, per-face-per-vertex " - "normals if smooth-shaded."); + "normals if smooth-shaded"); RNA_def_boolean(ot->srna, "export_materials", true, diff --git a/source/blender/io/wavefront_obj/intern/obj_exporter.cc b/source/blender/io/wavefront_obj/intern/obj_exporter.cc index 907c22afd7a..90d284e24cc 100644 --- a/source/blender/io/wavefront_obj/intern/obj_exporter.cc +++ b/source/blender/io/wavefront_obj/intern/obj_exporter.cc @@ -128,8 +128,8 @@ static void export_frame(ViewLayer *view_layer, frame_writer.write_mtllib(filepath); } for (int i = 0; i < exportable_as_mesh.size(); i++) { -/* Smooth groups and UV vertex indices may take huge memory, so remove objects right - * after they're written. */ +/* Smooth groups and UV vertex indices may take huge memory, so objects should be freed right + * after they're written, instead of waiting for Vector to clean up. */ const std::unique_ptr mesh_to_export = std::move(exportable_as_mesh[i]); frame_writer.write_object_name(*mesh_to_export); frame_writer.write_vertex_coords(*mesh_to_export); @@ -157,8 +157,8 @@ static void export_frame(ViewLayer *view_layer, /* Export nurbs in parm form, not as vertices and edges. */ for (const std::unique_ptr _to_export : exportable_as_nurbs) { -/* Curves don't have any dynamically allocated memory, so it's find to keep them - * around till Vector's cleanup. */ +/* Curves don't have any dynamically allocated memory, so it's fine + * to wait for Vector to clean the objects up. */ frame_writer.write_nurbs_curve(*nurbs_to_export); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6b62935e896] soc-2020-io-performance: Fix importing multiple material for one object.
Commit: 6b62935e8963cccb1d0a324097f035f011806ee1 Author: Ankit Meel Date: Thu Sep 3 00:10:45 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB6b62935e8963cccb1d0a324097f035f011806ee1 Fix importing multiple material for one object. Also add sphere type reflection to Metallic socket. Remove double inline warnings, and also trust compiler to inline what it deems fit. === M source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc M source/blender/io/wavefront_obj/intern/obj_import_mesh.cc M source/blender/io/wavefront_obj/intern/obj_import_mtl.cc M source/blender/io/wavefront_obj/intern/obj_import_mtl.hh M source/blender/io/wavefront_obj/intern/obj_import_objects.cc M source/blender/io/wavefront_obj/intern/obj_import_objects.hh M source/blender/io/wavefront_obj/intern/obj_importer.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc index 92a4f4625b5..457bc8c59dd 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc @@ -42,7 +42,7 @@ using std::string; static void read_next_line(std::ifstream , string _line) { std::string new_line; - while (file.good() && r_line.back() == '\\') { + while (file.good() && !r_line.empty() && r_line.back() == '\\') { new_line.clear(); bool ok = static_cast(std::getline(file, new_line)); /* Remove the last backslash character. */ @@ -158,9 +158,9 @@ static void copy_string_to_float(StringRef src, const float fallback_value, floa * Catches exception if any string cannot be converted to a float. The destination * float is set to the given fallback value in that case. */ -static BLI_INLINE void copy_string_to_float(Span src, - const float fallback_value, - MutableSpan r_dst) +static void copy_string_to_float(Span src, + const float fallback_value, + MutableSpan r_dst) { BLI_assert(src.size() >= r_dst.size()); for (int i = 0; i < r_dst.size(); ++i) { @@ -174,7 +174,7 @@ static BLI_INLINE void copy_string_to_float(Span src, * Catches exception if the string cannot be converted to an integer. The destination * int is set to the given fallback value in that case. */ -static BLI_INLINE void copy_string_to_int(StringRef src, const int fallback_value, int _dst) +static void copy_string_to_int(StringRef src, const int fallback_value, int _dst) { try { r_dst = std::stoi(string(src)); @@ -196,9 +196,9 @@ static BLI_INLINE void copy_string_to_int(StringRef src, const int fallback_valu * Catches exception if any string cannot be converted to an integer. The destination * int is set to the given fallback value in that case. */ -static BLI_INLINE void copy_string_to_int(Span src, - const int fallback_value, - MutableSpan r_dst) +static void copy_string_to_int(Span src, + const int fallback_value, + MutableSpan r_dst) { BLI_assert(src.size() >= r_dst.size()); for (int i = 0; i < r_dst.size(); ++i) { @@ -292,6 +292,7 @@ void OBJParser::parse_and_store(Vector> _all_geometr * elements in the object. */ bool shaded_smooth = false; string object_group{}; + string material_name; while (std::getline(obj_file_, line)) { /* Keep reading new lines if the last character is `\`. */ @@ -310,6 +311,7 @@ void OBJParser::parse_and_store(Vector> _all_geometr else if (line_key == "o") { shaded_smooth = false; object_group = {}; + material_name = ""; current_geometry = create_geometry( current_geometry, GEOM_MESH, rest_line, r_global_vertices, r_all_geometries, offset); } @@ -375,6 +377,9 @@ void OBJParser::parse_and_store(Vector> _all_geometr BLI_assert(current_geometry); FaceElement curr_face; curr_face.shaded_smooth = shaded_smooth; + if (!material_name.empty()) { +curr_face.material_name = material_name; + } if (!object_group.empty()) { curr_face.vertex_group = object_group; /* Yes it repeats several times, but another if-check will not reduce steps either. */ @@ -470,7 +475,9 @@ void OBJParser::parse_and_store(Vector> _all_geometr /* Curves mark their end this way. */ } else if (line_key == "usemtl") { - current_geometry->material_names_.append(string(rest_line)); + /* Materials may repeat if faces are written without sorting. */ + current_geometry->material_names_.add(string(rest_line)); + material_name =
[Bf-blender-cvs] [6f6f6ee1869] master: Fix missing "extern_bullet" library when building rigidbodies
Commit: 6f6f6ee18695dad66ad8aa0eb2bcab72501df597 Author: Sebastian Parborg Date: Wed Sep 2 19:43:03 2020 +0200 Branches: master https://developer.blender.org/rB6f6f6ee18695dad66ad8aa0eb2bcab72501df597 Fix missing "extern_bullet" library when building rigidbodies === M intern/rigidbody/CMakeLists.txt === diff --git a/intern/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt index 91cfc312bd2..f619161b630 100644 --- a/intern/rigidbody/CMakeLists.txt +++ b/intern/rigidbody/CMakeLists.txt @@ -37,6 +37,7 @@ set(SRC ) set(LIB + extern_bullet ${BULLET_LIBRARIES} ) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f5e55c33378] master: Cleanup: use bool instead of int in various places
Commit: f5e55c33378b96e614710006121860eb880e6820 Author: Jacques Lucke Date: Wed Sep 2 19:10:18 2020 +0200 Branches: master https://developer.blender.org/rBf5e55c33378b96e614710006121860eb880e6820 Cleanup: use bool instead of int in various places === M source/blender/blenkernel/BKE_DerivedMesh.h M source/blender/blenkernel/BKE_colorband.h M source/blender/blenkernel/BKE_colortools.h M source/blender/blenkernel/BKE_fcurve.h M source/blender/blenkernel/BKE_image.h M source/blender/blenkernel/BKE_object.h M source/blender/blenkernel/intern/DerivedMesh.c M source/blender/blenkernel/intern/cloth.c M source/blender/blenkernel/intern/colorband.c M source/blender/blenkernel/intern/colortools.c M source/blender/blenkernel/intern/customdata.c M source/blender/blenkernel/intern/customdata_file.c M source/blender/blenkernel/intern/dynamicpaint.c M source/blender/blenkernel/intern/effect.c M source/blender/blenkernel/intern/fcurve.c M source/blender/blenkernel/intern/image.c M source/blender/blenkernel/intern/object.c M source/blender/blenkernel/intern/softbody.c M source/blender/editors/gpencil/gpencil_primitive.c M source/blender/editors/include/ED_object.h M source/blender/editors/interface/interface_eyedropper_datablock.c M source/blender/editors/interface/interface_eyedropper_depth.c M source/blender/editors/interface/interface_eyedropper_driver.c M source/blender/editors/interface/interface_handlers.c M source/blender/editors/interface/interface_ops.c M source/blender/editors/interface/view2d_ops.c M source/blender/editors/lattice/editlattice_tools.c M source/blender/editors/mask/mask_editaction.c M source/blender/editors/object/object_gpencil_modifier.c M source/blender/editors/object/object_hook.c M source/blender/editors/object/object_modifier.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_uv.c M source/blender/editors/sound/sound_ops.c M source/blender/editors/space_file/space_file.c M source/blender/editors/space_graph/graph_buttons.c M source/blender/editors/space_graph/graph_select.c M source/blender/editors/space_image/image_ops.c M source/blender/editors/space_node/drawnode.c M source/blender/editors/space_node/node_add.c M source/blender/editors/space_node/node_draw.c M source/blender/editors/space_node/node_edit.c M source/blender/editors/space_node/node_intern.h M source/blender/editors/space_view3d/view3d_utils.c M source/blender/editors/space_view3d/view3d_view.c M source/blender/makesrna/intern/rna_color.c M source/blender/modifiers/intern/MOD_weightvgproximity.c M source/blender/python/mathutils/mathutils_Matrix.c === diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 76c610fb5bd..9752185bc40 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -281,9 +281,9 @@ void DM_from_template(DerivedMesh *dm, /** * Utility function to release a DerivedMesh's layers - * returns 1 if DerivedMesh has to be released by the backend, 0 otherwise. + * returns true if DerivedMesh has to be released by the backend, false otherwise. */ -int DM_release(DerivedMesh *dm); +bool DM_release(DerivedMesh *dm); void DM_set_only_copy(DerivedMesh *dm, const struct CustomData_MeshMasks *mask); diff --git a/source/blender/blenkernel/BKE_colorband.h b/source/blender/blenkernel/BKE_colorband.h index 6ac96a1ed36..0f46ced8b06 100644 --- a/source/blender/blenkernel/BKE_colorband.h +++ b/source/blender/blenkernel/BKE_colorband.h @@ -40,7 +40,7 @@ struct ColorBand *BKE_colorband_add(bool rangetype); bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4]); void BKE_colorband_evaluate_table_rgba(const struct ColorBand *coba, float **array, int *size); struct CBData *BKE_colorband_element_add(struct ColorBand *coba, float position); -int BKE_colorband_element_remove(struct ColorBand *coba, int index); +bool BKE_colorband_element_remove(struct ColorBand *coba, int index); void BKE_colorband_update_sort(struct ColorBand *coba); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 1ada83c0163..73fe50c0c4f 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -95,7 +95,7 @@ void BKE_curvemapping_evaluate_premulRGBF_ex(const struct CurveMapping *cumap, void BKE_curvemapping_evaluate_premulRGBF(const struct CurveMapping *cumap, float vecout[3],
[Bf-blender-cvs] [f20f82ce3ee] master: Fix segfaults when deleting objects with upstream bullet lib
Commit: f20f82ce3ee55c12adcec024e0133e71183e07b3 Author: Sebastian Parborg Date: Wed Sep 2 18:26:37 2020 +0200 Branches: master https://developer.blender.org/rBf20f82ce3ee55c12adcec024e0133e71183e07b3 Fix segfaults when deleting objects with upstream bullet lib Blender tried to free objects twice from the bullet world sometime. First we would implicity remove all objects when recreating the bullet world and then explicity try to remove them again from the now empty world. This would wouldn't crash older bullet versions, but the recent versions will as we will try to free objects that no longer exists in the bullet world. Also clear the cache on deletion as the object order changes. Fix T77181: The cache clearing will fix this issue. === M source/blender/blenkernel/intern/rigidbody.c === diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 00b993296d0..7eab716d805 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -174,7 +174,7 @@ void BKE_rigidbody_free_object(Object *ob, RigidBodyWorld *rbw) /* free physics references */ if (is_orig) { if (rbo->shared->physics_object) { - if (rbw != NULL) { + if (rbw != NULL && rbw->shared->physics_world != NULL) { /* We can only remove the body from the world if the world is known. * The world is generally only unknown if it's an evaluated copy of * an object that's being freed, in which case this code isn't run anyway. */ @@ -185,7 +185,7 @@ void BKE_rigidbody_free_object(Object *ob, RigidBodyWorld *rbw) * loop over all scenes then. */ for (Scene *scene = G_MAIN->scenes.first; scene != NULL; scene = scene->id.next) { RigidBodyWorld *scene_rbw = scene->rigidbody_world; - if (scene_rbw != NULL) { + if (scene_rbw != NULL && scene_rbw->shared->physics_world != NULL) { RB_dworld_remove_body(scene_rbw->shared->physics_world, rbo->shared->physics_object); } } @@ -816,7 +816,9 @@ static void rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, bool rigidbody_validate_sim_shape(rbw, ob, true); } - if (rbo->shared->physics_object) { + if (rbo->shared->physics_object && !rebuild) { +/* Don't remove body on rebuild as it has already been removed when deleting and rebuilding the + * world. */ RB_dworld_remove_body(rbw->shared->physics_world, rbo->shared->physics_object); } if (!rbo->shared->physics_object || rebuild) { @@ -1559,6 +1561,10 @@ void BKE_rigidbody_remove_object(Main *bmain, Scene *scene, Object *ob, const bo /* flag cache as outdated */ BKE_rigidbody_cache_reset(rbw); + /* Reset cache as the object order probably changed after freeing the object. */ + PTCacheID pid; + BKE_ptcache_id_from_rigidbody(, NULL, rbw); + BKE_ptcache_id_reset(scene, , PTCACHE_RESET_OUTDATED); /* Dependency graph update */ DEG_relations_tag_update(bmain); @@ -1771,6 +1777,8 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, * T70667). */ if (rebuild || rbw->shared->physics_world == NULL) { BKE_rigidbody_validate_sim_world(scene, rbw, rebuild); +/* We have rebuilt the world so we need to make sure the rest is rebuilt as well. */ +rebuild = true; } rigidbody_update_sim_world(scene, rbw); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9b1f726248a] master: Cleanup: general cleanup of node.c
Commit: 9b1f726248afcbc415846526a03acbd92d3235d0 Author: Jacques Lucke Date: Wed Sep 2 18:28:04 2020 +0200 Branches: master https://developer.blender.org/rB9b1f726248afcbc415846526a03acbd92d3235d0 Cleanup: general cleanup of node.c - reduce variable scope - use bool instead of int - use LISTBASE_FOREACH === M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.c === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index ef46bc0f202..91e3b85aaca 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -446,8 +446,8 @@ void ntreeSetOutput(struct bNodeTree *ntree); void ntreeFreeCache(struct bNodeTree *ntree); -int ntreeNodeExists(struct bNodeTree *ntree, struct bNode *testnode); -int ntreeOutputExists(struct bNode *node, struct bNodeSocket *testsock); +bool ntreeNodeExists(struct bNodeTree *ntree, struct bNode *testnode); +bool ntreeOutputExists(struct bNode *node, struct bNodeSocket *testsock); void ntreeNodeFlagSet(const bNodeTree *ntree, const int flag, const bool enable); struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree); void ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree *ntree); @@ -618,10 +618,10 @@ void nodePositionRelative(struct bNode *from_node, void nodePositionPropagate(struct bNode *node); struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name); -int nodeFindNode(struct bNodeTree *ntree, - struct bNodeSocket *sock, - struct bNode **nodep, - int *sockindex); +bool nodeFindNode(struct bNodeTree *ntree, + struct bNodeSocket *sock, + struct bNode **r_node, + int *r_sockindex); struct bNode *nodeFindRootParent(bNode *node); bool nodeIsChildOf(const bNode *parent, const bNode *child); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 499e2311297..900817a0513 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -648,10 +648,8 @@ GHashIterator *ntreeTypeGetIterator(void) bNodeType *nodeTypeFind(const char *idname) { - bNodeType *nt; - if (idname[0]) { -nt = BLI_ghash_lookup(nodetypes_hash, idname); +bNodeType *nt = BLI_ghash_lookup(nodetypes_hash, idname); if (nt) { return nt; } @@ -722,10 +720,8 @@ GHashIterator *nodeTypeGetIterator(void) bNodeSocketType *nodeSocketTypeFind(const char *idname) { - bNodeSocketType *st; - if (idname[0]) { -st = BLI_ghash_lookup(nodesockettypes_hash, idname); +bNodeSocketType *st = BLI_ghash_lookup(nodesockettypes_hash, idname); if (st) { return st; } @@ -772,8 +768,8 @@ GHashIterator *nodeSocketTypeGetIterator(void) struct bNodeSocket *nodeFindSocket(const bNode *node, int in_out, const char *identifier) { - bNodeSocket *sock = (in_out == SOCK_IN ? node->inputs.first : node->outputs.first); - for (; sock; sock = sock->next) { + const ListBase *sockets = (in_out == SOCK_IN) ? >inputs : >outputs; + LISTBASE_FOREACH (bNodeSocket *, sock, sockets) { if (STREQ(sock->identifier, identifier)) { return sock; } @@ -785,8 +781,7 @@ struct bNodeSocket *nodeFindSocket(const bNode *node, int in_out, const char *id static bool unique_identifier_check(void *arg, const char *identifier) { struct ListBase *lb = arg; - bNodeSocket *sock; - for (sock = lb->first; sock; sock = sock->next) { + LISTBASE_FOREACH (bNodeSocket *, sock, lb) { if (STREQ(sock->identifier, identifier)) { return true; } @@ -802,7 +797,6 @@ static bNodeSocket *make_socket(bNodeTree *ntree, const char *identifier, const char *name) { - bNodeSocket *sock; char auto_identifier[MAX_NAME]; if (identifier && identifier[0] != '\0') { @@ -817,7 +811,7 @@ static bNodeSocket *make_socket(bNodeTree *ntree, BLI_uniquename_cb( unique_identifier_check, lb, "socket", '.', auto_identifier, sizeof(auto_identifier)); - sock = MEM_callocN(sizeof(bNodeSocket), "sock"); + bNodeSocket *sock = MEM_callocN(sizeof(bNodeSocket), "sock"); sock->in_out = in_out; BLI_strncpy(sock->identifier, auto_identifier, NODE_MAXSTR); @@ -,14 +1105,13 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree, const char *name) { const char *idname = nodeStaticSocketType(type, subtype); - bNodeSocket *sock; if (!idname) { CLOG_ERROR(, "static node socket type %d undefined", type); return NULL; } - sock = nodeAddSocket(ntree, node, in_out, idname, identifier, name); + bNodeSocket *sock = nodeAddSocket(ntree, node, in_out, idname, identifier, name); sock->type = type; return
[Bf-blender-cvs] [c335173a780] property-search-ui-v2: Merge branch 'master' into property-search-ui-v2
Commit: c335173a780b6451ab1df1c9bb944011d6faf990 Author: Hans Goudey Date: Tue Sep 1 23:32:18 2020 -0500 Branches: property-search-ui-v2 https://developer.blender.org/rBc335173a780b6451ab1df1c9bb944011d6faf990 Merge branch 'master' into property-search-ui-v2 === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ca0d4d90c6b] property-search-ui-v2: Merge branch 'master' into property-search-ui-v2
Commit: ca0d4d90c6b9ca29aa17ea7cd8ea5c90f4b3f097 Author: Hans Goudey Date: Wed Sep 2 11:15:50 2020 -0500 Branches: property-search-ui-v2 https://developer.blender.org/rBca0d4d90c6b9ca29aa17ea7cd8ea5c90f4b3f097 Merge branch 'master' into property-search-ui-v2 === === diff --cc source/blender/editors/include/UI_interface.h index 8da1c167245,4fc537ca5c2..80185e49980 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@@ -2421,10 -2405,11 +2421,13 @@@ void uiItemTabsEnumR_prop(uiLayout *lay struct bContext *C, struct PointerRNA *ptr, PropertyRNA *prop, + struct PointerRNA *ptr_highlight, + PropertyRNA *prop_highlight, bool icon_only); + /* Only for testing, inspecting layouts. */ + const char *UI_layout_introspect(uiLayout *layout); + /* UI Operators */ typedef struct uiDragColorHandle { float color[3]; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a8cf9d2f805] master: UI: Use property split layout for add torus operator
Commit: a8cf9d2f805275d2550aead4e5fe36049f79add9 Author: Hans Goudey Date: Wed Sep 2 10:34:44 2020 -0500 Branches: master https://developer.blender.org/rBa8cf9d2f805275d2550aead4e5fe36049f79add9 UI: Use property split layout for add torus operator Continuing the work from D8326, this commit adds a property split layout to the add torus operator. It also puts the properties common to all object add operators at the bottom for consistency. Differential Revision: https://developer.blender.org/D8748 === M release/scripts/startup/bl_operators/add_mesh_torus.py === diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index edcd52c12bd..c2f9a4189cf 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -149,7 +149,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): default=12, ) mode: EnumProperty( -name="Torus Dimensions", +name="Dimensions Mode", items=( ('MAJOR_MINOR', "Major/Minor", "Use the major/minor radii for torus dimensions"), @@ -204,47 +204,30 @@ class AddTorus(Operator, object_utils.AddObjectHelper): def draw(self, _context): layout = self.layout -col = layout.column(align=True) -col.prop(self, "generate_uvs") -col.separator() -col.prop(self, "align") +layout.use_property_split = True +layout.use_property_decorate = False -col = layout.column(align=True) -col.label(text="Location") -col.prop(self, "location", text="") +layout.separator() -col = layout.column(align=True) -col.label(text="Rotation") -col.prop(self, "rotation", text="") +layout.prop(self, "major_segments") +layout.prop(self, "minor_segments") -col = layout.column(align=True) -col.label(text="Major Segments") -col.prop(self, "major_segments", text="") - -col = layout.column(align=True) -col.label(text="Minor Segments") -col.prop(self, "minor_segments", text="") - -col = layout.column(align=True) -col.label(text="Torus Dimensions") -col.row().prop(self, "mode", expand=True) +layout.separator() +layout.prop(self, "mode") if self.mode == 'MAJOR_MINOR': -col = layout.column(align=True) -col.label(text="Major Radius") -col.prop(self, "major_radius", text="") - -col = layout.column(align=True) -col.label(text="Minor Radius") -col.prop(self, "minor_radius", text="") +layout.prop(self, "major_radius") +layout.prop(self, "minor_radius") else: -col = layout.column(align=True) -col.label(text="Exterior Radius") -col.prop(self, "abso_major_rad", text="") +layout.prop(self, "abso_major_rad") +layout.prop(self, "abso_minor_rad") + +layout.separator() -col = layout.column(align=True) -col.label(text="Interior Radius") -col.prop(self, "abso_minor_rad", text="") +layout.prop(self, "generate_uvs") +layout.prop(self, "align") +layout.prop(self, "location") +layout.prop(self, "rotation") def invoke(self, context, _event): object_utils.object_add_grid_scale_apply_operator(self, context) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4330f147d0b] master: Fix unused variable warning on Windows with WITH_INPUT_IME disabled
Commit: 4330f147d0bf0f5f38f0cf05e05de717d95b437f Author: Julian Eisel Date: Wed Sep 2 17:32:58 2020 +0200 Branches: master https://developer.blender.org/rB4330f147d0bf0f5f38f0cf05e05de717d95b437f Fix unused variable warning on Windows with WITH_INPUT_IME disabled === M intern/ghost/intern/GHOST_SystemWin32.cpp === diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 533e51db355..f784d100db2 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1305,7 +1305,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LRESULT lResult = 0; GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); +#ifdef WITH_INPUT_IME GHOST_EventManager *eventManager = system->getEventManager(); +#endif GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized"); if (hwnd) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1082edfdfd8] master: Cleanup: Clang-format
Commit: 1082edfdfd848ca3231457c4ae7443bbea9db968 Author: Ray Molenkamp Date: Wed Sep 2 09:19:14 2020 -0600 Branches: master https://developer.blender.org/rB1082edfdfd848ca3231457c4ae7443bbea9db968 Cleanup: Clang-format === M intern/cycles/render/camera.cpp === diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 0fedba7c2ca..0fa1d512547 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -751,9 +751,9 @@ float Camera::world_to_raster_size(float3 P) } #else camera_sample_panorama(_camera, -# ifdef __CAMERA_MOTION__ +# ifdef __CAMERA_MOTION__ kernel_camera_motion.data(), -# endif +# endif 0.5f * full_width, 0.5f * full_height, 0.0f, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c992fd3a3c1] master: Cycles: Support WITH_CYCLES_NATIVE_ONLY with MSVC
Commit: c992fd3a3c13763f458e420507f044ec82155a81 Author: Ray Molenkamp Date: Wed Sep 2 09:19:44 2020 -0600 Branches: master https://developer.blender.org/rBc992fd3a3c13763f458e420507f044ec82155a81 Cycles: Support WITH_CYCLES_NATIVE_ONLY with MSVC This change enables the developer option `WITH_CYCLES_NATIVE_ONLY` for MSVC. This allows a developer to just build the cycles CPU kernel for their specific system rather than all kernels, speeding up development. Other platforms have had this option for years, but MSVC lacks the compiler switch to target the host architecture hence it always build all kernels. This change uses a small helper program to detect the required flags. Only AVX/AVX2 are tested, for the following reasons - SSE2 is enabled by default and requires no flags - SSE3/4 have no specific build flags for msvc - AVX512 is not yet supported by cycles Differential Revision: https://developer.blender.org/D8775 Reviewed by: brecht, sergey === M intern/cycles/CMakeLists.txt A intern/cycles/cmake/msvc_arch_flags.c === diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index e5a5e9773d3..0dd182526b1 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -33,6 +33,22 @@ if(WITH_CYCLES_NATIVE_ONLY) if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") set(CYCLES_KERNEL_FLAGS "-march=native") + else() +if(NOT MSVC_NATIVE_ARCH_FLAGS) +TRY_RUN( +arch_run_result +arch_compile_result +${CMAKE_CURRENT_BINARY_DIR}/ +${CMAKE_CURRENT_SOURCE_DIR}/cmake/msvc_arch_flags.c +COMPILE_OUTPUT_VARIABLE arch_compile_output +RUN_OUTPUT_VARIABLE arch_run_output +) +if (arch_compile_result AND "${arch_run_result}" EQUAL "0") +string(STRIP ${arch_run_output} arch_run_output) +set(MSVC_NATIVE_ARCH_FLAGS ${arch_run_output} CACHE STRING "MSVC Native architecture flags") +endif() +endif() +set(CYCLES_KERNEL_FLAGS "${MSVC_NATIVE_ARCH_FLAGS}") endif() elseif(NOT WITH_CPU_SSE) set(CXX_HAS_SSE FALSE) diff --git a/intern/cycles/cmake/msvc_arch_flags.c b/intern/cycles/cmake/msvc_arch_flags.c new file mode 100644 index 000..79dbd3b87ac --- /dev/null +++ b/intern/cycles/cmake/msvc_arch_flags.c @@ -0,0 +1,38 @@ +/* + * Copyright 2011-2020 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +/* The MS CRT defines this */ +extern int __isa_available; + +const char* get_arch_flags() +{ + if (__isa_available >= __ISA_AVAILABLE_AVX2) { +return "/arch:AVX2"; + } + if (__isa_available >= __ISA_AVAILABLE_AVX) { +return "/arch:AVX"; + } + return ""; +} + +int main() +{ +printf("%s\n", get_arch_flags()); +return 0; +} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [279f7ad8ac1] master: Cleanup: Correction to previous cleanup commit
Commit: 279f7ad8ac193bc3a1656e992be23b2c7368b374 Author: Julian Eisel Date: Wed Sep 2 16:29:24 2020 +0200 Branches: master https://developer.blender.org/rB279f7ad8ac193bc3a1656e992be23b2c7368b374 Cleanup: Correction to previous cleanup commit I somehow undid these changes again before committing, sorry for the noise... === M source/blender/blenlib/intern/math_vector.c === diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 4d35f1e34d4..dc6e213d0b5 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -708,12 +708,12 @@ void project_v3_v3v3_normalized(float out[3], const float p[3], const float v_pr * * Projecting will make \a out a copy of \a p orthogonal to \a v_plane. * - * \note If \a v is exactly perpendicular to \a v_plane, \a c will just be a copy of \a v. + * \note If \a p is exactly perpendicular to \a v_plane, \a out will just be a copy of \a p. * * \note This function is a convenience to call: * \code{.c} - * project_v3_v3v3(c, v, v_plane); - * sub_v3_v3v3(c, v, c); + * project_v3_v3v3(out, p, v_plane); + * sub_v3_v3v3(out, p, out); * \endcode */ void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3]) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9c3fa996582] master: Cleanup: Correct argument names in comment
Commit: 9c3fa9965829a679acf2285cda3389fa0f08be7f Author: Julian Eisel Date: Wed Sep 2 16:25:20 2020 +0200 Branches: master https://developer.blender.org/rB9c3fa9965829a679acf2285cda3389fa0f08be7f Cleanup: Correct argument names in comment Names were changed in 66b12ef4ab94, but the comment wasn't updated. === M source/blender/blenlib/intern/math_vector.c === diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index fb3ea539df1..4d35f1e34d4 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -706,7 +706,7 @@ void project_v3_v3v3_normalized(float out[3], const float p[3], const float v_pr /** * In this case plane is a 3D vector only (no 4th component). * - * Projecting will make \a c a copy of \a v orthogonal to \a v_plane. + * Projecting will make \a out a copy of \a p orthogonal to \a v_plane. * * \note If \a v is exactly perpendicular to \a v_plane, \a c will just be a copy of \a v. * ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a9cacb22804] blender-v2.83-release: Fix T80159: Custom Normals Averaging crash after clearing custom split normals data
Commit: a9cacb228041e33bc04a3bc634532164b102c4df Author: Philipp Oeser Date: Thu Aug 27 15:47:13 2020 +0200 Branches: blender-v2.83-release https://developer.blender.org/rBa9cacb228041e33bc04a3bc634532164b102c4df Fix T80159: Custom Normals Averaging crash after clearing custom split normals data Clearing custom split normals would get rid of the CD_CUSTOMLOOPNORMAL layer - but editing data `lnor_spacearr` would be kept. Adding a CD_CUSTOMLOOPNORMAL layer (if none exists yet) should be done in `edbm_average_normals_exec` / `BKE_editmesh_lnorspace_update` / `BM_lnorspace_update` / `BM_lnorspacearr_store`. The thing is that if the editing data `lnor_spacearr` would still be valid after `Clear Custom Split Normals Data`, blender would happily call `BM_lnorspace_rebuild` instead. Doing that without a CD_CUSTOMLOOPNORMAL layer is asking for trouble. Now clear lnor_spacearr on `Clear Custom Split Normals Data` as well. Thx @mont29 for feedback here. Maniphest Tasks: T80159 Differential Revision: https://developer.blender.org/D8730 === M source/blender/editors/mesh/mesh_data.c === diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 51b699acd63..57153acfa44 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -856,6 +856,10 @@ static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperato Mesh *me = ED_mesh_context(C); if (BKE_mesh_has_custom_loop_normals(me)) { +BMEditMesh *em = me->edit_mesh; +if (em != NULL && em->bm->lnor_spacearr != NULL) { + BKE_lnor_spacearr_clear(em->bm->lnor_spacearr); +} return mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_CUSTOMLOOPNORMAL); } return OPERATOR_CANCELLED; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c4b9e2da8c3] blender-v2.83-release: Fix T77900: File Browser in macOS fullscreen crashes
Commit: c4b9e2da8c3c12e69b9a7eab8d9f8a12e65dccaa Author: Yevgeny Makarov Date: Wed Aug 26 16:27:05 2020 +0200 Branches: blender-v2.83-release https://developer.blender.org/rBc4b9e2da8c3c12e69b9a7eab8d9f8a12e65dccaa Fix T77900: File Browser in macOS fullscreen crashes When Blender is started in fullscreen mode from the command line, or if the fullscreen state is saved in the startup file, all temporary windows will also open in fullscreen mode. When closing the fullscreen File Browser, Blender would either crash or parent window becomes black. This does not happen if the Blender switches to full screen manually. `NSWindowCollectionBehaviorFullScreenPrimary` should be set for windows that can enter full-screen mode. Otherwise macOS will turn the wrong window into full-screen. Similar fix: rB4b39de677d20 Differential Revision: https://developer.blender.org/D8708 Reviewed by: Julian Eisel === M intern/ghost/intern/GHOST_WindowCocoa.mm === diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 278147c5622..da84dc86b80 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -415,7 +415,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa, [parentWindow->getCocoaWindow() addChildWindow:m_window ordered:NSWindowAbove]; [m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; } - else if (state != GHOST_kWindowStateFullScreen) { + else { [m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [812c2343773] blender-v2.83-release: Fix T80078: Overrides: Crash with animated IK control on linked armature.
Commit: 812c234377302fdcb6b6bf8c7715507f9831525f Author: Bastien Montagne Date: Thu Aug 27 16:50:01 2020 +0200 Branches: blender-v2.83-release https://developer.blender.org/rB812c234377302fdcb6b6bf8c7715507f9831525f Fix T80078: Overrides: Crash with animated IK control on linked armature. Issue was with our dear posebones again... when applying overrides we keep the same address/pointer for the IDs themselves, (which avoids us the need to remap their usages), but their inner data is often re-allocated. Therefore, we need once again to go over armature objects and invalidate their posebone pointers. This should also be back-ported to Blender LTS 2.83. Maniphest Tasks: T80078 Differential Revision: https://developer.blender.org/D8734 === M source/blender/blenkernel/intern/lib_override.c M source/blender/blenkernel/intern/lib_remap.c === diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 795390f1940..7ec77bf381c 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -952,6 +952,20 @@ void BKE_lib_override_library_update(Main *bmain, ID *local) /* XXX And crashing in complex cases (e.g. because depsgraph uses same data...). */ BKE_id_free_ex(bmain, tmp_id, LIB_ID_FREE_NO_UI_USER, true); + if (GS(local->name) == ID_AR) { +/* Funtime again, thanks to bone pointers in pose data of objects. We keep same ID addresses, + * but internal data has changed for sure, so we need to invalidate posebones caches. */ +LISTBASE_FOREACH (Object *, ob, >objects) { + if (ob->pose != NULL && ob->data == local) { +BLI_assert(ob->type == OB_ARMATURE); +ob->pose->flag |= POSE_RECALC; +/* We need to clear pose bone pointers immediately, some code may access those before pose + * is actually recomputed, which can lead to segfault. */ +BKE_pose_clear_pointers(ob->pose); + } +} + } + if (local->override_library->storage) { /* We know this datablock is not used anywhere besides local->override->storage. */ /* XXX For until we get fully shadow copies, we still need to ensure storage releases diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c index 72ae4629dba..1a9d9f0bce2 100644 --- a/source/blender/blenkernel/intern/lib_remap.c +++ b/source/blender/blenkernel/intern/lib_remap.c @@ -244,17 +244,17 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data) ID *old_id = r_id_remap_data->old_id; if (!old_id || GS(old_id->name) == ID_AR) { Object *ob = (Object *)r_id_remap_data->id_owner; -/* Object's pose holds reference to armature bones... sic */ -/* Note that in theory, we should have to bother about - * linked/non-linked/never-null/etc. flags/states. +/* Object's pose holds reference to armature bones. sic */ +/* Note that in theory, we should have to bother about linked/non-linked/never-null/etc. + * flags/states. * Fortunately, this is just a tag, so we can accept to 'over-tag' a bit for pose recalc, * and avoid another complex and risky condition nightmare like the one we have in - * foreach_libblock_remap_callback()... */ + * foreach_libblock_remap_callback(). */ if (ob->pose && (!old_id || ob->data == old_id)) { BLI_assert(ob->type == OB_ARMATURE); ob->pose->flag |= POSE_RECALC; - /* We need to clear pose bone pointers immediately, things like undo writefile may be - * called before pose is actually recomputed, can lead to segfault... */ + /* We need to clear pose bone pointers immediately, some code may access those before + * pose is actually recomputed, which can lead to segfault. */ BKE_pose_clear_pointers(ob->pose); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [006ff645388] blender-v2.83-release: Fix crash accessing image space properties without an active window
Commit: 006ff645388628eb82c47acc3a595a6d80cd7d8d Author: Campbell Barton Date: Wed Sep 2 12:44:37 2020 +1000 Branches: blender-v2.83-release https://developer.blender.org/rB006ff645388628eb82c47acc3a595a6d80cd7d8d Fix crash accessing image space properties without an active window === M source/blender/editors/include/ED_image.h M source/blender/editors/screen/screen_ops.c M source/blender/editors/space_image/image_edit.c M source/blender/editors/space_image/image_ops.c M source/blender/editors/space_image/space_image.c M source/blender/makesrna/intern/rna_space.c === diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 910cf362a37..81ef1593d58 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -106,7 +106,7 @@ bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit); bool ED_space_image_paint_curve(const struct bContext *C); -bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer); +bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct Object *obedit); bool ED_space_image_maskedit_poll(struct bContext *C); bool ED_space_image_maskedit_mask_poll(struct bContext *C); bool ED_space_image_cursor_poll(struct bContext *C); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 90813c9351c..37427eb8321 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -610,7 +610,8 @@ bool ED_operator_mask(bContext *C) case SPACE_IMAGE: { SpaceImage *sima = area->spacedata.first; ViewLayer *view_layer = CTX_data_view_layer(C); -return ED_space_image_check_show_maskedit(sima, view_layer); +Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); +return ED_space_image_check_show_maskedit(sima, obedit); } } } diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 6a37c094dac..39be2cbfa52 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -475,11 +475,10 @@ bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) } /* matches clip function */ -bool ED_space_image_check_show_maskedit(SpaceImage *sima, ViewLayer *view_layer) +bool ED_space_image_check_show_maskedit(SpaceImage *sima, Object *obedit) { /* check editmode - this is reserved for UV editing */ - Object *ob = OBACT(view_layer); - if (ob && ob->mode & OB_MODE_EDIT && ED_space_image_show_uvedit(sima, ob)) { + if (obedit && ED_space_image_show_uvedit(sima, obedit)) { return false; } @@ -492,7 +491,8 @@ bool ED_space_image_maskedit_poll(bContext *C) if (sima) { ViewLayer *view_layer = CTX_data_view_layer(C); -return ED_space_image_check_show_maskedit(sima, view_layer); +Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); +return ED_space_image_check_show_maskedit(sima, obedit); } return false; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 7889e56ecfe..2e5b27bcf4a 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -905,7 +905,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } } - else if (ED_space_image_check_show_maskedit(sima, view_layer)) { + else if (ED_space_image_check_show_maskedit(sima, obedit)) { if (!ED_mask_selected_minmax(C, min, max)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 1e1d4373fea..3b73e9f92f3 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -368,10 +368,9 @@ static void image_listener(wmWindow *win, ScrArea *area, wmNotifier *wmn, Scene } break; case NC_MASK: { - // Scene *scene = wmn->window->screen->scene; - /* ideally would check for: ED_space_image_check_show_maskedit(scene, sima) - * but we cant get the scene */ - if (sima->mode == SI_MODE_MASK) { + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + if (ED_space_image_check_show_maskedit(sima, obedit)) { switch (wmn->data) { case ND_SELECT: ED_area_tag_redraw(area); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d4d35e07c2a..b02bf375349 100644 ---
[Bf-blender-cvs] [521ae3d458a] blender-v2.83-release: Fix Outliner allowing to enter Pose Mode on linked armature
Commit: 521ae3d458adcce73e5f9832fd6e7197721e9df0 Author: Julian Eisel Date: Thu Aug 27 16:40:56 2020 +0200 Branches: blender-v2.83-release https://developer.blender.org/rB521ae3d458adcce73e5f9832fd6e7197721e9df0 Fix Outliner allowing to enter Pose Mode on linked armature If a different object was active, clicking on a linked armature's pose in the Outliner would enter Pose Mode for it. This would actually cause a failed assert, but in release builds the armature would just enter pose mode. Steps to reproduce were: * Link in armature object * Activate a different object * In the Outliner, un-collapse the armature object * Activate Pose Mode by clicking on its pose there === M source/blender/editors/space_outliner/outliner_select.c === diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index fa8422573ab..36bcef22838 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -46,6 +46,7 @@ #include "BKE_main.h" #include "BKE_object.h" #include "BKE_paint.h" +#include "BKE_report.h" #include "BKE_scene.h" #include "BKE_sequencer.h" #include "BKE_workspace.h" @@ -193,12 +194,17 @@ static void do_outliner_activate_pose( } else { bool ok = false; -if (ob->mode & OB_MODE_POSE) { + +if (ID_IS_LINKED(ob)) { + BKE_report(CTX_wm_reports(C), RPT_WARNING, "Cannot pose libdata"); +} +else if (ob->mode & OB_MODE_POSE) { ok = ED_object_posemode_exit_ex(bmain, ob); } else { ok = ED_object_posemode_enter_ex(bmain, ob); } + if (ok) { ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [74a9ffc8047] blender-v2.83-release: Add undo step to Alembic and Collada importers...
Commit: 74a9ffc8047581d5a642e881edad038765280a62 Author: Bastien Montagne Date: Mon Jun 22 12:13:09 2020 +0200 Branches: blender-v2.83-release https://developer.blender.org/rB74a9ffc8047581d5a642e881edad038765280a62 Add undo step to Alembic and Collada importers... Re T77754. === M source/blender/editors/io/io_alembic.c M source/blender/editors/io/io_collada.c === diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c index af17303466b..88f3f10e5a9 100644 --- a/source/blender/editors/io/io_alembic.c +++ b/source/blender/editors/io/io_alembic.c @@ -684,6 +684,7 @@ void WM_OT_alembic_import(wmOperatorType *ot) ot->name = "Import Alembic"; ot->description = "Load an Alembic archive"; ot->idname = "WM_OT_alembic_import"; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->invoke = wm_alembic_import_invoke; ot->exec = wm_alembic_import_exec; diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index 9091e7d8afc..c1a4492994a 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -857,6 +857,7 @@ void WM_OT_collada_import(wmOperatorType *ot) ot->name = "Import COLLADA"; ot->description = "Load a Collada file"; ot->idname = "WM_OT_collada_import"; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->invoke = WM_operator_filesel; ot->exec = wm_collada_import_exec; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7071daaee3f] blender-v2.83-release: Fix T80135: Duplicate doesn't preserve active spline
Commit: 7071daaee3f65b155466c4da1ba825b0407b2fe4 Author: Campbell Barton Date: Fri Aug 28 14:34:26 2020 +1000 Branches: blender-v2.83-release https://developer.blender.org/rB7071daaee3f65b155466c4da1ba825b0407b2fe4 Fix T80135: Duplicate doesn't preserve active spline Checks to preserve the active spline on duplication required an active vertex too. Now having no active vertex doesn't prevent duplicate from keeping the spline active. Reviewed by: @mano-wii Ref D8729 === M source/blender/editors/curve/editcurve.c === diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 240f5261960..dcf4d344e05 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2169,12 +2169,22 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const short flag) return ok; } +static void calc_duplicate_actnurb(const ListBase *editnurb, const ListBase *newnurb, Curve *cu) +{ + cu->actnu = BLI_listbase_count(editnurb) + BLI_listbase_count(newnurb); +} + static bool calc_duplicate_actvert( const ListBase *editnurb, const ListBase *newnurb, Curve *cu, int start, int end, int vert) { + if (cu->actvert == -1) { +calc_duplicate_actnurb(editnurb, newnurb, cu); +return true; + } + if ((start <= cu->actvert) && (end > cu->actvert)) { +calc_duplicate_actnurb(editnurb, newnurb, cu); cu->actvert = vert; -cu->actnu = BLI_listbase_count(editnurb) + BLI_listbase_count(newnurb); return true; } return false; @@ -2424,26 +2434,31 @@ static void adduplicateflagNurb( } if (cu->actnu == i) { - for (b = 0, diffa = 0; b < newv; b++, diffa += nu->pntsu - newu) { -starta = b * nu->pntsu + a; -if (calc_duplicate_actvert(editnurb, - newnurb, - cu, - cu->actvert, - starta, - cu->actvert % nu->pntsu + newu + - b * newnu->pntsu)) { - /* actvert in cyclicu selection */ - break; -} -else if (calc_duplicate_actvert(editnurb, -newnurb, -cu, -starta, -starta + newu, -cu->actvert - starta + b * newnu->pntsu)) { - /* actvert in 'current' iteration selection */ - break; + if (cu->actvert == -1) { +calc_duplicate_actnurb(editnurb, newnurb, cu); + } + else { +for (b = 0, diffa = 0; b < newv; b++, diffa += nu->pntsu - newu) { + starta = b * nu->pntsu + a; + if (calc_duplicate_actvert(editnurb, + newnurb, + cu, + cu->actvert, + starta, + cu->actvert % nu->pntsu + newu + + b * newnu->pntsu)) { +/* actvert in cyclicu selection */ +break; + } + if (calc_duplicate_actvert(editnurb, + newnurb, + cu, + starta, + starta + newu, + cu->actvert - starta + b * newnu->pntsu)) { +/* actvert in 'current' iteration selection */ +break; + } } } } @@ -2471,16 +2486,21 @@ static void adduplicateflagNurb( /* general case if not handled by cyclicu or cyclicv */ if (cu->actnu == i) { -for (b = 0, diffa = 0; b < newv; b++, diffa += nu->pntsu - newu) { - starta = b * nu->pntsu + a; - if (calc_duplicate_actvert(editnurb, - newnurb, - cu, - starta, -
[Bf-blender-cvs] [cbb5201f09b] blender-v2.83-release: Fix T80104: Crash on making material local.
Commit: cbb5201f09bd88a5c7e58fe74ee4178fb2aec27f Author: Bastien Montagne Date: Thu Aug 27 15:48:01 2020 +0200 Branches: blender-v2.83-release https://developer.blender.org/rBcbb5201f09bd88a5c7e58fe74ee4178fb2aec27f Fix T80104: Crash on making material local. Problem is again with the embedded data, we want to make those local together with their owner ID, but sometimes we are actually dealing with copies here, which are inheritently already local. Code did not considered that possibility before, leading to access to a NULL `lib` pointer. This should also be back-ported to 2.83 LTS release. Maniphest Tasks: T80104 Differential Revision: https://developer.blender.org/D8731 === M source/blender/blenkernel/intern/lib_id.c === diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 18c72e2a324..fcdc28d3acd 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -396,8 +396,11 @@ static int lib_id_expand_local_cb(LibraryIDLinkCallbackData *cb_data) } if (cb_flag & IDWALK_CB_EMBEDDED) { -/* Embedded data-blocks need to be made fully local as well. */ -if (*id_pointer != NULL) { +/* Embedded data-blocks need to be made fully local as well. + * Note however that in some cases (when owner ID had to be duplicated instead of being made + * local directly), its embedded IDs should also have already been duplicated, and hence be + * fully local here already. */ +if (*id_pointer != NULL && ID_IS_LINKED(*id_pointer)) { BLI_assert(*id_pointer != id_self); lib_id_clear_library_data_ex(bmain, *id_pointer); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [09ef1999650] master: PY API doc: fix doc for new override option of properties.
Commit: 09ef19996509fff4694b65ba8a5146f543d2ec57 Author: Bastien Montagne Date: Wed Sep 2 14:59:58 2020 +0200 Branches: master https://developer.blender.org/rB09ef19996509fff4694b65ba8a5146f543d2ec57 PY API doc: fix doc for new override option of properties. Reported by Demeter Dzadik (@Mets) on blender.chat, thanks. Candidate to be backported to a potential 2.90.1. === M source/blender/python/intern/bpy_props.c === diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 859f0027f14..a78ed601d57 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -93,13 +93,13 @@ static const EnumPropertyItem property_flag_override_items[] = { "LIBRARY_OVERRIDABLE", 0, "Library Overridable", - "Allow that property to be overridable from library linked data-blocks"}, + "Make that property editable in library overrides of linked data-blocks"}, {0, NULL, 0, NULL, NULL}, }; #define BPY_PROPDEF_OPTIONS_OVERRIDE_DOC \ - " :arg options: Enumerator in ['LIBRARY_OVERRIDE'].\n" \ - " :type options: set\n" + " :arg override: Enumerator in ['LIBRARY_OVERRIDABLE'].\n" \ + " :type override: set\n" static const EnumPropertyItem property_flag_override_collection_items[] = { {PROPOVERRIDE_OVERRIDABLE_LIBRARY, @@ -116,8 +116,8 @@ static const EnumPropertyItem property_flag_override_collection_items[] = { }; #define BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC \ - " :arg options: Enumerator in ['LIBRARY_OVERRIDE', 'NO_PROPERTY_NAME'].\n" \ - " :type options: set\n" + " :arg override: Enumerator in ['LIBRARY_OVERRIDABLE', 'NO_PROPERTY_NAME'].\n" \ + " :type override: set\n" /* subtypes */ /* XXX Keep in sync with rna_rna.c's rna_enum_property_subtype_items ??? ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1aa54d4921c] master: Make rigidbody simulation handle animated objects gracefully
Commit: 1aa54d4921c2e8d7114f463a940c169ee573f557 Author: Sebastian Parborg Date: Wed Sep 2 14:14:47 2020 +0200 Branches: master https://developer.blender.org/rB1aa54d4921c2e8d7114f463a940c169ee573f557 Make rigidbody simulation handle animated objects gracefully The animated objects was not updated for each internal substep for the rigidbody sim. This would lead to unstable simulations or very annoying clipping artifacts. Updated the code to use explicit substeps and tie it to the scene frame rate. Fix T47402: Properly updating the animated objects fixes the reported issue. Reviewed By: Brecht, Jacques Differential Revision: http://developer.blender.org/D8762 === M extern/bullet2/CMakeLists.txt M intern/rigidbody/CMakeLists.txt M intern/rigidbody/RBI_api.h A intern/rigidbody/RBI_hull_api.h M intern/rigidbody/rb_bullet_api.cpp A intern/rigidbody/rb_convex_hull_api.cpp M release/scripts/startup/bl_ui/properties_scene.py M source/blender/blenkernel/CMakeLists.txt M source/blender/blenkernel/intern/rigidbody.c M source/blender/blenlib/BLI_math_vector.h M source/blender/blenlib/intern/math_vector_inline.c M source/blender/blenloader/intern/versioning_290.c M source/blender/bmesh/CMakeLists.txt M source/blender/bmesh/operators/bmo_hull.c M source/blender/makesdna/DNA_rigidbody_types.h M source/blender/makesdna/intern/dna_rename_defs.h M source/blender/makesrna/intern/rna_rigidbody.c M source/blender/modifiers/CMakeLists.txt === diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt index 9d0557ded7d..fd043bb9048 100644 --- a/extern/bullet2/CMakeLists.txt +++ b/extern/bullet2/CMakeLists.txt @@ -18,6 +18,19 @@ # All rights reserved. # * END GPL LICENSE BLOCK * +# avoid noisy warnings +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + add_c_flag( +"-Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -Wno-reorder" + ) + remove_cc_flag( +"-Wmissing-declarations" + ) +endif() + +# Use double precision to make simulations of small objects stable. +add_definitions(-DBT_USE_DOUBLE_PRECISION) + set(INC . src diff --git a/intern/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt index 77d88548e1b..91cfc312bd2 100644 --- a/intern/rigidbody/CMakeLists.txt +++ b/intern/rigidbody/CMakeLists.txt @@ -18,6 +18,8 @@ # All rights reserved. # * END GPL LICENSE BLOCK * +add_definitions(-DBT_USE_DOUBLE_PRECISION) + set(INC . ) @@ -28,7 +30,9 @@ set(INC_SYS set(SRC rb_bullet_api.cpp + rb_convex_hull_api.cpp + RBI_hull_api.h RBI_api.h ) diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h index 07cda49e04b..2e09f8952cb 100644 --- a/intern/rigidbody/RBI_api.h +++ b/intern/rigidbody/RBI_api.h @@ -200,10 +200,12 @@ void RB_body_set_scale(rbRigidBody *body, const float scale[3]); /* */ -/* Get RigidBody's position as vector */ +/* Get RigidBody's position as a vector */ void RB_body_get_position(rbRigidBody *body, float v_out[3]); -/* Get RigidBody's orientation as quaternion */ +/* Get RigidBody's orientation as a quaternion */ void RB_body_get_orientation(rbRigidBody *body, float v_out[4]); +/* Get RigidBody's local scale as a vector */ +void RB_body_get_scale(rbRigidBody *object, float v_out[3]); /* */ diff --git a/intern/rigidbody/RBI_hull_api.h b/intern/rigidbody/RBI_hull_api.h new file mode 100644 index 000..9d2dc5034db --- /dev/null +++ b/intern/rigidbody/RBI_hull_api.h @@ -0,0 +1,43 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2020 Blender Foundation, + * All rights reserved. + */ + +#ifndef __RB_HULL_API_H__ +#define __RB_HULL_API_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct plConvexHull__ { + int unused; +} * plConvexHull; + +plConvexHull plConvexHullCompute(float (*coords)[3], int count); +void plConvexHullDelete(plConvexHull hull); +int plConvexHullNumVertices(plConvexHull hull); +int plConvexHullNumFaces(plConvexHull hull); +void
[Bf-blender-cvs] [feb4b645d70] master: EEVEE: Shader tests for Depth of Field
Commit: feb4b645d70ec8ad5c3f91a957738a9fba4054f0 Author: Jeroen Bakker Date: Tue Sep 1 11:48:37 2020 +0200 Branches: master https://developer.blender.org/rBfeb4b645d70ec8ad5c3f91a957738a9fba4054f0 EEVEE: Shader tests for Depth of Field This patch moves the EEVEE depth of field shaders to eevee_shaders.c and adds them to the eevee shaders test suite. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D8771 === M source/blender/draw/engines/eevee/eevee_depth_of_field.c M source/blender/draw/engines/eevee/eevee_engine.c M source/blender/draw/engines/eevee/eevee_private.h M source/blender/draw/engines/eevee/eevee_shaders.c M source/blender/draw/tests/shaders_test.cc === diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 1d8082538a8..92ba526c67c 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -40,46 +40,6 @@ #include "GPU_texture.h" #include "eevee_private.h" -static struct { - /* Depth Of Field */ - struct GPUShader *dof_downsample_sh[2]; - struct GPUShader *dof_scatter_sh[2]; - struct GPUShader *dof_resolve_sh[2]; -} e_data = {{NULL}}; /* Engine data */ - -extern char datatoc_effect_dof_vert_glsl[]; -extern char datatoc_effect_dof_frag_glsl[]; - -extern char datatoc_common_view_lib_glsl[]; - -static void eevee_create_shader_depth_of_field(const bool use_alpha) -{ - DRWShaderLibrary *lib = EEVEE_shader_lib_get(); - - e_data.dof_downsample_sh[use_alpha] = DRW_shader_create_fullscreen_with_shaderlib( - datatoc_effect_dof_frag_glsl, - lib, - use_alpha ? "#define USE_ALPHA_DOF\n" - "#define STEP_DOWNSAMPLE\n" : - "#define STEP_DOWNSAMPLE\n"); - - e_data.dof_scatter_sh[use_alpha] = DRW_shader_create_with_shaderlib( - datatoc_effect_dof_vert_glsl, - NULL, - datatoc_effect_dof_frag_glsl, - lib, - use_alpha ? "#define USE_ALPHA_DOF\n" - "#define STEP_SCATTER\n" : - "#define STEP_SCATTER\n"); - - e_data.dof_resolve_sh[use_alpha] = DRW_shader_create_fullscreen_with_shaderlib( - datatoc_effect_dof_frag_glsl, - lib, - use_alpha ? "#define USE_ALPHA_DOF\n" - "#define STEP_RESOLVE\n" : - "#define STEP_RESOLVE\n"); -} - int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata, Object *camera) @@ -95,12 +55,6 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) { RegionView3D *rv3d = draw_ctx->rv3d; -const bool use_alpha = !DRW_state_draw_background(); - -if (!e_data.dof_downsample_sh[use_alpha]) { - eevee_create_shader_depth_of_field(use_alpha); -} - const float *viewport_size = DRW_viewport_size_get(); /* Retrieve Near and Far distance */ @@ -212,7 +166,8 @@ void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_ DRW_PASS_CREATE(psl->dof_down, DRW_STATE_WRITE_COLOR); -grp = DRW_shgroup_create(e_data.dof_downsample_sh[use_alpha], psl->dof_down); +grp = DRW_shgroup_create(EEVEE_shaders_depth_of_field_downsample_get(use_alpha), + psl->dof_down); DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", >source_buffer); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", >depth); DRW_shgroup_uniform_vec2(grp, "nearFar", effects->dof_near_far, 1); @@ -226,7 +181,8 @@ void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_ const float *viewport_size = DRW_viewport_size_get(); const int sprite_len = ((int)viewport_size[0] / 2) * ((int)viewport_size[1] / 2); /* brackets matters */ -grp = DRW_shgroup_create(e_data.dof_scatter_sh[use_alpha], psl->dof_scatter); +grp = DRW_shgroup_create(EEVEE_shaders_depth_of_field_scatter_get(use_alpha), + psl->dof_scatter); DRW_shgroup_uniform_texture_ref(grp, "nearBuffer", >dof_down_near); DRW_shgroup_uniform_texture_ref(grp, "farBuffer", >dof_down_far); DRW_shgroup_uniform_texture_ref(grp, "cocBuffer", >dof_coc); @@ -236,7 +192,8 @@ void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_ DRW_PASS_CREATE(psl->dof_resolve, DRW_STATE_WRITE_COLOR); -grp = DRW_shgroup_create(e_data.dof_resolve_sh[use_alpha], psl->dof_resolve); +grp = DRW_shgroup_create(EEVEE_shaders_depth_of_field_resolve_get(use_alpha), + psl->dof_resolve); DRW_shgroup_uniform_texture_ref(grp, "scatterBuffer", >dof_blur);
[Bf-blender-cvs] [d851b38185c] master: Cleanup: improve internal function name in 'ngon_tessellate'
Commit: d851b38185c1777287a19618c7fd103ad18e15f3 Author: Campbell Barton Date: Wed Sep 2 19:33:47 2020 +1000 Branches: master https://developer.blender.org/rBd851b38185c1777287a19618c7fd103ad18e15f3 Cleanup: improve internal function name in 'ngon_tessellate' === M release/scripts/modules/bpy_extras/mesh_utils.py === diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index f70f1eacead..cef03a1eb08 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -268,7 +268,8 @@ def ngon_tessellate(from_data, indices, fix_loops=True, debug_print=True): # Manhatten length of a vector, faster then length. return abs(co[0]) + abs(co[1]) + abs(co[2]) -def vert_treplet(v, i): +def vert_from_vector_with_extra_data(v, i): +# Calculate data per-vector, for reuse. return v, vector_to_tuple(v, 6), i, mlen(v) def ed_key_mlen(v1, v2): @@ -298,12 +299,12 @@ def ngon_tessellate(from_data, indices, fix_loops=True, debug_print=True): if type(from_data) in {tuple, list}: verts = [ -vert_treplet(Vector(from_data[i]), ii) +vert_from_vector_with_extra_data(Vector(from_data[i]), ii) for ii, i in enumerate(indices) ] else: verts = [ -vert_treplet(from_data.vertices[i].co, ii) +vert_from_vector_with_extra_data(from_data.vertices[i].co, ii) for ii, i in enumerate(indices) ] ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [008eb7af41e] soc-2020-io-performance: Fix build errors on MSVC.
Commit: 008eb7af41e740bd26461855e268057602d27cd6 Author: Ankit Meel Date: Wed Sep 2 14:30:01 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB008eb7af41e740bd26461855e268057602d27cd6 Fix build errors on MSVC. === M source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc M source/blender/io/wavefront_obj/intern/obj_import_mesh.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc index 67bf6ebf892..92a4f4625b5 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc @@ -135,7 +135,7 @@ static void split_by_char(StringRef in_string, const char delimiter, Vector src, +static BLI_INLINE void copy_string_to_float(Span src, const float fallback_value, MutableSpan r_dst) { @@ -174,7 +174,7 @@ BLI_INLINE void copy_string_to_float(Span src, * Catches exception if the string cannot be converted to an integer. The destination * int is set to the given fallback value in that case. */ -BLI_INLINE void copy_string_to_int(StringRef src, const int fallback_value, int _dst) +static BLI_INLINE void copy_string_to_int(StringRef src, const int fallback_value, int _dst) { try { r_dst = std::stoi(string(src)); @@ -196,7 +196,7 @@ BLI_INLINE void copy_string_to_int(StringRef src, const int fallback_value, int * Catches exception if any string cannot be converted to an integer. The destination * int is set to the given fallback value in that case. */ -BLI_INLINE void copy_string_to_int(Span src, +static BLI_INLINE void copy_string_to_int(Span src, const int fallback_value, MutableSpan r_dst) { diff --git a/source/blender/io/wavefront_obj/intern/obj_import_mesh.cc b/source/blender/io/wavefront_obj/intern/obj_import_mesh.cc index 4f0f362630f..881df8feb99 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_mesh.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_mesh.cc @@ -214,7 +214,8 @@ void MeshFromGeometry::create_vertices() global_vertices_.vertices[mesh_geometry_.vertex_index(i)]); if (i >= mesh_geometry_.tot_normals()) { /* Silence debug warning in mesh validate. */ -normal_float_to_short_v3(blender_mesh_->mvert[i].no, (float[3]){1.0f, 1.0f, 1.0f}); +const float3 normals = {1.0f, 1.0f, 1.0f}; +normal_float_to_short_v3(blender_mesh_->mvert[i].no, normals); } } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3c4a67c575c] soc-2020-io-performance: Fix UI tooltips, layout, frame setting.
Commit: 3c4a67c575cb7f328b916745e51bbc6d6e5a098c Author: Ankit Meel Date: Wed Sep 2 14:29:28 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB3c4a67c575cb7f328b916745e51bbc6d6e5a098c Fix UI tooltips, layout, frame setting. Fix NodetreeRef crashing due to null nodetree. === M source/blender/editors/io/io_obj.c M source/blender/io/wavefront_obj/intern/obj_export_mtl.cc === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index e7b020c6f6c..b52d3d84539 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -148,8 +148,8 @@ static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr) /* Animation options. */ uiLayout *box = uiLayoutBox(layout); uiItemL(box, IFACE_("Animation"), ICON_ANIM); - uiLayout *col = uiLayoutColumn(box, true); - uiLayout *sub = uiLayoutColumn(col, true); + uiLayout *col = uiLayoutColumn(box, false); + uiLayout *sub = uiLayoutColumn(col, false); uiItemR(sub, imfptr, "export_animation", 0, NULL, ICON_NONE); sub = uiLayoutColumn(sub, true); uiItemR(sub, imfptr, "start_frame", 0, IFACE_("Frame Start"), ICON_NONE); @@ -159,17 +159,19 @@ static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr) /* Object Transform options. */ box = uiLayoutBox(layout); uiItemL(box, IFACE_("Object Transform"), ICON_OBJECT_DATA); - col = uiLayoutColumn(box, true); - uiItemR(col, imfptr, "forward_axis", 0, NULL, ICON_NONE); - uiItemR(col, imfptr, "up_axis", 0, NULL, ICON_NONE); - uiItemR(col, imfptr, "scaling_factor", 0, NULL, ICON_NONE); - uiItemR(col, imfptr, "export_eval_mode", 0, NULL, ICON_NONE); + col = uiLayoutColumn(box, false); + sub = uiLayoutColumn(col, false); + uiItemR(sub, imfptr, "forward_axis", 0, IFACE_("Axis Forward"), ICON_NONE); + uiItemR(sub, imfptr, "up_axis", 0, IFACE_("Up"), ICON_NONE); + sub = uiLayoutColumn(box, false); + uiItemR(sub, imfptr, "scaling_factor", 0, NULL, ICON_NONE); + uiItemR(sub, imfptr, "export_eval_mode", 0, NULL, ICON_NONE); /* Options for what to write. */ box = uiLayoutBox(layout); - uiItemL(box, IFACE_("Geometry Export Options"), ICON_EXPORT); - col = uiLayoutColumn(box, true); - sub = uiLayoutColumnWithHeading(col, true, IFACE_("Export")); + uiItemL(box, IFACE_("Geometry Export"), ICON_EXPORT); + col = uiLayoutColumn(box, false); + sub = uiLayoutColumnWithHeading(col, false, IFACE_("Export")); uiItemR(sub, imfptr, "export_uv", 0, IFACE_("UV Coordinates"), ICON_NONE); uiItemR(sub, imfptr, "export_normals", 0, IFACE_("Normals"), ICON_NONE); uiItemR(sub, imfptr, "export_materials", 0, IFACE_("Materials"), ICON_NONE); @@ -178,14 +180,14 @@ static void ui_obj_export_settings(uiLayout *layout, PointerRNA *imfptr) uiItemR(sub, imfptr, "export_curves_as_nurbs", 0, IFACE_("Curves as NURBS"), ICON_NONE); box = uiLayoutBox(layout); - uiItemL(box, IFACE_("Grouping Options"), ICON_GROUP); - col = uiLayoutColumn(box, true); - sub = uiLayoutColumnWithHeading(col, true, IFACE_("Export")); + uiItemL(box, IFACE_("Grouping"), ICON_GROUP); + col = uiLayoutColumn(box, false); + sub = uiLayoutColumnWithHeading(col, false, IFACE_("Export")); uiItemR(sub, imfptr, "export_object_groups", 0, IFACE_("Object Groups"), ICON_NONE); uiItemR(sub, imfptr, "export_material_groups", 0, IFACE_("Material Groups"), ICON_NONE); uiItemR(sub, imfptr, "export_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE); uiItemR(sub, imfptr, "export_smooth_groups", 0, IFACE_("Smooth Groups"), ICON_NONE); - sub = uiLayoutColumn(sub, true); + sub = uiLayoutColumn(sub, false); uiLayoutSetEnabled(sub, export_smooth_groups); uiItemR(sub, imfptr, "smooth_group_bitflags", 0, IFACE_("Smooth Group Bitflags"), ICON_NONE); } @@ -199,7 +201,7 @@ static void wm_obj_export_draw(bContext *UNUSED(C), wmOperator *op) static bool wm_obj_export_check(bContext *C, wmOperator *op) { - char filepath[FILE_MAX] = {}; + char filepath[FILE_MAX]; Scene *scene = CTX_data_scene(C); bool ret = false; RNA_string_get(op->ptr, "filepath", filepath); @@ -210,14 +212,28 @@ static bool wm_obj_export_check(bContext *C, wmOperator *op) ret = true; } - /* Set the default export frames to the current one in viewport. */ if (RNA_boolean_get(op->ptr, "export_animation")) { -RNA_int_set(op->ptr, "start_frame", SFRA); -RNA_int_set(op->ptr, "end_frame", EFRA); +const int start = RNA_int_get(op->ptr, "start_frame"); +const int end = RNA_int_get(op->ptr, "end_frame"); +/* Set the defaults. */ +if (start == -INT_MAX) { + RNA_int_set(op->ptr, "start_frame", SFRA); +} +if (end == INT_MAX) { + RNA_int_set(op->ptr, "end_frame", EFRA); + ret = true; +} +/* Fix manual errors. */ +if (end < start)
[Bf-blender-cvs] [cf67ba848f2] master: WM: add use_factory_startup option to read homefile operator
Commit: cf67ba848f2f42e0b7320aa0654ba89bd14a1416 Author: Campbell Barton Date: Wed Sep 2 17:44:08 2020 +1000 Branches: master https://developer.blender.org/rBcf67ba848f2f42e0b7320aa0654ba89bd14a1416 WM: add use_factory_startup option to read homefile operator There was no way to reset the current file to factory settings without reloading the preferences (which disables & re-enables add-ons), this slows down resetting files and can complicate tests. === M source/blender/windowmanager/intern/wm_files.c === diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index f53a3d6bf35..561e27f933d 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1982,7 +1982,10 @@ void WM_OT_read_history(wmOperatorType *ot) static int wm_homefile_read_exec(bContext *C, wmOperator *op) { - const bool use_factory_settings = (STREQ(op->type->idname, "WM_OT_read_factory_settings")); + const bool use_factory_startup_and_userdef = STREQ(op->type->idname, + "WM_OT_read_factory_settings"); + const bool use_factory_settings = use_factory_startup_and_userdef || +RNA_boolean_get(op->ptr, "use_factory_startup"); bool use_userdef = false; char filepath_buf[FILE_MAX]; const char *filepath = NULL; @@ -2007,10 +2010,12 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op) } } else { -/* always load UI for factory settings (prefs will re-init) */ -G.fileflags &= ~G_FILE_NO_UI; -/* Always load preferences with factory settings. */ -use_userdef = true; +if (use_factory_startup_and_userdef) { + /* always load UI for factory settings (prefs will re-init) */ + G.fileflags &= ~G_FILE_NO_UI; + /* Always load preferences with factory settings. */ + use_userdef = true; +} } char app_template_buf[sizeof(U.app_template)]; @@ -2127,6 +2132,12 @@ void WM_OT_read_homefile(wmOperatorType *ot) prop = RNA_def_boolean(ot->srna, "use_splash", false, "Splash", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + /* So scripts can load factory-startup without resetting preferences + * (which has other implications such as reloading all add-ons). + * Match naming for `--factory-startup` command line argument. */ + prop = RNA_def_boolean(ot->srna, "use_factory_startup", false, "Factory Startup", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + read_homefile_props(ot); /* omit poll to run in background mode */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [428a1aaf737] master: UI: add back Layout.introspect
Commit: 428a1aaf7372aaad793fe7cc03128db18e3ae602 Author: Campbell Barton Date: Tue Sep 1 15:23:55 2020 +1000 Branches: master https://developer.blender.org/rB428a1aaf7372aaad793fe7cc03128db18e3ae602 UI: add back Layout.introspect Add back this function, removed 2e14b7fb9770b. Useful for checking operators used in menus. === M source/blender/editors/include/UI_interface.h M source/blender/editors/interface/interface_layout.c M source/blender/python/intern/CMakeLists.txt M source/blender/python/intern/bpy_rna.c M source/blender/python/intern/bpy_rna_types_capi.c A source/blender/python/intern/bpy_rna_ui.c A source/blender/python/intern/bpy_rna_ui.h === diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 367f7965026..4fc537ca5c2 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -2407,6 +2407,9 @@ void uiItemTabsEnumR_prop(uiLayout *layout, PropertyRNA *prop, bool icon_only); +/* Only for testing, inspecting layouts. */ +const char *UI_layout_introspect(uiLayout *layout); + /* UI Operators */ typedef struct uiDragColorHandle { float color[3]; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 50355d350ac..e1f3e14eda1 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -31,6 +31,7 @@ #include "DNA_userdef_types.h" #include "BLI_alloca.h" +#include "BLI_dynstr.h" #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_rect.h" @@ -5637,3 +5638,126 @@ void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout) } /** \} */ + +/* */ +/** \name Layout (Debuging/Introspection) + * + * Serialize the layout as a Python compatible dictionary, + * + * \note Proper string escaping isn't used, + * triple quotes are used to prevent single quotes from interfering with Python syntax. + * If we want this to be fool-proof, we would need full Python compatible string escape support. + * As we don't use triple quotes in the UI it's good-enough in practice. + * \{ */ + +static void ui_layout_introspect_button(DynStr *ds, uiButtonItem *bitem) +{ + uiBut *but = bitem->but; + BLI_dynstr_appendf(ds, "'type':%d, ", (int)but->type); + BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr); + /* Not exactly needed, rna has this. */ + BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); + + if (but->optype) { +char *opstr = WM_operator_pystring_ex( +but->block->evil_C, NULL, false, true, but->optype, but->opptr); +BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : ""); +MEM_freeN(opstr); + } + + { +PropertyRNA *prop = NULL; +wmOperatorType *ot = UI_but_operatortype_get_from_enum_menu(but, ); +if (ot) { + char *opstr = WM_operator_pystring_ex(but->block->evil_C, NULL, false, true, ot, NULL); + BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : ""); + BLI_dynstr_appendf(ds, "'property':'''%s''', ", prop ? RNA_property_identifier(prop) : ""); + MEM_freeN(opstr); +} + } + + if (but->rnaprop) { +BLI_dynstr_appendf(ds, + "'rna':'%s.%s[%d]', ", + RNA_struct_identifier(but->rnapoin.type), + RNA_property_identifier(but->rnaprop), + but->rnaindex); + } +} + +static void ui_layout_introspect_items(DynStr *ds, ListBase *lb) +{ + uiItem *item; + + BLI_dynstr_append(ds, "["); + + for (item = lb->first; item; item = item->next) { + +BLI_dynstr_append(ds, "{"); + +#define CASE_ITEM(id) \ + case id: { \ +const char *id_str = STRINGIFY(id); \ +BLI_dynstr_append(ds, "'type': '"); \ +/* Skip 'ITEM_'. */ \ +BLI_dynstr_append(ds, id_str + 5); \ +BLI_dynstr_append(ds, "', "); \ +break; \ + } \ +((void)0) + +switch (item->type) { + CASE_ITEM(ITEM_BUTTON); + CASE_ITEM(ITEM_LAYOUT_ROW); + CASE_ITEM(ITEM_LAYOUT_COLUMN); + CASE_ITEM(ITEM_LAYOUT_COLUMN_FLOW); + CASE_ITEM(ITEM_LAYOUT_ROW_FLOW); + CASE_ITEM(ITEM_LAYOUT_BOX); + CASE_ITEM(ITEM_LAYOUT_ABSOLUTE); + CASE_ITEM(ITEM_LAYOUT_SPLIT); + CASE_ITEM(ITEM_LAYOUT_OVERLAP); + CASE_ITEM(ITEM_LAYOUT_ROOT); + CASE_ITEM(ITEM_LAYOUT_GRID_FLOW); + CASE_ITEM(ITEM_LAYOUT_RADIAL); +} + +#undef CASE_ITEM + +switch (item->type) { + case ITEM_BUTTON: +ui_layout_introspect_button(ds, (uiButtonItem *)item); +break; + default: +BLI_dynstr_append(ds, "'items':"); +