diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-18 16:41:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-18 19:25:07 +0300 |
commit | 252b0cf5d28c5ce6397a64cb4bb399a6c5a438fa (patch) | |
tree | 17892fee417a6e2d9efc78eccdb3d8aec7170e64 /source/blender/editors | |
parent | 38bea4e86c90c514d345f34f865da831e6d2f83f (diff) |
Cleanup: API naming use BKE_undo_ prefix
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_paint.h | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_particle.h | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_util.h | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 11 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_undo.c | 17 | ||||
-rw-r--r-- | source/blender/editors/util/editmode_undo.c | 11 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 17 | ||||
-rw-r--r-- | source/blender/editors/util/util_intern.h | 12 |
8 files changed, 41 insertions, 37 deletions
diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h index c3a411a2b97..822dab61a06 100644 --- a/source/blender/editors/include/ED_paint.h +++ b/source/blender/editors/include/ED_paint.h @@ -46,9 +46,9 @@ typedef bool (*UndoCleanupCb)(struct bContext *C, struct ListBase *lb); int ED_undo_paint_step(struct bContext *C, int type, int step, const char *name); void ED_undo_paint_step_num(struct bContext *C, int type, int num); -const char *ED_undo_paint_get_name(struct bContext *C, int type, int nr, int *active); +const char *ED_undo_paint_get_name(struct bContext *C, int type, int nr, bool *r_active); void ED_undo_paint_free(void); -int ED_undo_paint_valid(int type, const char *name); +bool ED_undo_paint_is_valid(int type, const char *name); bool ED_undo_paint_empty(int type); void ED_undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free, UndoCleanupCb cleanup); void ED_undo_paint_push_end(int type); diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 56a4bfa7e21..6cb8c0cfb19 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -66,9 +66,9 @@ void PE_undo_push(struct Scene *scene, const char *str); void PE_undo_step(struct Scene *scene, int step); void PE_undo(struct Scene *scene); void PE_redo(struct Scene *scene); -int PE_undo_valid(struct Scene *scene); +bool PE_undo_is_valid(struct Scene *scene); void PE_undo_number(struct Scene *scene, int nr); -const char *PE_undo_get_name(struct Scene *scene, int nr, int *active); +const char *PE_undo_get_name(struct Scene *scene, int nr, bool *r_active); #endif /* __ED_PARTICLE_H__ */ diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 6fa92e1953d..9556c601d1f 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -60,7 +60,7 @@ int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); void ED_undo_operator_repeat_cb(struct bContext *C, void *arg_op, void *arg_unused); void ED_undo_operator_repeat_cb_evt(struct bContext *C, void *arg_op, int arg_unused); -int ED_undo_valid(const struct bContext *C, const char *undoname); +bool ED_undo_is_valid(const struct bContext *C, const char *undoname); /* undo_editmode.c */ void undo_editmode_push(struct bContext *C, const char *name, diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 6c90e319bc6..a0420dfa46e 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -4445,7 +4445,7 @@ void PE_undo_step(Scene *scene, int step) DAG_id_tag_update(&OBACT->id, OB_RECALC_DATA); } -int PE_undo_valid(Scene *scene) +bool PE_undo_is_valid(Scene *scene) { PTCacheEdit *edit= PE_get_current(scene, OBACT); @@ -4496,18 +4496,19 @@ void PE_undo_number(Scene *scene, int nr) /* get name of undo item, return null if no item with this index */ /* if active pointer, set it to 1 if true */ -const char *PE_undo_get_name(Scene *scene, int nr, int *active) +const char *PE_undo_get_name(Scene *scene, int nr, bool *r_active) { PTCacheEdit *edit= PE_get_current(scene, OBACT); PTCacheUndo *undo; - if (active) *active= 0; + if (r_active) *r_active = false; if (edit) { undo= BLI_findlink(&edit->undo, nr); if (undo) { - if (active && undo==edit->curundo) - *active= 1; + if (r_active && (undo == edit->curundo)) { + *r_active = true; + } return undo->name; } } diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index 0293a0bfc00..42f0aaab173 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -331,32 +331,33 @@ void ED_undo_paint_step_num(bContext *C, int type, int step) undo_step_num(C, &MeshUndoStack, step); } -static char *undo_stack_get_name(UndoStack *stack, int nr, int *active) +static char *undo_stack_get_name(UndoStack *stack, int nr, bool *r_active) { UndoElem *uel; - if (active) *active = 0; + if (r_active) *r_active = false; uel = BLI_findlink(&stack->elems, nr); if (uel) { - if (active && uel == stack->current) - *active = 1; + if (r_active && (uel == stack->current)) { + *r_active = true; + } return uel->name; } return NULL; } -const char *ED_undo_paint_get_name(bContext *C, int type, int nr, int *active) +const char *ED_undo_paint_get_name(bContext *C, int type, int nr, bool *r_active) { if (type == UNDO_PAINT_IMAGE) { undo_stack_cleanup(&ImageUndoStack, C); - return undo_stack_get_name(&ImageUndoStack, nr, active); + return undo_stack_get_name(&ImageUndoStack, nr, r_active); } else if (type == UNDO_PAINT_MESH) { undo_stack_cleanup(&MeshUndoStack, C); - return undo_stack_get_name(&MeshUndoStack, nr, active); + return undo_stack_get_name(&MeshUndoStack, nr, r_active); } return NULL; } @@ -379,7 +380,7 @@ bool ED_undo_paint_empty(int type) return false; } -int ED_undo_paint_valid(int type, const char *name) +bool ED_undo_paint_is_valid(int type, const char *name) { UndoStack *stack; diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 7f5edb5ea9e..bc7a8374c73 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -315,7 +315,7 @@ void undo_editmode_name(bContext *C, const char *undoname) } /* undoname optionally, if NULL it just checks for existing undo steps */ -int undo_editmode_valid(const char *undoname) +bool undo_editmode_is_valid(const char *undoname) { if (undoname) { UndoElem *uel; @@ -332,19 +332,20 @@ int undo_editmode_valid(const char *undoname) /* get name of undo item, return null if no item with this index */ /* if active pointer, set it to 1 if true */ -const char *undo_editmode_get_name(bContext *C, int nr, int *active) +const char *undo_editmode_get_name(bContext *C, int nr, bool *r_active) { UndoElem *uel; /* prevent wrong numbers to be returned */ undo_clean_stack(C); - if (active) *active = 0; + if (r_active) *r_active = false; uel = BLI_findlink(&undobase, nr); if (uel) { - if (active && uel == curundo) - *active = 1; + if (r_active && (uel == curundo)) { + *r_active = true; + } return uel->name; } return NULL; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index ab882a388ad..ee6101d2952 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -108,7 +108,7 @@ void ED_undo_push(bContext *C, const char *str) /* do nothing for now */ } else { - BKE_write_undo(C, str); + BKE_undo_write(C, str); } if (wm->file_saved) { @@ -244,7 +244,7 @@ void ED_undo_pop_op(bContext *C, wmOperator *op) } /* name optionally, function used to check for operator redo panel */ -int ED_undo_valid(const bContext *C, const char *undoname) +bool ED_undo_is_valid(const bContext *C, const char *undoname) { Object *obedit = CTX_data_edit_object(C); Object *obact = CTX_data_active_object(C); @@ -263,7 +263,7 @@ int ED_undo_valid(const bContext *C, const char *undoname) } else if (obedit) { if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) { - return undo_editmode_valid(undoname); + return undo_editmode_is_valid(undoname); } } else { @@ -271,19 +271,19 @@ int ED_undo_valid(const bContext *C, const char *undoname) /* if below tests fail, global undo gets executed */ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) { - if (ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname)) + if (ED_undo_paint_is_valid(UNDO_PAINT_IMAGE, undoname)) return 1; } else if (obact && obact->mode & OB_MODE_SCULPT) { - if (ED_undo_paint_valid(UNDO_PAINT_MESH, undoname)) + if (ED_undo_paint_is_valid(UNDO_PAINT_MESH, undoname)) return 1; } else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) { - return PE_undo_valid(CTX_data_scene(C)); + return PE_undo_is_valid(CTX_data_scene(C)); } if (U.uiflag & USER_GLOBALUNDO) { - return BKE_undo_valid(undoname); + return BKE_undo_is_valid(undoname); } } return 0; @@ -487,7 +487,8 @@ static int get_undo_system(bContext *C) static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem) { EnumPropertyItem item_tmp = {0}, *item = NULL; - int active, i = 0; + int i = 0; + bool active; while (true) { const char *name = NULL; diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h index d366ad7997f..0f650330951 100644 --- a/source/blender/editors/util/util_intern.h +++ b/source/blender/editors/util/util_intern.h @@ -35,12 +35,12 @@ /* internal exports only */ /* editmode_undo.c */ -void undo_editmode_name (struct bContext *C, const char *undoname); -int undo_editmode_valid (const char *undoname); -const char *undo_editmode_get_name (struct bContext *C, int nr, int *active); -void *undo_editmode_get_prev (struct Object *ob); -void undo_editmode_step (struct bContext *C, int step); -void undo_editmode_number (struct bContext *C, int nr); +void undo_editmode_name(struct bContext *C, const char *undoname); +bool undo_editmode_is_valid(const char *undoname); +const char *undo_editmode_get_name(struct bContext *C, int nr, bool *r_active); +void *undo_editmode_get_prev(struct Object *ob); +void undo_editmode_step(struct bContext *C, int step); +void undo_editmode_number(struct bContext *C, int nr); #endif /* __UTIL_INTERN_H__ */ |