Remove the NODE_OPTIONS flag usage from node->typeinfo. This is a redundant flag which can be replaced by simply checking for nodetype->uifunc/uifuncbut callbacks (if these callbacks are defined the node
type generally supports options). Note that the node->flag still uses NODE_OPTIONS as a switch to toggle the display of such options!
This commit is contained in:
@@ -402,7 +402,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
|
||||
}
|
||||
|
||||
/* buttons rect? */
|
||||
if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
|
||||
if (node->typeinfo->uifunc && (node->flag & NODE_OPTIONS)) {
|
||||
dy -= NODE_DYS / 2;
|
||||
|
||||
/* set this for uifunc() that don't use layout engine yet */
|
||||
|
||||
@@ -1411,7 +1411,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
|
||||
|
||||
if (toggle_flag == NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW) == 0)
|
||||
continue;
|
||||
if (toggle_flag == NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS) == 0)
|
||||
if (toggle_flag == NODE_OPTIONS && !(node->typeinfo->uifunc || node->typeinfo->uifuncbut))
|
||||
continue;
|
||||
|
||||
if (node->flag & toggle_flag)
|
||||
@@ -1425,7 +1425,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
|
||||
|
||||
if (toggle_flag == NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW) == 0)
|
||||
continue;
|
||||
if (toggle_flag == NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS) == 0)
|
||||
if (toggle_flag == NODE_OPTIONS && !(node->typeinfo->uifunc || node->typeinfo->uifuncbut))
|
||||
continue;
|
||||
|
||||
if ((tot_eq && tot_neq) || tot_eq == 0)
|
||||
|
||||
@@ -207,7 +207,7 @@ static void node_socket_add_replace(const bContext *C, bNodeTree *ntree, bNode *
|
||||
break;
|
||||
|
||||
if (node_from)
|
||||
if (!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
|
||||
if (node_from->inputs.first || node_from->typeinfo->uifunc || node_from->typeinfo->uifuncbut)
|
||||
node_from = NULL;
|
||||
|
||||
if (node_prev && node_prev->type == type && node_link_item_compare(node_prev, item)) {
|
||||
|
||||
@@ -1336,9 +1336,6 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc
|
||||
nt->freefunc_api = (have_function[5]) ? rna_Node_free : NULL;
|
||||
nt->uifunc = (have_function[6]) ? rna_Node_draw_buttons : NULL;
|
||||
nt->uifuncbut = (have_function[7]) ? rna_Node_draw_buttons_ext : NULL;
|
||||
/* node buttons are only drawn if the options flag is set */
|
||||
if (nt->uifunc || nt->uifuncbut)
|
||||
nt->flag |= NODE_OPTIONS;
|
||||
|
||||
/* sanitize size values in case not all have been registered */
|
||||
if (nt->maxwidth < nt->minwidth)
|
||||
|
||||
Reference in New Issue
Block a user