@@ -381,6 +381,127 @@ PyObject *py_ue_graph_add_node(ue_PyUObject * self, PyObject * args)
381381 Py_RETURN_UOBJECT (node);
382382}
383383
384+ PyObject *py_ue_graph_remove_node (ue_PyUObject * self, PyObject * args)
385+ {
386+
387+ ue_py_check (self);
388+
389+ PyObject *py_node_class;
390+ int x = 0 ;
391+ int y = 0 ;
392+
393+ char *metadata = nullptr ;
394+ PyObject *py_data = nullptr ;
395+
396+ if (!PyArg_ParseTuple (args, " O|iisO:graph_remove_node" , &py_node_class, &x, &y, &metadata, &py_data))
397+ {
398+ return nullptr ;
399+ }
400+
401+ UEdGraph *graph = ue_py_check_type<UEdGraph>(self);
402+ if (!graph)
403+ return PyErr_Format (PyExc_Exception, " uobject is not a UEdGraph" );
404+
405+ UObject *u_obj = ue_py_check_type<UObject>(py_node_class);
406+ if (!u_obj)
407+ return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
408+
409+ UEdGraphNode *node = nullptr ;
410+
411+ if (UClass *u_class = Cast<UClass>(u_obj))
412+ {
413+ if (!u_class->IsChildOf <UEdGraphNode>())
414+ {
415+ return PyErr_Format (PyExc_Exception, " argument is not a child of UEdGraphNode" );
416+ }
417+ node = NewObject<UEdGraphNode>(graph, u_class);
418+ node->PostLoad ();
419+ }
420+ else
421+ {
422+ node = Cast<UEdGraphNode>(u_obj);
423+ if (node)
424+ {
425+ if (node->GetOuter () != graph)
426+
427+ node->Rename (*node->GetName (), graph);
428+ }
429+ }
430+
431+ if (!node)
432+ return PyErr_Format (PyExc_Exception, " argument is not a supported type" );
433+
434+ graph->RemoveNode (node);
435+
436+ if (UBlueprint *bp = Cast<UBlueprint>(node->GetGraph ()->GetOuter ()))
437+ {
438+ FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified (bp);
439+ }
440+
441+ Py_RETURN_NONE;
442+ }
443+
444+ PyObject *py_ue_graph_reconstruct_node (ue_PyUObject * self, PyObject * args)
445+ {
446+
447+ ue_py_check (self);
448+
449+ PyObject *py_node_class;
450+ int x = 0 ;
451+ int y = 0 ;
452+
453+ char *metadata = nullptr ;
454+ PyObject *py_data = nullptr ;
455+
456+ if (!PyArg_ParseTuple (args, " O|iisO:graph_reconstruct_node" , &py_node_class, &x, &y, &metadata, &py_data))
457+ {
458+ return nullptr ;
459+ }
460+
461+ UEdGraph *graph = ue_py_check_type<UEdGraph>(self);
462+ if (!graph)
463+ return PyErr_Format (PyExc_Exception, " uobject is not a UEdGraph" );
464+
465+ UObject *u_obj = ue_py_check_type<UObject>(py_node_class);
466+ if (!u_obj)
467+ return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
468+
469+ UEdGraphNode *node = nullptr ;
470+
471+ if (UClass *u_class = Cast<UClass>(u_obj))
472+ {
473+ if (!u_class->IsChildOf <UEdGraphNode>())
474+ {
475+ return PyErr_Format (PyExc_Exception, " argument is not a child of UEdGraphNode" );
476+ }
477+ node = NewObject<UEdGraphNode>(graph, u_class);
478+ node->PostLoad ();
479+ }
480+ else
481+ {
482+ node = Cast<UEdGraphNode>(u_obj);
483+ if (node)
484+ {
485+ if (node->GetOuter () != graph)
486+
487+ node->Rename (*node->GetName (), graph);
488+ }
489+ }
490+
491+ if (!node)
492+ return PyErr_Format (PyExc_Exception, " argument is not a supported type" );
493+
494+ // graph->RemoveNode(node);
495+ node->ReconstructNode ();
496+
497+ if (UBlueprint *bp = Cast<UBlueprint>(node->GetGraph ()->GetOuter ()))
498+ {
499+ FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified (bp);
500+ }
501+
502+ Py_RETURN_NONE;
503+ }
504+
384505PyObject *py_ue_graph_add_node_dynamic_cast (ue_PyUObject * self, PyObject * args)
385506{
386507
0 commit comments