[Bf-blender-cvs] [3f16810150c] blender2.8: Cleanup: Naming, avoid passing bContext to low-level function, etc

Julian Eisel noreply at git.blender.org
Wed Jan 10 23:03:45 CET 2018


Commit: 3f16810150c0f6057d6e6354f5a97bc3f20a13eb
Author: Julian Eisel
Date:   Wed Jan 10 23:02:10 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB3f16810150c0f6057d6e6354f5a97bc3f20a13eb

Cleanup: Naming, avoid passing bContext to low-level function, etc

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

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

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

diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 2f4d8cc60cb..fb89c1818ac 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -125,30 +125,28 @@ static SceneCollection *scene_collection_from_index(ListBase *lb, const int numb
 }
 
 typedef struct TreeElementFindData {
-	SceneCollection *sc;
-	TreeElement *te;
+	SceneCollection *collection;
+	TreeElement *r_result_te;
 } TreeElementFindData;
 
-static TreeTraversalAction tree_element_find_by_scene_collection(TreeElement *te, void *customdata)
+static TreeTraversalAction tree_element_find_by_scene_collection_cb(TreeElement *te, void *customdata)
 {
 	TreeElementFindData *data = customdata;
+	const SceneCollection *current_element_sc = outliner_scene_collection_from_tree_element(te);
 
-	SceneCollection *current_element_sc = outliner_scene_collection_from_tree_element(te);
-
-	if (current_element_sc == data->sc) {
-		data->te = te;
+	if (current_element_sc == data->collection) {
+		data->r_result_te = te;
 		return TRAVERSE_BREAK;
 	}
 
 	return TRAVERSE_CONTINUE;
 }
 
-static TreeElement *outliner_tree_element_from_layer_collection(bContext *C)
+static TreeElement *outliner_tree_element_from_layer_collection_index(
+        SpaceOops *soops, ViewLayer *view_layer,
+        const int index)
 {
-	ViewLayer *view_layer = CTX_data_view_layer(C);
-	SpaceOops *soops = CTX_wm_space_outliner(C);
-
-	LayerCollection *lc = BKE_layer_collection_from_index(view_layer, 0);
+	LayerCollection *lc = BKE_layer_collection_from_index(view_layer, index);
 
 	if (lc == NULL) {
 		return NULL;
@@ -156,12 +154,12 @@ static TreeElement *outliner_tree_element_from_layer_collection(bContext *C)
 
 	/* Find the tree element containing the LayerCollection's scene_collection. */
 	TreeElementFindData data = {
-		.sc = lc->scene_collection,
-		.te = NULL,
+		.collection = lc->scene_collection,
+		.r_result_te = NULL,
 	};
-	outliner_tree_traverse(soops, &soops->tree, 0, 0, tree_element_find_by_scene_collection, &data);
+	outliner_tree_traverse(soops, &soops->tree, 0, 0, tree_element_find_by_scene_collection_cb, &data);
 
-	return data.te;
+	return data.r_result_te;
 }
 
 static int collection_link_exec(bContext *C, wmOperator *op)
@@ -679,7 +677,7 @@ static int collection_delete_exec(bContext *C, wmOperator *UNUSED(op))
 
 	BLI_gset_free(data.collections_to_delete, NULL);
 
-	TreeElement *select_te = outliner_tree_element_from_layer_collection(C);
+	TreeElement *select_te = outliner_tree_element_from_layer_collection_index(soops, CTX_data_view_layer(C), 0);
 	if (select_te) {
 		outliner_item_select(soops, select_te, false, false);
 	}



More information about the Bf-blender-cvs mailing list