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
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2010-05-30 01:22:24 +0400
committerMitchell Stokes <mogurijin@gmail.com>2010-05-30 01:22:24 +0400
commit9d3157eed000e7c543d04f5ad3efc5990675903b (patch)
tree54d3fcbc7a128ef0881385f49c57392c38bbd7e0 /source/blender/editors/sound/sound_ops.c
parente335321e884f270e2ad28a7b6c75eea7e11bf4b7 (diff)
Reversing the last merge because I botched it.
Diffstat (limited to 'source/blender/editors/sound/sound_ops.c')
-rw-r--r--source/blender/editors/sound/sound_ops.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index be4f6ff0570..376db0d3d58 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -30,13 +30,10 @@
#include <stdlib.h>
#include <stdio.h>
-#include "MEM_guardedalloc.h"
-
#include "DNA_packedFile_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_sequence_types.h"
-#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -64,30 +61,17 @@
/******************** open sound operator ********************/
-static void open_init(bContext *C, wmOperator *op)
-{
- PropertyPointerRNA *pprop;
-
- op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
- uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
-}
-
static int open_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
bSound *sound;
- PropertyPointerRNA *pprop;
- PointerRNA idptr;
AUD_SoundInfo info;
RNA_string_get(op->ptr, "path", path);
+
sound = sound_new_file(CTX_data_main(C), path);
- if(!op->customdata)
- open_init(C, op);
-
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;
}
@@ -96,7 +80,6 @@ static int open_exec(bContext *C, wmOperator *op)
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(C, sound);
- if(op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@@ -104,34 +87,12 @@ static int open_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "cache")) {
sound_cache(sound, 0);
}
-
- /* hook into UI */
- pprop= op->customdata;
-
- if(pprop->prop) {
- /* when creating new ID blocks, use is already 1, but RNA
- * pointer se also increases user, so this compensates it */
- sound->id.us--;
-
- RNA_id_pointer_create(&sound->id, &idptr);
- RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
- RNA_property_update(C, &pprop->ptr, pprop->prop);
- }
- MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
}
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
- if(RNA_property_is_set(op->ptr, "path"))
- return open_exec(C, op);
-
- open_init(C, op);
-
return WM_operator_filesel(C, op, event);
}
@@ -152,7 +113,6 @@ void SOUND_OT_open(wmOperatorType *ot)
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
- RNA_def_boolean(ot->srna, "relative_path", FALSE, "Relative Path", "Load image with relative path to current .blend file");
}
/* ******************************************************* */