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>2005-05-20 09:14:03 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2005-05-20 09:14:03 +0400
commit8f080e024f51d06e2de42b759f065a2f50fa7ecc (patch)
treefce00186d3ac6bf116f37b79bf70a0035a3ab765 /source/blender/python/api2_2x/Scene.c
parentfcadf9cc349a83a22cd86d4089a49ee4c3cfa3f8 (diff)
BPython: bug fixes / patches from trackers
(excuse me for not committing earlier) Patches by Ken Hughes (thanks for all bug fixes!): 1) Setting a scene's MapOld and MapNew values in python does nothing: bug #2566 submitted by Dominic Agoro-Ombaka (dmao): https://projects.blender.org/tracker/?func=detail&aid=2566&group_id=9&atid=125 patch #2571: https://projects.blender.org/tracker/index.php?func=detail&aid=2571&group_id=9&atid=127 2) Calling the file selector after setting the progress bar crashes Blender: bug #2418 submitted by Alessandro Garosi (brandano): https://projects.blender.org/tracker/?func=detail&aid=2418&group_id=9&atid=125 patch #2568: https://projects.blender.org/tracker/index.php?func=detail&aid=2568&group_id=9&atid=127 3) Menus always generate same event when canceled: bug #2429 submitted by Campbell Barton: https://projects.blender.org/tracker/?func=detail&aid=2429&group_id=9&atid=125 patch #2579: https://projects.blender.org/tracker/?func=detail&aid=2579&group_id=9&atid=127 4) Add a vertex to a mesh with groups using a script and then edit that mesh hangs blender: bug #2211 reported by German Alonso Tamayo (servivo): https://projects.blender.org/tracker/index.php?func=detail&aid=2211&group_id=9&atid=125 patch #2580 #https://projects.blender.org/tracker/index.php?func=detail&aid=2580&group_id=9&atid=127 About bug #2033, I'm still looking at it, committing a small fix now. ===== Patches by Campbell Barton (thanks!): #2482: BGL pydocs fix broken links https://projects.blender.org/tracker/index.php?func=detail&aid=2482&group_id=9&atid=127 #2426: Large text in Draw.Text and Draw.GetStreingWidth https://projects.blender.org/tracker/index.php?func=detail&aid=2462&group_id=9&atid=127 #2521: scene.getActiveObject() https://projects.blender.org/tracker/index.php?func=detail&aid=2521&group_id=9&atid=127 #2523: NMesh.GetNames() https://projects.blender.org/tracker/index.php?func=detail&aid=2523&group_id=9&atid=127 - docs also updated
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r--source/blender/python/api2_2x/Scene.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index e3a668fd0a8..2010129ae6b 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -25,7 +25,8 @@
*
* This is a new part of Blender.
*
- * Contributor(s): Willian P. Germano, Jacques Guignot, Joseph Gilbert
+ * Contributor(s): Willian P. Germano, Jacques Guignot, Joseph Gilbert,
+ * Campbell Barton.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -102,6 +103,7 @@ static PyObject *Scene_update( BPy_Scene * self, PyObject * args );
static PyObject *Scene_link( BPy_Scene * self, PyObject * args );
static PyObject *Scene_unlink( BPy_Scene * self, PyObject * args );
static PyObject *Scene_getChildren( BPy_Scene * self );
+static PyObject *Scene_getActiveObject(BPy_Scene *self);
static PyObject *Scene_getCurrentCamera( BPy_Scene * self );
static PyObject *Scene_setCurrentCamera( BPy_Scene * self, PyObject * args );
static PyObject *Scene_getRenderingContext( BPy_Scene * self );
@@ -125,9 +127,9 @@ static PyMethodDef BPy_Scene_methods[] = {
{"setName", ( PyCFunction ) Scene_setName, METH_VARARGS,
"(str) - Change Scene name"},
{"getLayers", ( PyCFunction ) Scene_getLayers, METH_NOARGS,
- "() - Return a list of layers int indices which are set in this Scene "},
+ "() - Return a list of layers int indices which are set in this scene "},
{"setLayers", ( PyCFunction ) Scene_setLayers, METH_VARARGS,
- "(layers) - Change layers which are set in this Scene\n"
+ "(layers) - Change layers which are set in this scene\n"
"(layers) - list of integers in the range [1, 20]."},
{"copy", ( PyCFunction ) Scene_copy, METH_VARARGS,
"(duplicate_objects = 1) - Return a copy of this scene\n"
@@ -145,7 +147,9 @@ static PyMethodDef BPy_Scene_methods[] = {
{"unlink", ( PyCFunction ) Scene_unlink, METH_VARARGS,
"(obj) - Unlink Object obj from this scene"},
{"getChildren", ( PyCFunction ) Scene_getChildren, METH_NOARGS,
- "() - Return list of all objects linked to scene self"},
+ "() - Return list of all objects linked to this scene"},
+ {"getActiveObject", (PyCFunction)Scene_getActiveObject, METH_NOARGS,
+ "() - Return this scene's active object"},
{"getCurrentCamera", ( PyCFunction ) Scene_getCurrentCamera,
METH_NOARGS,
"() - Return current active Camera"},
@@ -839,6 +843,36 @@ static PyObject *Scene_getChildren( BPy_Scene * self )
return pylist;
}
+//-----------------------Scene.getActiveObject()------------------------
+static PyObject *Scene_getActiveObject(BPy_Scene *self)
+{
+ Scene *scene = self->scene;
+ PyObject *pyob;
+ Object *ob;
+
+ if (!scene)
+ return EXPP_ReturnPyObjError(PyExc_RuntimeError,
+ "Blender Scene was deleted!");
+
+ ob = ((scene->basact) ? (scene->basact->object) : 0);
+
+ if (ob) {
+ PyObject *arg = Py_BuildValue("(s)", ob->id.name+2);
+
+ pyob = M_Object_Get(Py_None, arg);
+
+ Py_DECREF(arg);
+
+ if (!pyob)
+ return EXPP_ReturnPyObjError(PyExc_MemoryError,
+ "couldn't create new object wrapper!");
+
+ return pyob;
+ }
+
+ return EXPP_incr_ret(Py_None); /* no active object */
+}
+
//-----------------------Scene.getCurrentCamera()------------------------
static PyObject *Scene_getCurrentCamera( BPy_Scene * self )
{