forked from bartvdbraak/blender
Compositor node preview:
moved the hide preview logic to a method on bNodeTreeType. This way the node.c keeps clean, but logic could still be shared. Implementing this per node, can lead to future errors.
This commit is contained in:
parent
6c83d92d58
commit
4332cd16fb
@ -42,7 +42,7 @@ extern "C" {
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 269
|
||||
#define BLENDER_SUBVERSION 5
|
||||
#define BLENDER_SUBVERSION 6
|
||||
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
|
||||
#define BLENDER_MINVERSION 262
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -306,6 +306,8 @@ typedef struct bNodeTreeType {
|
||||
void (*update)(struct bNodeTree *ntree);
|
||||
|
||||
int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
|
||||
|
||||
void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode);
|
||||
|
||||
/* RNA integration */
|
||||
ExtensionRNA ext;
|
||||
|
@ -134,16 +134,12 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
|
||||
|
||||
node_add_sockets_from_type(ntree, node, ntype);
|
||||
|
||||
/* Composite node will only show previews for input classes
|
||||
* by default, other will be hidden
|
||||
* but can be made visible with the show_preview option */
|
||||
if (ntree->typeinfo->type == NTREE_COMPOSIT && ntype->nclass != NODE_CLASS_INPUT) {
|
||||
node->flag &= ~NODE_PREVIEW;
|
||||
}
|
||||
|
||||
if (ntype->initfunc != NULL)
|
||||
ntype->initfunc(ntree, node);
|
||||
|
||||
|
||||
if (ntree->typeinfo->node_add_init != NULL)
|
||||
ntree->typeinfo->node_add_init(ntree, node);
|
||||
|
||||
/* extra init callback */
|
||||
if (ntype->initfunc_api) {
|
||||
PointerRNA ptr;
|
||||
|
@ -218,6 +218,15 @@ static void update(bNodeTree *ntree)
|
||||
}
|
||||
}
|
||||
|
||||
static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode) {
|
||||
/* Composite node will only show previews for input classes
|
||||
* by default, other will be hidden
|
||||
* but can be made visible with the show_preview option */
|
||||
if (bnode->typeinfo->nclass != NODE_CLASS_INPUT) {
|
||||
bnode->flag &= ~NODE_PREVIEW;
|
||||
}
|
||||
}
|
||||
|
||||
bNodeTreeType *ntreeType_Composite;
|
||||
|
||||
void register_node_tree_type_cmp(void)
|
||||
@ -238,6 +247,7 @@ void register_node_tree_type_cmp(void)
|
||||
tt->local_merge = local_merge;
|
||||
tt->update = update;
|
||||
tt->get_from_context = composite_get_from_context;
|
||||
tt->node_add_init = composite_node_add_init;
|
||||
|
||||
tt->ext.srna = &RNA_CompositorNodeTree;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user