[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25543] trunk/blender/source/blender: Reverted the addition of the f-curve sound modifier ( was added in revision 24759) due to unusability and performance issues.
Joerg Mueller
nexyon at gmail.com
Thu Dec 24 15:01:22 CET 2009
Revision: 25543
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25543
Author: nexyon
Date: 2009-12-24 15:01:22 +0100 (Thu, 24 Dec 2009)
Log Message:
-----------
Reverted the addition of the f-curve sound modifier (was added in revision 24759) due to unusability and performance issues. The ability to use a sound as animation source will be added as an import operator later that renders a sound to an f-curve which brings the advantage that you can edit the generated curve later and the disadvantage it is not automatically updated when the sound changes.
Revision Links:
--------------
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24759
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/fmodifier.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/editors/animation/fmodifier_ui.c
trunk/blender/source/blender/editors/include/ED_anim_api.h
trunk/blender/source/blender/editors/space_graph/graph_buttons.c
trunk/blender/source/blender/editors/space_nla/nla_buttons.c
trunk/blender/source/blender/makesdna/DNA_anim_types.h
trunk/blender/source/blender/makesrna/RNA_access.h
trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
Modified: trunk/blender/source/blender/blenkernel/intern/fmodifier.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/fmodifier.c 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/blenkernel/intern/fmodifier.c 2009-12-24 14:01:22 UTC (rev 25543)
@@ -53,8 +53,6 @@
#include "RNA_access.h"
#include "RNA_types.h"
-#include "AUD_C-API.h"
-
#ifndef DISABLE_PYTHON
#include "BPY_extern.h" /* for BPY_pydriver_eval() */
#endif
@@ -873,96 +871,6 @@
fcm_limits_evaluate /* evaluate */
};
-/* Sound F-Curve Modifier --------------------------- */
-
-static void fcm_sound_new_data (void *mdata)
-{
- FMod_Sound *data= (FMod_Sound *)mdata;
-
- /* defaults */
- data->strength= 1.0f;
- data->delay = 0.0f;
- data->modification = FCM_SOUND_MODIF_REPLACE;
- data->sound = NULL;
-}
-
-static void fcm_sound_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
-{
- FMod_Sound *data= (FMod_Sound *)fcm->data;
- float amplitude;
-
- AUD_Device *device;
- AUD_Sound *limiter;
- AUD_SoundInfo info;
-
- // XXX fixme - need to get in terms of time instead of frames to be really useful
-// evaltime = FRA2TIME(evaltime);
- evaltime -= data->delay;
-
- /* sound-system cannot cope with negative times/frames */
- if (evaltime < 0.0f)
- return;
- /* must have a sound with a cache so that this can be used */
- if (ELEM(NULL, data->sound, data->sound->cache))
- return;
-
- /* examine this snippet of the wave, and extract the amplitude from it */
- info = AUD_getInfo(data->sound->cache);
- info.specs.channels = 1;
- info.specs.format = AUD_FORMAT_FLOAT32;
- device = AUD_openReadDevice(info.specs);
- limiter = AUD_limitSound(data->sound->cache, evaltime, evaltime + 1);
- AUD_playDevice(device, limiter);
- AUD_unload(limiter);
- AUD_readDevice(device, (sample_t*)&litude, 1);
- AUD_closeReadDevice(device);
-
- /* combine the amplitude with existing motion data */
- switch (data->modification) {
- case FCM_SOUND_MODIF_ADD:
- *cvalue= *cvalue + amplitude * data->strength;
- break;
- case FCM_SOUND_MODIF_SUBTRACT:
- *cvalue= *cvalue - amplitude * data->strength;
- break;
- case FCM_SOUND_MODIF_MULTIPLY:
- *cvalue= *cvalue * amplitude * data->strength;
- break;
- case FCM_SOUND_MODIF_REPLACE:
- default:
- *cvalue= *cvalue + amplitude * data->strength;
- break;
- }
-}
-
-static float fcm_sound_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime)
-{
- FMod_Sound *data= (FMod_Sound *)fcm->data;
-
- /* check for the time delay */
-// evaltime = FRA2TIME(evaltime);
- if(evaltime < data->delay)
- return data->delay;
-
- /* modifier doesn't change time */
- return evaltime;
-}
-
-static FModifierTypeInfo FMI_SOUND = {
- FMODIFIER_TYPE_SOUND, /* type */
- sizeof(FMod_Sound), /* size */
- FMI_TYPE_REPLACE_VALUES, /* action type */
- 0, /* requirements */
- "Sound", /* name */
- "FMod_Sound", /* struct name */
- NULL, /* free data */
- NULL, /* copy data */
- fcm_sound_new_data, /* new data */
- NULL, /* verify */
- fcm_sound_time, /* evaluate time */
- fcm_sound_evaluate /* evaluate */
-};
-
/* F-Curve Modifier API --------------------------- */
/* All of the F-Curve Modifier api functions use FModifierTypeInfo structs to carry out
* and operations that involve F-Curve modifier specific code.
@@ -984,7 +892,6 @@
fmodifiersTypeInfo[6]= NULL/*&FMI_FILTER*/; /* Filter F-Curve Modifier */ // XXX unimplemented
fmodifiersTypeInfo[7]= &FMI_PYTHON; /* Custom Python F-Curve Modifier */
fmodifiersTypeInfo[8]= &FMI_LIMITS; /* Limits F-Curve Modifier */
- fmodifiersTypeInfo[9]= &FMI_SOUND; /* Sound F-Curve Modifier */
}
/* This function should be used for getting the appropriate type-info when only
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2009-12-24 14:01:22 UTC (rev 25543)
@@ -1695,12 +1695,6 @@
data->script = newlibadr(fd, id->lib, data->script);
}
break;
- case FMODIFIER_TYPE_SOUND:
- {
- FMod_Sound *data= (FMod_Sound *)fcm->data;
- data->sound = newlibadr(fd, id->lib, data->sound);
- }
- break;
}
}
}
@@ -10663,13 +10657,6 @@
expand_doit(fd, mainvar, data->script);
}
break;
- case FMODIFIER_TYPE_SOUND:
- {
- FMod_Sound *data= (FMod_Sound *)fcm->data;
-
- expand_doit(fd, mainvar, data->sound);
- }
- break;
}
}
}
Modified: trunk/blender/source/blender/editors/animation/fmodifier_ui.c
===================================================================
--- trunk/blender/source/blender/editors/animation/fmodifier_ui.c 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/editors/animation/fmodifier_ui.c 2009-12-24 14:01:22 UTC (rev 25543)
@@ -321,45 +321,6 @@
/* --------------- */
-/* draw settings for sound modifier */
-static void draw_modifier__sound(const bContext *C, uiLayout *layout, ID *id, FModifier *fcm, short width)
-{
- FMod_Sound *data= (FMod_Sound *)fcm->data;
- PointerRNA ptr;
-
- /* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierSound, fcm, &ptr);
-
- /* sound */
- uiTemplateID(layout, (bContext*)C, &ptr, "sound", NULL, "sound.open", NULL);
-
- if (data->sound)
- {
- /* only sounds that are cached can be used, so display error if not cached */
- if (data->sound->cache)
- {
- /* blending mode */
- uiItemR(layout, NULL, 0, &ptr, "modification", 0);
-
- /* settings */
- uiItemR(layout, NULL, 0, &ptr, "strength", 0);
- uiItemR(layout, NULL, 0, &ptr, "delay", 0);
- }
- else
- {
- PointerRNA id_ptr;
-
- RNA_id_pointer_create((ID *)data->sound, &id_ptr);
-
- /* error message with a button underneath allowing users to rectify the issue */
- uiItemL(layout, "Sound must be cached.", ICON_ERROR);
- uiItemR(layout, NULL, 0, &id_ptr, "caching", UI_ITEM_R_TOGGLE);
- }
- }
-}
-
-/* --------------- */
-
#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001
/* Binary search algorithm for finding where to insert Envelope Data Point.
@@ -623,7 +584,7 @@
/* --------------- */
-void ANIM_uiTemplate_fmodifier_draw (const bContext *C, uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
{
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *subrow;
@@ -704,15 +665,11 @@
case FMODIFIER_TYPE_LIMITS: /* Limits */
draw_modifier__limits(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_NOISE: /* Noise */
draw_modifier__noise(box, id, fcm, width);
break;
-
- case FMODIFIER_TYPE_SOUND: /* Sound */
- draw_modifier__sound(C, box, id, fcm, width);
- break;
-
+
default: /* unknown type */
break;
}
Modified: trunk/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_anim_api.h 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/editors/include/ED_anim_api.h 2009-12-24 14:01:22 UTC (rev 25543)
@@ -428,7 +428,7 @@
/* F-MODIFIER TOOLS */
/* draw a given F-Modifier for some layout/UI-Block */
-void ANIM_uiTemplate_fmodifier_draw(const struct bContext *C, struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
+void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
/* ************************************************* */
/* ASSORTED TOOLS */
Modified: trunk/blender/source/blender/editors/space_graph/graph_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_buttons.c 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/editors/space_graph/graph_buttons.c 2009-12-24 14:01:22 UTC (rev 25543)
@@ -452,7 +452,7 @@
for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) {
col= uiLayoutColumn(pa->layout, 1);
- ANIM_uiTemplate_fmodifier_draw(C, col, ale->id, &fcu->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
}
MEM_freeN(ale);
Modified: trunk/blender/source/blender/editors/space_nla/nla_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_buttons.c 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/editors/space_nla/nla_buttons.c 2009-12-24 14:01:22 UTC (rev 25543)
@@ -434,7 +434,7 @@
for (fcm= strip->modifiers.first; fcm; fcm= fcm->next) {
col= uiLayoutColumn(pa->layout, 1);
- ANIM_uiTemplate_fmodifier_draw(C, col, strip_ptr.id.data, &strip->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, &strip->modifiers, fcm);
}
}
Modified: trunk/blender/source/blender/makesdna/DNA_anim_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_anim_types.h 2009-12-24 11:40:14 UTC (rev 25542)
+++ trunk/blender/source/blender/makesdna/DNA_anim_types.h 2009-12-24 14:01:22 UTC (rev 25543)
@@ -36,7 +36,6 @@
#include "DNA_listBase.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
-#include "DNA_sound_types.h"
/* ************************************************ */
/* F-Curve DataTypes */
@@ -74,7 +73,6 @@
FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */
FMODIFIER_TYPE_PYTHON,
FMODIFIER_TYPE_LIMITS,
- FMODIFIER_TYPE_SOUND,
/* NOTE: all new modifiers must be added above this line */
FMODIFIER_NUM_TYPES
@@ -232,25 +230,6 @@
FCM_NOISE_MODIF_MULTIPLY, /* Multiply the curve by noise */
} eFMod_Noise_Modifications;
-/* sound modifier data */
-typedef struct FMod_Sound {
- float strength;
- float delay;
-
- short modification;
- short pad[3];
-
- bSound *sound;
-} FMod_Sound;
-
-/* modification modes */
-typedef enum eFMod_Sound_Modifications {
- FCM_SOUND_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */
- FCM_SOUND_MODIF_ADD, /* Add amplitude to the curve */
- FCM_SOUND_MODIF_SUBTRACT, /* Subtract amplitude from the curve */
- FCM_SOUND_MODIF_MULTIPLY, /* Multiply the curve by amplitude */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list