diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-16 14:11:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-16 14:11:16 +0300 |
commit | 567ee32f14304a462e59bde2de92b10861ad7c86 (patch) | |
tree | 29e95d2fe7945d976fc0d01722f400134b4e775a /source/blender/blenkernel/intern/fmodifier.c | |
parent | d2ca3e55820258361aa1f4cd9db1c1084b1e3f23 (diff) |
- fcurve modifiers.new()/remove()/active
- renamed .add() to .new() for rna collection functions since they dont add an existing item.
- remove 'name' as an argument from the new driver target function, better to keep the api minimal and let scripters use the data api for editing values after.
- added some api functions to keep rna api from becoming a mess.
Diffstat (limited to 'source/blender/blenkernel/intern/fmodifier.c')
-rw-r--r-- | source/blender/blenkernel/intern/fmodifier.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index f70de4983e3..e9e12e29606 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -992,13 +992,13 @@ void copy_fmodifiers (ListBase *dst, ListBase *src) } /* Remove and free the given F-Modifier from the given stack */ -void remove_fmodifier (ListBase *modifiers, FModifier *fcm) +int remove_fmodifier (ListBase *modifiers, FModifier *fcm) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); /* sanity check */ if (fcm == NULL) - return; + return 0; /* free modifier's special data (stored inside fcm->data) */ if (fcm->data) { @@ -1010,12 +1010,24 @@ void remove_fmodifier (ListBase *modifiers, FModifier *fcm) } /* remove modifier from stack */ - if (modifiers) + if (modifiers) { BLI_freelinkN(modifiers, fcm); - else { + return 1; + } else { // XXX this case can probably be removed some day, as it shouldn't happen... printf("remove_fmodifier() - no modifier stack given \n"); MEM_freeN(fcm); + return 0; + } +} +int remove_fmodifier_index (ListBase *modifiers, int index) +{ + FModifier *fcm= BLI_findlink(modifiers, index); + if(fcm) { + return remove_fmodifier(modifiers, fcm); + } + else { + return 0; } } |