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/makesdna/DNA_outliner_types.h
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/makesdna/DNA_outliner_types.h')
-rw-r--r--source/blender/makesdna/DNA_outliner_types.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index 16129768b60..7a39e0caef3 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -73,6 +73,16 @@ enum {
/** #TreeStoreElem.types */
typedef enum eTreeStoreElemType {
+ /**
+ * If an element is of this type, `TreeStoreElem.id` points to a valid ID and the ID-type can be
+ * received through `TreeElement.idcode` (or `GS(TreeStoreElem.id->name)`). Note however that the
+ * types below may also have a valid ID pointer (see #TSE_IS_REAL_ID()).
+ *
+ * In cases where the type is still checked against "0" (even implicitly), please replace it with
+ * an explicit check against `TSE_SOME_ID`.
+ */
+ TSE_SOME_ID = 0,
+
TSE_NLA = 1, /* NO ID */
TSE_NLA_ACTION = 2,
TSE_DEFGROUP_BASE = 3,