[Bf-blender-cvs] [a9cfee6106f] uuid-undo-experiments-swap-reread-datablocks: Make new undo speedup code hidden behind experimental option.
Bastien Montagne
noreply at git.blender.org
Thu Mar 5 18:18:48 CET 2020
Commit: a9cfee6106f8c8a024e70c5174dc6fbab139a36d
Author: Bastien Montagne
Date: Thu Mar 5 18:17:03 2020 +0100
Branches: uuid-undo-experiments-swap-reread-datablocks
https://developer.blender.org/rBa9cfee6106f8c8a024e70c5174dc6fbab139a36d
Make new undo speedup code hidden behind experimental option.
===================================================================
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/blenloader/intern/readfile.c
M source/blender/editors/undo/memfile_undo.c
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index c3c99ebb826..0fd3d97ef6b 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -2118,6 +2118,25 @@ class USERPREF_PT_experimental_virtual_reality(ExperimentalPanel, Panel):
"""
+class USERPREF_PT_experimental_system(ExperimentalPanel, Panel):
+ bl_label = "System"
+
+ def draw(self, context):
+ prefs = context.preferences
+ experimental = prefs.experimental
+
+ layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False
+
+ task = "T60695"
+ split = layout.split(factor=0.66)
+ col = split.split()
+ col.prop(experimental, "use_undo_speedup")
+ col = split.split()
+ col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
+
+
# -----------------------------------------------------------------------------
# Class Registration
@@ -2205,6 +2224,8 @@ classes = (
# Popovers.
USERPREF_PT_ndof_settings,
+ USERPREF_PT_experimental_system,
+
# Add dynamically generated editor theme panels last,
# so they show up last in the theme section.
*ThemeGenericClassGenerator.generate_panel_classes_from_theme_areas(),
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index b54f834c999..4e759642bec 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2752,7 +2752,7 @@ static void direct_link_id(FileData *fd, ID *id, ID *id_old)
id->recalc = 0;
id->recalc_undo_accumulated = 0;
}
- else {
+ else if ((fd->skip_flags & BLO_READ_SKIP_UNDO_OLD_MAIN) == 0) {
if (fd->undo_direction < 0) {
/* We are coming from the future (i.e. do an actual undo, and not a redo), and we found an
* old (aka existing) ID: we use its 'accumulated recalc flags since last memfile undo step
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index e6b686f1da2..312edab91b1 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -148,7 +148,10 @@ static void memfile_undosys_step_decode(struct bContext *C,
bool use_old_bmain_data = true;
- if (undo_direction > 0) {
+ if (!U.experimental.use_undo_speedup) {
+ use_old_bmain_data = false;
+ }
+ else if (undo_direction > 0) {
/* Redo case.
* The only time we should have to force a complete redo is when current step is tagged as a
* redo barrier.
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index b3f82bc1269..cb5cd1fa7dc 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -613,7 +613,8 @@ typedef struct UserDef_FileSpaceData {
} UserDef_FileSpaceData;
typedef struct UserDef_Experimental {
- char _pad0[8]; /* makesdna does not allow empty structs. */
+ char use_undo_speedup;
+ char _pad0[7]; /* makesdna does not allow empty structs. */
} UserDef_Experimental;
#define USER_EXPERIMENTAL_TEST(userdef, member) \
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 566305ad1c7..708fd796a5d 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -5929,12 +5929,20 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
static void rna_def_userdef_experimental(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna = RNA_def_struct(brna, "PreferencesExperimental", NULL);
RNA_def_struct_sdna(srna, "UserDef_Experimental");
RNA_def_struct_nested(brna, srna, "Preferences");
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Experimental", "Experimental features");
+
+ prop = RNA_def_property(srna, "use_undo_speedup", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_undo_speedup", 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Undo Speedup",
+ "Use new undo speedup (WARNING: can lead to crashes and serious .blend file corruption)");
}
static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
More information about the Bf-blender-cvs
mailing list