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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-10-20 09:51:24 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-10-20 09:51:24 +0400
commitfa9135385a38c9289a2dfa2320c20b68d782c1e4 (patch)
treef011e964789f9d9c37f18dfc72de661a525ecf3c /source/blender/python/api2_2x/Sound.c
parentf2f004af2df9733761cf9d4888e883a8c5f0d3e9 (diff)
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks); - added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos); - Blender.Image: added image.glFree() to free textures bound by the recently added image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can be used to load textures for scripts); - Blender.Sound: removed for now at least a few get/set methods of vars that can't be accessed via interface; - renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney pointed this some weeks ago, we should stick to one naming convention. - added documentation for Sound and Window.Theme modules and the other added functions, made other small updates. - Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix: after reading a discussion on blender.org's Python forum where eeshlo mentioned the pre 2.34 default was worldspace, I took a better look at Blender's relevant code, confirmed, talked to Theeth about this and as he suggested am changing the default back to 'worldspace'.
Diffstat (limited to 'source/blender/python/api2_2x/Sound.c')
-rw-r--r--source/blender/python/api2_2x/Sound.c86
1 files changed, 48 insertions, 38 deletions
diff --git a/source/blender/python/api2_2x/Sound.c b/source/blender/python/api2_2x/Sound.c
index ca5b24c8a3d..eb8b5094b58 100644
--- a/source/blender/python/api2_2x/Sound.c
+++ b/source/blender/python/api2_2x/Sound.c
@@ -48,11 +48,16 @@
/* Python BPy_Sound defaults: */
/*****************************************************************************/
+#define EXPP_SND_volume_MIN 0.0
+#define EXPP_SND_volume_MAX 1.0
+#define EXPP_SND_pitch_MIN -12.0
+#define EXPP_SND_pitch_MAX 12.0
+#define EXPP_SND_attenuation_MIN 0.0
+#define EXPP_SND_attenuation_MAX 5.0
+
/*****************************************************************************/
/* Python API function prototypes for the Sound module. */
/*****************************************************************************/
-static PyObject *M_Sound_New( PyObject * self, PyObject * args,
- PyObject * keywords );
static PyObject *M_Sound_Get( PyObject * self, PyObject * args );
static PyObject *M_Sound_Load( PyObject * self, PyObject * args );
@@ -63,26 +68,20 @@ static PyObject *M_Sound_Load( PyObject * self, PyObject * args );
/************************************************************************/
static char M_Sound_doc[] = "The Blender Sound module\n\n";
-static char M_Sound_New_doc[] =
- "() - return a new Sound object -- unimplemented";
-
static char M_Sound_Get_doc[] =
"(name) - return the sound with the name 'name', \
returns None if not found.\n If 'name' is not specified, \
it returns a list of all sounds in the\ncurrent scene.";
static char M_Sound_Load_doc[] =
- "(filename, redraw = 0) - return sound from file filename as Sound Object,\n\
+ "(filename) - return sound from file filename as a Sound Object,\n\
returns None if not found.";
/*****************************************************************************/
/* Python method structure definition for Blender.Sound module: */
/*****************************************************************************/
struct PyMethodDef M_Sound_methods[] = {
- {"New", ( PyCFunction ) M_Sound_New, METH_VARARGS | METH_KEYWORDS,
- M_Sound_New_doc},
{"Get", M_Sound_Get, METH_VARARGS, M_Sound_Get_doc},
- {"get", M_Sound_Get, METH_VARARGS, M_Sound_Get_doc},
{"Load", M_Sound_Load, METH_VARARGS, M_Sound_Load_doc},
{NULL, NULL, 0, NULL}
};
@@ -109,7 +108,8 @@ static PyObject *Sound_set ## funcname(BPy_Sound *self, PyObject *args) { \
if (!PyArg_ParseTuple(args, "f", &f)) \
return (EXPP_ReturnPyObjError (PyExc_TypeError, \
"expected float argument")); \
- self->sound->varname = f; \
+ self->sound->varname = EXPP_ClampFloat(f,\
+ EXPP_SND_##varname##_MIN, EXPP_SND_##varname##_MAX);\
Py_INCREF(Py_None); \
return Py_None; \
}
@@ -127,14 +127,18 @@ static PyObject *Sound_set ## funcname(BPy_Sound *self, PyObject *args) { \
static PyObject *Sound_getName( BPy_Sound * self );
static PyObject *Sound_getFilename( BPy_Sound * self );
static PyObject *Sound_play( BPy_Sound * self );
-static PyObject *Sound_makeActive( BPy_Sound * self );
+static PyObject *Sound_setCurrent( BPy_Sound * self );
+//static PyObject *Sound_reload ( BPy_Sound * self );
SOUND_FLOAT_METHODS( Volume, volume )
- SOUND_FLOAT_METHODS( Panning, panning )
- SOUND_FLOAT_METHODS( Attenuation, attenuation )
- SOUND_FLOAT_METHODS( Pitch, pitch )
- SOUND_FLOAT_METHODS( MinGain, min_gain )
- SOUND_FLOAT_METHODS( MaxGain, max_gain )
- SOUND_FLOAT_METHODS( Distance, distance )
+SOUND_FLOAT_METHODS( Attenuation, attenuation )
+SOUND_FLOAT_METHODS( Pitch, pitch )
+/* these can't be set via interface, removed for now */
+/*
+SOUND_FLOAT_METHODS( Panning, panning )
+SOUND_FLOAT_METHODS( MinGain, min_gain )
+SOUND_FLOAT_METHODS( MaxGain, max_gain )
+SOUND_FLOAT_METHODS( Distance, distance )
+*/
/*****************************************************************************/
/* Python BPy_Sound methods table: */
@@ -147,15 +151,21 @@ static PyMethodDef BPy_Sound_methods[] = {
"() - Return Sound object filename"},
{"play", ( PyCFunction ) Sound_play, METH_NOARGS,
"() - play this sound"},
- {"makeActive", ( PyCFunction ) Sound_makeActive, METH_NOARGS,
+ {"setCurrent", ( PyCFunction ) Sound_setCurrent, METH_NOARGS,
"() - make this the active sound in the sound buttons win (also redraws)"},
+ //{"reload", ( PyCFunction ) Sound_setCurrent, METH_NOARGS,
+ //"() - reload this Sound object's sample.\n\
+//This is only useful if the original sound file has changed."},
SOUND_FLOAT_METHOD_FUNCS( Volume )
- SOUND_FLOAT_METHOD_FUNCS( Panning )
- SOUND_FLOAT_METHOD_FUNCS( Attenuation )
- SOUND_FLOAT_METHOD_FUNCS( Pitch )
- SOUND_FLOAT_METHOD_FUNCS( MinGain )
- SOUND_FLOAT_METHOD_FUNCS( MaxGain )
- SOUND_FLOAT_METHOD_FUNCS( Distance ) {NULL, NULL, 0, NULL}
+ SOUND_FLOAT_METHOD_FUNCS( Attenuation )
+ SOUND_FLOAT_METHOD_FUNCS( Pitch )
+ /*
+ SOUND_FLOAT_METHOD_FUNCS( Panning )
+ SOUND_FLOAT_METHOD_FUNCS( MinGain )
+ SOUND_FLOAT_METHOD_FUNCS( MaxGain )
+ SOUND_FLOAT_METHOD_FUNCS( Distance )
+ */
+ {NULL, NULL, 0, NULL}
};
/*****************************************************************************/
@@ -185,19 +195,6 @@ PyTypeObject Sound_Type = {
0, /* tp_members */
};
-/*****************************************************************************/
-/* Function: M_Sound_New */
-/* Python equivalent: Blender.Sound.New */
-/*****************************************************************************/
-static PyObject *M_Sound_New( PyObject * self, PyObject * args,
- PyObject * keywords )
-{
- printf( "In Sound_New() - unimplemented in 2.34\n" );
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
/* NOTE: these were copied and modified from image.h. To Be Done TBD:
* macro-ize them, or C++ templates eventually?
*/
@@ -417,7 +414,7 @@ static PyObject *Sound_play( BPy_Sound * self )
return Py_None;
}
-static PyObject *Sound_makeActive( BPy_Sound * self )
+static PyObject *Sound_setCurrent( BPy_Sound * self )
{
bSound *snd_ptr = self->sound;
@@ -433,6 +430,19 @@ static PyObject *Sound_makeActive( BPy_Sound * self )
Py_INCREF( Py_None );
return Py_None;
}
+/*
+static PyObject *Sound_reload( BPy_Sound * self)
+{
+ sound_free_sample();
+
+ if (sound->snd_sound) {
+ SND_RemoveSound(ghSoundScene, sound->snd_sound);
+ sound->snd_sound = NULL;
+ }
+
+ return EXPP_incr_ret( Py_None );
+}
+*/
/*****************************************************************************/
/* Function: Sound_getAttr */