[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19391] trunk/blender/source/blender/ python/api2_2x/Object.c: fix for [18443] Object.GetSelected() returns empty when run from command line

Campbell Barton ideasman42 at gmail.com
Tue Mar 24 04:53:21 CET 2009


Revision: 19391
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19391
Author:   campbellbarton
Date:     2009-03-24 04:53:20 +0100 (Tue, 24 Mar 2009)

Log Message:
-----------
fix for [18443] Object.GetSelected() returns empty when run from command line

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Object.c

Modified: trunk/blender/source/blender/python/api2_2x/Object.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Object.c	2009-03-23 20:19:09 UTC (rev 19390)
+++ trunk/blender/source/blender/python/api2_2x/Object.c	2009-03-24 03:53:20 UTC (rev 19391)
@@ -945,17 +945,13 @@
 	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 @@
 	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 );





More information about the Bf-blender-cvs mailing list