(Python Object API)
authorCampbell Barton <ideasman42@gmail.com>
Fri, 22 Jun 2007 13:38:15 +0000 (13:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 22 Jun 2007 13:38:15 +0000 (13:38 +0000)
setting object layers didnt break once the base of an object was found.
DAG update and countall ran even when the object wasnt in the scene.

source/blender/python/api2_2x/Object.c

index 73859bedcddf7fc6817b0542b1c1195d5bf9e02c..8170aeb6a76bee26759b7d6dca3bd64b1350373e 100644 (file)
@@ -1230,7 +1230,9 @@ static int Object_setSelect( BPy_Object * self, PyObject * value )
                }
                base = base->next;
        }
-       countall(  );
+       if (base) { /* was the object selected? */
+               countall(  );
+       }
        return 0;
 }
 
@@ -4297,13 +4299,16 @@ static int Object_setLayers( BPy_Object * self, PyObject *value )
                        local = base->lay;
                        base->lay = local | layers;
                        self->object->lay = base->lay;
+                       break;
                }
                base = base->next;
        }
        
        /* these to calls here are overkill! (ton) */
-       countall();
-       DAG_scene_sort( G.scene );
+       if (base) { /* The object was found? */
+               countall();
+               DAG_scene_sort( G.scene );
+       }
        return 0;
 }
 
@@ -4333,11 +4338,14 @@ static int Object_setLayersMask( BPy_Object *self, PyObject *value )
                        local = base->lay;
                        base->lay = local | layers;
                        self->object->lay = base->lay;
+                       break;
                }
                base = base->next;
        }
-       countall();
-       DAG_scene_sort( G.scene );
+       if (base) { /* The object was found? */
+               countall();
+               DAG_scene_sort( G.scene );
+       }
        return 0;
 }