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_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_outliner/outliner_sync.c') diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c index 8bd5e3a130a..6543a909a41 100644 --- a/source/blender/editors/space_outliner/outliner_sync.c +++ b/source/blender/editors/space_outliner/outliner_sync.c @@ -326,7 +326,7 @@ static void outliner_sync_selection_from_outliner(Scene *scene, LISTBASE_FOREACH (TreeElement *, te, tree) { TreeStoreElem *tselem = TREESTORE(te); - if (tselem->type == 0 && te->idcode == ID_OB) { + if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) { if (sync_types->object) { outliner_select_sync_to_object(view_layer, te, tselem, selected_items->objects); } @@ -503,7 +503,7 @@ static void outliner_sync_selection_to_outliner(ViewLayer *view_layer, LISTBASE_FOREACH (TreeElement *, te, tree) { TreeStoreElem *tselem = TREESTORE(te); - if (tselem->type == 0 && te->idcode == ID_OB) { + if ((tselem->type == TSE_SOME_ID) && te->idcode == ID_OB) { if (sync_types->object) { outliner_select_sync_from_object(view_layer, active_data->object, te, tselem); } -- cgit v1.2.3