Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-03-05 19:38:53 +0300
committerJulian Eisel <julian@blender.org>2021-03-05 19:46:33 +0300
commitb9e54566e3b1a49d9757680da64d8e19c136c706 (patch)
tree2888ae7a1c41eab1467995a569218f5cdc413f70 /source/blender/editors/space_outliner/outliner_select.c
parented84161529527274852d5665f93a7d8b7cd1be9c (diff)
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.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index e31af48ab7e..d53a37fa60e 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -198,7 +198,7 @@ void outliner_item_mode_toggle(bContext *C,
{
TreeStoreElem *tselem = TREESTORE(te);
- if (tselem->type == 0 && te->idcode == ID_OB) {
+ if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
Object *ob = (Object *)tselem->id;
Base *base = BKE_view_layer_base_find(tvc->view_layer, ob);
@@ -301,7 +301,7 @@ static void tree_element_object_activate(bContext *C,
Object *ob = NULL;
/* if id is not object, we search back */
- if (tselem->type == 0 && te->idcode == ID_OB) {
+ if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
ob = (Object *)tselem->id;
}
else {
@@ -443,7 +443,7 @@ static void tree_element_world_activate(bContext *C, Scene *scene, TreeElement *
TreeElement *tep = te->parent;
if (tep) {
TreeStoreElem *tselem = TREESTORE(tep);
- if (tselem->type == 0) {
+ if (tselem->type == TSE_SOME_ID) {
sce = (Scene *)tselem->id;
}
}
@@ -1165,7 +1165,7 @@ static void outliner_set_properties_tab(bContext *C, TreeElement *te, TreeStoreE
int context = 0;
/* ID Types */
- if (tselem->type == 0) {
+ if (tselem->type == TSE_SOME_ID) {
RNA_id_pointer_create(tselem->id, &ptr);
switch (te->idcode) {
@@ -1374,12 +1374,12 @@ static void do_outliner_item_activate_tree_element(bContext *C,
tvc->scene,
tvc->view_layer,
te,
- (extend && tselem->type == 0) ? OL_SETSEL_EXTEND :
- OL_SETSEL_NORMAL,
- recursive && tselem->type == 0);
+ (extend && tselem->type == TSE_SOME_ID) ? OL_SETSEL_EXTEND :
+ OL_SETSEL_NORMAL,
+ recursive && tselem->type == TSE_SOME_ID);
}
- if (tselem->type == 0) { /* The lib blocks. */
+ if (tselem->type == TSE_SOME_ID) { /* The lib blocks. */
if (do_activate_data == false) {
/* Only select in outliner. */
}