Skip to content

Commit 020763a

Browse files
authored
Add break_all_links() and get_linked_to()
for blueprint pins
1 parent e2802a5 commit 020763a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Source/UnrealEnginePython/Private/Blueprint/UEPyEdGraphPin.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,49 @@ static PyObject *py_ue_edgraphpin_break_link_to(ue_PyEdGraphPin *self, PyObject
8080
Py_RETURN_NONE;
8181
}
8282

83+
static PyObject *py_ue_edgraphpin_break_all_pin_links(ue_PyEdGraphPin *self, PyObject * args)
84+
{
85+
PyObject *py_notify_nodes = nullptr;
86+
if (!PyArg_ParseTuple(args, "O:break_all_pin_links", &py_notify_nodes))
87+
{
88+
return NULL;
89+
}
90+
91+
bool notify_nodes = true;
92+
if (py_notify_nodes && !PyObject_IsTrue(py_notify_nodes))
93+
notify_nodes = false;
94+
95+
self->pin->BreakAllPinLinks(notify_nodes);
96+
97+
if (UBlueprint *bp = Cast<UBlueprint>(self->pin->GetOwningNode()->GetGraph()->GetOuter()))
98+
{
99+
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(bp);
100+
}
101+
102+
Py_RETURN_NONE;
103+
}
104+
105+
static PyObject *py_ue_edgraphpin_get_linked_to(ue_PyEdGraphPin * self, PyObject * args)
106+
{
107+
PyObject *pins = PyList_New(0);
108+
109+
TArray<UEdGraphPin*> Links = self->pin->LinkedTo;
110+
111+
for (int32 i = 0; i < Links.Num(); i++)
112+
{
113+
UEdGraphPin *pin = Links[i];
114+
ue_PyUObject *item = (ue_PyUObject *)py_ue_new_edgraphpin(pin);
115+
if (item)
116+
PyList_Append(pins, (PyObject *)item);
117+
}
118+
return pins;
119+
}
120+
83121
static PyMethodDef ue_PyEdGraphPin_methods[] = {
84122
{ "make_link_to", (PyCFunction)py_ue_edgraphpin_make_link_to, METH_VARARGS, "" },
85123
{ "break_link_to", (PyCFunction)py_ue_edgraphpin_break_link_to, METH_VARARGS, "" },
124+
{ "break_all_pin_links", (PyCFunction)py_ue_edgraphpin_break_all_pin_links, METH_VARARGS, "" },
125+
{ "get_linked_to", (PyCFunction)py_ue_edgraphpin_get_linked_to, METH_VARARGS, "" },
86126
{ "connect", (PyCFunction)py_ue_edgraphpin_connect, METH_VARARGS, "" },
87127
{ NULL } /* Sentinel */
88128
};

0 commit comments

Comments
 (0)