[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46966] trunk/blender/source/blender/ editors/sound/sound_ops.c: style cleanup
Campbell Barton
ideasman42 at gmail.com
Thu May 24 12:16:42 CEST 2012
Revision: 46966
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46966
Author: campbellbarton
Date: 2012-05-24 10:16:42 +0000 (Thu, 24 May 2012)
Log Message:
-----------
style cleanup
Modified Paths:
--------------
trunk/blender/source/blender/editors/sound/sound_ops.c
Modified: trunk/blender/source/blender/editors/sound/sound_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sound/sound_ops.c 2012-05-24 10:15:38 UTC (rev 46965)
+++ trunk/blender/source/blender/editors/sound/sound_ops.c 2012-05-24 10:16:42 UTC (rev 46966)
@@ -80,7 +80,7 @@
static int sound_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
return OPERATOR_CANCELLED;
}
@@ -88,7 +88,7 @@
{
PropertyPointerRNA *pprop;
- op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
+ op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
@@ -108,7 +108,7 @@
if (!op->customdata)
sound_open_init(C, op);
- if (sound==NULL || sound->playback_handle == NULL) {
+ if (sound == NULL || sound->playback_handle == NULL) {
if (op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
@@ -133,7 +133,7 @@
}
/* hook into UI */
- pprop= op->customdata;
+ pprop = op->customdata;
if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
@@ -183,10 +183,10 @@
ot->cancel = sound_open_cancel;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono");
}
@@ -204,10 +204,10 @@
ot->cancel = sound_open_cancel;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
RNA_def_boolean(ot->srna, "mono", TRUE, "Mono", "Mixdown the sound to mono");
}
@@ -216,12 +216,12 @@
static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
{
- Sequence* seq;
- Scene* scene = CTX_data_scene(C);
- struct FCurve* fcu;
+ Sequence *seq;
+ Scene *scene = CTX_data_scene(C);
+ struct FCurve *fcu;
char driven;
- SEQ_BEGIN (scene->ed, seq)
+ SEQ_BEGIN(scene->ed, seq)
{
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
if (fcu || driven)
@@ -243,7 +243,7 @@
}
SEQ_END
- fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
+ fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
if (fcu || driven)
scene->audio.flag |= AUDIO_VOLUME_ANIMATED;
else
@@ -277,8 +277,8 @@
static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main* bmain = CTX_data_main(C);
- Scene* scene = CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
int oldfra = scene->r.cfra;
int cfra;
@@ -325,7 +325,7 @@
AUD_DeviceSpecs specs;
AUD_Container container;
AUD_Codec codec;
- const char* result;
+ const char *result;
sound_bake_animation_exec(C, op);
@@ -393,18 +393,14 @@
{
AUD_Container container = RNA_enum_get(op->ptr, "container");
- const char* extension = NULL;
+ const char *extension = NULL;
- EnumPropertyItem* item = container_items;
- while(item->identifier != NULL)
- {
- if(item->value == container)
- {
- const char** ext = snd_ext_sound;
- while(*ext != NULL)
- {
- if(!strcmp(*ext + 1, item->name))
- {
+ EnumPropertyItem *item = container_items;
+ while (item->identifier != NULL) {
+ if (item->value == container) {
+ const char **ext = snd_ext_sound;
+ while (*ext != NULL) {
+ if (!strcmp(*ext + 1, item->name)) {
extension = *ext;
break;
}
@@ -424,12 +420,12 @@
prop = RNA_struct_find_property(op->ptr, "filepath");
RNA_property_string_get(op->ptr, prop, filepath);
- if(BLI_testextensie_array(filepath, snd_ext_sound))
+ if (BLI_testextensie_array(filepath, snd_ext_sound))
check = BLI_replace_extension(filepath, FILE_MAX, extension);
else
check = BLI_ensure_extension(filepath, FILE_MAX, extension);
- if(!check)
+ if (!check)
return check;
RNA_property_string_set(op->ptr, prop, filepath);
@@ -453,11 +449,10 @@
static int sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- const char *prop_id= RNA_property_identifier(prop);
- return !( strcmp(prop_id, "filepath") == 0 ||
- strcmp(prop_id, "directory") == 0 ||
- strcmp(prop_id, "filename") == 0
- );
+ const char *prop_id = RNA_property_identifier(prop);
+ return !(strcmp(prop_id, "filepath") == 0 ||
+ strcmp(prop_id, "directory") == 0 ||
+ strcmp(prop_id, "filename") == 0);
}
static void sound_mixdown_draw(bContext *C, wmOperator *op)
@@ -471,23 +466,27 @@
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
{AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"},
{AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
static EnumPropertyItem mp3_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
static EnumPropertyItem ac3_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
#ifdef WITH_SNDFILE
static EnumPropertyItem flac_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
#endif
static EnumPropertyItem all_codec_items[] = {
@@ -498,15 +497,17 @@
{AUD_CODEC_MP3, "MP3", 0, "MP3", "MPEG-2 Audio Layer III"},
{AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
static EnumPropertyItem ogg_codec_items[] = {
{AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+ };
uiLayout *layout = op->layout;
- wmWindowManager *wm= CTX_wm_manager(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
PropertyRNA *prop_format;
PropertyRNA *prop_codec;
@@ -524,84 +525,84 @@
RNA_def_property_flag(prop_format, PROP_HIDDEN);
switch (container) {
- case AUD_CONTAINER_AC3:
- RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
- RNA_def_property_enum_items(prop_format, ac3_format_items);
- RNA_def_property_enum_items(prop_codec, all_codec_items);
- RNA_enum_set(op->ptr, "codec", AUD_CODEC_AC3);
- break;
- case AUD_CONTAINER_FLAC:
- RNA_def_property_flag(prop_bitrate, PROP_HIDDEN);
- RNA_def_property_enum_items(prop_codec, all_codec_items);
- RNA_enum_set(op->ptr, "codec", AUD_CODEC_FLAC);
+ case AUD_CONTAINER_AC3:
+ RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
+ RNA_def_property_enum_items(prop_format, ac3_format_items);
+ RNA_def_property_enum_items(prop_codec, all_codec_items);
+ RNA_enum_set(op->ptr, "codec", AUD_CODEC_AC3);
+ break;
+ case AUD_CONTAINER_FLAC:
+ RNA_def_property_flag(prop_bitrate, PROP_HIDDEN);
+ RNA_def_property_enum_items(prop_codec, all_codec_items);
+ RNA_enum_set(op->ptr, "codec", AUD_CODEC_FLAC);
#ifdef WITH_SNDFILE
- RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
- RNA_def_property_enum_items(prop_format, flac_format_items);
+ RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
+ RNA_def_property_enum_items(prop_format, flac_format_items);
#else
- RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
+ RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
#endif
- break;
- case AUD_CONTAINER_MATROSKA:
- RNA_def_property_clear_flag(prop_codec, PROP_HIDDEN);
- RNA_def_property_enum_items(prop_codec, all_codec_items);
+ break;
+ case AUD_CONTAINER_MATROSKA:
+ RNA_def_property_clear_flag(prop_codec, PROP_HIDDEN);
+ RNA_def_property_enum_items(prop_codec, all_codec_items);
- switch (codec) {
- case AUD_CODEC_AAC:
+ switch (codec) {
+ case AUD_CODEC_AAC:
+ RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
+ break;
+ case AUD_CODEC_AC3:
+ RNA_def_property_enum_items(prop_format, ac3_format_items);
+ RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
+ break;
+ case AUD_CODEC_FLAC:
+ RNA_def_property_flag(prop_bitrate, PROP_HIDDEN);
+ RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
+ break;
+ case AUD_CODEC_MP2:
+ RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
+ break;
+ case AUD_CODEC_MP3:
+ RNA_def_property_enum_items(prop_format, mp3_format_items);
+ RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
+ break;
+ case AUD_CODEC_PCM:
+ RNA_def_property_flag(prop_bitrate, PROP_HIDDEN);
+ RNA_def_property_enum_items(prop_format, pcm_format_items);
+ RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
+ break;
+ case AUD_CODEC_VORBIS:
+ RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
+ break;
+ default:
+ break;
+ }
+
+ break;
+ case AUD_CONTAINER_MP2:
RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
+ RNA_enum_set(op->ptr, "codec", AUD_CODEC_MP2);
+ RNA_def_property_enum_items(prop_codec, all_codec_items);
break;
- case AUD_CODEC_AC3:
- RNA_def_property_enum_items(prop_format, ac3_format_items);
+ case AUD_CONTAINER_MP3:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list