@@ -970,8 +970,6 @@ PyObject *py_unreal_engine_add_component_to_blueprint(PyObject * self, PyObject
970970 bp->SimpleConstructionScript ->AddNode (node);
971971 }
972972
973- FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified (bp);
974-
975973 ue_PyUObject *ret = ue_get_python_wrapper (node->ComponentTemplate );
976974 if (!ret)
977975 return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
@@ -1104,6 +1102,53 @@ PyObject *py_unreal_engine_blueprint_add_function(PyObject * self, PyObject * ar
11041102 return ret;
11051103}
11061104
1105+ PyObject *py_unreal_engine_blueprint_add_event_dispatcher (PyObject * self, PyObject * args) {
1106+
1107+ PyObject *py_blueprint;
1108+ char *name;
1109+ if (!PyArg_ParseTuple (args, " Os:blueprint_add_event_dispatcher" , &py_blueprint, &name)) {
1110+ return NULL ;
1111+ }
1112+
1113+ UBlueprint *bp = ue_py_check_type<UBlueprint>(py_blueprint);
1114+ if (!bp)
1115+ return PyErr_Format (PyExc_Exception, " argument is not a UBlueprint" );
1116+
1117+ FName multicast_name = FName (UTF8_TO_TCHAR (name));
1118+
1119+ bp->Modify ();
1120+
1121+ const UEdGraphSchema_K2 *state = GetDefault<UEdGraphSchema_K2>();
1122+
1123+ FEdGraphPinType multicast_type;
1124+ multicast_type.PinCategory = state->PC_MCDelegate ;
1125+
1126+ if (!FBlueprintEditorUtils::AddMemberVariable (bp, multicast_name, multicast_type)) {
1127+ return PyErr_Format (PyExc_Exception, " unable to create multicast variable" );
1128+ }
1129+
1130+ UEdGraph *graph = FBlueprintEditorUtils::CreateNewGraph (bp, multicast_name, UEdGraph::StaticClass (), UEdGraphSchema_K2::StaticClass ());
1131+ if (!graph) {
1132+ return PyErr_Format (PyExc_Exception, " unable to create graph" );
1133+ }
1134+
1135+ graph->bEditable = false ;
1136+
1137+ state->CreateDefaultNodesForGraph (*graph);
1138+ state->CreateFunctionGraphTerminators (*graph, (UClass *)nullptr );
1139+ state->AddExtraFunctionFlags (graph, (FUNC_BlueprintCallable | FUNC_BlueprintEvent | FUNC_Public));
1140+ state->MarkFunctionEntryAsEditable (graph, true );
1141+
1142+ bp->DelegateSignatureGraphs .Add (graph);
1143+ FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified (bp);
1144+
1145+ PyObject *ret = (PyObject *)ue_get_python_wrapper (graph);
1146+ if (!ret)
1147+ return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
1148+ Py_INCREF (ret);
1149+ return ret;
1150+ }
1151+
11071152PyObject *py_unreal_engine_blueprint_add_ubergraph_page (PyObject * self, PyObject * args) {
11081153
11091154 PyObject *py_blueprint;
@@ -1145,7 +1190,7 @@ PyObject *py_unreal_engine_create_new_graph(PyObject * self, PyObject * args) {
11451190 return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
11461191 }
11471192 ue_PyUObject *py_obj = (ue_PyUObject *)py_object;
1148-
1193+
11491194 if (!ue_is_pyuobject (py_graph_class)) {
11501195 return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
11511196 }
0 commit comments