[Bf-blender-cvs] [2003509217e] temp-gpencil-bezier-stroke-type: GPencil: Update the polyline when sculpting
Commit: 2003509217ee36a39d98a64b8da5dda88f187a3c Author: Falk David Date: Thu Apr 29 16:48:11 2021 +0200 Branches: temp-gpencil-bezier-stroke-type https://developer.blender.org/rB2003509217ee36a39d98a64b8da5dda88f187a3c GPencil: Update the polyline when sculpting === M source/blender/editors/gpencil/gpencil_sculpt_paint.c === diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 6eda7f481c1..53187f4d087 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -305,7 +305,8 @@ static void gpencil_update_geometry(bGPdata *gpd) LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { if (gps->flag & GP_STROKE_TAG) { - BKE_gpencil_stroke_geometry_update(gpd, gps, GP_GEO_UPDATE_CURVE_REFIT_ALL); + BKE_gpencil_stroke_geometry_update( + gpd, gps, GP_GEO_UPDATE_CURVE_REFIT_ALL | GP_GEO_UPDATE_POLYLINE_REGENERATE_ALL); gps->flag &= ~GP_STROKE_TAG; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1cb31e54ef7] temp-gpencil-bezier-stroke-type: GPencil: Free polyline weights before regenerate
Commit: 1cb31e54ef716dfbac4445ab82b1aef897a4a0e5 Author: Falk David Date: Thu Apr 29 16:47:58 2021 +0200 Branches: temp-gpencil-bezier-stroke-type https://developer.blender.org/rB1cb31e54ef716dfbac4445ab82b1aef897a4a0e5 GPencil: Free polyline weights before regenerate === M source/blender/blenkernel/intern/gpencil_curve.c === diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c index f441c578de4..82c890f5680 100644 --- a/source/blender/blenkernel/intern/gpencil_curve.c +++ b/source/blender/blenkernel/intern/gpencil_curve.c @@ -1622,6 +1622,9 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps, return; } + /* We have to free all of the old weight data and replace it completely. */ + BKE_gpencil_free_stroke_weights(gps); + /* resize stroke point array */ gps->totpoints = points_len; gps->points = MEM_recallocN(gps->points, sizeof(bGPDspoint) * gps->totpoints); @@ -1657,7 +1660,7 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps, /* Interpolate weights. */ if (gpc->dvert != NULL && (update_all_attributes || (flag & GP_GEO_UPDATE_POLYLINE_WEIGHT))) { -gps->dvert = MEM_recallocN(gps->dvert, sizeof(MDeformVert) * gps->totpoints); +gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, __func__); idx = 0; for (int i = 0; i < gpc->tot_curve_points - 1; i++) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2b723abea02] master: Object: improve on fix for Object.to_mesh() crash T86871
Commit: 2b723abea02c868d94623f4dd9e9b6775cb3aaab Author: Campbell Barton Date: Fri Apr 30 16:22:51 2021 +1000 Branches: master https://developer.blender.org/rB2b723abea02c868d94623f4dd9e9b6775cb3aaab Object: improve on fix for Object.to_mesh() crash T86871 While fa7ddd0f43ea15dd19d81e7808de2bfe8cfc89ee fixed the reported issue, the possibility of reusing runtime data during curve-to-mesh conversion remained. Instead of treating the bounding-box as a special case, clear all run-time data for temporary objects. Ref D11026 Reviewed By: sergey === M source/blender/blenkernel/BKE_object.h M source/blender/blenkernel/intern/mesh_convert.c M source/blender/blenkernel/intern/object.c === diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 9fe286df36d..c5eae586e9c 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -374,6 +374,7 @@ struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, void BKE_object_runtime_reset(struct Object *object); void BKE_object_runtime_reset_on_copy(struct Object *object, const int flag); +void BKE_object_runtime_free(struct Object *object); void BKE_object_batch_cache_dirty_tag(struct Object *ob); diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 1ec3b6a1cbf..e03a5f03fb5 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -1027,11 +1027,15 @@ static Object *object_for_curve_to_mesh_create(Object *object) * * Note that there are extra fields in there like bevel and path, but those are not needed during * conversion, so they are not copied to save unnecessary allocations. */ - if (object->runtime.curve_cache != NULL) { + if (temp_object->runtime.curve_cache == NULL) { temp_object->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for curve types"); + } + + if (object->runtime.curve_cache != NULL) { BKE_displist_copy(&temp_object->runtime.curve_cache->disp, &object->runtime.curve_cache->disp); } + /* Constructive modifiers will use mesh to store result. */ if (object->runtime.data_eval != NULL) { BKE_id_copy_ex( @@ -1059,15 +1063,17 @@ static Object *object_for_curve_to_mesh_create(Object *object) static void curve_to_mesh_eval_ensure(Object *object) { - if (object->runtime.curve_cache == NULL) { -object->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); - } Curve *curve = (Curve *)object->data; Curve remapped_curve = *curve; Object remapped_object = *object; - remapped_object.runtime.bb = NULL; + BKE_object_runtime_reset(&remapped_object); + remapped_object.data = &remapped_curve; + if (remapped_object.runtime.curve_cache == NULL) { +remapped_object.runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); + } + /* Clear all modifiers for the bevel object. * * This is because they can not be reliably evaluated for an original object (at least because @@ -1078,8 +1084,8 @@ static void curve_to_mesh_eval_ensure(Object *object) Object bevel_object = {{NULL}}; if (remapped_curve.bevobj != NULL) { bevel_object = *remapped_curve.bevobj; -bevel_object.runtime.bb = NULL; BLI_listbase_clear(&bevel_object.modifiers); +BKE_object_runtime_reset(&bevel_object); remapped_curve.bevobj = &bevel_object; } @@ -1087,8 +1093,8 @@ static void curve_to_mesh_eval_ensure(Object *object) Object taper_object = {{NULL}}; if (remapped_curve.taperobj != NULL) { taper_object = *remapped_curve.taperobj; -taper_object.runtime.bb = NULL; BLI_listbase_clear(&taper_object.modifiers); +BKE_object_runtime_reset(&taper_object); remapped_curve.taperobj = &taper_object; } @@ -1110,12 +1116,9 @@ static void curve_to_mesh_eval_ensure(Object *object) BKE_object_eval_assign_data(&remapped_object, &mesh_eval->id, true); } - MEM_SAFE_FREE(remapped_object.runtime.bb); - MEM_SAFE_FREE(taper_object.runtime.bb); - MEM_SAFE_FREE(bevel_object.runtime.bb); - - BKE_object_free_curve_cache(&bevel_object); - BKE_object_free_curve_cache(&taper_object); + BKE_object_runtime_free(&remapped_object); + BKE_object_runtime_free(&taper_object); + BKE_object_runtime_free(&taper_object); } static Mesh *mesh_new_from_curve_type_object(Object *object) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 82d99e980a4..912bd5a4d69 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -5113,6 +5113,17 @@ void BKE_object_runtime_reset_on_copy(Object *object, const in
[Bf-blender-cvs] [4d7d1b5daea] master: Cleanup: comments in BMesh bisect, use doxygen sections
Commit: 4d7d1b5daea94bbdddf40e4bb4b93506580ce06b Author: Campbell Barton Date: Fri Apr 30 15:49:33 2021 +1000 Branches: master https://developer.blender.org/rB4d7d1b5daea94bbdddf40e4bb4b93506580ce06b Cleanup: comments in BMesh bisect, use doxygen sections === 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 f840a3770ff..e7d0fe6a0c6 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -39,12 +39,13 @@ #include "BLI_utildefines_stack.h" #include "bmesh.h" -#include "bmesh_bisect_plane.h" /* own include */ +#include "bmesh_bisect_plane.h" /* Own include. */ -#include "BLI_strict_flags.h" /* keep last */ +#include "BLI_strict_flags.h" /* Keep last. */ /* */ -/* Math utils */ +/** \name Math Functions + * \{ */ static short plane_point_test_v3(const float plane[4], const float co[3], @@ -63,10 +64,15 @@ static short plane_point_test_v3(const float plane[4], return 0; } +/** \} */ + /* */ -/* Wrappers to hide internal data-structure abuse, +/** \name BMesh Element Accessors + * + * Wrappers to hide internal data-structure abuse, * later we may want to move this into some hash lookup - * to a separate struct, but for now we can store in BMesh data */ + * to a separate struct, but for now we can store in #BMesh data. + * \{ */ #define BM_VERT_DIR(v) ((short *)(&(v)->head.index))[0] /* Direction -1/0/1 */ #define BM_VERT_SKIP(v) ((short *)(&(v)->head.index))[1] /* Skip Vert 0/1 */ @@ -75,12 +81,16 @@ static short plane_point_test_v3(const float plane[4], #define BM_VERT_LOOPINDEX(v) /* The verts index within a face (temp var) */ \ (*((uint *)(&(v)->no[2]))) -/** +/** \} */ + +/* */ +/** \name BMesh Flag Accessors + * * Hide flag access - * (for more readable code since same flag is used differently for vert/edgeface)... + * (for more readable code since same flag is used differently for vert/edge-face). */ -/* enable when vertex is in the center and its faces have been added to the stack */ +/** Enable when vertex is in the center and its faces have been added to the stack. */ BLI_INLINE void vert_is_center_enable(BMVert *v) { BM_elem_flag_enable(v, BM_ELEM_TAG); @@ -100,7 +110,7 @@ BLI_INLINE bool vert_pair_adjacent_in_orig_face(BMVert *v_a, BMVert *v_b, const return ELEM(delta, 1, (uint)(f_len_orig - 1)); } -/* enable when the edge can be cut */ +/** Enable when the edge can be cut. */ BLI_INLINE void edge_is_cut_enable(BMEdge *e) { BM_elem_flag_enable(e, BM_ELEM_TAG); @@ -114,7 +124,7 @@ BLI_INLINE bool edge_is_cut_test(BMEdge *e) return (BM_elem_flag_test(e, BM_ELEM_TAG) != 0); } -/* enable when the faces are added to the stack */ +/** Enable when the faces are added to the stack. */ BLI_INLINE void face_in_stack_enable(BMFace *f) { BM_elem_flag_disable(f, BM_ELEM_TAG); @@ -128,8 +138,11 @@ BLI_INLINE bool face_in_stack_test(BMFace *f) return (BM_elem_flag_test(f, BM_ELEM_TAG) == 0); } +/** \} */ + /* */ -/* BMesh utils */ +/** \name BMesh Face Bisect + * \{ */ static int bm_vert_sortval_cb(const void *v_a_v, const void *v_b_v) { @@ -148,7 +161,7 @@ static int bm_vert_sortval_cb(const void *v_a_v, const void *v_b_v) static void bm_face_bisect_verts( BMesh *bm, BMFace *f, const float plane[4], const short oflag_center, const short oflag_new) { - /* unlikely more than 2 verts are needed */ + /* Unlikely more than 2 verts are needed. */ const uint f_len_orig = (uint)f->len; BMVert **vert_split_arr = BLI_array_alloca(vert_split_arr, f_len_orig); STACK_DECLARE(vert_split_arr); @@ -163,16 +176,14 @@ static void bm_face_bisect_verts( l_first = BM_FACE_FIRST_LOOP(f); - /* add plane-aligned verts to the stack - * and check we have verts from both sides in this face, - * ... that the face doesn't only have boundary verts on the plane for eg. */ + /* Add plane-aligned verts to the stack and check we have verts from both sides in this face + * (that the face doesn't only have boundary verts on the plane for eg). */ l_iter = l_first; do { if (vert_is_center_test(l_iter->v)) { BLI_assert(BM_VERT_DIR(l_iter->v) == 0); - /* if both are -1 or 1, or both are zero: - * don't flip 'inside' var while walking */ + /* If both are -1 or 1, or both are zero: don't flip 'inside' var while walking. */ BM_VERT_SKIP(l_iter->v) = (((BM_VERT_DIR(l_iter->pre
[Bf-blender-cvs] [ea17a92cd70] master: Cleanup: interface_intern.h doc-strings
Commit: ea17a92cd7040c0d63a4ed3a8a60cd8f0a3cb77e Author: Campbell Barton Date: Fri Apr 30 16:15:22 2021 +1000 Branches: master https://developer.blender.org/rBea17a92cd7040c0d63a4ed3a8a60cd8f0a3cb77e Cleanup: interface_intern.h doc-strings Also clarify some vague comments & add doxygen section for menu-memory. === M source/blender/editors/interface/interface_intern.h M source/blender/editors/interface/interface_region_menu_popup.c === diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 0e465be5bf6..333dc1beb22 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -62,7 +62,7 @@ struct wmTimer; #define UI_MENU_PADDING (int)(0.2f * UI_UNIT_Y) #define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9) -/* some extra padding added to menus containing submenu icons */ +/** Some extra padding added to menus containing sub-menu icons. */ #define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC) /* menu scrolling */ @@ -74,7 +74,7 @@ struct wmTimer; #define UI_PANEL_MINX 100 #define UI_PANEL_MINY 70 -/* popover width (multiplied by 'U.widget_unit') */ +/** Popover width (multiplied by #U.widget_unit) */ #define UI_POPOVER_WIDTH_UNITS 10 /** #uiBut.flag */ @@ -93,12 +93,12 @@ enum { /* WARNING: rest of #uiBut.flag in UI_interface.h */ }; -/* uiBut->dragflag */ +/** #uiBut.dragflag */ enum { UI_BUT_DRAGPOIN_FREE = (1 << 0), }; -/* but->pie_dir */ +/** #uiBut.pie_dir */ typedef enum RadialDirection { UI_RADIAL_NONE = -1, UI_RADIAL_N = 0, @@ -129,13 +129,13 @@ extern const short ui_radial_dir_to_angle[8]; #define UI_BITBUT_ROW(min, max) \ (((max) >= 31 ? 0x : (1 << ((max) + 1)) - 1) - ((min) ? ((1 << (min)) - 1) : 0)) -/* split numbuts by ':' and align l/r */ +/** Split number-buttons by ':' and align left/right. */ #define USE_NUMBUTS_LR_ALIGN -/* Use new 'align' computation code. */ +/** Use new 'align' computation code. */ #define USE_UIBUT_SPATIAL_ALIGN -/* PieMenuData->flags */ +/** #PieMenuData.flags */ enum { /** pie menu item collision is detected at 90 degrees */ UI_PIE_DEGREES_RANGE_LARGE = (1 << 0), @@ -155,13 +155,13 @@ enum { #define PIE_CLICK_THRESHOLD_SQ 50.0f -/* max amount of items a radial menu (pie menu) can contain */ +/** The maximum number of items a radial menu (pie menu) can contain. */ #define PIE_MAX_ITEMS 8 struct uiBut { struct uiBut *next, *prev; - /* Pointer back to the layout item holding this button. */ + /** Pointer back to the layout item holding this button. */ uiLayout *layout; int flag, drawflag; eButType type; @@ -238,10 +238,10 @@ struct uiBut { short modifier_key; short iconadd; - /* UI_BTYPE_BLOCK data */ + /** #UI_BTYPE_BLOCK data */ uiBlockCreateFunc block_create_func; - /* UI_BTYPE_PULLDOWN/UI_BTYPE_MENU data */ + /** #UI_BTYPE_PULLDOWN / #UI_BTYPE_MENU data */ uiMenuCreateFunc menu_create_func; uiMenuStepFunc menu_step_func; @@ -255,9 +255,11 @@ struct uiBut { struct wmOperatorType *optype; struct PointerRNA *opptr; short opcontext; - uchar menu_key; /* 'a'-'z', always lower case */ - ListBase extra_op_icons; /* uiButExtraOpIcon */ + /** When non-zero, this is the key used to activate a menu items (`a-z` always lower case). */ + uchar menu_key; + + ListBase extra_op_icons; /** #uiButExtraOpIcon */ /* Draggable data, type is WM_DRAG_... */ char dragtype; @@ -266,10 +268,10 @@ struct uiBut { struct ImBuf *imb; float imb_scale; - /* active button data */ + /** Active button data (set when the user is hovering or interacting with a button). */ struct uiHandleButtonData *active; - /* Custom button data. */ + /** Custom button data (borrowed, not owned). */ void *custom_data; char *editstr; @@ -432,7 +434,7 @@ struct PieMenuData { float alphafac; }; -/* uiBlock.content_hints */ +/** #uiBlock.content_hints */ enum eBlockContentHints { /** In a menu block, if there is a single sub-menu button, we add some * padding to the right to put nicely aligned triangle icons there. */ @@ -466,7 +468,8 @@ struct uiBlock { struct Panel *panel; uiBlock *oldblock; - ListBase butstore; /* UI_butstore_* runtime function */ + /** Used for `UI_butstore_*` runtime function. */ + ListBase butstore; ListBase button_groups; /* #uiButtonGroup. */ @@ -482,7 +485,8 @@ struct uiBlock { rctf rect; float aspect; - uint puphash; /* popup menu hash for memory */ + /** Unique hash used to implement popup menu memory. */ + uint puphash; uiButHandleFunc func; void *func_arg1; @@ -497,10 +501,10 @@ struct uiBlock { uiBlockHandleFunc handle_func; void *handle_func_arg; - /* custom extra handling */ + /** Custom extra event handling.
[Bf-blender-cvs] [0dde73b4fcb] master: Cleanup: use early return in edittranslation_exec
Commit: 0dde73b4fcb16fb18cfc674d627a6094e6e57d4a Author: Campbell Barton Date: Fri Apr 30 15:26:17 2021 +1000 Branches: master https://developer.blender.org/rB0dde73b4fcb16fb18cfc674d627a6094e6e57d4a Cleanup: use early return in edittranslation_exec === M source/blender/editors/interface/interface_ops.c === diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 1fb7a931c08..0cf3ad59903 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1495,117 +1495,115 @@ static void edittranslation_find_po_file(const char *root, static int edittranslation_exec(bContext *C, wmOperator *op) { uiBut *but = UI_context_active_but_get(C); - int ret = OPERATOR_CANCELLED; - - if (but) { -wmOperatorType *ot; -PointerRNA ptr; -char popath[FILE_MAX]; -const char *root = U.i18ndir; -const char *uilng = BLT_lang_get(); - -uiStringInfo but_label = {BUT_GET_LABEL, NULL}; -uiStringInfo rna_label = {BUT_GET_RNA_LABEL, NULL}; -uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL}; -uiStringInfo but_tip = {BUT_GET_TIP, NULL}; -uiStringInfo rna_tip = {BUT_GET_RNA_TIP, NULL}; -uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL}; -uiStringInfo rna_struct = {BUT_GET_RNASTRUCT_IDENTIFIER, NULL}; -uiStringInfo rna_prop = {BUT_GET_RNAPROP_IDENTIFIER, NULL}; -uiStringInfo rna_enum = {BUT_GET_RNAENUM_IDENTIFIER, NULL}; -uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL}; - -if (!BLI_is_dir(root)) { - BKE_report(op->reports, - RPT_ERROR, - "Please set your Preferences' 'Translation Branches " - "Directory' path to a valid directory"); - return OPERATOR_CANCELLED; -} -ot = WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0); -if (ot == NULL) { - BKE_reportf(op->reports, - RPT_ERROR, - "Could not find operator '%s'! Please enable ui_translate add-on " - "in the User Preferences", - EDTSRC_I18N_OP_NAME); - return OPERATOR_CANCELLED; -} -/* Try to find a valid po file for current language... */ -edittranslation_find_po_file(root, uilng, popath, FILE_MAX); -/* printf("po path: %s\n", popath); */ -if (popath[0] == '\0') { - BKE_reportf( - op->reports, RPT_ERROR, "No valid po found for language '%s' under %s", uilng, root); - return OPERATOR_CANCELLED; -} - -UI_but_string_info_get(C, - but, - &but_label, - &rna_label, - &enum_label, - &but_tip, - &rna_tip, - &enum_tip, - &rna_struct, - &rna_prop, - &rna_enum, - &rna_ctxt, - NULL); - -WM_operator_properties_create_ptr(&ptr, ot); -RNA_string_set(&ptr, "lang", uilng); -RNA_string_set(&ptr, "po_file", popath); -RNA_string_set(&ptr, "but_label", but_label.strinfo); -RNA_string_set(&ptr, "rna_label", rna_label.strinfo); -RNA_string_set(&ptr, "enum_label", enum_label.strinfo); -RNA_string_set(&ptr, "but_tip", but_tip.strinfo); -RNA_string_set(&ptr, "rna_tip", rna_tip.strinfo); -RNA_string_set(&ptr, "enum_tip", enum_tip.strinfo); -RNA_string_set(&ptr, "rna_struct", rna_struct.strinfo); -RNA_string_set(&ptr, "rna_prop", rna_prop.strinfo); -RNA_string_set(&ptr, "rna_enum", rna_enum.strinfo); -RNA_string_set(&ptr, "rna_ctxt", rna_ctxt.strinfo); -ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr); - -/* Clean up */ -if (but_label.strinfo) { - MEM_freeN(but_label.strinfo); -} -if (rna_label.strinfo) { - MEM_freeN(rna_label.strinfo); -} -if (enum_label.strinfo) { - MEM_freeN(enum_label.strinfo); -} -if (but_tip.strinfo) { - MEM_freeN(but_tip.strinfo); -} -if (rna_tip.strinfo) { - MEM_freeN(rna_tip.strinfo); -} -if (enum_tip.strinfo) { - MEM_freeN(enum_tip.strinfo); -} -if (rna_struct.strinfo) { - MEM_freeN(rna_struct.strinfo); -} -if (rna_prop.strinfo) { - MEM_freeN(rna_prop.strinfo); -} -if (rna_enum.strinfo) { - MEM_freeN(rna_enum.strinfo); -} -if (rna_ctxt.strinfo) { - MEM_freeN(rna_ctxt.strinfo); -} + if (but == NULL) { +BKE_report(op->reports, RPT_ERROR, "Active button not found"); +return OPERATOR_CANCELLED; + } -return ret; + wmOperatorType *ot; + PointerRNA ptr; + char popath[FILE_MAX]; + const char *root = U.i18ndir; + const char *uilng = BLT_la
[Bf-blender-cvs] [c51720a6add] master: Cleanup: rename BKE_pose_channel_{verify => ensure}
Commit: c51720a6add99a728c3784a5ff507a619e797316 Author: Campbell Barton Date: Fri Apr 30 15:30:41 2021 +1000 Branches: master https://developer.blender.org/rBc51720a6add99a728c3784a5ff507a619e797316 Cleanup: rename BKE_pose_channel_{verify => ensure} The term `verify` doesn't fit with what this function does and is sometimes used to check data is valid or to control validity checking as with `RNA_define_verify_sdna`. use more common term `ensure`. === M source/blender/blenkernel/BKE_action.h M source/blender/blenkernel/intern/action.c M source/blender/blenkernel/intern/armature.c M source/blender/blenkernel/intern/constraint.c M source/blender/editors/armature/armature_add.c === diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index e9ac865cfd2..3d81fcba37d 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -161,7 +161,7 @@ void BKE_pose_channel_session_uuid_generate(struct bPoseChannel *pchan); struct bPoseChannel *BKE_pose_channel_find_name(const struct bPose *pose, const char *name); struct bPoseChannel *BKE_pose_channel_active(struct Object *ob); struct bPoseChannel *BKE_pose_channel_active_or_first_selected(struct Object *ob); -struct bPoseChannel *BKE_pose_channel_verify(struct bPose *pose, const char *name); +struct bPoseChannel *BKE_pose_channel_ensure(struct bPose *pose, const char *name); struct bPoseChannel *BKE_pose_channel_get_mirrored(const struct bPose *pose, const char *name); void BKE_pose_check_uuids_unique_and_report(const struct bPose *pose); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 933d0678bf5..3f3aa0386e2 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -635,7 +635,7 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) * \note Use with care, not on Armature poses but for temporal ones. * \note (currently used for action constraints and in rebuild_pose). */ -bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) +bPoseChannel *BKE_pose_channel_ensure(bPose *pose, const char *name) { bPoseChannel *chan; @@ -1191,7 +1191,7 @@ void BKE_pose_free(bPose *pose) * and ID-Props, used when duplicating bones in editmode. * (unlike copy_pose_channel_data which only does posing-related stuff). * - * \note use when copying bones in editmode (on returned value from #BKE_pose_channel_verify) + * \note use when copying bones in editmode (on returned value from #BKE_pose_channel_ensure) */ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_from) { diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 146a482e72a..80992cff34d 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2444,7 +2444,7 @@ static void pose_proxy_sync(Object *ob, Object *from, int layer_protected) static int rebuild_pose_bone( bPose *pose, Bone *bone, bPoseChannel *parchan, int counter, Bone **r_last_visited_bone_p) { - bPoseChannel *pchan = BKE_pose_channel_verify(pose, bone->name); /* verify checks and/or adds */ + bPoseChannel *pchan = BKE_pose_channel_ensure(pose, bone->name); /* verify checks and/or adds */ pchan->bone = bone; pchan->parent = parchan; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 2ee030ca83f..17f36bd0860 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2836,7 +2836,7 @@ static void actcon_get_tarmat(struct Depsgraph *depsgraph, * including rotation order, otherwise this fails. */ pchan = cob->pchan; - tchan = BKE_pose_channel_verify(&pose, pchan->name); + tchan = BKE_pose_channel_ensure(&pose, pchan->name); tchan->rotmode = pchan->rotmode; /* evaluate action using workob (it will only set the PoseChannel in question) */ diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 3d5f0ac5c10..3902f6613a1 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -390,7 +390,7 @@ static void updateDuplicateSubtarget(EditBone *dup_bone, bConstraint *curcon; ListBase *conlist; - if ((pchan = BKE_pose_channel_verify(ob->pose, dup_bone->name))) { + if ((pchan = BKE_pose_channel_ensure(ob->pose, dup_bone->name))) { if ((conlist = &pchan->constraints)) { for (curcon = conlist->first; curcon; curcon = curcon->next) { /* does this constraint have a subtarget in @@ -825,7 +825,7 @@ static v
[Bf-blender-cvs] [67cd6beea0b] master: Cleanup: correct comment
Commit: 67cd6beea0b3aca284e2f1401eef0cb1ef0e2d3c Author: Campbell Barton Date: Fri Apr 30 15:58:04 2021 +1000 Branches: master https://developer.blender.org/rB67cd6beea0b3aca284e2f1401eef0cb1ef0e2d3c Cleanup: correct comment === M source/blender/blenkernel/BKE_mesh.h === diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index e39caac7c36..fae0ee4f81d 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -577,9 +577,9 @@ void BKE_mesh_polygons_flip(struct MPoly *mpoly, struct CustomData *ldata, int totpoly); -/* merge verts */ -/* Enum for merge_mode of CDDM_merge_verts. - * Refer to mesh.c for details. */ +/* Merge verts. */ +/* Enum for merge_mode of #BKE_mesh_merge_verts. + * Refer to mesh_merge.c for details. */ enum { MESH_MERGE_VERTS_DUMP_IF_MAPPED, MESH_MERGE_VERTS_DUMP_IF_EQUAL, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b316aaa0d2d] master: Cleanup: use const variables
Commit: b316aaa0d2daa06b0e1d43c187f5e0b0a8b8a462 Author: Campbell Barton Date: Fri Apr 30 15:24:46 2021 +1000 Branches: master https://developer.blender.org/rBb316aaa0d2daa06b0e1d43c187f5e0b0a8b8a462 Cleanup: use const variables === M source/blender/gpu/intern/gpu_debug.cc M source/blender/gpu/intern/gpu_state.cc === diff --git a/source/blender/gpu/intern/gpu_debug.cc b/source/blender/gpu/intern/gpu_debug.cc index 63e7024b74b..2d9fb7822ae 100644 --- a/source/blender/gpu/intern/gpu_debug.cc +++ b/source/blender/gpu/intern/gpu_debug.cc @@ -86,8 +86,8 @@ bool GPU_debug_group_match(const char *ref) if (ctx == nullptr) { return false; } - DebugStack &stack = ctx->debug_stack; - for (StringRef &name : stack) { + const DebugStack &stack = ctx->debug_stack; + for (const StringRef &name : stack) { if (name == ref) { return true; } diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 782d25747bb..5c33066c720 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -248,7 +248,7 @@ eGPUWriteMask GPU_write_mask_get() uint GPU_stencil_mask_get() { - GPUStateMutable &state = Context::get()->state_manager->mutable_state; + const GPUStateMutable &state = Context::get()->state_manager->mutable_state; return state.stencil_write_mask; } @@ -267,7 +267,7 @@ eGPUStencilTest GPU_stencil_test_get() /* NOTE: Already premultiplied by U.pixelsize. */ float GPU_line_width_get() { - GPUStateMutable &state = Context::get()->state_manager->mutable_state; + const GPUStateMutable &state = Context::get()->state_manager->mutable_state; return state.line_width; } @@ -292,7 +292,7 @@ void GPU_viewport_size_get_i(int coords[4]) bool GPU_depth_mask_get() { - GPUState &state = Context::get()->state_manager->state; + const GPUState &state = Context::get()->state_manager->state; return (state.write_mask & GPU_WRITE_DEPTH) != 0; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [af3eda81850] master: Cleanup: rename BKE_pose_channels_hash_{make => ensure}
Commit: af3eda81850dfd0b823392205f25716605f8a9cd Author: Campbell Barton Date: Fri Apr 30 15:28:13 2021 +1000 Branches: master https://developer.blender.org/rBaf3eda81850dfd0b823392205f25716605f8a9cd Cleanup: rename BKE_pose_channels_hash_{make => ensure} Use the term `ensure` since it makes it clear the data is not manipulated if it already exists. === M source/blender/blenkernel/BKE_action.h M source/blender/blenkernel/intern/action.c M source/blender/blenkernel/intern/armature.c M source/blender/blenkernel/intern/object.c M source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc M source/blender/editors/armature/armature_add.c === diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index e27cb2be8ee..e9ac865cfd2 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -140,7 +140,7 @@ void BKE_pose_channel_free_bbone_cache(struct bPoseChannel_Runtime *runtime); void BKE_pose_channels_free(struct bPose *pose); void BKE_pose_channels_free_ex(struct bPose *pose, bool do_id_user); -void BKE_pose_channels_hash_make(struct bPose *pose); +void BKE_pose_channels_hash_ensure(struct bPose *pose); void BKE_pose_channels_hash_free(struct bPose *pose); void BKE_pose_channels_remove(struct Object *ob, diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 0b38e2d9f75..933d0678bf5 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -815,7 +815,7 @@ void BKE_pose_copy_data_ex(bPose **dst, */ if (outPose->chanbase.first != outPose->chanbase.last) { outPose->chanhash = NULL; -BKE_pose_channels_hash_make(outPose); +BKE_pose_channels_hash_ensure(outPose); } outPose->iksolver = src->iksolver; @@ -945,7 +945,7 @@ bool BKE_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) * Removes the hash for quick lookup of channels, must * be done when adding/removing channels. */ -void BKE_pose_channels_hash_make(bPose *pose) +void BKE_pose_channels_hash_ensure(bPose *pose) { if (!pose->chanhash) { bPoseChannel *pchan; @@ -1774,7 +1774,7 @@ void what_does_obaction(Object *ob, * allocation and also will make lookup slower. */ if (pose->chanbase.first != pose->chanbase.last) { - BKE_pose_channels_hash_make(pose); + BKE_pose_channels_hash_ensure(pose); } if (pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { BKE_pose_update_constraint_flags(pose); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index da8a3b49f3c..146a482e72a 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2562,7 +2562,7 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_ /* and a check for garbage */ BKE_pose_channels_clear_with_null_bone(pose, do_id_user); - BKE_pose_channels_hash_make(pose); + BKE_pose_channels_hash_ensure(pose); for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { /* Find the custom B-Bone handles. */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 24593bf3812..82d99e980a4 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -4343,7 +4343,7 @@ void BKE_object_handle_update_ex(Depsgraph *depsgraph, } /* Speed optimization for animation lookups. */ if (ob->pose != NULL) { -BKE_pose_channels_hash_make(ob->pose); +BKE_pose_channels_hash_ensure(ob->pose); if (ob->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { BKE_pose_update_constraint_flags(ob->pose); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 13caba67713..00c78b8edce 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -169,7 +169,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) } /* Speed optimization for animation lookups. */ if (object->pose != nullptr) { -BKE_pose_channels_hash_make(object->pose); +BKE_pose_channels_hash_ensure(object->pose); if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { BKE_pose_update_constraint_flags(object->pose); } @@ -318,7 +318,7 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl /* Armature. */ build_armature(armature); /* speed optimization for animation lookups */ - BKE_pose_channels_hash_make(object->pose); + BKE_pose_channels_hash_ensure(object->po
[Bf-blender-cvs] [d5ae0290e8b] master: Cleanup: duplicate break
Commit: d5ae0290e8b1ee4556ea77a9ab64523a13dc312c Author: Campbell Barton Date: Fri Apr 30 15:22:59 2021 +1000 Branches: master https://developer.blender.org/rBd5ae0290e8b1ee4556ea77a9ab64523a13dc312c Cleanup: duplicate break === M source/blender/nodes/intern/node_socket.cc === diff --git a/source/blender/nodes/intern/node_socket.cc b/source/blender/nodes/intern/node_socket.cc index b583523da98..5b5fe183823 100644 --- a/source/blender/nodes/intern/node_socket.cc +++ b/source/blender/nodes/intern/node_socket.cc @@ -294,7 +294,6 @@ void node_socket_init_default_value(bNodeSocket *sock) sock->default_value = dval; break; - break; } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5806d7ef543] master: Cleanup: avoid ambiguous parenthesis
Commit: 5806d7ef5432e9e46ab90050de91a071b1371a9b Author: Campbell Barton Date: Fri Apr 30 15:24:24 2021 +1000 Branches: master https://developer.blender.org/rB5806d7ef5432e9e46ab90050de91a071b1371a9b Cleanup: avoid ambiguous parenthesis === M source/blender/blenkernel/intern/pointcache.c M source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c === diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 17434ee8023..be206f8a642 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1805,7 +1805,7 @@ int BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm, void *cur[BPH } for (i = 0; i < BPHYS_TOT_DATA; i++) { -cur[i] = data_types & (1 << i) ? (char *)pm->data[i] + index * ptcache_data_size[i] : NULL; +cur[i] = (data_types & (1 << i)) ? (char *)pm->data[i] + index * ptcache_data_size[i] : NULL; } return 1; diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c index ee344561b0e..e2f3c352676 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -614,8 +614,8 @@ static void snap_gizmo_draw(const bContext *C, wmGizmo *gz) GPU_line_width(1.0f); - const float *prev_point = snap_gizmo_snap_elements(snap_gizmo) & -SCE_SNAP_MODE_EDGE_PERPENDICULAR ? + const float *prev_point = (snap_gizmo_snap_elements(snap_gizmo) & + SCE_SNAP_MODE_EDGE_PERPENDICULAR) ? snap_gizmo->prevpoint : NULL; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d286adc26e9] master: Cleanup: remove redundant assignments & NULL pointer check
Commit: d286adc26e9d58475e5d7d83160999a25b6fc61f Author: Campbell Barton Date: Fri Apr 30 15:20:06 2021 +1000 Branches: master https://developer.blender.org/rBd286adc26e9d58475e5d7d83160999a25b6fc61f Cleanup: remove redundant assignments & NULL pointer check === M source/blender/blenkernel/intern/softbody.c M source/blender/makesrna/intern/rna_sequencer.c === diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index d52e4443ac1..3b1230ce3b6 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -499,7 +499,6 @@ static void ccd_mesh_free(ccd_Mesh *ccdm) } MEM_freeN(ccdm->mima); MEM_freeN(ccdm); -ccdm = NULL; } } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 24d051fecc8..f411566b623 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -990,18 +990,14 @@ static int colbalance_seq_cmp_fn(Sequence *seq, void *arg_pt) { SequenceSearchData *data = arg_pt; - if (seq->modifiers.first) { -SequenceModifierData *smd = seq->modifiers.first; - -for (smd = seq->modifiers.first; smd; smd = smd->next) { - if (smd->type == seqModifierType_ColorBalance) { -ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd; - -if (&cbmd->color_balance == data->data) { - data->seq = seq; - data->smd = smd; - return -1; /* done so bail out */ -} + for (SequenceModifierData *smd = seq->modifiers.first; smd; smd = smd->next) { +if (smd->type == seqModifierType_ColorBalance) { + ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd; + + if (&cbmd->color_balance == data->data) { +data->seq = seq; +data->smd = smd; +return -1; /* done so bail out */ } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4a82df366f6] master: Cleanup: use 'else if'
Commit: 4a82df366f6bd804a27f137a4517595ae56fe2c4 Author: Campbell Barton Date: Fri Apr 30 15:22:44 2021 +1000 Branches: master https://developer.blender.org/rB4a82df366f6bd804a27f137a4517595ae56fe2c4 Cleanup: use 'else if' === M source/blender/windowmanager/intern/wm_cursors.c === diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index cdb7b591907..11783ae3517 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -264,7 +264,7 @@ void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4]) if (wrap == WM_CURSOR_WRAP_X) { mode_axis = GHOST_kAxisX; } -if (wrap == WM_CURSOR_WRAP_Y) { +else if (wrap == WM_CURSOR_WRAP_Y) { mode_axis = GHOST_kGrabAxisY; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[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, &ob->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(&list); } +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, &ptr); /* dummy */ + func = &rna_NodeTree_valid_socket_type_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "type", &socket_type); + ntreetype->rna_ext.call(NULL, &ptr, func, &list); + + RNA_parameter_get_lookup(&list, "valid", &ret); + valid = *(bool *)ret; + + RNA_parameter_list_free(&list); + + 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(&dummynt, 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
[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 &weights, const Color4f &v0, const Color4f &v1, /** \} */ +/* */ +/** \name Mix two values of the same type. + * + * This is just basic linear interpolation. + * \{ */ + +template T mix2(const float factor, const T &a, const T &b); + +template<> inline bool mix2(const float factor, const bool &a, const bool &b) +{ + return ((1.0f - factor) * a + factor * b) >= 0.5f; +} + +template<> inline int mix2(const float factor, const int &a, const int &b) +{ + return static_cast((1.0f - factor) * a + factor * b); +} + +template<> inline float mix2(const float factor, const float &a, const float &b) +{ + return (1.0f - factor) * a + factor * b; +} + +template<> inline float2 mix2(const float factor, const float2 &a, const float2 &b) +{ + return float2::interpolate(a, b, factor); +} + +template<> inline float3 mix2(const float factor, const float3 &a, const float3 &b) +{ + return float3::interpolate(a, b, factor); +} + +template<> inline Color4f mix2(const float factor, const Color4f &a, const Color4f &b) +{ + 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 https://lists.blender.org/mailman/listin
[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 10
[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, &bmain->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, &flood, pose_face_sets_floodfill_cb, &fdata); SCULPT_floodfill_free(&flood); ++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, &sfile->params); BLO_read_data_address(reader, &sfile->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, + st
[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, &kcd->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(&args, 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(&args, 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(&allocsize, 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(&pbvh->bm->vdata, vsrcs, vws, NULL, 2, v_new->head.data); + CustomData_bmesh_interp(&pbvh->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(&pbvh->bm->ldata, lsrcs, lws, lws, 2, f_new->l_first->next->head.data); +CustomData_bmesh_interp(&pbvh->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(&pbvh->bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->head.data); +CustomData_bmesh_interp( +&pbvh->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(&pbvh->bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->prev->head.data); +CustomData_bmesh_interp( +&pbvh->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(&pbvh->bm->ldata, lsrcs, lws, lws, 2, f_new->l_first->head.data); +CustomData_bmesh_interp( +&pbvh->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(&pbvh->bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->next->head.data); +CustomData_bmesh_interp( +&pbvh->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(&pbvh->bm->ldata, lsrcs, lws, lws, 1, f_new->l_first->prev->head.data); +CustomData_bmesh_interp( +&pbvh->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(&pbvh->bm->ldata, blocks, ws, NULL, totl, ls[0]->head.data); +CustomData_bmesh_interp( +&pbvh->bm->ldata, (const void **)blocks, ws, NULL, totl, ls[0]->head.data
[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, &ob_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 https://lists.blender.org/mailman/lis
[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", &modelname, &bufferlen, 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(&rb->lock_task); - reln = lineart_list_append_pointer_pool_sized( + reln = lineart_list_append_pointer_pool_sized_thread( &rb->vertex_buffer_pointers, &rb->render_data_pool, orv, sizeof(LineartElementLinkNode)); BLI_spin_unlock(&rb->lock_task); @@ -1644,9 +1644,10 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu } BLI_spin_lock(&rb->lock_task); - reln = lineart_list_append_pointer_pool_sized( + reln = lineart_list_append_pointer_pool_sized_thread( &rb->triangle_buffer_pointers, &rb->render_data_pool, ort, sizeof(LineartElementLinkNode)); BLI_spin_unlock(&rb->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(&rb->triangle_adjacent_pointers, &rb->render_data_pool, orta); + BLI_spin_lock(&rb->lock_task); + lineart_list_append_pointer_pool_thread( + &rb->triangle_adjacent_pointers, &rb->render_data_pool, orta); + BLI_spin_unlock(&rb->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(&rb->render_data_pool, sizeof(LineartLineSegment) * allocate_la_e); BLI_spin_lock(&rb->lock_task); - reln = lineart_list_append_pointer_pool_sized( + reln = lineart_list_append_pointer_pool_sized_thread( &rb->line_buffer_pointers, &rb->render_data_pool, o_la_e, sizeof(LineartElementLinkNode)); BLI_spin_unlock(&rb->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(ListBa
[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, &gpd->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, &local_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(&local_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, &ob_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, &ob->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, &bmain->objects) { +if (ob->type == OB_GPENCIL) { + LISTBASE_FOREACH (GpencilModifierData *, md, &ob->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(c
[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, &local_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(&local_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, &gpf->strokes) { -if (o_gps == gps) { - break; -} -rnd_index += 1; - } + int rnd_index = BLI_findindex(&gpf->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, &pt->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, &pt->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 = &gps->points[i]; MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL; @@ -179,13 +178,6 @@ static void deformPolyline(GpencilModifierData *md, mul_m4_v3(mat_rnd, &pt->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", &modelname, &bufferlen, 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 &&new_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, &iter, 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(&gpf->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, &pt1->x, &pt0->x); @@ -1696,7 +1697,8 @@ void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3]) sub_v3_v3v3(vec2, &pt3->x, &pt0->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, &gpf->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 =
[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, &eiter, 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, &eiter, 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, &liter, 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, &eiter, 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 &varray_; + + public: + GVArray_For_ShallowCopy(const GVArray &varray) + : 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(&entry->lock, THREAD_LOCK_READ); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_READ); void *ret = BLI_ghash_lookup(gh, key); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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(&entry->lock, THREAD_LOCK_READ); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_READ); void **ret = BLI_ghash_lookup_p(gh, key); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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(&entry->lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_WRITE); BLI_ghash_insert(gh, key, val); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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(&entry->lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_WRITE); bool ret = BLI_ghash_remove(gh, key, keyfree, valfree); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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(&entry->lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_WRITE); bool ret = BLI_ghash_reinsert(gh, key, val, keyfree, valfree); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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(&entry->lock, THREAD_LOCK_READ); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_READ); bool ret = BLI_ghash_haskey(gh, key); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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(&entry->lock, THREAD_LOCK_WRITE); + BLI_rw_mutex_lock(&log->lock, THREAD_LOCK_WRITE); bool ret = BLI_ghash_ensure_p(gh, key, val); - BLI_rw_mutex_unlock(&entry->lock); + BLI_rw_mutex_unlock(&log->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, &iter, 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, &tmp); @@ -1147,8 +1142,8 @@ static void full_copy_swap(BMesh *bm, BMLog *log, BMLogEntry *entry) uintptr_t id = (uintptr_t)BLI_ghashIterator_getKey(&gi); uintptr_t key = (uintptr_t)BLI_ghashIterator_getValue(&gi); -uintptr_t idx = (key & ((1L << 31L) - 1L)); -
[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 ¬ifier) 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(&list_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(); +mask.foreach_index([&](co
[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 &geometry_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, &mectx, &geometry_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, &mectx, 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 &node) { +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, &new_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 &geometry_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, &cddata_masks, &need_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(&area->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 &node) + { +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 &node) + { +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, &r, &g, &b); +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/
[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 &arg = *(NodeTooltipArg *)argN; ProfileNode &node = *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 &local_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 &local_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 &local_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, &cddata_masks, &need_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(&profile_task, md->name); + Mesh *new_mesh = mti->modifyMesh(md, ctx, me); + BLI_profile_task_end(&profile_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(&profile_task, md->name); mti->deformVerts(md, ctx, me, vertexCos, numVerts); + BLI_profile_task_end(&profile_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 ¶ms_provider) { +BLI_PROFILE_SCOPE(node->name().c_str()); const bNode &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