diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 1 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 15 | ||||
-rw-r--r-- | editor/editor_help.cpp | 19 | ||||
-rw-r--r-- | editor/editor_node.cpp | 9 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 21 | ||||
-rw-r--r-- | editor/groups_editor.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 62 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 3 | ||||
-rw-r--r-- | editor/plugins/mesh_instance_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 1 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 67 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 20 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 3 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 1 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 10 |
21 files changed, 198 insertions, 69 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 7183d34d4f..33f833afa4 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -5818,6 +5818,7 @@ AnimationTrackEditor::AnimationTrackEditor() { info_message->set_valign(Label::VALIGN_CENTER); info_message->set_align(Label::ALIGN_CENTER); info_message->set_autowrap(true); + info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); info_message->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); main_panel->add_child(info_message); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 3663bdee27..2467e1f722 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -325,14 +325,12 @@ void EditorFileSystem::_save_filesystem_cache() { String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(CACHE_FILE_NAME); FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE); - if (f == NULL) { - ERR_PRINTS("Error writing fscache '" + fscache + "'."); - } else { - f->store_line(filesystem_settings_version_for_import); - _save_filesystem_cache(filesystem, f); - f->close(); - memdelete(f); - } + ERR_FAIL_COND_MSG(!f, "Cannot create file '" + fscache + "'. Check user write permissions."); + + f->store_line(filesystem_settings_version_for_import); + _save_filesystem_cache(filesystem, f); + f->close(); + memdelete(f); } void EditorFileSystem::_thread_func(void *_userdata) { @@ -1373,6 +1371,7 @@ void EditorFileSystem::_save_late_updated_files() { //files that already existed, and were modified, need re-scanning for dependencies upon project restart. This is done via saving this special file String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update4"); FileAccessRef f = FileAccess::open(fscache, FileAccess::WRITE); + ERR_FAIL_COND_MSG(!f, "Cannot create file '" + fscache + "'. Check user write permissions."); for (Set<String>::Element *E = late_update_files.front(); E; E = E->next()) { f->store_line(E->get()); } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index d2306abfd7..dd49e38d7f 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1224,11 +1224,18 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts"); Ref<Font> doc_bold_font = p_rt->get_font("doc_bold", "EditorFonts"); Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); + Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp"); - Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8); + Color accent_color = p_rt->get_color("accent_color", "Editor"); + Color link_color = accent_color.linear_interpolate(font_color_hl, 0.8); + Color code_color = accent_color.linear_interpolate(font_color_hl, 0.6); String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges(); + // remove extra new lines around code blocks + bbcode = bbcode.replace("[codeblock]\n", "[codeblock]"); + bbcode = bbcode.replace("\n[/codeblock]", "[/codeblock]"); + List<String> tag_stack; bool code_tag = false; @@ -1276,9 +1283,14 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { tag_stack.pop_front(); pos = brk_end + 1; - code_tag = false; - if (tag != "/img") + if (tag != "/img") { p_rt->pop(); + if (code_tag) { + p_rt->pop(); + } + } + code_tag = false; + } else if (code_tag) { p_rt->add_text("["); @@ -1323,6 +1335,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { //use monospace font p_rt->push_font(doc_code_font); + p_rt->push_color(code_color); code_tag = true; pos = brk_end + 1; tag_stack.push_front(tag); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9fa33044e1..d42345d9a2 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5171,14 +5171,20 @@ void EditorNode::_open_imported() { } void EditorNode::dim_editor(bool p_dimming, bool p_force_dim) { - // Dimming can be forced regardless of the editor setting, which is useful when quitting the editor + // Dimming can be forced regardless of the editor setting, which is useful when quitting the editor. if ((p_force_dim || EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup")) && p_dimming) { + dimmed = true; gui_base->set_modulate(Color(0.5, 0.5, 0.5)); } else { + dimmed = false; gui_base->set_modulate(Color(1, 1, 1)); } } +bool EditorNode::is_editor_dimmed() const { + return dimmed; +} + void EditorNode::open_export_template_manager() { export_template_manager->popup_manager(); @@ -5487,6 +5493,7 @@ EditorNode::EditorNode() { singleton = this; exiting = false; + dimmed = false; last_checked_version = 0; changing_scene = false; _initializing_addons = false; diff --git a/editor/editor_node.h b/editor/editor_node.h index fb7e81d2d2..b7775b5e83 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -260,6 +260,7 @@ private: int tab_closing; bool exiting; + bool dimmed; int old_split_ofs; VSplitContainer *top_split; @@ -850,6 +851,7 @@ public: void restart_editor(); void dim_editor(bool p_dimming, bool p_force_dim = false); + bool is_editor_dimmed() const; void edit_current() { _edit_current(); }; diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 65a1704770..55f9347045 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -201,9 +201,8 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< if (has_small_texture) { ResourceSaver::save(cache_base + "_small.png", r_small_texture); } - Error err; - FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE, &err); - ERR_FAIL_COND_MSG(err != OK, "Cannot create file '" + cache_base + ".txt'."); + FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE); + ERR_FAIL_COND_MSG(!f, "Cannot create file '" + cache_base + ".txt'. Check user write permissions."); f->store_line(itos(thumbnail_size)); f->store_line(itos(has_small_texture)); f->store_line(itos(FileAccess::get_modified_time(p_item.path))); @@ -295,11 +294,17 @@ void EditorResourcePreview::_thread() { //update modified time f = FileAccess::open(file, FileAccess::WRITE); - f->store_line(itos(thumbnail_size)); - f->store_line(itos(has_small_texture)); - f->store_line(itos(modtime)); - f->store_line(md5); - memdelete(f); + if (!f) { + // Not returning as this would leave the thread hanging and would require + // some proper cleanup/disabling of resource preview generation. + ERR_PRINTS("Cannot create file '" + file + "'. Check user write permissions."); + } else { + f->store_line(itos(thumbnail_size)); + f->store_line(itos(has_small_texture)); + f->store_line(itos(modtime)); + f->store_line(md5); + memdelete(f); + } } } else { memdelete(f); diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 4cefb53617..74d81bf561 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -529,6 +529,7 @@ GroupDialog::GroupDialog() { group_empty->set_valign(Label::VALIGN_CENTER); group_empty->set_align(Label::ALIGN_CENTER); group_empty->set_autowrap(true); + group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); nodes_to_remove->add_child(group_empty); group_empty->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bc22d9315e..ce400ad6dd 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1117,15 +1117,17 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { undo_redo->add_do_method(this, "_update_graph"); undo_redo->add_undo_method(this, "_update_graph"); undo_redo->commit_action(); + name_edit->hide(); updating = false; state_machine_draw->update(); - - name_edit->hide(); } void AnimationNodeStateMachineEditor::_name_edited_focus_out() { + if (updating) + return; + _name_edited(name_edit->get_text()); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index cf62d59352..d84a67dba1 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -70,11 +70,15 @@ class SnapDialog : public ConfirmationDialog { SpinBox *primary_grid_steps; SpinBox *rotation_offset; SpinBox *rotation_step; + SpinBox *scale_step; public: SnapDialog() { const int SPIN_BOX_GRID_RANGE = 16384; const int SPIN_BOX_ROTATION_RANGE = 360; + const float SPIN_BOX_SCALE_MIN = 0.01f; + const float SPIN_BOX_SCALE_MAX = 100; + Label *label; VBoxContainer *container; GridContainer *child_container; @@ -182,9 +186,27 @@ public: rotation_step->set_suffix("deg"); rotation_step->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(rotation_step); + + container->add_child(memnew(HSeparator)); + + child_container = memnew(GridContainer); + child_container->set_columns(2); + container->add_child(child_container); + label = memnew(Label); + label->set_text(TTR("Scale Step:")); + child_container->add_child(label); + label->set_h_size_flags(SIZE_EXPAND_FILL); + + scale_step = memnew(SpinBox); + scale_step->set_min(SPIN_BOX_SCALE_MIN); + scale_step->set_max(SPIN_BOX_SCALE_MAX); + scale_step->set_allow_greater(true); + scale_step->set_h_size_flags(SIZE_EXPAND_FILL); + scale_step->set_step(0.01f); + child_container->add_child(scale_step); } - void set_fields(const Point2 p_grid_offset, const Point2 p_grid_step, const int p_primary_grid_steps, const float p_rotation_offset, const float p_rotation_step) { + void set_fields(const Point2 p_grid_offset, const Point2 p_grid_step, const int p_primary_grid_steps, const float p_rotation_offset, const float p_rotation_step, const float p_scale_step) { grid_offset_x->set_value(p_grid_offset.x); grid_offset_y->set_value(p_grid_offset.y); grid_step_x->set_value(p_grid_step.x); @@ -192,14 +214,16 @@ public: primary_grid_steps->set_value(p_primary_grid_steps); rotation_offset->set_value(p_rotation_offset * (180 / Math_PI)); rotation_step->set_value(p_rotation_step * (180 / Math_PI)); + scale_step->set_value(p_scale_step); } - void get_fields(Point2 &p_grid_offset, Point2 &p_grid_step, int &p_primary_grid_steps, float &p_rotation_offset, float &p_rotation_step) { + void get_fields(Point2 &p_grid_offset, Point2 &p_grid_step, int &p_primary_grid_steps, float &p_rotation_offset, float &p_rotation_step, float &p_scale_step) { p_grid_offset = Point2(grid_offset_x->get_value(), grid_offset_y->get_value()); p_grid_step = Point2(grid_step_x->get_value(), grid_step_y->get_value()); p_primary_grid_steps = int(primary_grid_steps->get_value()); p_rotation_offset = rotation_offset->get_value() / (180 / Math_PI); p_rotation_step = rotation_step->get_value() / (180 / Math_PI); + p_scale_step = scale_step->get_value(); } }; @@ -921,7 +945,7 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite } void CanvasItemEditor::_snap_changed() { - ((SnapDialog *)snap_dialog)->get_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step); + ((SnapDialog *)snap_dialog)->get_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step); grid_step_multiplier = 0; viewport->update(); } @@ -1203,8 +1227,8 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo } if (panning) { - if (!b->is_pressed()) { - // Stop panning the viewport (for any mouse button press) + if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != BUTTON_WHEEL_DOWN && b->get_button_index() != BUTTON_WHEEL_UP))) { + // Stop panning the viewport (for any mouse button press except zooming) panning = false; } } @@ -1852,6 +1876,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) { Transform2D simple_xform = (viewport->get_transform() * unscaled_transform).affine_inverse() * transform; bool uniform = m->get_shift(); + bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CONTROL); Point2 drag_from_local = simple_xform.xform(drag_from); Point2 drag_to_local = simple_xform.xform(drag_to); @@ -1882,6 +1907,12 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) { } } } + + if (snap_scale && !is_ctrl) { + scale.x = roundf(scale.x / snap_scale_step) * snap_scale_step; + scale.y = roundf(scale.y / snap_scale_step) * snap_scale_step; + } + canvas_item->call("set_scale", scale); return true; } @@ -4351,6 +4382,11 @@ void CanvasItemEditor::_popup_callback(int p_op) { int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_ROTATION); snap_config_menu->get_popup()->set_item_checked(idx, snap_rotation); } break; + case SNAP_USE_SCALE: { + snap_scale = !snap_scale; + int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_SCALE); + snap_config_menu->get_popup()->set_item_checked(idx, snap_scale); + } break; case SNAP_RELATIVE: { snap_relative = !snap_relative; int idx = snap_config_menu->get_popup()->get_item_index(SNAP_RELATIVE); @@ -4363,7 +4399,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { snap_config_menu->get_popup()->set_item_checked(idx, snap_pixel); } break; case SNAP_CONFIGURE: { - ((SnapDialog *)snap_dialog)->set_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step); + ((SnapDialog *)snap_dialog)->set_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step); snap_dialog->popup_centered(Size2(220, 160) * EDSCALE); } break; case SKELETON_SHOW_BONES: { @@ -4914,6 +4950,7 @@ Dictionary CanvasItemEditor::get_state() const { state["primary_grid_steps"] = primary_grid_steps; state["snap_rotation_offset"] = snap_rotation_offset; state["snap_rotation_step"] = snap_rotation_step; + state["snap_scale_step"] = snap_scale_step; state["smart_snap_active"] = smart_snap_active; state["grid_snap_active"] = grid_snap_active; state["snap_node_parent"] = snap_node_parent; @@ -4931,6 +4968,7 @@ Dictionary CanvasItemEditor::get_state() const { state["show_zoom_control"] = zoom_hb->is_visible(); state["show_edit_locks"] = show_edit_locks; state["snap_rotation"] = snap_rotation; + state["snap_scale"] = snap_scale; state["snap_relative"] = snap_relative; state["snap_pixel"] = snap_pixel; state["skeleton_show_bones"] = skeleton_show_bones; @@ -4972,6 +5010,10 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { snap_rotation_offset = state["snap_rotation_offset"]; } + if (state.has("snap_scale_step")) { + snap_scale_step = state["snap_scale_step"]; + } + if (state.has("smart_snap_active")) { smart_snap_active = state["smart_snap_active"]; smart_snap_button->set_pressed(smart_snap_active); @@ -5072,6 +5114,12 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { snap_config_menu->get_popup()->set_item_checked(idx, snap_rotation); } + if (state.has("snap_scale")) { + snap_scale = state["snap_scale"]; + int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_SCALE); + snap_config_menu->get_popup()->set_item_checked(idx, snap_scale); + } + if (state.has("snap_relative")) { snap_relative = state["snap_relative"]; int idx = snap_config_menu->get_popup()->get_item_index(SNAP_RELATIVE); @@ -5157,6 +5205,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { grid_step_multiplier = 0; snap_rotation_offset = 0; snap_rotation_step = 15 / (180 / Math_PI); + snap_scale_step = 0.1f; smart_snap_active = false; grid_snap_active = false; snap_node_parent = true; @@ -5379,6 +5428,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->connect("id_pressed", this, "_popup_callback"); p->set_hide_on_checkable_item_selection(false); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_scale_snap", TTR("Use Scale Snap")), SNAP_USE_SCALE); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL); p->add_submenu_item(TTR("Smart Snapping"), "SmartSnapping"); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 35efc14b5e..058f9a77d3 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -108,6 +108,7 @@ private: SNAP_USE_GRID, SNAP_USE_GUIDES, SNAP_USE_ROTATION, + SNAP_USE_SCALE, SNAP_RELATIVE, SNAP_CONFIGURE, SNAP_USE_PIXEL, @@ -260,6 +261,7 @@ private: float snap_rotation_step; float snap_rotation_offset; + float snap_scale_step; bool smart_snap_active; bool grid_snap_active; @@ -270,6 +272,7 @@ private: bool snap_other_nodes; bool snap_guides; bool snap_rotation; + bool snap_scale; bool snap_relative; bool snap_pixel; bool skeleton_show_bones; diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index 635b934333..22df8fd8f4 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -180,6 +180,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { CollisionShape *cshape = memnew(CollisionShape); cshape->set_shape(shapes[i]); + cshape->set_transform(node->get_transform()); Node *owner = node->get_owner(); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 603a2365c1..f63445dab8 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -571,6 +571,7 @@ void ScriptTextEditor::_validate_script() { String error_text = "error(" + itos(line) + "," + itos(col) + "): " + errortxt; code_editor->set_error(error_text); code_editor->set_error_pos(line - 1, col - 1); + script_is_valid = false; } else { code_editor->set_error(""); line = -1; @@ -585,6 +586,7 @@ void ScriptTextEditor::_validate_script() { functions.push_back(E->get()); } + script_is_valid = true; } _update_connected_methods(); @@ -967,7 +969,7 @@ void ScriptTextEditor::_update_connected_methods() { text_edit->clear_info_icons(); missing_connections.clear(); - if (!script->is_valid()) { + if (!script_is_valid) { return; } @@ -1000,10 +1002,18 @@ void ScriptTextEditor::_update_connected_methods() { if (!ClassDB::has_method(script->get_instance_base_type(), connection.method)) { int line = -1; - if (script->has_method(connection.method)) { - line = script->get_member_line(connection.method); - text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); - methods_found.insert(connection.method); + + for (int j = 0; j < functions.size(); j++) { + String name = functions[j].get_slice(":", 0); + if (name == connection.method) { + line = functions[j].get_slice(":", 1).to_int(); + text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); + methods_found.insert(connection.method); + break; + } + } + + if (line >= 0) { continue; } @@ -1728,6 +1738,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p ScriptTextEditor::ScriptTextEditor() { theme_loaded = false; + script_is_valid = false; VSplitContainer *editor_box = memnew(VSplitContainer); add_child(editor_box); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index eba75befd4..2ba0be8feb 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -59,6 +59,7 @@ class ScriptTextEditor : public ScriptEditorBase { RichTextLabel *warnings_panel; Ref<Script> script; + bool script_is_valid; Vector<String> functions; diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 2d66087699..10567557d6 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -1996,6 +1996,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { info_message->set_valign(Label::VALIGN_CENTER); info_message->set_align(Label::ALIGN_CENTER); info_message->set_autowrap(true); + info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); info_message->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); palette->add_child(info_message); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index d81c6d3f96..cc4c21cc04 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -584,6 +584,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { empty_message->set_valign(Label::VALIGN_CENTER); empty_message->set_align(Label::ALIGN_CENTER); empty_message->set_autowrap(true); + empty_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); empty_message->set_v_size_flags(SIZE_EXPAND_FILL); main_vb->add_child(empty_message); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 3a9e48cfdb..90eb3045df 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -109,11 +109,12 @@ void VisualShaderEditor::clear_custom_types() { for (int i = 0; i < add_options.size(); i++) { if (add_options[i].is_custom) { add_options.remove(i); + i--; } } } -void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_sub_category) { +void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory) { ERR_FAIL_COND(!p_name.is_valid_identifier()); ERR_FAIL_COND(!p_script.is_valid()); @@ -131,9 +132,25 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> ao.return_type = p_return_icon_type; ao.description = p_description; ao.category = p_category; - ao.sub_category = p_sub_category; + ao.sub_category = p_subcategory; ao.is_custom = true; + bool begin = false; + + for (int i = 0; i < add_options.size(); i++) { + if (add_options[i].is_custom) { + if (add_options[i].category == p_category) { + if (!begin) { + begin = true; + } + } else { + if (begin) { + add_options.insert(i, ao); + return; + } + } + } + } add_options.push_back(ao); } @@ -184,6 +201,7 @@ void VisualShaderEditor::update_custom_nodes() { clear_custom_types(); List<StringName> class_list; ScriptServer::get_global_class_list(&class_list); + Dictionary added; for (int i = 0; i < class_list.size(); i++) { if (ScriptServer::get_global_class_native_base(class_list[i]) == "VisualShaderNodeCustom") { @@ -222,14 +240,44 @@ void VisualShaderEditor::update_custom_nodes() { category = "Custom"; } - String sub_category = ""; + String subcategory = ""; if (ref->has_method("_get_subcategory")) { - sub_category = (String)ref->call("_get_subcategory"); + subcategory = (String)ref->call("_get_subcategory"); } - add_custom_type(name, script, description, return_icon_type, category, sub_category); + Dictionary dict; + dict["name"] = name; + dict["script"] = script; + dict["description"] = description; + dict["return_icon_type"] = return_icon_type; + dict["category"] = category; + dict["subcategory"] = subcategory; + + String key; + key = category; + key += "/"; + if (subcategory != "") { + key += subcategory; + key += "/"; + } + key += name; + + added[key] = dict; } } + + Array keys = added.keys(); + keys.sort(); + + for (int i = 0; i < keys.size(); i++) { + + const Variant &key = keys.get(i); + + const Dictionary &value = (Dictionary)added[key]; + + add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"]); + } + _update_options_menu(); } @@ -2483,9 +2531,11 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("Alpha", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Binormal", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "binormal"), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Color", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("DepthTexture", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "depth_texture"), "depth_texture", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("FrontFacing", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "front_facing"), "front_facing", VisualShaderNode::PORT_TYPE_BOOLEAN, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "point_coord"), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ScreenTexture", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "screen_texture"), "screen_texture", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Side", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "side"), "side", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Tangent", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "tangent"), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL)); @@ -2519,9 +2569,12 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("LightPass", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "light_pass"), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("NormalTexture", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "normal_texture"), "normal_texture", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "point_coord"), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("ScreenPixelSize", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "screen_pixel_size"), "screen_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("ScreenTexture", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_shader_mode, "screen_texture"), "screen_texture", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("Texture", "Input", "Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "texture"), "texture", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("LightAlpha", "Input", "Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "light_alpha"), "light_alpha", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM)); @@ -2533,6 +2586,7 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("PointCoord", "Input", "Light", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "point_coord"), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("ScreenUV", "Input", "Light", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("ShadowColor", "Input", "Light", "VisualShaderNodeInput", vformat(input_param_for_light_shader_mode, "shadow_color"), "shadow_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM)); + add_options.push_back(AddOption("Texture", "Input", "Light", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "texture"), "texture", VisualShaderNode::PORT_TYPE_SAMPLER, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("Extra", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_shader_mode, "extra"), "extra", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM)); add_options.push_back(AddOption("LightPass", "Input", "Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "light_pass"), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM)); @@ -2830,11 +2884,12 @@ public: void setup(const Ref<VisualShaderNodeInput> &p_input) { input = p_input; - Ref<Texture> type_icon[4] = { + Ref<Texture> type_icon[5] = { EditorNode::get_singleton()->get_gui_base()->get_icon("float", "EditorIcons"), EditorNode::get_singleton()->get_gui_base()->get_icon("Vector3", "EditorIcons"), EditorNode::get_singleton()->get_gui_base()->get_icon("bool", "EditorIcons"), EditorNode::get_singleton()->get_gui_base()->get_icon("Transform", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_icon("ImageTexture", "EditorIcons"), }; add_item("[None]"); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 6f77641936..5197f8c77f 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -264,7 +264,7 @@ public: static VisualShaderEditor *get_singleton() { return singleton; } void clear_custom_types(); - void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_sub_category); + void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory); virtual Size2 get_minimum_size() const; void edit(VisualShader *p_visual_shader); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index f56f7ef7ca..ca5858b768 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -442,15 +442,7 @@ void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) { if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) { last_wait_for_key = p_event; - String str = keycode_get_string(k->get_scancode()).capitalize(); - if (k->get_metakey()) - str = vformat("%s+", find_keycode_name(KEY_META)) + str; - if (k->get_shift()) - str = TTR("Shift+") + str; - if (k->get_alt()) - str = TTR("Alt+") + str; - if (k->get_control()) - str = TTR("Control+") + str; + const String str = keycode_get_string(k->get_scancode_with_modifiers()); press_a_key_label->set_text(str); press_a_key->accept_event(); @@ -740,15 +732,7 @@ void ProjectSettingsEditor::_update_actions() { Ref<InputEventKey> k = event; if (k.is_valid()) { - String str = keycode_get_string(k->get_scancode()).capitalize(); - if (k->get_metakey()) - str = vformat("%s+", find_keycode_name(KEY_META)) + str; - if (k->get_shift()) - str = TTR("Shift+") + str; - if (k->get_alt()) - str = TTR("Alt+") + str; - if (k->get_control()) - str = TTR("Control+") + str; + const String str = keycode_get_string(k->get_scancode_with_modifiers()); action2->set_text(0, str); action2->set_icon(0, get_icon("Keyboard", "EditorIcons")); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 0884620e5d..beead9e7f1 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -340,8 +340,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!profile_allow_editing) { break; } - Tree *tree = scene_tree->get_scene_tree(); - if (tree->is_anything_selected()) { + if (editor_selection->get_selected_node_list().size() > 1) { rename_dialog->popup_centered(); } } break; diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index c1899b2bde..06acdcd4e2 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -2424,6 +2424,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { info_message->set_valign(Label::VALIGN_CENTER); info_message->set_align(Label::ALIGN_CENTER); info_message->set_autowrap(true); + info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); info_message->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); perf_draw->add_child(info_message); } diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index f8425ebe22..a38c6b98cc 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -310,15 +310,7 @@ void EditorSettingsDialog::_wait_for_key(const Ref<InputEvent> &p_event) { if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) { last_wait_for_key = k; - String str = keycode_get_string(k->get_scancode()).capitalize(); - if (k->get_metakey()) - str = vformat("%s+", find_keycode_name(KEY_META)) + str; - if (k->get_shift()) - str = TTR("Shift+") + str; - if (k->get_alt()) - str = TTR("Alt+") + str; - if (k->get_control()) - str = TTR("Control+") + str; + const String str = keycode_get_string(k->get_scancode_with_modifiers()); press_a_key_label->set_text(str); press_a_key->accept_event(); |