[Bf-blender-cvs] [3850557073a] master: Cleanup: get rid of BKE_collection_master() useless accessor.

Bastien Montagne noreply at git.blender.org
Mon Sep 2 18:49:16 CEST 2019


Commit: 3850557073a156fed94455eb3d7a9b3aad340880
Author: Bastien Montagne
Date:   Mon Sep 2 14:31:19 2019 +0200
Branches: master
https://developer.blender.org/rB3850557073a156fed94455eb3d7a9b3aad340880

Cleanup: get rid of BKE_collection_master() useless accessor.

In its current version that was a totally useless extra layer of crap
that we can totally avoid. Plus name was bad too.

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

M	source/blender/blenkernel/BKE_collection.h
M	source/blender/blenkernel/intern/collection.c
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/space_outliner/outliner_collections.c
M	source/blender/editors/space_outliner/outliner_dragdrop.c
M	source/blender/editors/space_outliner/outliner_tools.c
M	source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp

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

diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 757b1c64db3..6847efc8eb3 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -76,7 +76,6 @@ struct Collection *BKE_collection_copy_master(struct Main *bmain,
 
 /* Master Collection for Scene */
 
-struct Collection *BKE_collection_master(const struct Scene *scene);
 struct Collection *BKE_collection_master_add(void);
 struct Scene *BKE_collection_master_scene_search(const struct Main *bmain,
                                                  const struct Collection *master_collection);
@@ -225,7 +224,7 @@ void BKE_scene_objects_iterator_end(struct BLI_Iterator *iter);
     bool is_scene_collection = (_scene) != NULL; \
 \
     if (_scene) { \
-      _instance_next = BKE_collection_master(_scene); \
+      _instance_next = _scene->master_collection; \
     } \
     else { \
       _instance_next = (_bmain)->collections.first; \
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 06710b40569..0c84dded53d 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -506,11 +506,6 @@ Collection *BKE_collection_master_add()
   return master_collection;
 }
 
-Collection *BKE_collection_master(const Scene *scene)
-{
-  return scene->master_collection;
-}
-
 Scene *BKE_collection_master_scene_search(const Main *bmain, const Collection *master_collection)
 {
   BLI_assert((master_collection->flag & COLLECTION_IS_MASTER) != 0);
@@ -587,7 +582,7 @@ bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
 
 static Collection *collection_next_find(Main *bmain, Scene *scene, Collection *collection)
 {
-  if (scene && collection == BKE_collection_master(scene)) {
+  if (scene && collection == scene->master_collection) {
     return bmain->collections.first;
   }
   else {
@@ -604,7 +599,7 @@ Collection *BKE_collection_object_find(Main *bmain,
     collection = collection_next_find(bmain, scene, collection);
   }
   else if (scene) {
-    collection = BKE_collection_master(scene);
+    collection = scene->master_collection;
   }
   else {
     collection = bmain->collections.first;
@@ -746,7 +741,7 @@ void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, O
   if (!is_instantiated) {
     /* In case we could not find any non-linked collections in which instantiate our ob_dst,
      * fallback to scene's master collection... */
-    collection_object_add(bmain, BKE_collection_master(scene), ob_dst, 0, true);
+    collection_object_add(bmain, scene->master_collection, ob_dst, 0, true);
   }
 
   BKE_main_collection_sync(bmain);
@@ -888,7 +883,7 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection)
       collection_null_children_remove(collection);
     }
     for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
-      collection_null_children_remove(BKE_collection_master(scene));
+      collection_null_children_remove(scene->master_collection);
     }
 
     for (collection = bmain->collections.first; collection != NULL;
@@ -896,7 +891,7 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection)
       collection_missing_parents_remove(collection);
     }
     for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
-      collection_missing_parents_remove(BKE_collection_master(scene));
+      collection_missing_parents_remove(scene->master_collection);
     }
   }
   else {
@@ -1172,7 +1167,7 @@ static Collection *collection_from_index_recursive(Collection *collection,
 Collection *BKE_collection_from_index(Scene *scene, const int index)
 {
   int index_current = 0;
-  Collection *master_collection = BKE_collection_master(scene);
+  Collection *master_collection = scene->master_collection;
   return collection_from_index_recursive(master_collection, index, &index_current);
 }
 
@@ -1366,7 +1361,7 @@ static void scene_collections_array(Scene *scene, Collection ***collections_arra
     return;
   }
 
-  collection = BKE_collection_master(scene);
+  collection = scene->master_collection;
   BLI_assert(collection != NULL);
   scene_collection_callback(collection, scene_collections_count, tot);
 
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index f536f21c3e5..bcf6bb338ff 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1053,7 +1053,7 @@ Collection *CTX_data_collection(const bContext *C)
 
   /* fallback */
   Scene *scene = CTX_data_scene(C);
-  return BKE_collection_master(scene);
+  return scene->master_collection;
 }
 
 enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit,
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ae091f32fbf..7ea395e9386 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3871,7 +3871,7 @@ int BKE_object_scenes_users_get(Main *bmain, Object *ob)
 {
   int num_scenes = 0;
   for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
-    if (BKE_collection_has_object_recursive(BKE_collection_master(scene), ob)) {
+    if (BKE_collection_has_object_recursive(scene->master_collection, ob)) {
       num_scenes++;
     }
   }
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index ec73406c14c..514f000d73d 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1452,7 +1452,7 @@ void BKE_rigidbody_remove_object(Main *bmain, Scene *scene, Object *ob)
       /* Some users seems to find it funny to use a view-layer instancing collection
        * as RBW collection... Despite this being a bad (ab)use of the system, avoid losing objects
        * when we remove them from RB simulation. */
-      BKE_collection_object_add(bmain, BKE_collection_master(scene), ob);
+      BKE_collection_object_add(bmain, scene->master_collection, ob);
     }
     BKE_collection_object_remove(bmain, rbw->group, ob, false);
   }
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 00c0ed561f7..ae98d3e0e15 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -406,7 +406,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
   }
 
   /* Create collections from layers. */
