From b9e54566e3b1a49d9757680da64d8e19c136c706 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 5 Mar 2021 17:38:53 +0100 Subject: Cleanup: Add & use enum value for ID Outliner element type Code to check if the Outliner tree-element type was the general ID one would always check against "0" (explicity or even implicitly). For somebody unfamiliar with the code this is very confusing. Instead the value should be given a name, e.g. through an enum. Adds `TSE_SOME_ID` as the "default" ID tree-element type. Other types may still represent IDs, as I explained in a comment at the definition. There may also still be cases where the type is checked against "0". I noted in the comment that such cases should be cleaned up if found. --- source/blender/editors/space_outliner/outliner_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_outliner/outliner_context.c') diff --git a/source/blender/editors/space_outliner/outliner_context.c b/source/blender/editors/space_outliner/outliner_context.c index e2b3b79e027..4293d8da73e 100644 --- a/source/blender/editors/space_outliner/outliner_context.c +++ b/source/blender/editors/space_outliner/outliner_context.c @@ -34,7 +34,7 @@ static void outliner_context_selected_ids_recursive(const ListBase *subtree, { LISTBASE_FOREACH (const TreeElement *, te, subtree) { const TreeStoreElem *tse = TREESTORE(te); - if ((tse->flag & TSE_SELECTED) && (ELEM(tse->type, 0, TSE_LAYER_COLLECTION))) { + if ((tse->flag & TSE_SELECTED) && (ELEM(tse->type, TSE_SOME_ID, TSE_LAYER_COLLECTION))) { CTX_data_id_list_add(result, tse->id); } outliner_context_selected_ids_recursive(&te->subtree, result); -- cgit v1.2.3