[Bf-blender-cvs] [a6b7ee2a1e8] master: Fix T66948: Outliner - collections/objects with wrong active state

Dalai Felinto noreply at git.blender.org
Thu Jul 18 00:42:04 CEST 2019


Commit: a6b7ee2a1e8f4631b14293aedcef1e981a56dc8a
Author: Dalai Felinto
Date:   Tue Jul 16 18:05:43 2019 -0300
Branches: master
https://developer.blender.org/rBa6b7ee2a1e8f4631b14293aedcef1e981a56dc8a

Fix T66948: Outliner - collections/objects with wrong active state

If the parent collection was out of view we were not taking its
properties into consideration. We need it even when not drawing the
parent to set active/inactive values for its children.

Related Task: T66948

Reviewers: brecht

Subscribers: Zachman

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

===================================================================

M	source/blender/editors/space_outliner/outliner_draw.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 31783e09aeb..55130ae8894 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -933,6 +933,40 @@ static void outliner_restrict_properties_enable_layer_collection_set(
   }
 }
 
+static bool outliner_restrict_properties_collection_set(Scene *scene,
+                                                        TreeElement *te,
+                                                        PointerRNA *collection_ptr,
+                                                        PointerRNA *layer_collection_ptr,
+                                                        RestrictProperties *props,
+                                                        RestrictPropertiesActive *props_active)
+{
+  TreeStoreElem *tselem = TREESTORE(te);
+  LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ? te->directdata :
+                                                                               NULL;
+  Collection *collection = outliner_collection_from_tree_element(te);
+
+  if ((collection->flag & COLLECTION_IS_MASTER) ||
+      (layer_collection && ((layer_collection->flag & LAYER_COLLECTION_EXCLUDE) != 0))) {
+    return false;
+  }
+
+  /* Create the PointerRNA. */
+  RNA_id_pointer_create(&collection->id, collection_ptr);
+  if (layer_collection != NULL) {
+    RNA_pointer_create(&scene->id, &RNA_LayerCollection, layer_collection, layer_collection_ptr);
+  }
+
+  /* Update the restriction column values for the collection children. */
+  if (layer_collection) {
+    outliner_restrict_properties_enable_layer_collection_set(
+        layer_collection_ptr, collection_ptr, props, props_active);
+  }
+  else {
+    outliner_restrict_properties_enable_collection_set(collection_ptr, props, props_active);
+  }
+  return true;
+}
+
 static void outliner_draw_restrictbuts(uiBlock *block,
                                        Scene *scene,
                                        ViewLayer *view_layer,
@@ -1337,30 +1371,16 @@ static void outliner_draw_restrictbuts(uiBlock *block,
         }
       }
       else if (outliner_is_collection_tree_element(te)) {
-        LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ?
-                                                te->directdata :
-                                                NULL;
-        Collection *collection = outliner_collection_from_tree_element(te);
-        if ((!layer_collection || !(layer_collection->flag & LAYER_COLLECTION_EXCLUDE)) &&
-            !(collection->flag & COLLECTION_IS_MASTER)) {
+        PointerRNA collection_ptr;
+        PointerRNA layer_collection_ptr;
 
-          PointerRNA collection_ptr;
-          PointerRNA layer_collection_ptr;
-          RNA_id_pointer_create(&collection->id, &collection_ptr);
-          if (layer_collection != NULL) {
-            RNA_pointer_create(
-                &scene->id, &RNA_LayerCollection, layer_collection, &layer_collection_ptr);
-          }
+        if (outliner_restrict_properties_collection_set(
+                scene, te, &collection_ptr, &layer_collection_ptr, &props, &props_active)) {
 
-          /* Update the restriction column values for the collection children. */
-          if (layer_collection) {
-            outliner_restrict_properties_enable_layer_collection_set(
-                &layer_collection_ptr, &collection_ptr, &props, &props_active);
-          }
-          else {
-            outliner_restrict_properties_enable_collection_set(
-                &collection_ptr, &props, &props_active);
-          }
+          LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ?
+                                                  te->directdata :
+                                                  NULL;
+          Collection *collection = outliner_collection_from_tree_element(te);
 
           if (layer_collection != NULL) {
             if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
@@ -1563,6 +1583,12 @@ static void outliner_draw_restrictbuts(uiBlock *block,
         }
       }
     }
+    else if (outliner_is_collection_tree_element(te)) {
+      PointerRNA collection_ptr;
+      PointerRNA layer_collection_ptr;
+      outliner_restrict_properties_collection_set(
+          scene, te, &collection_ptr, &layer_collection_ptr, &props, &props_active);
+    }
 
     if (TSELEM_OPEN(tselem, soops)) {
       outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree, props_active);



More information about the Bf-blender-cvs mailing list