Full cleanup of MatMakerGDEditor.

This commit is contained in:
Relintai 2022-06-08 19:13:06 +02:00
parent 0f7a6fb070
commit 15ce82c23b
2 changed files with 149 additions and 429 deletions

View File

@ -1,36 +1,43 @@
#include "mat_maker_gd_editor.h" #include "mat_maker_gd_editor.h"
NodePath MatMakerGDEditor::get_graph_edit_path() { #include "../algos/mm_algos.h"
return graph_edit_path;
}
void MatMakerGDEditor::set_graph_edit_path(const NodePath &val) { #include "core/io/resource_loader.h"
graph_edit_path = val; #include "core/undo_redo.h"
} #include "modules/material_maker/editor/mm_create_name_popup.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/panel_container.h"
NodePath MatMakerGDEditor::get_add_popup_path() { #include "../nodes/mm_material.h"
return add_popup_path; #include "../nodes/mm_node.h"
} #include "../nodes/mm_node_universal_property.h"
#include "mm_graph_node.h"
void MatMakerGDEditor::set_add_popup_path(const NodePath &val) { #include "editor/editor_plugin.h"
add_popup_path = val;
}
GraphEdit *MatMakerGDEditor::get_graph_edit() { GraphEdit *MatMakerGDEditor::get_graph_edit() {
return _graph_edit; return _graph_edit;
} }
void MatMakerGDEditor::set_graph_edit(GraphEdit *val) {
_graph_edit = val;
}
Ref<MMMaterial> MatMakerGDEditor::get_mm_material() { Ref<MMMaterial> MatMakerGDEditor::get_mm_material() {
return _material; return _material;
} }
void MatMakerGDEditor::set_mm_material(const Ref<MMMaterial> &val) { void MatMakerGDEditor::set_mm_material(const Ref<MMMaterial> &object) {
_material = val; if (_material.is_valid()) {
_material->disconnect("changed", this, "on_material_changed");
}
_material = object;
recreate();
if (_material.is_valid()) {
_material->connect("changed", this, "on_material_changed");
}
} }
int MatMakerGDEditor::get_ignore_material_change_event() const { int MatMakerGDEditor::get_ignore_material_change_event() const {
@ -41,6 +48,16 @@ void MatMakerGDEditor::set_ignore_material_change_event(const int val) {
_ignore_material_change_event = val; _ignore_material_change_event = val;
} }
void MatMakerGDEditor::ignore_changes(const bool val) {
if (val) {
_ignore_material_change_event += 1;
}
else {
_ignore_material_change_event -= 1;
}
}
bool MatMakerGDEditor::get_recreation_in_progress() const { bool MatMakerGDEditor::get_recreation_in_progress() const {
return _recreation_in_progress; return _recreation_in_progress;
} }
@ -49,31 +66,20 @@ void MatMakerGDEditor::set_recreation_in_progress(const bool val) {
_recreation_in_progress = val; _recreation_in_progress = val;
} }
EditorPlugin *MatMakerGDEditor::get_plugin() {
return _plugin;
}
void MatMakerGDEditor::set_plugin(EditorPlugin *plugin) {
_plugin = plugin;
_undo_redo = plugin->get_undo_redo();
}
UndoRedo *MatMakerGDEditor::get_undo_redo() { UndoRedo *MatMakerGDEditor::get_undo_redo() {
if (!_undo_redo) {
_undo_redo = memnew(UndoRedo);
}
return _undo_redo; return _undo_redo;
} }
void MatMakerGDEditor::set_undo_redo(UndoRedo *val) { void MatMakerGDEditor::set_undo_redo(UndoRedo *ur) {
_undo_redo = val; _undo_redo = ur;
} }
void MatMakerGDEditor::_enter_tree() { void MatMakerGDEditor::_notification(int p_what) {
ensure_objs(); if (p_what == NOTIFICATION_POSTINITIALIZE) {
}
void MatMakerGDEditor::ensure_objs() {
if (!_graph_edit) {
_graph_edit = get_node(graph_edit_path);
_graph_edit->add_valid_connection_type(MMNodeUniversalProperty::SLOT_TYPE_IMAGE, MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL); _graph_edit->add_valid_connection_type(MMNodeUniversalProperty::SLOT_TYPE_IMAGE, MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
_graph_edit->add_valid_connection_type(MMNodeUniversalProperty::SLOT_TYPE_INT, MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL); _graph_edit->add_valid_connection_type(MMNodeUniversalProperty::SLOT_TYPE_INT, MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
_graph_edit->add_valid_connection_type(MMNodeUniversalProperty::SLOT_TYPE_FLOAT, MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL); _graph_edit->add_valid_connection_type(MMNodeUniversalProperty::SLOT_TYPE_FLOAT, MMNodeUniversalProperty::SLOT_TYPE_UNIVERSAL);
@ -107,19 +113,18 @@ void MatMakerGDEditor::recreate() {
} }
_recreation_in_progress = true; _recreation_in_progress = true;
ensure_objs(); _graph_edit->clear_connections();
_graph_edit.clear_connections();
for (int i = 0; i < _graph_edit->get_child_count(); ++i) { for (int i = 0; i < _graph_edit->get_child_count(); ++i) {
GraphNode *c = Object::cast_to<GraphNode>(_graph_edit->get_child(i)); MMGraphNode *c = Object::cast_to<MMGraphNode>(_graph_edit->get_child(i));
if (c) { if (c) {
_graph_edit->remove_child(c); _graph_edit->remove_child(c);
c->queue_free(); c->queue_delete();
} }
} }
if (!_material) { if (!_material.is_valid()) {
return; return;
} }
@ -129,7 +134,7 @@ void MatMakerGDEditor::recreate() {
Ref<MMNode> n = _material->nodes[i]; Ref<MMNode> n = _material->nodes[i];
MMGraphNode *gn = memnew(MMGraphNode); MMGraphNode *gn = memnew(MMGraphNode);
gn->set_editor(this); gn->set_editor_node(this);
gn->set_node(_material, n); gn->set_node(_material, n);
_graph_edit->add_child(gn); _graph_edit->add_child(gn);
} }
@ -140,32 +145,32 @@ void MatMakerGDEditor::recreate() {
Ref<MMNode> n = _material->nodes[i]; Ref<MMNode> n = _material->nodes[i];
if (n.is_valid()) { if (n.is_valid()) {
for (int j = 0; j < n->input_property.size(); ++j) { for (int j = 0; j < n->input_properties.size(); ++j) {
Ref<MMNodeUniversalProperty> ip = n->input_properties[j]; Ref<MMNodeUniversalProperty> ip = n->input_properties[j];
if (ip.is_valid()) { if (ip.is_valid()) {
Node *input_node = find_graph_node_for(n); MMGraphNode *input_node = find_graph_node_for(n);
Node *output_node = find_graph_node_for(ip.input_property.owner); MMGraphNode *output_node = find_graph_node_for(ip->get_input_property()->get_owner());
int to_slot = input_node.get_input_property_graph_node_slot_index(ip); 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.input_property); int from_slot = output_node->get_output_property_graph_node_slot_index(ip->get_input_property());
_graph_edit.connect_node(output_node.name, from_slot, input_node.name, to_slot); _graph_edit->connect_node(output_node->get_name(), from_slot, input_node->get_name(), to_slot);
} }
} }
} }
} }
_material.render(); _material->render();
_recreation_in_progress = false; _recreation_in_progress = false;
ignore_changes(false); ignore_changes(false);
} }
MMGraphNode *MatMakerGDEditor::find_graph_node_for(const Ref<MMnode> &nnode) { MMGraphNode *MatMakerGDEditor::find_graph_node_for(const Ref<MMNode> &nnode) {
for (int i = 0; i < _graph_edit->get_child_count(); ++i) { for (int i = 0; i < _graph_edit->get_child_count(); ++i) {
GraphNode *c = Object::cast_to<GraphNode>(_graph_edit->get_child(i)); MMGraphNode *c = Object::cast_to<MMGraphNode>(_graph_edit->get_child(i));
if (c) { if (c) {
if (c->has_method("get_material_node")) { if (c->has_method("get_material_node")) {
Ref<MMnode> n = c->get_material_node(); Ref<MMNode> n = c->get_material_node();
if (n == nnode) { if (n == nnode) {
return c; return c;
@ -177,19 +182,6 @@ MMGraphNode *MatMakerGDEditor::find_graph_node_for(const Ref<MMnode> &nnode) {
return nullptr; return nullptr;
} }
void MatMakerGDEditor::set_mmmaterial(const Ref<MMMaterial> &object) {
if (_material) {
_material->disconnect("changed", this, "on_material_changed");
}
_material = object;
recreate();
if (_material) {
_material->connect("changed", this, "on_material_changed");
}
}
void MatMakerGDEditor::on_material_changed() { void MatMakerGDEditor::on_material_changed() {
if (_ignore_material_change_event > 0) { if (_ignore_material_change_event > 0) {
return; return;
@ -202,19 +194,10 @@ void MatMakerGDEditor::on_material_changed() {
call_deferred("recreate"); call_deferred("recreate");
} }
void MatMakerGDEditor::ignore_changes(const bool val) {
if (val) {
_ignore_material_change_event += 1;
}
else {
_ignore_material_change_event -= 1;
}
}
void MatMakerGDEditor::on_graph_edit_connection_request(const String &from, const int from_slot, const String &to, const int to_slot) { void MatMakerGDEditor::on_graph_edit_connection_request(const String &from, const int from_slot, const String &to, const int to_slot) {
GraphNode *from_node = _graph_edit.get_node(from); MMGraphNode *from_node = Object::cast_to<MMGraphNode>(_graph_edit->get_node(from));
GraphNode *to_node = _graph_edit.get_node(to); MMGraphNode *to_node = Object::cast_to<MMGraphNode>(_graph_edit->get_node(to));
ignore_changes(true); ignore_changes(true);
_material->cancel_render_and_wait(); _material->cancel_render_and_wait();
@ -226,8 +209,9 @@ void MatMakerGDEditor::on_graph_edit_connection_request(const String &from, cons
} }
void MatMakerGDEditor::on_graph_edit_disconnection_request(const String &from, const int from_slot, const String &to, const int to_slot) { void MatMakerGDEditor::on_graph_edit_disconnection_request(const String &from, const int from_slot, const String &to, const int to_slot) {
GraphNode *from_node = _graph_edit.get_node(from); MMGraphNode *from_node = Object::cast_to<MMGraphNode>(_graph_edit->get_node(from));
GraphNode *to_node = _graph_edit.get_node(to); MMGraphNode *to_node = Object::cast_to<MMGraphNode>(_graph_edit->get_node(to));
ignore_changes(true); ignore_changes(true);
_material->cancel_render_and_wait(); _material->cancel_render_and_wait();
@ -238,362 +222,120 @@ void MatMakerGDEditor::on_graph_edit_disconnection_request(const String &from, c
ignore_changes(false); ignore_changes(false);
} }
void MatMakerGDEditor::on_graph_node_close_request(const GraphNode &node) { void MatMakerGDEditor::on_graph_node_close_request(Node *p_node) {
if (_material) { MMGraphNode *node = Object::cast_to<MMGraphNode>(p_node);
if (_material.is_valid()) {
ignore_changes(true); ignore_changes(true);
_material->cancel_render_and_wait(); _material->cancel_render_and_wait();
//_material.remove_node(node._node); //_material.remove_node(node._node);
_undo_redo->create_action("MMGD: Remove Node"); get_undo_redo()->create_action("MMGD: Remove Node");
_undo_redo->add_do_method(_material, "remove_node", node._node); get_undo_redo()->add_do_method(*_material, "remove_node", node->get_node());
_undo_redo->add_undo_method(_material, "add_node", node._node); get_undo_redo()->add_undo_method(*_material, "add_node", node->get_node());
_undo_redo->commit_action(); get_undo_redo()->commit_action();
recreate(); recreate();
ignore_changes(false); ignore_changes(false);
} }
} }
void MatMakerGDEditor::_on_AddButton_pressed() { void MatMakerGDEditor::_on_AddButton_pressed() {
get_node(add_popup_path)->opup_centered(); _create_popup->popup_centered();
} }
void MatMakerGDEditor::_on_AddPopup_ok_pressed(const String &script_path) { void MatMakerGDEditor::_on_AddPopup_ok_pressed(const int type, const String &data) {
if (!_material) { if (!_material.is_valid()) {
return; return;
} }
ensure_objs();
_material->cancel_render_and_wait(); _material->cancel_render_and_wait();
//Variant = load(script_path); Ref<MMNode> nnode;
MMGraphNode *nnode = memnew(MMGraphNode);
if (!nnode) { if (type == MMAlgos::MMNODE_REGISTRY_TYPE_CLASS) {
print_error("_on_AddPopup_ok_pressed: Error !nnode! script: " + script_path); nnode = Ref<MMNode>(ClassDB::instance(data));
} else if (type == MMAlgos::MMNODE_REGISTRY_TYPE_SCRIPT) {
Ref<Script> script = ResourceLoader::load(data);
if (script.is_valid() && script->can_instance()) {
nnode.instance();
nnode->set_script(script.get_ref_ptr());
}
}
if (!nnode.is_valid()) {
print_error("_on_AddPopup_ok_pressed: Error !nnode! script/class: " + data);
return; return;
} }
ignore_changes(true); ignore_changes(true);
//_material.add_node(nnode); //_material.add_node(nnode);
_undo_redo->create_action("MMGD: Add Node");
_undo_redo->add_do_method(_material, "add_node", nnode); get_undo_redo()->create_action("MMGD: Add Node");
_undo_redo->add_undo_method(_material, "remove_node", nnode); get_undo_redo()->add_do_method(*_material, "add_node", nnode);
_undo_redo->commit_action(); get_undo_redo()->add_undo_method(*_material, "remove_node", nnode);
get_undo_redo()->commit_action();
MMGraphNode *gn = memnew(MMGraphNode); MMGraphNode *gn = memnew(MMGraphNode);
gn->set_editor(this); gn->set_editor_node(this);
gn->set_node(_material, nnode); gn->set_node(_material, nnode);
_graph_edit->add_child(gn); _graph_edit->add_child(gn);
ignore_changes(false); ignore_changes(false);
} }
MatMakerGDEditor::MatMakerGDEditor() { MatMakerGDEditor::MatMakerGDEditor() {
//var MMGraphNode = preload("res://addons/mat_maker_gd/editor/mm_graph_node.gd"); _graph_edit = memnew(GraphEdit);
graph_edit_path = "VBoxContainer/GraphEdit";
add_popup_path = "Popups/AddPopup";
_graph_edit = nullptr;
_material;
_ignore_material_change_event = 0; _ignore_material_change_event = 0;
_recreation_in_progress = false; _recreation_in_progress = false;
_plugin = nullptr; _plugin = nullptr;
_undo_redo = nullptr; _undo_redo = nullptr;
//Script: res://addons/mat_maker_gd/editor/MatMakerGDEditor.gd set_name("MatMakerGDEditor");
MarginContainer *matmakergdeditor = memnew(MarginContainer); set_anchors_and_margins_preset(LayoutPreset::PRESET_WIDE);
matmakergdeditor->set_name("MatMakerGDEditor"); set_h_size_flags(SIZE_EXPAND_FILL);
matmakergdeditor->set_filename("res://addons/mat_maker_gd/editor/MatMakerGDEditor.tscn"); set_v_size_flags(SIZE_EXPAND_FILL);
matmakergdeditor->set_anchor_right(1);
matmakergdeditor->set_anchor_bottom(1);
matmakergdeditor->set_rect_min_size(Vector2(0, 200));
matmakergdeditor->set_size_flags_horizontal(3);
matmakergdeditor->set_size_flags_vertical(3);
VBoxContainer *vboxcontainer_matmakergdeditor = memnew(VBoxContainer); VBoxContainer *vboxcontainer = memnew(VBoxContainer);
vboxcontainer_matmakergdeditor->set_name("VBoxContainer"); vboxcontainer->set_name("VBoxContainer");
matmakergdeditor->add_child(vboxcontainer_matmakergdeditor); add_child(vboxcontainer);
vboxcontainer_matmakergdeditor->set_name("VBoxContainer");
//vboxcontainer_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327]
vboxcontainer_matmakergdeditor->set_margin_right(1024);
vboxcontainer_matmakergdeditor->set_margin_bottom(600);
vboxcontainer_matmakergdeditor->set_rect_size(Vector2(1024, 600));
PanelContainer *panelcontainer_vboxcontainer_matmakergdeditor = memnew(PanelContainer); PanelContainer *panelcontainer_vboxcontainer = memnew(PanelContainer);
panelcontainer_vboxcontainer_matmakergdeditor->set_name("PanelContainer"); panelcontainer_vboxcontainer->set_name("PanelContainer");
vboxcontainer_matmakergdeditor->add_child(panelcontainer_vboxcontainer_matmakergdeditor); vboxcontainer->add_child(panelcontainer_vboxcontainer);
panelcontainer_vboxcontainer_matmakergdeditor->set_name("PanelContainer");
//panelcontainer_vboxcontainer_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327]
panelcontainer_vboxcontainer_matmakergdeditor->set_margin_right(1024);
panelcontainer_vboxcontainer_matmakergdeditor->set_margin_bottom(34);
panelcontainer_vboxcontainer_matmakergdeditor->set_rect_size(Vector2(1024, 34));
HBoxContainer *hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor = memnew(HBoxContainer); HBoxContainer *hboxcontainer_panelcontainer_vboxcontainer = memnew(HBoxContainer);
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_name("HBoxContainer"); hboxcontainer_panelcontainer_vboxcontainer->set_name("HBoxContainer");
panelcontainer_vboxcontainer_matmakergdeditor->add_child(hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor); panelcontainer_vboxcontainer->add_child(hboxcontainer_panelcontainer_vboxcontainer);
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_name("HBoxContainer");
//hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327]
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_margin_left(7);
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_margin_top(7);
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_margin_right(1017);
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_margin_bottom(27);
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_rect_position(Vector2(7, 7));
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_rect_global_position(Vector2(7, 7));
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_rect_size(Vector2(1010, 20));
Button *addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor = memnew(Button); Button *addbutton_hboxcontainer_panelcontainer_vboxcontainer = memnew(Button);
addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_name("AddButton"); addbutton_hboxcontainer_panelcontainer_vboxcontainer->set_name("AddButton");
hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->add_child(addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor); addbutton_hboxcontainer_panelcontainer_vboxcontainer->set_text("Add");
addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_name("AddButton"); addbutton_hboxcontainer_panelcontainer_vboxcontainer->connect("pressed", this, "_on_AddButton_pressed");
//addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327] hboxcontainer_panelcontainer_vboxcontainer->add_child(addbutton_hboxcontainer_panelcontainer_vboxcontainer);
addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_margin_right(37);
addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_margin_bottom(20);
addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_rect_size(Vector2(37, 20));
addbutton_hboxcontainer_panelcontainer_vboxcontainer_matmakergdeditor->set_text("Add");
GraphEdit *graphedit_vboxcontainer_matmakergdeditor = memnew(GraphEdit); _graph_edit = memnew(GraphEdit);
graphedit_vboxcontainer_matmakergdeditor->set_name("GraphEdit"); _graph_edit->set_name("GraphEdit");
vboxcontainer_matmakergdeditor->add_child(graphedit_vboxcontainer_matmakergdeditor); _graph_edit->set_right_disconnects(true);
graphedit_vboxcontainer_matmakergdeditor->set_name("GraphEdit"); _graph_edit->set_h_size_flags(SIZE_EXPAND_FILL);
//graphedit_vboxcontainer_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327] _graph_edit->set_v_size_flags(SIZE_EXPAND_FILL);
graphedit_vboxcontainer_matmakergdeditor->set_margin_top(38); vboxcontainer->add_child(_graph_edit);
graphedit_vboxcontainer_matmakergdeditor->set_margin_right(1024);
graphedit_vboxcontainer_matmakergdeditor->set_margin_bottom(600);
graphedit_vboxcontainer_matmakergdeditor->set_rect_position(Vector2(0, 38));
graphedit_vboxcontainer_matmakergdeditor->set_rect_global_position(Vector2(0, 38));
graphedit_vboxcontainer_matmakergdeditor->set_rect_size(Vector2(1024, 562));
graphedit_vboxcontainer_matmakergdeditor->set_size_flags_horizontal(3);
graphedit_vboxcontainer_matmakergdeditor->set_size_flags_vertical(3);
graphedit_vboxcontainer_matmakergdeditor->set_right_disconnects(True);
graphedit_vboxcontainer_matmakergdeditor->set_scroll_offset(Vector2(0, -20));
GraphEditFilter *grapheditfilter_graphedit_vboxcontainer_matmakergdeditor = memnew(GraphEditFilter); Control *popups = memnew(Control);
grapheditfilter_graphedit_vboxcontainer_matmakergdeditor->set_name("GraphEditFilter"); popups->set_name("Popups");
graphedit_vboxcontainer_matmakergdeditor->add_child(grapheditfilter_graphedit_vboxcontainer_matmakergdeditor); popups->set_mouse_filter(MOUSE_FILTER_IGNORE);
Control *clayer_graphedit_vboxcontainer_matmakergdeditor = memnew(Control); add_child(popups);
clayer_graphedit_vboxcontainer_matmakergdeditor->set_name("CLAYER");
graphedit_vboxcontainer_matmakergdeditor->add_child(clayer_graphedit_vboxcontainer_matmakergdeditor);
clayer_graphedit_vboxcontainer_matmakergdeditor->set_name("CLAYER");
clayer_graphedit_vboxcontainer_matmakergdeditor->set_mouse_filter(2);
Control *popups_matmakergdeditor = memnew(Control); _create_popup = memnew(MMCreateNamePopup);
popups_matmakergdeditor->set_name("Popups"); _create_popup->set_name("AddPopup");
matmakergdeditor->add_child(popups_matmakergdeditor); _create_popup->set_title("Create New Resource");
popups_matmakergdeditor->set_name("Popups"); popups->add_child(_create_popup);
//popups_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327]
popups_matmakergdeditor->set_margin_right(1024);
popups_matmakergdeditor->set_margin_bottom(600);
popups_matmakergdeditor->set_rect_size(Vector2(1024, 600));
popups_matmakergdeditor->set_mouse_filter(2);
//Script: res://addons/mat_maker_gd/editor/CreateNamePopup.gd
ConfirmationDialog *addpopup_popups_matmakergdeditor = memnew(ConfirmationDialog);
addpopup_popups_matmakergdeditor->set_name("AddPopup");
popups_matmakergdeditor->add_child(addpopup_popups_matmakergdeditor);
addpopup_popups_matmakergdeditor->set_name("AddPopup");
addpopup_popups_matmakergdeditor->set_filename("res://addons/mat_maker_gd/editor/CreateNamePopup.tscn");
//addpopup_popups_matmakergdeditor property owner TYPE_OBJECT value: MatMakerGDEditor:[MarginContainer:280327]
addpopup_popups_matmakergdeditor->set_anchor_left(0.5);
addpopup_popups_matmakergdeditor->set_anchor_top(0.5);
addpopup_popups_matmakergdeditor->set_anchor_right(0.5);
addpopup_popups_matmakergdeditor->set_anchor_bottom(0.5);
addpopup_popups_matmakergdeditor->set_margin_left(-245.5);
addpopup_popups_matmakergdeditor->set_margin_top(-220);
addpopup_popups_matmakergdeditor->set_margin_right(245.5);
addpopup_popups_matmakergdeditor->set_margin_bottom(220);
addpopup_popups_matmakergdeditor->set_rect_position(Vector2(-245.5, -220));
addpopup_popups_matmakergdeditor->set_rect_global_position(Vector2(-245.5, -220));
addpopup_popups_matmakergdeditor->set_rect_size(Vector2(491, 440));
addpopup_popups_matmakergdeditor->set_window_title("Create New Resource");
//addpopup_popups_matmakergdeditor property _meta_ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
//addpopup_popups_matmakergdeditor property line_edit_path TYPE_NODE_PATH value: VBoxContainer/LineEdit
//addpopup_popups_matmakergdeditor property tree_path TYPE_NODE_PATH value: VBoxContainer/Tree
//addpopup_popups_matmakergdeditor property type_folders TYPE_STRING_ARRAY value: [res://addons/mat_maker_gd/nodes/uniform, res://addons/mat_maker_gd/nodes/noise, res://addons/mat_maker_gd/nodes/filter, res://addons/mat_maker_gd/nodes/gradient, res://addons/mat_maker_gd/nodes/pattern, res://addons/mat_maker_gd/nodes/sdf2d, res://addons/mat_maker_gd/nodes/sdf3d, res://addons/mat_maker_gd/nodes/transform, res://addons/mat_maker_gd/nodes/simple, res://addons/mat_maker_gd/nodes/other]
TextureButton *texturebutton_addpopup_popups_matmakergdeditor = memnew(TextureButton);
texturebutton_addpopup_popups_matmakergdeditor->set_name("TextureButton");
addpopup_popups_matmakergdeditor->add_child(texturebutton_addpopup_popups_matmakergdeditor);
texturebutton_addpopup_popups_matmakergdeditor->set_name("TextureButton");
Label *label_addpopup_popups_matmakergdeditor = memnew(Label);
label_addpopup_popups_matmakergdeditor->set_name("Label");
addpopup_popups_matmakergdeditor->add_child(label_addpopup_popups_matmakergdeditor);
label_addpopup_popups_matmakergdeditor->set_name("Label");
label_addpopup_popups_matmakergdeditor->set_anchor_right(1);
label_addpopup_popups_matmakergdeditor->set_anchor_bottom(1);
label_addpopup_popups_matmakergdeditor->set_margin_left(8);
label_addpopup_popups_matmakergdeditor->set_margin_top(8);
label_addpopup_popups_matmakergdeditor->set_margin_right(-8);
label_addpopup_popups_matmakergdeditor->set_margin_bottom(-42);
label_addpopup_popups_matmakergdeditor->set_rect_position(Vector2(8, 8));
label_addpopup_popups_matmakergdeditor->set_rect_global_position(Vector2(8, 8));
label_addpopup_popups_matmakergdeditor->set_rect_size(Vector2(0, 14));
HBoxContainer *hboxcontainer_addpopup_popups_matmakergdeditor = memnew(HBoxContainer);
hboxcontainer_addpopup_popups_matmakergdeditor->set_name("HBoxContainer");
addpopup_popups_matmakergdeditor->add_child(hboxcontainer_addpopup_popups_matmakergdeditor);
hboxcontainer_addpopup_popups_matmakergdeditor->set_name("HBoxContainer");
Control *control3_hboxcontainer_addpopup_popups_matmakergdeditor = memnew(Control);
control3_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Control3");
hboxcontainer_addpopup_popups_matmakergdeditor->add_child(control3_hboxcontainer_addpopup_popups_matmakergdeditor);
control3_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Control3");
control3_hboxcontainer_addpopup_popups_matmakergdeditor->set_mouse_filter(1);
control3_hboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
Button *button2_hboxcontainer_addpopup_popups_matmakergdeditor = memnew(Button);
button2_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Button2");
hboxcontainer_addpopup_popups_matmakergdeditor->add_child(button2_hboxcontainer_addpopup_popups_matmakergdeditor);
button2_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Button2");
button2_hboxcontainer_addpopup_popups_matmakergdeditor->set_text("Cancel");
Control *control_hboxcontainer_addpopup_popups_matmakergdeditor = memnew(Control);
control_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Control");
hboxcontainer_addpopup_popups_matmakergdeditor->add_child(control_hboxcontainer_addpopup_popups_matmakergdeditor);
control_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Control");
control_hboxcontainer_addpopup_popups_matmakergdeditor->set_mouse_filter(1);
control_hboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
Button *button_hboxcontainer_addpopup_popups_matmakergdeditor = memnew(Button);
button_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Button");
hboxcontainer_addpopup_popups_matmakergdeditor->add_child(button_hboxcontainer_addpopup_popups_matmakergdeditor);
button_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Button");
button_hboxcontainer_addpopup_popups_matmakergdeditor->set_text("OK");
Control *control2_hboxcontainer_addpopup_popups_matmakergdeditor = memnew(Control);
control2_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Control2");
hboxcontainer_addpopup_popups_matmakergdeditor->add_child(control2_hboxcontainer_addpopup_popups_matmakergdeditor);
control2_hboxcontainer_addpopup_popups_matmakergdeditor->set_name("Control2");
control2_hboxcontainer_addpopup_popups_matmakergdeditor->set_mouse_filter(1);
control2_hboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
VBoxContainer *vboxcontainer_addpopup_popups_matmakergdeditor = memnew(VBoxContainer);
vboxcontainer_addpopup_popups_matmakergdeditor->set_name("VBoxContainer");
addpopup_popups_matmakergdeditor->add_child(vboxcontainer_addpopup_popups_matmakergdeditor);
vboxcontainer_addpopup_popups_matmakergdeditor->set_name("VBoxContainer");
//vboxcontainer_addpopup_popups_matmakergdeditor property owner TYPE_OBJECT value: AddPopup:[ConfirmationDialog:280352]
vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_left(8);
vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_top(8);
vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_right(483);
vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_bottom(404);
vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_position(Vector2(8, 8));
vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_global_position(Vector2(8, 8));
vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_size(Vector2(475, 396));
vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_vertical(3);
//vboxcontainer_addpopup_popups_matmakergdeditor property _meta_ TYPE_DICTIONARY value: {_edit_use_anchors_:False}
Label *label2_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(Label);
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("Label2");
vboxcontainer_addpopup_popups_matmakergdeditor->add_child(label2_vboxcontainer_addpopup_popups_matmakergdeditor);
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("Label2");
//label2_vboxcontainer_addpopup_popups_matmakergdeditor property owner TYPE_OBJECT value: AddPopup:[ConfirmationDialog:280352]
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_right(475);
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_bottom(14);
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_size(Vector2(475, 14));
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
label2_vboxcontainer_addpopup_popups_matmakergdeditor->set_text("Type");
Tree *tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(Tree);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("Tree");
vboxcontainer_addpopup_popups_matmakergdeditor->add_child(tree_vboxcontainer_addpopup_popups_matmakergdeditor);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("Tree");
//tree_vboxcontainer_addpopup_popups_matmakergdeditor property owner TYPE_OBJECT value: AddPopup:[ConfirmationDialog:280352]
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_top(18);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_right(475);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_bottom(350);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_position(Vector2(0, 18));
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_global_position(Vector2(0, 18));
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_size(Vector2(475, 332));
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_vertical(3);
tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_hide_root(True);
PopupMenu *popupmenu_tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(PopupMenu);
popupmenu_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("PopupMenu");
tree_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(popupmenu_tree_vboxcontainer_addpopup_popups_matmakergdeditor);
popupmenu_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("PopupMenu");
LineEdit *lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(LineEdit);
lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("LineEdit");
tree_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor);
lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("LineEdit");
lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_visible(False);
PopupMenu *popupmenu_lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(PopupMenu);
popupmenu_lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("PopupMenu");
lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(popupmenu_lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor);
popupmenu_lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("PopupMenu");
//popupmenu_lineedit_tree_vboxcontainer_addpopup_popups_matmakergdeditor property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
HSlider *hslider_tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(HSlider);
hslider_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("HSlider");
tree_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(hslider_tree_vboxcontainer_addpopup_popups_matmakergdeditor);
hslider_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("HSlider");
hslider_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_visible(False);
HScrollBar *hscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(HScrollBar);
hscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("HScrollBar");
tree_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(hscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor);
hscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("HScrollBar");
VScrollBar *vscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(VScrollBar);
vscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("VScrollBar");
tree_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(vscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor);
vscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("VScrollBar");
vscrollbar_tree_vboxcontainer_addpopup_popups_matmakergdeditor->set_custom_step(14);
Label *label_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(Label);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("Label");
vboxcontainer_addpopup_popups_matmakergdeditor->add_child(label_vboxcontainer_addpopup_popups_matmakergdeditor);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("Label");
//label_vboxcontainer_addpopup_popups_matmakergdeditor property owner TYPE_OBJECT value: AddPopup:[ConfirmationDialog:280352]
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_visible(False);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_top(354);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_right(475);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_bottom(368);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_position(Vector2(0, 354));
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_global_position(Vector2(0, 354));
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_size(Vector2(475, 14));
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
label_vboxcontainer_addpopup_popups_matmakergdeditor->set_text("Name");
LineEdit *lineedit_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(LineEdit);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("LineEdit");
vboxcontainer_addpopup_popups_matmakergdeditor->add_child(lineedit_vboxcontainer_addpopup_popups_matmakergdeditor);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("LineEdit");
//lineedit_vboxcontainer_addpopup_popups_matmakergdeditor property owner TYPE_OBJECT value: AddPopup:[ConfirmationDialog:280352]
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_visible(False);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_top(372);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_right(475);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_margin_bottom(396);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_position(Vector2(0, 372));
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_global_position(Vector2(0, 372));
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_rect_size(Vector2(475, 24));
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_size_flags_horizontal(3);
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_caret_blink(True);
PopupMenu *popupmenu_lineedit_vboxcontainer_addpopup_popups_matmakergdeditor = memnew(PopupMenu);
popupmenu_lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("PopupMenu");
lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->add_child(popupmenu_lineedit_vboxcontainer_addpopup_popups_matmakergdeditor);
popupmenu_lineedit_vboxcontainer_addpopup_popups_matmakergdeditor->set_name("PopupMenu");
//popupmenu_lineedit_vboxcontainer_addpopup_popups_matmakergdeditor property items TYPE_ARRAY value: [Cut, [Object:null], 0, False, False, 0, 268435544, Null, , False, Copy, [Object:null], 0, False, False, 1, 268435523, Null, , False, Paste, [Object:null], 0, False, False, 2, 268435542, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Select All, [Object:null], 0, False, False, 4, 268435521, Null, , False, Clear, [Object:null], 0, False, False, 3, 0, Null, , False, , [Object:null], 0, False, False, -1, 0, Null, , True, Undo, [Object:null], 0, False, False, 5, 268435546, Null, , False, Redo, [Object:null], 0, False, False, 6, 301989978, Null, , False]
} }
MatMakerGDEditor::~MatMakerGDEditor() { MatMakerGDEditor::~MatMakerGDEditor() {
} }
static void MatMakerGDEditor::_bind_methods() { void MatMakerGDEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_Variant"), &MatMakerGDEditor::get_Variant);
ClassDB::bind_method(D_METHOD("set_Variant", "value"), &MatMakerGDEditor::set_Variant);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "Variant", PROPERTY_HINT_RESOURCE_TYPE, "Variant"), "set_Variant", "get_Variant");
ClassDB::bind_method(D_METHOD("get_graph_edit_path"), &MatMakerGDEditor::get_graph_edit_path);
ClassDB::bind_method(D_METHOD("set_graph_edit_path", "value"), &MatMakerGDEditor::set_graph_edit_path);
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "graph_edit_path"), "set_graph_edit_path", "get_graph_edit_path");
ClassDB::bind_method(D_METHOD("get_add_popup_path"), &MatMakerGDEditor::get_add_popup_path);
ClassDB::bind_method(D_METHOD("set_add_popup_path", "value"), &MatMakerGDEditor::set_add_popup_path);
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "add_popup_path"), "set_add_popup_path", "get_add_popup_path");
ClassDB::bind_method(D_METHOD("get_graph_edit"), &MatMakerGDEditor::get_graph_edit); ClassDB::bind_method(D_METHOD("get_graph_edit"), &MatMakerGDEditor::get_graph_edit);
ClassDB::bind_method(D_METHOD("set_graph_edit", "value"), &MatMakerGDEditor::set_graph_edit);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*_graph_edit", PROPERTY_HINT_RESOURCE_TYPE, "GraphEdit"), "set_graph_edit", "get_graph_edit");
ClassDB::bind_method(D_METHOD("get_material"), &MatMakerGDEditor::get_material); ClassDB::bind_method(D_METHOD("get_material"), &MatMakerGDEditor::get_material);
ClassDB::bind_method(D_METHOD("set_material", "value"), &MatMakerGDEditor::set_material); ClassDB::bind_method(D_METHOD("set_material", "value"), &MatMakerGDEditor::set_material);
@ -601,28 +343,17 @@ static void MatMakerGDEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_ignore_material_change_event"), &MatMakerGDEditor::get_ignore_material_change_event); 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); ClassDB::bind_method(D_METHOD("set_ignore_material_change_event", "value"), &MatMakerGDEditor::set_ignore_material_change_event);
ADD_PROPERTY(PropertyInfo(Variant::INT, "_ignore_material_change_event"), "set_ignore_material_change_event", "get_ignore_material_change_event");
ClassDB::bind_method(D_METHOD("get_recreation_in_progress"), &MatMakerGDEditor::get_recreation_in_progress); ClassDB::bind_method(D_METHOD("get_recreation_in_progress"), &MatMakerGDEditor::get_recreation_in_progress);
ClassDB::bind_method(D_METHOD("set_recreation_in_progress", "value"), &MatMakerGDEditor::set_recreation_in_progress); 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"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "recreation_in_progress"), "set_recreation_in_progress", "get_recreation_in_progress");
ClassDB::bind_method(D_METHOD("get_plugin"), &MatMakerGDEditor::get_plugin);
ClassDB::bind_method(D_METHOD("set_plugin", "value"), &MatMakerGDEditor::set_plugin);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*_plugin", PROPERTY_HINT_RESOURCE_TYPE, "EditorPlugin"), "set_plugin", "get_plugin");
ClassDB::bind_method(D_METHOD("get_undo_redo"), &MatMakerGDEditor::get_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("set_undo_redo", "value"), &MatMakerGDEditor::set_undo_redo);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "*_undo_redo", PROPERTY_HINT_RESOURCE_TYPE, "UndoRedo"), "set_undo_redo", "get_undo_redo");
ClassDB::bind_method(D_METHOD("_enter_tree"), &MatMakerGDEditor::_enter_tree);
ClassDB::bind_method(D_METHOD("set_plugin", "plugin"), &MatMakerGDEditor::set_plugin);
ClassDB::bind_method(D_METHOD("get_undo_redo"), &MatMakerGDEditor::get_undo_redo);
ClassDB::bind_method(D_METHOD("ensure_objs"), &MatMakerGDEditor::ensure_objs);
ClassDB::bind_method(D_METHOD("recreate"), &MatMakerGDEditor::recreate); ClassDB::bind_method(D_METHOD("recreate"), &MatMakerGDEditor::recreate);
ClassDB::bind_method(D_METHOD("find_graph_node_for", "nnode"), &MatMakerGDEditor::find_graph_node_for); //ClassDB::bind_method(D_METHOD("find_graph_node_for", "nnode"), &MatMakerGDEditor::find_graph_node_for);
ClassDB::bind_method(D_METHOD("set_mmmaterial", "object"), &MatMakerGDEditor::set_mmmaterial); ClassDB::bind_method(D_METHOD("set_mm_material", "object"), &MatMakerGDEditor::set_mm_material);
ClassDB::bind_method(D_METHOD("on_material_changed"), &MatMakerGDEditor::on_material_changed); ClassDB::bind_method(D_METHOD("on_material_changed"), &MatMakerGDEditor::on_material_changed);
ClassDB::bind_method(D_METHOD("ignore_changes", "val"), &MatMakerGDEditor::ignore_changes); ClassDB::bind_method(D_METHOD("ignore_changes", "val"), &MatMakerGDEditor::ignore_changes);

View File

@ -8,6 +8,7 @@
#include "core/ustring.h" #include "core/ustring.h"
#include "core/vector.h" #include "core/vector.h"
#include "modules/material_maker/editor/mm_create_name_popup.h"
#include "scene/gui/margin_container.h" #include "scene/gui/margin_container.h"
class GraphEdit; class GraphEdit;
@ -16,22 +17,13 @@ class UndoRedo;
class MMMaterial; class MMMaterial;
class GraphNode; class GraphNode;
class MMGraphNode; class MMGraphNode;
class MMNode;
class MatMakerGDEditor : public MarginContainer { class MatMakerGDEditor : public MarginContainer {
GDCLASS(MatMakerGDEditor, MarginContainer); GDCLASS(MatMakerGDEditor, MarginContainer);
public: public:
Variant get_Variant();
void set_Variant(const Variant &val);
NodePath get_graph_edit_path();
void set_graph_edit_path(const NodePath &val);
NodePath get_add_popup_path();
void set_add_popup_path(const NodePath &val);
GraphEdit *get_graph_edit(); GraphEdit *get_graph_edit();
void set_graph_edit(const GraphEdit *val);
Ref<MMMaterial> get_mm_material(); Ref<MMMaterial> get_mm_material();
void set_mm_material(const Ref<MMMaterial> &val); void set_mm_material(const Ref<MMMaterial> &val);
@ -39,43 +31,40 @@ public:
int get_ignore_material_change_event() const; int get_ignore_material_change_event() const;
void set_ignore_material_change_event(const int val); void set_ignore_material_change_event(const int val);
void ignore_changes(const bool val);
bool get_recreation_in_progress() const; bool get_recreation_in_progress() const;
void set_recreation_in_progress(const bool val); void set_recreation_in_progress(const bool val);
EditorPlugin *get_plugin();
void set_plugin(const EditorPlugin *val);
UndoRedo *get_undo_redo(); UndoRedo *get_undo_redo();
void set_undo_redo(const UndoRedo *val); void set_undo_redo(UndoRedo *ur);
void _enter_tree();
void ensure_objs();
void recreate(); void recreate();
MMGraphNode *find_graph_node_for(const Ref<MMnode> &nnode); MMGraphNode *find_graph_node_for(const Ref<MMNode> &nnode);
void set_mmmaterial(const Ref<MMMaterial> &object);
void on_material_changed(); void on_material_changed();
void ignore_changes(const bool val);
void on_graph_edit_connection_request(const String &from, const int from_slot, const String &to, const int to_slot); void on_graph_edit_connection_request(const String &from, const int from_slot, const String &to, const int to_slot);
void on_graph_edit_disconnection_request(const String &from, const int from_slot, const String &to, const int to_slot); void on_graph_edit_disconnection_request(const String &from, const int from_slot, const String &to, const int to_slot);
void on_graph_node_close_request(GraphNode *node); void on_graph_node_close_request(Node *node);
void _on_AddButton_pressed(); void _on_AddButton_pressed();
void _on_AddPopup_ok_pressed(const String &script_path); void _on_AddPopup_ok_pressed(const int type, const String &data);
MatMakerGDEditor(); MatMakerGDEditor();
~MatMakerGDEditor(); ~MatMakerGDEditor();
protected: protected:
void _notification(int p_what);
static void _bind_methods(); static void _bind_methods();
NodePath graph_edit_path;
NodePath add_popup_path;
GraphEdit *_graph_edit; GraphEdit *_graph_edit;
Ref<MMMaterial> *_material; MMCreateNamePopup *_create_popup;
Ref<MMMaterial> _material;
int _ignore_material_change_event; int _ignore_material_change_event;
bool _recreation_in_progress; bool _recreation_in_progress;
EditorPlugin *_plugin; EditorPlugin *_plugin;
private:
UndoRedo *_undo_redo; UndoRedo *_undo_redo;
}; };