[Bf-blender-cvs] [8a1d3bf2b1f] master: Merge branch 'blender-v2.93-release'
Commit: 8a1d3bf2b1f9564d845c694ebf11268bbdfced97 Author: Campbell Barton Date: Fri Apr 30 15:16:08 2021 +1000 Branches: master https://developer.blender.org/rB8a1d3bf2b1f9564d845c694ebf11268bbdfced97 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a636909aa77] master: Merge branch 'blender-v2.93-release'
Commit: a636909aa77dd6a8f1c2da9fe05170a62e9857d0 Author: Campbell Barton Date: Fri Apr 30 15:16:06 2021 +1000 Branches: master https://developer.blender.org/rBa636909aa77dd6a8f1c2da9fe05170a62e9857d0 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [452f32dcb3e] master: Merge branch 'blender-v2.93-release'
Commit: 452f32dcb3ea281aff3089c64aa0b84224abd80f Author: Campbell Barton Date: Fri Apr 30 15:16:05 2021 +1000 Branches: master https://developer.blender.org/rB452f32dcb3ea281aff3089c64aa0b84224abd80f Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5a40c795200] master: Merge branch 'blender-v2.93-release'
Commit: 5a40c7952007a59bab2ae952d31885e6814c713e Author: Campbell Barton Date: Fri Apr 30 15:16:04 2021 +1000 Branches: master https://developer.blender.org/rB5a40c7952007a59bab2ae952d31885e6814c713e Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a9a048c726c] master: Merge branch 'blender-v2.93-release'
Commit: a9a048c726c1f8bbd99f711f93d28ea37027728a Author: Campbell Barton Date: Fri Apr 30 15:16:02 2021 +1000 Branches: master https://developer.blender.org/rBa9a048c726c1f8bbd99f711f93d28ea37027728a Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1597eb82d65] master: Merge branch 'blender-v2.93-release'
Commit: 1597eb82d6507a8186f694cf79c9eea3138e4ae8 Author: Campbell Barton Date: Fri Apr 30 15:14:47 2021 +1000 Branches: master https://developer.blender.org/rB1597eb82d6507a8186f694cf79c9eea3138e4ae8 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [093ab05bcd6] master: Merge branch 'blender-v2.93-release'
Commit: 093ab05bcd6efd3e08409f4ca2edb9e84cf75bd1 Author: Campbell Barton Date: Fri Apr 30 15:14:36 2021 +1000 Branches: master https://developer.blender.org/rB093ab05bcd6efd3e08409f4ca2edb9e84cf75bd1 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0959618c2e5] master: Merge branch 'blender-v2.93-release'
Commit: 0959618c2e5f31a8e5df3967dacdba1a6f6f9854 Author: Campbell Barton Date: Fri Apr 30 15:15:14 2021 +1000 Branches: master https://developer.blender.org/rB0959618c2e5f31a8e5df3967dacdba1a6f6f9854 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d1cdbbc5fdb] master: Merge branch 'blender-v2.93-release'
Commit: d1cdbbc5fdb9e25798bb5953849407b0346dbee8 Author: Campbell Barton Date: Fri Apr 30 15:14:34 2021 +1000 Branches: master https://developer.blender.org/rBd1cdbbc5fdb9e25798bb5953849407b0346dbee8 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3be50c849a1] master: Merge branch 'blender-v2.93-release'
Commit: 3be50c849a14a6030e171acbdb0ec6706dfa277e Author: Campbell Barton Date: Fri Apr 30 15:14:32 2021 +1000 Branches: master https://developer.blender.org/rB3be50c849a14a6030e171acbdb0ec6706dfa277e Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [caf1643f4a7] blender-v2.93-release: Fix uninitialized memory use in GLDrawList
Commit: caf1643f4a779cb13523843252fde930e615e865 Author: Campbell Barton Date: Fri Apr 30 12:31:52 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rBcaf1643f4a779cb13523843252fde930e615e865 Fix uninitialized memory use in GLDrawList GLDrawList::init() used MDI_INDEXED which checks base_index_. === M source/blender/gpu/opengl/gl_drawlist.cc === diff --git a/source/blender/gpu/opengl/gl_drawlist.cc b/source/blender/gpu/opengl/gl_drawlist.cc index d3401036154..50ab5574cd2 100644 --- a/source/blender/gpu/opengl/gl_drawlist.cc +++ b/source/blender/gpu/opengl/gl_drawlist.cc @@ -68,6 +68,7 @@ GLDrawList::GLDrawList(int length) batch_ = nullptr; buffer_id_ = 0; command_len_ = 0; + base_index_ = 0; command_offset_ = 0; data_size_ = 0; data_ = nullptr; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2ed847317e7] blender-v2.93-release: Fix crash running window operators in background mode
Commit: 2ed847317e7da8de86846766c54f40c5ee7cee73 Author: Campbell Barton Date: Fri Apr 30 14:16:50 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rB2ed847317e7da8de86846766c54f40c5ee7cee73 Fix crash running window operators in background mode === M source/blender/editors/include/ED_screen.h M source/blender/editors/screen/screen_ops.c M source/blender/windowmanager/intern/wm_operators.c === diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index b3205acb8ee..78c4c2a8eba 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -304,6 +304,7 @@ void ED_operatortypes_workspace(void); /* operators; context poll callbacks */ bool ED_operator_screenactive(struct bContext *C); +bool ED_operator_screenactive_nobackground(struct bContext *C); bool ED_operator_screen_mainwinactive(struct bContext *C); bool ED_operator_areaactive(struct bContext *C); bool ED_operator_regionactive(struct bContext *C); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 5cd4e8c353b..765877d6a8e 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -141,6 +141,14 @@ bool ED_operator_screenactive(bContext *C) return true; } +bool ED_operator_screenactive_nobackground(bContext *C) +{ + if (G.background) { +return false; + } + return ED_operator_screenactive(C); +} + /* XXX added this to prevent anim state to change during renders */ static bool ED_operator_screenactive_norender(bContext *C) { @@ -4883,7 +4891,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) /* api callbacks */ ot->exec = userpref_show_exec; - ot->poll = ED_operator_screenactive; + ot->poll = ED_operator_screenactive_nobackground; /* Not in background as this opens a window. */ } /** \} */ @@ -4960,7 +4968,7 @@ static void SCREEN_OT_drivers_editor_show(struct wmOperatorType *ot) /* api callbacks */ ot->exec = drivers_editor_show_exec; - ot->poll = ED_operator_screenactive; + ot->poll = ED_operator_screenactive_nobackground; /* Not in background as this opens a window. */ } /** \} */ @@ -5004,7 +5012,7 @@ static void SCREEN_OT_info_log_show(struct wmOperatorType *ot) /* api callbacks */ ot->exec = info_log_show_exec; - ot->poll = ED_operator_screenactive; + ot->poll = ED_operator_screenactive_nobackground; } /** \} */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 6f98ecfd621..9175eb2dbf7 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1911,6 +1911,9 @@ static bool wm_operator_winactive_normal(bContext *C) if (!((screen = WM_window_get_active_screen(win)) && (screen->state == SCREENNORMAL))) { return 0; } + if (G.background) { +return 0; + } return 1; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bf8962e442e] blender-v2.93-release: Fix sculpt mask operator crash running without a 3D view
Commit: bf8962e442e51d76c0cdf669c3399bd0f83cd701 Author: Campbell Barton Date: Fri Apr 30 14:22:13 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rBbf8962e442e51d76c0cdf669c3399bd0f83cd701 Fix sculpt mask operator crash running without a 3D view Add missing operator poll, depend on the 3D view for all sculpt paint/mask operators. === M source/blender/editors/sculpt_paint/paint_mask.c === diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 7671f69ee05..b6ae6f8bee7 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -1650,7 +1650,7 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot) ot->modal = WM_gesture_lasso_modal; ot->exec = paint_mask_gesture_lasso_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; @@ -1671,7 +1671,7 @@ void PAINT_OT_mask_box_gesture(wmOperatorType *ot) ot->modal = WM_gesture_box_modal; ot->exec = paint_mask_gesture_box_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; @@ -1692,7 +1692,7 @@ void PAINT_OT_mask_line_gesture(wmOperatorType *ot) ot->modal = WM_gesture_straightline_oneshot_modal; ot->exec = paint_mask_gesture_line_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; @@ -1713,6 +1713,8 @@ void SCULPT_OT_face_set_lasso_gesture(wmOperatorType *ot) ot->modal = WM_gesture_lasso_modal; ot->exec = face_set_gesture_lasso_exec; + ot->poll = SCULPT_mode_poll_view3d; + /* Properties. */ WM_operator_properties_gesture_lasso(ot); sculpt_gesture_operator_properties(ot); @@ -1728,7 +1730,7 @@ void SCULPT_OT_face_set_box_gesture(wmOperatorType *ot) ot->modal = WM_gesture_box_modal; ot->exec = face_set_gesture_box_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; @@ -1747,7 +1749,7 @@ void SCULPT_OT_trim_lasso_gesture(wmOperatorType *ot) ot->modal = WM_gesture_lasso_modal; ot->exec = sculpt_trim_gesture_lasso_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; @@ -1768,7 +1770,7 @@ void SCULPT_OT_trim_box_gesture(wmOperatorType *ot) ot->modal = WM_gesture_box_modal; ot->exec = sculpt_trim_gesture_box_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; @@ -1789,7 +1791,7 @@ void SCULPT_OT_project_line_gesture(wmOperatorType *ot) ot->modal = WM_gesture_straightline_oneshot_modal; ot->exec = project_gesture_line_exec; - ot->poll = SCULPT_mode_poll; + ot->poll = SCULPT_mode_poll_view3d; ot->flag = OPTYPE_REGISTER; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d6b26b3fa0c] blender-v2.93-release: Fix potential buffer overrun in drw_shader_dependencies_get
Commit: d6b26b3fa0c46c6a9d9c9e5d3816a713dfa261a7 Author: Campbell Barton Date: Fri Apr 30 14:27:44 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rBd6b26b3fa0c46c6a9d9c9e5d3816a713dfa261a7 Fix potential buffer overrun in drw_shader_dependencies_get Logical error let this function to write one past the buffer bounds. === M source/blender/draw/intern/draw_manager_shader.c === diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c index c93cbf16a30..2aad1f10154 100644 --- a/source/blender/draw/intern/draw_manager_shader.c +++ b/source/blender/draw/intern/draw_manager_shader.c @@ -606,10 +606,10 @@ static uint32_t drw_shader_dependencies_get(const DRWShaderLibrary *lib, const c haystack += 16; int dep = drw_shader_library_search(lib, haystack); if (dep == -1) { - char dbg_name[32]; + char dbg_name[33]; int i = 0; - while ((haystack[0] != ')') && (i < 31)) { -dbg_name[i] = haystack[0]; + while ((*haystack != ')') && (i < (sizeof(dbg_name) - 2))) { +dbg_name[i] = *haystack; haystack++; i++; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0eef9df3559] blender-v2.93-release: Fix missing NULL check in grease-pencil clear strokes
Commit: 0eef9df3559f11128266638904762705cc4c5bc1 Author: Campbell Barton Date: Fri Apr 30 14:24:49 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rB0eef9df3559f11128266638904762705cc4c5bc1 Fix missing NULL check in grease-pencil clear strokes === M source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c === diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c index 0c6b4ebf30c..c023c63ebc9 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c @@ -364,7 +364,8 @@ static int lineart_gpencil_bake_strokes_commom_modal(bContext *C, static void lineart_gpencil_clear_strokes_exec_common(Object *ob) { - if (ob->type != OB_GPENCIL) { + /* TODO: move these checks to an operator poll function. */ + if ((ob == NULL) || ob->type != OB_GPENCIL) { return; } LISTBASE_FOREACH (GpencilModifierData *, md, >greasepencil_modifiers) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e5c2e5e9e5f] blender-v2.93-release: Cleanup: quiet shadow variable warning
Commit: e5c2e5e9e5fe9d1fd6178397cc29bb2552787083 Author: Campbell Barton Date: Fri Apr 30 11:21:31 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rBe5c2e5e9e5fe9d1fd6178397cc29bb2552787083 Cleanup: quiet shadow variable warning === M source/blender/imbuf/intern/anim_movie.c === diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 9e8224f58b2..96cd1fb61a4 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -881,12 +881,12 @@ static void ffmpeg_postprocess(struct anim *anim) # endif if (need_aligned_ffmpeg_buffer(anim)) { -uint8_t *src = anim->pFrameRGB->data[0]; -uint8_t *dst = (uint8_t *)ibuf->rect; +uint8_t *buf_src = anim->pFrameRGB->data[0]; +uint8_t *buf_dst = (uint8_t *)ibuf->rect; for (int y = 0; y < anim->y; y++) { - memcpy(dst, src, anim->x * 4); - dst += anim->x * 4; - src += anim->pFrameRGB->linesize[0]; + memcpy(buf_dst, buf_src, anim->x * 4); + buf_dst += anim->x * 4; + buf_src += anim->pFrameRGB->linesize[0]; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c195c061d59] blender-v2.93-release: Fix uninitialized local-view flag on object creation
Commit: c195c061d59b59283077328bdf0931d45fef76d0 Author: Campbell Barton Date: Fri Apr 30 11:39:13 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rBc195c061d59b59283077328bdf0931d45fef76d0 Fix uninitialized local-view flag on object creation Local view return argument to ED_object_add_generic_get_opts was left uninitialized. === M source/blender/editors/object/object_add.c === diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index bcddf3d585c..6f8b5f7d244 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -482,9 +482,7 @@ bool ED_object_add_generic_get_opts(bContext *C, if (local_view_bits) { View3D *v3d = CTX_wm_view3d(C); -if (v3d && v3d->localvd) { - *local_view_bits = v3d->local_view_uuid; -} +*local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0; } /* Location! */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [47aca2b4c40] master: Nodes: Add a callback to check for valid socket type
Commit: 47aca2b4c402ec35ea52c18afcc0840bcf283b26 Author: Wannes Malfait Date: Thu Apr 29 23:36:46 2021 -0500 Branches: master https://developer.blender.org/rB47aca2b4c402ec35ea52c18afcc0840bcf283b26 Nodes: Add a callback to check for valid socket type This adds a callback to bNodeTreeType to check which socket types are valid for the tree type. Function has been implemented for the normal tree types, and can be implemented for custom node trees with python, by adding a `classmethod` to the tree. However, only builtin socket types are supported. This is relevant for T87049, but it also has the advantage that it is now clear which node trees support which sockets. Previously this was assumed to be known by all developers. Differential Revision: https://developer.blender.org/D10938 === M source/blender/blenkernel/BKE_node.h M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/composite/node_composite_tree.c M source/blender/nodes/geometry/node_geometry_tree.cc M source/blender/nodes/shader/node_shader_tree.c M source/blender/nodes/texture/node_texture_tree.c === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index b913e76836c..819c148f0ad 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -410,6 +410,9 @@ typedef struct bNodeTreeType { void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode); + /* Check if the socket type is valid for this tree type. */ + bool (*valid_socket_type)(enum eNodeSocketDatatype socket_type, struct bNodeTreeType *ntreetype); + /* RNA integration */ ExtensionRNA rna_ext; } bNodeTreeType; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a738084dbcd..3b81b591f6d 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -971,6 +971,32 @@ static void rna_NodeTree_get_from_context( RNA_parameter_list_free(); } +static bool rna_NodeTree_valid_socket_type(eNodeSocketDatatype socket_type, + bNodeTreeType *ntreetype) +{ + extern FunctionRNA rna_NodeTree_valid_socket_type_func; + + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + void *ret; + bool valid; + + RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, ); /* dummy */ + func = _NodeTree_valid_socket_type_func; + + RNA_parameter_list_create(, , func); + RNA_parameter_set_lookup(, "type", _type); + ntreetype->rna_ext.call(NULL, , func, ); + + RNA_parameter_get_lookup(, "valid", ); + valid = *(bool *)ret; + + RNA_parameter_list_free(); + + return valid; +} + static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type) { bNodeTreeType *nt = RNA_struct_blender_type_get(type); @@ -999,7 +1025,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain, bNodeTreeType *nt, dummynt; bNodeTree dummyntree; PointerRNA dummyptr; - int have_function[3]; + int have_function[4]; /* setup dummy tree & tree type to store static properties in */ memset(, 0, sizeof(bNodeTreeType)); @@ -1045,6 +1071,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain, nt->poll = (have_function[0]) ? rna_NodeTree_poll : NULL; nt->update = (have_function[1]) ? rna_NodeTree_update_reg : NULL; nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : NULL; + nt->valid_socket_type = (have_function[3]) ? rna_NodeTree_valid_socket_type : NULL; ntreeTypeAdd(nt); @@ -11414,6 +11441,14 @@ static void rna_def_nodetree(BlenderRNA *brna) parm = RNA_def_pointer( func, "result_3", "ID", "From ID", "Original ID data-block selected from the context"); RNA_def_function_output(func, parm); + + /* Check for support of a socket type. */ + func = RNA_def_function(srna, "valid_socket_type", NULL); + RNA_def_function_ui_description(func, "Check if the socket type is valid for the node tree"); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); + parm = RNA_def_enum(func, "type", node_socket_type_items, 0, "", ""); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + RNA_def_function_return(func, RNA_def_boolean(func, "valid", false, "", "")); } static void rna_def_composite_nodetree(BlenderRNA *brna) diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 085b5c463b9..19815d01278 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -205,6 +205,12 @@ static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode) } } +static bool composite_node_tree_socket_type_valid(eNodeSocketDatatype socket_type, +
[Bf-blender-cvs] [ddaeaa4b981] master: Geometry Nodes: Add a template utility to mix two attribute values
Commit: ddaeaa4b981d38393fcbb6ca6cc27e81f55da900 Author: Hans Goudey Date: Thu Apr 29 21:52:34 2021 -0500 Branches: master https://developer.blender.org/rBddaeaa4b981d38393fcbb6ca6cc27e81f55da900 Geometry Nodes: Add a template utility to mix two attribute values This is just linear interpolation, but it's nice to have an equivalent to `mix3` for only two values. It will be used for interpolation of values between bezier spline control points. === M source/blender/blenkernel/BKE_attribute_math.hh === diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh index 65ac5b5bfa8..fc7498951f9 100644 --- a/source/blender/blenkernel/BKE_attribute_math.hh +++ b/source/blender/blenkernel/BKE_attribute_math.hh @@ -130,6 +130,48 @@ inline Color4f mix3(const float3 , const Color4f , const Color4f , /** \} */ +/* */ +/** \name Mix two values of the same type. + * + * This is just basic linear interpolation. + * \{ */ + +template T mix2(const float factor, const T , const T ); + +template<> inline bool mix2(const float factor, const bool , const bool ) +{ + return ((1.0f - factor) * a + factor * b) >= 0.5f; +} + +template<> inline int mix2(const float factor, const int , const int ) +{ + return static_cast((1.0f - factor) * a + factor * b); +} + +template<> inline float mix2(const float factor, const float , const float ) +{ + return (1.0f - factor) * a + factor * b; +} + +template<> inline float2 mix2(const float factor, const float2 , const float2 ) +{ + return float2::interpolate(a, b, factor); +} + +template<> inline float3 mix2(const float factor, const float3 , const float3 ) +{ + return float3::interpolate(a, b, factor); +} + +template<> inline Color4f mix2(const float factor, const Color4f , const Color4f ) +{ + Color4f result; + interp_v4_v4v4(result, a, b, factor); + return result; +} + +/** \} */ + /* */ /** \name Mix a dynamic amount of values with weights for many elements. * ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [45a14a20de9] master: Cleanup: Mismatched array bounds in function declaration
Commit: 45a14a20de9cfd11695195ea7b2aaceb2734e747 Author: Hans Goudey Date: Thu Apr 29 21:25:34 2021 -0500 Branches: master https://developer.blender.org/rB45a14a20de9cfd11695195ea7b2aaceb2734e747 Cleanup: Mismatched array bounds in function declaration === M source/blender/blenkernel/intern/pbvh_intern.h M source/blender/blenlib/BLI_math_geom.h M source/blender/blenlib/BLI_math_solvers.h M source/blender/blenlib/intern/math_geom.c M source/blender/editors/include/ED_fileselect.h === diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index db6b2a89efb..948b57578dc 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -194,9 +194,9 @@ bool ray_face_intersection_quad(const float ray_start[3], float *depth); bool ray_face_intersection_tri(const float ray_start[3], struct IsectRayPrecalc *isect_precalc, - const float *t0, - const float *t1, - const float *t2, + const float t0[3], + const float t1[3], + const float t2[3], float *depth); bool ray_face_nearest_quad(const float ray_start[3], diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index b9c3d8af25c..c744c5d13d3 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -119,10 +119,10 @@ float dist_signed_to_plane_v3(const float p[3], const float plane[4]); float dist_to_plane_v3(const float p[3], const float plane[4]); /* plane3 versions */ -float dist_signed_squared_to_plane3_v3(const float p[3], const float plane[4]); -float dist_squared_to_plane3_v3(const float p[3], const float plane[4]); -float dist_signed_to_plane3_v3(const float p[3], const float plane[4]); -float dist_to_plane3_v3(const float p[3], const float plane[4]); +float dist_signed_squared_to_plane3_v3(const float p[3], const float plane[3]); +float dist_squared_to_plane3_v3(const float p[3], const float plane[3]); +float dist_signed_to_plane3_v3(const float p[3], const float plane[3]); +float dist_to_plane3_v3(const float p[3], const float plane[3]); float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h index 13481e27e2a..39a79efc7e2 100644 --- a/source/blender/blenlib/BLI_math_solvers.h +++ b/source/blender/blenlib/BLI_math_solvers.h @@ -41,7 +41,7 @@ bool BLI_eigen_solve_selfadjoint_m3(const float m3[3][3], float r_eigen_values[3], float r_eigen_vectors[3][3]); -void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[], float r_V[3][3]); +void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[3], float r_V[3][3]); /* Simple Solvers / diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 01cda6c9e4a..bd1fa0fbb8b 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -5393,7 +5393,7 @@ void accumulate_vertex_normals_poly_v3(float **vertnos, void tangent_from_uv_v3(const float uv1[2], const float uv2[2], -const float uv3[3], +const float uv3[2], const float co1[3], const float co2[3], const float co3[3], diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 983ae94b637..8118e3c6c69 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -110,7 +110,7 @@ struct FileAssetSelectParams *ED_fileselect_get_asset_params(const struct SpaceF void ED_fileselect_set_params_from_userdef(struct SpaceFile *sfile); void ED_fileselect_params_to_userdef(struct SpaceFile *sfile, - const int temp_win_size[], + const int temp_win_size[2], const bool is_maximized); void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *region); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org
[Bf-blender-cvs] [78008642ae0] asset-browser-snap-dragging: Show a bounding box for object assets while dragging
Commit: 78008642ae010c64da4cb6b64911b44488823c3e Author: Julian Eisel Date: Fri Apr 30 02:02:45 2021 +0200 Branches: asset-browser-snap-dragging https://developer.blender.org/rB78008642ae010c64da4cb6b64911b44488823c3e Show a bounding box for object assets while dragging Note: Object assets have to be saved with this commit or later for the bounding box to appear. Basic idea is: * Store the bounding box (and related info) in the asset metadata. * The bounding box has to be updated and written to custom properties of the asset metadata. * There's a new `AssetTypeInfo` struct, to set asset type dependent callbacks or data (in future). ID types can conveniently define asset-type info as part of their `IDTypeInfo` definition. * The asset-type info can contain a custom callback to be executed before the asset is saved. This is how the object can write its custom asset metadata. * The dropbox can also register a callback to set properties for its gizmo-group now. Used to copy * The "placement plane" gizmo is scaled to the bounding box size too. * For local ID assets, the data should be accessed directly, so the file doesn't have to be saved to get the bounding box updated. Also: * Added proper gizmo group custom property support to C (was already supported in Python, or in C with some hacking). * Store the basis matrix (world matrix without parent or constraint transforms) in the custom asset metadata. Used by the placement gizmo to scale the bounding box to match the result visually when dropping. * The preview image is disabled while dragging objects over the 3D view. * The bounding box always snaps with its lower edge (Z axis) to the surface. Snapping with other axes can be added still. * However, actually dropping the object still uses the origin, so the drop position may not match what the bounding box indicated. This could be changed to also use the bounding box instead. Or the drawn bounding box should be translated to respect the origin position. === M source/blender/blenkernel/BKE_asset.h M source/blender/blenkernel/BKE_idtype.h M source/blender/blenkernel/BKE_main.h M source/blender/blenkernel/intern/asset.cc M source/blender/blenkernel/intern/object.c M source/blender/blenloader/intern/readfile.c M source/blender/editors/asset/asset_edit.cc M source/blender/editors/include/ED_asset.h M source/blender/editors/include/UI_interface.h M source/blender/editors/interface/interface.c M source/blender/editors/space_file/file_draw.c M source/blender/editors/space_view3d/space_view3d.c M source/blender/editors/space_view3d/view3d_placement.c M source/blender/makesdna/DNA_asset_types.h M source/blender/windowmanager/WM_api.h M source/blender/windowmanager/WM_types.h M source/blender/windowmanager/gizmo/WM_gizmo_types.h M source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c M source/blender/windowmanager/intern/wm_dragdrop.c M source/blender/windowmanager/intern/wm_files.c === diff --git a/source/blender/blenkernel/BKE_asset.h b/source/blender/blenkernel/BKE_asset.h index d1f543b1f38..38c053607f5 100644 --- a/source/blender/blenkernel/BKE_asset.h +++ b/source/blender/blenkernel/BKE_asset.h @@ -20,17 +20,30 @@ #pragma once +#include "BLI_compiler_attrs.h" #include "BLI_utildefines.h" #ifdef __cplusplus extern "C" { #endif +struct AssetMetaData; struct BlendDataReader; struct BlendWriter; struct ID; +struct IDProperty; struct PreviewImage; +typedef void (*PreSaveFn)(void *asset_ptr, struct AssetMetaData *asset_data); + +typedef struct AssetTypeInfo { + /** + * For local assets (assets in the current .blend file), a callback to execute before the file is + * saved. + */ + PreSaveFn pre_save_fn; +} AssetTypeInfo; + struct AssetMetaData *BKE_asset_metadata_create(void); void BKE_asset_metadata_free(struct AssetMetaData **asset_data); @@ -45,6 +58,10 @@ struct AssetTagEnsureResult BKE_asset_metadata_tag_ensure(struct AssetMetaData * const char *name); void BKE_asset_metadata_tag_remove(struct AssetMetaData *asset_data, struct AssetTag *tag); +void BKE_asset_metadata_idprop_ensure(struct AssetMetaData *asset_data, struct IDProperty *prop); +struct IDProperty *BKE_asset_metadata_idprop_find(const struct AssetMetaData *asset_data, + const char *name) ATTR_WARN_UNUSED_RESULT; + struct PreviewImage *BKE_asset_metadata_preview_get_from_id(const struct AssetMetaData *asset_data, const struct ID *owner_id); diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 4578f1c3ca5..be3691009d2
[Bf-blender-cvs] [5df6caa7f36] asset-browser-snap-dragging: Merge remote-tracking branch 'origin/master' into asset-browser-snap-dragging
Commit: 5df6caa7f36bd8f8c0fbea9faa3761323b6a5cfc Author: Julian Eisel Date: Thu Apr 29 18:50:29 2021 +0200 Branches: asset-browser-snap-dragging https://developer.blender.org/rB5df6caa7f36bd8f8c0fbea9faa3761323b6a5cfc Merge remote-tracking branch 'origin/master' into asset-browser-snap-dragging === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8dd5fdca3bc] master: Cleanup: Remove unecessary variable
Commit: 8dd5fdca3bc3cefe965a288de56b88553a2245bc Author: Hans Goudey Date: Thu Apr 29 15:11:35 2021 -0500 Branches: master https://developer.blender.org/rB8dd5fdca3bc3cefe965a288de56b88553a2245bc Cleanup: Remove unecessary variable The value of this variable was incremented, but never used. === M source/blender/blenkernel/intern/curveprofile.c === diff --git a/source/blender/blenkernel/intern/curveprofile.c b/source/blender/blenkernel/intern/curveprofile.c index 752e0d4dfcf..00cdc7b3031 100644 --- a/source/blender/blenkernel/intern/curveprofile.c +++ b/source/blender/blenkernel/intern/curveprofile.c @@ -1015,7 +1015,6 @@ void BKE_curveprofile_create_samples_even_spacing(CurveProfile *profile, { const float total_length = BKE_curveprofile_total_length(profile); const float segment_length = total_length / n_segments; - float length_travelled = 0.0f; float distance_to_next_table_point = curveprofile_distance_to_next_table_point(profile, 0); float distance_to_previous_table_point = 0.0f; int i_table = 0; @@ -1029,7 +1028,6 @@ void BKE_curveprofile_create_samples_even_spacing(CurveProfile *profile, for (int i = 1; i < n_segments; i++) { /* Travel over all of the points that fit inside this segment. */ while (distance_to_next_table_point < segment_left) { - length_travelled += distance_to_next_table_point; segment_left -= distance_to_next_table_point; i_table++; distance_to_next_table_point = curveprofile_distance_to_next_table_point(profile, i_table); @@ -1057,7 +1055,6 @@ void BKE_curveprofile_create_samples_even_spacing(CurveProfile *profile, /* We sampled in between this table point and the next, so the next travel step is smaller. */ distance_to_next_table_point -= segment_left; distance_to_previous_table_point += segment_left; -length_travelled += segment_left; segment_left = segment_length; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dd20d226a00] greasepencil-object: GPencil: Add new Dilate factor for Fill Brush
Commit: dd20d226a0051e020ec79f99849773ef4e5eea09 Author: Antonio Vazquez Date: Thu Apr 29 20:04:30 2021 +0200 Branches: greasepencil-object https://developer.blender.org/rBdd20d226a0051e020ec79f99849773ef4e5eea09 GPencil: Add new Dilate factor for Fill Brush Before, the dilate of the fill area was predefined as 1 pixel. Now this value can be changed to fill gaps. === M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/blenkernel/intern/brush.c M source/blender/blenloader/intern/versioning_300.c M source/blender/editors/gpencil/gpencil_fill.c M source/blender/makesdna/DNA_brush_types.h M source/blender/makesrna/intern/rna_brush.c === diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index ab012a6f2ef..7da70fb90cb 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1467,6 +1467,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_advanced(View3DPanel, Panel): row.prop(gp_settings, "extend_stroke_factor") row.prop(gp_settings, "show_fill_extend", text="", icon='GRID') +col.separator() +col.prop(gp_settings, "dilate_pixels") + col.separator() col.prop(gp_settings, "fill_simplify_level", text="Simplify") if gp_settings.fill_draw_mode != 'STROKE': diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index ef567044282..20c5af0efb6 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -989,6 +989,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->draw_smoothfac = 0.1f; brush->gpencil_settings->draw_smoothlvl = 1; brush->gpencil_settings->draw_subdivide = 1; + brush->gpencil_settings->dilate_pixels = 1; brush->gpencil_settings->flag |= GP_BRUSH_FILL_SHOW_EXTENDLINES; diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 6b13b21f057..b2bb70278e1 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -23,6 +23,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "DNA_brush_types.h" #include "DNA_genfile.h" #include "DNA_modifier_types.h" @@ -76,5 +77,13 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } +/* Grease Pencil: Set default value for dilate pixels. */ +if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "int", "dilate_pixels")) { + LISTBASE_FOREACH (Brush *, brush, >brushes) { +if (brush->gpencil_settings) { + brush->gpencil_settings->dilate_pixels = 1; +} + } +} } } diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index aaa8a63dd37..039831ba151 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1241,6 +1241,7 @@ static bool dilate_shape(ImBuf *ibuf) static void gpencil_get_outline_points(tGPDfill *tgpf, const bool dilate) { ImBuf *ibuf; + Brush *brush = tgpf->brush; float rgba[4]; void *lock; int v[2]; @@ -1273,8 +1274,9 @@ static void gpencil_get_outline_points(tGPDfill *tgpf, const bool dilate) /* Dilate. */ if (dilate) { -dilate_shape(ibuf); -dilate_shape(ibuf); +for (int i = 0; i < brush->gpencil_settings->dilate_pixels; i++) { + dilate_shape(ibuf); +} } for (int idx = imagesize - 1; idx != 0; idx--) { diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index a11e7d77c67..986c009ac26 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -133,7 +133,8 @@ typedef struct BrushGpencilSettings { /** Factor to extend stroke extremes using fill tool. */ float fill_extend_fac; - char _pad3[4]; + /** Number of pixels to dilate fill area. */ + int dilate_pixels; struct CurveMapping *curve_sensitivity; struct CurveMapping *curve_strength; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index e7daa55af6c..044e6ca2da1 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1617,6 +1617,15 @@ static void rna_def_gpencil_options(BlenderRNA *brna) prop, "Stroke Extension", "Strokes end extension for closing gaps, use zero to disable"); RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + /*
[Bf-blender-cvs] [f70a8c15811] temp_bmesh_multires: Merge branch 'master' into temp_bmesh_multires
Commit: f70a8c158118b422d4937d3e028b049d5efe9148 Author: Joseph Eagar Date: Thu Apr 29 10:17:22 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rBf70a8c158118b422d4937d3e028b049d5efe9148 Merge branch 'master' into temp_bmesh_multires Also fixed a pose brush bug that may or may not have been the result of the merge nixing code, need to check master. === === diff --cc release/datafiles/locale index aafea2abb18,f7b706dd643..2c9eee69e65 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit aafea2abb18bb42e7d31a6926b2caba90f4e0316 -Subproject commit f7b706dd6434db2d752f47c4b8c3148b2990fd73 ++Subproject commit 2c9eee69e654a8b654ea08e356391c192dcc56df diff --cc release/scripts/addons index c8752443311,4cb833e84ac..eb3952fcd26 --- a/release/scripts/addons +++ b/release/scripts/addons @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit c8752443311b133f8783a6b9b2152eb7c92d06a7 -Subproject commit 4cb833e84acfd2be5fa08ce75118ce9cb60643b8 ++Subproject commit eb3952fcd26e9897bcc0128eab925b070c0e7593 diff --cc source/blender/blenlib/BLI_compiler_attrs.h index f976b32fcf6,4b5a7d671f2..df54d061db7 --- a/source/blender/blenlib/BLI_compiler_attrs.h +++ b/source/blender/blenlib/BLI_compiler_attrs.h @@@ -99,13 -99,9 +99,20 @@@ # define ATTR_ALIGN(x) __attribute__((aligned(x))) #endif +/* Disable optimization for a function (for debugging use only)*/ +#ifdef __clang__ +#define ATTR_NO_OPT __attribute__((optnone)) +#elif __MSC_VER +# define ATTR_NO_OPT __pragma(optimize("", off)) +#elif __GNUC__ +#define ATTR_NO_OPT _Pragma(optimize, "O0") +#else +#define ATTR_NO_OPT +#endif ++ + /* Alignment directive */ + #ifdef _WIN64 + # define ALIGN_STRUCT __declspec(align(64)) + #else + # define ALIGN_STRUCT + #endif diff --cc source/blender/editors/sculpt_paint/paint_stroke.c index d1604e01610,49ddf2f82d8..ff4bbfe021f --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@@ -1137,11 -1233,19 +1166,21 @@@ static void paint_line_strokes_spacing( length += *length_residue; *length_residue = 0.0; +stroke->spacing = spacing; + if (length >= spacing) { - mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing_final; - mouse[1] = stroke->last_mouse_position[1] + dmouse[1] * spacing_final; + if (use_scene_spacing) { + float final_world_space_position[3]; + normalize_v3(d_world_space_position); + mul_v3_v3fl(final_world_space_position, d_world_space_position, spacing_final); + add_v3_v3v3( + final_world_space_position, world_space_position_old, final_world_space_position); + ED_view3d_project(region, final_world_space_position, mouse); + } + else { + mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing_final; + mouse[1] = stroke->last_mouse_position[1] + dmouse[1] * spacing_final; + } ups->overlap_factor = paint_stroke_integrate_overlap(stroke->brush, 1.0); diff --cc source/blender/editors/sculpt_paint/sculpt_pose.c index d2551326391,587ce346428..07f0f763ff9 --- a/source/blender/editors/sculpt_paint/sculpt_pose.c +++ b/source/blender/editors/sculpt_paint/sculpt_pose.c @@@ -197,8 -197,9 +197,9 @@@ static void do_pose_brush_task_cb_ex(vo mul_v3_fl(disp, segments[ik].weights[vd.index]); /* Apply the vertex mask to the displacement. */ - float mask = vd.mask ? *vd.mask : 0.0f; - mul_v3_fl(disp, 1.0f - mask); + const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f; - const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.index); ++ const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.vertex); + mul_v3_fl(disp, mask * automask); /* Accumulate the displacement. */ add_v3_v3(total_disp, disp); @@@ -807,6 -797,6 +808,13 @@@ static SculptPoseIKChain *pose_ik_chain SCULPT_floodfill_execute(ss, , pose_face_sets_floodfill_cb, ); SCULPT_floodfill_free(); ++if (!fdata.next_face_set_found) { ++ for (int i = s; i < ik_chain->tot_segments; i++) { ++zero_v3(ik_chain->segments[i].orig); ++ } ++ break; ++} ++ if (fdata.tot_co > 0) { mul_v3_fl(fdata.pose_origin, 1.0f / (float)fdata.tot_co); copy_v3_v3(ik_chain->segments[s].orig, fdata.pose_origin); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [39226cd437c] blender-v2.93-release: Fix T87317: Cycles XML parsing broken after bugfix for initialization order
Commit: 39226cd437c4d68134369740bdab945c4b4d4364 Author: Brecht Van Lommel Date: Thu Apr 29 19:07:08 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rB39226cd437c4d68134369740bdab945c4b4d4364 Fix T87317: Cycles XML parsing broken after bugfix for initialization order === M intern/cycles/graph/node_type.h === diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h index 2a741d9b06f..8b37398fa17 100644 --- a/intern/cycles/graph/node_type.h +++ b/intern/cycles/graph/node_type.h @@ -148,16 +148,17 @@ struct NodeType { #define NODE_DECLARE \ static const NodeType *get_node_type(); \ template static const NodeType *register_type(); \ - static Node *create(const NodeType *type); + static Node *create(const NodeType *type); \ + static const NodeType *node_type; #define NODE_DEFINE(structname) \ + const NodeType *structname::node_type = structname::register_type(); \ Node *structname::create(const NodeType *) \ { \ return new structname(); \ } \ const NodeType *structname::get_node_type() \ { \ -static const NodeType *node_type = register_type(); \ return node_type; \ } \ template const NodeType *structname::register_type() @@ -169,6 +170,8 @@ struct NodeType { #define NODE_ABSTRACT_DEFINE(structname) \ const NodeType *structname::get_node_base_type() \ { \ +/* Base types constructed in this getter to ensure correct initialization \ + * order. Regular types are not so they are auto-registered for XML parsing. */ \ static const NodeType *node_base_type = register_base_type(); \ return node_base_type; \ } \ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f0eda573926] blender-v2.93-release: Fix error in Python UI script
Commit: f0eda573926fa3adc463db84433644f4be759a0c Author: Brecht Van Lommel Date: Thu Apr 29 17:48:14 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBf0eda573926fa3adc463db84433644f4be759a0c Fix error in Python UI script === M intern/cycles/blender/addon/ui.py === diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 0b7f548c792..9aea7725810 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -552,8 +552,9 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel): if world: light = world.light_settings - sub.prop(light, "ao_factor", text="AO Factor") - layout.prop(light, "distance", text="AO Distance") + col = layout.column(align=True) + col.prop(light, "ao_factor", text="AO Factor") + col.prop(light, "distance", text="AO Distance") class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel): ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b4f0d524733] blender-v2.93-release: Fix: crash when creating GPU texture from image fails
Commit: b4f0d52473382d5f2339d75a391be0871dd86747 Author: Brecht Van Lommel Date: Thu Apr 29 18:28:25 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBb4f0d52473382d5f2339d75a391be0871dd86747 Fix: crash when creating GPU texture from image fails === M source/blender/blenkernel/intern/image_gpu.c === diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c index 8847b88d6f2..bb7495437bb 100644 --- a/source/blender/blenkernel/intern/image_gpu.c +++ b/source/blender/blenkernel/intern/image_gpu.c @@ -408,17 +408,19 @@ static GPUTexture *image_get_gpu_texture(Image *ima, store_premultiplied, limit_gl_texture_size); -GPU_texture_wrap_mode(*tex, true, false); +if (*tex) { + GPU_texture_wrap_mode(*tex, true, false); -if (GPU_mipmap_enabled()) { - GPU_texture_generate_mipmap(*tex); - if (ima) { -ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE; + if (GPU_mipmap_enabled()) { +GPU_texture_generate_mipmap(*tex); +if (ima) { + ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE; +} +GPU_texture_mipmap_mode(*tex, true, true); + } + else { +GPU_texture_mipmap_mode(*tex, false, true); } - GPU_texture_mipmap_mode(*tex, true, true); -} -else { - GPU_texture_mipmap_mode(*tex, false, true); } } @@ -427,7 +429,9 @@ static GPUTexture *image_get_gpu_texture(Image *ima, BKE_image_release_ibuf(ima, ibuf_intern, NULL); } - GPU_texture_orig_size_set(*tex, ibuf_intern->x, ibuf_intern->y); + if (*tex) { +GPU_texture_orig_size_set(*tex, ibuf_intern->x, ibuf_intern->y); + } return *tex; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b0a6a388237] asset-browser-poselib: Asset: Keep assets active after renaming, make sure they are scrolled into view
Commit: b0a6a38823729a1010db4408d1e60ad6f97ba377 Author: Julian Eisel Date: Thu Apr 29 18:19:45 2021 +0200 Branches: asset-browser-poselib https://developer.blender.org/rBb0a6a38823729a1010db4408d1e60ad6f97ba377 Asset: Keep assets active after renaming, make sure they are scrolled into view I want to clean this up a bit still, but it seems to work now. Also includes (to be split off): * Don't allow renaming assets from the file list for now (e.g. right-click > Rename). This doesn't work yet and I'm not sure it should even. If an asset is a local data-block it can be renamed in the sidebar. * Fix broken logic to scroll a preview into view. * Partially includes D9994. These changes were needed for this to work. Differential Revision: https://developer.blender.org/D9 === M source/blender/blenkernel/intern/screen.c M source/blender/editors/space_file/file_draw.c M source/blender/editors/space_file/file_intern.h M source/blender/editors/space_file/file_ops.c M source/blender/editors/space_file/filelist.c M source/blender/editors/space_file/filelist.h M source/blender/editors/space_file/filesel.c M source/blender/editors/space_file/space_file.c M source/blender/makesdna/DNA_space_types.h === diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index d0d63192ebf..9b9d961c268 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -1723,6 +1723,14 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) sfile->runtime = NULL; BLO_read_data_address(reader, >params); BLO_read_data_address(reader, >asset_params); + /* XXX No access to filelist_uuid_unset() here. Should be used once direct-linking happens + * via a space-type callback. */ + if (sfile->params) { +sfile->params->renamefile_uuid[0] = FILE_UUID_UNSET; + } + if (sfile->asset_params) { +sfile->asset_params->base_params.renamefile_uuid[0] = FILE_UUID_UNSET; + } } else if (sl->spacetype == SPACE_CLIP) { SpaceClip *sclip = (SpaceClip *)sl; diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index c1dcf2e56d3..cd7f44cc147 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -506,6 +506,9 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) ARegion *region = CTX_wm_region(C); FileSelectParams *params = ED_fileselect_get_active_params(sfile); + /* Renaming asset files is not supported from the file list. */ + BLI_assert(!ED_fileselect_is_asset_browser(sfile)); + BLI_join_dirfile(orgname, sizeof(orgname), params->dir, oldname); BLI_strncpy(filename, params->renamefile, sizeof(filename)); BLI_filename_make_safe(filename); @@ -521,13 +524,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) else { /* If rename is successful, scroll to newly renamed entry. */ BLI_strncpy(params->renamefile, filename, sizeof(params->renamefile)); -params->rename_flag = FILE_PARAMS_RENAME_POSTSCROLL_PENDING; - -if (sfile->smoothscroll_timer != NULL) { - WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer); -} -sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0); -sfile->scroll_offset = 0; +file_params_invoke_rename_postscroll(wm, CTX_wm_window(C), sfile); } /* to make sure we show what is on disk */ @@ -957,6 +954,8 @@ void file_draw_list(const bContext *C, ARegion *region) textwidth : layout->attribute_columns[COLUMN_NAME].width - ATTRIBUTE_COLUMN_PADDING; + /* Assets don't support renaming via the file list. */ + BLI_assert((file->typeflag & FILE_TYPE_ASSET) == 0); uiBut *but = uiDefBut(block, UI_BTYPE_TEXT, diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 309b280177c..1350b3d2982 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -111,6 +111,9 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche int autocomplete_directory(struct bContext *C, char *str, void *arg_v); int autocomplete_file(struct bContext *C, char *str, void *arg_v); +void file_params_invoke_rename_postscroll(struct wmWindowManager *wm, + struct wmWindow *win, + struct
[Bf-blender-cvs] [d8118c2e89b] asset-browser-poselib: Assets: Keep assets active after renaming, ensure they are scrolled into view
Commit: d8118c2e89b382be88c405287088c9ed9f9716fa Author: Julian Eisel Date: Thu Apr 29 18:28:27 2021 +0200 Branches: asset-browser-poselib https://developer.blender.org/rBd8118c2e89b382be88c405287088c9ed9f9716fa Assets: Keep assets active after renaming, ensure they are scrolled into view See https://developer.blender.org/D9, just committing this to the branch for testing already. === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [41820e8a8e7] master: GPencil: Add "Convert Text to Gpencil"
Commit: 41820e8a8e7065ad770ad031b3663b3ddcd2a11c Author: Antonio Vazquez Date: Thu Apr 29 17:45:46 2021 +0200 Branches: master https://developer.blender.org/rB41820e8a8e7065ad770ad031b3663b3ddcd2a11c GPencil: Add "Convert Text to Gpencil" Currently when you try to convert a Text-object to Grease pencil from the Object-menu or via the operator in some other way, the Text-object is only converted to a Curve. This commit converts that curve to a Grease pencil object. Differential Revision: https://developer.blender.org/D7 === M source/blender/editors/object/object_add.c === diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 3751e62dbe0..840fd97cc48 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2628,6 +2628,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) int a, mballConverted = 0; bool gpencilConverted = false; + bool gpencilCurveConverted = false; /* don't forget multiple users! */ @@ -2912,6 +2913,16 @@ static int object_convert_exec(bContext *C, wmOperator *op) /* meshes doesn't use displist */ BKE_object_free_curve_cache(newob); } + else if (target == OB_GPENCIL) { +ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0; +Object *ob_gpencil = ED_gpencil_add_object(C, newob->loc, local_view_bits); +copy_v3_v3(ob_gpencil->rot, newob->rot); +copy_v3_v3(ob_gpencil->scale, newob->scale); +BKE_gpencil_convert_curve(bmain, scene, ob_gpencil, newob, false, 1.0f, 0.0f); +gpencilConverted = true; +gpencilCurveConverted = true; +basen = NULL; + } } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { ob->flag |= OB_DONE; @@ -3093,6 +3104,17 @@ static int object_convert_exec(bContext *C, wmOperator *op) FOREACH_SCENE_OBJECT_END; } } + else { +/* Remove Text curves converted to Grease Pencil object to avoid duplicated curves. */ +if (gpencilCurveConverted) { + FOREACH_SCENE_OBJECT_BEGIN (scene, ob_delete) { +if (ELEM(ob_delete->type, OB_CURVE) && (ob_delete->flag & OB_DONE)) { + ED_object_base_free_and_unlink(bmain, scene, ob_delete); +} + } + FOREACH_SCENE_OBJECT_END; +} + } // XXX ED_object_editmode_enter(C, 0); // XXX exit_editmode(C, EM_FREEDATA|); /* freedata, but no undo */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c9d1143b334] master: Cleanup: Reduce indentation by returning early
Commit: c9d1143b334527d5b9dfb886f8fdba986bd1ec53 Author: Hans Goudey Date: Thu Apr 29 10:46:55 2021 -0500 Branches: master https://developer.blender.org/rBc9d1143b334527d5b9dfb886f8fdba986bd1ec53 Cleanup: Reduce indentation by returning early === M source/blender/modifiers/intern/MOD_nodes.cc === diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 1ee9043d46c..6f674798a59 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1084,36 +1084,37 @@ static void draw_property_for_socket(uiLayout *layout, /* IDProperties can be removed with python, so there could be a situation where * there isn't a property for a socket or it doesn't have the correct type. */ - if (property != nullptr && property_type->is_correct_type(*property)) { + if (property == nullptr || !property_type->is_correct_type(*property)) { +return; + } -char socket_id_esc[sizeof(socket.identifier) * 2]; -BLI_str_escape(socket_id_esc, socket.identifier, sizeof(socket_id_esc)); + char socket_id_esc[sizeof(socket.identifier) * 2]; + BLI_str_escape(socket_id_esc, socket.identifier, sizeof(socket_id_esc)); -char rna_path[sizeof(socket_id_esc) + 4]; -BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc); + char rna_path[sizeof(socket_id_esc) + 4]; + BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc); -/* Use #uiItemPointerR to draw pointer properties because #uiItemR would not have enough - * information about what type of ID to select for editing the values. This is because - * pointer IDProperties contain no information about their type. */ -switch (socket.type) { - case SOCK_OBJECT: { -uiItemPointerR( -layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA); -break; - } - case SOCK_COLLECTION: { -uiItemPointerR(layout, - md_ptr, - rna_path, - bmain_ptr, - "collections", - socket.name, - ICON_OUTLINER_COLLECTION); -break; - } - default: -uiItemR(layout, md_ptr, rna_path, 0, socket.name, ICON_NONE); + /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not have enough + * information about what type of ID to select for editing the values. This is because + * pointer IDProperties contain no information about their type. */ + switch (socket.type) { +case SOCK_OBJECT: { + uiItemPointerR( + layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA); + break; +} +case SOCK_COLLECTION: { + uiItemPointerR(layout, + md_ptr, + rna_path, + bmain_ptr, + "collections", + socket.name, + ICON_OUTLINER_COLLECTION); + break; } +default: + uiItemR(layout, md_ptr, rna_path, 0, socket.name, ICON_NONE); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [48b8b17da0e] master: Merge branch 'blender-v2.93-release'
Commit: 48b8b17da0e623bfee0ac450adcf890a44d45a44 Author: Campbell Barton Date: Fri Apr 30 01:43:04 2021 +1000 Branches: master https://developer.blender.org/rB48b8b17da0e623bfee0ac450adcf890a44d45a44 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9f1a409f3ac] blender-v2.93-release: Fix T86335: Knife tool fails on object with zero scaled axis
Commit: 9f1a409f3acdef770e30bfd04545feb8413f6f2b Author: Campbell Barton Date: Fri Apr 30 01:37:10 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rB9f1a409f3acdef770e30bfd04545feb8413f6f2b Fix T86335: Knife tool fails on object with zero scaled axis Use invert_m4_m4_safe_ortho for the knife tool to support operating on objects with a single zero scaled axis. === M source/blender/editors/mesh/editmesh_knife.c === diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 37e0ef661b6..b5cd9c7f60d 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -205,6 +205,12 @@ typedef struct KnifeTool_OpData { BLI_mempool *refs; + /** + * Use this instead of #Object.imat since it's calculated using #invert_m4_m4_safe_ortho + * to support objects with zero scale on a single axis. + */ + float ob_imat[4][4]; + float projmat[4][4]; float projmat_inv[4][4]; /* vector along view z axis (object space, normalized) */ @@ -287,7 +293,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) copy_v3_v3(co_depth, kcd->prev.cage); mul_m4_v3(kcd->ob->obmat, co_depth); ED_view3d_win_to_3d(kcd->vc.v3d, kcd->region, co_depth, kcd->curr.mval, curr_cage_adjust); - mul_m4_v3(kcd->ob->imat, curr_cage_adjust); + mul_m4_v3(kcd->ob_imat, curr_cage_adjust); sub_v3_v3v3(ray_dir, curr_cage_adjust, kcd->prev.cage); } @@ -576,10 +582,8 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, ED_view3d_unproject(kcd->vc.region, mval[0], mval[1], ofs, r_origin_ofs); /* transform into object space */ - invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); - - mul_m4_v3(kcd->ob->imat, r_origin); - mul_m4_v3(kcd->ob->imat, r_origin_ofs); + mul_m4_v3(kcd->ob_imat, r_origin); + mul_m4_v3(kcd->ob_imat, r_origin_ofs); } static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f) @@ -625,11 +629,11 @@ static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f) static void knife_recalc_projmat(KnifeTool_OpData *kcd) { - invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); ED_view3d_ob_project_mat_get(kcd->region->regiondata, kcd->ob, kcd->projmat); invert_m4_m4(kcd->projmat_inv, kcd->projmat); - mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob->imat, kcd->vc.rv3d->viewinv[2]); + invert_m4_m4_safe_ortho(kcd->ob_imat, kcd->ob->obmat); + mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob_imat, kcd->vc.rv3d->viewinv[2]); normalize_v3(kcd->proj_zaxis); kcd->is_ortho = ED_view3d_clip_range_get( @@ -941,8 +945,7 @@ static void knife_start_cut(KnifeTool_OpData *kcd) float ofs_local[3]; negate_v3_v3(ofs_local, kcd->vc.rv3d->ofs); -invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); -mul_m4_v3(kcd->ob->imat, ofs_local); +mul_m4_v3(kcd->ob_imat, ofs_local); knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs); @@ -1744,7 +1747,7 @@ static bool point_is_visible(KnifeTool_OpData *kcd, /* TODO: I think there's a simpler way to get the required raycast ray */ ED_view3d_unproject(kcd->vc.region, s[0], s[1], 0.0f, view); -mul_m4_v3(kcd->ob->imat, view); +mul_m4_v3(kcd->ob_imat, view); /* make p_ofs a little towards view, so ray doesn't hit p's face. */ sub_v3_v3(view, p); @@ -1875,10 +1878,10 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->region, kcd->vc.v3d, s1, v1, v3, true); ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->region, kcd->vc.v3d, s2, v2, v4, true); - mul_m4_v3(kcd->ob->imat, v1); - mul_m4_v3(kcd->ob->imat, v2); - mul_m4_v3(kcd->ob->imat, v3); - mul_m4_v3(kcd->ob->imat, v4); + mul_m4_v3(kcd->ob_imat, v1); + mul_m4_v3(kcd->ob_imat, v2); + mul_m4_v3(kcd->ob_imat, v3); + mul_m4_v3(kcd->ob_imat, v4); /* Numeric error, 'v1' -> 'v2', 'v2' -> 'v4' * can end up being ~2000 units apart with an orthogonal perspective. @@ -2644,6 +2647,8 @@ static void knifetool_init(bContext *C, kcd->ob = obedit; kcd->region = CTX_wm_region(C); + invert_m4_m4_safe_ortho(kcd->ob_imat, kcd->ob->obmat); + em_setup_viewcontext(C, >vc); kcd->em = BKE_editmesh_from_object(kcd->ob); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9291128bff9] master: Clean-up: Edit and comments
Commit: 9291128bff9aafcf7ddc5765e9c89c9655e21c4b Author: Pratik Borhade Date: Thu Apr 29 11:50:28 2021 -0300 Branches: master https://developer.blender.org/rB9291128bff9aafcf7ddc5765e9c89c9655e21c4b Clean-up: Edit and comments - Corrected spellings - Comments added and edited Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D10991 === M source/blender/bmesh/intern/bmesh_polygon_edgenet.c === diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c index dcf9717465c..0754564fa47 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c @@ -106,7 +106,7 @@ static void normalize_v2_m3_v3v3(float out[2], /** * \note Be sure to update #bm_face_split_edgenet_find_loop_pair_exists - * when making changed to edge picking logic. + * when making changes to edge picking logic. */ static bool bm_face_split_edgenet_find_loop_pair(BMVert *v_init, const float face_normal[3], @@ -456,8 +456,8 @@ static bool bm_face_split_edgenet_find_loop(BMVert *v_init, * Splits a face into many smaller faces defined by an edge-net. * handle customdata and degenerate cases. * - * - isolated holes or unsupported face configurations, will be ignored. - * - customdata calculations aren't efficient + * - Isolated holes or unsupported face configurations, will be ignored. + * - Customdata calculations aren't efficient * (need to calculate weights for each vert). */ bool BM_face_split_edgenet(BMesh *bm, @@ -593,7 +593,7 @@ bool BM_face_split_edgenet(BMesh *bm, BMIter iter; BMLoop *l_other; -/* see: #BM_loop_interp_from_face for similar logic */ +/* See: #BM_loop_interp_from_face for similar logic. */ void **blocks = BLI_array_alloca(blocks, f->len); float(*cos_2d)[2] = BLI_array_alloca(cos_2d, f->len); float *w = BLI_array_alloca(w, f->len); @@ -1064,7 +1064,7 @@ static int bm_face_split_edgenet_find_connection(const struct EdgeGroup_FindConn #ifdef USE_PARTIAL_CONNECT /** - * Used to identify edges that get split off when making island from partial connection. + * Used to identify edges that get split off when making island from partial connection. * fptr should be a BMFace*, but is a void* for general interface to BM_vert_separate_tested_edges */ static bool test_tagged_and_notface(BMEdge *e, void *fptr) @@ -1211,7 +1211,7 @@ static bool bm_vert_partial_connect_check_overlap(const int *remap, const int v_a_index, const int v_b_index) { - /* connected to eachother */ + /* Connected to each other. */ if (UNLIKELY((remap[v_a_index] == v_b_index) || (remap[v_b_index] == v_a_index))) { return true; } @@ -1226,7 +1226,7 @@ static bool bm_vert_partial_connect_check_overlap(const int *remap, * \param use_partial_connect: Support for handling islands connected by only a single edge, * \note that this is quite slow so avoid using where possible. * \param mem_arena: Avoids many small allocs & should be cleared after each use. - * take care since \a r_edge_net_new is stored in \a r_edge_net_new. + * take care since \a edge_net_new is stored in \a r_edge_net_new. */ bool BM_face_split_edgenet_connect_islands(BMesh *bm, BMFace *f, @@ -1246,7 +1246,7 @@ bool BM_face_split_edgenet_connect_islands(BMesh *bm, * * Keep the first part fast since it will run very often for edge-nets that have no holes. * - * \note Don't use the mem_arena unless he have holes to fill. + * \note Don't use the mem_arena unless we have holes to fill. * (avoid thrashing the area when the initial check isn't so intensive on the stack). */ @@ -1572,7 +1572,7 @@ bool BM_face_split_edgenet_connect_islands(BMesh *bm, if (g->has_prev_edge == false) { BMVert *v_origin = g->vert_span.min; - +/* Index of BMVert for the edge group connection with `v_origin`. */ const int index_other = bm_face_split_edgenet_find_connection(, v_origin, false); // BLI_assert(index_other >= 0 && index_other < (int)vert_arr_len); @@ -1598,7 +1598,7 @@ bool BM_face_split_edgenet_connect_islands(BMesh *bm, { BMVert *v_origin = g->vert_span.max; - +/* Index of BMVert for the edge group connection with `v_origin`. */ const int index_other = bm_face_split_edgenet_find_connection(, v_origin, true); // BLI_assert(index_other >= 0 && index_other < (int)vert_arr_len); @@ -1660,7 +1660,7 @@ finally: struct TempVertPair *tvp = temp_vert_pairs.list; do { /* its _very_ unlikely the edge exists, -
[Bf-blender-cvs] [8eeacca9cbc] temp_bmesh_multires: Fix a few cast warnings
Commit: 8eeacca9cbc1e82b8cd869ae43e44fec2d4492c9 Author: Joseph Eagar Date: Thu Apr 29 08:01:32 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB8eeacca9cbc1e82b8cd869ae43e44fec2d4492c9 Fix a few cast warnings === M source/blender/blenkernel/intern/mesh.c M source/blender/blenkernel/intern/pbvh_bmesh.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_boundary.c M source/blender/editors/sculpt_paint/sculpt_dyntopo.c M source/blender/gpu/intern/gpu_buffers.c M source/creator/creator.c === diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 13efde374d0..5ab7b38ed69 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1012,7 +1012,7 @@ BMesh *BKE_mesh_to_bmesh_ex(const Object *ob, const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(me); BMesh *bm = BM_mesh_create(, create_params); - BM_mesh_bm_from_me(ob, bm, me, convert_params); + BM_mesh_bm_from_me((Object*)ob, bm, me, convert_params); return bm; } diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index e63cf5f0c73..36f920fb2ba 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -1572,8 +1572,11 @@ static bool edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f) BMLoop *l = f->l_first; /* Check if triangle intersects the sphere */ - float dis = dist_to_tri_sphere_simple( - q->center, l->v->co, l->next->v->co, l->prev->v->co, f->no); + float dis = dist_to_tri_sphere_simple((float *)q->center, +(float *)l->v->co, +(float *)l->next->v->co, +(float *)l->prev->v->co, +(float *)f->no); // closest_on_tri_to_point_v3(c, co, v1, v2, v3); @@ -2291,7 +2294,7 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, void *vsrcs[2] = {e->v1->head.data, e->v2->head.data}; float vws[2] = {0.5f, 0.5f}; - CustomData_bmesh_interp(>bm->vdata, vsrcs, vws, NULL, 2, v_new->head.data); + CustomData_bmesh_interp(>bm->vdata, (const void**)vsrcs, (float*)vws, NULL, 2, v_new->head.data); if (boundary) { MDynTopoVert *mv_new = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, v_new); @@ -2387,17 +2390,19 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, void *lsrcs[2] = {l1->head.data, l2->head.data}; float lws[2] = {0.5f, 0.5f}; -CustomData_bmesh_interp(>bm->ldata, lsrcs, lws, lws, 2, f_new->l_first->next->head.data); +CustomData_bmesh_interp(>bm->ldata, (const void**)lsrcs, lws, lws, 2, f_new->l_first->next->head.data); lsrcs[0] = l1->head.data; lws[0] = 1.0f; -CustomData_bmesh_interp(>bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->head.data); +CustomData_bmesh_interp( +>bm->ldata, (const void **)lsrcs, lws, lws, 1, f_new->l_first->head.data); lsrcs[0] = l3->head.data; lws[0] = 1.0f; -CustomData_bmesh_interp(>bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->prev->head.data); +CustomData_bmesh_interp( +>bm->ldata, (const void **)lsrcs, lws, lws, 1, f_new->l_first->prev->head.data); v_tri[0] = v_new; v_tri[1] = v2; @@ -2416,18 +2421,21 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, lsrcs[1] = lfirst->next->head.data; lws[0] = lws[1] = 0.5f; -CustomData_bmesh_interp(>bm->ldata, lsrcs, lws, lws, 2, f_new->l_first->head.data); +CustomData_bmesh_interp( +>bm->ldata, (const void **)lsrcs, lws, lws, 2, f_new->l_first->head.data); lsrcs[0] = lfirst->next->head.data; ; lws[0] = 1.0f; -CustomData_bmesh_interp(>bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->next->head.data); +CustomData_bmesh_interp( +>bm->ldata, (const void **)lsrcs, lws, lws, 1, f_new->l_first->next->head.data); lsrcs[0] = lfirst->prev->head.data; lws[0] = 1.0f; -CustomData_bmesh_interp(>bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->prev->head.data); +CustomData_bmesh_interp( +>bm->ldata, (const void **)lsrcs, lws, lws, 1, f_new->l_first->prev->head.data); /* Delete original */ pbvh_bmesh_face_remove(pbvh, f_adj); @@ -2659,7 +2667,8 @@ static void pbvh_bmesh_collapse_edge(PBVH *pbvh, // snap customdata if (totl > 0) { -CustomData_bmesh_interp(>bm->ldata, blocks, ws, NULL, totl, ls[0]->head.data); +CustomData_bmesh_interp( +>bm->ldata, (const void **)blocks, ws, NULL, totl, ls[0]->head.data); //* BM_LOOPS_OF_VERT_ITER_BEGIN (l, v_del) { BMLoop *l2 = l->v != v_del ? l->next :
[Bf-blender-cvs] [bcf524328ff] master: Fix T87297: Gpencil - Disable Frames and Start delay when use Factor
Commit: bcf524328ff28acc02d57b70a8e55b10b8460fe5 Author: Antonio Vazquez Date: Thu Apr 29 17:01:12 2021 +0200 Branches: master https://developer.blender.org/rBbcf524328ff28acc02d57b70a8e55b10b8460fe5 Fix T87297: Gpencil - Disable Frames and Start delay when use Factor After talking with the GP team, we agree in disable these options when the factor is used in Build modifier. === M source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c index d7fc08e38f3..d9f0fc9bddd 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c @@ -455,8 +455,10 @@ static void generate_geometry( /* Compute start and end frames for the animation effect * By default, the upper bound is given by the "maximum length" setting */ - float start_frame = gpf->framenum + mmd->start_delay; - float end_frame = start_frame + mmd->length; + float start_frame = is_percentage ? gpf->framenum : gpf->framenum + mmd->start_delay; + /* When use percentage don't need a limit in the upper bound, so use a maximum value for the last + * frame. */ + float end_frame = is_percentage ? start_frame + : start_frame + mmd->length; if (gpf->next) { /* Use the next frame or upper bound as end frame, whichever is lower/closer */ @@ -547,6 +549,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, _ptr); int mode = RNA_enum_get(ptr, "mode"); + const bool use_percentage = RNA_boolean_get(ptr, "use_percentage"); uiLayoutSetPropSep(layout, true); @@ -558,8 +561,12 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemS(layout); uiItemR(layout, ptr, "transition", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "start_delay", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "length", 0, IFACE_("Frames"), ICON_NONE); + row = uiLayoutRow(layout, true); + uiLayoutSetActive(row, !use_percentage); + uiItemR(row, ptr, "start_delay", 0, NULL, ICON_NONE); + row = uiLayoutRow(layout, true); + uiLayoutSetActive(row, !use_percentage); + uiItemR(row, ptr, "length", 0, IFACE_("Frames"), ICON_NONE); uiItemS(layout); @@ -567,7 +574,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetPropDecorate(row, false); uiItemR(row, ptr, "use_percentage", 0, "", ICON_NONE); sub = uiLayoutRow(row, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_percentage")); + uiLayoutSetActive(sub, use_percentage); uiItemR(sub, ptr, "percentage_factor", 0, "", ICON_NONE); uiItemDecoratorR(row, ptr, "percentage_factor", 0); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3e3363a6edd] master: Merge branch 'blender-v2.93-release'
Commit: 3e3363a6edd719038592567ee9b9e3a7db658458 Author: Campbell Barton Date: Fri Apr 30 00:59:52 2021 +1000 Branches: master https://developer.blender.org/rB3e3363a6edd719038592567ee9b9e3a7db658458 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [315582f28ce] blender-v2.93-release: Fix T86799: Boolean crashes duplicating object with "Fast" solver
Commit: 315582f28cefbf158b308f0dea17dab949eb6eff Author: Campbell Barton Date: Fri Apr 30 00:51:14 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rB315582f28cefbf158b308f0dea17dab949eb6eff Fix T86799: Boolean crashes duplicating object with "Fast" solver BMesh intersect could leave invalid items in the selection list, causing a crash. The list is now cleared since boolean is such a destructive operation, it's unlikely the selection order would be useful. Thanks to @lukastoenne for finding the root cause. === M source/blender/bmesh/tools/bmesh_intersect.c === diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index c176210426b..710d7f79637 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -1660,5 +1660,9 @@ bool BM_mesh_intersect(BMesh *bm, BLI_memarena_free(s.mem_arena); + /* It's unlikely the selection history is useful at this point, + * if this is not called this array would need to be validated, see: T86799. */ + BM_select_history_clear(bm); + return (has_edit_isect || has_edit_boolean); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [97923d9b989] master: GPencil: glow fx, add threshold value color mode
Commit: 97923d9b9892b422cfd4c5a795258a34e44c09e8 Author: Falk David Date: Thu Apr 29 16:49:57 2021 +0200 Branches: master https://developer.blender.org/rB97923d9b9892b422cfd4c5a795258a34e44c09e8 GPencil: glow fx, add threshold value color mode This patch adds a threshold value to the glow effect in color mode. Currently, the threshold is hardcoded to 5%. You can select a color and specify a higher threshold to include similar colors in the effect. Note: depends on D10670 Reviewed By: #grease_pencil, pepeland Differential Revision: https://developer.blender.org/D10672 === M source/blender/draw/engines/gpencil/gpencil_shader_fx.c M source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl M source/blender/shader_fx/intern/FX_shader_glow.c === diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c index 0b66141e51a..ab90831f4ac 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c +++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c @@ -424,22 +424,26 @@ static void gpencil_vfx_glow(GlowShaderFxData *fx, Object *UNUSED(ob), gpIterVfx GPUShader *sh = GPENCIL_shader_fx_glow_get(); - float ref_col[3]; + float ref_col[4]; if (fx->mode == eShaderFxGlowMode_Luminance) { +/* Only pass in the first value for luminace. */ ref_col[0] = fx->threshold; ref_col[1] = -1.0f; ref_col[2] = -1.0f; +ref_col[3] = -1.0f; } else { +/* First three values are the RGB for the selected color, last value the threshold. */ copy_v3_v3(ref_col, fx->select_color); +ref_col[3] = fx->threshold; } DRWState state = DRW_STATE_WRITE_COLOR; grp = gpencil_vfx_pass_create("Fx Glow H", state, iter, sh); DRW_shgroup_uniform_vec2_copy(grp, "offset", (float[2]){fx->blur[0] * c, fx->blur[0] * s}); DRW_shgroup_uniform_int_copy(grp, "sampCount", max_ii(1, min_ii(fx->samples, fx->blur[0]))); - DRW_shgroup_uniform_vec3_copy(grp, "threshold", ref_col); + DRW_shgroup_uniform_vec4_copy(grp, "threshold", ref_col); DRW_shgroup_uniform_vec4_copy(grp, "glowColor", fx->glow_color); DRW_shgroup_uniform_bool_copy(grp, "glowUnder", use_glow_under); DRW_shgroup_uniform_bool_copy(grp, "firstPass", true); @@ -473,7 +477,7 @@ static void gpencil_vfx_glow(GlowShaderFxData *fx, Object *UNUSED(ob), gpIterVfx grp = gpencil_vfx_pass_create("Fx Glow V", state, iter, sh); DRW_shgroup_uniform_vec2_copy(grp, "offset", (float[2]){-fx->blur[1] * s, fx->blur[1] * c}); DRW_shgroup_uniform_int_copy(grp, "sampCount", max_ii(1, min_ii(fx->samples, fx->blur[0]))); - DRW_shgroup_uniform_vec3_copy(grp, "threshold", (float[3]){-1.0f, -1.0f, -1.0f}); + DRW_shgroup_uniform_vec4_copy(grp, "threshold", (float[4]){-1.0f, -1.0f, -1.0f, -1.0}); DRW_shgroup_uniform_vec4_copy(grp, "glowColor", (float[4]){1.0f, 1.0f, 1.0f, fx->glow_color[3]}); DRW_shgroup_uniform_bool_copy(grp, "firstPass", false); DRW_shgroup_uniform_int_copy(grp, "blendMode", fx->blend_mode); diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl index bb905f8694b..269ed49c4d0 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl @@ -145,7 +145,7 @@ void main() uniform vec4 glowColor; uniform vec2 offset; uniform int sampCount; -uniform vec3 threshold; +uniform vec4 threshold; uniform bool firstPass; uniform bool glowUnder; uniform int blendMode; @@ -168,7 +168,7 @@ void main() vec3 rev = texture(revealBuf, uv).rgb; if (threshold.x > -1.0) { if (threshold.y > -1.0) { -if (any(greaterThan(abs(col - threshold), vec3(0.05 { +if (any(greaterThan(abs(col - vec3(threshold)), vec3(threshold.w { weight = 0.0; } } diff --git a/source/blender/shader_fx/intern/FX_shader_glow.c b/source/blender/shader_fx/intern/FX_shader_glow.c index 30eaa35a049..fc75771cd62 100644 --- a/source/blender/shader_fx/intern/FX_shader_glow.c +++ b/source/blender/shader_fx/intern/FX_shader_glow.c @@ -71,12 +71,11 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - if (mode == eShaderFxGlowMode_Luminance) { -uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NONE); - } - else { + uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NONE); + if (mode == eShaderFxGlowMode_Color) { uiItemR(layout, ptr, "select_color", 0, NULL, ICON_NONE); } + uiItemR(layout, ptr, "glow_color", 0, NULL, ICON_NONE); uiItemS(layout); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org
[Bf-blender-cvs] [7134b9dacad] master: Added Operator tests: unsubdivide, shading, vertex connect and mark seam
Commit: 7134b9dacadb933f884ffdbb1e5f433839dc47f2 Author: Himanshi Kalra Date: Thu Apr 29 19:59:11 2021 +0530 Branches: master https://developer.blender.org/rB7134b9dacadb933f884ffdbb1e5f433839dc47f2 Added Operator tests: unsubdivide, shading, vertex connect and mark seam Added tests for: * Mark Seam * Shade flat * Shade smooth * Unsubdivide * Vertex Connect Path * select nth (Checkered Deselect) Notes: 1) Shade flat, shade smooth are base test cases (to check mesh doesn't change for real) Updated blend file: tests/modeling/operators.blend Reviewed By: zazizizou, mont29 Differential Revision: https://developer.blender.org/D10893 === M tests/python/operators.py === diff --git a/tests/python/operators.py b/tests/python/operators.py index 309a872ac67..4c863edfbdb 100644 --- a/tests/python/operators.py +++ b/tests/python/operators.py @@ -196,6 +196,14 @@ def main(): MeshTest("SphereFillHoles", "testSphereFillHoles", "expectedSphereFillHoles", [OperatorSpecEditMode("fill_holes", {"sides": 9}, "VERT", {i for i in range(481)})]), +# face shade smooth (not a real test) +MeshTest("CubeShadeSmooth", "testCubeShadeSmooth", "expectedCubeShadeSmooth", + [OperatorSpecEditMode("faces_shade_smooth", {}, "VERT", {i for i in range(8)})]), + +# faces shade flat (not a real test) +MeshTest("CubeShadeFlat", "testCubeShadeFlat", "expectedCubeShadeFlat", + [OperatorSpecEditMode("faces_shade_flat", {}, "FACE", {i for i in range(6)})]), + # inset faces MeshTest("CubeInset", "testCubeInset", "expectedCubeInset", [OperatorSpecEditMode("inset", {"thickness": 0.2}, "VERT", @@ -226,6 +234,10 @@ def main(): MeshTest("EmptyMeshLoopMultiSelect", "testEmptyMeshLoopMultiSelect", "expectedEmptyMeshLoopMultiSelect", [OperatorSpecEditMode("loop_multi_select", {}, "VERT", {})]), +# mark seam +MeshTest("CubeMarkSeam", "testCubeMarkSeam", "expectedCubeMarkSeam", + [OperatorSpecEditMode("mark_seam", {}, "EDGE", {1})]), + # select all MeshTest("CircleSelectAll", "testCircleSelectAll", "expectedCircleSelectAll", [OperatorSpecEditMode("select_all", {}, "VERT", {1})]), @@ -296,6 +308,26 @@ def main(): MeshTest("EmptyMeshSelectLinked", "testEmptyMeshSelectLinked", "expectedEmptyMeshSelectLinked", [OperatorSpecEditMode("select_linked", {}, "VERT", {})]), +# select nth (checkered deselect) +MeshTest("CircleSelect2nd", "testCircleSelect2nd", "expectedCircleSelect2nd", + [OperatorSpecEditMode("select_nth", {}, "VERT", {i for i in range(32)})]), + +# unsubdivide +# normal case +MeshTest("CubeFaceUnsubdivide", "testCubeUnsubdivide", "expectedCubeUnsubdivide", + [OperatorSpecEditMode("unsubdivide", {}, "FACE", {i for i in range(6)})]), + +# T87259 - test cases +MeshTest("CubeEdgeUnsubdivide", "testCubeEdgeUnsubdivide", "expectedCubeEdgeUnsubdivide", + [OperatorSpecEditMode("unsubdivide", {}, "EDGE", {i for i in range(6)})]), +MeshTest("UVSphereUnsubdivide", "testUVSphereUnsubdivide", "expectedUVSphereUnsubdivide", +[OperatorSpecEditMode("unsubdivide", {'iterations': 9}, "FACE", {i for i in range(512)})]), + +# vert connect path +# Tip: It works only if there is an already existing face or more than 2 vertices. +MeshTest("CubeVertConnectPath", "testCubeVertConnectPath", "expectedCubeVertConnectPath", + [OperatorSpecEditMode("vert_connect_path", {}, "VERT", {0, 5})]), + ] operators_test = RunTest(tests) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ee52ae3fd2f] greasepencil-object: GPencil: Dilate more the filling area
Commit: ee52ae3fd2fbf3b0ffb4aa6a10e6c25c36b1cd4d Author: Antonio Vazquez Date: Thu Apr 29 16:26:43 2021 +0200 Branches: greasepencil-object https://developer.blender.org/rBee52ae3fd2fbf3b0ffb4aa6a10e6c25c36b1cd4d GPencil: Dilate more the filling area This is a text for small pixel gaps in complex areas === M source/blender/editors/gpencil/gpencil_fill.c === diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 3f86e5474c5..aaa8a63dd37 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1274,6 +1274,7 @@ static void gpencil_get_outline_points(tGPDfill *tgpf, const bool dilate) /* Dilate. */ if (dilate) { dilate_shape(ibuf); +dilate_shape(ibuf); } for (int idx = imagesize - 1; idx != 0; idx--) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [738a890025e] master: Merge branch 'blender-v2.93-release'
Commit: 738a890025eccc1b98fdc11386a9f203acda71c4 Author: Campbell Barton Date: Fri Apr 30 00:25:35 2021 +1000 Branches: master https://developer.blender.org/rB738a890025eccc1b98fdc11386a9f203acda71c4 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5946352ae2c] blender-v2.93-release: Fix T87779: Asymmetric position vertices in circles primitives.
Commit: 5946352ae2cd3ef14d8af07f8d4bd047954b9fd1 Author: Campbell Barton Date: Fri Apr 30 00:22:02 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rB5946352ae2cd3ef14d8af07f8d4bd047954b9fd1 Fix T87779: Asymmetric position vertices in circles primitives. Incrementing a floating point value in a loop resulted in the vertex locations for circles in primitives being slightly asymmetric. === M source/blender/bmesh/operators/bmo_primitive.c === diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index a0a31ab6154..f47c8dfb405 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -867,19 +867,19 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) BMIter iter; const float axis[3] = {0, 0, 1}; float vec[3], mat[4][4], cmat[3][3]; - float phi, phid; int a; BMO_slot_mat4_get(op->slots_in, "matrix", mat); - phid = 2.0f * (float)M_PI / tot; + const float phid = (float)M_PI / tot; /* phi = 0.25f * (float)M_PI; */ /* UNUSED */ /* one segment first */ - phi = 0; - phid /= 2; for (a = 0; a <= tot; a++) { /* Going in this direction, then edge extruding, makes normals face outward */ +/* Calculate with doubles for higher precision, see: T87779. */ +const float phi = M_PI * ((double)a / (double)tot); + vec[0] = 0.0; vec[1] = dia * sinf(phi); vec[2] = dia * cosf(phi); @@ -891,7 +891,6 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) BMO_edge_flag_enable(bm, e, EDGE_ORIG); } -phi += phid; preveve = eve; } @@ -1272,7 +1271,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs"); BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL; - float vec[3], mat[4][4], phi, phid; + float vec[3], mat[4][4]; int a; if (!segs) { @@ -1281,9 +1280,6 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMO_slot_mat4_get(op->slots_in, "matrix", mat); - phid = 2.0f * (float)M_PI / segs; - phi = 0; - if (cap_ends) { zero_v3(vec); mul_m4_v3(mat, vec); @@ -1292,8 +1288,11 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMO_vert_flag_enable(bm, cent1, VERT_MARK); } - for (a = 0; a < segs; a++, phi += phid) { + for (a = 0; a < segs; a++) { /* Going this way ends up with normal(s) upward */ + +/* Calculate with doubles for higher precision, see: T87779. */ +const float phi = (2.0 * M_PI) * ((double)a / (double)segs); vec[0] = -radius * sinf(phi); vec[1] = radius * cosf(phi); vec[2] = 0.0f; @@ -1392,7 +1391,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) { BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2; BMFace *f; - float vec[3], mat[4][4], phi, phid; + float vec[3], mat[4][4]; const float dia1 = BMO_slot_float_get(op->slots_in, "diameter1"); const float dia2 = BMO_slot_float_get(op->slots_in, "diameter2"); const float depth_half = 0.5f * BMO_slot_float_get(op->slots_in, "depth"); @@ -1409,9 +1408,6 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) BMO_slot_mat4_get(op->slots_in, "matrix", mat); - phid = 2.0f * (float)M_PI / segs; - phi = 0; - if (cap_ends) { vec[0] = vec[1] = 0.0f; vec[2] = -depth_half; @@ -1432,7 +1428,10 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) const int side_faces_len = segs - 1; BMFace **side_faces = MEM_mallocN(sizeof(*side_faces) * side_faces_len, __func__); - for (int i = 0; i < segs; i++, phi += phid) { + for (int i = 0; i < segs; i++) { +/* Calculate with doubles for higher precision, see: T87779. */ +const float phi = (2.0 * M_PI) * ((double)i / (double)segs); + vec[0] = dia1 * sinf(phi); vec[1] = dia1 * cosf(phi); vec[2] = -depth_half; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dcf2c6e2250] blender-v2.93-release: Fix build error after recent changes to CPU name detection
Commit: dcf2c6e225083b3e6145f8dc2b3116ef37d5827f Author: Brecht Van Lommel Date: Thu Apr 29 16:21:30 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBdcf2c6e225083b3e6145f8dc2b3116ef37d5827f Fix build error after recent changes to CPU name detection === M intern/cycles/util/util_system.cpp === diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 8971867b736..03bc5aea1dd 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -145,7 +145,8 @@ int system_cpu_num_active_group_processors() return numaAPI_GetNumCurrentNodesProcessors(); } -#if !defined(__APPLE__) && (!defined(_WIN32) || defined(FREE_WINDOWS)) +/* Equivalent of Windows __cpuid for x86 processors on other platforms. */ +#if (!defined(_WIN32) || defined(FREE_WINDOWS)) && (defined(__x86_64__) || defined(__i386__)) static void __cpuid(int data[4], int selector) { # if defined(__x86_64__) @@ -167,12 +168,33 @@ static void __cpuid(int data[4], int selector) string system_cpu_brand_string() { #if defined(__APPLE__) + /* Get from system on macOS. */ char modelname[512] = ""; size_t bufferlen = 512; if (sysctlbyname("machdep.cpu.brand_string", , , NULL, 0) == 0) { return modelname; } -#elif !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) +#elif defined(WIN32) || defined(__x86_64__) || defined(__i386__) + /* Get from intrinsics on Windows and x86. */ + char buf[49] = {0}; + int result[4] = {0}; + + __cpuid(result, 0x8000); + + if (result[0] != 0 && result[0] >= (int)0x8004) { +__cpuid((int *)(buf + 0), 0x8002); +__cpuid((int *)(buf + 16), 0x8003); +__cpuid((int *)(buf + 32), 0x8004); + +string brand = buf; + +/* Make it a bit more presentable. */ +brand = string_remove_trademark(brand); + +return brand; + } +#else + /* Get from /proc/cpuinfo on Unix systems. */ FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo != nullptr) { char cpuinfo_buf[513] = ""; @@ -192,24 +214,6 @@ string system_cpu_brand_string() } } } -#else - char buf[49] = {0}; - int result[4] = {0}; - - __cpuid(result, 0x8000); - - if (result[0] != 0 && result[0] >= (int)0x8004) { -__cpuid((int *)(buf + 0), 0x8002); -__cpuid((int *)(buf + 16), 0x8003); -__cpuid((int *)(buf + 32), 0x8004); - -string brand = buf; - -/* make it a bit more presentable */ -brand = string_remove_trademark(brand); - -return brand; - } #endif return "Unknown CPU"; } @@ -219,7 +223,7 @@ int system_cpu_bits() return (sizeof(void *) * 8); } -#if defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(_M_IX86) +#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) struct CPUCapabilities { bool x64; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fee66055184] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: fee660551847701e092b0fa13442e378df1ccb11 Author: Antonio Vazquez Date: Thu Apr 29 16:17:47 2021 +0200 Branches: greasepencil-object https://developer.blender.org/rBfee660551847701e092b0fa13442e378df1ccb11 Merge branch 'master' into greasepencil-object === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2f6eca4af35] temp-lineart-contained: LineArt: Fix memory leaking issue in threaded loading.
Commit: 2f6eca4af35fec898dc258f79c3b14a0dcd37a08 Author: YimingWu Date: Thu Apr 29 22:17:14 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rB2f6eca4af35fec898dc258f79c3b14a0dcd37a08 LineArt: Fix memory leaking issue in threaded loading. === M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c M source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h M source/blender/gpencil_modifiers/intern/lineart/lineart_util.c === diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index 696623f9ef9..e5e01f3a813 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -346,7 +346,7 @@ typedef struct LineartCache { #define DBL_TRIANGLE_LIM 1e-8 #define DBL_EDGE_LIM 1e-9 -#define LRT_MEMORY_POOL_64MB (1 << 26) +#define LRT_MEMORY_POOL_1MB (1 << 20) typedef enum eLineartTriangleFlags { LRT_CULL_DONT_CARE = 0, diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 73a79093d20..31a6ba8b416 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -1622,7 +1622,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu orig_ob = obi->original_ob; BLI_spin_lock(>lock_task); - reln = lineart_list_append_pointer_pool_sized( + reln = lineart_list_append_pointer_pool_sized_thread( >vertex_buffer_pointers, >render_data_pool, orv, sizeof(LineartElementLinkNode)); BLI_spin_unlock(>lock_task); @@ -1644,9 +1644,10 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu } BLI_spin_lock(>lock_task); - reln = lineart_list_append_pointer_pool_sized( + reln = lineart_list_append_pointer_pool_sized_thread( >triangle_buffer_pointers, >render_data_pool, ort, sizeof(LineartElementLinkNode)); BLI_spin_unlock(>lock_task); + reln->element_count = bm->totface; reln->object_ref = orig_ob; reln->flags |= (usage == OBJECT_LRT_NO_INTERSECTION ? LRT_ELEMENT_NO_INTERSECTION : 0); @@ -1654,7 +1655,10 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu /* Note this memory is not from pool, will be deleted after culling. */ orta = MEM_callocN(sizeof(LineartTriangleAdjacent) * bm->totface, "LineartTriangleAdjacent"); /* Link is minimal so we use pool anyway. */ - lineart_list_append_pointer_pool(>triangle_adjacent_pointers, >render_data_pool, orta); + BLI_spin_lock(>lock_task); + lineart_list_append_pointer_pool_thread( + >triangle_adjacent_pointers, >render_data_pool, orta); + BLI_spin_unlock(>lock_task); for (i = 0; i < bm->totvert; i++) { v = BM_vert_at_index(bm, i); @@ -1725,7 +1729,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu o_la_s = lineart_mem_aquire_thread(>render_data_pool, sizeof(LineartLineSegment) * allocate_la_e); BLI_spin_lock(>lock_task); - reln = lineart_list_append_pointer_pool_sized( + reln = lineart_list_append_pointer_pool_sized_thread( >line_buffer_pointers, >render_data_pool, o_la_e, sizeof(LineartElementLinkNode)); BLI_spin_unlock(>lock_task); reln->element_count = allocate_la_e; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h index 2c3130b46c9..9562d52a336 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h @@ -43,6 +43,13 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h, struct LineartStaticMemPool *smp, void *data, int size); +void *lineart_list_append_pointer_pool_thread(ListBase *h, + struct LineartStaticMemPool *smp, + void *data); +void *lineart_list_append_pointer_pool_sized_thread(ListBase *h, +LineartStaticMemPool *smp, +void *data, +int size); void *list_push_pointer_static(ListBase *h, struct LineartStaticMemPool *smp, void *p); void *list_push_pointer_static_sized(ListBase *h, struct LineartStaticMemPool
[Bf-blender-cvs] [ff51da43feb] temp-lineart-contained: LineArt: Cache/Non-cache toggle for modifier stack.
Commit: ff51da43feb697fe81d7d12b5b47882f79d17801 Author: YimingWu Date: Thu Apr 29 21:18:41 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rBff51da43feb697fe81d7d12b5b47882f79d17801 LineArt: Cache/Non-cache toggle for modifier stack. === M source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index b2b74398536..f2109a2ea18 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -58,6 +58,7 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" +#include "MOD_gpencil_lineart.h" #include "MOD_gpencil_modifiertypes.h" #include "MOD_gpencil_ui_common.h" @@ -156,18 +157,32 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec return; } + LineartCache *local_lc = gpd->runtime.lineart_cache; if (!gpd->runtime.lineart_cache) { MOD_lineart_compute_feature_lines( depsgraph, lmd, >runtime.lineart_cache, (!(ob->dtx & OB_DRAW_IN_FRONT))); MOD_lineart_destroy_render_data(lmd); } else { -MOD_lineart_chain_clear_picked_flag(gpd->runtime.lineart_cache); -lmd->cache = gpd->runtime.lineart_cache; +if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) { + MOD_lineart_compute_feature_lines( + depsgraph, lmd, _lc, (!(ob->dtx & OB_DRAW_IN_FRONT))); + MOD_lineart_destroy_render_data(lmd); +} +MOD_lineart_chain_clear_picked_flag(local_lc); +lmd->cache = local_lc; } generate_strokes_actual(md, depsgraph, ob, gpl, gpf); + if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) { +/* Clear local cache. */ +MOD_lineart_clear_cache(_lc); +/* Restore the original cache pointer so the modifiers below still have access to the "global" + * cache. */ +lmd->cache = gpd->runtime.lineart_cache; + } + WM_main_add_notifier(NA_EDITED | NC_GPENCIL, NULL); } @@ -482,7 +497,7 @@ static void baking_panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemO(col, NULL, ICON_NONE, "OBJECT_OT_lineart_clear_all"); } -static void composition_panel_draw(const bContext *C, Panel *panel) +static void composition_panel_draw(const bContext *UNUSED(C), Panel *panel) { PointerRNA ob_ptr; PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, _ptr); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [88065c20dc8] temp-lineart-contained: LineArt: UI grey out for cache mode.
Commit: 88065c20dc89aa99747d7097eb84570f8bec79eb Author: YimingWu Date: Thu Apr 29 21:04:55 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rB88065c20dc89aa99747d7097eb84570f8bec79eb LineArt: UI grey out for cache mode. === M release/datafiles/locale M release/scripts/addons M release/scripts/addons_contrib M source/blender/blenkernel/BKE_gpencil_modifier.h M source/blender/blenkernel/intern/gpencil_modifier.c M source/blender/blenloader/intern/versioning_300.c M source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c M source/blender/makesdna/DNA_gpencil_modifier_types.h M source/blender/makesrna/intern/rna_gpencil_modifier.c M source/tools === diff --git a/release/datafiles/locale b/release/datafiles/locale index ef74c1b861a..f7b706dd643 16 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit ef74c1b861a1b05c2483a2c045a6380704167491 +Subproject commit f7b706dd6434db2d752f47c4b8c3148b2990fd73 diff --git a/release/scripts/addons b/release/scripts/addons index 6dfba915743..4cb833e84ac 16 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 6dfba915743b67aff99ddcc19c0807d339a87c96 +Subproject commit 4cb833e84acfd2be5fa08ce75118ce9cb60643b8 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index ef6ef414d22..8970953d4a8 16 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit ef6ef414d22c2578fad99327743b925ab640a99c +Subproject commit 8970953d4a8a4ea3bf77c66370c817ed0cf1308a diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h index 25fd3b18234..b49a6fa244c 100644 --- a/source/blender/blenkernel/BKE_gpencil_modifier.h +++ b/source/blender/blenkernel/BKE_gpencil_modifier.h @@ -305,6 +305,7 @@ void BKE_gpencil_get_lineart_global_limits(struct Object *ob, void BKE_gpencil_assign_lineart_global_limits(struct GpencilModifierData *md, struct GpencilLineartLimitInfo *info); +bool BKE_gpencil_lineart_is_first_run(struct Object *ob, struct GpencilModifierData *md); void BKE_gpencil_lattice_init(struct Object *ob); void BKE_gpencil_lattice_clear(struct Object *ob); diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 723e41557a5..1ebb2eba540 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -225,6 +225,24 @@ void BKE_gpencil_assign_lineart_global_limits(GpencilModifierData *md, lmd->edge_types_override = info->edge_types; } +bool BKE_gpencil_lineart_is_first_run(Object *ob, GpencilModifierData *md) +{ + if (md->type != eGpencilModifierType_Lineart) { +return false; + } + LISTBASE_FOREACH (GpencilModifierData *, gmd, >greasepencil_modifiers) { +if (gmd->type == eGpencilModifierType_Lineart) { + if (gmd == md) { +return true; + } + else { +return false; + } +} + } + return false; /* Unlikely. */ +} + /* apply time modifiers */ static int gpencil_time_modifier( Depsgraph *depsgraph, Scene *scene, Object *ob, bGPDlayer *gpl, int cfra, bool is_render) diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 6b13b21f057..35ff57ad781 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -24,6 +24,7 @@ #include "BLI_utildefines.h" #include "DNA_genfile.h" +#include "DNA_gpencil_modifier_types.h" #include "DNA_modifier_types.h" #include "BKE_main.h" @@ -76,5 +77,18 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } +if (!DNA_struct_elem_find( +fd->filesdna, "LineartGpencilModifierData", "bool", "use_cached_result")) { + LISTBASE_FOREACH (Object *, ob, >objects) { +if (ob->type == OB_GPENCIL) { + LISTBASE_FOREACH (GpencilModifierData *, md, >greasepencil_modifiers) { +if (md->type == eGpencilModifierType_Lineart) { + LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md; + lmd->flags |= LRT_GPENCIL_USE_CACHE; +} + } +} + } +} } } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index 58ff8625fd3..b2b74398536 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -257,6 +257,10 @@ static void panel_draw(const bContext
[Bf-blender-cvs] [d184490f0e3] temp-lineart-contained: Lineart: Cache toggle for baking operators.
Commit: d184490f0e31e0271bf2105d106abefb489f023c Author: YimingWu Date: Thu Apr 29 21:26:46 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rBd184490f0e31e0271bf2105d106abefb489f023c Lineart: Cache toggle for baking operators. === M source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c === diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c index 1548a3138a6..eeec79f030c 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c @@ -112,13 +112,18 @@ static bool bake_strokes( /* No greasepencil frame created or found. */ return false; } + LineartCache *local_lc = *lc; if (!(*lc)) { MOD_lineart_compute_feature_lines(dg, lmd, lc, (!(ob->dtx & OB_DRAW_IN_FRONT))); MOD_lineart_destroy_render_data(lmd); } else { -MOD_lineart_chain_clear_picked_flag(gpd->runtime.lineart_cache); -lmd->cache = gpd->runtime.lineart_cache; +if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) { + MOD_lineart_compute_feature_lines(dg, lmd, _lc, (!(ob->dtx & OB_DRAW_IN_FRONT))); + MOD_lineart_destroy_render_data(lmd); +} +MOD_lineart_chain_clear_picked_flag(local_lc); +lmd->cache = local_lc; } MOD_lineart_gpencil_generate( @@ -142,6 +147,14 @@ static bool bake_strokes( lmd->vgname, lmd->flags); + if (!(lmd->flags & LRT_GPENCIL_USE_CACHE)) { +/* Clear local cache. */ +MOD_lineart_clear_cache(_lc); +/* Restore the original cache pointer so the modifiers below still have access to the "global" + * cache. */ +lmd->cache = gpd->runtime.lineart_cache; + } + return true; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [781684d0cf1] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained
Commit: 781684d0cf125006e69296c92f146a6c0427db95 Author: YimingWu Date: Thu Apr 29 19:37:29 2021 +0800 Branches: temp-lineart-contained https://developer.blender.org/rB781684d0cf125006e69296c92f146a6c0427db95 Merge remote-tracking branch 'origin/master' into temp-lineart-contained === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ae69c457c62] temp-gpencil-bezier-stroke-type: Merge branch 'master' into temp-gpencil-bezier-stroke-type
Commit: ae69c457c62ab4b72c253363878e6e1ebfb54d7b Author: Antonio Vazquez Date: Thu Apr 29 16:05:24 2021 +0200 Branches: temp-gpencil-bezier-stroke-type https://developer.blender.org/rBae69c457c62ab4b72c253363878e6e1ebfb54d7b Merge branch 'master' into temp-gpencil-bezier-stroke-type === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9bdb2f5e0b2] master: Cleanup: Use BLI_findindex instead of loop
Commit: 9bdb2f5e0b2cbdcdb06af5d672cd8c22742346b2 Author: Antonio Vazquez Date: Thu Apr 29 16:04:17 2021 +0200 Branches: master https://developer.blender.org/rB9bdb2f5e0b2cbdcdb06af5d672cd8c22742346b2 Cleanup: Use BLI_findindex instead of loop === M source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c index a9d4d5091ec..cd29a006aae 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c @@ -108,13 +108,7 @@ static void deformStroke(GpencilModifierData *md, float rand_offset = BLI_hash_int_01(seed); /* Get stroke index for random offset. */ - int rnd_index = 0; - LISTBASE_FOREACH (bGPDstroke *, o_gps, >strokes) { -if (o_gps == gps) { - break; -} -rnd_index += 1; - } + int rnd_index = BLI_findindex(>strokes, gps); for (int j = 0; j < 3; j++) { const uint primes[3] = {2, 3, 7}; double offset[3] = {0.0f, 0.0f, 0.0f}; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [347e1f3acf2] temp-gpencil-bezier-stroke-type: Merge branch 'master' into temp-gpencil-bezier-stroke-type
Commit: 347e1f3acf2564327aeb53ffede8c7031780f856 Author: Antonio Vazquez Date: Thu Apr 29 15:53:26 2021 +0200 Branches: temp-gpencil-bezier-stroke-type https://developer.blender.org/rB347e1f3acf2564327aeb53ffede8c7031780f856 Merge branch 'master' into temp-gpencil-bezier-stroke-type Conflicts: source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c === === diff --cc source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c index 62eb00beb0e,a9d4d5091ec..38587d46f96 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c @@@ -125,8 -156,18 +175,19 @@@ static void deformPolyline(GpencilModif if (weight < 0.0f) { continue; } + /* Apply randomness matrix. */ + mul_m4_v3(mat_rnd, >x); + + /* Calculate matrix. */ + mul_v3_v3fl(loc, mmd->loc, weight); + mul_v3_v3fl(rot, mmd->rot, weight); + mul_v3_v3fl(scale, mmd->scale, weight); + add_v3_fl(scale, 1.0); + loc_eul_size_to_mat4(mat, loc, rot, scale); + + /* Apply scale to thickness. */ -float unit_scale = (scale[0] + scale[1] + scale[2]) / 3.0f; +float mat[4][4]; +float unit_scale = prepare_matrix(mmd, weight, mat); pt->pressure *= unit_scale; mul_m4_v3(mat, >x); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [734c8f9a771] master: Merge branch 'blender-v2.93-release'
Commit: 734c8f9a7717cf1b94a53045f19d1af22031db35 Author: Brecht Van Lommel Date: Thu Apr 29 16:00:05 2021 +0200 Branches: master https://developer.blender.org/rB734c8f9a7717cf1b94a53045f19d1af22031db35 Merge branch 'blender-v2.93-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5f277216fac] temp-gpencil-bezier-stroke-type: GPencil: Fix merge issues
Commit: 5f277216fac4cf6e57ec7f1fc38ae267b6dc752d Author: Antonio Vazquez Date: Thu Apr 29 16:00:19 2021 +0200 Branches: temp-gpencil-bezier-stroke-type https://developer.blender.org/rB5f277216fac4cf6e57ec7f1fc38ae267b6dc752d GPencil: Fix merge issues === M source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c index 38587d46f96..da6873547c9 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c @@ -108,7 +108,7 @@ static void deformPolyline(GpencilModifierData *md, Depsgraph *UNUSED(depsgraph), Object *ob, bGPDlayer *gpl, - bGPDframe *UNUSED(gpf), + bGPDframe *gpf, bGPDstroke *gps) { OffsetGpencilModifierData *mmd = (OffsetGpencilModifierData *)md; @@ -164,7 +164,6 @@ static void deformPolyline(GpencilModifierData *md, loc_eul_size_to_mat4(mat_rnd, rnd_loc, rnd_rot, rnd_scale); bGPdata *gpd = ob->data; - for (int i = 0; i < gps->totpoints; i++) { bGPDspoint *pt = >points[i]; MDeformVert *dvert = gps->dvert != NULL ? >dvert[i] : NULL; @@ -179,13 +178,6 @@ static void deformPolyline(GpencilModifierData *md, mul_m4_v3(mat_rnd, >x); /* Calculate matrix. */ -mul_v3_v3fl(loc, mmd->loc, weight); -mul_v3_v3fl(rot, mmd->rot, weight); -mul_v3_v3fl(scale, mmd->scale, weight); -add_v3_fl(scale, 1.0); -loc_eul_size_to_mat4(mat, loc, rot, scale); - -/* Apply scale to thickness. */ float mat[4][4]; float unit_scale = prepare_matrix(mmd, weight, mat); pt->pressure *= unit_scale; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [87ba01dba90] blender-v2.93-release: Fix missing Cycles CPU name on macOS Arm
Commit: 87ba01dba90b0b2ffbad2b9e07552734959814db Author: Christian Baars Date: Thu Apr 29 15:52:27 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rB87ba01dba90b0b2ffbad2b9e07552734959814db Fix missing Cycles CPU name on macOS Arm Differential Revision: https://developer.blender.org/D11061 === M intern/cycles/util/util_system.cpp === diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 6500a59e42c..8971867b736 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -145,7 +145,7 @@ int system_cpu_num_active_group_processors() return numaAPI_GetNumCurrentNodesProcessors(); } -#if !defined(_WIN32) || defined(FREE_WINDOWS) +#if !defined(__APPLE__) && (!defined(_WIN32) || defined(FREE_WINDOWS)) static void __cpuid(int data[4], int selector) { # if defined(__x86_64__) @@ -166,7 +166,13 @@ static void __cpuid(int data[4], int selector) string system_cpu_brand_string() { -#if !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) +#if defined(__APPLE__) + char modelname[512] = ""; + size_t bufferlen = 512; + if (sysctlbyname("machdep.cpu.brand_string", , , NULL, 0) == 0) { +return modelname; + } +#elif !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo != nullptr) { char cpuinfo_buf[513] = ""; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ffa70e76901] blender-v2.93-release: Fix missing Cycles CPU name for Arm processors
Commit: ffa70e769010a3b7e6b80be6f80b21dfb8713f13 Author: Patrick Mours Date: Thu Apr 29 15:51:29 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBffa70e769010a3b7e6b80be6f80b21dfb8713f13 Fix missing Cycles CPU name for Arm processors === M intern/cycles/util/util_system.cpp === diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 2c1716ce515..6500a59e42c 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -166,12 +166,33 @@ static void __cpuid(int data[4], int selector) string system_cpu_brand_string() { +#if !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) + FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); + if (cpuinfo != nullptr) { +char cpuinfo_buf[513] = ""; +fread(cpuinfo_buf, sizeof(cpuinfo_buf) - 1, 1, cpuinfo); +fclose(cpuinfo); + +char *modelname = strstr(cpuinfo_buf, "model name"); +if (modelname != nullptr) { + modelname = strchr(modelname, ':'); + if (modelname != nullptr) { +modelname += 2; +char *modelname_end = strchr(modelname, '\n'); +if (modelname_end != nullptr) { + *modelname_end = '\0'; + return modelname; +} + } +} + } +#else char buf[49] = {0}; int result[4] = {0}; __cpuid(result, 0x8000); - if (result[0] >= (int)0x8004) { + if (result[0] != 0 && result[0] >= (int)0x8004) { __cpuid((int *)(buf + 0), 0x8002); __cpuid((int *)(buf + 16), 0x8003); __cpuid((int *)(buf + 32), 0x8004); @@ -183,7 +204,7 @@ string system_cpu_brand_string() return brand; } - +#endif return "Unknown CPU"; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [db021ee2ea0] blender-v2.93-release: Fix macOS arm crash in scaling images with ffmpeg
Commit: db021ee2ea0355f0c1733e51e3ee7c54e6ca2a3e Author: Brecht Van Lommel Date: Thu Apr 29 14:57:23 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBdb021ee2ea0355f0c1733e51e3ee7c54e6ca2a3e Fix macOS arm crash in scaling images with ffmpeg Ref T78710 === M source/blender/imbuf/intern/anim_movie.c === diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 6c63c1a1b5b..9e8224f58b2 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -815,66 +815,70 @@ static void ffmpeg_postprocess(struct anim *anim) anim->y); } - if (ENDIAN_ORDER == B_ENDIAN) { -int *dstStride = anim->pFrameRGB->linesize; -uint8_t **dst = anim->pFrameRGB->data; -const int dstStride2[4] = {dstStride[0], 0, 0, 0}; -uint8_t *dst2[4] = {dst[0], 0, 0, 0}; -int x, y, h, w; -unsigned char *bottom; -unsigned char *top; - -sws_scale(anim->img_convert_ctx, - (const uint8_t *const *)input->data, - input->linesize, - 0, - anim->y, - dst2, - dstStride2); - -bottom = (unsigned char *)ibuf->rect; -top = bottom + ibuf->x * (ibuf->y - 1) * 4; - -h = (ibuf->y + 1) / 2; -w = ibuf->x; - -for (y = 0; y < h; y++) { - unsigned char tmp[4]; - unsigned int *tmp_l = (unsigned int *)tmp; - - for (x = 0; x < w; x++) { -tmp[0] = bottom[0]; -tmp[1] = bottom[1]; -tmp[2] = bottom[2]; -tmp[3] = bottom[3]; - -bottom[0] = top[0]; -bottom[1] = top[1]; -bottom[2] = top[2]; -bottom[3] = top[3]; - -*(unsigned int *)top = *tmp_l; - -bottom += 4; -top += 4; - } - top -= 8 * w; +# if defined(__x86_64__) || defined(_M_X64) + /* Scale and flip image over Y axis in one go, using negative strides. + * This doesn't work with arm/powerpc though and may be misusing the API. + * Limit it x86_64 where it appears to work. + * http://trac.ffmpeg.org/ticket/9060 */ + int *dstStride = anim->pFrameRGB->linesize; + uint8_t **dst = anim->pFrameRGB->data; + const int dstStride2[4] = {-dstStride[0], 0, 0, 0}; + uint8_t *dst2[4] = {dst[0] + (anim->y - 1) * dstStride[0], 0, 0, 0}; + + sws_scale(anim->img_convert_ctx, +(const uint8_t *const *)input->data, +input->linesize, +0, +anim->y, +dst2, +dstStride2); +# else + /* Scale with swscale then flip image over Y axis. */ + int *dstStride = anim->pFrameRGB->linesize; + uint8_t **dst = anim->pFrameRGB->data; + const int dstStride2[4] = {dstStride[0], 0, 0, 0}; + uint8_t *dst2[4] = {dst[0], 0, 0, 0}; + int x, y, h, w; + unsigned char *bottom; + unsigned char *top; + + sws_scale(anim->img_convert_ctx, +(const uint8_t *const *)input->data, +input->linesize, +0, +anim->y, +dst2, +dstStride2); + + bottom = (unsigned char *)ibuf->rect; + top = bottom + ibuf->x * (ibuf->y - 1) * 4; + + h = (ibuf->y + 1) / 2; + w = ibuf->x; + + for (y = 0; y < h; y++) { +unsigned char tmp[4]; +unsigned int *tmp_l = (unsigned int *)tmp; + +for (x = 0; x < w; x++) { + tmp[0] = bottom[0]; + tmp[1] = bottom[1]; + tmp[2] = bottom[2]; + tmp[3] = bottom[3]; + + bottom[0] = top[0]; + bottom[1] = top[1]; + bottom[2] = top[2]; + bottom[3] = top[3]; + + *(unsigned int *)top = *tmp_l; + + bottom += 4; + top += 4; } +top -= 8 * w; } - else { -int *dstStride = anim->pFrameRGB->linesize; -uint8_t **dst = anim->pFrameRGB->data; -const int dstStride2[4] = {-dstStride[0], 0, 0, 0}; -uint8_t *dst2[4] = {dst[0] + (anim->y - 1) * dstStride[0], 0, 0, 0}; - -sws_scale(anim->img_convert_ctx, - (const uint8_t *const *)input->data, - input->linesize, - 0, - anim->y, - dst2, - dstStride2); - } +# endif if (need_aligned_ffmpeg_buffer(anim)) { uint8_t *src = anim->pFrameRGB->data[0]; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cd05a05bca0] blender-v2.93-release: Fix T87686: Cycles persistent data not updating correctly with hair
Commit: cd05a05bca02e9fa7dfcb59f7fa8533015889ff4 Author: Brecht Van Lommel Date: Thu Apr 29 15:46:06 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBcd05a05bca02e9fa7dfcb59f7fa8533015889ff4 Fix T87686: Cycles persistent data not updating correctly with hair === M intern/cycles/render/attribute.cpp === diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index 331d30802f1..d6a638fd4cd 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -689,6 +689,9 @@ void AttributeSet::update(AttributeSet &_attributes) it++; } + + /* If all attributes were replaced, transform is no longer applied. */ + geometry->transform_applied = false; } void AttributeSet::clear_modified() ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a5fdff26b1f] blender-v2.93-release: Fix ASAN warnings with Cycles OSL
Commit: a5fdff26b1f3d9765fc28be780c281e90402fe85 Author: Brecht Van Lommel Date: Thu Apr 29 14:56:49 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rBa5fdff26b1f3d9765fc28be780c281e90402fe85 Fix ASAN warnings with Cycles OSL === M intern/cycles/render/nodes.h === diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index fb9cf0c9836..99cb0b779b8 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -1600,11 +1600,23 @@ class SetNormalNode : public ShaderNode { NODE_SOCKET_API(float3, direction) }; -class OSLNode : public ShaderNode { +class OSLNode final : public ShaderNode { public: static OSLNode *create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from = NULL); ~OSLNode(); + static void operator delete(void *ptr) + { +/* Override delete operator to silence new-delete-type-mismatch ASAN warnings + * regarding size mismatch in the destructor. This is intentional as we allocate + * extra space at the end of the node. */ +::operator delete(ptr); + } + static void operator delete(void *, void *) + { +/* Deliberately empty placement delete operator, to avoid MSVC warning C4291. */ + } + ShaderNode *clone(ShaderGraph *graph) const; char *input_default_value(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8b9b87aee8e] blender-v2.93-release: Cleanup: removed unnecessary multiplications in area light importance sampling
Commit: 8b9b87aee8e5e9a68b3c211049377d77d44126c0 Author: Matteo Falduto Date: Thu Apr 29 15:10:16 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rB8b9b87aee8e5e9a68b3c211049377d77d44126c0 Cleanup: removed unnecessary multiplications in area light importance sampling Differential Revision: https://developer.blender.org/D4 === M intern/cycles/kernel/kernel_light_common.h === diff --git a/intern/cycles/kernel/kernel_light_common.h b/intern/cycles/kernel/kernel_light_common.h index c21c517a353..4a683d36226 100644 --- a/intern/cycles/kernel/kernel_light_common.h +++ b/intern/cycles/kernel/kernel_light_common.h @@ -200,12 +200,12 @@ ccl_device bool light_spread_clamp_area_light(const float3 P, * uv coordinates. */ const float new_center_u = 0.5f * (min_u + max_u); const float new_center_v = 0.5f * (min_v + max_v); - const float new_len_u = 0.5f * (max_u - min_u); - const float new_len_v = 0.5f * (max_v - min_v); + const float new_len_u = max_u - min_u; + const float new_len_v = max_v - min_v; *lightP = *lightP + new_center_u * u + new_center_v * v; - *axisu = u * new_len_u * 2.0f; - *axisv = v * new_len_v * 2.0f; + *axisu = u * new_len_u; + *axisv = v * new_len_v; return true; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1ace224c633] blender-v2.93-release: Fix: missing AO factor from Cyclest Fast GI panel
Commit: 1ace224c633df1a00d1a73f18c579520fcc92411 Author: Brecht Van Lommel Date: Sat Apr 24 13:34:05 2021 +0200 Branches: blender-v2.93-release https://developer.blender.org/rB1ace224c633df1a00d1a73f18c579520fcc92411 Fix: missing AO factor from Cyclest Fast GI panel The AO distance was already there, but I forgot the factor also has an impact on this. === M intern/cycles/blender/addon/ui.py === diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 73bc114893a..0b7f548c792 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -552,6 +552,7 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel): if world: light = world.light_settings + sub.prop(light, "ao_factor", text="AO Factor") layout.prop(light, "distance", text="AO Distance") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7627e0980dd] master: Merge branch 'blender-v2.93-release'
Commit: 7627e0980ddc860917f0484a976956eacbcbe1ac Author: Campbell Barton Date: Thu Apr 29 23:57:42 2021 +1000 Branches: master https://developer.blender.org/rB7627e0980ddc860917f0484a976956eacbcbe1ac Merge branch 'blender-v2.93-release' === === diff --cc source/blender/editors/transform/transform_convert_mesh.c index 9ef033639f6,5c05e35feb4..8d942b1094e --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@@ -816,212 -811,222 +816,226 @@@ void transform_convert_mesh_islanddata_ } } -void createTransEditVerts(TransInfo *t) -{ - FOREACH_TRANS_DATA_CONTAINER (t, tc) { -TransDataExtension *tx = NULL; -BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); -Mesh *me = tc->obedit->data; -BMesh *bm = em->bm; -BMVert *eve; -BMIter iter; -float mtx[3][3], smtx[3][3]; -int a; -const int prop_mode = (t->flag & T_PROP_EDIT) ? (t->flag & T_PROP_EDIT_ALL) : 0; +/** \} */ -struct TransIslandData island_data = {NULL}; -struct TransMirrorData mirror_data = {NULL}; -struct TransMeshDataCrazySpace crazyspace_data = {NULL}; +/* */ +/** \name Connectivity Distance for Proportional Editing + * \{ */ -/** - * Quick check if we can transform. - * - * \note ignore modes here, even in edge/face modes, - * transform data is created by selected vertices. - */ +/* Propagate distance from v1 and v2 to v0. */ +static bool bmesh_test_dist_add(BMVert *v0, +BMVert *v1, +BMVert *v2, +float *dists, +/* optionally track original index */ +int *index, +const float mtx[3][3]) +{ + if ((BM_elem_flag_test(v0, BM_ELEM_SELECT) == 0) && + (BM_elem_flag_test(v0, BM_ELEM_HIDDEN) == 0)) { +const int i0 = BM_elem_index_get(v0); +const int i1 = BM_elem_index_get(v1); -/* Support other objects using PET to adjust these, unless connected is enabled. */ -if ((!prop_mode || (prop_mode & T_PROP_CONNECTED)) && (bm->totvertsel == 0)) { - continue; +BLI_assert(dists[i1] != FLT_MAX); +if (dists[i0] <= dists[i1]) { + return false; } -int data_len = 0; -if (prop_mode) { - BM_ITER_MESH (eve, , bm, BM_VERTS_OF_MESH) { -if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { - data_len++; -} +float dist0; + +if (v2) { + /* Distance across triangle. */ + const int i2 = BM_elem_index_get(v2); + BLI_assert(dists[i2] != FLT_MAX); + if (dists[i0] <= dists[i2]) { +return false; } + + float vm0[3], vm1[3], vm2[3]; + mul_v3_m3v3(vm0, mtx, v0->co); + mul_v3_m3v3(vm1, mtx, v1->co); + mul_v3_m3v3(vm2, mtx, v2->co); + + dist0 = geodesic_distance_propagate_across_triangle(vm0, vm1, vm2, dists[i1], dists[i2]); } else { - data_len = bm->totvertsel; -} + /* Distance along edge. */ + float vec[3]; + sub_v3_v3v3(vec, v1->co, v0->co); + mul_m3_v3(mtx, vec); -if (data_len == 0) { - continue; + dist0 = dists[i1] + len_v3(vec); } -/* Snap rotation along normal needs a common axis for whole islands, - * otherwise one get random crazy results, see T59104. - * However, we do not want to use the island center for the pivot/translation reference. */ -const bool is_snap_rotate = ((t->mode == TFM_TRANSLATION) && - /* There is not guarantee that snapping - * is initialized yet at this point... */ - (usingSnappingNormal(t) || - (t->settings->snap_flag & SCE_SNAP_ROTATE) != 0) && - (t->around != V3D_AROUND_LOCAL_ORIGINS)); +if (dist0 < dists[i0]) { + dists[i0] = dist0; + if (index != NULL) { +index[i0] = index[i1]; + } + return true; +} + } -/* Even for translation this is needed because of island-orientation, see: T51651. */ -const bool is_island_center = (t->around == V3D_AROUND_LOCAL_ORIGINS) || is_snap_rotate; -if (is_island_center) { - /* In this specific case, near-by vertices will need to know - * the island of the nearest connected vertex. */ - const bool calc_single_islands = ((prop_mode & T_PROP_CONNECTED) && -(t->around == V3D_AROUND_LOCAL_ORIGINS) && -(em->selectmode & SCE_SELECT_VERTEX)); +
[Bf-blender-cvs] [cd06f3646ee] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: cd06f3646ee64e90663aa9a3a76f03ad065b4378 Author: Antonio Vazquez Date: Thu Apr 29 15:49:27 2021 +0200 Branches: greasepencil-object https://developer.blender.org/rBcd06f3646ee64e90663aa9a3a76f03ad065b4378 Merge branch 'master' into greasepencil-object === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6a2bc40e013] master: Gpencil Offset Modifier - Add randomize offset options
Commit: 6a2bc40e0131aa2689aa37a915f672f28fed8aa8 Author: Cody Winchester Date: Thu Apr 29 15:39:08 2021 +0200 Branches: master https://developer.blender.org/rB6a2bc40e0131aa2689aa37a915f672f28fed8aa8 Gpencil Offset Modifier - Add randomize offset options This patch adds the Randomize options that exist in the Array modifier to the offset modifier. Currently the patch uses ``` BLI_findindex(>strokes, gps); ``` to get the index of the current stroke for making each stroke a different seed value. This is how the noise modifier also gets the stroke seed value and it is noted there as well that this method is slow, and should be fixed in the future with another method of getting the stroke index. Other methods were explored such as using the total number of points of the stroke, but that makes the randomize options incompatible with other modifiers before it such as Multiple Strokes, Array, Build, and Simplify. {F9591325} Differential Revision: https://developer.blender.org/D10171 === M source/blender/blenkernel/intern/gpencil_geom.c M source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c M source/blender/makesdna/DNA_gpencil_modifier_types.h M source/blender/makesrna/intern/rna_gpencil_modifier.c === diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index 04403e264a4..612bfe65f34 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -1688,6 +1688,7 @@ void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3]) float vec1[3]; float vec2[3]; + float vec3[3]; /* initial vector (p0 -> p1) */ sub_v3_v3v3(vec1, >x, >x); @@ -1696,7 +1697,8 @@ void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3]) sub_v3_v3v3(vec2, >x, >x); /* vector orthogonal to polygon plane */ - cross_v3_v3v3(r_normal, vec1, vec2); + cross_v3_v3v3(vec3, vec1, vec2); + cross_v3_v3v3(r_normal, vec1, vec3); /* Normalize vector */ normalize_v3(r_normal); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c index bffb324f07f..56882caa2a3 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c @@ -26,7 +26,11 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "BLI_math.h" +#include "BLI_hash.h" +#include "BLI_rand.h" #include "DNA_defaults.h" #include "DNA_gpencil_modifier_types.h" @@ -71,7 +75,7 @@ static void deformStroke(GpencilModifierData *md, Depsgraph *UNUSED(depsgraph), Object *ob, bGPDlayer *gpl, - bGPDframe *UNUSED(gpf), + bGPDframe *gpf, bGPDstroke *gps) { OffsetGpencilModifierData *mmd = (OffsetGpencilModifierData *)md; @@ -94,6 +98,52 @@ static void deformStroke(GpencilModifierData *md, mmd->flag & GP_OFFSET_INVERT_MATERIAL)) { return; } + + int seed = mmd->seed; + /* Make sure different modifiers get different seeds. */ + seed += BLI_hash_string(ob->id.name + 2); + seed += BLI_hash_string(md->name); + + float rand[3][3]; + float rand_offset = BLI_hash_int_01(seed); + + /* Get stroke index for random offset. */ + int rnd_index = 0; + LISTBASE_FOREACH (bGPDstroke *, o_gps, >strokes) { +if (o_gps == gps) { + break; +} +rnd_index += 1; + } + for (int j = 0; j < 3; j++) { +const uint primes[3] = {2, 3, 7}; +double offset[3] = {0.0, 0.0, 0.0}; +double r[3]; +/* To ensure a nice distribution, we use halton sequence and offset using the seed. */ +BLI_halton_3d(primes, offset, rnd_index, r); + + if ((mmd->flag & GP_OFFSET_UNIFORM_RANDOM_SCALE) && j == 2) { + float rand_value; + rand_value = fmodf(r[0] * 2.0 - 1.0 + rand_offset, 1.0f); + rand_value = fmodf(sin(rand_value * 12.9898 + j * 78.233) * 43758.5453, 1.0f); + copy_v3_fl(rand[j], rand_value); +} +else { + for (int i = 0; i < 3; i++) { +rand[j][i] = fmodf(r[i] * 2.0 - 1.0 + rand_offset, 1.0f); +rand[j][i] = fmodf(sin(rand[j][i] * 12.9898 + j * 78.233) * 43758.5453, 1.0f); + } +} + } + /* Calculate Random matrix. */ + float mat_rnd[4][4]; + float rnd_loc[3], rnd_rot[3]; + float rnd_scale[3] = {1.0f, 1.0f, 1.0f}; + mul_v3_v3v3(rnd_loc, mmd->rnd_offset, rand[0]); + mul_v3_v3v3(rnd_rot, mmd->rnd_rot, rand[1]); + madd_v3_v3v3(rnd_scale, mmd->rnd_scale, rand[2]); + loc_eul_size_to_mat4(mat_rnd, rnd_loc, rnd_rot, rnd_scale); + bGPdata *gpd = ob->data; for (int i = 0; i < gps->totpoints; i++) {
[Bf-blender-cvs] [933de8201e8] master: Cleanup: Add float format
Commit: 933de8201e8c0ef844478e8bf000dd8d32c7bcdf Author: Antonio Vazquez Date: Thu Apr 29 15:41:27 2021 +0200 Branches: master https://developer.blender.org/rB933de8201e8c0ef844478e8bf000dd8d32c7bcdf Cleanup: Add float format === M source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c index 56882caa2a3..a9d4d5091ec 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c @@ -28,8 +28,8 @@ #include "BLT_translation.h" -#include "BLI_math.h" #include "BLI_hash.h" +#include "BLI_math.h" #include "BLI_rand.h" #include "DNA_defaults.h" @@ -117,21 +117,21 @@ static void deformStroke(GpencilModifierData *md, } for (int j = 0; j < 3; j++) { const uint primes[3] = {2, 3, 7}; -double offset[3] = {0.0, 0.0, 0.0}; +double offset[3] = {0.0f, 0.0f, 0.0f}; double r[3]; /* To ensure a nice distribution, we use halton sequence and offset using the seed. */ BLI_halton_3d(primes, offset, rnd_index, r); - if ((mmd->flag & GP_OFFSET_UNIFORM_RANDOM_SCALE) && j == 2) { +if ((mmd->flag & GP_OFFSET_UNIFORM_RANDOM_SCALE) && j == 2) { float rand_value; - rand_value = fmodf(r[0] * 2.0 - 1.0 + rand_offset, 1.0f); - rand_value = fmodf(sin(rand_value * 12.9898 + j * 78.233) * 43758.5453, 1.0f); + rand_value = fmodf(r[0] * 2.0f - 1.0f + rand_offset, 1.0f); + rand_value = fmodf(sin(rand_value * 12.9898f + j * 78.233f) * 43758.5453f, 1.0f); copy_v3_fl(rand[j], rand_value); } else { for (int i = 0; i < 3; i++) { -rand[j][i] = fmodf(r[i] * 2.0 - 1.0 + rand_offset, 1.0f); -rand[j][i] = fmodf(sin(rand[j][i] * 12.9898 + j * 78.233) * 43758.5453, 1.0f); +rand[j][i] = fmodf(r[i] * 2.0f - 1.0f + rand_offset, 1.0f); +rand[j][i] = fmodf(sin(rand[j][i] * 12.9898f + j * 78.233f) * 43758.5453f, 1.0f); } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d8cdc80263e] blender-v2.93-release: Fix T87808: Connected proportional editing includes hidden geometry
Commit: d8cdc80263e2d0ebab565346e131c3829f527f44 Author: Campbell Barton Date: Thu Apr 29 23:36:32 2021 +1000 Branches: blender-v2.93-release https://developer.blender.org/rBd8cdc80263e2d0ebab565346e131c3829f527f44 Fix T87808: Connected proportional editing includes hidden geometry Regression in 21b9231d7f5a248027c32dcc7daab3318390c20f === M source/blender/editors/transform/transform_convert_mesh.c === diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 93c36645873..5c05e35feb4 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -384,6 +384,14 @@ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, BMEdge *e; BM_ITER_MESH (e, , bm, BM_EDGES_OF_MESH) { + + /* Always clear to satisfy the assert, also predictable to leave in cleared state. */ + BM_elem_flag_disable(e, tag_queued); + + if (BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { +continue; + } + BMVert *v1 = e->v1; BMVert *v2 = e->v2; int i1 = BM_elem_index_get(v1); @@ -392,7 +400,6 @@ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, if (dists[i1] != FLT_MAX || dists[i2] != FLT_MAX) { BLI_LINKSTACK_PUSH(queue, e); } - BM_elem_flag_disable(e, tag_queued); BM_elem_flag_set(e, tag_loose, bmesh_test_loose_edge(e)); } } @@ -420,6 +427,7 @@ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, BMIter eiter; BM_ITER_ELEM (e_other, , v2, BM_EDGES_OF_VERT) { if (e_other != e && BM_elem_flag_test(e_other, tag_queued) == 0 && +!BM_elem_flag_test(e_other, BM_ELEM_HIDDEN) && (BM_elem_flag_test(e, tag_loose) || BM_elem_flag_test(e_other, tag_loose))) { BM_elem_flag_enable(e_other, tag_queued); BLI_LINKSTACK_PUSH(queue_next, e_other); @@ -433,6 +441,11 @@ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, BMLoop *l; BMIter liter; BM_ITER_ELEM (l, , e, BM_LOOPS_OF_EDGE) { + if (BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) { +continue; + } + /* Don't check hidden edges or vertices in this loop + * since any hidden edge causes the face to be hidden too. */ for (BMLoop *l_other = l->next->next; l_other != l; l_other = l_other->next) { BMVert *v_other = l_other->v; BLI_assert(!ELEM(v_other, v1, v2)); @@ -445,6 +458,7 @@ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, BMIter eiter; BM_ITER_ELEM (e_other, , v_other, BM_EDGES_OF_VERT) { if (e_other != e && BM_elem_flag_test(e_other, tag_queued) == 0 && +!BM_elem_flag_test(e_other, BM_ELEM_HIDDEN) && (BM_elem_flag_test(e_other, tag_loose) || dists[BM_elem_index_get(BM_edge_other_vert(e_other, v_other))] != FLT_MAX)) { BM_elem_flag_enable(e_other, tag_queued); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4225a18b35f] master: Function: add method to create shallow copy of virtual array
Commit: 4225a18b35f071ae1ff01c54b475ad396c77febc Author: Jacques Lucke Date: Thu Apr 29 15:42:32 2021 +0200 Branches: master https://developer.blender.org/rB4225a18b35f071ae1ff01c54b475ad396c77febc Function: add method to create shallow copy of virtual array Creating a shallow copy is sometimes useful to get a unique ptr for a virtual array when one only has a reference. It shouldn't be used usually, but sometimes its the fastest way to do correct ownership handling. === M source/blender/functions/FN_generic_virtual_array.hh M source/blender/functions/intern/generic_virtual_array.cc === diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh index 848deb6bc04..fba69f30330 100644 --- a/source/blender/functions/FN_generic_virtual_array.hh +++ b/source/blender/functions/FN_generic_virtual_array.hh @@ -34,6 +34,12 @@ namespace blender::fn { template class GVArray_Typed; template class GVMutableArray_Typed; +class GVArray; +class GVMutableArray; + +using GVArrayPtr = std::unique_ptr; +using GVMutableArrayPtr = std::unique_ptr; + /* A generically typed version of `VArray`. */ class GVArray { protected: @@ -143,6 +149,8 @@ class GVArray { return GVArray_Typed(*this); } + GVArrayPtr shallow_copy() const; + protected: virtual void get_impl(const int64_t index, void *r_value) const; virtual void get_to_uninitialized_impl(const int64_t index, void *r_value) const = 0; @@ -215,9 +223,6 @@ class GVMutableArray : public GVArray { virtual void *try_get_internal_mutable_varray_impl(); }; -using GVArrayPtr = std::unique_ptr; -using GVMutableArrayPtr = std::unique_ptr; - class GVArray_For_GSpan : public GVArray { protected: const void *data_ = nullptr; diff --git a/source/blender/functions/intern/generic_virtual_array.cc b/source/blender/functions/intern/generic_virtual_array.cc index 754a2156a65..ca2bd0f806f 100644 --- a/source/blender/functions/intern/generic_virtual_array.cc +++ b/source/blender/functions/intern/generic_virtual_array.cc @@ -18,6 +18,37 @@ namespace blender::fn { +/* + * GVArray_For_ShallowCopy. + */ + +class GVArray_For_ShallowCopy : public GVArray { + private: + const GVArray _; + + public: + GVArray_For_ShallowCopy(const GVArray ) + : GVArray(varray.type(), varray.size()), varray_(varray) + { + } + + private: + void get_impl(const int64_t index, void *r_value) const override + { +varray_.get(index, r_value); + } + + void get_to_uninitialized_impl(const int64_t index, void *r_value) const override + { +varray_.get_to_uninitialized(index, r_value); + } + + void materialize_to_uninitialized_impl(const IndexMask mask, void *dst) const override + { +varray_.materialize_to_uninitialized(mask, dst); + } +}; + /* * GVArray. */ @@ -73,6 +104,26 @@ const void *GVArray::try_get_internal_varray_impl() const return nullptr; } +/** + * Creates a new `std::unique_ptr` based on this `GVArray`. + * The lifetime of the returned virtual array must not be longer than the lifetime of this virtual + * array. + */ +GVArrayPtr GVArray::shallow_copy() const +{ + if (this->is_span()) { +return std::make_unique(this->get_internal_span()); + } + if (this->is_single()) { +BUFFER_FOR_CPP_TYPE_VALUE(*type_, buffer); +this->get_internal_single(buffer); +std::unique_ptr new_varray = std::make_unique(*type_, size_, buffer); +type_->destruct(buffer); +return new_varray; + } + return std::make_unique(*this); +} + /* * GVMutableArray. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [82847af9f94] temp_bmesh_multires: Fix invalid parameter type in bmlog.
Commit: 82847af9f94cd7a8bee624e5b8254b52e34ba236 Author: Joseph Eagar Date: Thu Apr 29 06:28:37 2021 -0700 Branches: temp_bmesh_multires https://developer.blender.org/rB82847af9f94cd7a8bee624e5b8254b52e34ba236 Fix invalid parameter type in bmlog. === M source/blender/bmesh/intern/bmesh_log.c === diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index ab0af9f905d..6ce62008d3a 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -161,66 +161,66 @@ typedef struct { #define logkey_hash BLI_ghashutil_inthash_p_simple #define logkey_cmp BLI_ghashutil_intcmp -static void *log_ghash_lookup(BMLog *entry, GHash *gh, const void *key) +static void *log_ghash_lookup(BMLog *log, GHash *gh, const void *key) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_READ); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_READ); void *ret = BLI_ghash_lookup(gh, key); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); return ret; } // this is not 100% threadsafe -static void **log_ghash_lookup_p(BMLog *entry, GHash *gh, const void *key) +static void **log_ghash_lookup_p(BMLog *log, GHash *gh, const void *key) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_READ); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_READ); void **ret = BLI_ghash_lookup_p(gh, key); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); return ret; } -static void log_ghash_insert(BMLog *entry, GHash *gh, void *key, void *val) +static void log_ghash_insert(BMLog *log, GHash *gh, void *key, void *val) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); BLI_ghash_insert(gh, key, val); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); } static bool log_ghash_remove( -BMLog *entry, GHash *gh, const void *key, GHashKeyFreeFP keyfree, GHashValFreeFP valfree) +BMLog *log, GHash *gh, const void *key, GHashKeyFreeFP keyfree, GHashValFreeFP valfree) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); bool ret = BLI_ghash_remove(gh, key, keyfree, valfree); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); return ret; } static bool log_ghash_reinsert( -BMLog *entry, GHash *gh, void *key, void *val, GHashKeyFreeFP keyfree, GHashValFreeFP valfree) +BMLog *log, GHash *gh, void *key, void *val, GHashKeyFreeFP keyfree, GHashValFreeFP valfree) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); bool ret = BLI_ghash_reinsert(gh, key, val, keyfree, valfree); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); return ret; } -static bool log_ghash_haskey(BMLog *entry, GHash *gh, const void *key) +static bool log_ghash_haskey(BMLog *log, GHash *gh, const void *key) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_READ); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_READ); bool ret = BLI_ghash_haskey(gh, key); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); return ret; } -static bool log_ghash_ensure_p(BMLog *entry, GHash *gh, void *key, void ***val) +static bool log_ghash_ensure_p(BMLog *log, GHash *gh, void *key, void ***val) { - BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(>lock, THREAD_LOCK_WRITE); bool ret = BLI_ghash_ensure_p(gh, key, val); - BLI_rw_mutex_unlock(>lock); + BLI_rw_mutex_unlock(>lock); return ret; } @@ -614,14 +614,13 @@ static void bm_log_full_mesh_intern(BMesh *bm, BMLog *log, BMLogEntry *entry) entry->full_copy_idmap = BLI_ghash_ptr_new_ex("bmlog", bm->totvert + bm->totface); BM_mesh_elem_index_ensure(bm, BM_VERT | BM_EDGE | BM_FACE); - GHashIterator gi; for (int step = 0; step < 2; step++) { BMIter iter; BMHeader *elem; BM_ITER_MESH (elem, , bm, step ? BM_FACES_OF_MESH : BM_VERTS_OF_MESH) { - void **val = log_ghash_lookup_p(entry, log->elem_to_id, (void *)elem); + void **val = log_ghash_lookup_p(log, log->elem_to_id, (void *)elem); if (!val) { continue; } @@ -1115,10 +1114,6 @@ static void full_copy_swap(BMesh *bm, BMLog *log, BMLogEntry *entry) { CustomData_MeshMasks cd_mask_extra = {CD_MASK_DYNTOPO_VERT, 0, 0, 0, 0}; - BMIter iter; - BMVert *v; - BMFace *f; - BMLogEntry tmp = {0}; bm_log_full_mesh_intern(bm, log, ); @@ -1147,8 +1142,8 @@ static void full_copy_swap(BMesh *bm, BMLog *log, BMLogEntry *entry) uintptr_t id = (uintptr_t)BLI_ghashIterator_getKey(); uintptr_t key = (uintptr_t)BLI_ghashIterator_getValue(); -uintptr_t idx = (key & ((1L << 31L) - 1L)); -uintptr_t type = key >> 31L; +uintptr_t idx = (key & ((1LL << 31LL) - 1LL)); +uintptr_t type = key >> 31LL; BMHeader *elem = NULL; switch (type) { @@ -1161,13
[Bf-blender-cvs] [79a3adae540] asset-browser-poselib: Merge branch 'master' into asset-browser-poselib
Commit: 79a3adae5405fc25799ad3966025875b73e75a4d Author: Julian Eisel Date: Thu Apr 29 13:57:55 2021 +0200 Branches: asset-browser-poselib https://developer.blender.org/rB79a3adae5405fc25799ad3966025875b73e75a4d Merge branch 'master' into asset-browser-poselib === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [41945454f71] master: Correction to own previous commit: Add missing break
Commit: 41945454f712e6892b4e01e093ceeac13cf71a5c Author: Julian Eisel Date: Thu Apr 29 13:36:04 2021 +0200 Branches: master https://developer.blender.org/rB41945454f712e6892b4e01e093ceeac13cf71a5c Correction to own previous commit: Add missing break Small mistake in 88400f0c03a9. Not having this break would be harmless, but we can avoid some unnecessary work with it. === M source/blender/editors/space_file/space_file.c === diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 4ad2e5c2fd2..4422a685af1 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -474,6 +474,7 @@ static void file_listener(const wmSpaceTypeListenerParams *params) file_reset_filelist_showing_main_data(area, sfile); break; } + break; } case NC_ASSET: { switch (wmn->action) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4f8e8b60546] asset-browser-poselib: Fix incorrect sorting in Asset View after renaming local asset
Commit: 4f8e8b60546e737c1a31fe972c30a363bedc1565 Author: Julian Eisel Date: Thu Apr 29 13:30:15 2021 +0200 Branches: asset-browser-poselib https://developer.blender.org/rB4f8e8b60546e737c1a31fe972c30a363bedc1565 Fix incorrect sorting in Asset View after renaming local asset Basically the same as 88400f0c03a9, but now for the asset view. === M source/blender/editors/asset/asset_list.cc M source/blender/editors/interface/interface_template_asset_view.cc === diff --git a/source/blender/editors/asset/asset_list.cc b/source/blender/editors/asset/asset_list.cc index fdc67ef3aaa..378d12442b3 100644 --- a/source/blender/editors/asset/asset_list.cc +++ b/source/blender/editors/asset/asset_list.cc @@ -310,6 +310,12 @@ void AssetList::clear(bContext *C) bool AssetList::listen(const wmNotifier ) const { switch (notifier.category) { +case NC_ID: { + if (ELEM(notifier.action, NA_RENAME)) { +return true; + } + break; +} case NC_ASSET: if (ELEM(notifier.data, ND_ASSET_LIST, ND_ASSET_LIST_READING, ND_ASSET_LIST_PREVIEW)) { return true; diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc index 1f2702abeb0..653fc42f370 100644 --- a/source/blender/editors/interface/interface_template_asset_view.cc +++ b/source/blender/editors/interface/interface_template_asset_view.cc @@ -39,6 +39,7 @@ #include "UI_interface.h" #include "WM_api.h" +#include "WM_types.h" #include "interface_intern.h" @@ -123,6 +124,16 @@ static void asset_view_draw_item(uiList *ui_list, static void asset_view_listener(uiList *ui_list, wmRegionListenerParams *params) { AssetViewListData *list_data = (AssetViewListData *)ui_list->dyn_data->customdata; + const wmNotifier *notifier = params->notifier; + + switch (notifier->category) { +case NC_ID: { + if (ELEM(notifier->action, NA_RENAME)) { +ED_assetlist_storage_tag_main_data_dirty(); + } + break; +} + } if (ED_assetlist_listen(_data->asset_library, params->notifier)) { ED_region_tag_redraw(params->region); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0c4eddcfa15] asset-browser-poselib: Merge branch 'master' into asset-browser-poselib
Commit: 0c4eddcfa1584d2c18050a649223703702b1dbf2 Author: Julian Eisel Date: Thu Apr 29 13:21:35 2021 +0200 Branches: asset-browser-poselib https://developer.blender.org/rB0c4eddcfa1584d2c18050a649223703702b1dbf2 Merge branch 'master' into asset-browser-poselib === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [88400f0c03a] master: Fix incorrect sorting in Asset Browser after renaming local asset
Commit: 88400f0c03a96f5c92e251ebc24b197da80707d5 Author: Julian Eisel Date: Thu Apr 29 13:15:42 2021 +0200 Branches: master https://developer.blender.org/rB88400f0c03a96f5c92e251ebc24b197da80707d5 Fix incorrect sorting in Asset Browser after renaming local asset When renaming a data-block that is an asset, while the asset is visible in the Asset Browser ("Current File" asset library), the list wouldn't re-sort items, breaking the alphabetical sorting. This was easily possible while changing the data-block name throught the Asset Browser's sidebar, while in the "Current File" asset library. === M source/blender/editors/space_file/space_file.c === diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 993b1d9b69c..4ad2e5c2fd2 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -467,6 +467,14 @@ static void file_listener(const wmSpaceTypeListenerParams *params) break; } break; +case NC_ID: { + switch (wmn->action) { +case NA_RENAME: + /* Force list to update sorting (with a full reset for now). */ + file_reset_filelist_showing_main_data(area, sfile); + break; + } +} case NC_ASSET: { switch (wmn->action) { case NA_SELECTED: ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4e10b196ac1] master: Functions: make copying virtual arrays to span more efficient
Commit: 4e10b196ac15339cfded8d5615f04ac40c93e19b Author: Jacques Lucke Date: Thu Apr 29 12:59:44 2021 +0200 Branches: master https://developer.blender.org/rB4e10b196ac15339cfded8d5615f04ac40c93e19b Functions: make copying virtual arrays to span more efficient Sometimes functions expect a span instead of a virtual array. If the virtual array is a span internally already, great. But if it is not (e.g. the position attribute on a mesh), the elements have to be copied over to a span. This patch makes the copying process more efficient by giving the compiler more opportunity for optimization. === M source/blender/blenlib/BLI_virtual_array.hh M source/blender/functions/FN_generic_virtual_array.hh M source/blender/functions/intern/generic_virtual_array.cc === diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index eae15f0300c..1c02bce8411 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -38,6 +38,7 @@ */ #include "BLI_array.hh" +#include "BLI_index_mask.hh" #include "BLI_span.hh" namespace blender { @@ -127,14 +128,25 @@ template class VArray { /* Copy the entire virtual array into a span. */ void materialize(MutableSpan r_span) const { -BLI_assert(size_ == r_span.size()); -this->materialize_impl(r_span); +this->materialize(IndexMask(size_), r_span); + } + + /* Copy some indices of the virtual array into a span. */ + void materialize(IndexMask mask, MutableSpan r_span) const + { +BLI_assert(mask.min_array_size() <= size_); +this->materialize_impl(mask, r_span); } void materialize_to_uninitialized(MutableSpan r_span) const { -BLI_assert(size_ == r_span.size()); -this->materialize_to_uninitialized_impl(r_span); +this->materialize_to_uninitialized(IndexMask(size_), r_span); + } + + void materialize_to_uninitialized(IndexMask mask, MutableSpan r_span) const + { +BLI_assert(mask.min_array_size() <= size_); +this->materialize_to_uninitialized_impl(mask, r_span); } protected: @@ -164,40 +176,35 @@ template class VArray { return T(); } - virtual void materialize_impl(MutableSpan r_span) const + virtual void materialize_impl(IndexMask mask, MutableSpan r_span) const { +T *dst = r_span.data(); if (this->is_span()) { - const Span span = this->get_internal_span(); - initialized_copy_n(span.data(), size_, r_span.data()); + const T *src = this->get_internal_span().data(); + mask.foreach_index([&](const int64_t i) { dst[i] = src[i]; }); } else if (this->is_single()) { const T single = this->get_internal_single(); - initialized_fill_n(r_span.data(), size_, single); + mask.foreach_index([&](const int64_t i) { dst[i] = single; }); } else { - const int64_t size = size_; - for (int64_t i = 0; i < size; i++) { -r_span[i] = this->get(i); - } + mask.foreach_index([&](const int64_t i) { dst[i] = this->get(i); }); } } - virtual void materialize_to_uninitialized_impl(MutableSpan r_span) const + virtual void materialize_to_uninitialized_impl(IndexMask mask, MutableSpan r_span) const { +T *dst = r_span.data(); if (this->is_span()) { - const Span span = this->get_internal_span(); - uninitialized_copy_n(span.data(), size_, r_span.data()); + const T *src = this->get_internal_span().data(); + mask.foreach_index([&](const int64_t i) { new (dst + i) T(src[i]); }); } else if (this->is_single()) { const T single = this->get_internal_single(); - uninitialized_fill_n(r_span.data(), size_, single); + mask.foreach_index([&](const int64_t i) { new (dst + i) T(single); }); } else { - const int64_t size = size_; - T *dst = r_span.data(); - for (int64_t i = 0; i < size; i++) { -new (dst + i) T(this->get(i)); - } + mask.foreach_index([&](const int64_t i) { new (dst + i) T(this->get(i)); }); } } }; @@ -494,6 +501,18 @@ template class VArray_For_Func final : public VArr { return get_func_(index); } + + void materialize_impl(IndexMask mask, MutableSpan r_span) const override + { +T *dst = r_span.data(); +mask.foreach_index([&](const int64_t i) { dst[i] = get_func_(i); }); + } + + void materialize_to_uninitialized_impl(IndexMask mask, MutableSpan r_span) const override + { +T *dst = r_span.data(); +mask.foreach_index([&](const int64_t i) { new (dst + i) T(get_func_(i)); }); + } }; template @@ -511,6 +530,18 @@ class VArray_For_DerivedSpan : public VArray { { return GetFunc(data_[index]); } + + void materialize_impl(IndexMask mask, MutableSpan r_span) const override + { +ElemT *dst = r_span.data(); +
[Bf-blender-cvs] [8c73f44a019] blender-v2.93-release: Fix build error: use of unintialized variable
Commit: 8c73f44a019cd087436184484d7200a8f709a6e1 Author: Wannes Malfait Date: Thu Apr 29 14:48:21 2021 +0530 Branches: blender-v2.93-release https://developer.blender.org/rB8c73f44a019cd087436184484d7200a8f709a6e1 Fix build error: use of unintialized variable Differential Revision: https://developer.blender.org/D5 === M source/blender/bmesh/tools/bmesh_bisect_plane.c === diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index 40ac6c0348c..f840a3770ff 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -208,7 +208,7 @@ static void bm_face_bisect_verts( } else { - uint i; + uint i = 0; /* */ /* Check contiguous spans of centered vertices (skipping when necessary). */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [41f06beac98] profiler-editor: fix
Commit: 41f06beac980c56b603670a4d016eb5ccf27f363 Author: Jacques Lucke Date: Wed Apr 28 17:43:49 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB41f06beac980c56b603670a4d016eb5ccf27f363 fix === M source/blender/blenkernel/intern/DerivedMesh.cc === diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 771ab8e2830..473bd9d9d7e 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -924,7 +924,6 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md, Mesh *input_mesh, GeometrySet _set) { - BLI_PROFILE_SCOPE(md->name); Mesh *mesh_output = nullptr; const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type); if (mti->modifyGeometrySet == nullptr) { @@ -951,6 +950,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md, GeometryOwnershipType::Editable); /* Let the modifier change the geometry set. */ +BLI_PROFILE_SCOPE(md->name); mti->modifyGeometrySet(md, , _set); /* Release the mesh from the geometry set again. */ @@ -1218,7 +1218,6 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, } BKE_mesh_vert_coords_apply(mesh_final, deformed_verts); } - BLI_PROFILE_SCOPE(md->name); BKE_modifier_deform_verts(md, , mesh_final, deformed_verts, num_deformed_verts); } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fa918199c0b] profiler-editor: slightly improve drawing speed
Commit: fa918199c0b6b370ac500473a5bd7811e91f2625 Author: Jacques Lucke Date: Thu Apr 29 11:21:49 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBfa918199c0b6b370ac500473a5bd7811e91f2625 slightly improve drawing speed === M source/blender/editors/space_profiler/profiler_draw.cc === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index f12488b15a3..72b4d1b2f08 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -148,6 +148,17 @@ class ProfilerDrawer { void draw_node(ProfileNode ) { +const float left_x = this->time_to_x(node.begin_time()); +const float real_right_x = this->time_to_x(node.end_time()); +const float right_x = std::max(left_x + 1, real_right_x); + +if (left_x > region_->winx) { + return; +} +if (right_x < 0) { + return; +} + GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); @@ -156,13 +167,13 @@ class ProfilerDrawer { const Color4f color = this->get_node_color(node); immUniformColor4fv(color); -const int left_x = this->time_to_x(node.begin_time()); -const int right_x = std::max(left_x + 1, this->time_to_x(node.end_time())); immRecti(pos, left_x, node.top_y, right_x, node.top_y - row_height_); immUnbindProgram(); -this->draw_node_label(node, left_x, right_x); +if (right_x - left_x > 1.0f) { + this->draw_node_label(node, left_x, right_x); +} this->draw_nodes(node.direct_children()); for (Span nodes : node.parallel_children()) { @@ -240,7 +251,7 @@ class ProfilerDrawer { UI_view2d_smooth_view(C, region, _view, U.smooth_viewtx); } - int time_to_x(const TimePoint time) const + float time_to_x(const TimePoint time) const { const TimePoint begin_time = profiler_layout_->begin_time(); const Duration time_since_begin = time - begin_time; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7663d403565] profiler-editor: draw node rectangles
Commit: 7663d403565cb3bec5d36fb2ae103ab09ba2693e Author: Jacques Lucke Date: Tue Apr 27 17:39:58 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB7663d403565cb3bec5d36fb2ae103ab09ba2693e draw node rectangles === M source/blender/blenkernel/intern/DerivedMesh.cc M source/blender/blenkernel/intern/screen.c M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/profiler_profile.cc === diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 9f51ef5292f..474bfd0a4ee 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -41,6 +41,7 @@ #include "BLI_float2.hh" #include "BLI_linklist.h" #include "BLI_math.h" +#include "BLI_profile.hh" #include "BLI_task.h" #include "BLI_utildefines.h" #include "BLI_vector.hh" @@ -923,6 +924,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md, Mesh *input_mesh, GeometrySet _set) { + BLI_PROFILE_SCOPE(__func__); Mesh *mesh_output = nullptr; const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type); if (mti->modifyGeometrySet == nullptr) { @@ -2059,6 +2061,7 @@ void makeDerivedMesh(struct Depsgraph *depsgraph, BMEditMesh *em, const CustomData_MeshMasks *dataMask) { + BLI_PROFILE_SCOPE(__func__); bool need_mapping; CustomData_MeshMasks cddata_masks = *dataMask; object_get_datamask(depsgraph, ob, _masks, _mapping); diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 60e45168dea..7c4517b07f1 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -1764,6 +1764,10 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) } } } +else if (sl->spacetype == SPACE_PROFILER) { + SpaceProfiler *sprofiler = (SpaceProfiler *)sl; + sprofiler->runtime = NULL; +} } BLI_listbase_clear(>actionzones); diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 00dde364304..42f4e7c48f2 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -26,6 +26,9 @@ #include "BKE_context.h" +#include "BLI_color.hh" +#include "BLI_hash.h" +#include "BLI_math_color.h" #include "BLI_rect.h" #include "profiler_draw.hh" @@ -34,6 +37,8 @@ namespace blender::ed::profiler { +using profile::Duration; + class ProfilerDrawer { private: const bContext *C; @@ -64,6 +69,7 @@ class ProfilerDrawer { { UI_ThemeClearColor(TH_BACK); this->compute_vertical_extends_of_all_nodes(); +this->draw_all_nodes(); } void compute_vertical_extends_of_all_nodes() @@ -95,6 +101,59 @@ class ProfilerDrawer { node.bottom_y = this->compute_vertical_extends_of_nodes(children, node.bottom_y); } } + + void draw_all_nodes() + { +for (Span nodes : profiler_layout_->root_nodes()) { + this->draw_nodes(nodes); +} + } + + void draw_nodes(Span nodes) + { +for (ProfileNode *node : nodes) { + this->draw_node(*node); +} + } + + void draw_node(ProfileNode ) + { +GPUVertFormat *format = immVertexFormat(); +uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + +immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + +const Color4f color = this->get_node_color(node); +immUniformColor4fv(color); + +const int left_x = this->time_to_x(node.begin_time()); +const int right_x = std::max(left_x + 1, this->time_to_x(node.end_time())); +immRecti(pos, left_x, node.top_y, right_x, node.bottom_y); + +immUnbindProgram(); + } + + int time_to_x(const TimePoint time) const + { +const TimePoint begin_time = profiler_layout_->begin_time(); +const Duration time_since_begin = time - begin_time; +const float ms_since_begin = this->duration_to_ms(time_since_begin); +return ms_since_begin / 5.0f; + } + + Color4f get_node_color(ProfileNode ) + { +const uint64_t value = node.begin_time().time_since_epoch().count(); +const float variation = BLI_hash_int_2d_to_float(value, value >> 32); +float r, g, b; +hsv_to_rgb(variation * 0.2f, 0.5f, 0.5f, , , ); +return {r, g, b, 1.0f}; + } + + float duration_to_ms(const Duration duration) const + { +return duration.count() / 100.0f; + } }; void draw_profiler(const bContext *C, ARegion *region) diff --git a/source/blender/editors/space_profiler/profiler_profile.cc
[Bf-blender-cvs] [fd19b0123cb] profiler-editor: show duration percentages in tooltip
Commit: fd19b0123cbb4b239a07cbfb35ad0db1c0c26d8e Author: Jacques Lucke Date: Thu Apr 29 11:13:48 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBfd19b0123cbb4b239a07cbfb35ad0db1c0c26d8e show duration percentages in tooltip === M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/profiler_layout.hh === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index c555869588e..f12488b15a3 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -14,6 +14,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include + #include "UI_interface.h" #include "UI_resources.h" #include "UI_view2d.h" @@ -29,6 +31,7 @@ #include "BLI_color.hh" #include "BLI_hash.h" #include "BLI_math_color.h" +#include "BLI_profile.hh" #include "BLI_rect.h" #include "profiler_draw.hh" @@ -74,8 +77,11 @@ class ProfilerDrawer { ui_block_ = UI_block_begin(C, region_, __func__, UI_EMBOSS_NONE); this->draw_all_nodes(); -UI_block_end(C, ui_block_); -UI_block_draw(C, ui_block_); +{ + BLI_PROFILE_SCOPE("end/draw block"); + UI_block_end(C, ui_block_); + UI_block_draw(C, ui_block_); +} this->update_view2d_bounds(); } @@ -94,6 +100,7 @@ class ProfilerDrawer { void compute_vertical_extends_of_all_nodes() { +BLI_PROFILE_SCOPE(__func__); int top_y = region_->winy - region_->v2d.cur.ymax; for (Span nodes : profiler_layout_->root_nodes()) { top_y = this->compute_vertical_extends_of_nodes(nodes, top_y); @@ -126,6 +133,7 @@ class ProfilerDrawer { void draw_all_nodes() { +BLI_PROFILE_SCOPE(__func__); for (Span nodes : profiler_layout_->root_nodes()) { this->draw_nodes(nodes); } @@ -200,8 +208,16 @@ class ProfilerDrawer { { NodeTooltipArg = *(NodeTooltipArg *)argN; ProfileNode = *arg.node; +const Duration duration = node.duration(); std::stringstream ss; -ss << "Duration: " << duration_to_ms(node.end_time() - node.begin_time()) << " ms"; +ss << std::setprecision(2) << std::fixed; +for (const ProfileNode *parent = node.parent(); parent != nullptr; parent = parent->parent()) { + const Duration parent_duration = parent->duration(); + const float percentage = (duration.count() / (float)parent_duration.count()) * 100.0f; + ss << percentage << "% of " << parent->name() << "\n"; +} +ss << "\n"; +ss << "Duration: " << duration_to_ms(duration) << " ms"; return BLI_strdup(ss.str().c_str()); } @@ -249,6 +265,7 @@ class ProfilerDrawer { void draw_profiler(const bContext *C, ARegion *region) { + BLI_PROFILE_SCOPE(__func__); ProfilerDrawer drawer{C, region}; drawer.draw(); } diff --git a/source/blender/editors/space_profiler/profiler_layout.hh b/source/blender/editors/space_profiler/profiler_layout.hh index 57a91d15e40..9672230901f 100644 --- a/source/blender/editors/space_profiler/profiler_layout.hh +++ b/source/blender/editors/space_profiler/profiler_layout.hh @@ -23,6 +23,7 @@ namespace blender::ed::profiler { +using profile::Duration; using profile::RecordedProfile; using profile::TimePoint; @@ -67,6 +68,11 @@ class ProfileNode { return end_time_; } + Duration duration() const + { +return end_time_ - begin_time_; + } + ProfileNode *parent() { return parent_; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e6258f09d5d] profiler-editor: replace macros with inline functions
Commit: e6258f09d5d0a6f899d8dc1307251b71a3116bde Author: Jacques Lucke Date: Thu Apr 29 10:30:33 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBe6258f09d5d0a6f899d8dc1307251b71a3116bde replace macros with inline functions === M source/blender/blenlib/BLI_profile.h === diff --git a/source/blender/blenlib/BLI_profile.h b/source/blender/blenlib/BLI_profile.h index f1cbac7b3f7..d5929dcae08 100644 --- a/source/blender/blenlib/BLI_profile.h +++ b/source/blender/blenlib/BLI_profile.h @@ -41,29 +41,34 @@ void _bli_profile_task_begin_subtask(BLI_ProfileTask *task, const BLI_ProfileTask *parent_task); void _bli_profile_task_end(BLI_ProfileTask *task); -#define BLI_profile_task_begin(task_ptr, name) \ - if (bli_profiling_is_enabled) { \ -_bli_profile_task_begin((task_ptr), (name)); \ - } \ - else { \ -(task_ptr)->id = BLI_PROFILE_DUMMY_ID; \ - } \ - ((void)0) +BLI_INLINE void BLI_profile_task_begin(BLI_ProfileTask *task, const char *name) +{ + if (bli_profiling_is_enabled) { +_bli_profile_task_begin(task, name); + } + else { +task->id = BLI_PROFILE_DUMMY_ID; + } +} -#define BLI_profile_task_begin_subtask(task_ptr, name, parent_task) \ - if (bli_profiling_is_enabled) { \ -_bli_profile_task_begin_subtask((task_ptr), (name), (parent_task)); \ - } \ - else { \ -(task_ptr)->id = BLI_PROFILE_DUMMY_ID; \ - } \ - ((void)0) +BLI_INLINE void BLI_profile_task_begin_subtask(BLI_ProfileTask *task, + const char *name, + const BLI_ProfileTask *parent_task) +{ + if (bli_profiling_is_enabled) { +_bli_profile_task_begin_subtask(task, name, parent_task); + } + else { +task->id = BLI_PROFILE_DUMMY_ID; + } +} -#define BLI_profile_task_end(task_ptr) \ - if ((task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \ -_bli_profile_task_end(task_ptr); \ - } \ - ((void)0) +BLI_INLINE void BLI_profile_task_end(BLI_ProfileTask *task) +{ + if (task->id != BLI_PROFILE_DUMMY_ID) { +_bli_profile_task_end(task); + } +} #ifdef __cplusplus } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b9d8f34e355] profiler-editor: deduplicate code
Commit: b9d8f34e355ef34f65db9ac44bd0ae0b24c2fa93 Author: Jacques Lucke Date: Thu Apr 29 10:55:03 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBb9d8f34e355ef34f65db9ac44bd0ae0b24c2fa93 deduplicate code === M source/blender/blenlib/intern/profile.cc === diff --git a/source/blender/blenlib/intern/profile.cc b/source/blender/blenlib/intern/profile.cc index 53a54085106..c8ff6130729 100644 --- a/source/blender/blenlib/intern/profile.cc +++ b/source/blender/blenlib/intern/profile.cc @@ -159,16 +159,16 @@ void ProfileListener::flush_to_all() } // namespace blender::profile -void _bli_profile_task_begin(BLI_ProfileTask *task, const char *name) +static void profile_task_begin(BLI_ProfileTask *task, const char *name, uint64_t parent_id) { ThreadLocalProfileData _data = threadlocal_profile_data; const uint64_t id = local_data.get_next_unique_id(); - const uint64_t parent_id = local_data.id_stack.peek_default(0); local_data.id_stack.push(id); task->id = id; ProfileTaskBegin *task_begin = local_data.queue_begins.prepare_append(); + task_begin->id = id; task_begin->name = name; task_begin->parent_id = parent_id; @@ -178,25 +178,18 @@ void _bli_profile_task_begin(BLI_ProfileTask *task, const char *name) local_data.queue_begins.commit_append(); } +void _bli_profile_task_begin(BLI_ProfileTask *task, const char *name) +{ + ThreadLocalProfileData _data = threadlocal_profile_data; + const uint64_t parent_id = local_data.id_stack.peek_default(0); + profile_task_begin(task, name, parent_id); +} + void _bli_profile_task_begin_subtask(BLI_ProfileTask *task, const char *name, const BLI_ProfileTask *parent_task) { - ThreadLocalProfileData _data = threadlocal_profile_data; - - const uint64_t id = local_data.get_next_unique_id(); - const uint64_t parent_id = parent_task->id; - local_data.id_stack.push(id); - task->id = id; - - ProfileTaskBegin *task_begin = local_data.queue_begins.prepare_append(); - task_begin->id = id; - task_begin->name = name; - task_begin->parent_id = parent_id; - task_begin->thread_id = local_data.thread_id; - task_begin->time = Clock::now(); - - local_data.queue_begins.commit_append(); + profile_task_begin(task, name, parent_task->id); } void _bli_profile_task_end(BLI_ProfileTask *task) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5490d79dd5d] profiler-editor: Merge branch 'master' into profiler-editor
Commit: 5490d79dd5d31f0ee58632663142eaa9e87db22e Author: Jacques Lucke Date: Thu Apr 29 10:22:25 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB5490d79dd5d31f0ee58632663142eaa9e87db22e Merge branch 'master' into profiler-editor === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3a3bebc3eb2] profiler-editor: add profiling to a few more places
Commit: 3a3bebc3eb23aced4255c482864fb7c4ac2cdfaa Author: Jacques Lucke Date: Wed Apr 28 16:38:58 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB3a3bebc3eb23aced4255c482864fb7c4ac2cdfaa add profiling to a few more places === M source/blender/blenkernel/intern/DerivedMesh.cc M source/blender/blenkernel/intern/modifier.c M source/blender/modifiers/intern/MOD_nodes_evaluator.cc === diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 9fbbb227467..771ab8e2830 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -2069,7 +2069,7 @@ void makeDerivedMesh(struct Depsgraph *depsgraph, BMEditMesh *em, const CustomData_MeshMasks *dataMask) { - BLI_PROFILE_SCOPE(__func__); + BLI_PROFILE_SCOPE((std::string(ob->id.name) + " Modifiers").c_str()); bool need_mapping; CustomData_MeshMasks cddata_masks = *dataMask; object_get_datamask(depsgraph, ob, _masks, _mapping); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 34b7c4234ec..0fc3ac32040 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -51,6 +51,7 @@ #include "BLI_linklist.h" #include "BLI_listbase.h" #include "BLI_path_util.h" +#include "BLI_profile.h" #include "BLI_session_uuid.h" #include "BLI_string.h" #include "BLI_string_utils.h" @@ -1052,7 +1053,11 @@ struct Mesh *BKE_modifier_modify_mesh(ModifierData *md, if (mti->dependsOnNormals && mti->dependsOnNormals(md)) { modwrap_dependsOnNormals(me); } - return mti->modifyMesh(md, ctx, me); + BLI_ProfileTask profile_task; + BLI_profile_task_begin(_task, md->name); + Mesh *new_mesh = mti->modifyMesh(md, ctx, me); + BLI_profile_task_end(_task); + return new_mesh; } void BKE_modifier_deform_verts(ModifierData *md, @@ -1067,7 +1072,10 @@ void BKE_modifier_deform_verts(ModifierData *md, if (me && mti->dependsOnNormals && mti->dependsOnNormals(md)) { modwrap_dependsOnNormals(me); } + BLI_ProfileTask profile_task; + BLI_profile_task_begin(_task, md->name); mti->deformVerts(md, ctx, me, vertexCos, numVerts); + BLI_profile_task_end(_task); } void BKE_modifier_deform_vertsEM(ModifierData *md, diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc index aa35f5c540f..b04c9f7d2a6 100644 --- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc +++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc @@ -24,6 +24,8 @@ #include "FN_generic_value_map.hh" #include "FN_multi_function.hh" +#include "BLI_profile.hh" + namespace blender::modifiers::geometry_nodes { using bke::PersistentCollectionHandle; @@ -276,6 +278,7 @@ class GeometryNodesEvaluator { void execute_node(const DNode node, NodeParamsProvider _provider) { +BLI_PROFILE_SCOPE(node->name().c_str()); const bNode = *params_provider.dnode->bnode(); /* Use the geometry-node-execute callback if it exists. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f318ce578b7] profiler-editor: Merge branch 'master' into profiler-editor
Commit: f318ce578b7cb8ee8d155687dae285847cda54d1 Author: Jacques Lucke Date: Wed Apr 28 16:11:14 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBf318ce578b7cb8ee8d155687dae285847cda54d1 Merge branch 'master' into profiler-editor === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ca13fa81467] profiler-editor: improve unique id generation
Commit: ca13fa81467b58b0af424e9989752b6d1ccbfe66 Author: Jacques Lucke Date: Thu Apr 29 10:43:57 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBca13fa81467b58b0af424e9989752b6d1ccbfe66 improve unique id generation === M source/blender/blenlib/intern/profile.cc === diff --git a/source/blender/blenlib/intern/profile.cc b/source/blender/blenlib/intern/profile.cc index 7918ab1008e..53a54085106 100644 --- a/source/blender/blenlib/intern/profile.cc +++ b/source/blender/blenlib/intern/profile.cc @@ -26,11 +26,11 @@ using namespace blender; using namespace blender::profile; -static uint64_t get_unique_session_id() +static uint64_t get_unique_session_id_range(const uint64_t size) { - /* TODO: Allow getting ids without synchronizing threads for every id. */ static std::atomic id = 1; - return id++; + const uint64_t range_start = id.fetch_add(size, std::memory_order_relaxed); + return range_start; } struct ThreadLocalProfileData; @@ -69,7 +69,7 @@ struct ThreadLocalProfileData { std::lock_guard lock{ProfileRegistry::threadlocals_mutex}; used_registry = ensure_registry(); registry->threadlocals.append(this); -thread_id = get_unique_session_id(); +thread_id = get_unique_session_id_range(1); } ~ThreadLocalProfileData() @@ -83,8 +83,24 @@ struct ThreadLocalProfileData { ProfileDataQueue queue_ends; RawStack id_stack; + uint64_t get_next_unique_id() + { +if (unique_id_current_ == unique_id_end_) { + constexpr uint64_t size = 100'000; + unique_id_current_ = get_unique_session_id_range(size); + unique_id_end_ = unique_id_current_ + size; +} +const uint64_t id = unique_id_current_; +unique_id_current_++; +return id; + } + /* Take ownership to make sure that the registry won't be destructed too early. */ std::shared_ptr used_registry; + + private: + uint64_t unique_id_current_ = 0; + uint64_t unique_id_end_ = 0; }; static thread_local ThreadLocalProfileData threadlocal_profile_data; @@ -147,7 +163,7 @@ void _bli_profile_task_begin(BLI_ProfileTask *task, const char *name) { ThreadLocalProfileData _data = threadlocal_profile_data; - const uint64_t id = get_unique_session_id(); + const uint64_t id = local_data.get_next_unique_id(); const uint64_t parent_id = local_data.id_stack.peek_default(0); local_data.id_stack.push(id); task->id = id; @@ -168,7 +184,7 @@ void _bli_profile_task_begin_subtask(BLI_ProfileTask *task, { ThreadLocalProfileData _data = threadlocal_profile_data; - const uint64_t id = get_unique_session_id(); + const uint64_t id = local_data.get_next_unique_id(); const uint64_t parent_id = parent_task->id; local_data.id_stack.push(id); task->id = id; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3a6e4d76f9d] profiler-editor: support vertical panning
Commit: 3a6e4d76f9d937187e5d9aca24978b378bbe75b1 Author: Jacques Lucke Date: Wed Apr 28 17:09:37 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB3a6e4d76f9d937187e5d9aca24978b378bbe75b1 support vertical panning === M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/space_profiler.cc === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 1ae3de48690..c555869588e 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -86,14 +86,15 @@ class ProfilerDrawer { profiler_layout_->begin_time()); /* Giving a bit more space on the right side is convenient. */ const float extended_duration_ms = std::max(duration_ms * 1.1f, 5000.0f); -UI_view2d_totRect_set(_->v2d, extended_duration_ms, 1); +/* TODO: Remove magic numbers. */ +UI_view2d_totRect_set(_->v2d, extended_duration_ms, 2000); UI_view2d_scrollers_draw(_->v2d, nullptr); } void compute_vertical_extends_of_all_nodes() { -int top_y = region_->winy; +int top_y = region_->winy - region_->v2d.cur.ymax; for (Span nodes : profiler_layout_->root_nodes()) { top_y = this->compute_vertical_extends_of_nodes(nodes, top_y); top_y -= parallel_padding_; diff --git a/source/blender/editors/space_profiler/space_profiler.cc b/source/blender/editors/space_profiler/space_profiler.cc index bcb2a63c019..58d4c292b1b 100644 --- a/source/blender/editors/space_profiler/space_profiler.cc +++ b/source/blender/editors/space_profiler/space_profiler.cc @@ -64,12 +64,13 @@ static SpaceLink *profiler_create(const ScrArea *UNUSED(area), const Scene *UNUS v2d->scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM; v2d->keepzoom = V2D_LOCKZOOM_Y; v2d->keeptot = V2D_KEEPTOT_BOUNDS; +v2d->keepofs = V2D_KEEPOFS_Y; v2d->align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y; v2d->min[0] = 0.0001f; -v2d->min[1] = 100.0f; +v2d->min[1] = 1.0f; v2d->max[0] = 10.0f; -v2d->max[1] = 100.0f; -BLI_rctf_init(>tot, 0, 5000, -1, 0); +v2d->max[1] = 5000.0f; +BLI_rctf_init(>tot, 0, 5000, -1000, 0); v2d->cur = v2d->tot; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f9e22fd1ca7] profiler-editor: fix shutdown issues
Commit: f9e22fd1ca7959225458864450c64dfeb5f81465 Author: Jacques Lucke Date: Wed Apr 28 10:13:41 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBf9e22fd1ca7959225458864450c64dfeb5f81465 fix shutdown issues === M source/blender/blenlib/intern/profile.cc === diff --git a/source/blender/blenlib/intern/profile.cc b/source/blender/blenlib/intern/profile.cc index 50c5e61306c..7918ab1008e 100644 --- a/source/blender/blenlib/intern/profile.cc +++ b/source/blender/blenlib/intern/profile.cc @@ -35,29 +35,56 @@ static uint64_t get_unique_session_id() struct ThreadLocalProfileData; -static std::mutex registered_threadlocals_mutex; -static RawVector registered_threadlocals; +struct ProfileRegistry { + static inline std::mutex threadlocals_mutex; + RawVector threadlocals; + + static inline std::mutex listeners_mutex; + RawVector listeners; +}; + +/** + * All threads that record profile data register themselves here. + * It is a shared pointer, because the individual threadlocal variables have to own the registry as + * well. Otherwise there are problems at shutdown when this static variable is destructed before + * all other threads unregistered themselves. + */ +static std::shared_ptr registry; + +static std::shared_ptr _registry() +{ + static std::mutex mutex; + std::lock_guard lock{mutex}; + if (!registry) { +registry = std::make_shared(); + } + return registry; +} template using ProfileDataQueue = SingleProducerChunkConsumerQueue; struct ThreadLocalProfileData { ThreadLocalProfileData() { -std::lock_guard lock{registered_threadlocals_mutex}; -registered_threadlocals.append(this); +std::lock_guard lock{ProfileRegistry::threadlocals_mutex}; +used_registry = ensure_registry(); +registry->threadlocals.append(this); thread_id = get_unique_session_id(); } ~ThreadLocalProfileData() { -std::lock_guard lock{registered_threadlocals_mutex}; -registered_threadlocals.remove_first_occurrence_and_reorder(this); +std::lock_guard lock{ProfileRegistry::threadlocals_mutex}; +used_registry->threadlocals.remove_first_occurrence_and_reorder(this); } uint64_t thread_id; ProfileDataQueue queue_begins; ProfileDataQueue queue_ends; RawStack id_stack; + + /* Take ownership to make sure that the registry won't be destructed too early. */ + std::shared_ptr used_registry; }; static thread_local ThreadLocalProfileData threadlocal_profile_data; @@ -75,23 +102,22 @@ static void stop_profiling() bli_profiling_is_enabled = false; } -static std::mutex listeners_mutex; -static RawVector listeners; - ProfileListener::ProfileListener() { - std::lock_guard lock{listeners_mutex}; - listeners.append(this); - if (listeners.size() == 1) { + std::lock_guard lock{ProfileRegistry::listeners_mutex}; + ensure_registry(); + registry->listeners.append(this); + if (registry->listeners.size() == 1) { start_profiling(); } } ProfileListener::~ProfileListener() { - std::lock_guard lock{listeners_mutex}; - listeners.remove_first_occurrence_and_reorder(this); - if (listeners.is_empty()) { + std::lock_guard lock{ProfileRegistry::listeners_mutex}; + ensure_registry(); + registry->listeners.remove_first_occurrence_and_reorder(this); + if (registry->listeners.is_empty()) { stop_profiling(); } } @@ -99,15 +125,18 @@ ProfileListener::~ProfileListener() void ProfileListener::flush_to_all() { /* Todo: How to handle short lived threads? */ - std::scoped_lock lock{listeners_mutex, registered_threadlocals_mutex}; + std::scoped_lock lock{ProfileRegistry::threadlocals_mutex, ProfileRegistry::listeners_mutex}; + if (!registry) { +return; + } RecordedProfile recorded_profile; - for (ThreadLocalProfileData *data : registered_threadlocals) { + for (ThreadLocalProfileData *data : registry->threadlocals) { data->queue_begins.consume( [&](Span data) { recorded_profile.task_begins.extend(data); }); data->queue_ends.consume( [&](Span data) { recorded_profile.task_ends.extend(data); }); } - for (ProfileListener *listener : listeners) { + for (ProfileListener *listener : registry->listeners) { listener->handle(recorded_profile); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b02635ae1b5] profiler-editor: fix
Commit: b02635ae1b5c582a213ad2ba6ff772f480dd831b Author: Jacques Lucke Date: Tue Apr 27 19:56:12 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBb02635ae1b5c582a213ad2ba6ff772f480dd831b fix === M source/blender/blenlib/BLI_profile.h M source/blender/blenlib/intern/profile.cc M source/blender/depsgraph/intern/eval/deg_eval.cc === diff --git a/source/blender/blenlib/BLI_profile.h b/source/blender/blenlib/BLI_profile.h index 595cd7e122b..f1cbac7b3f7 100644 --- a/source/blender/blenlib/BLI_profile.h +++ b/source/blender/blenlib/BLI_profile.h @@ -60,7 +60,7 @@ void _bli_profile_task_end(BLI_ProfileTask *task); ((void)0) #define BLI_profile_task_end(task_ptr) \ - if (bli_profiling_is_enabled && (task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \ + if ((task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \ _bli_profile_task_end(task_ptr); \ } \ ((void)0) diff --git a/source/blender/blenlib/intern/profile.cc b/source/blender/blenlib/intern/profile.cc index ac427ac3708..50c5e61306c 100644 --- a/source/blender/blenlib/intern/profile.cc +++ b/source/blender/blenlib/intern/profile.cc @@ -60,7 +60,7 @@ struct ThreadLocalProfileData { RawStack id_stack; }; -static ThreadLocalProfileData threadlocal_profile_data; +static thread_local ThreadLocalProfileData threadlocal_profile_data; bool bli_profiling_is_enabled = false; namespace blender::profile { @@ -140,7 +140,7 @@ void _bli_profile_task_begin_subtask(BLI_ProfileTask *task, ThreadLocalProfileData _data = threadlocal_profile_data; const uint64_t id = get_unique_session_id(); - const uint64_t parent_id = local_data.id_stack.peek_default(0); + const uint64_t parent_id = parent_task->id; local_data.id_stack.push(id); task->id = id; diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 620e86550cc..2b6727c67c1 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -29,6 +29,7 @@ #include "BLI_compiler_attrs.h" #include "BLI_gsqueue.h" +#include "BLI_profile.hh" #include "BLI_task.h" #include "BLI_utildefines.h" @@ -95,10 +96,13 @@ struct DepsgraphEvalState { bool do_stats; EvaluationStage stage; bool need_single_thread_pass; + BLI_ProfileTask profile_task; }; void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_node) { + BLI_PROFILE_SCOPE_SUBTASK(__func__, >profile_task); + ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph *>(state->graph); /* Sanity checks. */ @@ -379,6 +383,9 @@ void deg_evaluate_on_refresh(Depsgraph *graph) state.graph = graph; state.do_stats = graph->debug.do_time_debug(); state.need_single_thread_pass = false; + + BLI_profile_task_begin(_task, __func__); + /* Prepare all nodes for evaluation. */ initialize_execution(, graph); @@ -413,6 +420,8 @@ void deg_evaluate_on_refresh(Depsgraph *graph) graph->is_evaluating = false; graph->debug.end_graph_evaluation(); + + BLI_profile_task_end(_task); } } // namespace blender::deg ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [db7519d9c93] profiler-editor: profile nodes
Commit: db7519d9c93c9fb26ad08f9034537fd5bdbcb6f8 Author: Jacques Lucke Date: Wed Apr 28 10:01:35 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBdb7519d9c93c9fb26ad08f9034537fd5bdbcb6f8 profile nodes === M source/blender/modifiers/intern/MOD_nodes.cc === diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index cc8f4a544c0..1d5a6b1f126 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -30,6 +30,7 @@ #include "BLI_float3.hh" #include "BLI_listbase.h" #include "BLI_multi_value_map.hh" +#include "BLI_profile.hh" #include "BLI_set.hh" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -457,6 +458,7 @@ class GeometryNodesEvaluator { void execute_node(const DNode node, GeoNodeExecParams params) { +BLI_PROFILE_SCOPE(node->name().c_str()); const bNode = params.node(); /* Use the geometry-node-execute callback if it exists. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6951661dccc] profiler-editor: fix stack
Commit: 6951661dccc51d8c470f29c1977f413989ca14ad Author: Jacques Lucke Date: Tue Apr 27 18:19:16 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB6951661dccc51d8c470f29c1977f413989ca14ad fix stack === M source/blender/blenkernel/intern/DerivedMesh.cc M source/blender/blenlib/BLI_profile.h M source/blender/blenlib/intern/profile.cc M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/profiler_layout.cc === diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 474bfd0a4ee..f3c6d9f9687 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -924,7 +924,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md, Mesh *input_mesh, GeometrySet _set) { - BLI_PROFILE_SCOPE(__func__); + BLI_PROFILE_SCOPE(md->name); Mesh *mesh_output = nullptr; const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type); if (mti->modifyGeometrySet == nullptr) { diff --git a/source/blender/blenlib/BLI_profile.h b/source/blender/blenlib/BLI_profile.h index 5826c5c84da..595cd7e122b 100644 --- a/source/blender/blenlib/BLI_profile.h +++ b/source/blender/blenlib/BLI_profile.h @@ -28,6 +28,8 @@ typedef struct BLI_ProfileTask { uint64_t id; } BLI_ProfileTask; +#define BLI_PROFILE_DUMMY_ID (~0) + BLI_INLINE bool BLI_profile_is_enabled(void) { return bli_profiling_is_enabled; @@ -43,16 +45,22 @@ void _bli_profile_task_end(BLI_ProfileTask *task); if (bli_profiling_is_enabled) { \ _bli_profile_task_begin((task_ptr), (name)); \ } \ + else { \ +(task_ptr)->id = BLI_PROFILE_DUMMY_ID; \ + } \ ((void)0) #define BLI_profile_task_begin_subtask(task_ptr, name, parent_task) \ if (bli_profiling_is_enabled) { \ _bli_profile_task_begin_subtask((task_ptr), (name), (parent_task)); \ } \ + else { \ +(task_ptr)->id = BLI_PROFILE_DUMMY_ID; \ + } \ ((void)0) #define BLI_profile_task_end(task_ptr) \ - if (bli_profiling_is_enabled) { \ + if (bli_profiling_is_enabled && (task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \ _bli_profile_task_end(task_ptr); \ } \ ((void)0) diff --git a/source/blender/blenlib/intern/profile.cc b/source/blender/blenlib/intern/profile.cc index 9b265a61093..ac427ac3708 100644 --- a/source/blender/blenlib/intern/profile.cc +++ b/source/blender/blenlib/intern/profile.cc @@ -116,41 +116,56 @@ void ProfileListener::flush_to_all() void _bli_profile_task_begin(BLI_ProfileTask *task, const char *name) { - task->id = get_unique_session_id(); + ThreadLocalProfileData _data = threadlocal_profile_data; - ProfileTaskBegin *task_begin = threadlocal_profile_data.queue_begins.prepare_append(); - task_begin->id = task->id; + const uint64_t id = get_unique_session_id(); + const uint64_t parent_id = local_data.id_stack.peek_default(0); + local_data.id_stack.push(id); + task->id = id; + + ProfileTaskBegin *task_begin = local_data.queue_begins.prepare_append(); + task_begin->id = id; task_begin->name = name; - task_begin->parent_id = threadlocal_profile_data.id_stack.peek_default(0); - task_begin->thread_id = threadlocal_profile_data.thread_id; + task_begin->parent_id = parent_id; + task_begin->thread_id = local_data.thread_id; task_begin->time = Clock::now(); - threadlocal_profile_data.queue_begins.commit_append(); + local_data.queue_begins.commit_append(); } void _bli_profile_task_begin_subtask(BLI_ProfileTask *task, const char *name, const BLI_ProfileTask *parent_task) { - task->id = get_unique_session_id(); + ThreadLocalProfileData _data = threadlocal_profile_data; + + const uint64_t id = get_unique_session_id(); + const uint64_t parent_id = local_data.id_stack.peek_default(0); + local_data.id_stack.push(id); + task->id = id; - ProfileTaskBegin *task_begin = threadlocal_profile_data.queue_begins.prepare_append(); - task_begin->id = task->id; + ProfileTaskBegin *task_begin = local_data.queue_begins.prepare_append(); + task_begin->id = id; task_begin->name = name; - task_begin->parent_id = parent_task->id; - task_begin->thread_id = threadlocal_profile_data.thread_id; + task_begin->parent_id = parent_id; + task_begin->thread_id = local_data.thread_id; task_begin->time = Clock::now(); - threadlocal_profile_data.queue_begins.commit_append(); + local_data.queue_begins.commit_append(); } void _bli_profile_task_end(BLI_ProfileTask *task) { TimePoint time = Clock::now(); - ProfileTaskEnd *task_end = threadlocal_profile_data.queue_ends.prepare_append(); +
[Bf-blender-cvs] [4f6280f6b4f] profiler-editor: cleanup
Commit: 4f6280f6b4fce0033d33981469666c72132e6e93 Author: Jacques Lucke Date: Tue Apr 27 16:20:11 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB4f6280f6b4fce0033d33981469666c72132e6e93 cleanup === M source/blender/editors/space_profiler/profiler_layout.cc M source/blender/editors/space_profiler/profiler_layout.hh === diff --git a/source/blender/editors/space_profiler/profiler_layout.cc b/source/blender/editors/space_profiler/profiler_layout.cc index 6cb27e6b673..9dce6a7ba96 100644 --- a/source/blender/editors/space_profiler/profiler_layout.cc +++ b/source/blender/editors/space_profiler/profiler_layout.cc @@ -30,36 +30,14 @@ bool ProfileNode::time_overlap(const ProfileNode , const ProfileNode ) return begin_of_a_is_in_b || begin_of_b_is_in_a; } -void ProfileNode::pack_added_children() +template +static int try_pack_into_vector(Vector _nodes_vec, +MutableSpan sorted_nodes_to_pack, +const UseNodeF _node_fn) { - /* Sort new nodes by begin time. */ - std::sort(children_to_pack_.begin(), -children_to_pack_.end(), -[](ProfileNode *a, ProfileNode *b) { return a->begin_time() < b->begin_time(); }); - - /* Assume already packed children are sorted by begin time. */ int tot_newly_inserted = 0; - tot_newly_inserted += this->try_pack_into_vector(direct_children_, true); - - int iteration = 0; - while (tot_newly_inserted < children_to_pack_.size()) { -if (iteration == parallel_children_.size()) { - parallel_children_.append({}); -} -Vector _vec = parallel_children_[iteration]; -iteration++; -tot_newly_inserted += this->try_pack_into_vector(children_vec, false); - } - - children_to_pack_.clear(); -} - -int ProfileNode::try_pack_into_vector(Vector _vec, - bool ignore_other_thread_ids) -{ - int tot_newly_inserted = 0; - MutableSpan remaining_existing = nodes_vec; - MutableSpan remaining_new = children_to_pack_; + MutableSpan remaining_existing = sorted_nodes_vec; + MutableSpan remaining_new = sorted_nodes_to_pack; Vector new_vec; while (!remaining_new.is_empty()) { ProfileNode *new_child = remaining_new[0]; @@ -68,12 +46,9 @@ int ProfileNode::try_pack_into_vector(Vector _vec, remaining_new = remaining_new.drop_front(1); continue; } -if (ignore_other_thread_ids) { - if (new_child->thread_id_ != thread_id_) { -/* Child is ignored because it is in another thread. */ -remaining_new = remaining_new.drop_front(1); -continue; - } +if (!use_node_fn(*new_child)) { + remaining_new = remaining_new.drop_front(1); + continue; } while (true) { if (!new_vec.is_empty()) { @@ -93,20 +68,20 @@ int ProfileNode::try_pack_into_vector(Vector _vec, break; } ProfileNode *existing_child = remaining_existing[0]; - if (existing_child->end_time_ <= new_child->begin_time_) { + if (existing_child->end_time() <= new_child->begin_time()) { /* Existing child is completely before the new one. */ new_vec.append(existing_child); remaining_existing = remaining_existing.drop_front(1); continue; } - if (existing_child->begin_time_ < new_child->end_time_) { + if (existing_child->begin_time() < new_child->end_time()) { /* Existing child collides with the new child. */ new_vec.append(existing_child); remaining_existing = remaining_existing.drop_front(1); remaining_new = remaining_new.drop_front(1); break; } - if (new_child->end_time_ <= existing_child->begin_time_) { + if (new_child->end_time() <= existing_child->begin_time()) { /* New child can be added safely. */ new_vec.append(new_child); tot_newly_inserted++; @@ -117,10 +92,49 @@ int ProfileNode::try_pack_into_vector(Vector _vec, } } new_vec.extend(remaining_existing); - nodes_vec = std::move(new_vec); + sorted_nodes_vec = std::move(new_vec); return tot_newly_inserted; } +static void pack_into_vectors(Vector> _node_vectors, + MutableSpan sorted_nodes_to_pack) +{ + int tot_newly_inserted = 0; + + int iteration = 0; + while (tot_newly_inserted < sorted_nodes_to_pack.size()) { +if (iteration == sorted_node_vectors.size()) { + sorted_node_vectors.append({}); +} +Vector _vec = sorted_node_vectors[iteration]; +iteration++; +tot_newly_inserted += try_pack_into_vector( +children_vec, sorted_nodes_to_pack, [](ProfileNode (node)) { return true; }); + } +} + +static void sort_nodes_by_begin_time(MutableSpan nodes) +{ + std::sort(nodes.begin(), nodes.end(), [](ProfileNode *a, ProfileNode *b) { +return a->begin_time() <
[Bf-blender-cvs] [0523aab3fef] profiler-editor: make view2d work
Commit: 0523aab3fef96cbd09a30b47b14cb7b7d0ee6c58 Author: Jacques Lucke Date: Tue Apr 27 18:55:54 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB0523aab3fef96cbd09a30b47b14cb7b7d0ee6c58 make view2d work === M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/space_profiler.cc === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index b447bd649a4..27e6da4a97b 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -76,6 +76,19 @@ class ProfilerDrawer { this->draw_all_nodes(); UI_block_end(C, ui_block_); UI_block_draw(C, ui_block_); + +this->update_view2d_bounds(); + } + + void update_view2d_bounds() + { +const float duration_ms = this->duration_to_ms(profiler_layout_->end_time() - + profiler_layout_->begin_time()); +/* Giving a bit more space on the right side is convenient. */ +const float extended_duration_ms = std::max(duration_ms * 1.1f, 5000.0f); +UI_view2d_totRect_set(_->v2d, extended_duration_ms, 1); + +UI_view2d_scrollers_draw(_->v2d, nullptr); } void compute_vertical_extends_of_all_nodes() @@ -177,7 +190,7 @@ class ProfilerDrawer { const TimePoint begin_time = profiler_layout_->begin_time(); const Duration time_since_begin = time - begin_time; const float ms_since_begin = this->duration_to_ms(time_since_begin); -return ms_since_begin / 5.0f; +return UI_view2d_view_to_region_x(_->v2d, ms_since_begin); } Color4f get_node_color(ProfileNode ) diff --git a/source/blender/editors/space_profiler/space_profiler.cc b/source/blender/editors/space_profiler/space_profiler.cc index 9e21bde224d..bcb2a63c019 100644 --- a/source/blender/editors/space_profiler/space_profiler.cc +++ b/source/blender/editors/space_profiler/space_profiler.cc @@ -17,6 +17,7 @@ #include #include "BLI_listbase.h" +#include "BLI_rect.h" #include "BKE_screen.h" @@ -58,6 +59,18 @@ static SpaceLink *profiler_create(const ScrArea *UNUSED(area), const Scene *UNUS ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), "profiler main region"); BLI_addtail(>regionbase, region); region->regiontype = RGN_TYPE_WINDOW; + +View2D *v2d = >v2d; +v2d->scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM; +v2d->keepzoom = V2D_LOCKZOOM_Y; +v2d->keeptot = V2D_KEEPTOT_BOUNDS; +v2d->align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y; +v2d->min[0] = 0.0001f; +v2d->min[1] = 100.0f; +v2d->max[0] = 10.0f; +v2d->max[1] = 100.0f; +BLI_rctf_init(>tot, 0, 5000, -1, 0); +v2d->cur = v2d->tot; } return (SpaceLink *)sprofiler; @@ -89,8 +102,9 @@ static void profiler_keymap(wmKeyConfig *UNUSED(keyconf)) { } -static void profiler_main_region_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(region)) +static void profiler_main_region_init(wmWindowManager *UNUSED(wm), ARegion *region) { + UI_view2d_region_reinit(>v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy); } static void profiler_main_region_draw(const bContext *C, ARegion *region) @@ -157,7 +171,7 @@ void ED_spacetype_profiler(void) /* regions: main window */ art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype profiler region"); art->regionid = RGN_TYPE_WINDOW; - art->keymapflag = ED_KEYMAP_UI; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; art->init = profiler_main_region_init; art->draw = profiler_main_region_draw; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6cbeb7de8b0] profiler-editor: improve tooltip
Commit: 6cbeb7de8b029dd4c5c99d324625deeabdc980c7 Author: Jacques Lucke Date: Tue Apr 27 19:10:50 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB6cbeb7de8b029dd4c5c99d324625deeabdc980c7 improve tooltip === M source/blender/editors/space_profiler/profiler_draw.cc === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 27e6da4a97b..2e14369c753 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -82,8 +82,8 @@ class ProfilerDrawer { void update_view2d_bounds() { -const float duration_ms = this->duration_to_ms(profiler_layout_->end_time() - - profiler_layout_->begin_time()); +const float duration_ms = duration_to_ms(profiler_layout_->end_time() - + profiler_layout_->begin_time()); /* Giving a bit more space on the right side is convenient. */ const float extended_duration_ms = std::max(duration_ms * 1.1f, 5000.0f); UI_view2d_totRect_set(_->v2d, extended_duration_ms, 1); @@ -161,6 +161,10 @@ class ProfilerDrawer { } } + struct NodeTooltipArg { +ProfileNode *node; + }; + void draw_node_label(ProfileNode , const int left_x, const int right_x) { const int x = std::max(0, left_x); @@ -183,13 +187,27 @@ class ProfilerDrawer { nullptr); UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT); UI_but_drawflag_disable(but, UI_BUT_TEXT_RIGHT); + +UI_but_func_tooltip_set(but, +node_tooltip_fn, +new (MEM_mallocN(sizeof(NodeTooltipArg), __func__)) +NodeTooltipArg{}); + } + + static char *node_tooltip_fn(bContext *UNUSED(C), void *argN, const char *UNUSED(tip)) + { +NodeTooltipArg = *(NodeTooltipArg *)argN; +ProfileNode = *arg.node; +std::stringstream ss; +ss << "Duration: " << duration_to_ms(node.end_time() - node.begin_time()) << " ms"; +return BLI_strdup(ss.str().c_str()); } int time_to_x(const TimePoint time) const { const TimePoint begin_time = profiler_layout_->begin_time(); const Duration time_since_begin = time - begin_time; -const float ms_since_begin = this->duration_to_ms(time_since_begin); +const float ms_since_begin = duration_to_ms(time_since_begin); return UI_view2d_view_to_region_x(_->v2d, ms_since_begin); } @@ -202,7 +220,7 @@ class ProfilerDrawer { return {r, g, b, 1.0f}; } - float duration_to_ms(const Duration duration) const + static float duration_to_ms(const Duration duration) { return duration.count() / 100.0f; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ef2bec0db23] profiler-editor: support click to zoom
Commit: ef2bec0db2359311d58572fbc4574b088e384235 Author: Jacques Lucke Date: Tue Apr 27 19:22:42 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBef2bec0db2359311d58572fbc4574b088e384235 support click to zoom === M source/blender/editors/space_profiler/profiler_draw.cc === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 2e14369c753..1ae3de48690 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -192,6 +192,7 @@ class ProfilerDrawer { node_tooltip_fn, new (MEM_mallocN(sizeof(NodeTooltipArg), __func__)) NodeTooltipArg{}); +UI_but_func_set(but, node_click_fn, , profiler_layout_); } static char *node_tooltip_fn(bContext *UNUSED(C), void *argN, const char *UNUSED(tip)) @@ -203,6 +204,25 @@ class ProfilerDrawer { return BLI_strdup(ss.str().c_str()); } + static void node_click_fn(bContext *C, void *arg1, void *arg2) + { +ProfileNode = *(ProfileNode *)arg1; +ProfilerLayout _layout = *(ProfilerLayout *)arg2; + +ARegion *region = CTX_wm_region(C); + +const TimePoint begin_time = profiler_layout.begin_time(); +const float left_ms = duration_to_ms(node.begin_time() - begin_time); +const float right_ms = duration_to_ms(node.end_time() - begin_time); +const float duration_ms = right_ms - left_ms; +const float padding = duration_ms * 0.05f; + +rctf new_view; +BLI_rctf_init(_view, left_ms - padding, right_ms + padding, -1, 0); + +UI_view2d_smooth_view(C, region, _view, U.smooth_viewtx); + } + int time_to_x(const TimePoint time) const { const TimePoint begin_time = profiler_layout_->begin_time(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9ad17f6005d] profiler-editor: add ED_profiler.h
Commit: 9ad17f6005deda5d0ee86d5b56ecae470623496d Author: Jacques Lucke Date: Tue Apr 27 15:33:41 2021 +0200 Branches: profiler-editor https://developer.blender.org/rB9ad17f6005deda5d0ee86d5b56ecae470623496d add ED_profiler.h === A source/blender/editors/include/ED_profiler.h M source/blender/editors/space_profiler/CMakeLists.txt A source/blender/editors/space_profiler/profiler_profile.cc M source/blender/editors/util/CMakeLists.txt === diff --git a/source/blender/editors/include/ED_profiler.h b/source/blender/editors/include/ED_profiler.h new file mode 100644 index 000..2a0a8716d15 --- /dev/null +++ b/source/blender/editors/include/ED_profiler.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +/** \file + * \ingroup editors + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +struct SpaceProfiler; + +void ED_profiler_profile_enable(struct SpaceProfiler *sprofiler); +void ED_profiler_profile_disable(struct SpaceProfiler *sprofiler); +bool ED_profiler_profile_is_enabled(struct SpaceProfiler *sprofiler); +void ED_profiler_profile_clear(struct SpaceProfiler *sprofiler); + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/editors/space_profiler/CMakeLists.txt b/source/blender/editors/space_profiler/CMakeLists.txt index 9ac83285321..0353ac1d39f 100644 --- a/source/blender/editors/space_profiler/CMakeLists.txt +++ b/source/blender/editors/space_profiler/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC set(SRC profiler_layout.cc + profiler_profile.cc space_profiler.cc profiler_layout.hh diff --git a/source/blender/editors/space_profiler/profiler_profile.cc b/source/blender/editors/space_profiler/profiler_profile.cc new file mode 100644 index 000..1dcaf9bb460 --- /dev/null +++ b/source/blender/editors/space_profiler/profiler_profile.cc @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#include "ED_profiler.h" + +#include "DNA_space_types.h" + +#include "profiler_runtime.hh" + +void ED_profiler_profile_enable(SpaceProfiler *sprofiler) +{ + if (ED_profiler_profile_is_enabled(sprofiler)) { +return; + } + SpaceProfiler_Runtime = *sprofiler->runtime; + runtime.profile_listener = std::make_unique( + runtime); +} + +void ED_profiler_profile_disable(SpaceProfiler *sprofiler) +{ + if (!ED_profiler_profile_is_enabled(sprofiler)) { +return; + } + SpaceProfiler_Runtime = *sprofiler->runtime; + runtime.profile_listener.reset(); +} + +bool ED_profiler_profile_is_enabled(SpaceProfiler *sprofiler) +{ + SpaceProfiler_Runtime = *sprofiler->runtime; + return (bool)runtime.profile_listener; +} + +void ED_profiler_profile_clear(SpaceProfiler *sprofiler) +{ + SpaceProfiler_Runtime = *sprofiler->runtime; + runtime.profile_layout.reset(); +} diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 54ec6b22e70..b7262c875d3 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -77,6 +77,7 @@ set(SRC ../include/ED_paint.h ../include/ED_particle.h ../include/ED_physics.h + ../include/ED_profiler.h ../include/ED_render.h ../include/ED_scene.h ../include/ED_screen.h ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ddb21b01beb] profiler-editor: improve profiling
Commit: ddb21b01bebff18be34e7ad227b2ec765e930f19 Author: Jacques Lucke Date: Tue Apr 27 18:32:16 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBddb21b01bebff18be34e7ad227b2ec765e930f19 improve profiling === M source/blender/blenkernel/intern/DerivedMesh.cc M source/blender/editors/space_profiler/profiler_draw.cc === diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index f3c6d9f9687..238d4f961e5 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -1218,6 +1218,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, } BKE_mesh_vert_coords_apply(mesh_final, deformed_verts); } + BLI_PROFILE_SCOPE(md->name); BKE_modifier_deform_verts(md, , mesh_final, deformed_verts, num_deformed_verts); } else { @@ -1694,6 +1695,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, BKE_mesh_vert_coords_apply(mesh_final, deformed_verts); } + BLI_PROFILE_SCOPE(md->name); if (mti->deformVertsEM) { BKE_modifier_deform_vertsEM( md, , em_input, mesh_final, deformed_verts, num_deformed_verts); diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 7bad79d28e8..b447bd649a4 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -136,7 +136,7 @@ class ProfilerDrawer { const int left_x = this->time_to_x(node.begin_time()); const int right_x = std::max(left_x + 1, this->time_to_x(node.end_time())); -immRecti(pos, left_x, node.top_y, right_x, node.bottom_y); +immRecti(pos, left_x, node.top_y, right_x, node.top_y - row_height_); immUnbindProgram(); @@ -154,7 +154,7 @@ class ProfilerDrawer { const int width = std::max(1, std::min(right_x, region_->winx) - x); uiBut *but = uiDefIconTextBut(ui_block_, - UI_BTYPE_LABEL, + UI_BTYPE_BUT, 0, ICON_NONE, node.name().c_str(), ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e13a3896d1b] profiler-editor: compute vertical extends
Commit: e13a3896d1b95461a3aaaf4ae18eaa5d67d96358 Author: Jacques Lucke Date: Tue Apr 27 17:14:44 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBe13a3896d1b95461a3aaaf4ae18eaa5d67d96358 compute vertical extends === M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/profiler_layout.hh M source/blender/editors/space_profiler/space_profiler.cc === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 6957461f129..00dde364304 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -41,6 +41,8 @@ class ProfilerDrawer { SpaceProfiler *sprofiler_; SpaceProfiler_Runtime *runtime_; ProfilerLayout *profiler_layout_; + int row_height_; + int parallel_padding_; public: ProfilerDrawer(const bContext *C, ARegion *region) : C(C), region_(region) @@ -53,11 +55,45 @@ class ProfilerDrawer { } profile::ProfileListener::flush_to_all(); profiler_layout_ = runtime_->profiler_layout.get(); + +row_height_ = UI_UNIT_Y; +parallel_padding_ = UI_UNIT_Y * 0.2f; } void draw() { UI_ThemeClearColor(TH_BACK); +this->compute_vertical_extends_of_all_nodes(); + } + + void compute_vertical_extends_of_all_nodes() + { +int top_y = region_->winy; +for (Span nodes : profiler_layout_->root_nodes()) { + top_y = this->compute_vertical_extends_of_nodes(nodes, top_y); + top_y -= parallel_padding_; +} + } + + float compute_vertical_extends_of_nodes(Span nodes, const float top_y) + { +int bottom_y = top_y; +for (ProfileNode *node : nodes) { + node->top_y = top_y; + this->compute_vertical_extends_of_node(*node); + bottom_y = std::min(bottom_y, node->bottom_y); +} +return bottom_y; + } + + void compute_vertical_extends_of_node(ProfileNode ) + { +node.bottom_y = node.top_y - row_height_; +node.bottom_y = this->compute_vertical_extends_of_nodes(node.direct_children(), node.bottom_y); +for (Span children : node.parallel_children()) { + node.bottom_y -= parallel_padding_; + node.bottom_y = this->compute_vertical_extends_of_nodes(children, node.bottom_y); +} } }; diff --git a/source/blender/editors/space_profiler/profiler_layout.hh b/source/blender/editors/space_profiler/profiler_layout.hh index 7f8c375b73f..57a91d15e40 100644 --- a/source/blender/editors/space_profiler/profiler_layout.hh +++ b/source/blender/editors/space_profiler/profiler_layout.hh @@ -45,11 +45,12 @@ class ProfileNode { /* These nodes still have to be inserted into the vectors above. They are not sorted. */ Vector children_to_pack_; + friend ProfilerLayout; + + public: int top_y; int bottom_y; - friend ProfilerLayout; - public: StringRefNull name() const { @@ -81,12 +82,12 @@ class ProfileNode { return thread_id_; } - Span children_on_same_thread() const + Span direct_children() { return direct_children_; } - Span> stacked_children_in_other_threads() const + Span> parallel_children() const { return parallel_children_; } diff --git a/source/blender/editors/space_profiler/space_profiler.cc b/source/blender/editors/space_profiler/space_profiler.cc index 32d980ea5e2..9e21bde224d 100644 --- a/source/blender/editors/space_profiler/space_profiler.cc +++ b/source/blender/editors/space_profiler/space_profiler.cc @@ -63,8 +63,10 @@ static SpaceLink *profiler_create(const ScrArea *UNUSED(area), const Scene *UNUS return (SpaceLink *)sprofiler; } -static void profiler_free(SpaceLink *UNUSED(sl)) +static void profiler_free(SpaceLink *sl) { + SpaceProfiler *sprofiler = (SpaceProfiler *)sl; + delete sprofiler->runtime; } static void profiler_init(wmWindowManager *UNUSED(wm), ScrArea *area) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f5594400148] profiler-editor: cleanup
Commit: f55944001480a6690aba40ccdbf23583cd4d790a Author: Jacques Lucke Date: Tue Apr 27 16:33:45 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBf55944001480a6690aba40ccdbf23583cd4d790a cleanup === M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/profiler_layout.cc M source/blender/editors/space_profiler/profiler_layout.hh M source/blender/editors/space_profiler/profiler_profile.cc M source/blender/editors/space_profiler/profiler_runtime.cc M source/blender/editors/space_profiler/profiler_runtime.hh === diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 8a496026092..ae40f963adf 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -29,6 +29,7 @@ #include "BLI_rect.h" #include "profiler_draw.hh" +#include "profiler_layout.hh" #include "profiler_runtime.hh" namespace blender::ed::profiler { @@ -36,6 +37,13 @@ namespace blender::ed::profiler { void draw_profiler(const bContext *C, ARegion *region) { SpaceProfiler *sprofiler = CTX_wm_space_profiler(C); + SpaceProfiler_Runtime = *sprofiler->runtime; + + if (!runtime.profiler_layout) { +runtime.profiler_layout = std::make_unique(); + } + ProfilerLayout _layout = *runtime.profiler_layout; + std::cout << profiler_layout.root_nodes().size() << "\n"; UI_ThemeClearColor(TH_BACK); } diff --git a/source/blender/editors/space_profiler/profiler_layout.cc b/source/blender/editors/space_profiler/profiler_layout.cc index 9dce6a7ba96..ec816e7d86b 100644 --- a/source/blender/editors/space_profiler/profiler_layout.cc +++ b/source/blender/editors/space_profiler/profiler_layout.cc @@ -135,7 +135,7 @@ void ProfileNode::pack_added_children() children_to_pack_.clear(); } -void ProfileLayout::add(const RecordedProfile _profile) +void ProfilerLayout::add(const RecordedProfile _profile) { /* Create new nodes for segments and add them to the id map. */ for (const ProfileTaskBegin _begin : recorded_profile.task_begins) { @@ -222,7 +222,7 @@ void ProfileNode::destruct_recursively() this->~ProfileNode(); } -ProfileLayout::~ProfileLayout() +ProfilerLayout::~ProfilerLayout() { for (Span nodes : root_nodes_) { for (ProfileNode *node : nodes) { diff --git a/source/blender/editors/space_profiler/profiler_layout.hh b/source/blender/editors/space_profiler/profiler_layout.hh index 43b442cd40e..7f8c375b73f 100644 --- a/source/blender/editors/space_profiler/profiler_layout.hh +++ b/source/blender/editors/space_profiler/profiler_layout.hh @@ -26,7 +26,7 @@ namespace blender::ed::profiler { using profile::RecordedProfile; using profile::TimePoint; -class ProfileLayout; +class ProfilerLayout; class ProfileNode { private: @@ -45,7 +45,10 @@ class ProfileNode { /* These nodes still have to be inserted into the vectors above. They are not sorted. */ Vector children_to_pack_; - friend ProfileLayout; + int top_y; + int bottom_y; + + friend ProfilerLayout; public: StringRefNull name() const @@ -96,7 +99,7 @@ class ProfileNode { void destruct_recursively(); }; -class ProfileLayout { +class ProfilerLayout { private: LinearAllocator<> allocator_; @@ -107,7 +110,7 @@ class ProfileLayout { TimePoint end_time_; public: - ~ProfileLayout(); + ~ProfilerLayout(); void add(const RecordedProfile ); diff --git a/source/blender/editors/space_profiler/profiler_profile.cc b/source/blender/editors/space_profiler/profiler_profile.cc index 1dcaf9bb460..5019577e4fe 100644 --- a/source/blender/editors/space_profiler/profiler_profile.cc +++ b/source/blender/editors/space_profiler/profiler_profile.cc @@ -48,5 +48,5 @@ bool ED_profiler_profile_is_enabled(SpaceProfiler *sprofiler) void ED_profiler_profile_clear(SpaceProfiler *sprofiler) { SpaceProfiler_Runtime = *sprofiler->runtime; - runtime.profile_layout.reset(); + runtime.profiler_layout.reset(); } diff --git a/source/blender/editors/space_profiler/profiler_runtime.cc b/source/blender/editors/space_profiler/profiler_runtime.cc index 9e3361828f2..27de77ce732 100644 --- a/source/blender/editors/space_profiler/profiler_runtime.cc +++ b/source/blender/editors/space_profiler/profiler_runtime.cc @@ -24,11 +24,11 @@ SpaceProfilerListener::SpaceProfilerListener(SpaceProfiler_Runtime ) : r void SpaceProfilerListener::handle(const RecordedProfile ) { - if (!runtime_->profile_layout) { -runtime_->profile_layout = std::make_unique(); + if (!runtime_->profiler_layout) { +runtime_->profiler_layout = std::make_unique(); } - ProfileLayout _layout = *runtime_->profile_layout; - profile_layout.add(profile); + ProfilerLayout _layout =