Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_text.h4
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h3
-rw-r--r--source/blender/blenkernel/intern/armature.c3
-rw-r--r--source/blender/blenkernel/intern/mesh.c1
-rw-r--r--source/blender/blenkernel/intern/text.c22
-rw-r--r--source/blender/blenkernel/intern/undo_system.c67
6 files changed, 74 insertions, 26 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/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/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/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);
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/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index 76b37b940ec..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,22 +679,36 @@ 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;
}
}
- 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, is_final);
+ ustack->step_active = us_iter;
+ } while ((us_active != us_iter) && (us_iter = us_iter->prev));
+ }
+
return true;
}
return false;
@@ -732,20 +747,34 @@ 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;
}
}
- 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, is_final);
+ ustack->step_active = us_iter;
+ } while ((us_active != us_iter) && (us_iter = us_iter->next));
+ }
return true;
}
return false;