Code Cleanup: Add proper defines (with ANIM_* prefix) for animation-related copy-paste buffer free callbacks

This commit is contained in:
Joshua Leung
2016-04-03 01:18:23 +13:00
parent 6401730697
commit 6bddad2c4e
10 changed files with 23 additions and 28 deletions

View File

@@ -61,9 +61,6 @@
#include "anim_intern.h"
/* called by WM */
void free_anim_drivers_copybuf(void);
/* ************************************************** */
/* Animation Data Validation */
@@ -514,8 +511,7 @@ bool ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path
static FCurve *channeldriver_copypaste_buf = NULL;
/* This function frees any MEM_calloc'ed copy/paste buffer data */
// XXX find some header to put this in!
void free_anim_drivers_copybuf(void)
void ANIM_drivers_copybuf_free(void)
{
/* free the buffer F-Curve if it exists, as if it were just another F-Curve */
if (channeldriver_copypaste_buf)
@@ -553,7 +549,7 @@ bool ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int ar
fcu = verify_driver_fcurve(id, rna_path, array_index, 0);
/* clear copy/paste buffer first (for consistency with other copy/paste buffers) */
free_anim_drivers_copybuf();
ANIM_drivers_copybuf_free();
/* copy this to the copy/paste buf if it exists */
if (fcu && fcu->driver) {

View File

@@ -697,14 +697,14 @@ static ListBase fmodifier_copypaste_buf = {NULL, NULL};
/* ---------- */
/* free the copy/paste buffer */
void free_fmodifiers_copybuf(void)
void ANIM_fmodifiers_copybuf_free(void)
{
/* just free the whole buffer */
free_fmodifiers(&fmodifier_copypaste_buf);
}
/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
* assuming that the buffer has been cleared already with ANIM_fmodifiers_copybuf_free()
* - active: only copy the active modifier
*/
bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active)

View File

@@ -527,8 +527,7 @@ typedef struct tAnimCopybufItem {
/* This function frees any MEM_calloc'ed copy/paste buffer data */
// XXX find some header to put this in!
void free_anim_copybuf(void)
void ANIM_fcurves_copybuf_free(void)
{
tAnimCopybufItem *aci, *acn;
@@ -563,7 +562,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
Scene *scene = ac->scene;
/* clear buffer first */
free_anim_copybuf();
ANIM_fcurves_copybuf_free();
/* assume that each of these is an F-Curve */
for (ale = anim_data->first; ale; ale = ale->next) {

View File

@@ -544,10 +544,10 @@ void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, List
/* free the copy/paste buffer */
void free_fmodifiers_copybuf(void);
void ANIM_fmodifiers_copybuf_free(void);
/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
* assuming that the buffer has been cleared already with ANIM_fmodifiers_copybuf_free()
* - active: only copy the active modifier
*/
bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active);

View File

@@ -272,7 +272,7 @@ void sample_fcurve(struct FCurve *fcu);
/* ----------- */
void free_anim_copybuf(void);
void ANIM_fcurves_copybuf_free(void);
short copy_animedit_keys(struct bAnimContext *ac, ListBase *anim_data);
short paste_animedit_keys(struct bAnimContext *ac, ListBase *anim_data,
const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip);

View File

@@ -288,6 +288,11 @@ bool ANIM_remove_driver(struct ReportList *reports, struct ID *id, const char rn
/* -------- */
/* Clear copy-paste buffer for drivers */
void ANIM_drivers_copybuf_free(void);
/* -------- */
/* Returns whether there is a driver in the copy/paste buffer to paste */
bool ANIM_driver_can_paste(void);

View File

@@ -496,7 +496,7 @@ static short copy_action_keys(bAnimContext *ac)
int filter, ok = 0;
/* clear buffer first */
free_anim_copybuf();
ANIM_fcurves_copybuf_free();
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);

View File

@@ -789,7 +789,7 @@ static short copy_graph_keys(bAnimContext *ac)
int filter, ok = 0;
/* clear buffer first */
free_anim_copybuf();
ANIM_fcurves_copybuf_free();
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
@@ -2487,7 +2487,7 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* clear buffer first */
free_fmodifiers_copybuf();
ANIM_fmodifiers_copybuf_free();
/* get the active F-Curve */
ale = get_active_fcurve_channel(&ac);

View File

@@ -2346,7 +2346,7 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* clear buffer first */
free_fmodifiers_copybuf();
ANIM_fmodifiers_copybuf_free();
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);

View File

@@ -97,9 +97,11 @@
#include "wm_files.h"
#include "wm_window.h"
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_gpencil.h"
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_node.h"
#include "ED_render.h"
#include "ED_space_api.h"
@@ -399,13 +401,6 @@ static void free_openrecent(void)
}
/* bad stuff*/
// XXX copy/paste buffer stuff...
extern void free_anim_copybuf(void);
extern void free_anim_drivers_copybuf(void);
extern void free_fmodifiers_copybuf(void);
#ifdef WIN32
/* Read console events until there is a key event. Also returns on any error. */
static void wait_for_console_key(void)
@@ -513,9 +508,9 @@ void WM_exit_ext(bContext *C, const bool do_python)
free_blender(); /* blender.c, does entire library and spacetypes */
// free_matcopybuf();
free_anim_copybuf();
free_anim_drivers_copybuf();
free_fmodifiers_copybuf();
ANIM_fcurves_copybuf_free();
ANIM_drivers_copybuf_free();
ANIM_fmodifiers_copybuf_free();
ED_gpencil_anim_copybuf_free();
ED_gpencil_strokes_copybuf_free();
ED_clipboard_posebuf_free();