diff options
author | Charlie Jolly <charlie> | 2022-02-07 18:29:16 +0300 |
---|---|---|
committer | Charlie Jolly <mistajolly@gmail.com> | 2022-02-07 18:39:39 +0300 |
commit | fe4e85a9240ff95909be33c7e72e0ab969d5a4ca (patch) | |
tree | a1d98ccdbe2687b1712508c0b7dbf8bc361668e8 /source/blender/blenkernel/BKE_node.h | |
parent | a7b598203034c04f5fce3088d6b07799d74f832c (diff) |
Nodes: Dynamic node class for Map Range node
This patch makes it possible to set the UI color of a node's
header bar and override the default from the node's typeinfo.
Currently the color is taken from the `.nclass`
member of the node's bNodeType->TypeInfo struct.
This is created once when registering the node.
The TypeInfo is used for both UI and non-UI functionality.
Since the TypeInfo is shared, the header bar for the node
can't be changed without changing all nodes of that type.
The Map Range node is shown as a `Converter` or blue color by default.
This patch allows this to be changed dynamically to `Vector` or purple.
This is done by adding a `ui_class` callback to node typeinfo struct.
Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13936
Diffstat (limited to 'source/blender/blenkernel/BKE_node.h')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index d583b5f0648..7ffa180b523 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -274,6 +274,9 @@ typedef struct bNodeType { char *label, int maxlen); + /** Optional override for node class, used for drawing node header. */ + int (*ui_class)(const struct bNode *node); + /** Called when the node is updated in the editor. */ void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node); /** Check and update if internal ID data has changed. */ |