From de203b26c2f70e622f0b223134f3946967b57f97 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jul 2019 09:22:19 +1000 Subject: Cleanup: quiet warning --- source/blender/windowmanager/intern/wm_operators.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 54eef4540c1..29e6c670c00 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1559,6 +1559,8 @@ static void wm_block_splash_add_labels(uiBlock *block, int x, int y) wm_block_splash_add_label(block, branch_buf, x, &y); } } +#else + UNUSED_VARS(show_build_info); #endif /* WITH_BUILDINFO */ } -- cgit v1.2.3 From d3a8d25fb3d8750b09d6b75b8b55f92e05c1297e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jul 2019 09:14:31 +1000 Subject: Cleanup: clang-format --- source/blender/blenkernel/intern/armature.c | 3 ++- source/blender/makesrna/intern/rna_mesh.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 6d855df8af7..65de951b190 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1372,7 +1372,8 @@ static void armature_vert_task(void *__restrict userdata, BLI_assert(i < data->mesh->totvert); if (data->mesh->dvert != NULL) { dvert = data->mesh->dvert + i; - } else { + } + else { dvert = NULL; } } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index f8b35d08ef0..03173bcb3da 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -3095,8 +3095,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_VERT_SEL); - RNA_def_property_ui_text( - prop, "Vertex Selection", "Vertex selection masking for painting"); + RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting"); RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask"); -- cgit v1.2.3 From e60d35153f1bb14bcc6b91ddcf9e1caf24069886 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jul 2019 09:11:49 +1000 Subject: Cleanup: avoid recursion for undo/redo step skipping Simplifies making further changes. --- source/blender/blenkernel/intern/undo_system.c | 55 +++++++++++++++++++------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 76b37b940ec..7197a1734c3 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -683,17 +683,30 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack, } } - undosys_step_decode(C, G_MAIN, ustack, us, -1); - - ustack->step_active = us_prev; - undosys_stack_validate(ustack, true); + UndoStep *us_active = us_prev; if (use_skip) { - if (ustack->step_active && ustack->step_active->skip) { - CLOG_INFO( - &LOG, 2, "undo continue with skip %p '%s', type='%s'", us, us->name, us->type->name); - BKE_undosys_step_undo_with_data(ustack, C, ustack->step_active); + while (us_active->skip && us_active->prev) { + us_active = us_active->prev; } } + + { + UndoStep *us_iter = us_prev; + do { + const bool is_final = (us_iter == us_active); + if (is_final == false) { + CLOG_INFO(&LOG, + 2, + "undo continue with skip %p '%s', type='%s'", + us_iter, + us_iter->name, + us_iter->type->name); + } + undosys_step_decode(C, G_MAIN, ustack, us_iter, -1); + ustack->step_active = us_iter; + } while ((us_active != us_iter) && (us_iter = us_iter->prev)); + } + return true; } return false; @@ -737,15 +750,29 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack, } } - undosys_step_decode(C, G_MAIN, ustack, us, 1); - ustack->step_active = us_next; + UndoStep *us_active = us_next; if (use_skip) { - if (ustack->step_active && ustack->step_active->skip) { - CLOG_INFO( - &LOG, 2, "redo continue with skip %p '%s', type='%s'", us, us->name, us->type->name); - BKE_undosys_step_redo_with_data(ustack, C, ustack->step_active); + while (us_active->skip && us_active->prev) { + us_active = us_active->next; } } + + { + UndoStep *us_iter = us_next; + do { + const bool is_final = (us_iter == us_active); + if (is_final == false) { + CLOG_INFO(&LOG, + 2, + "redo continue with skip %p '%s', type='%s'", + us_iter, + us_iter->name, + us_iter->type->name); + } + undosys_step_decode(C, G_MAIN, ustack, us_iter, 1); + ustack->step_active = us_iter; + } while ((us_active != us_iter) && (us_iter = us_iter->next)); + } return true; } return false; -- cgit v1.2.3 From 1544b9322c4f8728277a7a24b028bab95f22f7d6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jul 2019 09:36:59 +1000 Subject: Undo System: add is_final argument (no functional changes) This is needed step out of undo steps which accumulate changes, larger changes could be made to handle this but better not make them at this point. --- source/blender/blenkernel/BKE_undo_system.h | 3 ++- source/blender/blenkernel/intern/undo_system.c | 16 +++++++++------- source/blender/editors/armature/editarmature_undo.c | 3 ++- source/blender/editors/curve/editcurve_undo.c | 6 ++---- source/blender/editors/curve/editfont_undo.c | 3 ++- source/blender/editors/lattice/editlattice_undo.c | 3 ++- source/blender/editors/mesh/editmesh_undo.c | 3 ++- source/blender/editors/metaball/editmball_undo.c | 3 ++- source/blender/editors/physics/particle_edit_undo.c | 3 ++- source/blender/editors/sculpt_paint/paint_curve_undo.c | 3 ++- source/blender/editors/sculpt_paint/paint_image_undo.c | 6 ++---- source/blender/editors/sculpt_paint/sculpt_undo.c | 6 ++---- source/blender/editors/space_text/text_undo.c | 6 ++---- source/blender/editors/undo/memfile_undo.c | 6 ++---- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index b5e153fca95..50c29c456d1 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -106,7 +106,8 @@ typedef struct UndoType { void (*step_encode_init)(struct bContext *C, UndoStep *us); bool (*step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us); - void (*step_decode)(struct bContext *C, struct Main *bmain, UndoStep *us, int dir); + void (*step_decode)( + struct bContext *C, struct Main *bmain, UndoStep *us, int dir, bool is_final); /** * \note When freeing all steps, diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 7197a1734c3..d312dc0190b 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -173,7 +173,8 @@ static bool undosys_step_encode(bContext *C, Main *bmain, UndoStack *ustack, Und return ok; } -static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir) +static void undosys_step_decode( + bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir, bool is_final) { CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name); @@ -188,7 +189,7 @@ static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, Und else { /* Load the previous memfile state so any ID's referenced in this * undo step will be correctly resolved, see: T56163. */ - undosys_step_decode(C, bmain, ustack, us_iter, dir); + undosys_step_decode(C, bmain, ustack, us_iter, dir, false); /* May have been freed on memfile read. */ bmain = G.main; } @@ -203,7 +204,7 @@ static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, Und } UNDO_NESTED_CHECK_BEGIN; - us->type->step_decode(C, bmain, us, dir); + us->type->step_decode(C, bmain, us, dir, is_final); UNDO_NESTED_CHECK_END; #ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER @@ -678,7 +679,8 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack, * - skip successive steps that store the same data, eg: memfile steps. * - or steps that include another steps data, eg: a memfile step includes text undo data. */ - undosys_step_decode(C, G_MAIN, ustack, us_iter, -1); + undosys_step_decode(C, G_MAIN, ustack, us_iter, -1, false); + us_iter = us_iter->prev; } } @@ -702,7 +704,7 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack, us_iter->name, us_iter->type->name); } - undosys_step_decode(C, G_MAIN, ustack, us_iter, -1); + undosys_step_decode(C, G_MAIN, ustack, us_iter, -1, is_final); ustack->step_active = us_iter; } while ((us_active != us_iter) && (us_iter = us_iter->prev)); } @@ -745,7 +747,7 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack, if (ustack->step_active && ustack->step_active->next) { UndoStep *us_iter = ustack->step_active->next; while (us_iter != us) { - undosys_step_decode(C, G_MAIN, ustack, us_iter, 1); + undosys_step_decode(C, G_MAIN, ustack, us_iter, 1, false); us_iter = us_iter->next; } } @@ -769,7 +771,7 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack, us_iter->name, us_iter->type->name); } - undosys_step_decode(C, G_MAIN, ustack, us_iter, 1); + undosys_step_decode(C, G_MAIN, ustack, us_iter, 1, is_final); ustack->step_active = us_iter; } while ((us_active != us_iter) && (us_iter = us_iter->next)); } diff --git a/source/blender/editors/armature/editarmature_undo.c b/source/blender/editors/armature/editarmature_undo.c index 3a2440af2da..4a82a8fccee 100644 --- a/source/blender/editors/armature/editarmature_undo.c +++ b/source/blender/editors/armature/editarmature_undo.c @@ -174,7 +174,8 @@ static bool armature_undosys_step_encode(struct bContext *C, static void armature_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { ArmatureUndoStep *us = (ArmatureUndoStep *)us_p; diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c index d0c2afcb1d2..835abd1a630 100644 --- a/source/blender/editors/curve/editcurve_undo.c +++ b/source/blender/editors/curve/editcurve_undo.c @@ -238,10 +238,8 @@ static bool curve_undosys_step_encode(struct bContext *C, return true; } -static void curve_undosys_step_decode(struct bContext *C, - struct Main *bmain, - UndoStep *us_p, - int UNUSED(dir)) +static void curve_undosys_step_decode( + struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) { CurveUndoStep *us = (CurveUndoStep *)us_p; diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c index 82c19db7a4a..8f8c23a7772 100644 --- a/source/blender/editors/curve/editfont_undo.c +++ b/source/blender/editors/curve/editfont_undo.c @@ -356,7 +356,8 @@ static bool font_undosys_step_encode(struct bContext *C, static void font_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { /* TODO(campbell): undo_system: use low-level API to set mode. */ ED_object_mode_set(C, OB_MODE_EDIT); diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c index 166201adc15..5164970198e 100644 --- a/source/blender/editors/lattice/editlattice_undo.c +++ b/source/blender/editors/lattice/editlattice_undo.c @@ -176,7 +176,8 @@ static bool lattice_undosys_step_encode(struct bContext *C, static void lattice_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { LatticeUndoStep *us = (LatticeUndoStep *)us_p; diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c index 28b14b0060d..e823fb46140 100644 --- a/source/blender/editors/mesh/editmesh_undo.c +++ b/source/blender/editors/mesh/editmesh_undo.c @@ -741,7 +741,8 @@ static bool mesh_undosys_step_encode(struct bContext *C, static void mesh_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { MeshUndoStep *us = (MeshUndoStep *)us_p; diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c index d255fac26ad..9a95560ccdd 100644 --- a/source/blender/editors/metaball/editmball_undo.c +++ b/source/blender/editors/metaball/editmball_undo.c @@ -185,7 +185,8 @@ static bool mball_undosys_step_encode(struct bContext *C, static void mball_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { MBallUndoStep *us = (MBallUndoStep *)us_p; diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c index be625eb939f..40d90676487 100644 --- a/source/blender/editors/physics/particle_edit_undo.c +++ b/source/blender/editors/physics/particle_edit_undo.c @@ -252,7 +252,8 @@ static bool particle_undosys_step_encode(struct bContext *C, static void particle_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { /* TODO(campbell): undo_system: use low-level API to set mode. */ ED_object_mode_set(C, OB_MODE_PARTICLE_EDIT); diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c index c03cb69df88..7e283274383 100644 --- a/source/blender/editors/sculpt_paint/paint_curve_undo.c +++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c @@ -122,7 +122,8 @@ static bool paintcurve_undosys_step_encode(struct bContext *C, static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir)) + int UNUSED(dir), + bool UNUSED(is_final)) { PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; undocurve_to_paintcurve(&us->data, us->pc); diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c index bb73d424152..e7f100ebacb 100644 --- a/source/blender/editors/sculpt_paint/paint_image_undo.c +++ b/source/blender/editors/sculpt_paint/paint_image_undo.c @@ -540,10 +540,8 @@ static void image_undosys_step_decode_redo(ImageUndoStep *us) } } -static void image_undosys_step_decode(struct bContext *C, - struct Main *bmain, - UndoStep *us_p, - int dir) +static void image_undosys_step_decode( + struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final)) { ImageUndoStep *us = (ImageUndoStep *)us_p; #if 0 diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index a20fe375ec7..81bb9c35817 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1109,10 +1109,8 @@ static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep * } } -static void sculpt_undosys_step_decode(struct bContext *C, - struct Main *bmain, - UndoStep *us_p, - int dir) +static void sculpt_undosys_step_decode( + struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final)) { /* Ensure sculpt mode. */ { diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index 7710c5637a2..ae12473e600 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -175,10 +175,8 @@ static void text_undosys_step_decode_redo(TextUndoStep *us) } } -static void text_undosys_step_decode(struct bContext *C, - struct Main *UNUSED(bmain), - UndoStep *us_p, - int dir) +static void text_undosys_step_decode( + struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool UNUSED(is_final)) { TextUndoStep *us = (TextUndoStep *)us_p; diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index 0f495d64b29..f3e2ee92558 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -83,10 +83,8 @@ static bool memfile_undosys_step_encode(struct bContext *UNUSED(C), return true; } -static void memfile_undosys_step_decode(struct bContext *C, - struct Main *bmain, - UndoStep *us_p, - int UNUSED(dir)) +static void memfile_undosys_step_decode( + struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) { ED_editors_exit(bmain, false); -- cgit v1.2.3 From 676543d91f5c9f441cd0544d99aa34c933570347 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jul 2019 09:42:36 +1000 Subject: Fix T66658: Undo steps gets out sync with text/edit-mode --- source/blender/editors/space_text/text_undo.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index ae12473e600..66cbaa8bb5b 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -130,7 +130,7 @@ static void text_undosys_step_decode_redo_impl(Text *text, TextUndoStep *us) us->step.is_applied = true; } -static void text_undosys_step_decode_undo(TextUndoStep *us) +static void text_undosys_step_decode_undo(TextUndoStep *us, bool is_final) { TextUndoStep *us_iter = us; while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) { @@ -140,13 +140,16 @@ static void text_undosys_step_decode_undo(TextUndoStep *us) us_iter = (TextUndoStep *)us_iter->step.next; } Text *text_prev = NULL; - while (us_iter != us) { + while ((us_iter != us) || (is_final && us_iter == us)) { Text *text = us_iter->text_ref.ptr; text_undosys_step_decode_undo_impl(text, us_iter); if (text_prev != text) { text_update_edited(text); text_prev = text; } + if (is_final) { + break; + } us_iter = (TextUndoStep *)us_iter->step.prev; } } @@ -176,12 +179,12 @@ static void text_undosys_step_decode_redo(TextUndoStep *us) } static void text_undosys_step_decode( - struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool UNUSED(is_final)) + struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool is_final) { TextUndoStep *us = (TextUndoStep *)us_p; if (dir < 0) { - text_undosys_step_decode_undo(us); + text_undosys_step_decode_undo(us, is_final); } else { text_undosys_step_decode_redo(us); -- cgit v1.2.3 From a7ac40888f530c12f137b3f6249b6f1dcfae3ea3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jul 2019 14:18:39 +1000 Subject: Text: buffer from text, optional length return arg No functional changes (currently unused). --- source/blender/blenkernel/BKE_text.h | 4 ++-- source/blender/blenkernel/intern/text.c | 22 +++++++++++++++++++--- source/blender/editors/space_text/text_ops.c | 10 +++++----- source/blender/python/intern/bpy_interface.c | 2 +- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index d26b9a86635..c78faa9dd18 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -54,7 +54,7 @@ void BKE_text_write(struct Text *text, struct TextUndoBuf *utxt, const char *str int BKE_text_file_modified_check(struct Text *text); void BKE_text_file_modified_ignore(struct Text *text); -char *txt_to_buf(struct Text *text); +char *txt_to_buf(struct Text *text, int *r_buf_strlen); void txt_clean_text(struct Text *text); void txt_order_cursors(struct Text *text, const bool reverse); int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case); @@ -83,7 +83,7 @@ void txt_delete_selected(struct Text *text, struct TextUndoBuf *utxt); void txt_sel_all(struct Text *text); void txt_sel_clear(struct Text *text); void txt_sel_line(struct Text *text); -char *txt_sel_to_buf(struct Text *text); +char *txt_sel_to_buf(struct Text *text, int *r_buf_strlen); void txt_insert_buf(struct Text *text, struct TextUndoBuf *utxt, const char *in_buffer); void txt_undo_add_op(struct Text *text, struct TextUndoBuf *utxt, int op); void txt_do_undo(struct Text *text, struct TextUndoBuf *utxt); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 7d5862c1fb6..1d6de646255 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1289,7 +1289,7 @@ static void txt_delete_sel(Text *text, TextUndoBuf *utxt) txt_order_cursors(text, false); if (!undoing) { - buf = txt_sel_to_buf(text); + buf = txt_sel_to_buf(text, NULL); txt_undo_add_blockop(text, utxt, UNDO_DBLOCK, buf); MEM_freeN(buf); } @@ -1353,13 +1353,17 @@ void txt_sel_line(Text *text) /* Cut and paste functions */ /***************************/ -char *txt_to_buf(Text *text) +char *txt_to_buf(Text *text, int *r_buf_strlen) { int length; TextLine *tmp, *linef, *linel; int charf, charl; char *buf; + if (r_buf_strlen) { + *r_buf_strlen = 0; + } + if (!text->curl) { return NULL; } @@ -1419,6 +1423,10 @@ char *txt_to_buf(Text *text) buf[length] = 0; } + if (r_buf_strlen) { + *r_buf_strlen = length; + } + return buf; } @@ -1475,13 +1483,17 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) } } -char *txt_sel_to_buf(Text *text) +char *txt_sel_to_buf(Text *text, int *r_buf_strlen) { char *buf; int length = 0; TextLine *tmp, *linef, *linel; int charf, charl; + if (r_buf_strlen) { + *r_buf_strlen = 0; + } + if (!text->curl) { return NULL; } @@ -1556,6 +1568,10 @@ char *txt_sel_to_buf(Text *text) buf[length] = 0; } + if (r_buf_strlen) { + *r_buf_strlen = length; + } + return buf; } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 63d4f3e3119..33bacb0a95f 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -932,7 +932,7 @@ static void txt_copy_clipboard(Text *text) return; } - buf = txt_sel_to_buf(text); + buf = txt_sel_to_buf(text, NULL); if (buf) { WM_clipboard_text_set(buf, 0); @@ -2994,7 +2994,7 @@ static void text_cursor_set_exit(bContext *C, wmOperator *op) char *buffer; if (txt_has_sel(text)) { - buffer = txt_sel_to_buf(text); + buffer = txt_sel_to_buf(text, NULL); WM_clipboard_text_set(buffer, 1); MEM_freeN(buffer); } @@ -3308,7 +3308,7 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode) /* Replace current */ if (mode != TEXT_FIND && txt_has_sel(text)) { - tmp = txt_sel_to_buf(text); + tmp = txt_sel_to_buf(text, NULL); if (flags & ST_MATCH_CASE) { found = STREQ(st->findstr, tmp); @@ -3406,7 +3406,7 @@ static int text_find_set_selected_exec(bContext *C, wmOperator *op) Text *text = CTX_data_edit_text(C); char *tmp; - tmp = txt_sel_to_buf(text); + tmp = txt_sel_to_buf(text, NULL); BLI_strncpy(st->findstr, tmp, ST_MAX_FIND_STR); MEM_freeN(tmp); @@ -3437,7 +3437,7 @@ static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) Text *text = CTX_data_edit_text(C); char *tmp; - tmp = txt_sel_to_buf(text); + tmp = txt_sel_to_buf(text, NULL); BLI_strncpy(st->replacestr, tmp, ST_MAX_FIND_STR); MEM_freeN(tmp); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index b34a41b5af6..71bc01d6b98 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -457,7 +457,7 @@ static bool python_script_exec( fn_dummy_py = PyC_UnicodeFromByte(fn_dummy); - buf = txt_to_buf(text); + buf = txt_to_buf(text, NULL); text->compiled = Py_CompileStringObject(buf, fn_dummy_py, Py_file_input, NULL, -1); MEM_freeN(buf); -- cgit v1.2.3 From 3c4f6399d987fb3f832ba3c1ca0fea9426d6d7f5 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 11 Jul 2019 12:06:21 +0200 Subject: Fix T66628: "Auto Saved Modified Image" not working Reviewer: brecht --- source/blender/windowmanager/intern/wm_files.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 49b13da6b21..ef957fa03c5 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -2949,7 +2949,12 @@ static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_dat UI_popup_block_close(C, win, arg_block); if (save_images_when_file_is_closed) { - if (!ED_image_should_save_modified(C)) { + if (ED_image_should_save_modified(C)) { + ReportList *reports = CTX_wm_reports(C); + ED_image_save_all_modified(C, reports); + WM_report_banner_show(); + } + else { execute_callback = false; } } -- cgit v1.2.3 From 7c48b6c84cbbeb76b9fea5f9bee70e833afc7b8e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 11 Jul 2019 11:50:58 +0200 Subject: Fix for RC release step to also point at 'current' API doc link. RC's are supposed to be like "real" releases... --- release/scripts/startup/bl_operators/wm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index f2b885d0064..b68ef3da6da 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1022,7 +1022,7 @@ class WM_OT_doc_view(Operator): bl_label = "View Documentation" doc_id: doc_id - if bpy.app.version_cycle == "release": + if bpy.app.version_cycle in {"release", "rc"}: _prefix = ("https://docs.blender.org/api/current") else: _prefix = ("https://docs.blender.org/api/master") -- cgit v1.2.3 From 03d8bfb1447593f8460ce9d67ba17eabcb1aec3d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 11 Jul 2019 12:04:27 +0200 Subject: API Doc link: make releases/RC's point to their own version of the doc. Sounds kind of stupid to have 2.79 pointing to "current" which is now 2.80 API doc... Let's try to avoid that in future. --- release/scripts/startup/bl_operators/wm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index b68ef3da6da..5cc4b773b54 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1023,7 +1023,8 @@ class WM_OT_doc_view(Operator): doc_id: doc_id if bpy.app.version_cycle in {"release", "rc"}: - _prefix = ("https://docs.blender.org/api/current") + _prefix = ("https://docs.blender.org/api/%d.%d%s" % + (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)) else: _prefix = ("https://docs.blender.org/api/master") -- cgit v1.2.3 From d663048696b2d63a65d607e5e8dec3b2b320982c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 11 Jul 2019 12:59:19 +0200 Subject: Fix T66691: Ceash trying to render the 2.80 splash image Was caused by ray direction becoming NaN after some of the bounces. --- intern/cycles/kernel/bvh/bvh.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 7503bad37b0..be0f05285e8 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -174,7 +174,7 @@ ccl_device_inline bool scene_intersect_valid(const Ray *ray) * From production scenes so far it seems it's enough to test first element * only. */ - return isfinite(ray->P.x); + return isfinite_safe(ray->P.x) && isfinite_safe(ray->D.x); } /* Note: ray is passed by value to work around a possible CUDA compiler bug. */ -- cgit v1.2.3 From 8a1552545a6274d2ff201e0f98067199cbd47cc2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 11 Jul 2019 13:39:19 +0200 Subject: Fix T66672: auto and manual texture space affected by modifiers It should be based on the mesh bounds before modifier stack evaluation, but some modifiers were causing it to be recomputed. The flag to disable texture space recomputation was not preserved through modifier evaluation. Differential Revision: https://developer.blender.org/D5225 --- source/blender/blenkernel/intern/mesh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 04164de91ca..f5e93dcf9b7 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -665,6 +665,7 @@ static Mesh *mesh_new_nomain_from_template_ex(const Mesh *me_src, me_dst->cd_flag = me_src->cd_flag; me_dst->editflag = me_src->editflag; + me_dst->texflag = me_src->texflag; CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, CD_CALLOC, verts_len); CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, CD_CALLOC, edges_len); -- cgit v1.2.3 From f0b72a776ed888da798b41ce43995f7b5ac11ec0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 11 Jul 2019 14:13:22 +0200 Subject: Fix T66706: crash in viewport shading popover for workbench engine Differential Revision: https://developer.blender.org/D5226 --- source/blender/makesrna/intern/rna_space.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 1c76753fb1b..2ba5e2ae68c 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1067,11 +1067,7 @@ static const EnumPropertyItem *rna_View3DShading_color_type_itemf(bContext *UNUS int totitem = 0; - if (shading->type == OB_SOLID) { - r_free = false; - return rna_enum_shading_color_type_items; - } - else if (shading->type == OB_WIRE) { + if (shading->type == OB_WIRE) { EnumPropertyItem *item = NULL; RNA_enum_items_add_value( &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR); @@ -1084,8 +1080,9 @@ static const EnumPropertyItem *rna_View3DShading_color_type_itemf(bContext *UNUS return item; } else { - *r_free = false; - return NULL; + /* Solid mode, or lookdev mode for workbench engine. */ + r_free = false; + return rna_enum_shading_color_type_items; } } -- cgit v1.2.3 From 7ad21c3876c2453f11fd509a0157639d615567fc Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 11 Jul 2019 15:22:03 +0200 Subject: Fix T66604: Cycles bake crash on specific scene with volume The issue was caused by un-initialized local storage for volume intersection hits which are supposed to be stored in per-thread KernelGlobals. Fix is to make thread_shader() be the same as thread_render() in respect of KernelGlobals. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D5230 --- intern/cycles/device/device_cpu.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index dc9adcb1537..b2d923dfdf0 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -980,14 +980,11 @@ class CPUDevice : public Device { void thread_shader(DeviceTask &task) { - KernelGlobals kg = kernel_globals; + KernelGlobals *kg = new KernelGlobals(thread_kernel_globals_init()); -#ifdef WITH_OSL - OSLShader::thread_init(&kg, &kernel_globals, &osl_globals); -#endif for (int sample = 0; sample < task.num_samples; sample++) { for (int x = task.shader_x; x < task.shader_x + task.shader_w; x++) - shader_kernel()(&kg, + shader_kernel()(kg, (uint4 *)task.shader_input, (float4 *)task.shader_output, task.shader_eval_type, @@ -1002,9 +999,8 @@ class CPUDevice : public Device { task.update_progress(NULL); } -#ifdef WITH_OSL - OSLShader::thread_free(&kg); -#endif + thread_kernel_globals_free(kg); + delete kg; } int get_split_task_count(DeviceTask &task) -- cgit v1.2.3