diff options
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor_export.cpp | 36 | ||||
| -rw-r--r-- | editor/editor_export.h | 8 | ||||
| -rw-r--r-- | editor/editor_plugin.cpp | 2 | ||||
| -rw-r--r-- | editor/editor_plugin.h | 2 | ||||
| -rw-r--r-- | editor/editor_resource_preview.cpp | 2 | ||||
| -rw-r--r-- | editor/editor_settings.h | 3 | ||||
| -rw-r--r-- | editor/editor_vcs_interface.h | 2 | ||||
| -rw-r--r-- | editor/fileserver/editor_file_server.h | 2 | ||||
| -rw-r--r-- | editor/inspector_dock.cpp | 8 | ||||
| -rw-r--r-- | editor/inspector_dock.h | 8 | ||||
| -rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 6 | ||||
| -rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 102 | ||||
| -rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 7 | ||||
| -rw-r--r-- | editor/project_export.cpp | 203 | ||||
| -rw-r--r-- | editor/project_export.h | 12 | ||||
| -rw-r--r-- | editor/scene_tree_dock.cpp | 8 |
16 files changed, 118 insertions, 293 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index d3a4dbb6e7..0f86385031 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -185,35 +185,6 @@ bool EditorExportPreset::has_export_file(const String &p_path) { return selected_files.has(p_path); } -void EditorExportPreset::add_patch(const String &p_path, int p_at_pos) { - if (p_at_pos < 0) { - patches.push_back(p_path); - } else { - patches.insert(p_at_pos, p_path); - } - EditorExport::singleton->save_presets(); -} - -void EditorExportPreset::remove_patch(int p_idx) { - patches.remove(p_idx); - EditorExport::singleton->save_presets(); -} - -void EditorExportPreset::set_patch(int p_index, const String &p_path) { - ERR_FAIL_INDEX(p_index, patches.size()); - patches.write[p_index] = p_path; - EditorExport::singleton->save_presets(); -} - -String EditorExportPreset::get_patch(int p_index) { - ERR_FAIL_INDEX_V(p_index, patches.size(), String()); - return patches[p_index]; -} - -Vector<String> EditorExportPreset::get_patches() const { - return patches; -} - void EditorExportPreset::set_custom_features(const String &p_custom_features) { custom_features = p_custom_features; EditorExport::singleton->save_presets(); @@ -1341,7 +1312,6 @@ void EditorExport::_save() { config->set_value(section, "include_filter", preset->get_include_filter()); config->set_value(section, "exclude_filter", preset->get_exclude_filter()); config->set_value(section, "export_path", preset->get_export_path()); - config->set_value(section, "patch_list", preset->get_patches()); config->set_value(section, "encryption_include_filters", preset->get_enc_in_filter()); config->set_value(section, "encryption_exclude_filters", preset->get_enc_ex_filter()); config->set_value(section, "encrypt_pck", preset->get_enc_pck()); @@ -1529,12 +1499,6 @@ void EditorExport::load_config() { preset->set_exclude_filter(config->get_value(section, "exclude_filter")); preset->set_export_path(config->get_value(section, "export_path", "")); - Vector<String> patch_list = config->get_value(section, "patch_list"); - - for (int i = 0; i < patch_list.size(); i++) { - preset->add_patch(patch_list[i]); - } - if (config->has_section_key(section, "encrypt_pck")) { preset->set_enc_pck(config->get_value(section, "encrypt_pck")); } diff --git a/editor/editor_export.h b/editor/editor_export.h index fa6be88302..55728f0c94 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -68,8 +68,6 @@ private: Set<String> selected_files; bool runnable = false; - Vector<String> patches; - friend class EditorExport; friend class EditorExportPlatform; @@ -121,12 +119,6 @@ public: void set_exclude_filter(const String &p_exclude); String get_exclude_filter() const; - void add_patch(const String &p_path, int p_at_pos = -1); - void set_patch(int p_index, const String &p_path); - String get_patch(int p_index); - void remove_patch(int p_idx); - Vector<String> get_patches() const; - void set_custom_features(const String &p_custom_features); String get_custom_features() const; diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 082c317655..e330713cfb 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -791,7 +791,7 @@ bool EditorPlugin::build() { return true; } -void EditorPlugin::queue_save_layout() const { +void EditorPlugin::queue_save_layout() { EditorNode::get_singleton()->save_layout(); } diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 40a91cbfb9..dd3bf08678 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -221,7 +221,7 @@ public: int update_overlays() const; - void queue_save_layout() const; + void queue_save_layout(); void make_bottom_panel_item_visible(Control *p_item); void hide_bottom_panel(); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 3170ea5ff8..9723ae188b 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -30,8 +30,6 @@ #include "editor_resource_preview.h" -#include "core/method_bind_ext.gen.inc" - #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/message_queue.h" diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 04bb49bb51..c1bb7951fa 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -31,8 +31,7 @@ #ifndef EDITOR_SETTINGS_H #define EDITOR_SETTINGS_H -#include "core/object.h" - +#include "core/class_db.h" #include "core/io/config_file.h" #include "core/os/thread_safe.h" #include "core/resource.h" diff --git a/editor/editor_vcs_interface.h b/editor/editor_vcs_interface.h index ee9e51441d..6ef55f0a46 100644 --- a/editor/editor_vcs_interface.h +++ b/editor/editor_vcs_interface.h @@ -31,7 +31,7 @@ #ifndef EDITOR_VCS_INTERFACE_H #define EDITOR_VCS_INTERFACE_H -#include "core/object.h" +#include "core/class_db.h" #include "core/ustring.h" #include "scene/gui/panel_container.h" diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h index 9645fbf39e..eefaa503c1 100644 --- a/editor/fileserver/editor_file_server.h +++ b/editor/fileserver/editor_file_server.h @@ -31,10 +31,10 @@ #ifndef EDITOR_FILE_SERVER_H #define EDITOR_FILE_SERVER_H +#include "core/class_db.h" #include "core/io/file_access_network.h" #include "core/io/packet_peer.h" #include "core/io/tcp_server.h" -#include "core/object.h" #include "core/os/thread.h" class EditorFileServer : public Object { diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 8f1b8838d8..c88cd8ea5f 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -164,7 +164,7 @@ void InspectorDock::_resource_file_selected(String p_file) { editor->push_item(res.operator->()); } -void InspectorDock::_save_resource(bool save_as) const { +void InspectorDock::_save_resource(bool save_as) { ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; @@ -179,7 +179,7 @@ void InspectorDock::_save_resource(bool save_as) const { } } -void InspectorDock::_unref_resource() const { +void InspectorDock::_unref_resource() { ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; @@ -190,7 +190,7 @@ void InspectorDock::_unref_resource() const { editor->edit_current(); } -void InspectorDock::_copy_resource() const { +void InspectorDock::_copy_resource() { ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr; @@ -201,7 +201,7 @@ void InspectorDock::_copy_resource() const { EditorSettings::get_singleton()->set_resource_clipboard(current_res); } -void InspectorDock::_paste_resource() const { +void InspectorDock::_paste_resource() { RES r = EditorSettings::get_singleton()->get_resource_clipboard(); if (r.is_valid()) { editor->push_item(EditorSettings::get_singleton()->get_resource_clipboard().ptr(), String()); diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h index 551d3d1643..b2dabf19c5 100644 --- a/editor/inspector_dock.h +++ b/editor/inspector_dock.h @@ -96,10 +96,10 @@ class InspectorDock : public VBoxContainer { void _load_resource(const String &p_type = ""); void _open_resource_selector() { _load_resource(); }; // just used to call from arg-less signal void _resource_file_selected(String p_file); - void _save_resource(bool save_as) const; - void _unref_resource() const; - void _copy_resource() const; - void _paste_resource() const; + void _save_resource(bool save_as); + void _unref_resource(); + void _copy_resource(); + void _paste_resource(); void _warning_pressed(); void _resource_created(); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 4f627b1d0c..e4a384449b 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef SPATIAL_EDITOR_PLUGIN_H -#define SPATIAL_EDITOR_PLUGIN_H +#ifndef NODE_3D_EDITOR_PLUGIN_H +#define NODE_3D_EDITOR_PLUGIN_H #include "editor/editor_node.h" #include "editor/editor_plugin.h" @@ -890,4 +890,4 @@ public: virtual ~EditorNode3DGizmoPlugin(); }; -#endif +#endif // NODE_3D_EDITOR_PLUGIN_H diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 61fb0f4700..ddcba18a78 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -108,6 +108,7 @@ void VisualShaderGraphPlugin::_bind_methods() { ClassDB::bind_method("set_input_port_default_value", &VisualShaderGraphPlugin::set_input_port_default_value); ClassDB::bind_method("set_uniform_name", &VisualShaderGraphPlugin::set_uniform_name); ClassDB::bind_method("set_expression", &VisualShaderGraphPlugin::set_expression); + ClassDB::bind_method("update_curve", &VisualShaderGraphPlugin::update_curve); ClassDB::bind_method("update_constant", &VisualShaderGraphPlugin::update_constant); } @@ -206,6 +207,14 @@ void VisualShaderGraphPlugin::set_uniform_name(VisualShader::Type p_type, int p_ } } +void VisualShaderGraphPlugin::update_curve(int p_node_id) { + if (links.has(p_node_id) && links[p_node_id].curve_editor) { + if (((VisualShaderNodeCurveTexture *)links[p_node_id].visual_node)->get_texture().is_valid()) { + links[p_node_id].curve_editor->set_curve(((VisualShaderNodeCurveTexture *)links[p_node_id].visual_node)->get_texture()->get_curve()); + } + } +} + int VisualShaderGraphPlugin::get_constant_index(float p_constant) const { for (int i = 0; i < MAX_FLOAT_CONST_DEFS; i++) { if (Math::is_equal_approx(p_constant, float_constant_defs[i].value)) { @@ -253,6 +262,10 @@ void VisualShaderGraphPlugin::register_expression_edit(int p_node_id, CodeEdit * links[p_node_id].expression_edit = p_expression_edit; } +void VisualShaderGraphPlugin::register_curve_editor(int p_node_id, CurveEditor *p_curve_editor) { + links[p_node_id].curve_editor = p_curve_editor; +} + void VisualShaderGraphPlugin::update_uniform_refs() { for (Map<int, Link>::Element *E = links.front(); E; E = E->next()) { VisualShaderNodeUniformRef *ref = Object::cast_to<VisualShaderNodeUniformRef>(E->get().visual_node); @@ -296,7 +309,7 @@ void VisualShaderGraphPlugin::make_dirty(bool p_enabled) { } void VisualShaderGraphPlugin::register_link(VisualShader::Type p_type, int p_id, VisualShaderNode *p_visual_node, GraphNode *p_graph_node) { - links.insert(p_id, { p_type, p_visual_node, p_graph_node, p_visual_node->get_output_port_for_preview() != -1, -1, Map<int, InputPort>(), Map<int, Port>(), nullptr, nullptr, nullptr, nullptr }); + links.insert(p_id, { p_type, p_visual_node, p_graph_node, p_visual_node->get_output_port_for_preview() != -1, -1, Map<int, InputPort>(), Map<int, Port>(), nullptr, nullptr, nullptr, nullptr, nullptr }); } void VisualShaderGraphPlugin::register_output_port(int p_node_id, int p_port, TextureButton *p_button) { @@ -327,9 +340,12 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { Ref<VisualShaderNode> vsnode = visual_shader->get_node(p_type, p_id); + Ref<VisualShaderNodeResizableBase> resizable_node = Object::cast_to<VisualShaderNodeResizableBase>(vsnode.ptr()); + bool is_resizable = !resizable_node.is_null(); + Size2 size = Size2(0, 0); + Ref<VisualShaderNodeGroupBase> group_node = Object::cast_to<VisualShaderNodeGroupBase>(vsnode.ptr()); bool is_group = !group_node.is_null(); - Size2 size = Size2(0, 0); Ref<VisualShaderNodeExpression> expression_node = Object::cast_to<VisualShaderNodeExpression>(group_node.ptr()); bool is_expression = !expression_node.is_null(); @@ -338,8 +354,8 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { GraphNode *node = memnew(GraphNode); register_link(p_type, p_id, vsnode.ptr(), node); - if (is_group) { - size = group_node->get_size(); + if (is_resizable) { + size = resizable_node->get_size(); node->set_resizable(true); node->connect("resize_request", callable_mp(VisualShaderEditor::get_singleton(), &VisualShaderEditor::_node_resized), varray((int)p_type, p_id)); @@ -403,6 +419,18 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { } } + Ref<VisualShaderNodeCurveTexture> curve = vsnode; + if (curve.is_valid()) { + if (curve->get_texture().is_valid() && !curve->get_texture()->is_connected("changed", callable_mp(VisualShaderEditor::get_singleton()->get_graph_plugin(), &VisualShaderGraphPlugin::update_curve))) { + curve->get_texture()->connect("changed", callable_mp(VisualShaderEditor::get_singleton()->get_graph_plugin(), &VisualShaderGraphPlugin::update_curve), varray(p_id)); + } + + HBoxContainer *hbox = memnew(HBoxContainer); + custom_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL); + hbox->add_child(custom_editor); + custom_editor = hbox; + } + Ref<VisualShaderNodeFloatConstant> float_const = vsnode; if (float_const.is_valid()) { HBoxContainer *hbox = memnew(HBoxContainer); @@ -425,6 +453,37 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { } else if (custom_editor) { port_offset++; node->add_child(custom_editor); + + if (curve.is_valid()) { + VisualShaderEditor::get_singleton()->graph->add_child(node); + VisualShaderEditor::get_singleton()->_update_created_node(node); + + CurveEditor *curve_editor = memnew(CurveEditor); + node->add_child(curve_editor); + register_curve_editor(p_id, curve_editor); + curve_editor->set_custom_minimum_size(Size2(300, 0)); + curve_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL); + if (curve->get_texture().is_valid()) { + curve_editor->set_curve(curve->get_texture()->get_curve()); + } + + TextureButton *preview = memnew(TextureButton); + preview->set_toggle_mode(true); + preview->set_normal_texture(VisualShaderEditor::get_singleton()->get_theme_icon("GuiVisibilityHidden", "EditorIcons")); + preview->set_pressed_texture(VisualShaderEditor::get_singleton()->get_theme_icon("GuiVisibilityVisible", "EditorIcons")); + preview->set_v_size_flags(Control::SIZE_SHRINK_CENTER); + + register_output_port(p_id, 0, preview); + + preview->connect("pressed", callable_mp(VisualShaderEditor::get_singleton(), &VisualShaderEditor::_preview_select_port), varray(p_id, 0), CONNECT_DEFERRED); + custom_editor->add_child(preview); + + VisualShaderNode::PortType port_left = vsnode->get_input_port_type(0); + VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0); + node->set_slot(0, true, port_left, type_color[port_left], true, port_right, type_color[port_right]); + + VisualShaderEditor::get_singleton()->call_deferred("_set_node_size", (int)p_type, p_id, size); + } if (vsnode->is_use_prop_slots()) { return; } @@ -672,7 +731,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { if (!uniform.is_valid()) { VisualShaderEditor::get_singleton()->graph->add_child(node); VisualShaderEditor::get_singleton()->_update_created_node(node); - if (is_group) { + if (is_resizable) { VisualShaderEditor::get_singleton()->call_deferred("_set_node_size", (int)p_type, p_id, size); } } @@ -1425,17 +1484,17 @@ void VisualShaderEditor::_expression_focus_out(Object *code_edit, int p_node) { void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p_size) { VisualShader::Type type = VisualShader::Type(p_type); - Ref<VisualShaderNode> node = visual_shader->get_node(type, p_node); + Ref<VisualShaderNodeResizableBase> node = visual_shader->get_node(type, p_node); if (node.is_null()) { return; } - Ref<VisualShaderNodeGroupBase> group_node = Object::cast_to<VisualShaderNodeGroupBase>(node.ptr()); - if (group_node.is_null()) { - return; + Size2 size = p_size; + if (!node->is_allow_v_resize()) { + size.y = 0; } - group_node->set_size(p_size); + node->set_size(size); if (get_current_shader_type() == type) { Ref<VisualShaderNodeExpression> expression_node = Object::cast_to<VisualShaderNodeExpression>(node.ptr()); @@ -1454,11 +1513,11 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p return; } - gn->set_custom_minimum_size(p_size); + gn->set_custom_minimum_size(size); gn->set_size(Size2(1, 1)); if (!expression_node.is_null() && text_box) { - Size2 box_size = p_size; + Size2 box_size = size; if (gn != nullptr) { if (box_size.x < 150 * EDSCALE || box_size.y < 0) { box_size.x = gn->get_size().x; @@ -1475,7 +1534,7 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p } void VisualShaderEditor::_node_resized(const Vector2 &p_new_size, int p_type, int p_node) { - Ref<VisualShaderNodeGroupBase> node = visual_shader->get_node(VisualShader::Type(p_type), p_node); + Ref<VisualShaderNodeResizableBase> node = visual_shader->get_node(VisualShader::Type(p_type), p_node); if (node.is_null()) { return; } @@ -1655,6 +1714,11 @@ void VisualShaderEditor::_add_texture3d_node(const String &p_path) { texture3d->set_texture(ResourceLoader::load(p_path)); } +void VisualShaderEditor::_add_curve_node(const String &p_path) { + VisualShaderNodeCurveTexture *curve = (VisualShaderNodeCurveTexture *)_add_node(curve_node_option_idx, -1); + curve->set_texture(ResourceLoader::load(p_path)); +} + VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) { ERR_FAIL_INDEX_V(p_idx, add_options.size(), nullptr); @@ -1833,6 +1897,11 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) { undo_redo->add_undo_method(this, "_update_uniforms", true); } + VisualShaderNodeCurveTexture *curve = Object::cast_to<VisualShaderNodeCurveTexture>(vsnode.ptr()); + if (curve) { + graph_plugin->call_deferred("update_curve", id_to_use); + } + undo_redo->commit_action(); return vsnode.ptr(); } @@ -2676,6 +2745,11 @@ void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da _add_custom_node(arr[i]); j++; } + } else if (type == "CurveTexture") { + saved_node_pos = p_point + Vector2(0, j * 210 * EDSCALE); + saved_node_pos_dirty = true; + _add_curve_node(arr[i]); + j++; } else if (ClassDB::get_parent_class(type) == "Texture2D") { saved_node_pos = p_point + Vector2(0, j * 210 * EDSCALE); saved_node_pos_dirty = true; @@ -3301,6 +3375,8 @@ VisualShaderEditor::VisualShaderEditor() { // TEXTURES cubemap_node_option_idx = add_options.size(); add_options.push_back(AddOption("CubeMap", "Textures", "Functions", "VisualShaderNodeCubemap", TTR("Perform the cubic texture lookup."), -1, -1)); + curve_node_option_idx = add_options.size(); + add_options.push_back(AddOption("CurveTexture", "Textures", "Functions", "VisualShaderNodeCurveTexture", TTR("Perform the curve texture lookup."), -1, -1)); texture2d_node_option_idx = add_options.size(); add_options.push_back(AddOption("Texture2D", "Textures", "Functions", "VisualShaderNodeTexture", TTR("Perform the 2D texture lookup."), -1, -1)); texture2d_array_node_option_idx = add_options.size(); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index cecee70ca9..73bebcd192 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -33,6 +33,7 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" +#include "editor/plugins/curve_editor_plugin.h" #include "editor/property_editor.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" @@ -74,6 +75,7 @@ private: LineEdit *uniform_name; OptionButton *const_op; CodeEdit *expression_edit; + CurveEditor *curve_editor; }; Ref<VisualShader> visual_shader; @@ -93,6 +95,7 @@ public: void register_default_input_button(int p_node_id, int p_port_id, Button *p_button); void register_constant_option_btn(int p_node_id, OptionButton *p_button); void register_expression_edit(int p_node_id, CodeEdit *p_expression_edit); + void register_curve_editor(int p_node_id, CurveEditor *p_curve_editor); void clear_links(); void set_shader_type(VisualShader::Type p_type); bool is_preview_visible(int p_id) const; @@ -111,6 +114,7 @@ public: void set_input_port_default_value(VisualShader::Type p_type, int p_node_id, int p_port_id, Variant p_value); void update_uniform_refs(); void set_uniform_name(VisualShader::Type p_type, int p_node_id, const String &p_name); + void update_curve(int p_node_id); void update_constant(VisualShader::Type p_type, int p_node_id); void set_expression(VisualShader::Type p_type, int p_node_id, const String &p_expression); int get_constant_index(float p_constant) const; @@ -254,6 +258,7 @@ class VisualShaderEditor : public VBoxContainer { int texture2d_array_node_option_idx; int texture3d_node_option_idx; int custom_node_option_idx; + int curve_node_option_idx; List<String> keyword_list; List<VisualShaderNodeUniformRef> uniform_refs; @@ -265,6 +270,8 @@ class VisualShaderEditor : public VBoxContainer { void _add_texture2d_node(const String &p_path); void _add_texture2d_array_node(const String &p_path); void _add_texture3d_node(const String &p_path); + void _add_curve_node(const String &p_path); + VisualShaderNode *_add_node(int p_idx, int p_op_idx = -1); void _update_options_menu(); void _set_mode(int p_which); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 1f553ba0de..71522bb253 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -51,10 +51,6 @@ void ProjectExportDialog::_theme_changed() { duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons")); delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons")); - Control *panel = custom_feature_display->get_parent_control(); - if (panel) { - panel->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree")); - } } void ProjectExportDialog::_notification(int p_what) { @@ -68,7 +64,6 @@ void ProjectExportDialog::_notification(int p_what) { duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons")); delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons")); connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip)); - custom_feature_display->get_parent_control()->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree")); } break; } } @@ -205,7 +200,6 @@ void ProjectExportDialog::_edit_preset(int p_index) { duplicate_preset->set_disabled(true); delete_preset->set_disabled(true); sections->hide(); - patches->clear(); export_error->hide(); export_templates_error->hide(); return; @@ -241,34 +235,6 @@ void ProjectExportDialog::_edit_preset(int p_index) { include_filters->set_text(current->get_include_filter()); exclude_filters->set_text(current->get_exclude_filter()); - patches->clear(); - TreeItem *patch_root = patches->create_item(); - Vector<String> patchlist = current->get_patches(); - for (int i = 0; i < patchlist.size(); i++) { - TreeItem *patch = patches->create_item(patch_root); - patch->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - String file = patchlist[i].get_file(); - patch->set_editable(0, true); - patch->set_text(0, file.get_file().replace("*", "")); - if (file.ends_with("*")) { - patch->set_checked(0, true); - } - patch->set_tooltip(0, patchlist[i]); - patch->set_metadata(0, i); - patch->add_button(0, presets->get_theme_icon("Remove", "EditorIcons"), 0); - patch->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1); - } - - TreeItem *patch_add = patches->create_item(patch_root); - patch_add->set_metadata(0, patchlist.size()); - if (patchlist.size() == 0) { - patch_add->set_text(0, TTR("Add initial export...")); - } else { - patch_add->set_text(0, TTR("Add previous patches...")); - } - - patch_add->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1); - _fill_resource_tree(); bool needs_templates; @@ -401,74 +367,6 @@ void ProjectExportDialog::_tab_changed(int) { _update_feature_list(); } -void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, int p_id) { - TreeItem *ti = (TreeItem *)p_item; - - patch_index = ti->get_metadata(0); - - Ref<EditorExportPreset> current = get_current_preset(); - ERR_FAIL_COND(current.is_null()); - - if (p_id == 0) { - Vector<String> patches = current->get_patches(); - ERR_FAIL_INDEX(patch_index, patches.size()); - patch_erase->set_text(vformat(TTR("Delete patch '%s' from list?"), patches[patch_index].get_file())); - patch_erase->popup_centered(); - } else { - patch_dialog->popup_file_dialog(); - } -} - -void ProjectExportDialog::_patch_edited() { - TreeItem *item = patches->get_edited(); - if (!item) { - return; - } - int index = item->get_metadata(0); - - Ref<EditorExportPreset> current = get_current_preset(); - ERR_FAIL_COND(current.is_null()); - - Vector<String> patches = current->get_patches(); - - ERR_FAIL_INDEX(index, patches.size()); - - String patch = patches[index].replace("*", ""); - - if (item->is_checked(0)) { - patch += "*"; - } - - current->set_patch(index, patch); -} - -void ProjectExportDialog::_patch_selected(const String &p_path) { - Ref<EditorExportPreset> current = get_current_preset(); - ERR_FAIL_COND(current.is_null()); - - Vector<String> patches = current->get_patches(); - - if (patch_index >= patches.size()) { - current->add_patch(ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + "*"); - } else { - String enabled = patches[patch_index].ends_with("*") ? String("*") : String(); - current->set_patch(patch_index, ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + enabled); - } - - _update_current_preset(); -} - -void ProjectExportDialog::_patch_deleted() { - Ref<EditorExportPreset> current = get_current_preset(); - ERR_FAIL_COND(current.is_null()); - - Vector<String> patches = current->get_patches(); - if (patch_index < patches.size()) { - current->remove_patch(patch_index); - _update_current_preset(); - } -} - void ProjectExportDialog::_update_parameters(const String &p_edited_property) { _update_current_preset(); } @@ -663,10 +561,6 @@ void ProjectExportDialog::_duplicate_preset() { preset->set_export_filter(current->get_export_filter()); preset->set_include_filter(current->get_include_filter()); preset->set_exclude_filter(current->get_exclude_filter()); - Vector<String> list = current->get_patches(); - for (int i = 0; i < list.size(); i++) { - preset->add_patch(list[i]); - } preset->set_custom_features(current->get_custom_features()); for (const List<PropertyInfo>::Element *E = current->get_properties().front(); E; E = E->next()) { @@ -718,21 +612,6 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_ return d; } - } else if (p_from == patches) { - TreeItem *item = patches->get_item_at_position(p_point); - - if (item && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK) { - int metadata = item->get_metadata(0); - Dictionary d; - d["type"] = "export_patch"; - d["patch"] = metadata; - - Label *label = memnew(Label); - label->set_text(item->get_text(0)); - patches->set_drag_preview(label); - - return d; - } } return Variant(); @@ -748,19 +627,6 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point)) { return false; } - } else if (p_from == patches) { - Dictionary d = p_data; - if (!d.has("type") || String(d["type"]) != "export_patch") { - return false; - } - - patches->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM); - - TreeItem *item = patches->get_item_at_position(p_point); - - if (!item) { - return false; - } } return true; @@ -797,33 +663,6 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d } else { _edit_preset(presets->get_item_count() - 1); } - } else if (p_from == patches) { - Dictionary d = p_data; - if (!d.has("type") || String(d["type"]) != "export_patch") { - return; - } - - int from_pos = d["patch"]; - - TreeItem *item = patches->get_item_at_position(p_point); - if (!item) { - return; - } - - int to_pos = item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK ? int(item->get_metadata(0)) : -1; - - if (to_pos == from_pos) { - return; - } else if (to_pos > from_pos) { - to_pos--; - } - - Ref<EditorExportPreset> preset = get_current_preset(); - String patch = preset->get_patch(from_pos); - preset->remove_patch(from_pos); - preset->add_patch(patch, to_pos); - - _update_current_preset(); } } @@ -1222,48 +1061,6 @@ ProjectExportDialog::ProjectExportDialog() { script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED); script_mode->connect("item_selected", callable_mp(this, &ProjectExportDialog::_script_export_mode_changed)); - // Patch packages. - - VBoxContainer *patch_vb = memnew(VBoxContainer); - sections->add_child(patch_vb); - patch_vb->set_name(TTR("Patches")); - - // FIXME: Patching support doesn't seem properly implemented yet, so we hide it. - // The rest of the code is still kept for now, in the hope that it will be made - // functional and reactivated. - patch_vb->hide(); - - patches = memnew(Tree); - patch_vb->add_child(patches); - patches->set_v_size_flags(Control::SIZE_EXPAND_FILL); - patches->set_hide_root(true); - patches->connect("button_pressed", callable_mp(this, &ProjectExportDialog::_patch_button_pressed)); - patches->connect("item_edited", callable_mp(this, &ProjectExportDialog::_patch_edited)); -#ifndef _MSC_VER -#warning must reimplement drag forward -#endif - //patches->set_drag_forwarding(this); - patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - - HBoxContainer *patches_hb = memnew(HBoxContainer); - patch_vb->add_child(patches_hb); - patches_hb->add_spacer(); - patch_export = memnew(Button); - patch_export->set_text(TTR("Make Patch")); - patches_hb->add_child(patch_export); - patches_hb->add_spacer(); - - patch_dialog = memnew(EditorFileDialog); - patch_dialog->add_filter("*.pck ; " + TTR("Pack File")); - patch_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); - patch_dialog->connect("file_selected", callable_mp(this, &ProjectExportDialog::_patch_selected)); - add_child(patch_dialog); - - patch_erase = memnew(ConfirmationDialog); - patch_erase->get_ok()->set_text(TTR("Delete")); - patch_erase->connect("confirmed", callable_mp(this, &ProjectExportDialog::_patch_deleted)); - add_child(patch_erase); - // Feature tags. VBoxContainer *feature_vb = memnew(VBoxContainer); diff --git a/editor/project_export.h b/editor/project_export.h index 75402dc334..026daac2ad 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -87,12 +87,6 @@ private: StringName editor_icons; - Tree *patches; - Button *patch_export; - int patch_index; - EditorFileDialog *patch_dialog; - ConfirmationDialog *patch_erase; - Button *export_button; Button *export_all_button; AcceptDialog *export_all_dialog; @@ -109,9 +103,6 @@ private: String default_filename; - void _patch_selected(const String &p_path); - void _patch_deleted(); - void _runnable_pressed(); void _update_parameters(const String &p_edited_property); void _name_changed(const String &p_string); @@ -133,9 +124,6 @@ private: bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes); void _tree_changed(); - void _patch_button_pressed(Object *p_item, int p_column, int p_id); - void _patch_edited(); - Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index fa2270dcd6..c4e90ca3ff 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2107,8 +2107,12 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop } if (E->get().name == "__meta__") { - if (Object::cast_to<CanvasItem>(newnode)) { - Dictionary metadata = n->get(E->get().name); + Dictionary metadata = n->get(E->get().name); + if (metadata.has("_editor_description_")) { + newnode->set_meta("_editor_description_", metadata["_editor_description_"]); + } + + if (Object::cast_to<CanvasItem>(newnode) || Object::cast_to<Node3D>(newnode)) { if (metadata.has("_edit_group_") && metadata["_edit_group_"]) { newnode->set_meta("_edit_group_", true); } |