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:
authorStephen Swaney <sswaney@centurytel.net>2005-03-27 17:28:49 +0400
committerStephen Swaney <sswaney@centurytel.net>2005-03-27 17:28:49 +0400
commit9fc58498129c284bdbab7b56eed2b9586ea91539 (patch)
treea38e593c77c501d1d93767f9dd3e7cb8441bcb71 /source/blender/python/api2_2x/Camera.c
parent577f822a4003315b779f383d55d708c842907075 (diff)
New Bpy method: Camera.insertIpoKey()
Contributed by Johnny Matthews (guitarGeek)
Diffstat (limited to 'source/blender/python/api2_2x/Camera.c')
-rw-r--r--source/blender/python/api2_2x/Camera.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
index 5db45ad16e9..a6d06512ecb 100644
--- a/source/blender/python/api2_2x/Camera.c
+++ b/source/blender/python/api2_2x/Camera.c
@@ -25,7 +25,7 @@
*
* This is a new part of Blender.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): Willian P. Germano, Johnny Matthews
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -35,6 +35,10 @@
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
+#include <BIF_editview.h>
+#include <BSE_editipo.h>
+#include <BIF_space.h>
+#include <mydevice.h>
#include <Python.h>
@@ -45,6 +49,9 @@
#include "Ipo.h"
+#define IPOKEY_LENS 0
+#define IPOKEY_CLIPPING 1
+
/*****************************************************************************/
/* Python API function prototypes for the Camera module. */
/*****************************************************************************/
@@ -119,6 +126,7 @@ static PyObject *Camera_setScale( BPy_Camera * self, PyObject * args );
static PyObject *Camera_getScriptLinks( BPy_Camera * self, PyObject * args );
static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args );
static PyObject *Camera_clearScriptLinks( BPy_Camera * self );
+static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args );
Camera *GetCameraByName( char *name );
@@ -151,6 +159,8 @@ static PyMethodDef BPy_Camera_methods[] = {
"(Blender Ipo) - Set Camera Ipo"},
{"clearIpo", ( PyCFunction ) Camera_clearIpo, METH_NOARGS,
"() - Unlink Ipo from this Camera."},
+ {"insertIpoKey", ( PyCFunction ) Camera_insertIpoKey, METH_VARARGS,
+ "( Camera IPO type ) - Inserts a key into IPO"},
{"setName", ( PyCFunction ) Camera_setName, METH_VARARGS,
"(s) - Set Camera Data name"},
{"setType", ( PyCFunction ) Camera_setType, METH_VARARGS,
@@ -347,6 +357,9 @@ PyObject *Camera_Init( void )
submodule = Py_InitModule3( "Blender.Camera",
M_Camera_methods, M_Camera_doc );
+ PyModule_AddIntConstant( submodule, "LENS", IPOKEY_LENS );
+ PyModule_AddIntConstant( submodule, "CLIPPING", IPOKEY_CLIPPING );
+
return submodule;
}
@@ -942,3 +955,33 @@ static PyObject *Camera_repr( BPy_Camera * self )
return PyString_FromFormat( "[Camera \"%s\"]",
self->camera->id.name + 2 );
}
+
+/*
+ * Camera_insertIpoKey()
+ * inserts Camera IPO key for LENS and CLIPPING
+ */
+
+static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args )
+{
+ int key = 0;
+
+ if( !PyArg_ParseTuple( args, "i", &( key ) ) )
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected int argument" ) );
+
+ if (key == IPOKEY_LENS){
+ insertkey((ID *)self->camera, CAM_LENS);
+ }
+ else if (key == IPOKEY_CLIPPING){
+ insertkey((ID *)self->camera, CAM_STA);
+ insertkey((ID *)self->camera, CAM_END);
+ }
+
+ allspace(REMAKEIPO, 0);
+ EXPP_allqueue(REDRAWIPO, 0);
+ EXPP_allqueue(REDRAWVIEW3D, 0);
+ EXPP_allqueue(REDRAWACTION, 0);
+ EXPP_allqueue(REDRAWNLA, 0);
+
+ return EXPP_incr_ret( Py_None );
+}