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:
authorKen Hughes <khughes@pacific.edu>2007-03-31 19:31:37 +0400
committerKen Hughes <khughes@pacific.edu>2007-03-31 19:31:37 +0400
commitbf8bb77abc3f48ab808d76863c653856a9a08507 (patch)
treeaa56abc4d066c5f9fa19e1e70858cdbc0d7f3dae /source/blender/python/api2_2x/Scene.c
parent417498a86532b3b4c228727c516c5052ef6c8227 (diff)
Python API
---------- Change deprecation printfs to print warning once instead of everytime the deprecated method is called. Also commented out deprecation warnings for code which will eventually be replaced by experimental Blender.Main/bpy module.
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r--source/blender/python/api2_2x/Scene.c67
1 files changed, 52 insertions, 15 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index bacc747ecf8..883133d33a9 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -1,4 +1,5 @@
/*
+ *
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
@@ -696,9 +697,15 @@ static PyObject *M_Scene_GetCurrent( PyObject * self )
{
return Scene_CreatePyObject( ( Scene * ) G.scene );
}
+
static PyObject *M_Scene_getCurrent_deprecated( PyObject * self )
{
- printf("Blender.Scene.getCurrent() is deprecated,\n\tuse Blender.Scene.GetCurrent() instead.\n");
+ static char warning = 1;
+ if( warning ) {
+ printf("Blender.Scene.getCurrent() is deprecated,\n\tuse Blender.Scene.GetCurrent() instead.\n");
+ --warning;
+ }
+
return Scene_CreatePyObject( ( Scene * ) G.scene );
}
@@ -759,11 +766,16 @@ static PyObject *Scene_copy( BPy_Scene * self, PyObject * args )
static PyObject *Scene_makeCurrent( BPy_Scene * self )
{
Scene *scene = self->scene;
-
+#if 0 /* add back in when bpy becomes "official" */
+ static char warning = 1;
+ if( warning ) {
+ printf("scene.makeCurrent() deprecated!\n\tuse bpy.scenes.active = scene instead\n");
+ --warning;
+ }
+#endif
+
SCENE_DEL_CHECK_PY(self);
- printf("scene.makeCurrent() deprecated!\n\tuse Blender.Main.scenes.active = scene instead\n");
-
if( scene && scene != G.scene) {
set_scene( scene );
scene_update_for_newframe(scene, scene->lay);
@@ -808,10 +820,14 @@ static PyObject *Scene_link( BPy_Scene * self, PyObject * args )
Scene *scene = self->scene;
BPy_Object *bpy_obj;
Object *object = NULL;
+ static char warning = 1;
- SCENE_DEL_CHECK_PY(self);
+ if( warning ) {
+ printf("scene.link(ob) deprecated!\n\tuse scene.objects.link(ob) instead\n");
+ --warning;
+ }
- printf("scene.link(ob) deprecated!\n\tuse scene.objects.link(ob) instead\n");
+ SCENE_DEL_CHECK_PY(self);
if( !PyArg_ParseTuple( args, "O!", &Object_Type, &bpy_obj ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -880,10 +896,14 @@ static PyObject *Scene_unlink( BPy_Scene * self, PyObject * args )
BPy_Object *bpy_obj = NULL;
Scene *scene = self->scene;
Base *base;
+ static char warning = 1;
- SCENE_DEL_CHECK_PY(self);
+ if( warning ) {
+ printf("scene.unlink(ob) deprecated!\n\tuse scene.objects.unlink(ob) instead\n");
+ --warning;
+ }
- printf("scene.unlink(ob) deprecated!\n\tuse scene.objects.unlink(ob) instead\n");
+ SCENE_DEL_CHECK_PY(self);
if( !PyArg_ParseTuple( args, "O!", &Object_Type, &bpy_obj ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -911,10 +931,15 @@ static PyObject *Scene_getChildren( BPy_Scene * self )
PyObject *bpy_obj;
Object *object;
Base *base;
+ static char warning = 1;
+
+ if( warning ) {
+ printf("scene.getChildren() deprecated!\n\tuse scene.objects instead\n");
+ --warning;
+ }
SCENE_DEL_CHECK_PY(self);
- printf("scene.getChildren() deprecated!\n\tuse scene.objects instead\n");
base = scene->base.first;
@@ -942,10 +967,14 @@ static PyObject *Scene_getActiveObject(BPy_Scene *self)
Scene *scene = self->scene;
PyObject *pyob;
Object *ob;
+ static char warning = 1;
- SCENE_DEL_CHECK_PY(self);
+ if( warning ) {
+ printf("scene.getActiveObject() deprecated!\n\tuse scene.objects.active instead\n");
+ --warning;
+ }
- printf("scene.getActiveObject() deprecated!\n\tuse scene.objects.active instead\n");
+ SCENE_DEL_CHECK_PY(self);
ob = ((scene->basact) ? (scene->basact->object) : 0);
@@ -968,10 +997,14 @@ static PyObject *Scene_getCurrentCamera( BPy_Scene * self )
Object *cam_obj;
PyObject *pyob;
Scene *scene = self->scene;
+ static char warning = 1;
+ if( warning ) {
+ printf("scene.getCurrentCamera() deprecated!\n\tuse scene.objects.camera instead\n");
+ --warning;
+ }
+
SCENE_DEL_CHECK_PY(self);
-
- printf("scene.getCurrentCamera() deprecated!\n\tGet scene.objects.camera instead\n");
cam_obj = scene->camera;
@@ -992,10 +1025,14 @@ static PyObject *Scene_setCurrentCamera( BPy_Scene * self, PyObject * args )
Object *object;
BPy_Object *cam_obj;
Scene *scene = self->scene;
+ static char warning = 1;
- SCENE_DEL_CHECK_PY(self);
+ if( warning ) {
+ printf("scene.setCurrentCamera(ob) deprecated!\n\tSet scene.objects.camera = ob instead\n");
+ --warning;
+ }
- printf("scene.setCurrentCamera(ob) deprecated!\n\tSet scene.objects.camera = ob instead\n");
+ SCENE_DEL_CHECK_PY(self);
if( !PyArg_ParseTuple( args, "O!", &Object_Type, &cam_obj ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,