diff --git a/modules/material_maker/SCsub b/modules/material_maker/SCsub index 926375ad0..3d89e8f20 100644 --- a/modules/material_maker/SCsub +++ b/modules/material_maker/SCsub @@ -14,6 +14,10 @@ sources = [ "nodes/mm_material.cpp", "nodes/mm_node_universal_property.cpp", "nodes/mm_node.cpp", + + #"editor/mat_maker_gd_editor.cpp", + #"editor/mm_create_name_popup.cpp", + #"editor/mm_graph_node.cpp", ] diff --git a/modules/material_maker/config.py b/modules/material_maker/config.py index 8b3e719ca..21960f2fe 100644 --- a/modules/material_maker/config.py +++ b/modules/material_maker/config.py @@ -14,6 +14,8 @@ def get_doc_classes(): "MMNode", "MMNodeUniversalProperty", "MMMaterial", + "MMGraphNode", + "MatMakerGDEditor", ] def get_doc_path(): diff --git a/modules/material_maker/editor/mat_maker_gd_editor.cpp b/modules/material_maker/editor/mat_maker_gd_editor.cpp index 31f610426..5783e5da5 100644 --- a/modules/material_maker/editor/mat_maker_gd_editor.cpp +++ b/modules/material_maker/editor/mat_maker_gd_editor.cpp @@ -151,6 +151,10 @@ void MatMakerGDEditor::recreate() { if (ip.is_valid()) { MMGraphNode *input_node = find_graph_node_for(n); MMGraphNode *output_node = find_graph_node_for(ip->get_input_property()->get_owner()); + + ERR_CONTINUE(!input_node); + ERR_CONTINUE(!output_node); + int to_slot = input_node->get_input_property_graph_node_slot_index(ip); int from_slot = output_node->get_output_property_graph_node_slot_index(ip->get_input_property()); _graph_edit->connect_node(output_node->get_name(), from_slot, input_node->get_name(), to_slot); @@ -337,9 +341,9 @@ MatMakerGDEditor::~MatMakerGDEditor() { void MatMakerGDEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("get_graph_edit"), &MatMakerGDEditor::get_graph_edit); - ClassDB::bind_method(D_METHOD("get_material"), &MatMakerGDEditor::get_material); - ClassDB::bind_method(D_METHOD("set_material", "value"), &MatMakerGDEditor::set_material); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*_material", PROPERTY_HINT_RESOURCE_TYPE, "Ref"), "set_material", "get_material"); + ClassDB::bind_method(D_METHOD("get_mm_material"), &MatMakerGDEditor::get_mm_material); + ClassDB::bind_method(D_METHOD("set_mm_material", "value"), &MatMakerGDEditor::set_mm_material); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mm_material", PROPERTY_HINT_RESOURCE_TYPE, "MMMaterial"), "set_mm_material", "get_mm_material"); ClassDB::bind_method(D_METHOD("get_ignore_material_change_event"), &MatMakerGDEditor::get_ignore_material_change_event); ClassDB::bind_method(D_METHOD("set_ignore_material_change_event", "value"), &MatMakerGDEditor::set_ignore_material_change_event); @@ -348,8 +352,8 @@ void MatMakerGDEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("set_recreation_in_progress", "value"), &MatMakerGDEditor::set_recreation_in_progress); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "recreation_in_progress"), "set_recreation_in_progress", "get_recreation_in_progress"); - ClassDB::bind_method(D_METHOD("get_undo_redo"), &MatMakerGDEditor::get_undo_redo); - ClassDB::bind_method(D_METHOD("set_undo_redo", "value"), &MatMakerGDEditor::set_undo_redo); + //ClassDB::bind_method(D_METHOD("get_undo_redo"), &MatMakerGDEditor::get_undo_redo); + //ClassDB::bind_method(D_METHOD("set_undo_redo", "value"), &MatMakerGDEditor::set_undo_redo); ClassDB::bind_method(D_METHOD("recreate"), &MatMakerGDEditor::recreate); //ClassDB::bind_method(D_METHOD("find_graph_node_for", "nnode"), &MatMakerGDEditor::find_graph_node_for); diff --git a/modules/material_maker/editor/mm_graph_node.cpp b/modules/material_maker/editor/mm_graph_node.cpp index 87fbb78e0..2f9751495 100644 --- a/modules/material_maker/editor/mm_graph_node.cpp +++ b/modules/material_maker/editor/mm_graph_node.cpp @@ -5,6 +5,7 @@ #include "../nodes/mm_node.h" #include "../nodes/mm_node_universal_property.h" #include "mat_maker_gd_editor.h" +#include "scene/resources/packed_scene.h" #include "scene/gui/check_box.h" #include "scene/gui/color_picker.h" @@ -905,10 +906,10 @@ void MMGraphNode::_bind_methods() { ClassDB::bind_method(D_METHOD("add_slot_bool", "getter", "setter", "slot_name"), &MMGraphNode::add_slot_bool); ClassDB::bind_method(D_METHOD("add_slot_label_universal", "property"), &MMGraphNode::add_slot_label_universal); ClassDB::bind_method(D_METHOD("add_slot_int_universal", "property"), &MMGraphNode::add_slot_int_universal); - ClassDB::bind_method(D_METHOD("add_slot_float", "getter", "setter", "slot_name", "step", "prange", " 1000)"), &MMGraphNode::add_slot_float, 0.1, Vector2(-1000, -1000)); + ClassDB::bind_method(D_METHOD("add_slot_float", "getter", "setter", "slot_name", "step", "prange"), &MMGraphNode::add_slot_float, 0.1, Vector2(-1000, -1000)); ClassDB::bind_method(D_METHOD("add_slot_float_universal", "property"), &MMGraphNode::add_slot_float_universal); - ClassDB::bind_method(D_METHOD("add_slot_vector2", "getter", "setter", "slot_name", "step", "prange", " 1000)"), &MMGraphNode::add_slot_vector2, 0.1, Vector2(-1000, -1000)); - ClassDB::bind_method(D_METHOD("add_slot_vector3", "getter", "setter", "slot_name", "step", "prange", " 1000)"), &MMGraphNode::add_slot_vector3, 0.1, Vector2(-1000, -1000)); + ClassDB::bind_method(D_METHOD("add_slot_vector2", "getter", "setter", "slot_name", "step", "prange"), &MMGraphNode::add_slot_vector2, 0.1, Vector2(-1000, -1000)); + ClassDB::bind_method(D_METHOD("add_slot_vector3", "getter", "setter", "slot_name", "step", "prange"), &MMGraphNode::add_slot_vector3, 0.1, Vector2(-1000, -1000)); ClassDB::bind_method(D_METHOD("add_slot_vector2_universal", "property"), &MMGraphNode::add_slot_vector2_universal); ClassDB::bind_method(D_METHOD("add_slot", "input_type", "output_type", "getter", "setter", "control"), &MMGraphNode::add_slot); diff --git a/modules/material_maker/register_types.cpp b/modules/material_maker/register_types.cpp index 25edd90c8..f15ee6b65 100644 --- a/modules/material_maker/register_types.cpp +++ b/modules/material_maker/register_types.cpp @@ -31,6 +31,9 @@ SOFTWARE. #include "nodes/mm_node.h" #include "nodes/mm_node_universal_property.h" +//#include "editor/mat_maker_gd_editor.h" +//#include "editor/mm_graph_node.h" + static _MMAlgos *_mm_algos_singleton = nullptr; void register_material_maker_types() { @@ -40,6 +43,9 @@ void register_material_maker_types() { ClassDB::register_class(); ClassDB::register_class(); + //ClassDB::register_class(); + //ClassDB::register_class(); + _mm_algos_singleton = memnew(_MMAlgos); Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton())); }