diff options
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r-- | source/blender/python/api2_2x/Scene.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index 7ef351b1127..eba951b8813 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -1355,16 +1355,29 @@ static PyObject *SceneObSeq_item( BPy_SceneObSeq * self, int i ) for (base= scene->base.first; base && i!=index; base= base->next, index++) {} /* selected */ else if (self->mode==EXPP_OBSEQ_SELECTED) { - for (base= scene->base.first; base && i!=index; base= base->next) - if (base->flag & SELECT) - index++; + for (base= scene->base.first; base; base= base->next) { + if (base->flag & SELECT) { + if (i==index) { + break; + } else { + index++; + } + } + } } /* context */ else if (self->mode==EXPP_OBSEQ_CONTEXT) { - if (G.vd) - for (base= scene->base.first; base && i!=index; base= base->next) - if TESTBASE(base) - index++; + if (G.vd) { + for (base= scene->base.first; base; base= base->next) { + if (TESTBASE(base)) { + if (i==index) { + break; + } else { + index++; + } + } + } + } } if (!(base)) |