forked from bartvdbraak/blender
Fix for #35134.
The node link operator had a feature to automatically expose sockets in node groups when ctrl+shift+clicking on a node socket, which would create a node group input/output node. This was intended as a shortcut but conflicts with other features such as socket selection and viewer creation. It is also hardly necessary now that input/output nodes have an extension socket, which is much easier to use. Removed this expose functionality completely.
This commit is contained in:
parent
a4a2949309
commit
abf1df03eb
@ -233,17 +233,10 @@ void node_keymap(struct wmKeyConfig *keyconf)
|
||||
|
||||
/* each of these falls through if not handled... */
|
||||
kmi = WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(kmi->ptr, "detach", FALSE);
|
||||
RNA_boolean_set(kmi->ptr, "expose", FALSE);
|
||||
RNA_boolean_set(kmi->ptr, "detach", FALSE);
|
||||
kmi = WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_boolean_set(kmi->ptr, "detach", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "expose", FALSE);
|
||||
kmi = WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "detach", FALSE);
|
||||
RNA_boolean_set(kmi->ptr, "expose", TRUE);
|
||||
kmi = WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
|
||||
RNA_boolean_set(kmi->ptr, "detach", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "expose", TRUE);
|
||||
|
||||
WM_keymap_add_item(keymap, "NODE_OT_resize", LEFTMOUSE, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "NODE_OT_add_reroute", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
||||
|
@ -443,15 +443,12 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
bNodeLink *link;
|
||||
LinkData *linkdata;
|
||||
int in_out;
|
||||
int expose;
|
||||
|
||||
in_out = nldrag->in_out;
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
|
||||
&snode->cursor[0], &snode->cursor[1]);
|
||||
|
||||
expose = RNA_boolean_get(op->ptr, "expose");
|
||||
|
||||
switch (event->type) {
|
||||
case MOUSEMOVE:
|
||||
|
||||
@ -515,12 +512,6 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
case RIGHTMOUSE:
|
||||
case MIDDLEMOUSE:
|
||||
{
|
||||
/* XXX expose + detach could have some ugly corner cases and is not great.
|
||||
* The first link will define the exposed socket type, which is arbitrary.
|
||||
* Some of the resulting links may turn out to be invalid.
|
||||
*/
|
||||
bNode *ionode = NULL;
|
||||
bNodeSocket *iosock = NULL, *gsock;
|
||||
for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
|
||||
link = linkdata->data;
|
||||
|
||||
@ -537,57 +528,6 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
if (in_out == SOCK_OUT)
|
||||
node_remove_extra_links(snode, link->tosock, link);
|
||||
}
|
||||
else if (expose) {
|
||||
if (link->tosock) {
|
||||
if (!ionode) {
|
||||
ionode = nodeAddStaticNode(C, snode->edittree, NODE_GROUP_INPUT);
|
||||
gsock = ntreeAddSocketInterfaceFromSocket(snode->edittree, link->tonode, link->tosock);
|
||||
node_group_input_verify(snode->edittree, ionode, (ID *)snode->edittree);
|
||||
iosock = node_group_input_find_socket(ionode, gsock->identifier);
|
||||
|
||||
{
|
||||
/* place the node at the mouse pointer */
|
||||
float sockx = 42.0f + 3 * HIDDEN_RAD; /* XXX totally arbitrary initial hidden node size ... */
|
||||
float socky = -HIDDEN_RAD;
|
||||
|
||||
ionode->locx = snode->cursor[0] - sockx;
|
||||
ionode->locy = snode->cursor[1] - socky;
|
||||
}
|
||||
}
|
||||
link->fromnode = ionode;
|
||||
link->fromsock = iosock;
|
||||
|
||||
BLI_addtail(&ntree->links, link);
|
||||
|
||||
ntree->update |= NTREE_UPDATE_GROUP_IN | NTREE_UPDATE_LINKS;
|
||||
}
|
||||
else if (link->fromsock) {
|
||||
if (!ionode) {
|
||||
ionode = nodeAddStaticNode(C, snode->edittree, NODE_GROUP_OUTPUT);
|
||||
gsock = ntreeAddSocketInterfaceFromSocket(snode->edittree, link->fromnode, link->fromsock);
|
||||
node_group_output_verify(snode->edittree, ionode, (ID *)snode->edittree);
|
||||
iosock = node_group_output_find_socket(ionode, gsock->identifier);
|
||||
|
||||
{
|
||||
/* place the node at the mouse pointer */
|
||||
float sockx = 0;
|
||||
float socky = -HIDDEN_RAD;
|
||||
|
||||
ionode->locx = snode->cursor[0] - sockx;
|
||||
ionode->locy = snode->cursor[1] - socky;
|
||||
}
|
||||
}
|
||||
link->tonode = ionode;
|
||||
link->tosock = iosock;
|
||||
|
||||
BLI_addtail(&ntree->links, link);
|
||||
|
||||
ntree->update |= NTREE_UPDATE_GROUP_OUT | NTREE_UPDATE_LINKS;
|
||||
}
|
||||
else {
|
||||
nodeRemLink(snode->edittree, link);
|
||||
}
|
||||
}
|
||||
else
|
||||
nodeRemLink(ntree, link);
|
||||
}
|
||||
@ -756,7 +696,6 @@ void NODE_OT_link(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
||||
RNA_def_boolean(ot->srna, "detach", FALSE, "Detach", "Detach and redirect existing links");
|
||||
RNA_def_boolean(ot->srna, "expose", FALSE, "Expose", "Expose the socket as an interface node");
|
||||
}
|
||||
|
||||
/* ********************** Make Link operator ***************** */
|
||||
|
Loading…
Reference in New Issue
Block a user