[Bf-blender-cvs] [8abf6efcf60] master: Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer

Brecht Van Lommel noreply at git.blender.org
Wed Aug 4 19:29:56 CEST 2021


Commit: 8abf6efcf60fa7f609f38fda0e085d84a72b6dba
Author: Brecht Van Lommel
Date:   Wed Aug 4 17:46:55 2021 +0200
Branches: master
https://developer.blender.org/rB8abf6efcf60fa7f609f38fda0e085d84a72b6dba

Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer

This makes the internal naming consistent with the public API. And also gives
us a visibility_flag rather than restrictflag that can be extended with more
flags.

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

M	source/blender/blenkernel/BKE_collection.h
M	source/blender/blenkernel/intern/collection.c
M	source/blender/blenkernel/intern/layer.c
M	source/blender/blenkernel/intern/lib_override.c
M	source/blender/blenkernel/intern/mask.c
M	source/blender/blenkernel/intern/mask_rasterize.c
M	source/blender/blenkernel/intern/object_dupli.cc
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/bmesh/intern/bmesh_walkers_impl.c
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/mask/mask_add.c
M	source/blender/editors/mask/mask_draw.c
M	source/blender/editors/mask/mask_ops.c
M	source/blender/editors/mask/mask_query.c
M	source/blender/editors/mask/mask_relationships.c
M	source/blender/editors/mask/mask_select.c
M	source/blender/editors/mask/mask_shapekey.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_bake_api.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/render/render_preview.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/space_clip/clip_utils.c
M	source/blender/editors/space_outliner/outliner_collections.c
M	source/blender/editors/transform/transform_convert_mask.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesdna/DNA_layer_types.h
M	source/blender/makesdna/DNA_mask_types.h
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesdna/intern/dna_rename_defs.h
M	source/blender/makesrna/intern/rna_collection.c
M	source/blender/makesrna/intern/rna_layer.c
M	source/blender/makesrna/intern/rna_mask.c
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 0326386e5c1..8b8d0f7b107 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -197,13 +197,14 @@ typedef void (*BKE_scene_collections_Cb)(struct Collection *ob, void *data);
 #define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode) \
   { \
     int _base_flag = (_mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; \
-    int _object_restrict_flag = (_mode == DAG_EVAL_VIEWPORT) ? OB_RESTRICT_VIEWPORT : \
-                                                               OB_RESTRICT_RENDER; \
+    int _object_visibility_flag = (_mode == DAG_EVAL_VIEWPORT) ? OB_HIDE_VIEWPORT : \
+                                                                 OB_HIDE_RENDER; \
     int _base_id = 0; \
     for (Base *_base = (Base *)BKE_collection_object_cache_get(_collection).first; _base; \
          _base = _base->next, _base_id++) { \
       Object *_object = _base->object; \
-      if ((_base->flag & _base_flag) && (_object->restrictflag & _object_restrict_flag) == 0) {
+      if ((_base->flag & _base_flag) && \
+          (_object->visibility_flag & _object_visibility_flag) == 0) {
 
 #define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END \
   } \
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index b90214f1814..dbcd80fe065 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -806,10 +806,10 @@ static void collection_object_cache_fill(ListBase *lb,
     /* Only collection flags are checked here currently, object restrict flag is checked
      * in FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN since it can be animated
      * without updating the cache. */
-    if (((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0)) {
+    if (((child_restrict & COLLECTION_HIDE_VIEWPORT) == 0)) {
       base->flag |= BASE_ENABLED_VIEWPORT;
     }
-    if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0)) {
+    if (((child_restrict & COLLECTION_HIDE_RENDER) == 0)) {
       base->flag |= BASE_ENABLED_RENDER;
     }
   }
@@ -1755,7 +1755,7 @@ static bool collection_objects_select(ViewLayer *view_layer, Collection *collect
 {
   bool changed = false;
 
-  if (collection->flag & COLLECTION_RESTRICT_SELECT) {
+  if (collection->flag & COLLECTION_HIDE_SELECT) {
     return false;
   }
 
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index ae1863f0a47..5940569ba76 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -602,7 +602,7 @@ static bool layer_collection_hidden(ViewLayer *view_layer, LayerCollection *lc)
   }
 
   /* Check visiblilty restriction flags */
-  if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) {
+  if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_HIDE_VIEWPORT) {
     return true;
   }
 
@@ -1005,17 +1005,17 @@ static void layer_collection_objects_sync(ViewLayer *view_layer,
       BLI_addtail(r_lb_new_object_bases, base);
     }
 
-    if ((collection_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) {
+    if ((collection_restrict & COLLECTION_HIDE_VIEWPORT) == 0) {
       base->flag_from_collection |= (BASE_ENABLED_VIEWPORT | BASE_VISIBLE_DEPSGRAPH);
       if ((layer_restrict & LAYER_COLLECTION_HIDE) == 0) {
         base->flag_from_collection |= BASE_VISIBLE_VIEWLAYER;
       }
-      if (((collection_restrict & COLLECTION_RESTRICT_SELECT) == 0)) {
+      if (((collection_restrict & COLLECTION_HIDE_SELECT) == 0)) {
         base->flag_from_collection |= BASE_SELECTABLE;
       }
     }
 
-    if ((collection_restrict & COLLECTION_RESTRICT_RENDER) == 0) {
+    if ((collection_restrict & COLLECTION_HIDE_RENDER) == 0) {
       base->flag_from_collection |= BASE_ENABLED_RENDER;
     }
 
@@ -1150,11 +1150,11 @@ static void layer_collection_sync(ViewLayer *view_layer,
 
     /* We separate restrict viewport and visible view layer because a layer collection can be
      * hidden in the view layer yet (locally) visible in a viewport (if it is not restricted). */
-    if (child_collection_restrict & COLLECTION_RESTRICT_VIEWPORT) {
-      child_layer->runtime_flag |= LAYER_COLLECTION_RESTRICT_VIEWPORT;
+    if (child_collection_restrict & COLLECTION_HIDE_VIEWPORT) {
+      child_layer->runtime_flag |= LAYER_COLLECTION_HIDE_VIEWPORT;
     }
 
-    if (((child_layer->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) == 0) &&
+    if (((child_layer->runtime_flag & LAYER_COLLECTION_HIDE_VIEWPORT) == 0) &&
         ((child_layer_restrict & LAYER_COLLECTION_HIDE) == 0)) {
       child_layer->runtime_flag |= LAYER_COLLECTION_VISIBLE_VIEW_LAYER;
     }
@@ -1333,7 +1333,7 @@ void BKE_main_collection_sync_remap(const Main *bmain)
  */
 bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection *lc, bool deselect)
 {
-  if (lc->collection->flag & COLLECTION_RESTRICT_SELECT) {
+  if (lc->collection->flag & COLLECTION_HIDE_SELECT) {
     return false;
   }
 
@@ -1369,7 +1369,7 @@ bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection
 
 bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerCollection *lc)
 {
-  if (lc->collection->flag & COLLECTION_RESTRICT_SELECT) {
+  if (lc->collection->flag & COLLECTION_HIDE_SELECT) {
     return false;
   }
 
@@ -1457,7 +1457,7 @@ bool BKE_object_is_visible_in_viewport(const View3D *v3d, const struct Object *o
 {
   BLI_assert(v3d != NULL);
 
-  if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
+  if (ob->visibility_flag & OB_HIDE_VIEWPORT) {
     return false;
   }
 
@@ -2146,14 +2146,14 @@ void BKE_base_eval_flags(Base *base)
   base->flag |= (base->flag_from_collection & g_base_collection_flags);
 
   /* Apply object restrictions. */
-  const int object_restrict = base->object->restrictflag;
-  if (object_restrict & OB_RESTRICT_VIEWPORT) {
+  const int object_restrict = base->object->visibility_flag;
+  if (object_restrict & OB_HIDE_VIEWPORT) {
     base->flag &= ~BASE_ENABLED_VIEWPORT;
   }
-  if (object_restrict & OB_RESTRICT_RENDER) {
+  if (object_restrict & OB_HIDE_RENDER) {
     base->flag &= ~BASE_ENABLED_RENDER;
   }
-  if (object_restrict & OB_RESTRICT_SELECT) {
+  if (object_restrict & OB_HIDE_SELECT) {
     base->flag &= ~BASE_SELECTABLE;
   }
 
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 8e67547b719..38687fa47b2 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -855,8 +855,8 @@ static void lib_override_library_create_post_process(Main *bmain,
             default_instantiating_collection = BKE_collection_add(
                 bmain, (Collection *)id_root, "OVERRIDE_HIDDEN");
             /* Hide the collection from viewport and render. */
-            default_instantiating_collection->flag |= COLLECTION_RESTRICT_VIEWPORT |
-                                                      COLLECTION_RESTRICT_RENDER;
+            default_instantiating_collection->flag |= COLLECTION_HIDE_VIEWPORT |
+                                                      COLLECTION_HIDE_RENDER;
             break;
           }
           case ID_OB: {
@@ -1731,8 +1731,7 @@ void BKE_lib_override_library_main_resync(Main *bmain,
     override_resync_residual_storage = BKE_collection_add(
         bmain, scene->master_collection, OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME);
     /* Hide the collection from viewport and render. */
-    override_resync_residual_storage->flag |= COLLECTION_RESTRICT_VIEWPORT |
-                                              COLLECTION_RESTRICT_RENDER;
+    override_resync_residual_storage->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
   }
 
   /* Necessary to improve performances, and prevent layers matching override sub-collections to be
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 34dd38164c2..f40d1db60ff 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -429,7 +429,7 @@ MaskLayer *BKE_mask_layer_copy(const MaskLayer *masklay)
   masklay_new->blend_flag = masklay->blend_flag;
   masklay_new->flag = masklay->flag;
   masklay_new->falloff = masklay->falloff;
-  masklay_new->restrictflag = masklay->restrictflag;
+  masklay_new->visibility_flag = masklay->visibility_flag;
 
   for (spline = masklay->splines.first; spline; spline = spline->next) {
     MaskSpline *spline_new = BKE_mask_spline_copy(spline);
@@ -2092,7 +2092,7 @@ void BKE_mask_clipboard_copy_from_layer(MaskLayer *mask_layer)
   MaskSpline *spline;
 
   /* Nothing to do if selection if disabled for the given layer. */
-  if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
+  if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
     return;
   }
 
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 00ed7d86975..8acc929a089 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -619,7 +619,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
     unsigned int tot_boundary_found = 0;
 #endif
 
-    if (masklay->restrictflag & MASK_RESTRICT_RENDER) {
+    if (masklay->visibility_flag & MASK_HIDE_RENDER) {
       /* skip the layer */
       mr_handle->layers_tot--;
       masklay_index--;
diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc
index 77969328365..141a9a25eca 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -1554,15 +1554,15 @@ static const DupliGenerator gen_dupli_particles = {
 static const DupliGenerator *get_dupli_generator(const DupliContext *ctx)
 {
   int transflag = ctx->object->transflag;
-  int restrictflag = ctx->object->restrictflag;
+  int visibility_fl

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list