[Bf-blender-cvs] [6b91c61a4f3] lanpr-under-gp: Merge remote-tracking branch 'origin/master' into lanpr-under-gp
Commit: 6b91c61a4f356a70b7ca29d78a4651920f2cd146 Author: YimingWu Date: Tue Sep 22 10:50:14 2020 +0800 Branches: lanpr-under-gp https://developer.blender.org/rB6b91c61a4f356a70b7ca29d78a4651920f2cd146 Merge remote-tracking branch 'origin/master' into lanpr-under-gp === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [69e46f11dd6] lanpr-under-gp: LineArt: Debug print in modifier.
Commit: 69e46f11dd66d3f7aa8aa83adbb82f9a6e9bcaca Author: YimingWu Date: Tue Sep 22 10:48:18 2020 +0800 Branches: lanpr-under-gp https://developer.blender.org/rB69e46f11dd66d3f7aa8aa83adbb82f9a6e9bcaca LineArt: Debug print in modifier. === 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 c3a93208f88..ba75b615d05 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -208,6 +208,10 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec } } + if (G.debug_value == 4000) { +printf("(is_render == %d) ", is_render); + } + /* If we reach here, means calculation is finished (LRT_SYNC_FRESH), we grab cache. flag reset is * done by calculation function.*/ generate_strokes_actual(md, depsgraph, ob, gpl, gpf); @@ -279,7 +283,7 @@ static void updateDepsgraph(GpencilModifierData *md, DEG_add_object_relation( ctx->node, lmd->source_object, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); DEG_add_object_relation( -ctx->node, lmd->source_object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); +ctx->node, lmd->source_object, DEG_OB_COMP_PARAMETERS, "Line Art Modifier"); } else { FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (ctx->scene->master_collection, ob, mode) { @@ -287,7 +291,7 @@ static void updateDepsgraph(GpencilModifierData *md, ob->type == OB_SURF || ob->type == OB_FONT) { if (!(ob->lineart.usage & COLLECTION_LRT_EXCLUDE)) { DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); - DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); + DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_PARAMETERS, "Line Art Modifier"); } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [992735589d7] lanpr-under-gp: LineArt: No double caching during one update, even with multiple modifiers.
Commit: 992735589d7808329a1ab2ba94bf2144ce8d78e2 Author: YimingWu Date: Tue Sep 22 12:20:07 2020 +0800 Branches: lanpr-under-gp https://developer.blender.org/rB992735589d7808329a1ab2ba94bf2144ce8d78e2 LineArt: No double caching during one update, even with multiple modifiers. === M source/blender/blenkernel/intern/collection.c M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/writefile.c M source/blender/editors/include/ED_lineart.h M source/blender/editors/lineart/lineart_cpu.c M source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c M source/blender/makesrna/intern/rna_material.c M source/blender/makesrna/intern/rna_scene.c === diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index ac21b143b4d..4d3c778058d 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -108,6 +108,7 @@ static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, cons } collection_dst->flag &= ~COLLECTION_HAS_OBJECT_CACHE; + collection_dst->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED; BLI_listbase_clear(_dst->object_cache); BLI_listbase_clear(_dst->object_cache_instanced); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c5718dca9ac..4c6a2925726 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4155,6 +4155,7 @@ static void direct_link_collection(BlendDataReader *reader, Collection *collecti BKE_previewimg_blend_read(reader, collection->preview); collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE; + collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED; collection->tag = 0; BLI_listbase_clear(>object_cache); BLI_listbase_clear(>object_cache_instanced); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 7719f71da63..d52958c10ff 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1409,6 +1409,7 @@ static void write_collection(BlendWriter *writer, Collection *collection, const if (collection->id.us > 0 || BLO_write_is_undo(writer)) { /* Clean up, important in undo case to reduce false detection of changed data-blocks. */ collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE; +collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED; collection->tag = 0; BLI_listbase_clear(>object_cache); BLI_listbase_clear(>object_cache_instanced); diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h index f9eef65d730..17068439a83 100644 --- a/source/blender/editors/include/ED_lineart.h +++ b/source/blender/editors/include/ED_lineart.h @@ -315,6 +315,8 @@ typedef struct LineartSharedResource { SpinLock lock_render_status; eLineartRenderStatus flag_render_status; eLineartModifierSyncStatus flag_sync_staus; + /** count of pending modifiers that is waiting for the data. */ + int customers; int thread_count; @@ -563,6 +565,9 @@ bool ED_lineart_calculation_flag_check(eLineartRenderStatus flag); void ED_lineart_modifier_sync_flag_set(eLineartModifierSyncStatus flag, bool is_from_modifier); bool ED_lineart_modifier_sync_flag_check(eLineartModifierSyncStatus flag); +void ED_lineart_modifier_sync_add_customer(); +void ED_lineart_modifier_sync_remove_customer(); +bool ED_lineart_modifier_sync_still_has_customer(); int ED_lineart_compute_feature_lines_internal(struct Depsgraph *depsgraph, const int show_frame_progress); diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c index eea6b7174a6..e47844c3dce 100644 --- a/source/blender/editors/lineart/lineart_cpu.c +++ b/source/blender/editors/lineart/lineart_cpu.c @@ -1474,7 +1474,8 @@ static void lineart_vert_transform( mul_v4_m4v3_db(rv->fbcoord, mvp_mat, co); } -static void lineart_geometry_object_load(Object *ob, +static void lineart_geometry_object_load(Depsgraph *dg, + Object *ob, double (*mv_mat)[4], double (*mvp_mat)[4], LineartRenderBuffer *rb, @@ -1509,7 +1510,7 @@ static void lineart_geometry_object_load(Object *ob, ob->type == OB_FONT) { if (ob->type == OB_MESH) { - use_mesh = ob->data; + use_mesh = DEG_get_evaluated_object(dg, ob)->data; } else { use_mesh = BKE_mesh_new_from_object(NULL, ob, false); @@ -1785,7 +1786,7 @@ static void
[Bf-blender-cvs] [b2782f78ba5] master: Fix warning building without potrace
Commit: b2782f78ba54a52a639f1411a3ee8a5fc66cba66 Author: Hans Goudey Date: Mon Sep 21 21:46:15 2020 -0500 Branches: master https://developer.blender.org/rBb2782f78ba54a52a639f1411a3ee8a5fc66cba66 Fix warning building without potrace The library is no longer in extern, so it isn't necessary to include it here. === M source/blender/editors/gpencil/CMakeLists.txt === diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 7bf8a93a97c..b2c618073f4 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -29,7 +29,6 @@ set(INC ../../windowmanager ../../../../intern/glew-mx ../../../../intern/guardedalloc - ../../../../extern/potrace/src ) set(SRC ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4e667ecef92] master: UI: Add curve geometry start and end panel
Commit: 4e667ecef92f4ba7e1d58cfb3effc2bf010085ce Author: Hans Goudey Date: Mon Sep 21 19:19:21 2020 -0500 Branches: master https://developer.blender.org/rB4e667ecef92f4ba7e1d58cfb3effc2bf010085ce UI: Add curve geometry start and end panel The placement of the start and end factor and mapping settings for curves has been quite misleading for a long time. They were in the "Bevel" subpanel, but they aren't related to bevel because they affect curves with only extrusion and no bevel. This commit moves these properties to their own subpanel, labeled "Start & End Mapping". Differential Revision: https://developer.blender.org/D8910 === M release/scripts/startup/bl_ui/properties_data_curve.py === diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index 083e5470a99..9f9261bde92 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -207,25 +207,39 @@ class DATA_PT_geometry_curve_bevel(CurveButtonsPanelCurve, Panel): col.prop(curve, "bevel_resolution", text="Resolution") col.prop(curve, "use_fill_caps") -if type(curve) is not TextCurve: +if curve.bevel_mode == 'PROFILE': +col.template_curveprofile(curve, "bevel_profile") -col = layout.column() -col.active = ( -(curve.bevel_depth > 0.0) or -(curve.extrude > 0.0) or -(curve.bevel_object is not None) -) -sub = col.column(align=True) -sub.prop(curve, "bevel_factor_start", text="Start") -sub.prop(curve, "bevel_factor_end", text="End") -sub = col.column(align=True) -sub.prop(curve, "bevel_factor_mapping_start", text="Mapping Start") -sub.prop(curve, "bevel_factor_mapping_end", text="End") +class DATA_PT_geometry_curve_start_end(CurveButtonsPanelCurve, Panel): +bl_label = "Start & End Mapping" +bl_parent_id = "DATA_PT_geometry_curve" +bl_options = {'DEFAULT_CLOSED'} -# Put the large template at the end so it doesn't displace the other properties -if curve.bevel_mode == 'PROFILE': -col.template_curveprofile(curve, "bevel_profile") +@classmethod +def poll(cls, context): +# Text objects don't support these properties +return (type(context.curve) in {Curve}) + +def draw(self, context): +layout = self.layout +layout.use_property_split = True + +curve = context.curve + +col = layout.column() + +col.active = ( +((curve.bevel_depth > 0.0) or (curve.extrude > 0.0)) and +(curve.bevel_mode != 'OBJECT') +) +sub = col.column(align=True) +sub.prop(curve, "bevel_factor_start", text="Factor Start") +sub.prop(curve, "bevel_factor_end", text="End") + +sub = col.column(align=True) +sub.prop(curve, "bevel_factor_mapping_start", text="Mapping Start") +sub.prop(curve, "bevel_factor_mapping_end", text="End") class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel): @@ -480,6 +494,7 @@ classes = ( DATA_PT_curve_texture_space, DATA_PT_geometry_curve, DATA_PT_geometry_curve_bevel, +DATA_PT_geometry_curve_start_end, DATA_PT_pathanim, DATA_PT_active_spline, DATA_PT_font, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8eda3ddc4f0] master: Weld Modifier: Performance improvement
Commit: 8eda3ddc4f047fcf7d8bd71d4fea958d8005ade8 Author: Henrik Dick Date: Mon Sep 21 12:30:49 2020 -0300 Branches: master https://developer.blender.org/rB8eda3ddc4f047fcf7d8bd71d4fea958d8005ade8 Weld Modifier: Performance improvement This commit contains the Performance improvement, that was originally proposed in D8966. It improves the performance of the Weld Modifier by a lot. It had a loop with execution time O(N^2) which is now O(N*log(N)) at a bare maximum. === M source/blender/modifiers/intern/MOD_weld.c === diff --git a/source/blender/modifiers/intern/MOD_weld.c b/source/blender/modifiers/intern/MOD_weld.c index 855f96df82f..d7d24062fc5 100644 --- a/source/blender/modifiers/intern/MOD_weld.c +++ b/source/blender/modifiers/intern/MOD_weld.c @@ -390,10 +390,7 @@ static void weld_vert_ctx_alloc_and_setup(const uint mvert_len, uint *r_wvert_len, uint *r_vert_kill_len) { - uint *v_dest_iter = _vert_dest_map[0]; - for (uint i = mvert_len; i--; v_dest_iter++) { -*v_dest_iter = OUT_OF_CONTEXT; - } + range_vn_u(r_vert_dest_map, mvert_len, 0); uint vert_kill_len = 0; const BVHTreeOverlap *overlap_iter = [0]; @@ -404,46 +401,36 @@ static void weld_vert_ctx_alloc_and_setup(const uint mvert_len, BLI_assert(indexA < indexB); uint va_dst = r_vert_dest_map[indexA]; +while (va_dst != r_vert_dest_map[va_dst]) { + va_dst = r_vert_dest_map[va_dst]; +} uint vb_dst = r_vert_dest_map[indexB]; -if (va_dst == OUT_OF_CONTEXT) { - if (vb_dst == OUT_OF_CONTEXT) { -vb_dst = indexA; -r_vert_dest_map[indexB] = vb_dst; - } - r_vert_dest_map[indexA] = vb_dst; - vert_kill_len++; +while (vb_dst != r_vert_dest_map[vb_dst]) { + vb_dst = r_vert_dest_map[vb_dst]; } -else if (vb_dst == OUT_OF_CONTEXT) { - r_vert_dest_map[indexB] = va_dst; - vert_kill_len++; +if (va_dst == vb_dst) { + continue; } -else if (va_dst != vb_dst) { - uint v_new, v_old; - if (va_dst < vb_dst) { -v_new = va_dst; -v_old = vb_dst; - } - else { -v_new = vb_dst; -v_old = va_dst; - } - BLI_assert(r_vert_dest_map[v_old] == v_old); - BLI_assert(r_vert_dest_map[v_new] == v_new); - vert_kill_len++; - - const BVHTreeOverlap *overlap_iter_b = [0]; - for (uint j = i + 1; j--; overlap_iter_b++) { -indexA = overlap_iter_b->indexA; -indexB = overlap_iter_b->indexB; -va_dst = r_vert_dest_map[indexA]; -vb_dst = r_vert_dest_map[indexB]; -if (ELEM(v_old, vb_dst, va_dst)) { - r_vert_dest_map[indexA] = v_new; - r_vert_dest_map[indexB] = v_new; -} - } - BLI_assert(r_vert_dest_map[v_old] == v_new); +if (va_dst > vb_dst) { + SWAP(uint, va_dst, vb_dst); +} +vert_kill_len++; +r_vert_dest_map[vb_dst] = va_dst; + } + + /* Fix #r_vert_dest_map for next step. */ + for (uint i = 0; i < mvert_len; i++) { +if (i == r_vert_dest_map[i]) { + r_vert_dest_map[i] = OUT_OF_CONTEXT; + continue; +} + +uint v = i; +while (v != r_vert_dest_map[v] && r_vert_dest_map[v] != OUT_OF_CONTEXT) { + v = r_vert_dest_map[v]; } +r_vert_dest_map[v] = v; +r_vert_dest_map[i] = v; } /* Vert Context. */ @@ -453,7 +440,7 @@ static void weld_vert_ctx_alloc_and_setup(const uint mvert_len, wvert = MEM_mallocN(sizeof(*wvert) * mvert_len, __func__); wv = [0]; - v_dest_iter = _vert_dest_map[0]; + uint *v_dest_iter = _vert_dest_map[0]; for (uint i = 0; i < mvert_len; i++, v_dest_iter++) { if (*v_dest_iter != OUT_OF_CONTEXT) { wv->vert_dest = *v_dest_iter; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [da64eef55a5] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve
Commit: da64eef55a5d92532713809bb04fffe8a8824c83 Author: Antonio Vazquez Date: Mon Sep 21 20:23:29 2020 +0200 Branches: greasepencil-edit-curve https://developer.blender.org/rBda64eef55a5d92532713809bb04fffe8a8824c83 Merge branch 'master' into greasepencil-edit-curve === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6a9e9bef44d] master: Cleanup: Reduce indentation by returning early
Commit: 6a9e9bef44d2aff5f115d6798ae1c7c6d486a393 Author: Hans Goudey Date: Mon Sep 21 13:21:22 2020 -0500 Branches: master https://developer.blender.org/rB6a9e9bef44d2aff5f115d6798ae1c7c6d486a393 Cleanup: Reduce indentation by returning early Checking for NULL icons or draw info can remove some indentation later in the funcitons, making the code more readable. === M source/blender/editors/interface/interface_icons.c === diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 2fa7cc27eef..b89f7a60ae1 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1114,23 +1114,25 @@ void UI_icons_free_drawinfo(void *drawinfo) { DrawInfo *di = drawinfo; - if (di) { -if (di->type == ICON_TYPE_BUFFER) { - if (di->data.buffer.image) { -if (di->data.buffer.image->rect) { - MEM_freeN(di->data.buffer.image->rect); -} -MEM_freeN(di->data.buffer.image); + if (di == NULL) { +return; + } + + if (di->type == ICON_TYPE_BUFFER) { +if (di->data.buffer.image) { + if (di->data.buffer.image->rect) { +MEM_freeN(di->data.buffer.image->rect); } + MEM_freeN(di->data.buffer.image); } -else if (di->type == ICON_TYPE_GEOM) { - if (di->data.geom.image_cache) { -IMB_freeImBuf(di->data.geom.image_cache); - } + } + else if (di->type == ICON_TYPE_GEOM) { +if (di->data.geom.image_cache) { + IMB_freeImBuf(di->data.geom.image_cache); } - -MEM_freeN(di); } + + MEM_freeN(di); } /** @@ -1324,56 +1326,60 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi { Icon *icon = BKE_icon_get(icon_id); - if (icon) { -DrawInfo *di = icon_ensure_drawinfo(icon); + if (icon == NULL) { +return; + } -if (di) { - switch (di->type) { -case ICON_TYPE_PREVIEW: { - ID *id = (icon->id_type != 0) ? icon->obj : NULL; - PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) : icon->obj; - /* Using jobs for screen previews crashes due to offscreen rendering. - * XXX would be nicer if PreviewImage could store if it supports jobs */ - const bool use_jobs = !id || (GS(id->name) != ID_SCR); + DrawInfo *di = icon_ensure_drawinfo(icon); - if (prv) { -const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON; + if (di == NULL) { +return; + } -if (id || (prv->tag & PRV_TAG_DEFFERED) != 0) { - ui_id_preview_image_render_size(C, NULL, id, prv, size, use_jobs); -} - } - break; + switch (di->type) { +case ICON_TYPE_PREVIEW: { + ID *id = (icon->id_type != 0) ? icon->obj : NULL; + PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) : icon->obj; + /* Using jobs for screen previews crashes due to offscreen rendering. + * XXX would be nicer if PreviewImage could store if it supports jobs */ + const bool use_jobs = !id || (GS(id->name) != ID_SCR); + + if (prv) { +const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON; + +if (id || (prv->tag & PRV_TAG_DEFFERED) != 0) { + ui_id_preview_image_render_size(C, NULL, id, prv, size, use_jobs); } -case ICON_TYPE_BUFFER: { - if (icon->obj_type == ICON_DATA_STUDIOLIGHT) { -if (di->data.buffer.image == NULL) { - wmWindowManager *wm = CTX_wm_manager(C); - StudioLight *sl = icon->obj; - BKE_studiolight_set_free_function(sl, _studiolight_free_function, wm); - IconImage *img = MEM_mallocN(sizeof(IconImage), __func__); - - img->w = STUDIOLIGHT_ICON_SIZE; - img->h = STUDIOLIGHT_ICON_SIZE; - const size_t size = STUDIOLIGHT_ICON_SIZE * STUDIOLIGHT_ICON_SIZE * sizeof(uint); - img->rect = MEM_mallocN(size, __func__); - memset(img->rect, 0, size); - di->data.buffer.image = img; - - wmJob *wm_job = WM_jobs_get( - wm, CTX_wm_window(C), icon, "StudioLight Icon", 0, WM_JOB_TYPE_STUDIOLIGHT); - Icon **tmp = MEM_callocN(sizeof(Icon *), __func__); - *tmp = icon; - WM_jobs_customdata_set(wm_job, tmp, MEM_freeN); - WM_jobs_timer(wm_job, 0.01, 0, NC_WINDOW); - WM_jobs_callbacks( - wm_job, ui_studiolight_icon_job_exec, NULL, NULL, ui_studiolight_icon_job_end); - WM_jobs_start(CTX_wm_manager(C), wm_job); -} - } - break; + } + break; +} +case ICON_TYPE_BUFFER: { + if (icon->obj_type == ICON_DATA_STUDIOLIGHT) { +if (di->data.buffer.image == NULL) { +
[Bf-blender-cvs] [9dc5670d080] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: 9dc5670d0805cae1a9f08bbbdef625e50d4a7b54 Author: Antonio Vazquez Date: Mon Sep 21 20:09:18 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB9dc5670d0805cae1a9f08bbbdef625e50d4a7b54 Merge branch 'master' into greasepencil-object Conflicts: source/blender/blenkernel/intern/gpencil.c source/blender/editors/gpencil/gpencil_trace_ops.c source/blender/editors/gpencil/gpencil_trace_utils.c === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4d62bb8fe57] master: GPencil: New Trace images using Potrace
Commit: 4d62bb8fe57ca431da669386d47ca185f3624c9a Author: Antonio Vazquez Date: Mon Sep 21 19:53:36 2020 +0200 Branches: master https://developer.blender.org/rB4d62bb8fe57ca431da669386d47ca185f3624c9a GPencil: New Trace images using Potrace This patch adds a new operator to convert a black and white image into grease pencil strokes. If the image is not B/W, an internal conversion is done. This is the first operator using Potrace, but we expect to add more features in next Blender versions. Reviewed By: HooglyBoogly Maniphest Tasks: T79877 Differential Revision: https://developer.blender.org/D8951 === M release/scripts/startup/bl_ui/space_view3d.py M source/blender/blenkernel/BKE_gpencil.h M source/blender/blenkernel/intern/gpencil.c M source/blender/editors/gpencil/CMakeLists.txt M source/blender/editors/gpencil/gpencil_intern.h M source/blender/editors/gpencil/gpencil_ops.c A source/blender/editors/gpencil/gpencil_trace.h A source/blender/editors/gpencil/gpencil_trace_ops.c A source/blender/editors/gpencil/gpencil_trace_utils.c M source/blender/python/intern/CMakeLists.txt M source/blender/python/intern/bpy_app_build_options.c === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 351654f61e4..888b4a62139 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2260,6 +2260,11 @@ class VIEW3D_MT_object(Menu): else: layout.operator_menu_enum("object.convert", "target") +# Potrace lib dependency +if bpy.app.build_options.potrace: +layout.separator() +layout.operator("gpencil.trace_image") + layout.separator() layout.menu("VIEW3D_MT_object_showhide") diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index f1912b14e8c..c484f0753a3 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -282,6 +282,8 @@ void BKE_gpencil_parent_matrix_get(const struct Depsgraph *depsgraph, void BKE_gpencil_update_layer_parent(const struct Depsgraph *depsgraph, struct Object *ob); +int BKE_gpencil_material_find_index_by_name_prefix(struct Object *ob, const char *name_prefix); + void BKE_gpencil_blend_read_data(struct BlendDataReader *reader, struct bGPdata *gpd); #ifdef __cplusplus diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 03ac7e622e1..7bc3daf037f 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -2745,4 +2745,25 @@ void BKE_gpencil_update_layer_parent(const Depsgraph *depsgraph, Object *ob) } } } + +/** + * Find material by name prefix. + * \param ob: Object pointer + * \param name_prefix: Prefix name of the material + * \return Index + */ +int BKE_gpencil_material_find_index_by_name_prefix(Object *ob, const char *name_prefix) +{ + const int name_prefix_len = strlen(name_prefix); + for (int i = 0; i < ob->totcol; i++) { +Material *ma = BKE_object_material_get(ob, i + 1); +if ((ma != NULL) && (ma->gp_style != NULL) && +(STREQLEN(ma->id.name + 2, name_prefix, name_prefix_len))) { + return i; +} + } + + return -1; +} + /** \} */ diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 20408327105..7bf8a93a97c 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -29,6 +29,7 @@ set(INC ../../windowmanager ../../../../intern/glew-mx ../../../../intern/guardedalloc + ../../../../extern/potrace/src ) set(SRC @@ -60,6 +61,7 @@ set(SRC gpencil_weight_paint.c gpencil_intern.h + gpencil_trace.h ) set(LIB @@ -67,6 +69,20 @@ set(LIB bf_blenlib ) +if(WITH_POTRACE) + list(APPEND SRC +gpencil_trace_ops.c +gpencil_trace_utils.c + ) + list(APPEND INC +${POTRACE_INCLUDE_DIRS} + ) + list(APPEND LIB +${POTRACE_LIBRARIES} + ) + add_definitions(-DWITH_POTRACE) +endif() + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index f45321b6b20..e3e2199f8a3 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -492,6 +492,7 @@ void GPENCIL_OT_convert(struct wmOperatorType *ot); void GPENCIL_OT_bake_mesh_animation(struct wmOperatorType *ot); void GPENCIL_OT_image_to_grease_pencil(struct wmOperatorType *ot); +void GPENCIL_OT_trace_image(struct wmOperatorType *ot); enum { GP_STROKE_JOIN = -1, diff --git
[Bf-blender-cvs] [d93db4f30c9] master: Cleanup: Declare variables where initialized
Commit: d93db4f30c9c435d84ff35529036368261c9b0db Author: Hans Goudey Date: Mon Sep 21 12:14:31 2020 -0500 Branches: master https://developer.blender.org/rBd93db4f30c9c435d84ff35529036368261c9b0db Cleanup: Declare variables where initialized === M source/blender/editors/interface/interface_icons.c === diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index d8a2ec53011..2fa7cc27eef 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -179,16 +179,12 @@ static const IconType icontypes[] = { static DrawInfo *def_internal_icon( ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type, int theme_color) { - Icon *new_icon = NULL; - IconImage *iimg = NULL; - DrawInfo *di; - - new_icon = MEM_callocN(sizeof(Icon), "texicon"); + Icon *new_icon = MEM_callocN(sizeof(Icon), "texicon"); new_icon->obj = NULL; /* icon is not for library object */ new_icon->id_type = 0; - di = MEM_callocN(sizeof(DrawInfo), "drawinfo"); + DrawInfo *di = MEM_callocN(sizeof(DrawInfo), "drawinfo"); di->type = type; if (ELEM(type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) { @@ -199,7 +195,7 @@ static DrawInfo *def_internal_icon( di->data.texture.h = size; } else if (type == ICON_TYPE_BUFFER) { -iimg = MEM_callocN(sizeof(IconImage), "icon_img"); +IconImage *iimg = MEM_callocN(sizeof(IconImage), "icon_img"); iimg->w = size; iimg->h = size; @@ -235,15 +231,12 @@ static DrawInfo *def_internal_icon( static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc) { - Icon *new_icon = NULL; - DrawInfo *di; - - new_icon = MEM_callocN(sizeof(Icon), "texicon"); + Icon *new_icon = MEM_callocN(sizeof(Icon), "texicon"); new_icon->obj = NULL; /* icon is not for library object */ new_icon->id_type = 0; - di = MEM_callocN(sizeof(DrawInfo), "drawinfo"); + DrawInfo *di = MEM_callocN(sizeof(DrawInfo), "drawinfo"); di->type = ICON_TYPE_VECTOR; di->data.vector.func = drawFunc; @@ -915,8 +908,6 @@ void UI_icons_reload_internal_textures(void) static void init_internal_icons(void) { - int x, y; - # if 0 // temp disabled if ((btheme != NULL) && btheme->tui.iconfile[0]) { char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); @@ -945,9 +936,9 @@ static void init_internal_icons(void) # endif /* Define icons. */ - for (y = 0; y < ICON_GRID_ROWS; y++) { + for (int y = 0; y < ICON_GRID_ROWS; y++) { /* Row W has monochrome icons. */ -for (x = 0; x < ICON_GRID_COLS; x++) { +for (int x = 0; x < ICON_GRID_COLS; x++) { const IconType icontype = icontypes[y * ICON_GRID_COLS + x]; if (!ELEM(icontype.type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) { continue; @@ -1010,20 +1001,17 @@ static void init_internal_icons(void) static void init_iconfile_list(struct ListBase *list) { - IconFile *ifile; - struct direntry *dir; - int index = 1; - const char *icondir; - BLI_listbase_clear(list); - icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); + const char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); if (icondir == NULL) { return; } + struct direntry *dir; int totfile = BLI_filelist_dir_contents(icondir, ); + int index = 1; for (int i = 0; i < totfile; i++) { if ((dir[i].type & S_IFREG)) { const char *filename = dir[i].relname; @@ -1058,7 +1046,7 @@ static void init_iconfile_list(struct ListBase *list) # endif /* removed */ /* found a potential icon file, so make an entry for it in the cache list */ -ifile = MEM_callocN(sizeof(IconFile), "IconFile"); +IconFile *ifile = MEM_callocN(sizeof(IconFile), "IconFile"); BLI_strncpy(ifile->filename, filename, sizeof(ifile->filename)); ifile->index = index; @@ -1151,9 +1139,8 @@ void UI_icons_free_drawinfo(void *drawinfo) static DrawInfo *icon_create_drawinfo(Icon *icon) { const int icon_data_type = icon->obj_type; - DrawInfo *di = NULL; - di = MEM_callocN(sizeof(DrawInfo), "di_icon"); + DrawInfo *di = MEM_callocN(sizeof(DrawInfo), "di_icon"); if (ELEM(icon_data_type, ICON_DATA_ID, ICON_DATA_PREVIEW)) { di->type = ICON_TYPE_PREVIEW; @@ -1188,10 +1175,7 @@ static DrawInfo *icon_ensure_drawinfo(Icon *icon) /* note!, returns unscaled by DPI */ int UI_icon_get_width(int icon_id) { - Icon *icon = NULL; - DrawInfo *di = NULL; - - icon = BKE_icon_get(icon_id); + Icon *icon = BKE_icon_get(icon_id); if (icon == NULL) { if (G.debug & G_DEBUG) { @@ -1200,7 +1184,7 @@ int UI_icon_get_width(int icon_id) return 0; } - di = icon_ensure_drawinfo(icon); + DrawInfo *di = icon_ensure_drawinfo(icon); if (di) { return
[Bf-blender-cvs] [11c94ad244e] lanpr-under-gp: Merge remote-tracking branch 'origin/master' into lanpr-under-gp
Commit: 11c94ad244e4e9cde15b697f27e091fda5551f16 Author: YimingWu Date: Mon Sep 21 22:40:23 2020 +0800 Branches: lanpr-under-gp https://developer.blender.org/rB11c94ad244e4e9cde15b697f27e091fda5551f16 Merge remote-tracking branch 'origin/master' into lanpr-under-gp # Conflicts: # source/blender/blenkernel/intern/scene.c === === diff --cc source/blender/blenkernel/intern/scene.c index aa30496cc83,39bb19c009a..a5c5704c3b7 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@@ -223,22 -223,16 +223,32 @@@ static void scene_init_data(ID *id BKE_view_layer_add(scene, "View Layer", NULL, VIEWLAYER_ADD_NEW); } + static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const int flag) + { + BLI_duplicatelist(_dst->markers, _src->markers); + LISTBASE_FOREACH (TimeMarker *, marker, _dst->markers) { + if (marker->prop != NULL) { + marker->prop = IDP_CopyProperty_ex(marker->prop, flag); + } + } + } + +static void BKE_lineart_free_everything(Scene *s) +{ +#if 0 + SceneLineart *lineart = >lineart; +#endif + /* Nothing to free. Reserved for future. */ +} + +static void BKE_lineart_copy_data(const Scene *from, Scene *to) +{ +#if 0 + const SceneLineart *lineart = >lineart; +#endif + /* Line layer removed. Currently nothing to do. Reserved for future. */ +} + static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) { Scene *scene_dst = (Scene *)id_dst; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a603f3ad53e] lanpr-under-gp: LineArt: Instanced collection child function bug.
Commit: a603f3ad53eb79565bdbad32770e3f5161035bf7 Author: YimingWu Date: Mon Sep 21 23:52:35 2020 +0800 Branches: lanpr-under-gp https://developer.blender.org/rBa603f3ad53eb79565bdbad32770e3f5161035bf7 LineArt: Instanced collection child function bug. === M source/blender/blenkernel/intern/collection.c M source/blender/makesdna/DNA_collection_types.h === diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 812e661fd85..ac21b143b4d 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -622,11 +622,11 @@ ListBase BKE_collection_object_cache_get(Collection *collection) ListBase BKE_collection_object_cache_instanced_get(Collection *collection) { - if (!(collection->flag & COLLECTION_HAS_OBJECT_CACHE)) { + if (!(collection->flag & COLLECTION_HAS_OBJECT_CACHE_INSTANCED)) { static ThreadMutex cache_lock = BLI_MUTEX_INITIALIZER; BLI_mutex_lock(_lock); -if (!(collection->flag & COLLECTION_HAS_OBJECT_CACHE)) { +if (!(collection->flag & COLLECTION_HAS_OBJECT_CACHE_INSTANCED)) { collection_object_cache_fill(>object_cache_instanced, collection, 0, true); collection->flag |= COLLECTION_HAS_OBJECT_CACHE_INSTANCED; } diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h index 0696a3dfb96..2cc052b2f67 100644 --- a/source/blender/makesdna/DNA_collection_types.h +++ b/source/blender/makesdna/DNA_collection_types.h @@ -97,7 +97,7 @@ enum { COLLECTION_RESTRICT_RENDER = (1 << 3), /* Disable in renders. */ COLLECTION_HAS_OBJECT_CACHE = (1 << 4), /* Runtime: object_cache is populated. */ COLLECTION_IS_MASTER = (1 << 5), /* Is master collection embedded in the scene. */ - COLLECTION_HAS_OBJECT_CACHE_INSTANCED = (1 << 4), /* for object_cache_instanced. */ + COLLECTION_HAS_OBJECT_CACHE_INSTANCED = (1 << 6), /* for object_cache_instanced. */ }; /* Collection->tag */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [978b97352a4] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: 978b97352a438229a39f94604e081b22205b6657 Author: Antonio Vazquez Date: Mon Sep 21 17:02:16 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB978b97352a438229a39f94604e081b22205b6657 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] [6f28e6998b3] blender-v2.90-release: Fix T80899: Crash on editing multiple UVs of multiple different objects at the same time
Commit: 6f28e6998b36f09b70fec059ad6bdc6bbfd175c6 Author: Sebastian Parborg Date: Mon Sep 21 16:07:24 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB6f28e6998b36f09b70fec059ad6bdc6bbfd175c6 Fix T80899: Crash on editing multiple UVs of multiple different objects at the same time The issue was two fold. First something sets the loop element tag and doesn't clear it before the UV code in question tries to use the tags. Added a sanity clear to make sure that it operates on a clean tag state. The next one was that the UV maps in question had quite a few points that had zero length UV loop edges. This would lead to division by zero. Reviewed By: Jeroen Bakker, Brecht Differential Revision: http://developer.blender.org/D8967 === M source/blender/blenlib/intern/math_geom.c M source/blender/editors/transform/transform_convert_mesh_uv.c === diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 83750277bf6..46db33283c3 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3335,10 +3335,16 @@ float closest_to_line_v3(float r_close[3], const float p[3], const float l1[3], float closest_to_line_v2(float r_close[2], const float p[2], const float l1[2], const float l2[2]) { - float h[2], u[2], lambda; + float h[2], u[2], lambda, denom; sub_v2_v2v2(u, l2, l1); sub_v2_v2v2(h, p, l1); - lambda = dot_v2v2(u, h) / dot_v2v2(u, u); + denom = dot_v2v2(u, u); + if (denom == 0.0f) { +r_close[0] = l1[0]; +r_close[1] = l1[1]; +return 0.0f; + } + lambda = dot_v2v2(u, h) / denom; r_close[0] = l1[0] + u[0] * lambda; r_close[1] = l1[1] + u[1] * lambda; return lambda; @@ -3353,12 +3359,12 @@ double closest_to_line_v2_db(double r_close[2], sub_v2_v2v2_db(u, l2, l1); sub_v2_v2v2_db(h, p, l1); denom = dot_v2v2_db(u, u); - if (denom < DBL_EPSILON) { + if (denom == 0.0) { r_close[0] = l1[0]; r_close[1] = l1[1]; return 0.0; } - lambda = dot_v2v2_db(u, h) / dot_v2v2_db(u, u); + lambda = dot_v2v2_db(u, h) / denom; r_close[0] = l1[0] + u[0] * lambda; r_close[1] = l1[1] + u[1] * lambda; return lambda; diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 92447c257da..b54c45e2ab2 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -301,6 +301,9 @@ void createTransUVs(bContext *C, TransInfo *t) BM_elem_flag_enable(efa, BM_ELEM_TAG); BM_ITER_ELEM (l, , efa, BM_LOOPS_OF_FACE) { +/* Make sure that the loop element flag is cleared for when we use it in + * uv_set_connectivity_distance later. */ +BM_elem_flag_disable(l, BM_ELEM_TAG); if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { countsel++; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e5a572157d8] master: Fix T80899: Crash on editing multiple UVs of multiple different objects at the same time
Commit: e5a572157d8cd5947a0b4b7420e728d57d6965ff Author: Sebastian Parborg Date: Mon Sep 21 16:07:24 2020 +0200 Branches: master https://developer.blender.org/rBe5a572157d8cd5947a0b4b7420e728d57d6965ff Fix T80899: Crash on editing multiple UVs of multiple different objects at the same time The issue was two fold. First something sets the loop element tag and doesn't clear it before the UV code in question tries to use the tags. Added a sanity clear to make sure that it operates on a clean tag state. The next one was that the UV maps in question had quite a few points that had zero length UV loop edges. This would lead to division by zero. Reviewed By: Jeroen Bakker, Brecht Differential Revision: http://developer.blender.org/D8967 === M source/blender/blenlib/intern/math_geom.c M source/blender/editors/transform/transform_convert_mesh_uv.c === diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 9cf1341b16a..1bc93a6a229 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3290,10 +3290,16 @@ float closest_to_line_v3(float r_close[3], const float p[3], const float l1[3], float closest_to_line_v2(float r_close[2], const float p[2], const float l1[2], const float l2[2]) { - float h[2], u[2], lambda; + float h[2], u[2], lambda, denom; sub_v2_v2v2(u, l2, l1); sub_v2_v2v2(h, p, l1); - lambda = dot_v2v2(u, h) / dot_v2v2(u, u); + denom = dot_v2v2(u, u); + if (denom == 0.0f) { +r_close[0] = l1[0]; +r_close[1] = l1[1]; +return 0.0f; + } + lambda = dot_v2v2(u, h) / denom; r_close[0] = l1[0] + u[0] * lambda; r_close[1] = l1[1] + u[1] * lambda; return lambda; @@ -3308,12 +3314,12 @@ double closest_to_line_v2_db(double r_close[2], sub_v2_v2v2_db(u, l2, l1); sub_v2_v2v2_db(h, p, l1); denom = dot_v2v2_db(u, u); - if (denom < DBL_EPSILON) { + if (denom == 0.0) { r_close[0] = l1[0]; r_close[1] = l1[1]; return 0.0; } - lambda = dot_v2v2_db(u, h) / dot_v2v2_db(u, u); + lambda = dot_v2v2_db(u, h) / denom; r_close[0] = l1[0] + u[0] * lambda; r_close[1] = l1[1] + u[1] * lambda; return lambda; diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 92447c257da..b54c45e2ab2 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -301,6 +301,9 @@ void createTransUVs(bContext *C, TransInfo *t) BM_elem_flag_enable(efa, BM_ELEM_TAG); BM_ITER_ELEM (l, , efa, BM_LOOPS_OF_FACE) { +/* Make sure that the loop element flag is cleared for when we use it in + * uv_set_connectivity_distance later. */ +BM_elem_flag_disable(l, BM_ELEM_TAG); if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { countsel++; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b8cef3b2dcc] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve
Commit: b8cef3b2dcc2c738820b30908e5f04ec520f11a3 Author: Antonio Vazquez Date: Mon Sep 21 15:48:04 2020 +0200 Branches: greasepencil-edit-curve https://developer.blender.org/rBb8cef3b2dcc2c738820b30908e5f04ec520f11a3 Merge branch 'master' into greasepencil-edit-curve === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9d3550d7819] master: Various fixes in UI messages.
Commit: 9d3550d7819807064dd39365322295ebd8ea0a09 Author: Bastien Montagne Date: Mon Sep 21 15:17:41 2020 +0200 Branches: master https://developer.blender.org/rB9d3550d7819807064dd39365322295ebd8ea0a09 Various fixes in UI messages. Along some other typos in comments or variable names. === M release/scripts/modules/bl_i18n_utils/settings.py M release/scripts/modules/bl_i18n_utils/utils_spell_check.py M release/scripts/startup/bl_ui/properties_physics_fluid.py M source/blender/blenkernel/intern/brush.c M source/blender/blenkernel/intern/scene.c M source/blender/editors/gpencil/gpencil_sculpt_paint.c M source/blender/editors/gpencil/gpencil_vertex_paint.c M source/blender/editors/gpencil/gpencil_weight_paint.c M source/blender/editors/sculpt_paint/paint_cursor.c M source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c M source/blender/makesrna/intern/rna_brush.c M source/blender/makesrna/intern/rna_curve.c M source/blender/makesrna/intern/rna_rigidbody.c === diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index a6101474aa9..e304ef5ea17 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -376,6 +376,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "multi-res modifier", "non-triangle face", "normal", +"performance impact!", "right", "the lazy dog", "unable to load movie clip", diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index 0ec3a322173..986f785a1ff 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -124,13 +124,14 @@ class SpellChecker: "forcefield", "forcefields", "fulldome", "fulldomes", "fullscreen", -"gridline", +"gridline", "gridlines", "hardlight", "hemi", "hostname", "inbetween", "inscatter", "inscattering", "libdata", +"lightcache", "lightprobe", "lightprobes", "lightless", "lineset", @@ -161,6 +162,7 @@ class SpellChecker: "online", "playhead", "popup", "popups", +"pointcloud", "pre", "precache", "precaching", "precalculate", @@ -182,6 +184,7 @@ class SpellChecker: "reprojection", "reproject", "reprojecting", "resize", "restpose", +"resync", "retarget", "retargets", "retargeting", "retargeted", "retiming", "rigidbody", @@ -608,6 +611,7 @@ class SpellChecker: "courant", "cryptomatte", "crypto", "embree", +"gmp", "hosek", "kutta", "lennard", diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index a8185a3e66f..8bf7430d067 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -1384,7 +1384,7 @@ class PHYSICS_PT_viewport_display_debug(PhysicButtonsPanel, Panel): if not domain.use_guide and domain.vector_field == 'GUIDE_VELOCITY': note = layout.split() -note.label(icon='INFO', text="Enable Guides first! Defaulting to Fluid Velocity.") +note.label(icon='INFO', text="Enable Guides first! Defaulting to Fluid Velocity") if domain.vector_display_type == 'MAC': sub = col.column(heading="MAC Grid") diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 7eea911f515..3e45d7377b2 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -250,7 +250,7 @@ static void brush_blend_read_data(BlendDataReader *reader, ID *id) { Brush *brush = (Brush *)id; - /* fallof curve */ + /* Falloff curve. */ BLO_read_data_address(reader, >curve); BLO_read_data_address(reader, >gradient); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2a3ac89a8a7..39bb19c009a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -724,7 +724,7 @@ ToolSettings *BKE_toolsettings_copy(ToolSettings *toolsettings, const int flag) /* duplicate Grease Pencil interpolation curve */ ts->gp_interpolate.custom_ipo = BKE_curvemapping_copy(ts->gp_interpolate.custom_ipo); - /* duplicate Grease Pencil multiframe fallof */ + /* Duplicate Grease Pencil multiframe falloff. */ ts->gp_sculpt.cur_falloff =
[Bf-blender-cvs] [7883ccd29fe] master: Fix T80854: Search buttons fail in Adjust Last Operation Panel
Commit: 7883ccd29fe1dc37dff6c46ee0e9ba05366d Author: Julian Eisel Date: Mon Sep 21 14:57:32 2020 +0200 Branches: master https://developer.blender.org/rB7883ccd29fe1dc37dff6c46ee0e9ba05366d Fix T80854: Search buttons fail in Adjust Last Operation Panel There's the old and ugly hack where the `uiBut.poin` points to the button itself. When reallocating the button we have to update that pointer of course. === M source/blender/editors/interface/interface.c === diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2cb58c92449..8b149e2f97b 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3988,12 +3988,16 @@ uiBut *ui_but_change_type(uiBut *but, eButType new_type) const void *old_but_ptr = but; /* Button may have pointer to a member within itself, this will have to be updated. */ const bool has_str_ptr_to_self = but->str == but->strdata; + const bool has_poin_ptr_to_self = but->poin == (char *)but; but = MEM_recallocN_id(but, alloc_size, alloc_str); but->type = new_type; if (has_str_ptr_to_self) { but->str = but->strdata; } + if (has_poin_ptr_to_self) { +but->poin = (char *)but; + } BLI_insertlinkafter(>block->buttons, insert_after_but, but); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a34e7c3e5d8] master: Cleanup (UI): Early-exit rather than having a big-ish conditional body
Commit: a34e7c3e5d844fd2b9e628534e93892467a7897e Author: Julian Eisel Date: Mon Sep 21 15:03:02 2020 +0200 Branches: master https://developer.blender.org/rBa34e7c3e5d844fd2b9e628534e93892467a7897e Cleanup (UI): Early-exit rather than having a big-ish conditional body It's generally considered a better codestyle to check conditions early and exit early when they are not met, over having most logic of a function within a big `if`-block. Otherwise people have to go over the entire block to see if there's possibly an `else` somewhere, or any followup logic. === M source/blender/editors/interface/interface.c === diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 8b149e2f97b..f0d19c38537 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3972,41 +3972,44 @@ static uiBut *ui_but_alloc(const eButType type) */ uiBut *ui_but_change_type(uiBut *but, eButType new_type) { - if (but->type != new_type) { -size_t alloc_size; -const char *alloc_str; -uiBut *insert_after_but = but->prev; -bool new_has_custom_type, old_has_custom_type; - -/* Remove old button address */ -BLI_remlink(>block->buttons, but); - -ui_but_alloc_info(but->type, NULL, NULL, _has_custom_type); -ui_but_alloc_info(new_type, _size, _str, _has_custom_type); - -if (new_has_custom_type || old_has_custom_type) { - const void *old_but_ptr = but; - /* Button may have pointer to a member within itself, this will have to be updated. */ - const bool has_str_ptr_to_self = but->str == but->strdata; - const bool has_poin_ptr_to_self = but->poin == (char *)but; - - but = MEM_recallocN_id(but, alloc_size, alloc_str); - but->type = new_type; - if (has_str_ptr_to_self) { -but->str = but->strdata; - } - if (has_poin_ptr_to_self) { -but->poin = (char *)but; - } + if (but->type == new_type) { +/* Nothing to do. */ +return but; + } - BLI_insertlinkafter(>block->buttons, insert_after_but, but); + size_t alloc_size; + const char *alloc_str; + uiBut *insert_after_but = but->prev; + bool new_has_custom_type, old_has_custom_type; - if (but->layout) { -const bool found_layout = ui_layout_replace_but_ptr(but->layout, old_but_ptr, but); -BLI_assert(found_layout); -UNUSED_VARS_NDEBUG(found_layout); -ui_button_group_replace_but_ptr(but->layout, old_but_ptr, but); - } + /* Remove old button address */ + BLI_remlink(>block->buttons, but); + + ui_but_alloc_info(but->type, NULL, NULL, _has_custom_type); + ui_but_alloc_info(new_type, _size, _str, _has_custom_type); + + if (new_has_custom_type || old_has_custom_type) { +const void *old_but_ptr = but; +/* Button may have pointer to a member within itself, this will have to be updated. */ +const bool has_str_ptr_to_self = but->str == but->strdata; +const bool has_poin_ptr_to_self = but->poin == (char *)but; + +but = MEM_recallocN_id(but, alloc_size, alloc_str); +but->type = new_type; +if (has_str_ptr_to_self) { + but->str = but->strdata; +} +if (has_poin_ptr_to_self) { + but->poin = (char *)but; +} + +BLI_insertlinkafter(>block->buttons, insert_after_but, but); + +if (but->layout) { + const bool found_layout = ui_layout_replace_but_ptr(but->layout, old_but_ptr, but); + BLI_assert(found_layout); + UNUSED_VARS_NDEBUG(found_layout); + ui_button_group_replace_but_ptr(but->layout, old_but_ptr, but); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [87d2ac96812] master: Cleanup: move some paint helpers to ED_ 'namespace'.
Commit: 87d2ac96812fd30bcfcef34a8b78b9df8a72982e Author: Bastien Montagne Date: Mon Sep 21 14:43:29 2020 +0200 Branches: master https://developer.blender.org/rB87d2ac96812fd30bcfcef34a8b78b9df8a72982e Cleanup: move some paint helpers to ED_ 'namespace'. Those two functions had `BKE_` prefix, were defined in BKE headers, but implemented in ED code, yuck. Moved everything to ED area for now, since those do not look fondamental enough to belong to BKE, and none of their usages requires it currently. === M source/blender/blenkernel/BKE_paint.h M source/blender/editors/include/ED_paint.h M source/blender/editors/mesh/mesh_data.c M source/blender/editors/render/render_shading.c M source/blender/editors/render/render_update.c M source/blender/editors/sculpt_paint/paint_image.c M source/blender/editors/sculpt_paint/paint_image_proj.c M source/blender/editors/util/ed_util.c M source/blender/makesrna/intern/rna_sculpt_paint.c === diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 5af9c35cab6..dfd7dafe2eb 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -182,11 +182,6 @@ void BKE_paint_palette_set(struct Paint *p, struct Palette *palette); void BKE_paint_curve_set(struct Brush *br, struct PaintCurve *pc); void BKE_paint_curve_clamp_endpoint_add_index(struct PaintCurve *pc, const int add_index); -void BKE_paint_data_warning( -struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil); -bool BKE_paint_proj_mesh_data_check( -struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil); - /* testing face select mode * Texture paint could be removed since selected faces are not used * however hiding faces is useful */ diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h index 39c5e3521d6..dec1f6844b2 100644 --- a/source/blender/editors/include/ED_paint.h +++ b/source/blender/editors/include/ED_paint.h @@ -53,6 +53,11 @@ void ED_imapaint_bucket_fill(struct bContext *C, struct wmOperator *op, const int mouse[2]); +/* paint_image_proj.c */ +void ED_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil); +bool ED_paint_proj_mesh_data_check( +struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil); + /* image_undo.c */ void ED_image_undo_push_begin(const char *name, int paint_mode); void ED_image_undo_push_begin_with_image(const char *name, diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 1537be0aef6..236e0a35f4e 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -36,7 +36,6 @@ #include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_mesh.h" -#include "BKE_paint.h" #include "BKE_report.h" #include "DEG_depsgraph.h" @@ -49,6 +48,7 @@ #include "ED_mesh.h" #include "ED_object.h" +#include "ED_paint.h" #include "ED_screen.h" #include "ED_uvedit.h" #include "ED_view3d.h" @@ -609,7 +609,7 @@ static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->mode & OB_MODE_TEXTURE_PAINT) { Scene *scene = CTX_data_scene(C); -BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); +ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } @@ -642,7 +642,7 @@ static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->mode & OB_MODE_TEXTURE_PAINT) { Scene *scene = CTX_data_scene(C); -BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); +ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 2b52ae117fc..b9fc72776a2 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -57,7 +57,6 @@ #include "BKE_main.h" #include "BKE_material.h" #include "BKE_object.h" -#include "BKE_paint.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_texture.h" @@ -82,6 +81,7 @@ #include "ED_mesh.h" #include "ED_node.h" #include "ED_object.h" +#include "ED_paint.h" #include "ED_render.h" #include "ED_scene.h" #include "ED_screen.h" @@ -178,7 +178,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->mode & OB_MODE_TEXTURE_PAINT) { Scene *scene = CTX_data_scene(C); -BKE_paint_proj_mesh_data_check(scene, ob, NULL,
[Bf-blender-cvs] [82aa300e1ce] master: Fix T79373: Forbid painting on linked image from 3DView.
Commit: 82aa300e1ce47f2b77e868ba43ffeaff0dc7bf96 Author: Bastien Montagne Date: Mon Sep 21 14:24:55 2020 +0200 Branches: master https://developer.blender.org/rB82aa300e1ce47f2b77e868ba43ffeaff0dc7bf96 Fix T79373: Forbid painting on linked image from 3DView. As noted by @lichtwerk (thanks), one can have a local object and/or material using a linked image data-block, this case needs some different handling to prevent painting on such linked image. For now, tweak `BKE_paint_proj_mesh_data_check` (k, that name prefix!) to consider paintslots with linked image as 'non-existing'. === M source/blender/editors/sculpt_paint/paint_image_proj.c === diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index bc1080208a5..0c07b84426b 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6333,19 +6333,15 @@ bool BKE_paint_proj_mesh_data_check( for (int i = 1; i < ob->totcol + 1; i++) { Material *ma = BKE_object_material_get(ob, i); -if (ma) { +if (ma && !ID_IS_LINKED(ma)) { hasmat = true; - if (!ma->texpaintslot) { + if (ma->texpaintslot == NULL) { /* refresh here just in case */ BKE_texpaint_slot_refresh_cache(scene, ma); - -/* if still no slots, we have to add */ -if (ma->texpaintslot) { - hastex = true; - break; -} } - else { + if (ma->texpaintslot != NULL && + (ma->texpaintslot[ma->paint_active_slot].ima == NULL || + !ID_IS_LINKED(ma->texpaintslot[ma->paint_active_slot].ima))) { hastex = true; break; } @@ -6354,7 +6350,7 @@ bool BKE_paint_proj_mesh_data_check( } } else if (imapaint->mode == IMAGEPAINT_MODE_IMAGE) { -if (imapaint->canvas == NULL) { +if (imapaint->canvas == NULL || ID_IS_LINKED(imapaint->canvas)) { hastex = false; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [154752243dd] master: Add missing new liboverride option to py-defined collections props doc.
Commit: 154752243dd726676d5e7c3c2ddf6a9dced678e2 Author: Bastien Montagne Date: Mon Sep 21 13:54:16 2020 +0200 Branches: master https://developer.blender.org/rB154752243dd726676d5e7c3c2ddf6a9dced678e2 Add missing new liboverride option to py-defined collections props doc. === M source/blender/python/intern/bpy_props.c === diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 33efbce24e9..fbfe878ea5f 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -121,7 +121,8 @@ static const EnumPropertyItem property_flag_override_collection_items[] = { }; #define BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC \ - " :arg override: Enumerator in ['LIBRARY_OVERRIDABLE', 'NO_PROPERTY_NAME'].\n" \ + " :arg override: Enumerator in ['LIBRARY_OVERRIDABLE', 'NO_PROPERTY_NAME', " \ + "'USE_INSERTION'].\n" \ " :type override: set\n" /* subtypes */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [55bc6ac1735] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance
Commit: 55bc6ac1735133b5c65abf074f50beb0d22e8f18 Author: Ankit Meel Date: Mon Sep 21 16:52:00 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB55bc6ac1735133b5c65abf074f50beb0d22e8f18 Merge branch 'master' into soc-2020-io-performance === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0444cabb41a] soc-2020-io-performance: Keep axes defaults same as python importer.
Commit: 0444cabb41af07fdc737f2d67918cc12563bd1c9 Author: Ankit Meel Date: Mon Sep 21 16:12:35 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB0444cabb41af07fdc737f2d67918cc12563bd1c9 Keep axes defaults same as python importer. === M source/blender/editors/io/io_obj.c === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index 35cde0e3ea5..7b8b1a03a78 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -458,8 +458,8 @@ void WM_OT_obj_import(struct wmOperatorType *ot) RNA_def_enum(ot->srna, "forward_axis", io_obj_transform_axis_forward, - OBJ_AXIS_NEGATIVE_Y_FORWARD, + OBJ_AXIS_NEGATIVE_Z_FORWARD, "Forward Axis", ""); - RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Z_UP, "Up Axis", ""); + RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Y_UP, "Up Axis", ""); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9e04dc90c7e] soc-2020-io-performance: Cleanup: clang format.
Commit: 9e04dc90c7e99be7aeb0d6baa43588f74040bd97 Author: Ankit Meel Date: Mon Sep 21 16:20:19 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB9e04dc90c7e99be7aeb0d6baa43588f74040bd97 Cleanup: clang format. === M source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc M source/blender/io/wavefront_obj/intern/obj_import_mtl.cc M source/blender/io/wavefront_obj/intern/parser_string_utils.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc index 585b276ce34..76786e6f3c9 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc @@ -36,7 +36,6 @@ namespace blender::io::obj { using std::string; - /** * Based on the properties of the given Geometry instance, create a new Geometry instance * or return the previous one. diff --git a/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc b/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc index 1a7d90a9774..f8d7aa49926 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc @@ -73,7 +73,6 @@ static void set_property_of_socket(eNodeSocketDatatype property_type, } } - /** * Load image for Image Texture node and set the node properties. * Return success if Image can be loaded successfully. @@ -119,8 +118,7 @@ static bool load_texture_image(Main *bmain, const tex_map_XX _map, bNode *r_ * Initialises a nodetree with a p-BSDF node's BSDF socket connected to shader output node's * surface socket. */ -ShaderNodetreeWrap::ShaderNodetreeWrap(Main *bmain, const MTLMaterial _mat) -: mtl_mat_(mtl_mat) +ShaderNodetreeWrap::ShaderNodetreeWrap(Main *bmain, const MTLMaterial _mat) : mtl_mat_(mtl_mat) { nodetree_.reset(ntreeAddTree(nullptr, "Shader Nodetree", ntreeType_Shader->idname)); bsdf_.reset(add_node_to_tree(SH_NODE_BSDF_PRINCIPLED)); @@ -312,8 +310,8 @@ void ShaderNodetreeWrap::set_bsdf_socket_values() } } float3 base_color = {std::max(0.0f, mtl_mat_.Kd[0]), -std::max(0.0f, mtl_mat_.Kd[1]), -std::max(0.0f, mtl_mat_.Kd[2])}; + std::max(0.0f, mtl_mat_.Kd[1]), + std::max(0.0f, mtl_mat_.Kd[2])}; float3 emission_color = {std::max(0.0f, mtl_mat_.Ke[0]), std::max(0.0f, mtl_mat_.Ke[1]), std::max(0.0f, mtl_mat_.Ke[2])}; diff --git a/source/blender/io/wavefront_obj/intern/parser_string_utils.cc b/source/blender/io/wavefront_obj/intern/parser_string_utils.cc index 3ada52e6dde..afaa272b1dc 100644 --- a/source/blender/io/wavefront_obj/intern/parser_string_utils.cc +++ b/source/blender/io/wavefront_obj/intern/parser_string_utils.cc @@ -17,8 +17,8 @@ * All rights reserved. */ -#include #include +#include #include #include "BLI_float3.hh" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [78bbdbd9317] soc-2020-io-performance: Add emission strength to MTL importer.
Commit: 78bbdbd93170e7771a580ef428a167b2d34b9065 Author: Ankit Meel Date: Mon Sep 21 16:19:59 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB78bbdbd93170e7771a580ef428a167b2d34b9065 Add emission strength to MTL importer. Ref rBAec4ad081e564 === M source/blender/io/wavefront_obj/intern/obj_import_mtl.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc b/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc index 562226e56b8..1a7d90a9774 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_mtl.cc @@ -314,12 +314,15 @@ void ShaderNodetreeWrap::set_bsdf_socket_values() float3 base_color = {std::max(0.0f, mtl_mat_.Kd[0]), std::max(0.0f, mtl_mat_.Kd[1]), std::max(0.0f, mtl_mat_.Kd[2])}; - float3 emission = {std::max(0.0f, mtl_mat_.Ke[0]), -std::max(0.0f, mtl_mat_.Ke[1]), -std::max(0.0f, mtl_mat_.Ke[2])}; + float3 emission_color = {std::max(0.0f, mtl_mat_.Ke[0]), + std::max(0.0f, mtl_mat_.Ke[1]), + std::max(0.0f, mtl_mat_.Ke[2])}; set_property_of_socket(SOCK_RGBA, "Base Color", {base_color, 3}, bsdf_.get()); - set_property_of_socket(SOCK_RGBA, "Emission", {emission, 3}, bsdf_.get()); + set_property_of_socket(SOCK_RGBA, "Emission", {emission_color, 3}, bsdf_.get()); + if (mtl_mat_.texture_maps.contains_as("Emission")) { +set_property_of_socket(SOCK_FLOAT, "Emission Strength", {1.0f}, bsdf_.get()); + } set_property_of_socket(SOCK_FLOAT, "Specular", {specular}, bsdf_.get()); set_property_of_socket(SOCK_FLOAT, "Roughness", {roughness}, bsdf_.get()); set_property_of_socket(SOCK_FLOAT, "Metallic", {metallic}, bsdf_.get()); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [84d32cb5c5e] soc-2020-io-performance: Cleanup: Remove unneeded headers.
Commit: 84d32cb5c5e26a4281deea4c77c3c31d1026798d Author: Ankit Meel Date: Mon Sep 21 17:04:48 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB84d32cb5c5e26a4281deea4c77c3c31d1026798d Cleanup: Remove unneeded headers. No functional change. === M source/blender/io/wavefront_obj/intern/obj_export_mtl.cc M source/blender/io/wavefront_obj/intern/obj_export_mtl.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc index 90879a61809..d432e3c5e5c 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc @@ -35,7 +35,6 @@ #include "obj_export_mesh.hh" #include "obj_export_mtl.hh" -#include "obj_import_mtl.hh" namespace blender::io::obj { diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh b/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh index a1b4950d730..cc06c7312ce 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh +++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh @@ -30,8 +30,6 @@ #include "DNA_node_types.h" -#include "obj_export_mesh.hh" - namespace blender::io::obj { class OBJMesh; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [33bd98a97bd] soc-2020-io-performance: Remove duplicate MTLMaterial, tex_map_XX. clean-up headers.
Commit: 33bd98a97bd68b675d462a020218bc9d88601822 Author: Ankit Meel Date: Mon Sep 21 16:10:35 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB33bd98a97bd68b675d462a020218bc9d88601822 Remove duplicate MTLMaterial, tex_map_XX. clean-up headers. === M source/blender/io/wavefront_obj/intern/obj_export_mtl.hh M source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc M source/blender/io/wavefront_obj/intern/obj_import_objects.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh b/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh index af287b6c071..a1b4950d730 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh +++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh @@ -33,6 +33,7 @@ #include "obj_export_mesh.hh" namespace blender::io::obj { +class OBJMesh; /** * Generic container for texture node properties. diff --git a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc index f3911c724cd..585b276ce34 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/intern/obj_import_file_reader.cc @@ -28,10 +28,10 @@ #include "BLI_string_ref.hh" #include "BLI_vector.hh" -#include "obj_export_file_writer.hh" -#include "obj_import_file_reader.hh" #include "parser_string_utils.hh" +#include "obj_import_file_reader.hh" + namespace blender::io::obj { using std::string; diff --git a/source/blender/io/wavefront_obj/intern/obj_import_objects.hh b/source/blender/io/wavefront_obj/intern/obj_import_objects.hh index 12a93233ab3..da156c39117 100644 --- a/source/blender/io/wavefront_obj/intern/obj_import_objects.hh +++ b/source/blender/io/wavefront_obj/intern/obj_import_objects.hh @@ -33,8 +33,6 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "obj_export_file_writer.hh" - namespace blender::io::obj { /** ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ef8b8f4030f] soc-2020-io-performance: Material: style guide, Class rearrangement.
Commit: ef8b8f4030fbf98a3e88a98e43ec8d73db1c9695 Author: Ankit Meel Date: Mon Sep 21 13:58:01 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rBef8b8f4030fbf98a3e88a98e43ec8d73db1c9695 Material: style guide, Class rearrangement. === M source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc M source/blender/io/wavefront_obj/intern/obj_export_mtl.cc M source/blender/io/wavefront_obj/intern/obj_export_mtl.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc index 935acc1b7e6..c0ecbd7d629 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc @@ -546,19 +546,19 @@ void MTLWriter::write_texture_map(const MTLMaterial _material, void MTLWriter::append_materials(const OBJMesh _to_export) { BLI_assert(this->good()); - if (!mtl_outfile_) { -/* Error logging in constructor. */ + if (!this->good()) { return; } Vector mtl_materials; - MaterialWrap mat_wrap(mesh_to_export, mtl_materials); - mat_wrap.fill_materials(); + MaterialWrap mat_wrap; + mat_wrap.fill_materials(mesh_to_export, mtl_materials); #ifdef DEBUG auto all_items_positive = [](const float3 ) { return triplet.x >= 0.0f && triplet.y >= 0.0f && triplet.z >= 0.0f; }; #endif + for (const MTLMaterial _material : mtl_materials) { fprintf(mtl_outfile_, "\nnewmtl %s\n", mtl_material.name.c_str()); /* At least one material property has not been modified since its initialisation. */ diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc index b0c6a6df7c8..af9cff8860d 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc @@ -42,10 +42,10 @@ namespace blender::io::obj { /** * Copy a float property of the given type from the bNode to given buffer. */ -static void copy_property_from_node(MutableSpan r_property, -eNodeSocketDatatype property_type, +static void copy_property_from_node(const eNodeSocketDatatype property_type, const bNode *curr_node, -const char *identifier) +const char *identifier, +MutableSpan r_property) { if (!curr_node) { return; @@ -88,10 +88,10 @@ static void copy_property_from_node(MutableSpan r_property, /** * Collect all the source sockets linked to the destination socket in a destination node. */ -static void linked_sockets_to_dest_id(Vector _linked_sockets, - const bNode *dest_node, - nodes::NodeTreeRef _tree, - StringRefNull dest_socket_id) +static void linked_sockets_to_dest_id(const bNode *dest_node, + const nodes::NodeTreeRef _tree, + StringRefNull dest_socket_id, + Vector _linked_sockets) { if (!dest_node) { return; @@ -194,19 +194,19 @@ void MaterialWrap::store_bsdf_properties(MTLMaterial _mtl_mat) const spec_exponent *= spec_exponent; /* If p-BSDF is not present, fallback to `Material *` of the object. */ float specular = export_mtl_->spec; - copy_property_from_node({, 1}, SOCK_FLOAT, bsdf_node_, "Specular"); + copy_property_from_node(SOCK_FLOAT, bsdf_node_, "Specular", {, 1}); float metallic = export_mtl_->metallic; - copy_property_from_node({, 1}, SOCK_FLOAT, bsdf_node_, "Metallic"); + copy_property_from_node(SOCK_FLOAT, bsdf_node_, "Metallic", {, 1}); float refraction_index = 1.0f; - copy_property_from_node({_index, 1}, SOCK_FLOAT, bsdf_node_, "IOR"); + copy_property_from_node(SOCK_FLOAT, bsdf_node_, "IOR", {_index, 1}); float dissolved = export_mtl_->a; - copy_property_from_node({, 1}, SOCK_FLOAT, bsdf_node_, "Alpha"); + copy_property_from_node(SOCK_FLOAT, bsdf_node_, "Alpha", {, 1}); bool transparent = dissolved != 1.0f; float3 diffuse_col = {export_mtl_->r, export_mtl_->g, export_mtl_->b}; - copy_property_from_node({diffuse_col, 3}, SOCK_RGBA, bsdf_node_, "Base Color"); - float3 emission_col = {0.0f, 0.0f, 0.0f}; - copy_property_from_node({emission_col, 3}, SOCK_RGBA, bsdf_node_, "Emission"); + copy_property_from_node(SOCK_RGBA, bsdf_node_, "Base Color", {diffuse_col, 3}); + float3 emission_col{0.0f}; + copy_property_from_node(SOCK_RGBA, bsdf_node_, "Emission", {emission_col, 3}); /* See https://wikipedia.org/wiki/Wavefront_.obj_file for all possible values of illum. */
[Bf-blender-cvs] [5ab177be326] soc-2020-io-performance: Replace uint and short with int and int16_t
Commit: 5ab177be32673b624c765219bf0a0363e2d04f41 Author: Ankit Meel Date: Mon Sep 21 13:30:18 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB5ab177be32673b624c765219bf0a0363e2d04f41 Replace uint and short with int and int16_t === M source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc M source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh M source/blender/io/wavefront_obj/intern/obj_export_mesh.cc M source/blender/io/wavefront_obj/intern/obj_export_mesh.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc index 6e7f084dd69..be9f39cc4ce 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc @@ -40,13 +40,14 @@ const int SMOOTH_GROUP_DEFAULT = 1; /** * Write one line of polygon indices as f v1/vt1/vn1 v2/vt2/vn2 ... . */ -void OBJWriter::write_vert_uv_normal_indices(Span vert_indices, - Span uv_indices, - Span normal_indices, - const uint tot_loop) const +void OBJWriter::write_vert_uv_normal_indices(Span vert_indices, + Span uv_indices, + Span normal_indices) const { + BLI_assert(vert_indices.size() == uv_indices.size() && + vert_indices.size() == normal_indices.size()); fprintf(outfile_, "f"); - for (uint j = 0; j < tot_loop; j++) { + for (int j = 0; j < vert_indices.size(); j++) { fprintf(outfile_, " %u/%u/%u", vert_indices[j] + index_offsets_.vertex_offset + 1, @@ -59,13 +60,13 @@ void OBJWriter::write_vert_uv_normal_indices(Span vert_indices, /** * Write one line of polygon indices as f v1//vn1 v2//vn2 ... . */ -void OBJWriter::write_vert_normal_indices(Span vert_indices, - Span, - Span normal_indices, - const uint tot_loop) const +void OBJWriter::write_vert_normal_indices(Span vert_indices, + Span, + Span normal_indices) const { + BLI_assert(vert_indices.size() == normal_indices.size()); fprintf(outfile_, "f"); - for (uint j = 0; j < tot_loop; j++) { + for (int j = 0; j < vert_indices.size(); j++) { fprintf(outfile_, " %u//%u", vert_indices[j] + index_offsets_.vertex_offset + 1, @@ -77,13 +78,13 @@ void OBJWriter::write_vert_normal_indices(Span vert_indices, /** * Write one line of polygon indices as f v1/vt1 v2/vt2 ... . */ -void OBJWriter::write_vert_uv_indices(Span vert_indices, - Span uv_indices, - Span, - const uint tot_loop) const +void OBJWriter::write_vert_uv_indices(Span vert_indices, + Span uv_indices, + Span) const { + BLI_assert(vert_indices.size() == uv_indices.size()); fprintf(outfile_, "f"); - for (uint j = 0; j < tot_loop; j++) { + for (int j = 0; j < vert_indices.size(); j++) { fprintf(outfile_, " %u/%u", vert_indices[j] + index_offsets_.vertex_offset + 1, @@ -95,13 +96,10 @@ void OBJWriter::write_vert_uv_indices(Span vert_indices, /** * Write one line of polygon indices as f v1 v2 ... . */ -void OBJWriter::write_vert_indices(Span vert_indices, - Span, - Span, - const uint tot_loop) const +void OBJWriter::write_vert_indices(Span vert_indices, Span, Span) const { fprintf(outfile_, "f"); - for (uint j = 0; j < tot_loop; j++) { + for (int j = 0; j < vert_indices.size(); j++) { fprintf(outfile_, " %u", vert_indices[j] + index_offsets_.vertex_offset + 1); } fprintf(outfile_, "\n"); @@ -162,7 +160,7 @@ void OBJWriter::write_object_name(const OBJMesh _mesh_data) const void OBJWriter::write_vertex_coords(const OBJMesh _mesh_data) const { const int tot_vertices = obj_mesh_data.tot_vertices(); - for (uint i = 0; i < tot_vertices; i++) { + for (int i = 0; i < tot_vertices; i++) { float3 vertex = obj_mesh_data.calc_vertex_coords(i, export_params_.scaling_factor); fprintf(outfile_, "v %f %f %f\n", vertex[0], vertex[1], vertex[2]); } @@ -191,7 +189,7 @@ void OBJWriter::write_poly_normals(OBJMesh _mesh_data) const obj_mesh_data.ensure_mesh_normals(); Vector lnormals; const int tot_polygons =
[Bf-blender-cvs] [8b316eb7a82] soc-2020-io-performance: Mesh: remove unused function, wrong assert, {} etc.
Commit: 8b316eb7a8220a55dd1abedd7cbdfd82f2f2798f Author: Ankit Meel Date: Mon Sep 21 14:02:44 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB8b316eb7a8220a55dd1abedd7cbdfd82f2f2798f Mesh: remove unused function, wrong assert, {} etc. === M source/blender/io/wavefront_obj/intern/obj_export_mesh.cc M source/blender/io/wavefront_obj/intern/obj_export_mesh.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc b/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc index f601560be01..e5e8e1a1cb9 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc @@ -76,7 +76,6 @@ OBJMesh::~OBJMesh() if (poly_smooth_groups_) { MEM_freeN(poly_smooth_groups_); } - BLI_assert(!(mesh_eval_needs_free_ && export_mesh_eval_)); } void OBJMesh::free_mesh_if_needed() @@ -233,7 +232,13 @@ void OBJMesh::calc_smooth_groups(const bool use_bitflags) const Material *OBJMesh::get_object_material(const int16_t mat_nr) const { /* "+ 1" as material getter needs one-based indices. */ - return BKE_object_material_get(export_object_eval_, mat_nr + 1); + const Material *r_mat = BKE_object_material_get(export_object_eval_, mat_nr + 1); +#ifdef DEBUG + if (!r_mat) { +std::cerr << "Material not found for mat_nr = " << mat_nr << std::endl; + } +#endif + return r_mat; } bool OBJMesh::is_ith_poly_smooth(const int poly_index) const @@ -252,12 +257,6 @@ int16_t OBJMesh::ith_poly_matnr(const int poly_index) const return r_mat_nr > 0 ? r_mat_nr : NOT_FOUND; } -int OBJMesh::ith_poly_totloop(const int poly_index) const -{ - BLI_assert(poly_index < export_mesh_eval_->totpoly); - return export_mesh_eval_->mpoly[poly_index].totloop; -} - /** * Get object name as it appears in the outliner. */ @@ -267,7 +266,7 @@ const char *OBJMesh::get_object_name() const } /** - * Get object's mesh name. + * Get Object's Mesh name. */ const char *OBJMesh::get_object_mesh_name() const { @@ -281,9 +280,6 @@ const char *OBJMesh::get_object_material_name(const int16_t mat_nr) const { const Material *mat = get_object_material(mat_nr); if (!mat) { -#ifdef DEBUG -std::cerr << "Material not found for mat_nr = " << mat_nr << std::endl; -#endif return nullptr; } return mat->id.name + 2; @@ -349,15 +345,12 @@ void OBJMesh::store_uv_coords_and_indices(Vector> _uv_coo if (uv_vert->separate) { tot_uv_vertices_ += 1; } - if (tot_uv_vertices_ == 0) { -return; - } const int vertices_in_poly = mpoly[uv_vert->poly_index].totloop; /* Fill up UV vertex's coordinates. */ r_uv_coords.resize(tot_uv_vertices_); const int loopstart = mpoly[uv_vert->poly_index].loopstart; - const float(_uv_coords)[2] = mloopuv[loopstart + uv_vert->loop_of_poly_index].uv; + Span vert_uv_coords(mloopuv[loopstart + uv_vert->loop_of_poly_index].uv, 2); r_uv_coords[tot_uv_vertices_ - 1][0] = vert_uv_coords[0]; r_uv_coords[tot_uv_vertices_ - 1][1] = vert_uv_coords[1]; @@ -504,6 +497,6 @@ std::optional> OBJMesh::calc_loose_edge_vert_indices(const in if (edge.flag & ME_LOOSEEDGE) { return std::array{static_cast(edge.v1), static_cast(edge.v2)}; } - return {}; + return std::nullopt; } } // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mesh.hh b/source/blender/io/wavefront_obj/intern/obj_export_mesh.hh index 92c68eb7200..dcc3dad9c7b 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mesh.hh +++ b/source/blender/io/wavefront_obj/intern/obj_export_mesh.hh @@ -71,7 +71,7 @@ class OBJMesh : NonMovable, NonCopyable { * Final transform of an object obtained from export settings (up_axis, forward_axis) and world * transform matrix. */ - float world_and_axes_transform_[4][4] = {}; + float world_and_axes_transform_[4][4]; /** * Total UV vertices in a mesh's texture map. ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e96dd70fac9] soc-2020-io-performance: Cleanup: use const, edit comments, reorder includes.
Commit: e96dd70fac9b3a9a0a55dae79bffb06639df0a3d Author: Ankit Meel Date: Mon Sep 21 13:22:59 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rBe96dd70fac9b3a9a0a55dae79bffb06639df0a3d Cleanup: use const, edit comments, reorder includes. No functional change. === M source/blender/editors/io/io_obj.c M source/blender/io/wavefront_obj/IO_wavefront_obj.h M source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc M source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh M source/blender/io/wavefront_obj/intern/obj_export_mesh.cc M source/blender/io/wavefront_obj/intern/obj_export_mesh.hh M source/blender/io/wavefront_obj/intern/obj_export_mtl.cc M source/blender/io/wavefront_obj/intern/obj_export_nurbs.cc M source/blender/io/wavefront_obj/intern/obj_export_nurbs.hh M source/blender/io/wavefront_obj/intern/obj_exporter.cc M source/blender/io/wavefront_obj/intern/obj_exporter.hh === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index de1f55053b5..35cde0e3ea5 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -67,8 +67,6 @@ const EnumPropertyItem io_obj_transform_axis_up[] = { {OBJ_AXIS_NEGATIVE_Z_UP, "NEGATIVE_Z_UP", 0, "-Z", "Negative Z axis"}, {0, NULL, 0, NULL, NULL}}; -const int TOTAL_AXES = 3; - const EnumPropertyItem io_obj_export_evaluation_mode[] = { {DAG_EVAL_RENDER, "DAG_EVAL_RENDER", diff --git a/source/blender/io/wavefront_obj/IO_wavefront_obj.h b/source/blender/io/wavefront_obj/IO_wavefront_obj.h index 4a2d9a10d7d..5340389feb1 100644 --- a/source/blender/io/wavefront_obj/IO_wavefront_obj.h +++ b/source/blender/io/wavefront_obj/IO_wavefront_obj.h @@ -49,23 +49,25 @@ typedef enum { OBJ_AXIS_NEGATIVE_Z_FORWARD = 5, } eTransformAxisForward; +const int TOTAL_AXES = 3; + struct OBJExportParams { /** Full path to the destination OBJ file to export. */ char filepath[FILE_MAX]; - /** Whether mutiple frames are to be exported or not. */ + /** Whether export multiple frames. */ bool export_animation; /** The first frame to be exported. */ int start_frame; /** The last frame to be exported. */ int end_frame; - /** Geometry Transform options. */ + /* Geometry Transform options. */ eTransformAxisForward forward_axis; eTransformAxisUp up_axis; float scaling_factor; - /** File Write Options. */ + /* File Write Options. */ bool export_selected_objects; eEvaluationMode export_eval_mode; bool export_uv; @@ -74,7 +76,7 @@ struct OBJExportParams { bool export_triangulated_mesh; bool export_curves_as_nurbs; - /** Grouping options. */ + /* Grouping options. */ bool export_object_groups; bool export_material_groups; bool export_vertex_groups; @@ -83,7 +85,7 @@ struct OBJExportParams { */ bool export_smooth_groups; /** - * If true, generate bitflags for smooth groups' IDs. Generates upto 32 but usually much less. + * If true, generate bitflags for smooth groups' IDs. */ bool smooth_groups_bitflags; }; diff --git a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc index 03a20a2fda8..6e7f084dd69 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc @@ -25,11 +25,12 @@ #include "BKE_blender_version.h" -#include "obj_export_file_writer.hh" #include "obj_export_mesh.hh" #include "obj_export_mtl.hh" #include "obj_export_nurbs.hh" +#include "obj_export_file_writer.hh" + namespace blender::io::obj { /* Default values of some parameters. */ @@ -354,8 +355,8 @@ void OBJWriter::write_edges_indices(const OBJMesh _mesh_data) const obj_mesh_data.ensure_mesh_edges(); const int tot_edges = obj_mesh_data.tot_edges(); for (uint edge_index = 0; edge_index < tot_edges; edge_index++) { -std::optional> vertex_indices = obj_mesh_data.calc_loose_edge_vert_indices( -edge_index); +const std::optional> vertex_indices = +obj_mesh_data.calc_loose_edge_vert_indices(edge_index); if (!vertex_indices) { continue; } @@ -376,7 +377,7 @@ void OBJWriter::write_nurbs_curve(const OBJCurve _nurbs_data) const /* Total control points in a nurbs. */ const int tot_points = obj_nurbs_data.get_nurbs_points(i); for (int point_idx = 0; point_idx < tot_points; point_idx++) { - float3 point_coord = obj_nurbs_data.calc_nurbs_point_coords( + const float3 point_coord = obj_nurbs_data.calc_nurbs_point_coords( i, point_idx, export_params_.scaling_factor); fprintf(outfile_, "v %f %f %f\n", point_coord[0], point_coord[1], point_coord[2]); } @@
[Bf-blender-cvs] [942039244ef] soc-2020-io-performance: Nurbs: remove depsgraph from class, minor cleanup.
Commit: 942039244ef09c79977e5df60b9e681bfe713383 Author: Ankit Meel Date: Mon Sep 21 13:31:07 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB942039244ef09c79977e5df60b9e681bfe713383 Nurbs: remove depsgraph from class, minor cleanup. === M source/blender/io/wavefront_obj/intern/obj_export_nurbs.cc M source/blender/io/wavefront_obj/intern/obj_export_nurbs.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_nurbs.cc b/source/blender/io/wavefront_obj/intern/obj_export_nurbs.cc index 441c7e647eb..0faf9c017b1 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_nurbs.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_nurbs.cc @@ -35,9 +35,9 @@ namespace blender::io::obj { OBJCurve::OBJCurve(Depsgraph *depsgraph, const OBJExportParams _params, Object *export_object) -: depsgraph_(depsgraph), export_object_eval_(export_object) +: export_object_eval_(export_object) { - export_object_eval_ = DEG_get_evaluated_object(depsgraph_, export_object); + export_object_eval_ = DEG_get_evaluated_object(depsgraph, export_object); export_curve_ = static_cast(export_object_eval_->data); set_world_axes_transform(export_params.forward_axis, export_params.up_axis); } @@ -84,9 +84,8 @@ float3 OBJCurve::calc_nurbs_point_coords(const int index, { const Nurb *nurb = static_cast(BLI_findlink(_curve_->nurb, index)); float3 r_coord; - BPoint *bpoint = nurb->bp; - bpoint += vert_index; - copy_v3_v3(r_coord, bpoint->vec); + const BPoint = nurb->bp[vert_index]; + copy_v3_v3(r_coord, bpoint.vec); mul_m4_v3(world_axes_transform_, r_coord); mul_v3_fl(r_coord, scaling_factor); return r_coord; diff --git a/source/blender/io/wavefront_obj/intern/obj_export_nurbs.hh b/source/blender/io/wavefront_obj/intern/obj_export_nurbs.hh index e63bc87145e..12b40067d67 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_nurbs.hh +++ b/source/blender/io/wavefront_obj/intern/obj_export_nurbs.hh @@ -37,7 +37,6 @@ namespace blender::io::obj { */ class OBJCurve : NonMovable, NonCopyable { private: - const Depsgraph *depsgraph_; const Object *export_object_eval_; const Curve *export_curve_; float world_axes_transform_[4][4]; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b6b4aa99ff3] soc-2020-io-performance: Change axes transform defaults to match old behavior.
Commit: b6b4aa99ff3cf6c91b9c8e81a3ef5c1190012977 Author: Ankit Meel Date: Wed Sep 16 18:15:51 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rBb6b4aa99ff3cf6c91b9c8e81a3ef5c1190012977 Change axes transform defaults to match old behavior. === M source/blender/editors/io/io_obj.c === diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index aaf16e4f280..de1f55053b5 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -54,14 +54,14 @@ const EnumPropertyItem io_obj_transform_axis_forward[] = { {OBJ_AXIS_Y_FORWARD, "Y_FORWARD", 0, "Y", "Positive Y axis"}, {OBJ_AXIS_Z_FORWARD, "Z_FORWARD", 0, "Z", "Positive Z axis"}, {OBJ_AXIS_NEGATIVE_X_FORWARD, "NEGATIVE_X_FORWARD", 0, "-X", "Negative X axis"}, -{OBJ_AXIS_NEGATIVE_Y_FORWARD, "NEGATIVE_Y_FORWARD", 0, "-Y (Default)", "Negative Y axis"}, -{OBJ_AXIS_NEGATIVE_Z_FORWARD, "NEGATIVE_Z_FORWARD", 0, "-Z", "Negative Z axis"}, +{OBJ_AXIS_NEGATIVE_Y_FORWARD, "NEGATIVE_Y_FORWARD", 0, "-Y", "Negative Y axis"}, +{OBJ_AXIS_NEGATIVE_Z_FORWARD, "NEGATIVE_Z_FORWARD", 0, "-Z (Default)", "Negative Z axis"}, {0, NULL, 0, NULL, NULL}}; const EnumPropertyItem io_obj_transform_axis_up[] = { {OBJ_AXIS_X_UP, "X_UP", 0, "X", "Positive X axis"}, -{OBJ_AXIS_Y_UP, "Y_UP", 0, "Y", "Positive Y axis"}, -{OBJ_AXIS_Z_UP, "Z_UP", 0, "Z (Default)", "Positive Z axis"}, +{OBJ_AXIS_Y_UP, "Y_UP", 0, "Y (Default)", "Positive Y axis"}, +{OBJ_AXIS_Z_UP, "Z_UP", 0, "Z", "Positive Z axis"}, {OBJ_AXIS_NEGATIVE_X_UP, "NEGATIVE_X_UP", 0, "-X", "Negative X axis"}, {OBJ_AXIS_NEGATIVE_Y_UP, "NEGATIVE_Y_UP", 0, "-Y", "Negative Y axis"}, {OBJ_AXIS_NEGATIVE_Z_UP, "NEGATIVE_Z_UP", 0, "-Z", "Negative Z axis"}, @@ -303,10 +303,10 @@ void WM_OT_obj_export(struct wmOperatorType *ot) RNA_def_enum(ot->srna, "forward_axis", io_obj_transform_axis_forward, - OBJ_AXIS_NEGATIVE_Y_FORWARD, + OBJ_AXIS_NEGATIVE_Z_FORWARD, "Forward Axis", ""); - RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Z_UP, "Up Axis", ""); + RNA_def_enum(ot->srna, "up_axis", io_obj_transform_axis_up, OBJ_AXIS_Y_UP, "Up Axis", ""); RNA_def_float(ot->srna, "scaling_factor", 1.0f, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [aaa4a544aea] soc-2020-io-performance: Material: add comments, use explicit float3 initialisation.
Commit: aaa4a544aea6b152a2382f1768640a5a517e9d15 Author: Ankit Meel Date: Mon Sep 21 15:56:45 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rBaaa4a544aea6b152a2382f1768640a5a517e9d15 Material: add comments, use explicit float3 initialisation. === M source/blender/io/wavefront_obj/intern/obj_export_mtl.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh b/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh index cef95f8f168..af287b6c071 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh +++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.hh @@ -33,15 +33,17 @@ #include "obj_export_mesh.hh" namespace blender::io::obj { + /** - * Used for storing parameters for all kinds of texture maps from MTL file. + * Generic container for texture node properties. */ struct tex_map_XX { tex_map_XX(StringRef to_socket_id) : dest_socket_id(to_socket_id){}; + /** Target socket which this texture node connects to. */ const std::string dest_socket_id{}; - float3 translation = {0.0f, 0.0f, 0.0f}; - float3 scale = {1.0f, 1.0f, 1.0f}; + float3 translation{0.0f}; + float3 scale{1.0f}; /* Only Flat and Smooth projections are supported. */ int projection_type = SHD_PROJ_FLAT; std::string image_path{}; @@ -49,8 +51,7 @@ struct tex_map_XX { }; /** - * Container for storing material data read from MTL file, as well as - * to be written to MTL file. + * Container suited for storing Material data for/from a MTL file. */ struct MTLMaterial { MTLMaterial() @@ -92,6 +93,9 @@ struct MTLMaterial { float map_Bump_strength{-1.0f}; }; +/** + * Get an Object's material properties from `Material` as well as `bNodeTree`. + */ class MaterialWrap { private: /** ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bc2a8f01ba9] soc-2020-io-performance: Material: add emission strength's effect on Ke (color)
Commit: bc2a8f01ba91e1ef2c52541be1f46d846a56a8df Author: Ankit Meel Date: Mon Sep 21 14:00:14 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rBbc2a8f01ba91e1ef2c52541be1f46d846a56a8df Material: add emission strength's effect on Ke (color) Ref {rBAec4ad081e564} === M source/blender/io/wavefront_obj/intern/obj_export_mtl.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc index af9cff8860d..90879a61809 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc @@ -206,7 +206,10 @@ void MaterialWrap::store_bsdf_properties(MTLMaterial _mtl_mat) const float3 diffuse_col = {export_mtl_->r, export_mtl_->g, export_mtl_->b}; copy_property_from_node(SOCK_RGBA, bsdf_node_, "Base Color", {diffuse_col, 3}); float3 emission_col{0.0f}; + float emission_strength = 0.0f; + copy_property_from_node(SOCK_FLOAT, bsdf_node_, "Emission Strength", {_strength, 1}); copy_property_from_node(SOCK_RGBA, bsdf_node_, "Emission", {emission_col, 3}); + mul_v3_fl(emission_col, emission_strength); /* See https://wikipedia.org/wiki/Wavefront_.obj_file for all possible values of illum. */ /* Highlight on. */ @@ -272,6 +275,14 @@ void MaterialWrap::store_image_textures(MTLMaterial _mtl_mat) const /* Find sockets linked to "Color" socket in normal map node. */ linked_sockets_to_dest_id(normal_map_node, node_tree, "Color", linked_sockets); } +else if (texture_map.key == "map_Ke") { + float emission_strength = 0.0f; + copy_property_from_node( + SOCK_FLOAT, bsdf_node_, "Emission Strength", {_strength, 1}); + if (emission_strength == 0.0f) { +continue; + } +} else { /* Find sockets linked to the destination socket of interest, in p-bsdf node. */ linked_sockets_to_dest_id( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2e16d14cee3] soc-2020-io-performance: Writer: add object group writer member function
Commit: 2e16d14cee343d4f1d701beedd3044366b1f3207 Author: Ankit Meel Date: Mon Sep 21 13:54:33 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB2e16d14cee343d4f1d701beedd3044366b1f3207 Writer: add object group writer member function === M source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc M source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc index be9f39cc4ce..935acc1b7e6 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc @@ -133,25 +133,36 @@ void OBJWriter::write_mtllib_name(const char *mtl_filepath) const } /** - * Write object name conditionally with mesh and material name. + * Write an Object's group with mesh and/or material name appended conditionally. */ -void OBJWriter::write_object_name(const OBJMesh _mesh_data) const +void OBJWriter::write_object_group(const OBJMesh _mesh_data) const { - const char *object_name = obj_mesh_data.get_object_name(); - + BLI_assert(export_params_.export_object_groups); if (!export_params_.export_object_groups) { -fprintf(outfile_, "o %s\n", object_name); +return; } - else { -const char *object_mesh_name = obj_mesh_data.get_object_mesh_name(); -if (export_params_.export_materials && export_params_.export_material_groups) { - const char *object_material_name = obj_mesh_data.get_object_material_name(0); - fprintf(outfile_, "g %s_%s_%s\n", object_name, object_mesh_name, object_material_name); -} -else { - fprintf(outfile_, "g %s_%s\n", object_name, object_mesh_name); -} + const char *object_name = obj_mesh_data.get_object_name(); + const char *object_mesh_name = obj_mesh_data.get_object_mesh_name(); + const char *object_material_name = obj_mesh_data.get_object_material_name(0); + if (export_params_.export_materials && export_params_.export_material_groups && + object_material_name) { +fprintf(outfile_, "g %s_%s_%s\n", object_name, object_mesh_name, object_material_name); +return; + } + fprintf(outfile_, "g %s_%s\n", object_name, object_mesh_name); +} + +/** + * Write object name or group, if specified. + */ +void OBJWriter::write_object_name(const OBJMesh _mesh_data) const +{ + const char *object_name = obj_mesh_data.get_object_name(); + if (export_params_.export_object_groups) { +write_object_group(obj_mesh_data); +return; } + fprintf(outfile_, "o %s\n", object_name); } /** @@ -255,10 +266,8 @@ void OBJWriter::write_poly_material(const OBJMesh _mesh_data, return; } const char *mat_name = obj_mesh_data.get_object_material_name(curr_mat_nr); - if (export_params_.export_material_groups) { -const char *object_name = obj_mesh_data.get_object_name(); -const char *object_mesh_name = obj_mesh_data.get_object_mesh_name(); -fprintf(outfile_, "g %s_%s_%s\n", object_name, object_mesh_name, mat_name); + if (export_params_.export_object_groups) { +write_object_group(obj_mesh_data); } fprintf(outfile_, "usemtl %s\n", mat_name); } diff --git a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh index 196cceef85c..6a9611eb32d 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh +++ b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.hh @@ -78,6 +78,7 @@ class OBJWriter { bool init_writer(const char *filepath); void write_object_name(const OBJMesh _mesh_data) const; + void write_object_group(const OBJMesh _mesh_data) const; void write_mtllib_name(const char *obj_filepath) const; void write_vertex_coords(const OBJMesh _mesh_data) const; void write_uv_coords(OBJMesh _mesh_data) const; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ded6377ea0c] soc-2020-io-performance: Write empty usemtl if a polygon has no material.
Commit: ded6377ea0ce31601695b623ec33407dc2f3b859 Author: Ankit Meel Date: Wed Sep 16 17:56:35 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rBded6377ea0ce31601695b623ec33407dc2f3b859 Write empty usemtl if a polygon has no material. === M source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc M source/blender/io/wavefront_obj/intern/obj_export_mesh.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc index c8fbe7aa71f..03a20a2fda8 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_file_writer.cc @@ -247,6 +247,14 @@ void OBJWriter::write_poly_material(const OBJMesh _mesh_data, if (r_last_face_mat_nr == curr_mat_nr) { return; } + r_last_face_mat_nr = curr_mat_nr; + if (curr_mat_nr == NOT_FOUND) { +/* Once a material is assigned, it cannot be turned off; it can only be changed. + * If a material name is not specified, a white material is used. + * http://www.martinreddy.net/gfx/3d/OBJ.spec */ +fprintf(outfile_, "usemtl\n"); +return; + } const char *mat_name = obj_mesh_data.get_object_material_name(curr_mat_nr); if (export_params_.export_material_groups) { const char *object_name = obj_mesh_data.get_object_name(); @@ -254,7 +262,6 @@ void OBJWriter::write_poly_material(const OBJMesh _mesh_data, fprintf(outfile_, "g %s_%s_%s\n", object_name, object_mesh_name, mat_name); } fprintf(outfile_, "usemtl %s\n", mat_name); - r_last_face_mat_nr = curr_mat_nr; } /** diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc b/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc index f30b0a7a3b5..353066b59cf 100644 --- a/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc +++ b/source/blender/io/wavefront_obj/intern/obj_export_mesh.cc @@ -240,10 +240,15 @@ bool OBJMesh::is_ith_poly_smooth(const uint poly_index) const return export_mesh_eval_->mpoly[poly_index].flag & ME_SMOOTH; } +/** + * Returns a zero-based index of a polygon's material indexing into + * the Object's material slots. + */ short OBJMesh::ith_poly_matnr(const uint poly_index) const { BLI_assert(poly_index < export_mesh_eval_->totpoly); - return export_mesh_eval_->mpoly[poly_index].mat_nr; + const short r_mat_nr = export_mesh_eval_->mpoly[poly_index].mat_nr; + return r_mat_nr > 0 ? r_mat_nr : NOT_FOUND; } int OBJMesh::ith_poly_totloop(const uint poly_index) const ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3e544770f63] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance
Commit: 3e544770f63f546da47e7b23e349500ffc417b13 Author: Ankit Meel Date: Mon Sep 21 15:45:04 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB3e544770f63f546da47e7b23e349500ffc417b13 Merge branch 'master' into soc-2020-io-performance === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6570780a795] soc-2020-io-performance: Cleanup: exporter main: use const, style guide.
Commit: 6570780a79512280cbbaa71ecaadf0af1ba0a386 Author: Ankit Meel Date: Mon Sep 21 13:24:46 2020 +0530 Branches: soc-2020-io-performance https://developer.blender.org/rB6570780a79512280cbbaa71ecaadf0af1ba0a386 Cleanup: exporter main: use const, style guide. === M source/blender/io/wavefront_obj/intern/obj_exporter.cc === diff --git a/source/blender/io/wavefront_obj/intern/obj_exporter.cc b/source/blender/io/wavefront_obj/intern/obj_exporter.cc index 5c5825d4b4b..b61d2276aa6 100644 --- a/source/blender/io/wavefront_obj/intern/obj_exporter.cc +++ b/source/blender/io/wavefront_obj/intern/obj_exporter.cc @@ -112,10 +112,10 @@ static void export_frame(ViewLayer *view_layer, const char *filepath) { OBJWriter frame_writer(export_params); - std::unique_ptr mtl_writer = nullptr; if (!frame_writer.init_writer(filepath)) { return; } + std::unique_ptr mtl_writer = nullptr; /* Meshes, and curves to be exported in mesh form. */ Vector> exportable_as_mesh; @@ -170,7 +170,9 @@ static void export_frame(ViewLayer *view_layer, * * \return Whether the filepath is in FILE_MAX limits. */ -static bool insert_frame_in_path(const char *filepath, char *r_filepath_with_frames, int frame) +static bool insert_frame_in_path(const char *filepath, + const int frame, + char *r_filepath_with_frames) { BLI_strncpy(r_filepath_with_frames, filepath, FILE_MAX); BLI_path_extension_replace(r_filepath_with_frames, FILE_MAX, ""); @@ -207,7 +209,7 @@ void exporter_main(bContext *C, const OBJExportParams _params) const int original_frame = CFRA; for (int frame = export_params.start_frame; frame <= export_params.end_frame; frame++) { -bool filepath_ok = insert_frame_in_path(filepath, filepath_with_frames, frame); +bool filepath_ok = insert_frame_in_path(filepath, frame, filepath_with_frames); if (!filepath_ok) { fprintf(stderr, "Error: File Path too long.\n%s\n", filepath_with_frames); return; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [92454ae100a] master: Fix assert failure when using Ctrl+Mousewheel on Object Mode button
Commit: 92454ae100a1bf8c1f41da5cd1abac27250474df Author: Julian Eisel Date: Mon Sep 21 13:04:26 2020 +0200 Branches: master https://developer.blender.org/rB92454ae100a1bf8c1f41da5cd1abac27250474df Fix assert failure when using Ctrl+Mousewheel on Object Mode button Do a proper check to see if the button supports Ctrl+Mousewheel cycling. See T80659. === M source/blender/editors/interface/interface_handlers.c === diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 19261bd3db6..51a719199da 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5651,7 +5651,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } -if (but->type == UI_BTYPE_MENU) { +if (ui_but_supports_cycling(but)) { if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) { const int direction = (event->type == WHEELDOWNMOUSE) ? 1 : -1; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [88a9d82bbbb] master: Cleanup: Remove weird assert in button handling
Commit: 88a9d82d4b1a67160a06de03535593e9bac8 Author: Julian Eisel Date: Mon Sep 21 13:08:19 2020 +0200 Branches: master https://developer.blender.org/rB88a9d82d4b1a67160a06de03535593e9bac8 Cleanup: Remove weird assert in button handling The function this was in already checks the conditions under which it can operate (as it should). No need to force the caller to do these (quite specific) checks, the function can just do nothing if the button doesn't need these operations. Otherwise we'd have to always execute these checks before calling, which makes calling it a hassle, makes the code harder to follow and generally harder to maintain (what if the conditions change?). === M source/blender/editors/interface/interface.c === diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5e17354f3f7..2cb58c92449 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3342,9 +3342,6 @@ void ui_but_range_set_soft(uiBut *but) but->softmax = max_ff(but->softmax, value); } } - else { -BLI_assert(0); - } } /* *** Free / ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b3c6ab50844] master: Fix datatoc_icon linker errors with ASan enabled.
Commit: b3c6ab50844e9e88d9009b5d7367dada0541d253 Author: Ankit Meel Date: Sun Sep 20 15:20:31 2020 +0530 Branches: master https://developer.blender.org/rBb3c6ab50844e9e88d9009b5d7367dada0541d253 Fix datatoc_icon linker errors with ASan enabled. Error introduced in {rBf9fcb25d521d}. Reviewed By: brecht Differential Revision: https://developer.blender.org/D8964 === M source/blender/datatoc/CMakeLists.txt === diff --git a/source/blender/datatoc/CMakeLists.txt b/source/blender/datatoc/CMakeLists.txt index 3253db2314d..3dc4a1add76 100644 --- a/source/blender/datatoc/CMakeLists.txt +++ b/source/blender/datatoc/CMakeLists.txt @@ -55,6 +55,7 @@ if(NOT WITH_HEADLESS) link_directories(${PNG_LIBPATH} ${ZLIB_LIBPATH}) add_executable(datatoc_icon ${SRC}) + setup_platform_linker_flags(datatoc_icon) target_link_libraries(datatoc_icon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) # PNG library uses pow() and floow(), so seems -lm is required for proper ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: bf-blender [62493] trunk/lib/linux_centos7_x86_64/gmp/lib: Linux: Re-compile libgmp with -FPIC
Revision: 62493 https://developer.blender.org/rBL62493 Author: sergey Date: 2020-09-21 12:54:38 +0200 (Mon, 21 Sep 2020) Log Message: --- Linux: Re-compile libgmp with -FPIC Similar to D8823. Attempt to resolve https://devtalk.blender.org/t/linux-make-bpy-link-error/15442 Modified Paths: -- trunk/lib/linux_centos7_x86_64/gmp/lib/libgmp.a trunk/lib/linux_centos7_x86_64/gmp/lib/libgmpxx.a Modified: trunk/lib/linux_centos7_x86_64/gmp/lib/libgmp.a === (Binary files differ) Modified: trunk/lib/linux_centos7_x86_64/gmp/lib/libgmpxx.a === (Binary files differ) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6836a40287f] master: Make deps: Enable fPIC for Linux
Commit: 6836a40287ff2d2fc9f67f8eca93cf8ff6f43a26 Author: Sergey Sharybin Date: Mon Sep 21 12:53:24 2020 +0200 Branches: master https://developer.blender.org/rB6836a40287ff2d2fc9f67f8eca93cf8ff6f43a26 Make deps: Enable fPIC for Linux Similar to D8823. === M build_files/build_environment/cmake/gmp.cmake === diff --git a/build_files/build_environment/cmake/gmp.cmake b/build_files/build_environment/cmake/gmp.cmake index f34ee95c6e3..173f4df7e60 100644 --- a/build_files/build_environment/cmake/gmp.cmake +++ b/build_files/build_environment/cmake/gmp.cmake @@ -37,6 +37,11 @@ if(APPLE) --with-pic ) endif() +elseif(UNIX) + set(GMP_OPTIONS +${GMP_OPTIONS} +--with-pic + ) endif() ExternalProject_Add(external_gmp ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [216a2218768] master: Implement ID properties support for TimeMarker
Commit: 216a2218768d005c18032df370c19c1c0f571797 Author: Sergey Sharybin Date: Fri Sep 18 16:57:33 2020 +0200 Branches: master https://developer.blender.org/rB216a2218768d005c18032df370c19c1c0f571797 Implement ID properties support for TimeMarker Allows scripters to store additional information in the marker itself instead of using work-around approach based on marker names and such. Differential Revision: https://developer.blender.org/D8944 === M source/blender/blenkernel/intern/scene.c M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/writefile.c M source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc M source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc M source/blender/editors/animation/anim_markers.c M source/blender/makesdna/DNA_scene_types.h M source/blender/makesrna/intern/rna_timeline.c === diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 34af226ef72..2a3ac89a8a7 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -223,6 +223,16 @@ static void scene_init_data(ID *id) BKE_view_layer_add(scene, "View Layer", NULL, VIEWLAYER_ADD_NEW); } +static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const int flag) +{ + BLI_duplicatelist(_dst->markers, _src->markers); + LISTBASE_FOREACH (TimeMarker *, marker, _dst->markers) { +if (marker->prop != NULL) { + marker->prop = IDP_CopyProperty_ex(marker->prop, flag); +} + } +} + static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) { Scene *scene_dst = (Scene *)id_dst; @@ -253,7 +263,8 @@ static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int BKE_view_layer_copy_data(scene_dst, scene_src, view_layer_dst, view_layer_src, flag_subdata); } - BLI_duplicatelist(&(scene_dst->markers), &(scene_src->markers)); + scene_copy_markers(scene_dst, scene_src, flag); + BLI_duplicatelist(&(scene_dst->transform_spaces), &(scene_src->transform_spaces)); BLI_duplicatelist(&(scene_dst->r.views), &(scene_src->r.views)); BKE_keyingsets_copy(&(scene_dst->keyingsets), &(scene_src->keyingsets)); @@ -336,6 +347,17 @@ static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int BKE_scene_copy_data_eevee(scene_dst, scene_src); } +static void scene_free_markers(Scene *scene, bool do_id_user) +{ + LISTBASE_FOREACH_MUTABLE (TimeMarker *, marker, >markers) { +if (marker->prop != NULL) { + IDP_FreePropertyContent_ex(marker->prop, do_id_user); + MEM_freeN(marker->prop); +} +MEM_freeN(marker); + } +} + static void scene_free_data(ID *id) { @@ -372,7 +394,7 @@ static void scene_free_data(ID *id) scene->r.ffcodecdata.properties = NULL; } - BLI_freelistN(>markers); + scene_free_markers(scene, do_id_user); BLI_freelistN(>transform_spaces); BLI_freelistN(>r.views); @@ -524,6 +546,8 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data) LISTBASE_FOREACH (TimeMarker *, marker, >markers) { BKE_LIB_FOREACHID_PROCESS(data, marker->camera, IDWALK_CB_NOP); +IDP_foreach_property( +marker->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data); } ToolSettings *toolsett = scene->toolsettings; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6e0fc1752a9..2b68c5ea203 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4450,6 +4450,8 @@ static void lib_link_scene(BlendLibReader *reader, Scene *sce) SEQ_ALL_END; LISTBASE_FOREACH (TimeMarker *, marker, >markers) { +IDP_BlendReadLib(reader, marker->prop); + if (marker->camera) { BLO_read_id_address(reader, sce->id.lib, >camera); } @@ -4809,6 +4811,11 @@ static void direct_link_scene(BlendDataReader *reader, Scene *sce) } BLO_read_list(reader, &(sce->markers)); + LISTBASE_FOREACH (TimeMarker *, marker, >markers) { +BLO_read_data_address(reader, >prop); +IDP_BlendDataRead(reader, >prop); + } + BLO_read_list(reader, &(sce->transform_spaces)); BLO_read_list(reader, &(sce->r.layers)); BLO_read_list(reader, &(sce->r.views)); @@ -7969,6 +7976,8 @@ static void expand_scene(BlendExpander *expander, Scene *sce) } LISTBASE_FOREACH (TimeMarker *, marker, >markers) { +IDP_BlendReadExpand(expander, marker->prop); + if (marker->camera) { BLO_expand(expander, marker->camera); } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index db51bb79f41..336276bdd40 100644 ---
[Bf-blender-cvs] [3791dbea1e7] master: Fix T79965: mesh.transform() modifies referenced layers
Commit: 3791dbea1e796f96440437333e4318066f26bde2 Author: Sergey Sharybin Date: Fri Sep 18 12:45:59 2020 +0200 Branches: master https://developer.blender.org/rB3791dbea1e796f96440437333e4318066f26bde2 Fix T79965: mesh.transform() modifies referenced layers Originally was noticed when transforming mesh created by object.to_mesh() from an object without modifier, in which case the result references CustomData layers used by the object itself. The issue goes a bit deeper: mesh.transform() should never modify referenced layers, hence it should duplicate referenced layers. This fix changes one specific aspect of the reported behavior. The case where vertices coordinates are modified manually will still have affect on the source mesh (as no referenced CustomData layers are being duplicated). Proper fix for this case is not yet clear to me. Differential Revision: https://developer.blender.org/D8939 === M source/blender/blenkernel/intern/mesh.c === diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a42522a2da3..71209739238 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1512,8 +1512,11 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3]) void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys) { int i; - MVert *mvert = me->mvert; - float(*lnors)[3] = CustomData_get_layer(>ldata, CD_NORMAL); + MVert *mvert = CustomData_duplicate_referenced_layer(>vdata, CD_MVERT, me->totvert); + float(*lnors)[3] = CustomData_duplicate_referenced_layer(>ldata, CD_NORMAL, me->totloop); + + /* If the referenced l;ayer has been re-allocated need to update pointers stored in the mesh. */ + BKE_mesh_update_customdata_pointers(me, false); for (i = 0; i < me->totvert; i++, mvert++) { mul_m4_v3(mat, mvert->co); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: bf-blender [62492] trunk/lib/linux_centos7_x86_64/openimagedenoise: Linux: Update OpenImageDenoise to 1.2.3
Revision: 62492 https://developer.blender.org/rBL62492 Author: sergey Date: 2020-09-21 12:16:55 +0200 (Mon, 21 Sep 2020) Log Message: --- Linux: Update OpenImageDenoise to 1.2.3 Ref T80940 Modified Paths: -- trunk/lib/linux_centos7_x86_64/openimagedenoise/include/OpenImageDenoise/version.h trunk/lib/linux_centos7_x86_64/openimagedenoise/lib/libOpenImageDenoise.a trunk/lib/linux_centos7_x86_64/openimagedenoise/lib/libcommon.a trunk/lib/linux_centos7_x86_64/openimagedenoise/lib/libdnnl.a Modified: trunk/lib/linux_centos7_x86_64/openimagedenoise/include/OpenImageDenoise/version.h === --- trunk/lib/linux_centos7_x86_64/openimagedenoise/include/OpenImageDenoise/version.h 2020-09-19 17:10:19 UTC (rev 62491) +++ trunk/lib/linux_centos7_x86_64/openimagedenoise/include/OpenImageDenoise/version.h 2020-09-21 10:16:55 UTC (rev 62492) @@ -5,6 +5,6 @@ #define OIDN_VERSION_MAJOR 1 #define OIDN_VERSION_MINOR 2 -#define OIDN_VERSION_PATCH 1 -#define OIDN_VERSION 10201 -#define OIDN_VERSION_STRING "1.2.1" +#define OIDN_VERSION_PATCH 3 +#define OIDN_VERSION 10203 +#define OIDN_VERSION_STRING "1.2.3" Modified: trunk/lib/linux_centos7_x86_64/openimagedenoise/lib/libOpenImageDenoise.a === (Binary files differ) Modified: trunk/lib/linux_centos7_x86_64/openimagedenoise/lib/libcommon.a === (Binary files differ) Modified: trunk/lib/linux_centos7_x86_64/openimagedenoise/lib/libdnnl.a === (Binary files differ) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7e8295c0096] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: 7e8295c009618f09014bebcfd1a332cff7f35432 Author: Antonio Vazquez Date: Mon Sep 21 12:09:39 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB7e8295c009618f09014bebcfd1a332cff7f35432 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] [b1acd5e9b18] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve
Commit: b1acd5e9b18285fa6c2c15c7d4492dfe952b96d5 Author: Antonio Vazquez Date: Mon Sep 21 12:09:14 2020 +0200 Branches: greasepencil-edit-curve https://developer.blender.org/rBb1acd5e9b18285fa6c2c15c7d4492dfe952b96d5 Merge branch 'master' into greasepencil-edit-curve === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [abc90d6b036] master: Fix T80931: Proporional Editing Cursor Draws Incorrect
Commit: abc90d6b036dce1b5003d487a266b8d48126fa1c Author: Jeroen Bakker Date: Mon Sep 21 11:39:32 2020 +0200 Branches: master https://developer.blender.org/rBabc90d6b036dce1b5003d487a266b8d48126fa1c Fix T80931: Proporional Editing Cursor Draws Incorrect The incorrect view was setup so it was drawn in pixel space. This patch changes it to use UV space. === M source/blender/draw/intern/draw_manager.c === diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index df1f4d8f405..d51042d4ae6 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2096,17 +2096,16 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, GPU_framebuffer_bind(dfbl->overlay_fb); +GPU_depth_test(GPU_DEPTH_NONE); +GPU_matrix_push_projection(); +wmOrtho2( +region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, region->v2d.cur.ymax); if (do_annotations) { - GPU_depth_test(GPU_DEPTH_NONE); - GPU_matrix_push_projection(); - wmOrtho2( - region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, region->v2d.cur.ymax); ED_annotation_draw_view2d(DST.draw_ctx.evil_C, true); - GPU_matrix_pop_projection(); } - GPU_depth_test(GPU_DEPTH_NONE); ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_POST_VIEW); +GPU_matrix_pop_projection(); /* Callback can be nasty and do whatever they want with the state. * Don't trust them! */ DRW_state_reset(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9743a58f7d1] blender-v2.90-release: Fix T80771: Avoid changing the visibility of loose geometry when entering Sculpt Mode
Commit: 9743a58f7d1f0fe8b5460a13b64bee05f66e6db6 Author: Pablo Dobarro Date: Thu Sep 17 23:51:01 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB9743a58f7d1f0fe8b5460a13b64bee05f66e6db6 Fix T80771: Avoid changing the visibility of loose geometry when entering Sculpt Mode When entering scultp mode the visibility from the Face Sets is copied to the base mesh. This steps was considering that if a vertex belongs to a face with a visibible Face Set ID, it should be visible. As loose geometry may not have any faces, those vertex were set to hidden. Now this function check if a vertex visibility should be modified by the face sets (by checking the loops), avoiding modifying the visibility of loose geometry unintentionally. Reviewed By: sergey Maniphest Tasks: T80771 Differential Revision: https://developer.blender.org/D8899 === M source/blender/blenkernel/intern/paint.c === diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 0ba5ec43318..bdead81d97d 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1832,18 +1832,31 @@ static void sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh) return; } - for (int i = 0; i < mesh->totvert; i++) { -mesh->mvert[i].flag |= ME_HIDE; - } + /* Enabled if the vertex should be visible according to the Face Sets. */ + BLI_bitmap *visibile_vertex = BLI_BITMAP_NEW(mesh->totvert, "visible vertices"); + /* Enabled if the visibility of this vertex can be affected by the Face Sets to avoid modifying + * disconnected geometry. */ + BLI_bitmap *modified_vertex = BLI_BITMAP_NEW(mesh->totvert, "modified vertices"); for (int i = 0; i < mesh->totpoly; i++) { -if (face_sets[i] >= 0) { - for (int l = 0; l < mesh->mpoly[i].totloop; l++) { -MLoop *loop = >mloop[mesh->mpoly[i].loopstart + l]; -mesh->mvert[loop->v].flag &= ~ME_HIDE; +const bool is_face_set_visible = face_sets[i] >= 0; +for (int l = 0; l < mesh->mpoly[i].totloop; l++) { + MLoop *loop = >mloop[mesh->mpoly[i].loopstart + l]; + if (is_face_set_visible) { +BLI_BITMAP_ENABLE(visibile_vertex, loop->v); } + BLI_BITMAP_ENABLE(modified_vertex, loop->v); } } + + for (int i = 0; i < mesh->totvert; i++) { +if (BLI_BITMAP_TEST(modified_vertex, i) && !BLI_BITMAP_TEST(visibile_vertex, i)) { + mesh->mvert[i].flag |= ME_HIDE; +} + } + + MEM_SAFE_FREE(visibile_vertex); + MEM_SAFE_FREE(modified_vertex); } static void sculpt_sync_face_sets_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d72b5785eb0] master: Fix T79373: Forbid painting on linked image.
Commit: d72b5785eb02741ff14121cf4bb8dcdd019ee786 Author: Bastien Montagne Date: Mon Sep 21 10:47:20 2020 +0200 Branches: master https://developer.blender.org/rBd72b5785eb02741ff14121cf4bb8dcdd019ee786 Fix T79373: Forbid painting on linked image. There is just no reason to support that kind of useless behavior. Some remote TODO could be to define a process based on liboverride and layers. === M source/blender/editors/sculpt_paint/paint_image.c === diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6bdc072ff64..5bfb03ee42f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -288,6 +288,9 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) SpaceImage *sima = CTX_wm_space_image(C); if (sima) { + if (sima->image != NULL && ID_IS_LINKED(sima->image)) { +return false; + } ARegion *region = CTX_wm_region(C); if ((sima->mode == SI_MODE_PAINT) && region->regiontype == RGN_TYPE_WINDOW) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b8b60e132d0] master: Fix T59272: dead particles not included in render, but visible in viewport
Commit: b8b60e132d0382bb360855e52f2f7c522625ca98 Author: Jacques Lucke Date: Mon Sep 21 10:46:35 2020 +0200 Branches: master https://developer.blender.org/rBb8b60e132d0382bb360855e52f2f7c522625ca98 Fix T59272: dead particles not included in render, but visible in viewport The issue was that the pointcache was not storing dead particles, even though they are displayed. This lead to the rendering issue, because only alive particles can be read from the point cache in the frame that is rendered. This also fixes an issue unrelated to rendering: when dead particles are displayed, their position is incorrect when some frames are skipped during playback. Reviewers: brecht Differential Revision: https://developer.blender.org/D8907 === M source/blender/blenkernel/intern/pointcache.c === diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 1263169a3a0..75b88ae7845 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -295,9 +295,20 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra float times[3]; int step = psys->pointcache->step; - /* No need to store unborn or died particles outside cache step bounds */ - if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step)) { -return 0; + /* Skip some particles that are not stored in the cache. */ + if (data[BPHYS_DATA_INDEX]) { +if (psys->part->flag & PART_DIED) { + /* Dead particles are stored when they are displayed. */ + if (cfra < pa->time - step) { +return 0; + } +} +else { + /* Particles are only stored in their lifetime. */ + if (cfra < pa->time - step || cfra > pa->dietime + step) { +return 0; + } +} } times[0] = pa->time; @@ -485,8 +496,16 @@ static int ptcache_particle_totwrite(void *psys_v, int cfra) return psys->totpart; } - for (p = 0; p < psys->totpart; p++, pa++) { -totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step); + if (psys->part->flag & PART_DIED) { +/* Also store dead particles when they are displayed. */ +for (p = 0; p < psys->totpart; p++, pa++) { + totwrite += (cfra >= pa->time - step); +} + } + else { +for (p = 0; p < psys->totpart; p++, pa++) { + totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step); +} } return totwrite; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3bb53b0ee64] master: Cleanup: Sculpt/Paint ED code: correct return constant types.
Commit: 3bb53b0ee640e744219e2a38207d1fbc76ca2068 Author: Bastien Montagne Date: Mon Sep 21 10:35:50 2020 +0200 Branches: master https://developer.blender.org/rB3bb53b0ee640e744219e2a38207d1fbc76ca2068 Cleanup: Sculpt/Paint ED code: correct return constant types. Mainly use false/true for bool, but also a few others. No change in behavior expected. === M source/blender/editors/sculpt_paint/paint_image.c M source/blender/editors/sculpt_paint/paint_image_2d.c M source/blender/editors/sculpt_paint/paint_image_proj.c M source/blender/editors/sculpt_paint/paint_utils.c M source/blender/editors/sculpt_paint/paint_vertex.c === diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index d2ae6912fc3..6bdc072ff64 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -275,13 +275,13 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) Object *obact; if (!image_paint_brush(C)) { -return 0; +return false; } obact = CTX_data_active_object(C); if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) { if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { - return 1; + return true; } } else { @@ -291,12 +291,12 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) ARegion *region = CTX_wm_region(C); if ((sima->mode == SI_MODE_PAINT) && region->regiontype == RGN_TYPE_WINDOW) { -return 1; +return true; } } } - return 0; + return false; } static bool image_paint_poll(bContext *C) @@ -316,12 +316,12 @@ static bool image_paint_2d_clone_poll(bContext *C) if (!CTX_wm_region_view3d(C) && image_paint_poll(C)) { if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) { if (brush->clone.image) { -return 1; +return true; } } } - return 0; + return false; } / paint operator / @@ -769,13 +769,13 @@ bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) if (sima->mode == SI_MODE_PAINT) { ARegion *region = CTX_wm_region(C); ED_space_image_get_zoom(sima, region, zoomx, zoomy); - return 1; + return true; } } *zoomx = *zoomy = 1; - return 0; + return false; } / cursor drawing ***/ @@ -1211,13 +1211,13 @@ static bool texture_paint_toggle_poll(bContext *C) { Object *ob = CTX_data_active_object(C); if (ob == NULL || ob->type != OB_MESH) { -return 0; +return false; } if (!ob->data || ID_IS_LINKED(ob->data)) { -return 0; +return false; } - return 1; + return true; } static int texture_paint_toggle_exec(bContext *C, wmOperator *op) @@ -1346,11 +1346,11 @@ static bool texture_paint_poll(bContext *C) { if (texture_paint_toggle_poll(C)) { if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT) { - return 1; + return true; } } - return 0; + return false; } bool image_texture_paint_poll(bContext *C) diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index d614c800350..78dc5fea2ce 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1037,7 +1037,7 @@ static float paint_2d_ibuf_add_if( paint_2d_ibuf_rgb_get(ibuf, x, y, inrgb); } else { -return 0; +return 0.0f; } mul_v4_fl(inrgb, w); @@ -1690,7 +1690,7 @@ void *paint_2d_new_stroke(bContext *C, wmOperator *op, int mode) if (BKE_image_has_packedfile(s->image) && s->image->rr != NULL) { BKE_report(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted"); MEM_freeN(s); -return 0; +return NULL; } s->num_tiles = BLI_listbase_count(>image->tiles); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 6f115acc856..bc1080208a5 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -774,7 +774,7 @@ static bool project_paint_PickColor( else { // xi = (int)((uv[0]*ibuf->x) + 0.5f); // yi = (int)((uv[1]*ibuf->y) + 0.5f); -// if (xi < 0 || xi >= ibuf->x || yi < 0 || yi >= ibuf->y) return 0; +// if (xi < 0 || xi >= ibuf->x || yi < 0 || yi >= ibuf->y) return false; /* wrap */ xi = mod_i((int)(uv[0] * ibuf->x), ibuf->x); @@ -899,7 +899,7 @@ static bool project_bucket_point_occluded(const ProjPaintState *ps, int isect_ret; const bool do_clip =
[Bf-blender-cvs] [213445e3896] master: Fix T66614: Text objects: Truncate overflow for non-top aligned text
Commit: 213445e3896922c2278fc7cdcb74d8ca13fa6a3e Author: Dalai Felinto Date: Mon Sep 21 17:49:15 2020 +1000 Branches: master https://developer.blender.org/rB213445e3896922c2278fc7cdcb74d8ca13fa6a3e Fix T66614: Text objects: Truncate overflow for non-top aligned text === M source/blender/blenkernel/intern/font.c === diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 88d91cf5640..124e53b4008 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1188,6 +1188,14 @@ static bool vfont_to_curve(Object *ob, ct_last = chartransdata + (is_last_filled_textbox ? slen : i_textbox_next - 1); lines = ct_last->linenr - ct_first->linenr + 1; +if (cu->overflow == CU_OVERFLOW_TRUNCATE) { + /* Ensure overflow doesn't truncate text, before centering vertically + * giving odd/buggy results, see: T66614. */ + if ((tb_index == cu->totbox - 1) && (last_line != -1)) { +lines = last_line - ct_first->linenr; + } +} + textbox_scale(_scale, >tb[tb_index], 1.0f / font_size); /* The initial Y origin of the textbox is hardcoded to 1.0f * text scale. */ const float textbox_y_origin = 1.0f; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f822cd511c2] blender-v2.90-release: Fix T80457: Library Override - Custom Property to Drive Child Particles results in Crash.
Commit: f822cd511c2314420aa225cf2fc245032b2c4953 Author: Bastien Montagne Date: Mon Sep 14 10:28:31 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rBf822cd511c2314420aa225cf2fc245032b2c4953 Fix T80457: Library Override - Custom Property to Drive Child Particles results in Crash. RNA diffing code was not dealing properly valid NULL PointerRNA (like the empty texture slots of a ParticleSettings e.g., which were cause of crash in that report). To be backported to 2.90 and 2.83. === M source/blender/makesrna/intern/rna_rna.c === diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 9f5440be9f8..bd8669d7f05 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1187,9 +1187,12 @@ static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *prop * This helps a lot in library override case, especially to detect inserted items in collections. */ if (!no_prop_name && (is_valid_for_diffing || do_force_name)) { -PropertyRNA *nameprop_a = RNA_struct_name_property(propptr_a->type); -PropertyRNA *nameprop_b = (propptr_b != NULL) ? RNA_struct_name_property(propptr_b->type) : -NULL; +PropertyRNA *nameprop_a = (propptr_a->type != NULL) ? + RNA_struct_name_property(propptr_a->type) : + NULL; +PropertyRNA *nameprop_b = (propptr_b != NULL && propptr_b->type != NULL) ? + RNA_struct_name_property(propptr_b->type) : + NULL; int propname_a_len = 0, propname_b_len = 0; char *propname_a = NULL; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c65e4f4e397] blender-v2.90-release: Fix T78793, T79707: Cycles crash on macOS with older CPUs
Commit: c65e4f4e3970b192ec4f6033bd8253ca07411628 Author: Brecht Van Lommel Date: Fri Sep 18 17:07:11 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rBc65e4f4e3970b192ec4f6033bd8253ca07411628 Fix T78793, T79707: Cycles crash on macOS with older CPUs Embree static libraries need additional linking flags to avoid SSE and AVX symbols getting mixed up. === M build_files/cmake/Modules/FindEmbree.cmake M build_files/cmake/platform/platform_apple.cmake === diff --git a/build_files/cmake/Modules/FindEmbree.cmake b/build_files/cmake/Modules/FindEmbree.cmake index 0c8def9ad22..54ecb03e4dd 100644 --- a/build_files/cmake/Modules/FindEmbree.cmake +++ b/build_files/cmake/Modules/FindEmbree.cmake @@ -40,9 +40,9 @@ FIND_PATH(EMBREE_INCLUDE_DIR SET(_embree_FIND_COMPONENTS embree3 + embree_sse42 embree_avx embree_avx2 - embree_sse42 lexers math simd diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index 2dc724f8376..2d906b0f94e 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -392,6 +392,16 @@ endif() if(WITH_CYCLES_EMBREE) find_package(Embree 3.8.0 REQUIRED) set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x10") + + # Embree static library linking can mix up SSE and AVX symbols, causing + # crashes on macOS systems with older CPUs that don't have AVX. Using + # force load avoids that. The Embree shared library does not suffer from + # this problem, precisely because linking a shared library uses force load. + set(_embree_libraries_force_load) + foreach(_embree_library ${EMBREE_LIBRARIES}) +list(APPEND _embree_libraries_force_load "-Wl,-force_load,${_embree_library}") + endforeach() + set(EMBREE_LIBRARIES ${_embree_libraries_force_load}) endif() if(WITH_OPENIMAGEDENOISE) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8ab98d0ed7d] blender-v2.90-release: Add versioning for 2.90 files that may have invalid mesh
Commit: 8ab98d0ed7d21aef1f6a259b4dc9b907f2193c1b Author: Germano Cavalcante Date: Thu Sep 17 11:10:58 2020 -0300 Branches: blender-v2.90-release https://developer.blender.org/rB8ab98d0ed7d21aef1f6a259b4dc9b907f2193c1b Add versioning for 2.90 files that may have invalid mesh rBf2d26409e83b fixed a serious problem with invalid mesh after an operation with the extrude manifold. Since BKE_mesh_validate_arrays is a slow operation, the chosen interval between versions is relatively small and also only the mentioned invalid mesh problem is tested. Differential Revision: https://developer.blender.org/D8898 === M source/blender/blenloader/intern/versioning_290.c === diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 84eee6c1d90..e7da180cb12 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -29,6 +29,8 @@ #include "DNA_genfile.h" #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_force_types.h" #include "DNA_object_types.h" @@ -41,6 +43,7 @@ #include "BKE_gpencil.h" #include "BKE_lib_id.h" #include "BKE_main.h" +#include "BKE_mesh.h" #include "BKE_node.h" #include "BLO_readfile.h" @@ -257,6 +260,33 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) { UNUSED_VARS(fd); + if (MAIN_VERSION_ATLEAST(bmain, 290, 2) && MAIN_VERSION_OLDER(bmain, 291, 1)) { +/* In this range, the extrude manifold could generate meshes with degenerated face. */ +LISTBASE_FOREACH (Mesh *, me, >meshes) { + for (MPoly *mp = me->mpoly, *mp_end = mp + me->totpoly; mp < mp_end; mp++) { +if (mp->totloop == 2) { + bool changed; + BKE_mesh_validate_arrays(me, + me->mvert, + me->totvert, + me->medge, + me->totedge, + me->mface, + me->totface, + me->mloop, + me->totloop, + me->mpoly, + me->totpoly, + me->dvert, + false, + true, + ); + break; +} + } +} + } + /** Repair files from duplicate brushes added to blend files, see: T76738. */ if (!MAIN_VERSION_ATLEAST(bmain, 290, 2)) { { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [be8935852bd] blender-v2.90-release: Fix invert vertex group weight miscalculation for modifiers
Commit: be8935852bd17d55c52b2416035d1c729a487f33 Author: Cody Winchester Date: Sat Sep 19 14:08:38 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rBbe8935852bd17d55c52b2416035d1c729a487f33 Fix invert vertex group weight miscalculation for modifiers Warp & weight vertex-group editing modifiers miscalculated vertex weight inversion, the weights were multiplied before being subtracted from 1. Ref D8241 === M source/blender/modifiers/intern/MOD_warp.c M source/blender/modifiers/intern/MOD_weightvg_util.c === diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index cbe774e91da..ff99e706ca3 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -280,8 +280,9 @@ static void warpModifier_do(WarpModifierData *wmd, /* skip if no vert group found */ if (defgrp_index != -1) { dv = [i]; -weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dv, defgrp_index) * strength : - BKE_defvert_find_weight(dv, defgrp_index) * strength; +weight = (invert_vgroup ? (1.0f - BKE_defvert_find_weight(dv, defgrp_index)) : + BKE_defvert_find_weight(dv, defgrp_index)) * + strength; if (weight <= 0.0f) { continue; } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 54d3aa46344..d463eae3a68 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -249,9 +249,10 @@ void weightvg_do_mask(const ModifierEvalContext *ctx, /* For each weight (vertex), make the mix between org and new weights. */ for (i = 0; i < num; i++) { int idx = indices ? indices[i] : i; - const float f = invert_vgroup_mask ? - 1.0f - BKE_defvert_find_weight([idx], ref_didx) * fact : - BKE_defvert_find_weight([idx], ref_didx) * fact; + const float f = (invert_vgroup_mask ? + (1.0f - BKE_defvert_find_weight([idx], ref_didx)) : + BKE_defvert_find_weight([idx], ref_didx)) * + fact; org_w[i] = (new_w[i] * f) + (org_w[i] * (1.0f - f)); /* If that vertex is not in ref vgroup, assume null factor, and hence do nothing! */ } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [918ef5f8352] blender-v2.90-release: Cycles: Separate Embree device for each CPU Device.
Commit: 918ef5f8352a209fba9846effe584bec9c97b1f6 Author: Stefan Werner Date: Tue Sep 1 14:47:34 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB918ef5f8352a209fba9846effe584bec9c97b1f6 Cycles: Separate Embree device for each CPU Device. Before, Cycles was using a shared Embree device across all instances. This could result in crashes when viewport rendering and material preview were using Cycles simultaneously. Fixes issue T80042 Maniphest Tasks: T80042 Differential Revision: https://developer.blender.org/D8772 === M intern/cycles/bvh/bvh.cpp M intern/cycles/bvh/bvh.h M intern/cycles/bvh/bvh_embree.cpp M intern/cycles/bvh/bvh_embree.h M intern/cycles/device/device.h M intern/cycles/device/device_cpu.cpp M intern/cycles/render/geometry.cpp === diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp index e9e67fd1305..2a1114229da 100644 --- a/intern/cycles/bvh/bvh.cpp +++ b/intern/cycles/bvh/bvh.cpp @@ -98,14 +98,15 @@ BVH::BVH(const BVHParams _, BVH *BVH::create(const BVHParams , const vector , - const vector ) + const vector , + const Device *device) { switch (params.bvh_layout) { case BVH_LAYOUT_BVH2: return new BVH2(params, geometry, objects); case BVH_LAYOUT_EMBREE: #ifdef WITH_EMBREE - return new BVHEmbree(params, geometry, objects); + return new BVHEmbree(params, geometry, objects, device); #else break; #endif diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h index 6639e06b0bc..033b1fd8e04 100644 --- a/intern/cycles/bvh/bvh.h +++ b/intern/cycles/bvh/bvh.h @@ -89,7 +89,8 @@ class BVH { static BVH *create(const BVHParams , const vector , - const vector ); + const vector , + const Device *device); virtual ~BVH() { } diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp index 4ef873634f0..b6f454da851 100644 --- a/intern/cycles/bvh/bvh_embree.cpp +++ b/intern/cycles/bvh/bvh_embree.cpp @@ -36,6 +36,8 @@ # include "bvh/bvh_embree.h" +# include "device/device.h" + /* Kernel includes are necessary so that the filter function for Embree can access the packed BVH. */ # include "kernel/bvh/bvh_embree.h" @@ -298,12 +300,6 @@ static bool rtc_progress_func(void *user_ptr, const double n) return !progress->get_cancel(); } -/* This is to have a shared device between all BVH instances. - It would be useful to actually to use a separte RTCDevice per Cycles instance. */ -RTCDevice BVHEmbree::rtc_shared_device = NULL; -int BVHEmbree::rtc_shared_users = 0; -thread_mutex BVHEmbree::rtc_shared_mutex; - static size_t count_primitives(Geometry *geom) { if (geom->type == Geometry::MESH) { @@ -320,11 +316,13 @@ static size_t count_primitives(Geometry *geom) BVHEmbree::BVHEmbree(const BVHParams _, const vector _, - const vector _) + const vector _, + const Device *device) : BVH(params_, geometry_, objects_), scene(NULL), mem_used(0), top_level(NULL), + rtc_device((RTCDevice)device->bvh_device()), stats(NULL), curve_subdivisions(params.curve_subdivisions), build_quality(RTC_BUILD_QUALITY_REFIT), @@ -332,47 +330,8 @@ BVHEmbree::BVHEmbree(const BVHParams _, { _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); - thread_scoped_lock lock(rtc_shared_mutex); - if (rtc_shared_users == 0) { -rtc_shared_device = rtcNewDevice("verbose=0"); -/* Check here if Embree was built with the correct flags. */ -ssize_t ret = rtcGetDeviceProperty(rtc_shared_device, RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED); -if (ret != 1) { - assert(0); - VLOG(1) << "Embree is compiled without the RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED flag." - "Ray visibility will not work."; -} -ret = rtcGetDeviceProperty(rtc_shared_device, RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED); -if (ret != 1) { - assert(0); - VLOG(1) - << "Embree is compiled without the RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED flag." - "Renders may not look as expected."; -} -ret = rtcGetDeviceProperty(rtc_shared_device, RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED); -if (ret != 1) { - assert(0); - VLOG(1) - << "Embree is compiled without the RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED flag. " - "Line primitives will not be rendered."; -} -ret = rtcGetDeviceProperty(rtc_shared_device, RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED); -if (ret != 1) { - assert(0); - VLOG(1) <<
[Bf-blender-cvs] [41e40793650] blender-v2.90-release: Fix T80437: Auto IK Double Generates IK constraints
Commit: 41e40793650aa23ad525c395706eae15ec82bff9 Author: Philipp Oeser Date: Thu Sep 17 18:22:42 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB41e40793650aa23ad525c395706eae15ec82bff9 Fix T80437: Auto IK Double Generates IK constraints Caused by rB9a7f5f1bb422. If using Auto IK (or targetless IK and Auto IK together), two temporary constraints were added. - from pose_grab_with_ik_add (even for targetless IK) - from add_pose_transdata (even for Auto IK) Since both both do similar things, but cannot work in tandem (with possibly different chainlengths for example), we have to decide which type to prefer over the other (as in: do not create a constraint for the other). It seems better to ignore the 'Auto IK' option on bones that will have targetless IK set up for them specificallly [e.g. defining special chainlength]. This way you can still work with 'Auto IK' ON generally [with interactive chainlength control], but also have specific bones that need their own custom chainlength. For now, the most straightforward fix is to - only add constraints for Auto IK from pose_grab_with_ik_add() - only add constraints for targetless IK from add_pose_transdata() Note: this area has some potential for later refactoring: - move creation of all temporary constraints to a single place [preferably pose_grab_with_ik_add] - use only those temporary constraints in transform code [atm. we still flip CONSTRAINT_IK_AUTO around on the "original" -- unneccesarily, after rB9a7f5f1bb422 a dedicated temporary constraint is now always available] - clarify CONSTRAINT_IK_AUTO vs. CONSTRAINT_IK_TEMP - obeying standard rotation locks on bones in the chain (not just the the IK locks) is not consistent between targetless IK and Auto IK Potential candidate for 2.90.1 as well as 2.83 LTS Maniphest Tasks: T80437 Differential Revision: https://developer.blender.org/D8930 === M source/blender/editors/transform/transform_convert_armature.c === diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index 9885c8fc3a6..5cc6a62894d 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -349,6 +349,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) } } } + + /* Return early (as in: don't actually create a temporary constraint here), since adding + * will take place later in add_pose_transdata() for targetless constraints. */ + return 0; } } @@ -702,10 +706,14 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr /* Add a temporary auto IK constraint here, as we will only temporarily active this * targetless bone during transform. (Targetless IK constraints are treated as if they are - * disabled unless they are transformed). */ - add_temporary_ik_constraint(pchan, data); - Main *bmain = CTX_data_main(t->context); - update_deg_with_temporary_ik(bmain, ob); + * disabled unless they are transformed). + * Only do this for targetless IK though, AutoIK already added a constraint in + * pose_grab_with_ik_add() beforehand. */ + if ((data->flag & CONSTRAINT_IK_TEMP) == 0) { +add_temporary_ik_constraint(pchan, data); +Main *bmain = CTX_data_main(t->context); +update_deg_with_temporary_ik(bmain, ob); + } /* only object matrix correction */ copy_m3_m3(td->mtx, omat); @@ -1350,10 +1358,14 @@ static void pose_transform_mirror_update(TransInfo *t, TransDataContainer *tc, O data->flag |= CONSTRAINT_IK_AUTO; /* Add a temporary auto IK constraint here, as we will only temporarily active this * target-less bone during transform. (Target-less IK constraints are treated as if they are - * disabled unless they are transformed) */ - add_temporary_ik_constraint(pchan, data); - Main *bmain = CTX_data_main(t->context); - update_deg_with_temporary_ik(bmain, ob); + * disabled unless they are transformed). + * Only do this for targetless IK though, AutoIK already added a constraint in + * pose_grab_with_ik_add() beforehand. */ + if ((data->flag & CONSTRAINT_IK_TEMP) == 0) { +add_temporary_ik_constraint(pchan, data); +Main *bmain = CTX_data_main(t->context); +update_deg_with_temporary_ik(bmain, ob); + } } if (pid) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9ec325b59d5] blender-v2.90-release: Fix T61985: NLA Bake exception baking pose with non-pose selection
Commit: 9ec325b59d54091f437689ebdfbc3f74ad46108d Author: Campbell Barton Date: Sun Sep 20 13:54:22 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB9ec325b59d54091f437689ebdfbc3f74ad46108d Fix T61985: NLA Bake exception baking pose with non-pose selection === M release/scripts/startup/bl_operators/anim.py === diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index d55644f19c7..d0b4b485d82 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -260,7 +260,13 @@ class NLA_OT_bake(Operator): def execute(self, context): from bpy_extras import anim_utils +do_pose = 'POSE' in self.bake_types +do_object = 'OBJECT' in self.bake_types + objects = context.selected_editable_objects +if do_pose and not do_object: +objects = [obj for obj in objects if obj.pose is not None] + object_action_pairs = ( [(obj, getattr(obj.animation_data, "action", None)) for obj in objects] if self.use_current_action else @@ -271,8 +277,8 @@ class NLA_OT_bake(Operator): object_action_pairs, frames=range(self.frame_start, self.frame_end + 1, self.step), only_selected=self.only_selected, -do_pose='POSE' in self.bake_types, -do_object='OBJECT' in self.bake_types, +do_pose=do_pose, +do_object=do_object, do_visual_keying=self.visual_keying, do_constraint_clear=self.clear_constraints, do_parents_clear=self.clear_parents, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [60fbed3dba9] blender-v2.90-release: Fix T80520: Tris to Quads ignores UV delimit option
Commit: 60fbed3dba9f7cafd134f7a6dfe2892252a2d54b Author: mano-wii Date: Mon Sep 21 15:01:46 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB60fbed3dba9f7cafd134f7a6dfe2892252a2d54b Fix T80520: Tris to Quads ignores UV delimit option === M source/blender/bmesh/operators/bmo_join_triangles.c === diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index efb8b810581..1da4be57568 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -166,7 +166,7 @@ static bool bm_edge_delimit_cdata(CustomData *ldata, r_delim_cd->cd_type = type; r_delim_cd->cd_size = CustomData_sizeof(r_delim_cd->cd_type); r_delim_cd->cd_offset = CustomData_get_n_offset(ldata, type, 0); - r_delim_cd->cd_offset_end = r_delim_cd->cd_size * layer_len; + r_delim_cd->cd_offset_end = r_delim_cd->cd_offset + (r_delim_cd->cd_size * layer_len); return (r_delim_cd->cd_offset != -1); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a5b6d6de0a2] blender-v2.90-release: Fix T80885: Texture paint camera project crashes after undo/redo
Commit: a5b6d6de0a2b3cec82cd914d58d0c435dace55b0 Author: Campbell Barton Date: Fri Sep 18 14:17:17 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rBa5b6d6de0a2b3cec82cd914d58d0c435dace55b0 Fix T80885: Texture paint camera project crashes after undo/redo Unmatched ED_image_undo_push_{begin/end}, add doc-strings noting why this is needed. Thanks to @Baardaap for the initial fix. === M source/blender/editors/sculpt_paint/paint_image_proj.c M source/blender/editors/space_image/image_undo.c === diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 5af3a3f4241..cc60d73eef0 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6114,8 +6114,6 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) scene->toolsettings->imapaint.flag |= IMAGEPAINT_DRAWING; - ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_3D); - /* allocate and initialize spatial data structures */ project_paint_begin(C, , false, 0); @@ -6125,8 +6123,10 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - float pos[2] = {0.0, 0.0}; - float lastpos[2] = {0.0, 0.0}; + ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_3D); + + const float pos[2] = {0.0, 0.0}; + const float lastpos[2] = {0.0, 0.0}; int a; project_paint_op(, lastpos, pos); @@ -6140,6 +6140,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) project_paint_end(); + ED_image_undo_push_end(); + scene->toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING; BKE_brush_size_set(scene, ps.brush, orig_brush_size); diff --git a/source/blender/editors/space_image/image_undo.c b/source/blender/editors/space_image/image_undo.c index e0c44c3a0ba..ce4e9195723 100644 --- a/source/blender/editors/space_image/image_undo.c +++ b/source/blender/editors/space_image/image_undo.c @@ -1005,6 +1005,14 @@ void ED_image_undosys_type(UndoType *ut) /* */ /** \name Utilities + * + * \note image undo exposes #ED_image_undo_push_begin, #ED_image_undo_push_end + * which must be called by the operator directly. + * + * Unlike most other undo stacks this is needed: + * - So we can always access the state before the image was painted onto, + * which is needed if previous undo states aren't image-type. + * - So operators can access the pixel-data before the stroke was applied, at run-time. * \{ */ ListBase *ED_image_paint_tile_list_get(void) @@ -1042,6 +1050,10 @@ static ImageUndoStep *image_undo_push_begin(const char *name, int paint_mode) return us; } +/** + * The caller is responsible for running #ED_image_undo_push_end, + * failure to do so causes an invalid state for the undo system. + */ void ED_image_undo_push_begin(const char *name, int paint_mode) { image_undo_push_begin(name, paint_mode); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [adcb3c6ee14] blender-v2.90-release: Fix T80728: UV edge select splits UV's for lasso/box/circle select
Commit: adcb3c6ee14d58ee9b9ff78db1b393f7c7394d70 Author: Campbell Barton Date: Mon Sep 14 21:03:24 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rBadcb3c6ee14d58ee9b9ff78db1b393f7c7394d70 Fix T80728: UV edge select splits UV's for lasso/box/circle select Oversight in 411c5238a2fef ignored sticky selection. Use 'uvedit_edge_select_set_with_sticky' to make sure sticky options are respected. Also skip checking the existing selection since that only checks the current UV, not all connected UV's which is needed for sticky selection. The extra checks to avoid updating UV's isn't such an advantage as only meshed in the selected region are tagged for updating. === M source/blender/editors/uvedit/uvedit_select.c === diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 149c5cf1f96..ffa88b97557 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -2855,9 +2855,6 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) } } else if (use_edge && !pinned) { - changed = true; - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); - BM_ITER_MESH (efa, , em->bm, BM_FACES_OF_MESH) { if (!uvedit_face_visible_test(scene, efa)) { continue; @@ -2865,29 +2862,18 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) BMLoop *l_prev = BM_FACE_FIRST_LOOP(efa)->prev; MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l_prev, cd_loop_uv_offset); -bool luv_select_prev = uvedit_uv_select_test(scene, l_prev, cd_loop_uv_offset); BM_ITER_ELEM (l, , efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - const bool luv_select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset); - if ((select != luv_select) || (select != luv_select_prev)) { -if (BLI_rctf_isect_pt_v(, luv->uv) && -BLI_rctf_isect_pt_v(, luv_prev->uv)) { - uvedit_uv_select_set(scene, em, l, select, false, cd_loop_uv_offset); - uvedit_uv_select_set(scene, em, l_prev, select, false, cd_loop_uv_offset); - BM_elem_flag_enable(l->v, BM_ELEM_TAG); - BM_elem_flag_enable(l_prev->v, BM_ELEM_TAG); -} + if (BLI_rctf_isect_pt_v(, luv->uv) && BLI_rctf_isect_pt_v(, luv_prev->uv)) { +uvedit_edge_select_set_with_sticky( +sima, scene, em, l_prev, select, false, cd_loop_uv_offset); +changed = true; } l_prev = l; luv_prev = luv; - luv_select_prev = luv_select; } } - - if (sima->sticky == SI_STICKY_VERTEX) { -uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset); - } } else { /* other selection modes */ @@ -3086,8 +3072,6 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) } } else if (use_edge) { - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); - BM_ITER_MESH (efa, , em->bm, BM_FACES_OF_MESH) { if (!uvedit_face_visible_test(scene, efa)) { continue; @@ -3095,29 +3079,18 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) BMLoop *l_prev = BM_FACE_FIRST_LOOP(efa)->prev; MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l_prev, cd_loop_uv_offset); -bool luv_select_prev = uvedit_uv_select_test(scene, l_prev, cd_loop_uv_offset); BM_ITER_ELEM (l, , efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - const bool luv_select = uvedit_uv_select_test(scene, l, cd_loop_uv_offset); - if ((select != luv_select) || (select != luv_select_prev)) { -if (uv_circle_select_is_edge_inside(luv->uv, luv_prev->uv, offset, ellipse)) { - changed = true; - uvedit_uv_select_set(scene, em, l, select, false, cd_loop_uv_offset); - uvedit_uv_select_set(scene, em, l_prev, select, false, cd_loop_uv_offset); - BM_elem_flag_enable(l->v, BM_ELEM_TAG); - BM_elem_flag_enable(l_prev->v, BM_ELEM_TAG); -} + if (uv_circle_select_is_edge_inside(luv->uv, luv_prev->uv, offset, ellipse)) { +uvedit_edge_select_set_with_sticky( +sima, scene, em, l_prev, select, false, cd_loop_uv_offset); +changed = true; } l_prev = l; luv_prev = luv; - luv_select_prev = luv_select; } } - - if (sima->sticky == SI_STICKY_VERTEX) { -uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset); - } } else { BM_mesh_elem_hflag_disable_all(em->bm,
[Bf-blender-cvs] [27ea0862426] blender-v2.90-release: Fix T80694: Crash reloading scripts from the Python console
Commit: 27ea0862426d910badc6f81ce13d29a6ef3cc5f0 Author: Campbell Barton Date: Mon Sep 14 17:50:01 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB27ea0862426d910badc6f81ce13d29a6ef3cc5f0 Fix T80694: Crash reloading scripts from the Python console Running `bpy.ops.script.reload()` from Python was crashing since the operator being called was it's self freed. Change the reload operator to defer execution - as supporting re-registration during execution is quite involved for a corner-case. === M release/scripts/modules/bpy/utils/__init__.py M source/blender/editors/space_script/script_edit.c M source/blender/makesrna/intern/rna_wm_api.c === diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index 8a67a598ccd..4e0220ee1cc 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -283,6 +283,8 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): del _initialize if reload_scripts: +_bpy.context.window_manager.tag_script_reload() + import gc print("gc.collect() -> %d" % gc.collect()) diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index e9ed1cec228..0c5cadf74e7 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -115,15 +115,32 @@ static int script_reload_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - WM_script_tag_reload(); - - /* TODO, this crashes on netrender and keying sets, need to look into why - * disable for now unless running in debug mode */ - WM_cursor_wait(1); - BPY_execute_string( - C, (const char *[]){"bpy", NULL}, "bpy.utils.load_scripts(reload_scripts=True)"); - WM_cursor_wait(0); - WM_event_add_notifier(C, NC_WINDOW, NULL); + /* TODO(campbell): this crashes on netrender and keying sets, need to look into why + * disable for now unless running in debug mode. */ + + /* It would be nice if we could detect when this is called from the Python + * only postponing in that case, for now always do it. */ + if (true) { +/* Postpone when called from Python so this can be called from an operator + * that might be re-registered, crashing Blender when we try to read from the + * freed operator type which, see T80694. */ +BPY_execute_string(C, + (const char *[]){"bpy", NULL}, + "def fn():\n" + "bpy.utils.load_scripts(reload_scripts=True)\n" + "return None\n" + "bpy.app.timers.register(fn)"); + } + else { +WM_cursor_wait(true); +BPY_execute_string( +C, (const char *[]){"bpy", NULL}, "bpy.utils.load_scripts(reload_scripts=True)"); +WM_cursor_wait(false); + } + + /* Note that #WM_script_tag_reload is called from `bpy.utils.load_scripts`, + * any additional updates required by this operator should go there. */ + return OPERATOR_FINISHED; #else UNUSED_VARS(C, op); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index ee7ff472c12..8d7a3cddbc5 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -558,6 +558,12 @@ static void rna_WindowManager_print_undo_steps(wmWindowManager *wm) BKE_undosys_print(wm->undo_stack); } +static void rna_WindowManager_tag_script_reload(void) +{ + WM_script_tag_reload(); + WM_main_add_notifier(NC_WINDOW, NULL); +} + static PointerRNA rna_WindoManager_operator_properties_last(const char *idname) { wmOperatorType *ot = WM_operatortype_find(idname, true); @@ -913,6 +919,12 @@ void RNA_api_wm(StructRNA *srna) RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps"); + /* Used by (#SCRIPT_OT_reload). */ + func = RNA_def_function(srna, "tag_script_reload", "rna_WindowManager_tag_script_reload"); + RNA_def_function_ui_description( + func, "Tag for refreshing the interface after scripts have been reloaded"); + RNA_def_function_flag(func, FUNC_NO_SELF); + parm = RNA_def_property(srna, "is_interface_locked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text( parm, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [39af4d8bfe3] blender-v2.90-release: Fix T77584: Edit Mode crash with shape keys created on blank mesh
Commit: 39af4d8bfe389a3392d2f5e0af22fccafa1064c6 Author: Campbell Barton Date: Sun Sep 13 18:11:38 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB39af4d8bfe389a3392d2f5e0af22fccafa1064c6 Fix T77584: Edit Mode crash with shape keys created on blank mesh Entering edit-mode after creating shape keys on a blank mesh would crash. Regression in 9b9f84b317fef which prevented initializing empty shape keys when there is no shape key offset data available. === M source/blender/bmesh/intern/bmesh_mesh_convert.c === diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c b/source/blender/bmesh/intern/bmesh_mesh_convert.c index 65bc4da49bc..6b975ab427c 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.c +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c @@ -884,19 +884,14 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh } for (currkey = me->key->block.first; currkey; currkey = currkey->next) { - const bool apply_offset = (ofs && (currkey != actkey) && - (bm->shapenr - 1 == currkey->relative)); - int cd_shape_offset; int keyi; const float(*ofs_pt)[3] = ofs; float *newkey, (*oldkey)[3], *fp; j = bm_to_mesh_shape_layer_index_from_kb(bm, currkey); - cd_shape_offset = CustomData_get_n_offset(>vdata, CD_SHAPEKEY, j); - if (cd_shape_offset < 0) { -/* The target Mesh has more shapekeys than the BMesh. */ -continue; - } + const int cd_shape_offset = CustomData_get_n_offset(>vdata, CD_SHAPEKEY, j); + const bool apply_offset = (cd_shape_offset != -1) && (ofs != NULL) && (currkey != actkey) && +(bm->shapenr - 1 == currkey->relative); fp = newkey = MEM_callocN(me->key->elemsize * bm->totvert, "currkey->data"); oldkey = currkey->data; @@ -918,7 +913,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh } } } -else if (j != -1) { +else if (cd_shape_offset != -1) { /* In most cases this runs. */ copy_v3_v3(fp, BM_ELEM_CD_GET_VOID_P(eve, cd_shape_offset)); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bff56477c9d] blender-v2.90-release: Fix T78225: Vertex Colors not showing in edit mode
Commit: bff56477c9d8f1dda42f5cd58dbd8230897c2665 Author: Pablo Dobarro Date: Sun Sep 6 18:56:40 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rBbff56477c9d8f1dda42f5cd58dbd8230897c2665 Fix T78225: Vertex Colors not showing in edit mode This should be using the mesh_cd_ldata_get_from_mesh function in order to get ldata from BMesh in edit mode. Reviewed By: sergey Maniphest Tasks: T78225 Differential Revision: https://developer.blender.org/D8818 === M source/blender/draw/intern/draw_cache_impl_mesh.c === diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 772871f726e..792b0372457 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -169,7 +169,7 @@ static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_us static void mesh_cd_calc_active_mloopcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { const Mesh *me_final = editmesh_final_or_this(me); - const CustomData *cd_ldata = _final->ldata; + const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL); if (layer != -1) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0f72e7c3ebb] blender-v2.90-release: Fix OpenCL render error in large scenes
Commit: 0f72e7c3ebb188001b29a54650272ab2fd3d9074 Author: Brecht Van Lommel Date: Thu Sep 17 13:07:28 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB0f72e7c3ebb188001b29a54650272ab2fd3d9074 Fix OpenCL render error in large scenes In scenes such as Cosmos Laundromat, there were memory allocations bigger than 2GB which would overflow. Problem and solution found by AMD, thanks! === M intern/cycles/device/opencl/memory_manager.cpp === diff --git a/intern/cycles/device/opencl/memory_manager.cpp b/intern/cycles/device/opencl/memory_manager.cpp index 0285dc969ec..4330e07cb37 100644 --- a/intern/cycles/device/opencl/memory_manager.cpp +++ b/intern/cycles/device/opencl/memory_manager.cpp @@ -65,7 +65,7 @@ void MemoryManager::DeviceBuffer::update_device_memory(OpenCLDevice *device) } /* Always allocate non-empty buffer, NULL pointers cause problems with some drivers. */ - total_size = max(total_size, 16); + total_size = std::max(total_size, (size_t)16); if (need_realloc) { cl_ulong max_buffer_size; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7447233f76f] blender-v2.90-release: Fix T80464: Crash deleting bone constraints when the armature layer is not active
Commit: 7447233f76fe85a364002f17232c284f16b7084f Author: Philipp Oeser Date: Wed Sep 9 14:10:47 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB7447233f76fe85a364002f17232c284f16b7084f Fix T80464: Crash deleting bone constraints when the armature layer is not active Caused by {rB608d9b5aa1f1} Prior to rB608d9b5aa1f1, the constraint was gotten using **context** [CTX_data_pointer_get_type(C, "constraint", _Constraint) -- which is valid for bones on hidden layers]. After rB608d9b5aa1f1, the constraint is found (or isnt) using `edit_constraint_property_get` [this is **not** valid for bones on hidden layers because internally `BKE_pose_channel_active` checks if the bone is on an active layer]. Some observations: - Every operator using `edit_constraint_property_get` doesnt work for bones on inactive layers [delete, moveup, movedown, move to index (drag n drop nowadays)] -- moveup, movedown, move to index check if they could find a constraint beforehand though (dont crash) -- delete crashes (doesnt check if a constraint could actually be found) - Every operator using `edit_constraint_property_get` for constraint data doesnt work for bones on inactive layers [stretchto_reset, limitdistance_reset, childof_set_inverse, ...] -- these all check if they could find a constraint beforehand though (dont crash) This is because the poll function is using **context** to get the constraint, the operators themselves use **edit_constraint_property_get** which leads to inconsistent/unexpected results. Possible solutions were: - [1] let the delete operator just work with the context constraint again (like prior to rB608d9b5aa1f1) -- allows for deleting constraints on bones in inactive layers - [2] check if we could get a constraint -- prevents the crash, but does **not** allow for deleting constraints on bones in inactive layers - [3] make the poll `edit_constraint_poll_generic` be as strict as the operators -- dont use **context** to get the constraint, but something like **edit_constraint_property_get** - [4] make the operators be more graceful and let them act on bones on hidden layers -- let **edit_constraint_property_get** actually use the same **context** This patch implements [4], so poll an doperators are now in sync. - prevents reported crash - also enables operators for bone constraints on hidden layers - also enables drag and drop reordering of constraints on hidden layers This might be a candidate for 2.90.1? (if it is, take care to include prior "Refactor getting constraints" refactoring commit) Note: Adding constraints also doesnt work for bones on inactive layers [that was the case in 2.79 as well -- it is also using `BKE_pose_channel_active`] Maniphest Tasks: T80464 Differential Revision: https://developer.blender.org/D8805 === M source/blender/editors/object/object_constraint.c === diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index cdb7a9f2b83..3eb0cc54398 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -796,7 +796,7 @@ static bool edit_constraint_invoke_properties(bContext *C, return false; } -static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type) +static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Object *ob, int type) { char constraint_name[MAX_NAME]; int owner = RNA_enum_get(op->ptr, "owner"); @@ -805,30 +805,10 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int RNA_string_get(op->ptr, "constraint", constraint_name); - if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) { -list = >constraints; - } - else if (owner == EDIT_CONSTRAINT_OWNER_BONE) { -bPoseChannel *pchan = BKE_pose_channel_active(ob); -if (pchan) { - list = >constraints; -} -else { -#if 0 - if (G.debug & G_DEBUG) { -printf("edit_constraint_property_get: No active bone for object '%s'\n", - (ob) ? ob->id.name + 2 : ""); - } -#endif - return NULL; -} + if (owner == EDIT_CONSTRAINT_OWNER_BONE) { +list = ED_object_pose_constraint_list(C); } else { -#if 0 -if (G.debug & G_DEBUG) { - printf("edit_constraint_property_get: defaulting to getting list in the standard way\n"); -} -#endif list = ED_object_constraint_active_list(ob); } @@ -858,7 +838,7 @@ static int stretchto_reset_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO); + bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_STRETCHTO); bStretchToConstraint *data = (con) ? (bStretchToConstraint
[Bf-blender-cvs] [3ff6541c5d7] blender-v2.90-release: Fix T80372: Mantaflow Noise Not working with Smoke/Smoke and Fire
Commit: 3ff6541c5d7e140a9945111706a16740d85dd69a Author: Sebastián Barschkis Date: Thu Sep 10 12:45:59 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB3ff6541c5d7e140a9945111706a16740d85dd69a Fix T80372: Mantaflow Noise Not working with Smoke/Smoke and Fire Modular caches for noise, particles and meshes require that additional data is baked (i.e. is resumable option). With this commit users will be explicitly asked to enable this option before being able to bake noise, particles or meshes. === M release/scripts/startup/bl_ui/properties_physics_fluid.py === diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 8dd5b935922..427f8c2c85f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -731,11 +731,18 @@ class PHYSICS_PT_noise(PhysicButtonsPanel, Panel): # Deactivate bake operator if data has not been baked yet. note_flag = True -if domain.use_noise and not domain.has_cache_baked_data and domain.cache_type == 'MODULAR': -note = layout.split() -note_flag = False -note.enabled = note_flag -note.label(icon='INFO', text="Unbaked Data: Bake Data first") +if domain.use_noise and domain.cache_type == 'MODULAR': +label = "" +if not domain.has_cache_baked_data: +label = "Unbaked Data: Bake Data first" +if not domain.cache_resumable: +label = "Non Resumable Cache: Enable resumable option first" + +if label: +note = layout.split() +note_flag = False +note.enabled = note_flag +note.label(icon='INFO', text=label) split = layout.split() split.enabled = domain.has_cache_baked_data and note_flag and ob.mode == 'OBJECT' @@ -817,11 +824,18 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel): # Deactivate bake operator if data has not been baked yet. note_flag = True -if domain.use_mesh and not domain.has_cache_baked_data and domain.cache_type == 'MODULAR': -note = layout.split() -note_flag = False -note.enabled = note_flag -note.label(icon='INFO', text="Unbaked Data: Bake Data first") +if domain.use_mesh and domain.cache_type == 'MODULAR': +label = "" +if not domain.has_cache_baked_data: +label = "Unbaked Data: Bake Data first" +if not domain.cache_resumable: +label = "Non Resumable Cache: Enable resumable option first" + +if label: +note = layout.split() +note_flag = False +note.enabled = note_flag +note.label(icon='INFO', text=label) split = layout.split() split.enabled = domain.has_cache_baked_data and note_flag and ob.mode == 'OBJECT' @@ -931,11 +945,18 @@ class PHYSICS_PT_particles(PhysicButtonsPanel, Panel): # Deactivate bake operator if data has not been baked yet. note_flag = True -if using_particles and not domain.has_cache_baked_data and domain.cache_type == 'MODULAR': -note = layout.split() -note_flag = False -note.enabled = note_flag -note.label(icon='INFO', text="Unbaked Data: Bake Data first") +if using_particles and domain.cache_type == 'MODULAR': +label = "" +if not domain.has_cache_baked_data: +label = "Unbaked Data: Bake Data first" +if not domain.cache_resumable: +label = "Non Resumable Cache: Enable resumable option first" + +if label: +note = layout.split() +note_flag = False +note.enabled = note_flag +note.label(icon='INFO', text=label) split = layout.split() split.enabled = ( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5d10814ccce] blender-v2.90-release: Fix T79626: 2.91 Mantaflow crash when adaptive domain + noise are enabled
Commit: 5d10814cccecd2a838fdaf6d991d5e9a335a35eb Author: Sebastián Barschkis Date: Thu Sep 10 11:09:49 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB5d10814cccecd2a838fdaf6d991d5e9a335a35eb Fix T79626: 2.91 Mantaflow crash when adaptive domain + noise are enabled Crash was caused by an incorect domain size of the noise solver and an index out of bounds. === M source/blender/blenkernel/intern/fluid.c === diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 079b436a3ea..f0f01df723e 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -181,7 +181,6 @@ void BKE_fluid_reallocate_copy_fluid(FluidDomainSettings *fds, float *n_b = manta_smoke_get_color_b(fds->fluid); /* Noise smoke fields. */ -int wt_res_old[3]; float *o_wt_dens = manta_noise_get_density(fluid_old); float *o_wt_react = manta_noise_get_react(fluid_old); float *o_wt_flame = manta_noise_get_flame(fluid_old); @@ -210,6 +209,7 @@ void BKE_fluid_reallocate_copy_fluid(FluidDomainSettings *fds, float *n_wt_tcv2 = manta_noise_get_texture_v2(fds->fluid); float *n_wt_tcw2 = manta_noise_get_texture_w2(fds->fluid); +int wt_res_old[3]; manta_noise_get_res(fluid_old, wt_res_old); for (int z = o_min[2]; z < o_max[2]; z++) { @@ -3790,6 +3790,13 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd, } } + /* Adaptive domain needs to know about current state, so save it here. */ + int o_res[3], o_min[3], o_max[3], o_shift[3]; + copy_v3_v3_int(o_res, fds->res); + copy_v3_v3_int(o_min, fds->res_min); + copy_v3_v3_int(o_max, fds->res_max); + copy_v3_v3_int(o_shift, fds->shift); + /* Ensure that time parameters are initialized correctly before every step. */ float fps = scene->r.frs_sec / scene->r.frs_sec_base; fds->frame_length = DT_DEFAULT * (25.0f / fps) * fds->time_scale; @@ -3870,8 +3877,6 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd, bool with_gdomain; with_gdomain = (fds->guide_source == FLUID_DOMAIN_GUIDE_SRC_DOMAIN); - int o_res[3], o_min[3], o_max[3], o_shift[3]; - /* Cache mode specific settings. */ switch (mode) { case FLUID_DOMAIN_CACHE_ALL: @@ -3935,12 +3940,6 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *fmd, break; } - /* Adaptive domain needs to know about current state, so save it here. */ - copy_v3_v3_int(o_res, fds->res); - copy_v3_v3_int(o_min, fds->res_min); - copy_v3_v3_int(o_max, fds->res_max); - copy_v3_v3_int(o_shift, fds->shift); - bool read_partial = false, read_all = false; /* Try to read from cache and keep track of read success. */ if (read_cache) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [211b3908711] blender-v2.90-release: Fix T79973: Re-ordering face maps messes up the names of other face maps
Commit: 211b39087117664a196825ec62e94adb8ff6e623 Author: Germano Cavalcante Date: Mon Aug 31 08:40:54 2020 -0300 Branches: blender-v2.90-release https://developer.blender.org/rB211b39087117664a196825ec62e94adb8ff6e623 Fix T79973: Re-ordering face maps messes up the names of other face maps Use a remap function instead a swap. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D8739 === M source/blender/editors/object/object_facemap_ops.c === diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c index 6e0376358bb..32668598df1 100644 --- a/source/blender/editors/object/object_facemap_ops.c +++ b/source/blender/editors/object/object_facemap_ops.c @@ -26,6 +26,7 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "DNA_mesh_types.h" @@ -99,71 +100,61 @@ void ED_object_facemap_face_remove(Object *ob, bFaceMap *fmap, int facenum) } } -static void object_fmap_swap_edit_mode(Object *ob, int num1, int num2) +static void object_fmap_remap_edit_mode(Object *ob, const int *remap) { - if (ob->type == OB_MESH) { -Mesh *me = ob->data; + if (ob->type != OB_MESH) { +return; + } + + Mesh *me = ob->data; + if (me->edit_mesh) { +BMEditMesh *em = me->edit_mesh; +const int cd_fmap_offset = CustomData_get_offset(>bm->pdata, CD_FACEMAP); -if (me->edit_mesh) { - BMEditMesh *em = me->edit_mesh; - const int cd_fmap_offset = CustomData_get_offset(>bm->pdata, CD_FACEMAP); - - if (cd_fmap_offset != -1) { -BMFace *efa; -BMIter iter; -int *map; - -BM_ITER_MESH (efa, , em->bm, BM_FACES_OF_MESH) { - map = BM_ELEM_CD_GET_VOID_P(efa, cd_fmap_offset); - - if (map) { -if (num1 != -1) { - if (*map == num1) { -*map = num2; - } - else if (*map == num2) { -*map = num1; - } -} - } +if (cd_fmap_offset != -1) { + BMFace *efa; + BMIter iter; + int *map; + + BM_ITER_MESH (efa, , em->bm, BM_FACES_OF_MESH) { +map = BM_ELEM_CD_GET_VOID_P(efa, cd_fmap_offset); + +if (map && *map != -1) { + *map = remap[*map]; } } } } } -static void object_fmap_swap_object_mode(Object *ob, int num1, int num2) +static void object_fmap_remap_object_mode(Object *ob, const int *remap) { - if (ob->type == OB_MESH) { -Mesh *me = ob->data; + if (ob->type != OB_MESH) { +return; + } -if (CustomData_has_layer(>pdata, CD_FACEMAP)) { - int *map = CustomData_get_layer(>pdata, CD_FACEMAP); - int i; - - if (map) { -for (i = 0; i < me->totpoly; i++) { - if (num1 != -1) { -if (map[i] == num1) { - map[i] = num2; -} -else if (map[i] == num2) { - map[i] = num1; -} - } + Mesh *me = ob->data; + if (CustomData_has_layer(>pdata, CD_FACEMAP)) { +int *map = CustomData_get_layer(>pdata, CD_FACEMAP); +int i; + +if (map) { + for (i = 0; i < me->totpoly; i++) { +if (map[i] != -1) { + map[i] = remap[map[i]]; } } } } } -static void object_facemap_swap(Object *ob, int num1, int num2) +static void object_facemap_remap(Object *ob, const int *remap) { if (BKE_object_is_in_editmode(ob)) { -object_fmap_swap_edit_mode(ob, num1, num2); +object_fmap_remap_edit_mode(ob, remap); } else { -object_fmap_swap_object_mode(ob, num1, num2); +object_fmap_remap_object_mode(ob, remap); } } @@ -432,45 +423,46 @@ static int face_map_move_exec(bContext *C, wmOperator *op) Object *ob = ED_object_context(C); bFaceMap *fmap; int dir = RNA_enum_get(op->ptr, "direction"); - int pos1, pos2 = -1, count; fmap = BLI_findlink(>fmaps, ob->actfmap - 1); if (!fmap) { return OPERATOR_CANCELLED; } - count = BLI_listbase_count(>fmaps); - pos1 = BLI_findindex(>fmaps, fmap); + if (!fmap->prev && !fmap->next) { +return OPERATOR_CANCELLED; + } - if (dir == 1) { /*up*/ -void *prev = fmap->prev; + int pos1 = BLI_findindex(>fmaps, fmap); + int pos2 = pos1 - dir; + int len = BLI_listbase_count(>fmaps); + int *map = MEM_mallocN(len * sizeof(*map), __func__); -if (prev) { - pos2 = pos1 - 1; -} -else { - pos2 = count - 1; + if (!IN_RANGE(pos2, -1, len)) { +const int offset = len - dir; +for (int i = 0; i < len; i++) { + map[i] = (i + offset) % len; } +pos2 = map[pos1]; + } + else { +range_vn_i(map, len, 0); +SWAP(int, map[pos1], map[pos2]); + } -BLI_remlink(>fmaps, fmap); + void *prev = fmap->prev; + void *next =
[Bf-blender-cvs] [4f6e51aa520] blender-v2.90-release: Fix T80623: Correct Face Attributes affecting modes not listed
Commit: 4f6e51aa5201c5eb00e009a95898c224f77d2c05 Author: Germano Cavalcante Date: Fri Sep 11 15:39:33 2020 -0300 Branches: blender-v2.90-release https://developer.blender.org/rB4f6e51aa5201c5eb00e009a95898c224f77d2c05 Fix T80623: Correct Face Attributes affecting modes not listed Some transform modes (such as Mirror) are not listed to have UV corrected during the transformation. It messed up the UV of all of these. === 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 c509cc782e5..cbbdb4c6c8f 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1293,6 +1293,9 @@ void mesh_customdatacorrect_init(TransInfo *t) use_merge_group = (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED) != 0; } } + else { +return; + } FOREACH_TRANS_DATA_CONTAINER (t, tc) { mesh_customdatacorrect_init_container(tc, use_merge_group); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9d290c9fc62] blender-v2.90-release: Fix T62504: Crash accessing depsgraph from evaluated view layer
Commit: 9d290c9fc62acdbb53fb34922916521f2027ed33 Author: Campbell Barton Date: Sun Sep 13 15:28:41 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB9d290c9fc62acdbb53fb34922916521f2027ed33 Fix T62504: Crash accessing depsgraph from evaluated view layer Use correct owner_id types for depsgraph view_layer properties instead of inheriting from the Depsgraph which is set to NULL. === M source/blender/makesrna/intern/rna_depsgraph.c === diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index da1ed166eb2..ed0fe3f7765 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -43,6 +43,8 @@ # include "BLI_iterator.h" # include "BLI_math.h" +# include "RNA_access.h" + # include "BKE_duplilist.h" # include "BKE_object.h" # include "BKE_scene.h" @@ -461,14 +463,19 @@ static PointerRNA rna_Depsgraph_scene_get(PointerRNA *ptr) { Depsgraph *depsgraph = (Depsgraph *)ptr->data; Scene *scene = DEG_get_input_scene(depsgraph); - return rna_pointer_inherit_refine(ptr, _Scene, scene); + PointerRNA newptr; + RNA_pointer_create(>id, _Scene, scene, ); + return newptr; } static PointerRNA rna_Depsgraph_view_layer_get(PointerRNA *ptr) { Depsgraph *depsgraph = (Depsgraph *)ptr->data; + Scene *scene = DEG_get_input_scene(depsgraph); ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); - return rna_pointer_inherit_refine(ptr, _ViewLayer, view_layer); + PointerRNA newptr; + RNA_pointer_create(>id, _ViewLayer, view_layer, ); + return newptr; } static PointerRNA rna_Depsgraph_scene_eval_get(PointerRNA *ptr) @@ -476,13 +483,19 @@ static PointerRNA rna_Depsgraph_scene_eval_get(PointerRNA *ptr) Depsgraph *depsgraph = (Depsgraph *)ptr->data; Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); return rna_pointer_inherit_refine(ptr, _Scene, scene_eval); + PointerRNA newptr; + RNA_pointer_create(_eval->id, _Scene, scene_eval, ); + return newptr; } static PointerRNA rna_Depsgraph_view_layer_eval_get(PointerRNA *ptr) { Depsgraph *depsgraph = (Depsgraph *)ptr->data; + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph); - return rna_pointer_inherit_refine(ptr, _ViewLayer, view_layer_eval); + PointerRNA newptr; + RNA_pointer_create(_eval->id, _ViewLayer, view_layer_eval, ); + return newptr; } #else ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1442827a4ff] blender-v2.90-release: Fix T78392: [2.83.5, 2.90, 2.91] Crash on undo/ redo after changing modes.
Commit: 1442827a4ffc84272fe047931812af7718b90f30 Author: Bastien Montagne Date: Mon Sep 14 14:55:48 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB1442827a4ffc84272fe047931812af7718b90f30 Fix T78392: [2.83.5, 2.90, 2.91] Crash on undo/ redo after changing modes. During undo/redo read code is expected to clear the `OB_MODE_EDIT` bitflag of `Object.mode`, for some reasons. This was not done anymore for re-used Objects, we need to add a special handling case for that too. Should be backported to 2.90 and 2.83 (will probably not be straight forward for the latter). === M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/writefile.c === diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 134e23d36e8..2f73abf430e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9153,6 +9153,9 @@ static void read_libblock_undo_restore_identical( if (ob->proxy != NULL) { ob->proxy->proxy_from = ob; } +/* For undo we stay in object mode during undo presses, so keep editmode disabled for re-used + * data-blocks too. */ +ob->mode &= ~OB_MODE_EDIT; } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 6f9f3eec31d..ad4460c552c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1844,10 +1844,17 @@ static void write_shaderfxs(BlendWriter *writer, ListBase *fxbase) static void write_object(BlendWriter *writer, Object *ob, const void *id_address) { - if (ob->id.us > 0 || BLO_write_is_undo(writer)) { + const bool is_undo = BLO_write_is_undo(writer); + if (ob->id.us > 0 || is_undo) { /* Clean up, important in undo case to reduce false detection of changed datablocks. */ BKE_object_runtime_reset(ob); +if (is_undo) { + /* For undo we stay in object mode during undo presses, so keep editmode disabled on save as + * well, can help reducing false detection of changed datablocks. */ + ob->mode &= ~OB_MODE_EDIT; +} + /* write LibData */ BLO_write_id_struct(writer, Object, id_address, >id); write_iddata(writer, >id); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2c8f8765a1d] blender-v2.90-release: Fix T80589: Translations in python scripts are missing.
Commit: 2c8f8765a1d815b15e0d9370a871b267d0ebe934 Author: Bastien Montagne Date: Sun Sep 13 19:50:08 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB2c8f8765a1d815b15e0d9370a871b267d0ebe934 Fix T80589: Translations in python scripts are missing. Python 3.8 changed handling of constant values in its AST tool. This code should work on both officialy supported 3.7, and newer 3.8, for now. === M release/scripts/modules/bl_i18n_utils/bl_extract_messages.py === diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index cee8f89abd3..b4abf572dbc 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -456,9 +456,11 @@ def dump_py_messages_from_files(msgs, reports, files, settings): Recursively get strings, needed in case we have "Blah" + "Blah", passed as an argument in that case it won't evaluate to a string. However, break on some kind of stopper nodes, like e.g. Subscript. """ -if type(node) == ast.Str: +# New in py 3.8: all constants are of type 'ast.Constant'. +# 'ast.Str' will have to be removed when we officially switch to this version. +if type(node) in {ast.Str, getattr(ast, "Constant", None)}: eval_str = ast.literal_eval(node) -if eval_str: +if eval_str and type(eval_str) == str: yield (is_split, eval_str, (node,)) else: is_split = (type(node) in separate_nodes) @@ -624,6 +626,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings): } for fp in files: +# ~ print("Checking File ", fp) with open(fp, 'r', encoding="utf8") as filedata: root_node = ast.parse(filedata.read(), fp, 'exec') @@ -631,8 +634,8 @@ def dump_py_messages_from_files(msgs, reports, files, settings): for node in ast.walk(root_node): if type(node) == ast.Call: -# print("found function at") -# print("%s:%d" % (fp, node.lineno)) +# ~ print("found function at") +# ~ print("%s:%d" % (fp, node.lineno)) # We can't skip such situations! from blah import foo\nfoo("bar") would also be an ast.Name func! if type(node.func) == ast.Name: @@ -657,31 +660,31 @@ def dump_py_messages_from_files(msgs, reports, files, settings): if kw.arg == arg_kw: context_elements[arg_kw] = kw.value break -# print(context_elements) +# ~ print(context_elements) for kws, proc in translate_kw[msgid]: if set(kws) <= context_elements.keys(): args = tuple(context_elements[k] for k in kws) -#print("running ", proc, " with ", args) +# ~ print("running ", proc, " with ", args) ctxt = proc(*args) if ctxt: msgctxts[msgid] = ctxt break -# print(translate_args) +# ~ print(func_args) # do nothing if not found for arg_kw, (arg_pos, _) in func_args.items(): msgctxt = msgctxts[arg_kw] estr_lst = [(None, ())] if arg_pos < len(node.args): estr_lst = extract_strings_split(node.args[arg_pos]) -#print(estr, nds) else: for kw in node.keywords: if kw.arg == arg_kw: +# ~ print(kw.arg, kw.value) estr_lst = extract_strings_split(kw.value) break -#print(estr, nds) for estr, nds in estr_lst: +# ~ print(estr, nds) if estr: if nds: msgsrc = "{}:{}".format(fp_rel, sorted({nd.lineno for nd in nds})[0]) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7347228d562] blender-v2.90-release: Fix T80630: potential crash in volume grids in Eevee shaders
Commit: 7347228d562ff06f8b14c912411ee00a60256330 Author: Brecht Van Lommel Date: Tue Sep 15 14:09:01 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB7347228d562ff06f8b14c912411ee00a60256330 Fix T80630: potential crash in volume grids in Eevee shaders Found by address sanitizer. === M source/blender/gpu/intern/gpu_node_graph.c === diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 096320dc43e..d29f669e189 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -459,6 +459,7 @@ GPUNodeLink *GPU_volume_grid(GPUMaterial *mat, GPUNodeLink *transform_link = gpu_node_link_create(); transform_link->link_type = GPU_NODE_LINK_VOLUME_GRID_TRANSFORM; transform_link->volume_grid = link->volume_grid; + transform_link->volume_grid->users++; /* Two special cases, where we adjust the output values of smoke grids to * bring the into standard range without having to modify the grid values. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [21e3b89634d] blender-v2.90-release: Fix T80516: Hook modifier crashes without vertex group data
Commit: 21e3b89634d3d517518dc340b8b26775aff500d2 Author: Campbell Barton Date: Thu Sep 10 17:58:05 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB21e3b89634d3d517518dc340b8b26775aff500d2 Fix T80516: Hook modifier crashes without vertex group data Checks for existence of a vertex group must check the array isn't NULL. Regression in c1386795a922. === M source/blender/modifiers/intern/MOD_hook.c === diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 083348dfb26..a55be041c91 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -313,10 +313,19 @@ static void deformVerts_do(HookModifierData *hmd, MOD_get_vgroup(ob, mesh, hmd->name, , _index); int cd_dvert_offset = -1; - if ((em != NULL) && (hd.defgrp_index != -1)) { -cd_dvert_offset = CustomData_get_offset(>bm->vdata, CD_MDEFORMVERT); -if (cd_dvert_offset == -1) { - hd.defgrp_index = -1; + if (hd.defgrp_index != -1) { +/* Edit-mesh. */ +if (em != NULL) { + cd_dvert_offset = CustomData_get_offset(>bm->vdata, CD_MDEFORMVERT); + if (cd_dvert_offset == -1) { +hd.defgrp_index = -1; + } +} +else { + /* Regular mesh. */ + if (dvert == NULL) { +hd.defgrp_index = -1; + } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8b953fa83d6] blender-v2.90-release: Refactor getting constraints
Commit: 8b953fa83d64ef0fa140c82e79d1a3101d7496b0 Author: Philipp Oeser Date: Wed Sep 9 13:52:37 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB8b953fa83d64ef0fa140c82e79d1a3101d7496b0 Refactor getting constraints This is the refactoring part of D8805 (should be no functional changes). - exposes pose-related part of former 'get_constraints()' from interface_templates.c to new ED_object_pose_constraint_list - rename ED_object_constraint_list_from_context --> ED_object_constraint_active_list Also clarify comments on both of these. ref T80464 ref https://developer.blender.org/D8805 === M source/blender/editors/include/ED_object.h M source/blender/editors/interface/interface_templates.c M source/blender/editors/object/object_constraint.c M source/blender/io/collada/BCAnimationSampler.cpp === diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 4c7dd4fe66c..99ecf0b69de 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -310,7 +310,8 @@ void ED_objects_recalculate_paths(struct bContext *C, eObjectPathCalcRange range); /* constraints */ -struct ListBase *ED_object_constraint_list_from_context(struct Object *ob); +struct ListBase *ED_object_constraint_active_list(struct Object *ob); +struct ListBase *ED_object_pose_constraint_list(const struct bContext *C); struct ListBase *ED_object_constraint_list_from_constraint(struct Object *ob, struct bConstraint *con, struct bPoseChannel **r_pchan); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 50148d8a8cd..a7fe3074e1f 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1950,18 +1950,13 @@ static bool constraint_panel_is_bone(Panel *panel) */ static ListBase *get_constraints(const bContext *C, bool use_bone_constraints) { - ListBase *constraints = {NULL}; + ListBase *constraints = NULL; if (use_bone_constraints) { -bPoseChannel *pose_bone = CTX_data_pointer_get(C, "pose_bone").data; -if (pose_bone != NULL) { - constraints = _bone->constraints; -} +constraints = ED_object_pose_constraint_list(C); } else { Object *ob = ED_object_active_context(C); -if (ob != NULL) { - constraints = >constraints; -} +constraints = ED_object_constraint_active_list(ob); } return constraints; } @@ -2043,7 +2038,13 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_ ARegion *region = CTX_wm_region(C); Object *ob = ED_object_active_context(C); - ListBase *constraints = get_constraints(C, use_bone_constraints); + ListBase *constraints = {NULL}; + if (use_bone_constraints) { +constraints = ED_object_pose_constraint_list(C); + } + else { +constraints = ED_object_constraint_active_list(ob); + } /* Switch between the bone panel ID function and the object panel ID function. */ uiListPanelIDFromDataFunc panel_id_func = use_bone_constraints ? bone_constraint_panel_id : diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 70404af6433..b6ff599da9a 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -80,8 +80,9 @@ /** \name Constraint Data Accessors * \{ */ -/* if object in posemode, active bone constraints, else object constraints */ -ListBase *ED_object_constraint_list_from_context(Object *ob) +/* If object is in posemode, return active bone constraints, else object constraints. No + * constraints are returned for a bone on an inactive bonelayer. */ +ListBase *ED_object_constraint_active_list(Object *ob) { if (ob == NULL) { return NULL; @@ -102,6 +103,18 @@ ListBase *ED_object_constraint_list_from_context(Object *ob) return NULL; } +/* Get the constraints for the active pose bone. Bone may be on an inactive bonelayer (unlike + * ED_object_constraint_active_list, such constraints are not excluded here). */ +ListBase *ED_object_pose_constraint_list(const bContext *C) +{ + bPoseChannel *pose_bone = CTX_data_pointer_get(C, "pose_bone").data; + if (pose_bone == NULL) { +return NULL; + } + + return _bone->constraints; +} + /* Find the list that a given constraint belongs to, * and/or also get the posechannel this is from (if applicable) */ ListBase *ED_object_constraint_list_from_constraint(Object *ob, @@ -147,7 +160,7 @@ ListBase *ED_object_constraint_list_from_constraint(Object *ob, /*
[Bf-blender-cvs] [5f66510a212] blender-v2.90-release: Fix T71012: Cycles baking crash with locked-UI & background-mode
Commit: 5f66510a212d70a516f31ce3d9dec3ca495a04e7 Author: Campbell Barton Date: Thu Sep 10 16:09:58 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB5f66510a212d70a516f31ce3d9dec3ca495a04e7 Fix T71012: Cycles baking crash with locked-UI & background-mode === M intern/cycles/blender/blender_sync.cpp === diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 511061db08a..44bf6f59899 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -717,7 +717,11 @@ void BlenderSync::free_data_after_sync(BL::Depsgraph _depsgraph) * footprint during synchronization process. */ const bool is_interface_locked = b_engine.render() && b_engine.render().use_lock_interface(); - const bool can_free_caches = BlenderSession::headless || is_interface_locked; + const bool can_free_caches = (BlenderSession::headless || is_interface_locked) && + /* Baking re-uses the depsgraph multiple times, clearing crashes +* reading un-evaluated mesh data which isn't aligned with the +* geometry we're baking, see T71012. */ + !scene->bake_manager->get_baking(); if (!can_free_caches) { return; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9f473e22751] blender-v2.90-release: Fix for failing constraints test
Commit: 9f473e2275197539e43753b8f5966644857481a6 Author: Philipp Oeser Date: Wed Sep 9 22:05:58 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB9f473e2275197539e43753b8f5966644857481a6 Fix for failing constraints test Caused by own rB6dc7266cf1f4. When overriding context for constraint operators (such as in constraint tests), it could happen that context "active_pose_bone" is set, but "pose_bone" isnt. Now check for both in ED_object_pose_constraint_list. === M source/blender/editors/object/object_constraint.c === diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index b6ff599da9a..cdb7a9f2b83 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -107,9 +107,12 @@ ListBase *ED_object_constraint_active_list(Object *ob) * ED_object_constraint_active_list, such constraints are not excluded here). */ ListBase *ED_object_pose_constraint_list(const bContext *C) { - bPoseChannel *pose_bone = CTX_data_pointer_get(C, "pose_bone").data; + bPoseChannel *pose_bone = CTX_data_pointer_get(C, "active_pose_bone").data; if (pose_bone == NULL) { -return NULL; +pose_bone = CTX_data_pointer_get(C, "pose_bone").data; +if (pose_bone == NULL) { + return NULL; +} } return _bone->constraints; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0ed4fa65418] blender-v2.90-release: PY API doc: fix doc for new override option of properties.
Commit: 0ed4fa6541891416a9ff57c796f8fdb758151eea Author: Bastien Montagne Date: Wed Sep 2 14:59:58 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB0ed4fa6541891416a9ff57c796f8fdb758151eea PY API doc: fix doc for new override option of properties. Reported by Demeter Dzadik (@Mets) on blender.chat, thanks. Candidate to be backported to a potential 2.90.1. === M source/blender/python/intern/bpy_props.c === diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 830acd987d9..1da845507f5 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -93,13 +93,13 @@ static const EnumPropertyItem property_flag_override_items[] = { "LIBRARY_OVERRIDABLE", 0, "Library Overridable", - "Allow that property to be overridable from library linked data-blocks"}, + "Make that property editable in library overrides of linked data-blocks"}, {0, NULL, 0, NULL, NULL}, }; #define BPY_PROPDEF_OPTIONS_OVERRIDE_DOC \ - " :arg options: Enumerator in ['LIBRARY_OVERRIDE'].\n" \ - " :type options: set\n" + " :arg override: Enumerator in ['LIBRARY_OVERRIDABLE'].\n" \ + " :type override: set\n" static const EnumPropertyItem property_flag_override_collection_items[] = { {PROPOVERRIDE_OVERRIDABLE_LIBRARY, @@ -116,8 +116,8 @@ static const EnumPropertyItem property_flag_override_collection_items[] = { }; #define BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC \ - " :arg options: Enumerator in ['LIBRARY_OVERRIDE', 'NO_PROPERTY_NAME'].\n" \ - " :type options: set\n" + " :arg override: Enumerator in ['LIBRARY_OVERRIDABLE', 'NO_PROPERTY_NAME'].\n" \ + " :type override: set\n" /* subtypes */ /* XXX Keep in sync with rna_rna.c's rna_enum_property_subtype_items ??? ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d52d56e83dc] blender-v2.90-release: Fix T80604: BLI_polyfill_calc exceeds stack size allocating points
Commit: d52d56e83dc72f8e140a631f0d9eeb8170cf31e5 Author: Campbell Barton Date: Wed Sep 9 12:48:29 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rBd52d56e83dc72f8e140a631f0d9eeb8170cf31e5 Fix T80604: BLI_polyfill_calc exceeds stack size allocating points On systems with 512kb stack this happened at around 13k points. This happened at times with grease-pencil, although callers that frequently use complex polygons should be using BLI_polyfill_calc_arena. === M source/blender/blenlib/intern/polyfill_2d.c === diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c index 90a4a4f4c2d..99bc7db64eb 100644 --- a/source/blender/blenlib/intern/polyfill_2d.c +++ b/source/blender/blenlib/intern/polyfill_2d.c @@ -909,6 +909,19 @@ void BLI_polyfill_calc(const float (*coords)[2], const int coords_sign, uint (*r_tris)[3]) { + /* Fallback to heap memory for large allocations. + * Avoid running out of stack memory on systems with 512kb stack (macOS). + * This happens at around 13,000 points, use a much lower value to be safe. */ + if (UNLIKELY(coords_tot > 8192)) { +/* The buffer size only accounts for the index allocation, + * worst case we do two allocations when concave, while we should try to be efficient, + * any caller that relies on this frequently should use #BLI_polyfill_calc_arena directly. */ +MemArena *arena = BLI_memarena_new(sizeof(PolyIndex) * coords_tot, __func__); +BLI_polyfill_calc_arena(coords, coords_tot, coords_sign, r_tris, arena); +BLI_memarena_free(arena); +return; + } + PolyFill pf; PolyIndex *indices = BLI_array_alloca(indices, coords_tot); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [961bcf9e503] blender-v2.90-release: Fix T80561: Crash when multi-mesh editing UVs with proportional editing
Commit: 961bcf9e50352558f1af2451ccd09fea4f7c7258 Author: Julian Eisel Date: Mon Sep 7 16:14:58 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB961bcf9e50352558f1af2451ccd09fea4f7c7258 Fix T80561: Crash when multi-mesh editing UVs with proportional editing Because of a `goto` we would free a variable before it was declared. Declare it before the `goto` and `NULL`-check the value before freeing. === M source/blender/editors/transform/transform_convert_mesh_uv.c === diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 632769c167e..92447c257da 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -322,6 +322,8 @@ void createTransUVs(bContext *C, TransInfo *t) } } +float *prop_dists = NULL; + /* Support other objects using PET to adjust these, unless connected is enabled. */ if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) { goto finally; @@ -349,8 +351,6 @@ void createTransUVs(bContext *C, TransInfo *t) td = tc->data; td2d = tc->data_2d; -float *prop_dists = NULL; - if (is_prop_connected) { prop_dists = MEM_callocN(em->bm->totloop * sizeof(float), "TransObPropDists(UV Editing)"); @@ -397,7 +397,7 @@ void createTransUVs(bContext *C, TransInfo *t) finally: if (is_prop_connected) { - MEM_freeN(prop_dists); + MEM_SAFE_FREE(prop_dists); } if (is_island_center) { BM_uv_element_map_free(elementmap); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cb1875c6f5d] blender-v2.90-release: Decimate Modifier: Restore vertex group factor property in UI
Commit: cb1875c6f5dde5c60aa2e4ef907acbb6597f847c Author: Hans Goudey Date: Mon Sep 7 15:34:32 2020 -0500 Branches: blender-v2.90-release https://developer.blender.org/rBcb1875c6f5dde5c60aa2e4ef907acbb6597f847c Decimate Modifier: Restore vertex group factor property in UI This property was inadvertently removed from the modifier's panel and it wasn't caught in time for the release of 2.90. Thanks to the user "VermossomreV" for bringing this to my attention. Differential Revision: https://developer.blender.org/D8790 === M source/blender/modifiers/intern/MOD_decimate.c === diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 75fd558ae39..35d4f5babe4 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -258,6 +258,10 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(layout, , "use_collapse_triangulate", 0, NULL, ICON_NONE); modifier_vgroup_ui(layout, , _ptr, "vertex_group", "invert_vertex_group", NULL); +sub = uiLayoutRow(layout, true); +bool has_vertex_group = RNA_string_length(, "vertex_group") != 0; +uiLayoutSetActive(sub, has_vertex_group); +uiItemR(sub, , "vertex_group_factor", 0, NULL, ICON_NONE); } else if (decimate_type == MOD_DECIM_MODE_UNSUBDIV) { uiItemR(layout, , "iterations", 0, NULL, ICON_NONE); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0e9a3882be1] blender-v2.90-release: Fix T80233: Extrude manifold can generate invalid geometry
Commit: 0e9a3882be1954691c7934365ac7d404ab6a062d Author: Germano Cavalcante Date: Tue Sep 1 15:25:19 2020 -0300 Branches: blender-v2.90-release https://developer.blender.org/rB0e9a3882be1954691c7934365ac7d404ab6a062d Fix T80233: Extrude manifold can generate invalid geometry Faces with only 2 sides were sometimes generated. === M source/blender/bmesh/operators/bmo_extrude.c === diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index eee31969971..757f9b390d3 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -614,7 +614,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BMEdge *e_other = BM_DISK_EDGE_NEXT(e, v); if ((e_other == e) || (BM_DISK_EDGE_NEXT(e_other, v) == e)) { /* Lose edge or BMVert is edge pair. */ -BM_edge_collapse(bm, BMO_elem_flag_test(bm, e, EXT_TAG) ? e : e_other, v, true, false); +BM_edge_collapse(bm, BMO_elem_flag_test(bm, e, EXT_TAG) ? e : e_other, v, true, true); } else { BLI_assert(!BM_vert_is_edge_pair(v)); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [56076e04920] blender-v2.90-release: Fix T80224: Crash after duplicating and hiding vertices while using X Axis Mirror
Commit: 56076e04920c8d570bf7e234c6987f4f440ee58b Author: Germano Cavalcante Date: Tue Sep 1 12:13:25 2020 -0300 Branches: blender-v2.90-release https://developer.blender.org/rB56076e04920c8d570bf7e234c6987f4f440ee58b Fix T80224: Crash after duplicating and hiding vertices while using X Axis Mirror The mirror map can reference a hidden vertex that is currently ignored in the transformation. Thus the mirror element array is not filled. === M source/blender/editors/include/ED_mesh.h M source/blender/editors/mesh/editmesh_select.c M source/blender/editors/mesh/editmesh_tools.c M source/blender/editors/mesh/editmesh_utils.c M source/blender/editors/object/object_vgroup.c M source/blender/editors/transform/transform_convert_mesh.c === diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index f2cad1acc84..660e4de09d3 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -59,6 +59,7 @@ void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis, const bool use_self, const bool use_select, + const bool respecthide, const bool use_topology, float maxdist, int *r_index); @@ -66,6 +67,7 @@ void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const int axis, const bool use_self, const bool use_select, + const bool respecthide, const bool use_toplogy); void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to); struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 1ea25353598..60a09b7eabe 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -110,7 +110,7 @@ void EDBM_select_mirrored(BMEditMesh *em, } } - EDBM_verts_mirror_cache_begin(em, axis, true, true, use_topology); + EDBM_verts_mirror_cache_begin(em, axis, true, true, false, use_topology); if (!extend) { EDBM_flag_disable_all(em, BM_ELEM_SELECT); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 4de7143682a..279becc1ae9 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2513,7 +2513,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) /* mirror before smooth */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_verts_mirror_cache_begin(em, 0, false, true, use_topology); + EDBM_verts_mirror_cache_begin(em, 0, false, true, false, use_topology); } /* if there is a mirror modifier with clipping, flag the verts that @@ -2658,7 +2658,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) /* Mirror before smooth. */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_verts_mirror_cache_begin(em, 0, false, true, use_topology); + EDBM_verts_mirror_cache_begin(em, 0, false, true, false, use_topology); } bool failed_repeat_loop = false; @@ -7600,7 +7600,7 @@ static int mesh_symmetry_snap_exec(bContext *C, wmOperator *op) BMVert *v; int i; -EDBM_verts_mirror_cache_begin_ex(em, axis, true, true, use_topology, thresh, index); +EDBM_verts_mirror_cache_begin_ex(em, axis, true, true, false, use_topology, thresh, index); BM_mesh_elem_table_ensure(bm, BM_VERT); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 46c63d2e057..e0e369882d2 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1059,6 +1059,7 @@ static BMVert *cache_mirr_intptr_as_bmvert(const intptr_t *index_lookup, int ind * \param em: Editmesh. * \param use_self: Allow a vertex to point to its self (middle verts). * \param use_select: Restrict to selected verts. + * \param respecthide: Skip hidden vertices. * \param use_topology: Use topology mirror. * \param maxdist: Distance for close point test. * \param r_index: Optional array to write into, as an alternative to a customdata layer @@ -1068,6 +1069,7 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis,
[Bf-blender-cvs] [90312da85ae] blender-v2.90-release: Fix T80332: principle volume shader not working for world in Eevee
Commit: 90312da85ae64f86742c3c041428d6536b7202b9 Author: Brecht Van Lommel Date: Thu Sep 3 15:26:52 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB90312da85ae64f86742c3c041428d6536b7202b9 Fix T80332: principle volume shader not working for world in Eevee The handling of missing volume grids for the principled volume shader was incomplete, different inputs need different default values. === M source/blender/draw/engines/eevee/eevee_volumes.c M source/blender/gpu/GPU_material.h M source/blender/gpu/intern/gpu_node_graph.c M source/blender/nodes/shader/nodes/node_shader_attribute.c M source/blender/nodes/shader/nodes/node_shader_volume_info.c M source/blender/nodes/shader/nodes/node_shader_volume_principled.c === diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index a443ec61ceb..9fe83a341c5 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -63,10 +63,9 @@ static struct { GPUTexture *depth_src; - GPUTexture *dummy_density; - GPUTexture *dummy_color; + GPUTexture *dummy_zero; + GPUTexture *dummy_one; GPUTexture *dummy_flame; - GPUTexture *dummy_missing; GPUTexture *dummy_scatter; GPUTexture *dummy_transmit; @@ -150,14 +149,24 @@ static void eevee_create_shader_volumes(void) e_data.volumetric_accum_sh = DRW_shader_create_fullscreen(datatoc_volumetric_accum_frag_glsl, NULL); - const float density[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - e_data.dummy_density = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, density); + const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + e_data.dummy_zero = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, zero); + + const float one[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + e_data.dummy_one = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, one); const float flame = 0.0f; e_data.dummy_flame = DRW_texture_create_3d(1, 1, 1, GPU_R8, DRW_TEX_WRAP, ); +} - const float missing[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - e_data.dummy_missing = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, missing); +static GPUTexture *eevee_volume_default_texture(eGPUVolumeDefaultValue default_value) +{ + switch (default_value) { +case GPU_VOLUME_DEFAULT_0: + return e_data.dummy_zero; +case GPU_VOLUME_DEFAULT_1: + return e_data.dummy_one; + } } void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample) @@ -378,7 +387,8 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) /* Fix principle volumetric not working with world materials. */ ListBase gpu_grids = GPU_material_volume_grids(mat); LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, _grids) { -DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_missing); +DRW_shgroup_uniform_texture( +grp, gpu_grid->sampler_name, eevee_volume_default_texture(gpu_grid->default_value)); } DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); @@ -466,7 +476,9 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS NULL; DRW_shgroup_uniform_texture( -grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_missing); +grp, +gpu_grid->sampler_name, +(drw_grid) ? drw_grid->texture : eevee_volume_default_texture(gpu_grid->default_value)); if (drw_grid && multiple_transforms) { /* Specify per-volume transform matrix that is applied after the @@ -519,21 +531,20 @@ static bool eevee_volume_object_mesh_init(Scene *scene, LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, gpu_grids) { if (STREQ(gpu_grid->name, "density")) { -DRW_shgroup_uniform_texture_ref(grp, -gpu_grid->sampler_name, -fds->tex_density ? >tex_density : - _data.dummy_density); +DRW_shgroup_uniform_texture_ref( +grp, gpu_grid->sampler_name, fds->tex_density ? >tex_density : _data.dummy_one); } else if (STREQ(gpu_grid->name, "color")) { DRW_shgroup_uniform_texture_ref( -grp, gpu_grid->sampler_name, fds->tex_color ? >tex_color : _data.dummy_density); +grp, gpu_grid->sampler_name, fds->tex_color ? >tex_color : _data.dummy_one); } else if (STREQ(gpu_grid->name, "flame") || STREQ(gpu_grid->name, "temperature")) { DRW_shgroup_uniform_texture_ref( grp, gpu_grid->sampler_name,
[Bf-blender-cvs] [293acae9220] blender-v2.90-release: Fix T80426: Crash when deleting custom orientation
Commit: 293acae9220fecd24ed90fd01aa1544130bf3c6a Author: Germano Cavalcante Date: Fri Sep 4 15:01:04 2020 -0300 Branches: blender-v2.90-release https://developer.blender.org/rB293acae9220fecd24ed90fd01aa1544130bf3c6a Fix T80426: Crash when deleting custom orientation Indices referencing other orientations were not being updated, === M source/blender/blenkernel/intern/scene.c === diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 141737b46ee..2ce671f6dec 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -2402,6 +2402,10 @@ void BKE_scene_transform_orientation_remove(Scene *scene, TransformOrientation * orient_slot->type = V3D_ORIENT_GLOBAL; orient_slot->index_custom = -1; } +else if (orient_slot->index_custom > orientation_index) { + BLI_assert(orient_slot->type == V3D_ORIENT_CUSTOM); + orient_slot->index_custom--; +} } BLI_freelinkN(>transform_spaces, orientation); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0f21e3b6888] blender-v2.90-release: Version: Blender 2.90.1 Beta
Commit: 0f21e3b68883bc7f10ffd6cab2ac5df235b56ac5 Author: Jeroen Bakker Date: Mon Sep 21 08:28:53 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB0f21e3b68883bc7f10ffd6cab2ac5df235b56ac5 Version: Blender 2.90.1 Beta === M source/blender/blenkernel/BKE_blender_version.h === diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 8ddb4e8a146..1ab62b1df15 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -33,9 +33,9 @@ extern "C" { /* Blender major and minor version. */ #define BLENDER_VERSION 290 /* Blender patch version for bugfix releases. */ -#define BLENDER_VERSION_PATCH 0 +#define BLENDER_VERSION_PATCH 1 /** Blender release cycle stage: alpha/beta/rc/release. */ -#define BLENDER_VERSION_CYCLE release +#define BLENDER_VERSION_CYCLE beta /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6de33ee656e] blender-v2.90-release: Fix T80238: Crash adding properties to material node-trees
Commit: 6de33ee656e69bddcab1d3dfc85fd3ccbf033abb Author: Campbell Barton Date: Tue Sep 8 18:04:03 2020 +1000 Branches: blender-v2.90-release https://developer.blender.org/rB6de33ee656e69bddcab1d3dfc85fd3ccbf033abb Fix T80238: Crash adding properties to material node-trees The localized node-tree was freeing the materials ID properties twice. This matches how animation data behaves, setting to NULL after freeing. === M source/blender/blenkernel/intern/lib_id_delete.c === diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c index 561db7d62c2..22ea5f2c854 100644 --- a/source/blender/blenkernel/intern/lib_id_delete.c +++ b/source/blender/blenkernel/intern/lib_id_delete.c @@ -56,10 +56,12 @@ void BKE_libblock_free_data(ID *id, const bool do_id_user) if (id->properties) { IDP_FreePropertyContent_ex(id->properties, do_id_user); MEM_freeN(id->properties); +id->properties = NULL; } if (id->override_library) { BKE_lib_override_library_free(>override_library, do_id_user); +id->override_library = NULL; } BKE_animdata_free(id, do_id_user); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0da0b5984a5] blender-v2.90-release: Fix T80289: GPencil Opacity modifier not working
Commit: 0da0b5984a57c8737adf233dce17812ce0d70843 Author: Antonio Vazquez Date: Thu Sep 3 20:17:01 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rB0da0b5984a57c8737adf233dce17812ce0d70843 Fix T80289: GPencil Opacity modifier not working This error was introduced in the refactor of the modifier panels. === M source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c index 34142709c18..7a22d5ca703 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c @@ -227,8 +227,8 @@ static void panel_draw(const bContext *C, Panel *panel) else { uiItemR(layout, , "normalize_opacity", 0, NULL, ICON_NONE); const char *text = (RNA_boolean_get(, "normalize_opacity")) ? IFACE_("Strength") : - IFACE_("Opacity Factor"); -uiItemR(layout, , "hardness", 0, text, ICON_NONE); + IFACE_("Opacity Factor"); +uiItemR(layout, , "factor", 0, text, ICON_NONE); } gpencil_modifier_panel_end(layout, ); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ea2d025a984] blender-v2.90-release: Fix T79718: Eevee OpenVDB render error when frames miss part of the grids
Commit: ea2d025a98481e372412940f49a489fa015e1851 Author: Brecht Van Lommel Date: Thu Sep 3 16:08:27 2020 +0200 Branches: blender-v2.90-release https://developer.blender.org/rBea2d025a98481e372412940f49a489fa015e1851 Fix T79718: Eevee OpenVDB render error when frames miss part of the grids Improved fix that handles the distinct cases of missing grids and zero size grids. === M source/blender/draw/engines/eevee/eevee_volumes.c === diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 9fe83a341c5..03dc36b2058 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -167,6 +167,8 @@ static GPUTexture *eevee_volume_default_texture(eGPUVolumeDefaultValue default_v case GPU_VOLUME_DEFAULT_1: return e_data.dummy_one; } + + return e_data.dummy_zero; } void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample) @@ -475,10 +477,16 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS DRW_volume_batch_cache_get_grid(volume, volume_grid) : NULL; -DRW_shgroup_uniform_texture( -grp, -gpu_grid->sampler_name, -(drw_grid) ? drw_grid->texture : eevee_volume_default_texture(gpu_grid->default_value)); +/* Handle 3 cases here: + * - Grid exists and texture was loaded -> use texture. + * - Grid exists but has zero size or failed to load -> use zero. + * - Grid does not exist -> use default value. */ +GPUTexture *grid_tex = (drw_grid) ? drw_grid->texture : +(volume_grid) ? +e_data.dummy_zero : + eevee_volume_default_texture(gpu_grid->default_value); + +DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, grid_tex); if (drw_grid && multiple_transforms) { /* Specify per-volume transform matrix that is applied after the ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs