Fix T62438: Unhide all doesn't set newly visible objects to selected
authorDalai Felinto <dfelinto@gmail.com>
Fri, 15 Mar 2019 19:14:21 +0000 (16:14 -0300)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 15 Mar 2019 19:14:21 +0000 (16:14 -0300)
The select option in the operator was never working because we were
trying to select an object considered unselectable (since it was hidden).

Reviewers: brecht

Differential Revision: https://developer.blender.org/D4527

source/blender/editors/object/object_edit.c

index 977f5f3..1964cd5 100644 (file)
@@ -77,6 +77,7 @@
 #include "BKE_softbody.h"
 #include "BKE_editmesh.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_workspace.h"
 
 #include "DEG_depsgraph.h"
@@ -162,7 +163,10 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *op)
                        changed = true;
 
                        if (select) {
-                               ED_object_base_select(base, BA_SELECT);
+                               /* We cannot call `ED_object_base_select` because
+                                * base is not selectable while it is hidden. */
+                               base->flag |= BASE_SELECTED;
+                               BKE_scene_object_base_flag_sync_from_base(base);
                        }
                }
        }