-  Collection *collection_master = BKE_collection_master(scene);
+  Collection *collection_master = scene->master_collection;
   Collection *collections[20] = {NULL};
 
   for (int layer = 0; layer < 20; layer++) {
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0c2b5292716..33c7ffefb8b 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1691,7 +1691,7 @@ static int move_to_collection_invoke(bContext *C, wmOperator *op, const wmEvent
     return move_to_collection_exec(C, op);
   }
 
-  Collection *master_collection = BKE_collection_master(scene);
+  Collection *master_collection = scene->master_collection;
 
   /* We need the data to be allocated so it's available during menu drawing.
    * Technically we could use wmOperator->customdata. However there is no free callback
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index df684bfc210..06c360ed1cd 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1434,7 +1434,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
-  Collection *collection_to = BKE_collection_master(scene_to);
+  Collection *collection_to = scene_to->master_collection;
   CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
     BKE_collection_object_add(bmain, collection_to, base->object);
   }
@@ -1771,7 +1771,7 @@ static void single_object_users(
     Main *bmain, Scene *scene, View3D *v3d, const int flag, const bool copy_collections)
 {
   /* duplicate all the objects of the scene (and matching collections, if required). */
-  Collection *master_collection = BKE_collection_master(scene);
+  Collection *master_collection = scene->master_collection;
   single_object_users_collection(bmain, scene, master_collection, flag, copy_collections, true);
 
   /* duplicate collections that consist entirely of duplicated objects */
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 4740c412083..309446db83b 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -89,7 +89,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
   }
   else if (ELEM(tselem->type, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
     Scene *scene = (Scene *)tselem->id;
-    return BKE_collection_master(scene);
+    return scene->master_collection;
   }
   else if (tselem->type == 0 && te->idcode == ID_GR) {
     return (Collection *)tselem->id;
@@ -199,7 +199,7 @@ static int collection_new_exec(bContext *C, wmOperator *op)
   }
 
   if (data.collection == NULL || ID_IS_LINKED(data.collection)) {
-    data.collection = BKE_collection_master(scene);
+    data.collection = scene->master_collection;
   }
 
   if (ID_IS_LINKED(scene)) {
@@ -514,14 +514,14 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
    * This can happen when a whole scene is linked e.g. */
   if (parent != NULL && ID_IS_LINKED(parent)) {
     Scene *scene = CTX_data_scene(C);
-    parent = ID_IS_LINKED(scene) ? NULL : BKE_collection_master(scene);
+    parent = ID_IS_LINKED(scene) ? NULL : scene->master_collection;
   }
   else if (parent != NULL && (parent->flag & COLLECTION_IS_MASTE

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list