diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-12 15:46:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-12 15:46:48 +0300 |
commit | 69b7ae839744b63ef6812bf2d1ce72f2ce4e64dc (patch) | |
tree | 6e30ee4ec724722bcf4e3b5f61625a18b36d85d5 /source | |
parent | c21488df5a830af494d13b353e78cbf81de1595c (diff) | |
parent | 753a600e354f21618e24e9071ef5d88f1913fcd8 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_callbacks.h | 4 | ||||
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 39 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 3 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_handlers.c | 4 |
4 files changed, 47 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index c913510bda3..f53a4b385b4 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -49,6 +49,10 @@ typedef enum { BLI_CB_EVT_LOAD_POST, BLI_CB_EVT_SAVE_PRE, BLI_CB_EVT_SAVE_POST, + BLI_CB_EVT_UNDO_PRE, + BLI_CB_EVT_UNDO_POST, + BLI_CB_EVT_REDO_PRE, + BLI_CB_EVT_REDO_POST, BLI_CB_EVT_VERSION_UPDATE, BLI_CB_EVT_TOT } eCbEvent; diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index c090414bc22..7bbb2479a52 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -39,6 +39,8 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_callbacks.h" +#include "BLI_listbase.h" #include "BLT_translation.h" @@ -121,17 +123,50 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) return ED_undo_gpencil_step(C, step, undoname); } + UndoStep *step_data_from_name = NULL; + int step_for_callback = step; + if (undoname != NULL) { + step_data_from_name = BKE_undosys_step_find_by_name(wm->undo_stack, undoname); + if (step_data_from_name == NULL) { + return OPERATOR_CANCELLED; + } + + /* TODO(campbell), could use simple optimization. */ + BLI_assert(step_data_from_name != wm->undo_stack->step_active); + step_for_callback = ( + BLI_findindex(&wm->undo_stack->steps, step_data_from_name) < + BLI_findindex(&wm->undo_stack->steps, wm->undo_stack->step_active)) ? 1 : -1; + } + + /* App-Handlers (pre). */ + { + /* Note: ignore grease pencil for now. */ + Main *bmain = CTX_data_main(C); + wm->op_undo_depth++; + BLI_callback_exec(bmain, &scene->id, (step_for_callback > 0) ? BLI_CB_EVT_UNDO_PRE : BLI_CB_EVT_REDO_PRE); + wm->op_undo_depth--; + } + + /* Undo System */ { if (undoname) { - UndoStep *step_data = BKE_undosys_step_find_by_name(wm->undo_stack, undoname); - BKE_undosys_step_undo_with_data(wm->undo_stack, C, step_data); + BKE_undosys_step_undo_with_data(wm->undo_stack, C, step_data_from_name); } else { BKE_undosys_step_undo_compat_only(wm->undo_stack, C, step); } } + /* App-Handlers (post). */ + { + Main *bmain = CTX_data_main(C); + scene = CTX_data_scene(C); + wm->op_undo_depth++; + BLI_callback_exec(bmain, &scene->id, step_for_callback > 0 ? BLI_CB_EVT_UNDO_PRE : BLI_CB_EVT_REDO_PRE); + wm->op_undo_depth--; + } + WM_event_add_notifier(C, NC_WINDOW, NULL); WM_event_add_notifier(C, NC_WM | ND_UNDO, NULL); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 9b065409201..083551f2367 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -1102,8 +1102,9 @@ static void rna_def_colormanage(BlenderRNA *brna) prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "exposure"); - RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_float_default(prop, 0.0f); + RNA_def_property_range(prop, -32.0f, 32.0f); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 1, 3); RNA_def_property_ui_text(prop, "Exposure", "Exposure (stops) applied before display transform"); RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update"); diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 948a78d5794..72bc5bbc910 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -59,6 +59,10 @@ static PyStructSequence_Field app_cb_info_fields[] = { {(char *)"load_post", (char *)"on loading a new blend file (after)"}, {(char *)"save_pre", (char *)"on saving a blend file (before)"}, {(char *)"save_post", (char *)"on saving a blend file (after)"}, + {(char *)"undo_pre", (char *)"on loading an undo step (before)"}, + {(char *)"undo_post", (char *)"on loading an undo step (after)"}, + {(char *)"redo_pre", (char *)"on loading a redo step (before)"}, + {(char *)"redo_post", (char *)"on loading a redo step (after)"}, {(char *)"version_update", (char *)"on ending the versioning code"}, /* sets the permanent tag */ |