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:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/editors/undo/memfile_undo.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/editors/undo/memfile_undo.c')
-rw-r--r--source/blender/editors/undo/memfile_undo.c153
1 files changed, 78 insertions, 75 deletions
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index c6719f6433a..36ce38091d4 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -45,97 +45,101 @@
* \{ */
typedef struct MemFileUndoStep {
- UndoStep step;
- MemFileUndoData *data;
+ UndoStep step;
+ MemFileUndoData *data;
} MemFileUndoStep;
static bool memfile_undosys_poll(bContext *C)
{
- /* other poll functions must run first, this is a catch-all. */
-
- if ((U.uiflag & USER_GLOBALUNDO) == 0) {
- return false;
- }
-
- /* Allow a single memfile undo step (the first). */
- UndoStack *ustack = ED_undo_stack_get();
- if ((ustack->step_active != NULL) &&
- (ED_undo_is_memfile_compatible(C) == false))
- {
- return false;
- }
- return true;
+ /* other poll functions must run first, this is a catch-all. */
+
+ if ((U.uiflag & USER_GLOBALUNDO) == 0) {
+ return false;
+ }
+
+ /* Allow a single memfile undo step (the first). */
+ UndoStack *ustack = ED_undo_stack_get();
+ if ((ustack->step_active != NULL) && (ED_undo_is_memfile_compatible(C) == false)) {
+ return false;
+ }
+ return true;
}
-static bool memfile_undosys_step_encode(struct bContext *UNUSED(C), struct Main *bmain, UndoStep *us_p)
+static bool memfile_undosys_step_encode(struct bContext *UNUSED(C),
+ struct Main *bmain,
+ UndoStep *us_p)
{
- MemFileUndoStep *us = (MemFileUndoStep *)us_p;
+ MemFileUndoStep *us = (MemFileUndoStep *)us_p;
- /* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
- UndoStack *ustack = ED_undo_stack_get();
+ /* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
+ UndoStack *ustack = ED_undo_stack_get();
- /* can be NULL, use when set. */
- MemFileUndoStep *us_prev = (MemFileUndoStep *)BKE_undosys_step_find_by_type(ustack, BKE_UNDOSYS_TYPE_MEMFILE);
- us->data = BKE_memfile_undo_encode(bmain, us_prev ? us_prev->data : NULL);
- us->step.data_size = us->data->undo_size;
+ /* can be NULL, use when set. */
+ MemFileUndoStep *us_prev = (MemFileUndoStep *)BKE_undosys_step_find_by_type(
+ ustack, BKE_UNDOSYS_TYPE_MEMFILE);
+ us->data = BKE_memfile_undo_encode(bmain, us_prev ? us_prev->data : NULL);
+ us->step.data_size = us->data->undo_size;
- return true;
+ 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))
{
- ED_editors_exit(bmain, false);
-
- MemFileUndoStep *us = (MemFileUndoStep *)us_p;
- BKE_memfile_undo_decode(us->data, C);
-
- for (UndoStep *us_iter = us_p->next; us_iter; us_iter = us_iter->next) {
- if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
- continue;
- }
- us_iter->is_applied = false;
- }
- for (UndoStep *us_iter = us_p; us_iter; us_iter = us_iter->prev) {
- if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
- continue;
- }
- us_iter->is_applied = true;
- }
-
- /* bmain has been freed. */
- bmain = CTX_data_main(C);
- ED_editors_init_for_undo(bmain);
-
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
+ ED_editors_exit(bmain, false);
+
+ MemFileUndoStep *us = (MemFileUndoStep *)us_p;
+ BKE_memfile_undo_decode(us->data, C);
+
+ for (UndoStep *us_iter = us_p->next; us_iter; us_iter = us_iter->next) {
+ if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
+ continue;
+ }
+ us_iter->is_applied = false;
+ }
+ for (UndoStep *us_iter = us_p; us_iter; us_iter = us_iter->prev) {
+ if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
+ continue;
+ }
+ us_iter->is_applied = true;
+ }
+
+ /* bmain has been freed. */
+ bmain = CTX_data_main(C);
+ ED_editors_init_for_undo(bmain);
+
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
}
static void memfile_undosys_step_free(UndoStep *us_p)
{
- /* To avoid unnecessary slow down, free backwards (so we don't need to merge when clearing all). */
- MemFileUndoStep *us = (MemFileUndoStep *)us_p;
- if (us_p->next != NULL) {
- UndoStep *us_next_p = BKE_undosys_step_same_type_next(us_p);
- if (us_next_p != NULL) {
- MemFileUndoStep *us_next = (MemFileUndoStep *)us_next_p;
- BLO_memfile_merge(&us->data->memfile, &us_next->data->memfile);
- }
- }
-
- BKE_memfile_undo_free(us->data);
+ /* To avoid unnecessary slow down, free backwards (so we don't need to merge when clearing all). */
+ MemFileUndoStep *us = (MemFileUndoStep *)us_p;
+ if (us_p->next != NULL) {
+ UndoStep *us_next_p = BKE_undosys_step_same_type_next(us_p);
+ if (us_next_p != NULL) {
+ MemFileUndoStep *us_next = (MemFileUndoStep *)us_next_p;
+ BLO_memfile_merge(&us->data->memfile, &us_next->data->memfile);
+ }
+ }
+
+ BKE_memfile_undo_free(us->data);
}
/* Export for ED_undo_sys. */
void ED_memfile_undosys_type(UndoType *ut)
{
- ut->name = "Global Undo";
- ut->poll = memfile_undosys_poll;
- ut->step_encode = memfile_undosys_step_encode;
- ut->step_decode = memfile_undosys_step_decode;
- ut->step_free = memfile_undosys_step_free;
+ ut->name = "Global Undo";
+ ut->poll = memfile_undosys_poll;
+ ut->step_encode = memfile_undosys_step_encode;
+ ut->step_decode = memfile_undosys_step_decode;
+ ut->step_free = memfile_undosys_step_free;
- ut->use_context = true;
+ ut->use_context = true;
- ut->step_size = sizeof(MemFileUndoStep);
+ ut->step_size = sizeof(MemFileUndoStep);
}
/** \} */
@@ -149,18 +153,17 @@ void ED_memfile_undosys_type(UndoType *ut)
*/
static struct MemFile *ed_undosys_step_get_memfile(UndoStep *us_p)
{
- MemFileUndoStep *us = (MemFileUndoStep *)us_p;
- return &us->data->memfile;
+ MemFileUndoStep *us = (MemFileUndoStep *)us_p;
+ return &us->data->memfile;
}
struct MemFile *ED_undosys_stack_memfile_get_active(UndoStack *ustack)
{
- UndoStep *us = BKE_undosys_stack_active_with_type(ustack, BKE_UNDOSYS_TYPE_MEMFILE);
- if (us) {
- return ed_undosys_step_get_memfile(us);
- }
- return NULL;
+ UndoStep *us = BKE_undosys_stack_active_with_type(ustack, BKE_UNDOSYS_TYPE_MEMFILE);
+ if (us) {
+ return ed_undosys_step_get_memfile(us);
+ }
+ return NULL;
}
-
/** \} */