Added visible_bases and visible_objects to screen Context.
authorElia Sarti <vekoon@gmail.com>
Thu, 1 Apr 2010 19:48:29 +0000 (19:48 +0000)
committerElia Sarti <vekoon@gmail.com>
Thu, 1 Apr 2010 19:48:29 +0000 (19:48 +0000)
Also fixes [#21576] bpy.ops.object.select_all() doesn't function

source/blender/editors/screen/screen_context.c

index 38f0778ea0c300060a6b10b4f0a70fa02df2e97d..14cafc74ea512cf6dd406d1ea715491b83ed9d7d 100644 (file)
@@ -60,7 +60,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 
        if(CTX_data_dir(member)) {
                static const char *dir[] = {
-                       "scene", "selected_objects", "selected_bases",
+                       "scene", "visible_objects", "visible_bases", "selected_objects", "selected_bases",
                        "selected_editable_objects", "selected_editable_bases",
                        "visible_bones", "editable_bones", "selected_bones", "selected_editable_bones",
                        "visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone",
@@ -75,6 +75,20 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                CTX_data_id_pointer_set(result, &scene->id);
                return 1;
        }
+       else if(CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
+               int visible_objects= CTX_data_equals(member, "visible_objects");
+
+               for(base=scene->base.first; base; base=base->next) {
+                       if(((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
+                               if(visible_objects)
+                                       CTX_data_id_list_add(result, &base->object->id);
+                               else
+                                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+                       }
+               }
+
+               return 1;
+       }
        else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
                int selected_objects= CTX_data_equals(member, "selected_objects");