diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-02 13:41:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-02 13:41:26 +0400 |
commit | a31449edaddc1be80676c77babf079a9f137c42d (patch) | |
tree | 30bf1759a51f5def43dc000d6af7112642404770 /source/blender/blenkernel/intern | |
parent | 2944d42c262d9d4459e356dc8b8fbad1c53c2054 (diff) |
all remove functions now invalidate the RNA objects passed, to help script authors to avoid bugs with accessing removed data.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 0c369a463d5..75276adf518 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -182,14 +182,14 @@ void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], con /* ********** NOTE: requires curvemapping_changed() call after ******** */ /* remove specified point */ -void curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point) +int curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point) { CurveMapPoint *cmp; int a, b, removed = 0; /* must have 2 points minimum */ if (cuma->totpoint <= 2) - return; + return FALSE; cmp = MEM_mallocN((cuma->totpoint) * sizeof(CurveMapPoint), "curve points"); @@ -205,6 +205,7 @@ void curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point) MEM_freeN(cuma->curve); cuma->curve = cmp; cuma->totpoint -= removed; + return (removed != 0); } /* removes with flag set */ diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index e39ad4a08c0..26775eaac8c 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1189,17 +1189,17 @@ MovieTrackingObject *BKE_tracking_object_add(MovieTracking *tracking, const char return object; } -void BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *object) +int BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *object) { MovieTrackingTrack *track; int index = BLI_findindex(&tracking->objects, object); - if (index < 0) - return; + if (index == -1) + return FALSE; if (object->flag & TRACKING_OBJECT_CAMERA) { /* object used for camera solving can't be deleted */ - return; + return FALSE; } track = object->tracks.first; @@ -1215,10 +1215,11 @@ void BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *ob tracking->tot_object--; - if (index > 0) + if (index != 0) tracking->objectnr = index - 1; else tracking->objectnr = 0; + return TRUE; } void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object) |