Page Menu
Home
Search
Configure Global Search
Log In
Files
F1575
World.c.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Johnny Matthews (guitargeek)
Nov 13 2013, 12:58 PM
Size
4 KB
Subscribers
None
World.c.patch
View Options
Index: source/blender/python/api2_2x/World.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/World.c,v
retrieving revision 1.26
diff -u -r1.26 World.c
--- source/blender/python/api2_2x/World.c 9 Feb 2005 15:53:35 -0000 1.26
+++ source/blender/python/api2_2x/World.c 21 Mar 2005 21:30:17 -0000
@@ -25,7 +25,7 @@
*
* This is a new part of Blender.
*
- * Contributor(s): Jacques Guignot
+ * Contributor(s): Jacques Guignot, Johnny Matthews
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -48,16 +48,24 @@
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
+#include <BSE_editipo.h>
#include <DNA_scene_types.h> /* for G.scene */
#include "World.h"
#include "Ipo.h"
+#include "modules.h"
#include "constant.h"
+#include "rgbTuple.h"
#include "gen_utils.h"
-
+#define IPOKEY_ZENITH 0
+#define IPOKEY_HORIZON 1
+#define IPOKEY_MIST 2
+#define IPOKEY_STARS 3
+#define IPOKEY_OFFSET 4
+#define IPOKEY_SIZE 5
/*****************************************************************************/
/* Python BPy_World methods declarations: */
/*****************************************************************************/
@@ -66,6 +74,7 @@
static PyObject *World_getIpo( BPy_World * self );
static PyObject *World_setIpo( BPy_World * self, PyObject * args );
static PyObject *World_clearIpo( BPy_World * self );
+static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args );
static PyObject *World_getName( BPy_World * self );
static PyObject *World_setName( BPy_World * self, PyObject * args );
static PyObject *World_getMode( BPy_World * self );
@@ -211,7 +220,10 @@
{"setCurrent", ( PyCFunction ) World_setCurrent, METH_NOARGS,
"() - Makes this world the active world for the current scene."},
{"makeActive", ( PyCFunction ) World_setCurrent, METH_NOARGS,
- "please use setCurrent instead, this alias will be removed."},
+ "please use setCurrent instead, this alias will be removed."},
+ {"insertIpoKey", ( PyCFunction ) World_insertIpoKey, METH_VARARGS,
+ "( World IPO type ) - Inserts a key into the IPO"},
+
{NULL, NULL, 0, NULL}
};
@@ -398,7 +410,14 @@
submodule = Py_InitModule3( "Blender.World",
M_World_methods, M_World_doc );
-
+
+ PyModule_AddIntConstant( submodule, "ZENITH", IPOKEY_ZENITH );
+ PyModule_AddIntConstant( submodule, "HORIZON", IPOKEY_HORIZON );
+ PyModule_AddIntConstant( submodule, "MIST", IPOKEY_MIST );
+ PyModule_AddIntConstant( submodule, "STARS", IPOKEY_STARS );
+ PyModule_AddIntConstant( submodule, "OFFSET", IPOKEY_OFFSET );
+ PyModule_AddIntConstant( submodule, "SIZE", IPOKEY_SIZE );
+
return ( submodule );
}
@@ -1070,4 +1089,61 @@
/* There is no object with the given name */
return ( NULL );
+}
+/*
+ * World_insertIpoKey()
+ * inserts World IPO key for ZENITH,HORIZON,MIST,STARS,OFFSET,SIZE
+ */
+
+static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args )
+{
+ int key = 0, map;
+
+ if( !PyArg_ParseTuple( args, "i", &( key ) ) )
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected int argument" ) );
+
+ map = texchannel_to_adrcode(self->world->texact);
+
+ if(key == IPOKEY_ZENITH) {
+ insertkey((ID *)self->world, WO_ZEN_R);
+ insertkey((ID *)self->world, WO_ZEN_G);
+ insertkey((ID *)self->world, WO_ZEN_B);
+ }
+ if(key == IPOKEY_HORIZON) {
+ insertkey((ID *)self->world, WO_HOR_R);
+ insertkey((ID *)self->world, WO_HOR_G);
+ insertkey((ID *)self->world, WO_HOR_B);
+ }
+ if(key == IPOKEY_MIST) {
+ insertkey((ID *)self->world, WO_MISI);
+ insertkey((ID *)self->world, WO_MISTDI);
+ insertkey((ID *)self->world, WO_MISTSTA);
+ insertkey((ID *)self->world, WO_MISTHI);
+ }
+ if(key == IPOKEY_STARS) {
+ insertkey((ID *)self->world, WO_STAR_R);
+ insertkey((ID *)self->world, WO_STAR_G);
+ insertkey((ID *)self->world, WO_STAR_B);
+ insertkey((ID *)self->world, WO_STARDIST);
+ insertkey((ID *)self->world, WO_STARSIZE);
+ }
+ if(key == IPOKEY_OFFSET) {
+ insertkey((ID *)self->world, map+MAP_OFS_X);
+ insertkey((ID *)self->world, map+MAP_OFS_Y);
+ insertkey((ID *)self->world, map+MAP_OFS_Z);
+ }
+ if(key == IPOKEY_SIZE) {
+ insertkey((ID *)self->world, map+MAP_SIZE_X);
+ insertkey((ID *)self->world, map+MAP_SIZE_Y);
+ insertkey((ID *)self->world, map+MAP_SIZE_Z);
+ }
+
+ 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 );
}
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0b/94/45adc4eaa39a271743d270b5d616
Event Timeline
Log In to Comment