From 252b0cf5d28c5ce6397a64cb4bb399a6c5a438fa Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 18 Apr 2015 15:41:12 +0200 Subject: Cleanup: API naming use BKE_undo_ prefix --- source/blender/editors/util/editmode_undo.c | 11 ++++++----- source/blender/editors/util/undo.c | 17 +++++++++-------- source/blender/editors/util/util_intern.h | 12 ++++++------ 3 files changed, 21 insertions(+), 19 deletions(-) (limited to 'source/blender/editors/util') 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__ */ -- cgit v1.2.3