@@ -27,9 +27,55 @@ static PyObject *py_ue_paste_nodes_here(PyObject *cls, PyObject * args)
2727 Py_RETURN_NONE;
2828}
2929
30+ static PyObject *py_ue_update_material_after_graph_change (PyObject *cls, PyObject * args)
31+ {
32+ PyObject *py_graph;
33+
34+ if (!PyArg_ParseTuple (args, " O:update_material_after_graph_change" , &py_graph))
35+ return nullptr ;
36+
37+ UEdGraph *Graph = ue_py_check_type<UEdGraph>(py_graph);
38+ if (!Graph)
39+ {
40+ return PyErr_Format (PyExc_Exception, " argument is not a UEdGraph" );
41+ }
42+
43+ FMaterialEditorUtilities::UpdateMaterialAfterGraphChange (Graph);
44+ Py_RETURN_NONE;
45+ }
46+
47+ static PyObject *py_ue_command_apply (PyObject *cls, PyObject * args)
48+ {
49+ PyObject *py_material;
50+
51+ if (!PyArg_ParseTuple (args, " O:command_apply" , &py_material))
52+ return nullptr ;
53+
54+ UMaterial *Material = ue_py_check_type<UMaterial>(py_material);
55+ if (!Material)
56+ {
57+ return PyErr_Format (PyExc_Exception, " argument is not a UMaterial" );
58+ }
59+
60+ IAssetEditorInstance *Instance = FAssetEditorManager::Get ().FindEditorForAsset (Material, false );
61+ if (!Instance)
62+ {
63+ return PyErr_Format (PyExc_Exception, " unable to retrieve editor for UMaterial" );
64+ }
65+
66+ IMaterialEditor *MaterialEditor = (IMaterialEditor *)Instance;
67+
68+ MaterialEditor->GetToolkitCommands ()->ExecuteAction (FMaterialEditorCommands::Get ().Apply .ToSharedRef ());
69+
70+ Py_RETURN_NONE;
71+
72+ }
73+
3074
3175static PyMethodDef ue_PyFMaterialEditorUtilities_methods[] = {
3276 { " paste_nodes_here" , (PyCFunction)py_ue_paste_nodes_here, METH_VARARGS | METH_CLASS, " " },
77+ { " update_material_after_graph_change" , (PyCFunction)py_ue_update_material_after_graph_change, METH_VARARGS | METH_CLASS, " " },
78+ { " command_apply" , (PyCFunction)py_ue_command_apply, METH_VARARGS | METH_CLASS, " " },
3379 { NULL } /* Sentinel */
3480};
3581
0 commit comments