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:
authorCampbell Barton <ideasman42@gmail.com>2009-03-24 06:53:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-03-24 06:53:20 +0300
commit5e44eba342190fe39332591a1e897a35658951c8 (patch)
treef11297d0e24b97dce10ab1d1e74021d102e79512
parent80319e5b518c689a4ac37da84aa533f36b1a261a (diff)
fix for [18443] Object.GetSelected() returns empty when run from command line
-rw-r--r--source/blender/python/api2_2x/Object.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 1282b9bd82c..fd2301bfae4 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -945,17 +945,13 @@ static PyObject *M_Object_GetSelected( PyObject * self_unused )
PyObject *blen_object;
PyObject *list;
Base *base_iter;
-
+ unsigned int lay = G.vd ? G.vd->lay : G.scene->lay;
+
list = PyList_New( 0 );
-
- if( G.vd == NULL ) {
- /* No 3d view has been initialized yet, simply return an empty list */
- return list;
- }
if( ( G.scene->basact ) &&
( ( G.scene->basact->flag & SELECT ) &&
- ( G.scene->basact->lay & G.vd->lay ) ) ) {
+ ( G.scene->basact->lay & lay ) ) ) {
/* Active object is first in the list. */
blen_object = Object_CreatePyObject( G.scene->basact->object );
@@ -970,7 +966,7 @@ static PyObject *M_Object_GetSelected( PyObject * self_unused )
base_iter = G.scene->base.first;
while( base_iter ) {
if( ( ( base_iter->flag & SELECT ) &&
- ( base_iter->lay & G.vd->lay ) ) &&
+ ( base_iter->lay & lay ) ) &&
( base_iter != G.scene->basact ) ) {
blen_object = Object_CreatePyObject( base_iter->object );