Commit: 2efdbeb58bd172939edb3a01f25d119c821e6627 Author: Hans Goudey Date: Thu Dec 8 11:49:41 2022 -0600 Branches: master https://developer.blender.org/rB2efdbeb58bd172939edb3a01f25d119c821e6627
Cleanup: Organize and comment bNode struct I organized the fields so that similar variables were closer together and more "important" fields were closer to the beginning. I also added comments to help describe the purpose of most fields. Differential Revision: https://developer.blender.org/D16710 =================================================================== M source/blender/makesdna/DNA_node_types.h =================================================================== diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 7764e2937b4..10cdc8e702e 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -280,57 +280,80 @@ typedef enum eNodeSocketFlag { SOCK_HIDE_LABEL = (1 << 12), } eNodeSocketFlag; -/** TODO: Limit data in #bNode to what we want to see saved. */ typedef struct bNode { struct bNode *next, *prev; - /** User-defined properties. */ - IDProperty *prop; - - /** Runtime type information. */ - struct bNodeType *typeinfo; - /** Runtime type identifier. */ - char idname[64]; + /* Input and output #bNodeSocket. */ + ListBase inputs, outputs; - /** MAX_NAME. */ + /** The node's name for unique identification and string lookup. MAX_NAME. */ char name[64]; + + /** + * A value that uniquely identifies a node in a node tree even when the name changes. + * This also allows referencing nodes more efficiently than with strings. + * + * Must be set whenever a node is added to a tree, besides a simple tree copy. + * Must always be positive. + */ + int32_t identifier; + int flag; - short type; - char _pad2[6]; + /** + * String identifier of the type like "FunctionNodeCompare". Stored in files to allow retrieving + * the node type for node types including custom nodes defined in Python by addons. + */ + char idname[64]; - /** Custom user-defined color. */ - float color[3]; + /** Type information retrieved from the #idname. TODO: Move to runtime data. */ + struct bNodeType *typeinfo; + + /** + * Integer type used for builtin nodes, allowing cheaper lookup and changing ID names with + * versioning code. Avoid using directly if possible, since may not match runtime node type if it + * wasn't found. + */ + int16_t type; + + char _pad1[2]; + + /** Used for some builtin nodes that store properties but don't have a storage struct . */ + int16_t custom1, custom2; + float custom3, custom4; - ListBase inputs, outputs; - /** Parent node. */ - struct bNode *parent; /** Optional link to libdata. */ struct ID *id; - /** Custom data, must be struct, for storage in file. */ + + /** Custom data struct for node properties for storage in files. */ void *storage; - /** Root offset for drawing (parent space). */ - float locx, locy; - /** Node custom width and height. */ - float width, height; - /** Additional offset from loc. */ - float offsetx, offsety; + /** + * Custom properties often defined by addons to store arbitrary data on nodes. A non-builtin + * equivalent to #storage. + */ + IDProperty *prop; + /** Parent node (for frame nodes). */ + struct bNode *parent; + + /** Root location in the node canvas (in parent space). */ + float locx, locy; /** - * A value that uniquely identifies a node in a node tree even when the name changes. - * This also allows referencing nodes more efficiently than with strings. - * - * Must be set whenever a node is added to a tree, besides a simple tree copy. - * Must always be positive. + * Custom width and height controlled by users. Height is calculate automatically for most + * nodes. */ - int32_t identifier; + float width, height; + /** Additional offset from loc. TODO: Redundant with #locx and #locy, remove/deprecate. */ + float offsetx, offsety; /** Custom user-defined label, MAX_NAME. */ char label[64]; - /** To be abused for buttons. */ - short custom1, custom2; - float custom3, custom4; + + /** Custom user-defined color. */ + float color[3]; + + char _pad2[4]; bNodeRuntimeHandle *runtime; _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
