diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2003-08-06 23:25:06 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2003-08-06 23:25:06 +0400 |
commit | 577616b3589132bc35b1d3fdcbb556289f66463a (patch) | |
tree | a53ea6b716127d27d2a28e73bf51fa7cf63f5bcf | |
parent | 2db07e8f2798e4a6ce56537f42d1064956e146e9 (diff) |
Exppython:
- Update method scene.update():
To accept an optional parameter for a "full" update (using set_scene_bg()).
- Updated the docs accordingly.
-rw-r--r-- | source/blender/python/api2_2x/Scene.c | 31 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Blender.py | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Scene.py | 11 |
3 files changed, 38 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index 600878df3d1..b6b55c2d50b 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -116,7 +116,7 @@ static PyObject *Scene_endFrame(BPy_Scene *self, PyObject *args); static PyObject *Scene_currentFrame(BPy_Scene *self, PyObject *args); static PyObject *Scene_frameSettings (BPy_Scene *self, PyObject *args); static PyObject *Scene_makeCurrent(BPy_Scene *self); -static PyObject *Scene_update(BPy_Scene *self); +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_getRenderdir(BPy_Scene *self); @@ -158,8 +158,10 @@ static PyMethodDef BPy_Scene_methods[] = { "A tuple (start, end, current) is returned in any case."}, {"makeCurrent", (PyCFunction)Scene_makeCurrent, METH_NOARGS, "() - Make self the current scene"}, - {"update", (PyCFunction)Scene_update, METH_NOARGS, - "() - Update scene self"}, + {"update", (PyCFunction)Scene_update, METH_VARARGS, + "(full = 0) - Update scene self.\n" + "full = 0: sort the base list of objects." + "full = 1: full update -- also regroups, does ipos, ikas, keys"}, {"link", (PyCFunction)Scene_link, METH_VARARGS, "(obj) - Link Object obj to this scene"}, {"unlink", (PyCFunction)Scene_unlink, METH_VARARGS, @@ -524,11 +526,30 @@ static PyObject *Scene_makeCurrent (BPy_Scene *self) return Py_None; } -static PyObject *Scene_update (BPy_Scene *self) +static PyObject *Scene_update (BPy_Scene *self, PyObject *args) { Scene *scene = self->scene; + int full = 0; - if (scene) sort_baselist (scene); + if (!scene) + return EXPP_ReturnPyObjError (PyExc_RuntimeError, + "Blender Scene was deleted!"); + + if (!PyArg_ParseTuple (args, "|i", &full)) + return EXPP_ReturnPyObjError (PyExc_TypeError, + "expected nothing or int (0 or 1) argument"); + + if (!full) + sort_baselist (scene); + + else if (full == 1) + set_scene_bg (scene); + + else + return EXPP_ReturnPyObjError (PyExc_ValueError, + "in method scene.update(full), full should be:\n" + "0: to only sort scene elements (old behavior); or\n" + "1: for a full update (regroups, does ipos, ikas, keys, etc.)"); Py_INCREF (Py_None); return Py_None; diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py index 4db6044e414..61d4af35e2a 100644 --- a/source/blender/python/api2_2x/doc/Blender.py +++ b/source/blender/python/api2_2x/doc/Blender.py @@ -52,7 +52,7 @@ The Blender Python API Reference open-source language. @author: The Blender Python Team -@requires: Blender 2.28 pre-release or newer. +@requires: Blender 2.28 (already updated for 2.28a) or newer. @version: 0.1 @see: U{www.blender.org<http://www.blender.org>} @see: U{projects.blender.org<http://projects.blender.org>} diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py index d17e593ad47..425cafe85b6 100644 --- a/source/blender/python/api2_2x/doc/Scene.py +++ b/source/blender/python/api2_2x/doc/Scene.py @@ -155,6 +155,17 @@ class Scene: Make this Scene the currently active one in Blender. """ + def update(full = 0): + """ + Update this Scene in Blender. + @type full: int + @param full: A bool to control the level of updating: + - 0: sort the base list of objects. + - 1: sort and also regroup, do ipos, ikas, keys, script links, etc. + @warn: When in doubt, try with I{full = 0} first, since it is faster. + The "full" update is a recent addition to this method. + """ + def link(object): """ Link an Object to this Scene. |