From 273c8e08041111714e47dbb0d50604553fd5f854 Mon Sep 17 00:00:00 2001 From: Stephen Swaney <sswaney@centurytel.net> Date: Mon, 20 Sep 2004 16:22:32 +0000 Subject: [PATCH] New bpy method for World module to set World for current scene: my_world.makeActive() Contributed by Campbell Barton (ideasman) --- source/blender/python/api2_2x/World.c | 15 +++++++++++++++ source/blender/python/api2_2x/doc/World.py | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 9df7ebfc55a..c20b41d542f 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -680,6 +680,21 @@ static PyObject *World_getScriptLinks (BPy_World *self, PyObject *args) } + +/* world.makeActive */ +static PyObject *World_makeActive (BPy_World *self) +{ + World *world = self->world; + /* If there is a world then it now has one less user */ + if( G.scene->world) + G.scene->world->id.us--; + world->id.us++; + G.scene->world = world; + Py_INCREF(Py_None); + return Py_None; +} + + /*@{*/ /** diff --git a/source/blender/python/api2_2x/doc/World.py b/source/blender/python/api2_2x/doc/World.py index 55b3cf2dc8c..a8d10ce7073 100644 --- a/source/blender/python/api2_2x/doc/World.py +++ b/source/blender/python/api2_2x/doc/World.py @@ -314,3 +314,10 @@ class World: @type event: string @param event: "FrameChanged" or "Redraw". """ + + def makeActive (): + """ + Make this world active in the current scene. + @rtype: PyNone + @return: PyNone + """ -- GitLab