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
path: root/source
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2020-06-05 09:41:09 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2020-06-05 09:41:35 +0300
commitfe6be70875bca64e555d1cbedf1c2160493cf0e2 (patch)
tree96a78a9737f091dfc884a232f28d8e0f33337967 /source
parente3a32a22bf9dbed18d7718ea4a0d66759c933a3b (diff)
CleanUp: Introduce BKE_fcurve_create
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h2
-rw-r--r--source/blender/blenkernel/intern/fcurve.c6
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/nla.c4
-rw-r--r--source/blender/editors/animation/drivers.c2
-rw-r--r--source/blender/editors/animation/keyframing.c2
-rw-r--r--source/blender/editors/space_graph/graph_edit.c2
-rw-r--r--source/blender/io/collada/AnimationImporter.cpp4
-rw-r--r--source/blender/io/collada/BCAnimationCurve.cpp2
9 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 1eb5da974ce..b310d66d4bd 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -179,7 +179,7 @@ int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array,
#define BEZT_BINARYSEARCH_THRESH 0.01f /* was 0.00001, but giving errors */
/* -------- Data Management -------- */
-
+struct FCurve *BKE_fcurve_create(void);
void free_fcurve(struct FCurve *fcu);
struct FCurve *copy_fcurve(const struct FCurve *fcu);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index c0843e049f3..5eb1b756ac7 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -58,7 +58,11 @@
static CLG_LogRef LOG = {"bke.fcurve"};
/* ************************** Data-Level Functions ************************* */
-
+FCurve *BKE_fcurve_create(void)
+{
+ FCurve *fcu = MEM_callocN(sizeof(FCurve), __func__);
+ return fcu;
+}
/* ---------------------- Freeing --------------------------- */
/* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 780c3c2f14a..a2dfbefdb2c 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1341,7 +1341,7 @@ static void icu_to_fcurves(ID *id,
int totbits;
/* allocate memory for a new F-Curve */
- fcu = MEM_callocN(sizeof(FCurve), "FCurve");
+ fcu = BKE_fcurve_create();
/* convert driver */
if (icu->driver) {
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 4ef68b91a84..97b09d10ede 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1499,7 +1499,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* add one if not found */
if (fcu == NULL) {
/* make new F-Curve */
- fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
+ fcu = BKE_fcurve_create();
BLI_addtail(&strip->fcurves, fcu);
/* set default flags */
@@ -1530,7 +1530,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* add one if not found */
if (fcu == NULL) {
/* make new F-Curve */
- fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
+ fcu = BKE_fcurve_create();
BLI_addtail(&strip->fcurves, fcu);
/* set default flags */
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 82e24eaa6e3..f7416ce7566 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -110,7 +110,7 @@ struct FCurve *alloc_driver_fcurve(const char rna_path[],
const int array_index,
eDriverFCurveCreationMode creation_mode)
{
- FCurve *fcu = MEM_callocN(sizeof(FCurve), "FCurve");
+ FCurve *fcu = BKE_fcurve_create();
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
fcu->auto_smoothing = U.auto_smoothing_new;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0e9b870df88..b3b818fafa9 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -214,7 +214,7 @@ FCurve *ED_action_fcurve_ensure(struct Main *bmain,
if (fcu == NULL) {
/* use default settings to make a F-Curve */
- fcu = MEM_callocN(sizeof(FCurve), "FCurve");
+ fcu = BKE_fcurve_create();
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
fcu->auto_smoothing = U.auto_smoothing_new;
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index a974ec612a9..06da4416f04 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -425,7 +425,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
/* loop through filtered data and add keys between selected keyframes on every frame */
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
- FCurve *gcu = MEM_callocN(sizeof(FCurve), "Ghost FCurve");
+ FCurve *gcu = BKE_fcurve_create();
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
ChannelDriver *driver = fcu->driver;
FPoint *fpt;
diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp
index 2511d3c287d..0e5fa5ec161 100644
--- a/source/blender/io/collada/AnimationImporter.cpp
+++ b/source/blender/io/collada/AnimationImporter.cpp
@@ -57,7 +57,7 @@ template<class T> static const char *bc_get_joint_name(T *node)
FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path)
{
- FCurve *fcu = (FCurve *)MEM_callocN(sizeof(FCurve), "FCurve");
+ FCurve *fcu = BKE_fcurve_create();
fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
fcu->array_index = array_index;
@@ -100,7 +100,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
case 16: /* matrix */
{
for (i = 0; i < dim; i++) {
- FCurve *fcu = (FCurve *)MEM_callocN(sizeof(FCurve), "FCurve");
+ FCurve *fcu = BKE_fcurve_create();
fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
fcu->array_index = 0;
diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp
index 98eb12f738e..67b96230b02 100644
--- a/source/blender/io/collada/BCAnimationCurve.cpp
+++ b/source/blender/io/collada/BCAnimationCurve.cpp
@@ -94,7 +94,7 @@ void BCAnimationCurve::delete_fcurve(FCurve *fcu)
FCurve *BCAnimationCurve::create_fcurve(int array_index, const char *rna_path)
{
- FCurve *fcu = (FCurve *)MEM_callocN(sizeof(FCurve), "FCurve");
+ FCurve *fcu = BKE_fcurve_create();
fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
fcu->array_index = array_index;