Skip to content

Commit 6dea293

Browse files
author
Roberto De Ioris
committed
added pin advanced connection
1 parent c1baebe commit 6dea293

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Source/UnrealEnginePython/Private/UEPyEdGraphPin.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,29 @@ static PyObject *py_ue_edgraphpin_make_link_to(ue_PyEdGraphPin *self, PyObject *
2727
return Py_None;
2828
}
2929

30+
static PyObject *py_ue_edgraphpin_connect(ue_PyEdGraphPin *self, PyObject * args) {
31+
PyObject *other_pin;
32+
if (!PyArg_ParseTuple(args, "O:connect", &other_pin)) {
33+
return NULL;
34+
}
35+
36+
ue_PyEdGraphPin *py_other_pin = py_ue_is_edgraphpin(other_pin);
37+
if (!py_other_pin) {
38+
return PyErr_Format(PyExc_Exception, "argument is not a UEdGraphPin");
39+
}
40+
41+
if (!self->pin->GetSchema()->TryCreateConnection(self->pin, py_other_pin->pin)) {
42+
return PyErr_Format(PyExc_Exception, "unable to connect pins");
43+
}
44+
45+
if (UBlueprint *bp = Cast<UBlueprint>(self->pin->GetOwningNode()->GetGraph()->GetOuter())) {
46+
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(bp);
47+
}
48+
49+
Py_INCREF(Py_None);
50+
return Py_None;
51+
}
52+
3053
static PyObject *py_ue_edgraphpin_break_link_to(ue_PyEdGraphPin *self, PyObject * args) {
3154
PyObject *other_pin;
3255
if (!PyArg_ParseTuple(args, "O:break_link_to", &other_pin)) {
@@ -51,6 +74,7 @@ static PyObject *py_ue_edgraphpin_break_link_to(ue_PyEdGraphPin *self, PyObject
5174
static PyMethodDef ue_PyEdGraphPin_methods[] = {
5275
{ "make_link_to", (PyCFunction)py_ue_edgraphpin_make_link_to, METH_VARARGS, "" },
5376
{ "break_link_to", (PyCFunction)py_ue_edgraphpin_break_link_to, METH_VARARGS, "" },
77+
{ "connect", (PyCFunction)py_ue_edgraphpin_connect, METH_VARARGS, "" },
5478
{ NULL } /* Sentinel */
5579
};
5680

0 commit comments

Comments
 (0)