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_edit.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_edit.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 09aa268d856..c63209b6b60 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -638,7 +638,7 @@ static bool outliner_id_remap_find_tree_element(bContext *C,
if (y > te->ys && y < te->ys + UI_UNIT_Y) {
TreeStoreElem *tselem = TREESTORE(te);
- if (tselem->type == 0 && tselem->id) {
+ if ((tselem->type == TSE_SOME_ID) && tselem->id) {
printf("found id %s (%p)!\n", tselem->id->name, tselem->id);
RNA_enum_set(op->ptr, "id_type", GS(tselem->id->name));
@@ -763,7 +763,7 @@ static int outliner_id_copy_tag(SpaceOutliner *space_outliner, ListBase *tree)
TreeStoreElem *tselem = TREESTORE(te);
/* if item is selected and is an ID, tag it as needing to be copied. */
- if (tselem->flag & TSE_SELECTED && ELEM(tselem->type, 0, TSE_LAYER_COLLECTION)) {
+ if (tselem->flag & TSE_SELECTED && ELEM(tselem->type, TSE_SOME_ID, TSE_LAYER_COLLECTION)) {
ID *id = tselem->id;
if (!(id->tag & LIB_TAG_DOIT)) {
BKE_copybuffer_tag_ID(tselem->id);
@@ -1640,7 +1640,7 @@ static int subtree_has_objects(ListBase *lb)
{
LISTBASE_FOREACH (TreeElement *, te, lb) {
TreeStoreElem *tselem = TREESTORE(te);
- if (tselem->type == 0 && te->idcode == ID_OB) {
+ if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
return 1;
}
if (subtree_has_objects(&te->subtree)) {
@@ -1658,7 +1658,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *space_outli
TreeStoreElem *tselem = TREESTORE(te);
if (ELEM(tselem->type,
- 0,
+ TSE_SOME_ID,
TSE_SCENE_OBJECTS_BASE,
TSE_VIEW_COLLECTION_BASE,
TSE_LAYER_COLLECTION)) {