diff options
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r-- | tools/editor/plugins/animation_player_editor_plugin.cpp | 38 | ||||
-rw-r--r-- | tools/editor/plugins/animation_player_editor_plugin.h | 4 | ||||
-rw-r--r-- | tools/editor/plugins/editor_preview_plugins.cpp | 10 | ||||
-rw-r--r-- | tools/editor/plugins/mesh_instance_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | tools/editor/plugins/path_2d_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | tools/editor/plugins/path_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | tools/editor/plugins/sample_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.h | 4 | ||||
-rw-r--r-- | tools/editor/plugins/shader_editor_plugin.cpp | 32 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.cpp | 83 | ||||
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.h | 3 | ||||
-rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.cpp | 92 |
14 files changed, 190 insertions, 138 deletions
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 4bbcb396af..10c7bf79a3 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -952,7 +952,7 @@ void AnimationPlayerEditor::_animation_duplicate() { } -void AnimationPlayerEditor::_seek_value_changed(float p_value) { +void AnimationPlayerEditor::_seek_value_changed(float p_value,bool p_set) { if (updating || !player || player->is_playing()) { return; @@ -980,7 +980,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { pos=anim->get_length(); } - if (player->is_valid()) { + if (player->is_valid() && !p_set) { float cpos = player->get_current_animation_pos(); player->seek_delta(pos,pos-cpos); @@ -988,6 +988,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { player->seek(pos,true); } + key_editor->set_anim_pos(pos); updating=true; @@ -1078,6 +1079,7 @@ void AnimationPlayerEditor::_editor_load(){ void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) { + frame->set_max(p_len); } @@ -1092,7 +1094,7 @@ void AnimationPlayerEditor::_animation_key_editor_anim_step_changed(float p_len) } -void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { +void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos,bool p_drag) { if (!is_visible()) return; @@ -1102,7 +1104,11 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { if (player->is_playing() ) return; - frame->set_val(p_pos); + updating=true; + frame->set_val(p_pos); + updating=false; + _seek_value_changed(p_pos,!p_drag); + EditorNode::get_singleton()->get_property_editor()->refresh(); @@ -1254,7 +1260,7 @@ void AnimationPlayerEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_animation_edit"),&AnimationPlayerEditor::_animation_edit); ObjectTypeDB::bind_method(_MD("_animation_resource_edit"),&AnimationPlayerEditor::_animation_resource_edit); ObjectTypeDB::bind_method(_MD("_dialog_action"),&AnimationPlayerEditor::_dialog_action); - ObjectTypeDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed); + ObjectTypeDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed,DEFVAL(true)); ObjectTypeDB::bind_method(_MD("_animation_player_changed"),&AnimationPlayerEditor::_animation_player_changed); ObjectTypeDB::bind_method(_MD("_blend_edited"),&AnimationPlayerEditor::_blend_edited); // ObjectTypeDB::bind_method(_MD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed); @@ -1350,19 +1356,23 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { add_anim = memnew( ToolButton ); + ED_SHORTCUT("animation_player_editor/add_animation", TTR("Create new animation in player.")); + add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/add_animation")); add_anim->set_tooltip(TTR("Create new animation in player.")); hb->add_child(add_anim); load_anim = memnew( ToolButton ); + ED_SHORTCUT("animation_player_editor/load_from_disk", TTR("Load animation from disk.")); + add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/load_from_disk")); load_anim->set_tooltip(TTR("Load an animation from disk.")); hb->add_child(load_anim); save_anim = memnew(MenuButton); save_anim->set_tooltip(TTR("Save the current animation")); - save_anim->get_popup()->add_item(TTR("Save"), ANIM_SAVE); - save_anim->get_popup()->add_item(TTR("Save As.."), ANIM_SAVE_AS); + save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save", TTR("Save")), ANIM_SAVE); + save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_as", TTR("Save As")), ANIM_SAVE_AS); save_anim->set_focus_mode(Control::FOCUS_NONE); hb->add_child(save_anim); @@ -1372,15 +1382,21 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { duplicate_anim = memnew( ToolButton ); hb->add_child(duplicate_anim); + ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate Animation")); + duplicate_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/duplicate_animation")); duplicate_anim->set_tooltip(TTR("Duplicate Animation")); rename_anim = memnew( ToolButton ); hb->add_child(rename_anim); + ED_SHORTCUT("animation_player_editor/rename_animation", TTR("Rename Animation")); + rename_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/rename_animation")); rename_anim->set_tooltip(TTR("Rename Animation")); remove_anim = memnew( ToolButton ); hb->add_child(remove_anim); + ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove Animation")); + remove_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/remove_animation")); remove_anim->set_tooltip(TTR("Remove Animation")); @@ -1402,8 +1418,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { tool_anim = memnew( MenuButton); //tool_anim->set_flat(false); tool_anim->set_tooltip(TTR("Animation Tools")); - tool_anim->get_popup()->add_item(TTR("Copy Animation"),TOOL_COPY_ANIM); - tool_anim->get_popup()->add_item(TTR("Paste Animation"),TOOL_PASTE_ANIM); + tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/copy_animation", TTR("Copy Animation")),TOOL_COPY_ANIM); + tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/paste_animation", TTR("Paste Animation")),TOOL_PASTE_ANIM); //tool_anim->get_popup()->add_separator(); //tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM); hb->add_child(tool_anim); @@ -1487,8 +1503,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { animation->connect("item_selected", this,"_animation_selected",Vector<Variant>(),true); resource_edit_anim->connect("pressed", this,"_animation_resource_edit"); file->connect("file_selected", this,"_dialog_action"); - frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); - scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true); + frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); + scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true); diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h index 3f3cda25b2..b0c930b66e 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.h +++ b/tools/editor/plugins/animation_player_editor_plugin.h @@ -145,7 +145,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _scale_changed(const String& p_scale); void _dialog_action(String p_file); void _seek_frame_changed(const String& p_frame); - void _seek_value_changed(float p_value); + void _seek_value_changed(float p_value, bool p_set=false); void _blend_editor_next_changed(const int p_idx); void _list_changed(); @@ -158,7 +158,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _animation_player_changed(Object *p_pl); - void _animation_key_editor_seek(float p_pos); + void _animation_key_editor_seek(float p_pos, bool p_drag); void _animation_key_editor_anim_len_changed(float p_new); void _animation_key_editor_anim_step_changed(float p_len); diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index f5470451ba..a057e6c2a1 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -669,7 +669,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -687,8 +687,8 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { float max[2]={-1e10,-1e10}; float min[2]={1e10,1e10}; int c=stereo?2:1; - int from = i*len/w; - int to = (i+1)*len/w; + int from = uint64_t(i)*len/w; + int to = (uint64_t(i)+1)*len/w; if (to>=len) to=len-1; @@ -699,7 +699,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int k=from;k<=to;k++) { - float v = src[k*c+j]/32768.0; + float v = src[uint64_t(k)*c+j]/32768.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -715,7 +715,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int k=from;k<=to;k++) { - float v = src[k*c+j]/128.0; + float v = src[uint64_t(k)*c+j]/128.0; if (v>max[j]) max[j]=v; if (v<min[j]) diff --git a/tools/editor/plugins/mesh_instance_editor_plugin.cpp b/tools/editor/plugins/mesh_instance_editor_plugin.cpp index f604e4c57c..c952feb1da 100644 --- a/tools/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_instance_editor_plugin.cpp @@ -183,6 +183,12 @@ void MeshInstanceEditor::_create_outline_mesh() { return; } + if (mesh->get_surface_count() == 0) { + err_dialog->set_text(TTR("Mesh has not surface to create outlines from!")); + err_dialog->popup_centered_minsize(); + return; + } + Ref<Mesh> mesho = mesh->create_outline(outline_size->get_val()); if (mesho.is_null()) { diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index 107ec30a91..95f330a1d5 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -633,35 +633,35 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { sep = memnew( VSeparator); base_hb->add_child(sep); curve_edit = memnew( ToolButton ); - curve_edit->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveEdit","EditorIcons")); + curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit","EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points")+"\n"+TTR("Shift+Drag: Select Control Points")+"\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Click: Add Point")+"\n"+TTR("Right Click: Delete Point")); curve_edit->connect("pressed",this,"_mode_selected",varray(MODE_EDIT)); base_hb->add_child(curve_edit); curve_edit_curve = memnew( ToolButton ); - curve_edit_curve->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveCurve","EditorIcons")); + curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCurve","EditorIcons")); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); curve_edit_curve->connect("pressed",this,"_mode_selected",varray(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); curve_create = memnew( ToolButton ); - curve_create->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveCreate","EditorIcons")); + curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate","EditorIcons")); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")+"\n"+TTR("Split Segment (in curve)")); curve_create->connect("pressed",this,"_mode_selected",varray(MODE_CREATE)); base_hb->add_child(curve_create); curve_del = memnew( ToolButton ); - curve_del->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveDelete","EditorIcons")); + curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete","EditorIcons")); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); curve_del->connect("pressed",this,"_mode_selected",varray(MODE_DELETE)); base_hb->add_child(curve_del); curve_close = memnew( ToolButton ); - curve_close->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveClose","EditorIcons")); + curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose","EditorIcons")); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); curve_close->connect("pressed",this,"_mode_selected",varray(ACTION_CLOSE)); diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index d7cc2bd157..33ef71efab 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -542,28 +542,28 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { sep->hide(); SpatialEditor::get_singleton()->add_control_to_menu_panel(sep); curve_edit = memnew( ToolButton ); - curve_edit->set_icon(SpatialEditor::get_singleton()->get_icon("CurveEdit","EditorIcons")); + curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit","EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->hide(); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points")+"\n"+TTR("Shift+Drag: Select Control Points")+"\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Click: Add Point")+"\n"+TTR("Right Click: Delete Point")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_edit); curve_create = memnew( ToolButton ); - curve_create->set_icon(SpatialEditor::get_singleton()->get_icon("CurveCreate","EditorIcons")); + curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate","EditorIcons")); curve_create->set_toggle_mode(true); curve_create->hide(); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")+"\n"+TTR("Split Segment (in curve)")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_create); curve_del = memnew( ToolButton ); - curve_del->set_icon(SpatialEditor::get_singleton()->get_icon("CurveDelete","EditorIcons")); + curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete","EditorIcons")); curve_del->set_toggle_mode(true); curve_del->hide(); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_del); curve_close = memnew( ToolButton ); - curve_close->set_icon(SpatialEditor::get_singleton()->get_icon("CurveClose","EditorIcons")); + curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose","EditorIcons")); curve_close->hide(); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index a3891a648b..b094184a29 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -211,7 +211,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -229,8 +229,8 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag float max[2]={-1e10,-1e10}; float min[2]={1e10,1e10}; int c=stereo?2:1; - int from = i*len/w; - int to = (i+1)*len/w; + int from = uint64_t(i)*len/w; + int to = (uint64_t(i)+1)*len/w; if (to>=len) to=len-1; @@ -241,7 +241,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int k=from;k<=to;k++) { - float v = src[k*c+j]/32768.0; + float v = src[uint64_t(k)*c+j]/32768.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -257,7 +257,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int k=from;k<=to;k++) { - float v = src[k*c+j]/128.0; + float v = src[uint64_t(k)*c+j]/128.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -270,7 +270,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag if (!stereo) { for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -297,7 +297,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; } - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[half] && v<max[half]) { imgofs[0]=255; imgofs[1]=150; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index a313b0053a..7de80e767b 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -531,7 +531,7 @@ static void _find_changed_scripts_for_external_editor(Node* p_base, Node*p_curre } -void ScriptEditor::_update_modified_scripts_for_external_editor() { +void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) { if (!bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))) return; @@ -547,6 +547,9 @@ void ScriptEditor::_update_modified_scripts_for_external_editor() { Ref<Script> script = E->get(); + if (p_for_script.is_valid() && p_for_script!=script) + continue; + if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) { continue; //internal script, who cares, though weird @@ -900,7 +903,7 @@ void ScriptEditor::_live_auto_reload_running_scripts() { } -bool ScriptEditor::_test_script_times_on_disk() { +bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) { disk_changed_list->clear(); @@ -920,6 +923,9 @@ bool ScriptEditor::_test_script_times_on_disk() { Ref<Script> script = ste->get_edited_script(); + if (p_for_script.is_valid() && p_for_script!=script) + continue; + if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) continue; //internal script, who cares @@ -2128,6 +2134,12 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { if (!restoring_layout) { EditorNode::get_singleton()->save_layout(); } + + //test for modification, maybe the script was not edited but was loaded + + _test_script_times_on_disk(p_script); + _update_modified_scripts_for_external_editor(p_script); + } void ScriptEditor::save_all_scripts() { @@ -2201,7 +2213,7 @@ void ScriptEditor::_editor_stop() { void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const StringArray& p_args) { - print_line("add callback! hohoho"); + //print_line("add callback! hohoho"); kinda sad to remove this ERR_FAIL_COND(!p_obj); Ref<Script> script = p_obj->get_script(); ERR_FAIL_COND( !script.is_valid() ); @@ -2243,7 +2255,6 @@ void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const void ScriptEditor::_editor_settings_changed() { - print_line("settings changed"); trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/trim_trailing_whitespace_on_save"); float autosave_time = EditorSettings::get_singleton()->get("text_editor/autosave_interval_secs"); if (autosave_time>0) { @@ -2284,7 +2295,6 @@ void ScriptEditor::_editor_settings_changed() { void ScriptEditor::_autosave_scripts() { - print_line("autosaving"); save_all_scripts(); } @@ -2625,7 +2635,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KEY_MASK_ALT|KEY_MASK_CMD|KEY_S), FILE_SAVE); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As..")), FILE_SAVE_AS); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_S), FILE_SAVE_ALL); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_MASK_ALT|KEY_S), FILE_SAVE_ALL); file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 3d723adfe9..0636190a41 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -232,7 +232,7 @@ class ScriptEditor : public VBoxContainer { void _resave_scripts(const String& p_str); void _reload_scripts(); - bool _test_script_times_on_disk(); + bool _test_script_times_on_disk(Ref<Script> p_for_script=Ref<Script>()); void _close_current_tab(); @@ -291,7 +291,7 @@ class ScriptEditor : public VBoxContainer { void _go_to_tab(int p_idx); void _update_history_pos(int p_new_pos); void _update_script_colors(); - void _update_modified_scripts_for_external_editor(); + void _update_modified_scripts_for_external_editor(Ref<Script> p_for_script=Ref<Script>()); int file_dialog_option; void _file_dialog_action(String p_file); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index f4b294daa5..83db650952 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -30,6 +30,7 @@ #include "tools/editor/editor_settings.h" #include "spatial_editor_plugin.h" +#include "scene/resources/shader_graph.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/keyboard.h" @@ -144,8 +145,6 @@ void ShaderTextEditor::_validate_script() { //List<StringName> params; //shader->get_param_list(¶ms); - print_line("compile: type: "+itos(type)+" code:\n"+code); - Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col); if (err!=OK) { @@ -557,34 +556,41 @@ ShaderEditor::ShaderEditor() { void ShaderEditorPlugin::edit(Object *p_object) { - if (!p_object->cast_to<Shader>()) + Shader* s = p_object->cast_to<Shader>(); + if (!s || s->cast_to<ShaderGraph>()) { + shader_editor->hide(); //Dont edit ShaderGraph return; + } - shader_editor->edit(p_object->cast_to<Shader>()); + if (_2d && s->get_mode()==Shader::MODE_CANVAS_ITEM) + shader_editor->edit(s); + else if (!_2d && s->get_mode()==Shader::MODE_MATERIAL) + shader_editor->edit(s); } bool ShaderEditorPlugin::handles(Object *p_object) const { + bool handles = true; Shader *shader=p_object->cast_to<Shader>(); - if (!shader) - return false; - if (_2d) - return shader->get_mode()==Shader::MODE_CANVAS_ITEM; - else + if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's + handles = false; + if (handles && _2d) + handles = shader->get_mode()==Shader::MODE_CANVAS_ITEM; + else if (handles && !_2d) return shader->get_mode()==Shader::MODE_MATERIAL; + + if (!handles) + shader_editor->hide(); + return handles; } void ShaderEditorPlugin::make_visible(bool p_visible) { if (p_visible) { shader_editor->show(); - //shader_editor->set_process(true); } else { - shader_editor->apply_shaders(); - //shader_editor->hide(); - //shader_editor->set_process(false); } } diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index fdb654571a..8d72178f23 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1580,7 +1580,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { nav_mode = NAVIGATION_PAN; } - } else if (EditorSettings::get_singleton()->get("3d_editor/trackpad_hint")) { + } else if (EditorSettings::get_singleton()->get("3d_editor/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case int mod = 0; if (m.mod.shift) diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 77097b11f6..5db331ba45 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -348,7 +348,7 @@ void ThemeEditor::_dialog_cbk() { names.clear(); Theme::get_default()->get_icon_list(fromtype,&names); for(List<StringName>::Element *E=names.front();E;E=E->next()) { - theme->set_icon(E->get(),fromtype,Theme::get_default()->get_icon(E->get(),fromtype)); + theme->set_icon(E->get(),fromtype,Ref<Texture>()); } @@ -357,7 +357,7 @@ void ThemeEditor::_dialog_cbk() { names.clear(); Theme::get_default()->get_stylebox_list(fromtype,&names); for(List<StringName>::Element *E=names.front();E;E=E->next()) { - theme->set_stylebox(E->get(),fromtype,Theme::get_default()->get_stylebox(E->get(),fromtype)); + theme->set_stylebox(E->get(),fromtype,Ref<StyleBox>()); } @@ -366,7 +366,7 @@ void ThemeEditor::_dialog_cbk() { names.clear(); Theme::get_default()->get_font_list(fromtype,&names); for(List<StringName>::Element *E=names.front();E;E=E->next()) { - theme->set_font(E->get(),fromtype,Theme::get_default()->get_font(E->get(),fromtype)); + theme->set_font(E->get(),fromtype,Ref<Font>()); } } @@ -537,7 +537,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title(TTR("Add Item")); add_del_dialog->get_ok()->set_text(TTR("Add")); - add_del_dialog->popup_centered(Size2(490,85)); + add_del_dialog->popup_centered(Size2(490,85)*EDSCALE); base_theme=Theme::get_default(); @@ -545,7 +545,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title(TTR("Add All Items")); add_del_dialog->get_ok()->set_text(TTR("Add All")); - add_del_dialog->popup_centered(Size2(240,85)); + add_del_dialog->popup_centered(Size2(240,85)*EDSCALE); base_theme=Theme::get_default(); @@ -559,7 +559,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title(TTR("Remove Item")); add_del_dialog->get_ok()->set_text(TTR("Remove")); - add_del_dialog->popup_centered(Size2(490,85)); + add_del_dialog->popup_centered(Size2(490,85)*EDSCALE); base_theme=theme; @@ -567,7 +567,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title("Remove All Items"); add_del_dialog->get_ok()->set_text("Remove All"); - add_del_dialog->popup_centered(Size2(240,85)); + add_del_dialog->popup_centered(Size2(240,85)*EDSCALE); base_theme=Theme::get_default(); @@ -583,12 +583,14 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { List<StringName> types; base_theme->get_type_list(&types); + type_menu->get_popup()->clear();; if (p_option==0 || p_option==1) {//add List<StringName> new_types; theme->get_type_list(&new_types); + //uh kind of sucks for(List<StringName>::Element *F=new_types.front();F;F=F->next()) { @@ -606,8 +608,8 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { } } - types.sort(); - + //types.sort(); + types.sort_custom<StringName::AlphCompare>(); for(List<StringName>::Element *E=types.front();E;E=E->next()) { type_menu->get_popup()->add_item( E->get() ); @@ -641,15 +643,23 @@ ThemeEditor::ThemeEditor() { time_left=0; + scroll = memnew( ScrollContainer ); + add_child(scroll); + scroll->set_area_as_parent_rect(3); + scroll->set_margin(MARGIN_TOP,30*EDSCALE); + //scroll->set_enable_h_scroll(true); + scroll->set_enable_v_scroll(true); + scroll->set_enable_h_scroll(false); + Panel * panel = memnew( Panel ); - add_child(panel); - panel->set_area_as_parent_rect(0); - panel->set_margin(MARGIN_TOP,25); + scroll->add_child(panel); + panel->set_custom_minimum_size(Size2(500,800)*EDSCALE); panel->set_theme(Theme::get_default()); + panel->set_h_size_flags(SIZE_EXPAND_FILL); main_vb= memnew( VBoxContainer ); panel->add_child(main_vb); - main_vb->set_area_as_parent_rect(4); + main_vb->set_area_as_parent_rect(4*EDSCALE); HBoxContainer *hb_menu = memnew(HBoxContainer); @@ -667,7 +677,8 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_item(TTR("Create Empty Template"),POPUP_CREATE_EMPTY); theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"),POPUP_CREATE_EDITOR_EMPTY); - hb_menu->add_child(theme_menu); + add_child(theme_menu); + theme_menu->set_pos(Vector2(3,3)*EDSCALE); theme_menu->get_popup()->connect("item_pressed", this,"_theme_menu_cbk"); @@ -742,26 +753,26 @@ ThemeEditor::ThemeEditor() { pb->set_val(50); first_vb->add_child( pb); Panel *pn=memnew( Panel ); - pn->set_custom_minimum_size(Size2(40,40)); + pn->set_custom_minimum_size(Size2(40,40)*EDSCALE); first_vb->add_child( pn); - first_vb->add_constant_override("separation",10); + first_vb->add_constant_override("separation",10*EDSCALE); VBoxContainer *second_vb = memnew( VBoxContainer ); second_vb->set_h_size_flags(SIZE_EXPAND_FILL); main_hb->add_child(second_vb); - second_vb->add_constant_override("separation",10); + second_vb->add_constant_override("separation",10*EDSCALE); LineEdit *le = memnew( LineEdit ); le->set_text("LineEdit"); second_vb->add_child(le); TextEdit *te = memnew( TextEdit ); te->set_text("TextEdit"); //te->set_v_size_flags(SIZE_EXPAND_FILL); - te->set_custom_minimum_size(Size2(0,160)); + te->set_custom_minimum_size(Size2(0,160)*EDSCALE); second_vb->add_child(te); Tree *test_tree = memnew(Tree); second_vb->add_child(test_tree); - test_tree->set_custom_minimum_size(Size2(0,160)); + test_tree->set_custom_minimum_size(Size2(0,160)*EDSCALE); TreeItem *item = test_tree->create_item(); @@ -789,7 +800,7 @@ ThemeEditor::ThemeEditor() { main_hb->add_child(third_vb); HBoxContainer *vhb = memnew( HBoxContainer ); - vhb->set_custom_minimum_size(Size2(0,160)); + vhb->set_custom_minimum_size(Size2(0,160)*EDSCALE); vhb->add_child(memnew(VSeparator)); vhb->add_child(memnew(VSlider)); vhb->add_child(memnew(VScrollBar)); @@ -797,7 +808,7 @@ ThemeEditor::ThemeEditor() { TabContainer *tc = memnew( TabContainer ); third_vb->add_child(tc); - tc->set_custom_minimum_size(Size2(0,160)); + tc->set_custom_minimum_size(Size2(0,160)*EDSCALE); Control *tcc = memnew( Control ); tcc->set_name(TTR("Tab 1")); tc->add_child(tcc); @@ -808,7 +819,7 @@ ThemeEditor::ThemeEditor() { tcc->set_name(TTR("Tab 3")); tc->add_child(tcc); - main_hb->add_constant_override("separation",20); + main_hb->add_constant_override("separation",20*EDSCALE); @@ -871,37 +882,37 @@ ThemeEditor::ThemeEditor() { Label *l = memnew( Label ); - l->set_pos( Point2(5,5) ); + l->set_pos( Point2(5,5)*EDSCALE ); l->set_text(TTR("Type:")); add_del_dialog->add_child(l); dtype_select_label=l; type_edit = memnew( LineEdit ); - type_edit->set_pos(Point2(5,25)); - type_edit->set_size(Point2(150,5)); + type_edit->set_pos(Point2(5,25)*EDSCALE); + type_edit->set_size(Point2(150,5)*EDSCALE); add_del_dialog->add_child(type_edit); type_menu = memnew( MenuButton ); - type_menu->set_pos(Point2(160,25)); - type_menu->set_size(Point2(30,5)); + type_menu->set_pos(Point2(160,25)*EDSCALE); + type_menu->set_size(Point2(30,5)*EDSCALE); type_menu->set_text(".."); add_del_dialog->add_child(type_menu); type_menu->get_popup()->connect("item_pressed", this,"_type_menu_cbk"); l = memnew( Label ); - l->set_pos( Point2(200,5) ); + l->set_pos( Point2(200,5)*EDSCALE ); l->set_text(TTR("Name:")); add_del_dialog->add_child(l); name_select_label=l; name_edit = memnew( LineEdit ); - name_edit->set_pos(Point2(200,25)); - name_edit->set_size(Point2(150,5)); + name_edit->set_pos(Point2(200,25)*EDSCALE); + name_edit->set_size(Point2(150,5)*EDSCALE); add_del_dialog->add_child(name_edit); name_menu = memnew( MenuButton ); - name_menu->set_pos(Point2(360,25)); - name_menu->set_size(Point2(30,5)); + name_menu->set_pos(Point2(360,25)*EDSCALE); + name_menu->set_size(Point2(30,5)*EDSCALE); name_menu->set_text(".."); add_del_dialog->add_child(name_menu); @@ -910,7 +921,7 @@ ThemeEditor::ThemeEditor() { name_menu->get_popup()->connect("item_pressed", this,"_name_menu_cbk"); type_select_label= memnew( Label ); - type_select_label->set_pos( Point2(400,5) ); + type_select_label->set_pos( Point2(400,5)*EDSCALE ); type_select_label->set_text(TTR("Data Type:")); add_del_dialog->add_child(type_select_label); @@ -920,8 +931,8 @@ ThemeEditor::ThemeEditor() { type_select->add_item(TTR("Font")); type_select->add_item(TTR("Color")); type_select->add_item(TTR("Constant")); - type_select->set_pos( Point2( 400,25 ) ); - type_select->set_size( Point2( 80,5 ) ); + type_select->set_pos( Point2( 400,25 )*EDSCALE ); + type_select->set_size( Point2( 80,5 )*EDSCALE ); add_del_dialog->add_child(type_select); @@ -974,7 +985,7 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) { editor=p_node; theme_editor = memnew( ThemeEditor ); - theme_editor->set_custom_minimum_size(Size2(0,500)); + theme_editor->set_custom_minimum_size(Size2(0,200)); // p_node->get_viewport()->add_child(theme_editor); button=editor->add_bottom_panel_item("Theme",theme_editor); diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 1384fa6b69..ea8f8c1d3c 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -35,16 +35,19 @@ #include "scene/gui/file_dialog.h" #include "scene/gui/check_box.h" #include "scene/gui/button_group.h" +#include "scene/gui/scroll_container.h" #include "tools/editor/editor_node.h" + class ThemeEditor : public Control { OBJ_TYPE( ThemeEditor, Control ); + ScrollContainer *scroll; VBoxContainer *main_vb; Ref<Theme> theme; diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 5a40777665..d5f85d3333 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -893,59 +893,53 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { if (tool!=TOOL_NONE || !mouse_over) return false; - if (k.scancode==KEY_DELETE) { - + if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) { _menu_option(OPTION_ERASE_SELECTION); return true; } + if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) { + tool=TOOL_SELECTING; + selection_active=false; - if (k.mod.command) { - - if (k.scancode==KEY_F) { - - search_box->select_all(); - search_box->grab_focus(); + canvas_item_editor->update(); - return true; - } - if (k.scancode==KEY_B) { + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) { + _update_copydata(); - tool=TOOL_SELECTING; - selection_active=false; + if (selection_active) { + tool=TOOL_DUPLICATING; canvas_item_editor->update(); return true; } - if (k.scancode==KEY_D) { - - _update_copydata(); - - if (selection_active) { - tool=TOOL_DUPLICATING; - - canvas_item_editor->update(); - - return true; - } - } - } else { - - if (k.scancode==KEY_A) { - - flip_h=!flip_h; - mirror_x->set_pressed(flip_h); - canvas_item_editor->update(); - return true; - } - if (k.scancode==KEY_S) { + } + if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) { + search_box->select_all(); + search_box->grab_focus(); - flip_v=!flip_v; - mirror_y->set_pressed(flip_v); - canvas_item_editor->update(); - return true; - } + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) { + flip_h=!flip_h; + mirror_x->set_pressed(flip_h); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) { + flip_v=!flip_v; + mirror_y->set_pressed(flip_v); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) { + transpose = !transpose; + transp->set_pressed(transpose); + canvas_item_editor->update(); + return true; } } break; } @@ -1308,6 +1302,12 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { flip_v=false; transpose=false; + ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase selection"), KEY_DELETE); + ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find tile"), KEY_MASK_CMD+KEY_F); + ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose")); + ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A); + ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S); + search_box = memnew( LineEdit ); search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_box->connect("text_entered", this, "_text_entered"); @@ -1349,9 +1349,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_separator(); p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL); p->add_separator(); - p->add_item(TTR("Select"), OPTION_SELECT, KEY_MASK_CMD+KEY_B); - p->add_item(TTR("Duplicate Selection"), OPTION_DUPLICATE, KEY_MASK_CMD+KEY_D); - p->add_item(TTR("Erase Selection"), OPTION_ERASE_SELECTION, KEY_DELETE); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD+KEY_B), OPTION_SELECT); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD+KEY_D), OPTION_DUPLICATE); + p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION); p->connect("item_pressed", this, "_menu_option"); @@ -1361,19 +1361,19 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { transp = memnew( ToolButton ); transp->set_toggle_mode(true); - transp->set_tooltip(TTR("Transpose")); + transp->set_tooltip(TTR("Transpose") + " ("+ED_GET_SHORTCUT("tile_map_editor/transpose")->get_as_text()+")"); transp->set_focus_mode(FOCUS_NONE); transp->connect("pressed", this, "_update_transform_buttons", make_binds(transp)); toolbar->add_child(transp); mirror_x = memnew( ToolButton ); mirror_x->set_toggle_mode(true); - mirror_x->set_tooltip(TTR("Mirror X (A)")); + mirror_x->set_tooltip(TTR("Mirror X") + " ("+ED_GET_SHORTCUT("tile_map_editor/mirror_x")->get_as_text()+")"); mirror_x->set_focus_mode(FOCUS_NONE); mirror_x->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_x)); toolbar->add_child(mirror_x); mirror_y = memnew( ToolButton ); mirror_y->set_toggle_mode(true); - mirror_y->set_tooltip(TTR("Mirror Y (S)")); + mirror_y->set_tooltip(TTR("Mirror Y") + " ("+ED_GET_SHORTCUT("tile_map_editor/mirror_y")->get_as_text()+")"); mirror_y->set_focus_mode(FOCUS_NONE); mirror_y->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_y)); toolbar->add_child(mirror_y); |