diff options
Diffstat (limited to 'tools/editor')
87 files changed, 4002 insertions, 1915 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 7582162b72..aa0156b0c0 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -85,7 +85,6 @@ private: int points = 48; if (mode==MODE_MULTIPLE) { - int max_draw = 16; Color mcolor=color; mcolor.a*=0.3; @@ -694,11 +693,103 @@ void AnimationKeyEditor::_menu_add_track(int p_type) { } } +void AnimationKeyEditor::_anim_duplicate_keys(bool transpose) { + //duplicait! + if (selection.size() && animation.is_valid() && selected_track>=0 && selected_track<animation->get_track_count()) { + + int top_track=0x7FFFFFFF; + float top_time = 1e10; + for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { + + const SelectedKey &sk = E->key(); + + float t = animation->track_get_key_time(sk.track,sk.key); + if (t<top_time) + top_time=t; + if (sk.track<top_track) + top_track=sk.track; + + } + ERR_FAIL_COND( top_track == 0x7FFFFFFF || top_time==1e10 ); + + // + + int start_track = transpose ? selected_track : top_track; + + undo_redo->create_action(TTR("Anim Duplicate Keys")); + + List<Pair<int,float> > new_selection_values; + + for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { + + const SelectedKey &sk = E->key(); + + float t = animation->track_get_key_time(sk.track,sk.key); + + float dst_time = t+(timeline_pos - top_time); + int dst_track = sk.track + (start_track - top_track); + + if (dst_track < 0 || dst_track>= animation->get_track_count()) + continue; + + if (animation->track_get_type(dst_track) != animation->track_get_type(sk.track)) + continue; + + int existing_idx = animation->track_find_key(dst_track,dst_time,true); + + undo_redo->add_do_method(animation.ptr(),"track_insert_key",dst_track,dst_time,animation->track_get_key_value(E->key().track,E->key().key),animation->track_get_key_transition(E->key().track,E->key().key)); + undo_redo->add_undo_method(animation.ptr(),"track_remove_key_at_pos",dst_track,dst_time); + + Pair<int,float> p; + p.first=dst_track; + p.second=dst_time; + new_selection_values.push_back( p ); + + if (existing_idx!=-1) { + + undo_redo->add_undo_method(animation.ptr(),"track_insert_key",dst_track,dst_time,animation->track_get_key_value(dst_track,existing_idx),animation->track_get_key_transition(dst_track,existing_idx)); + + } + + } + + undo_redo->commit_action(); + + //reselect duplicated + + Map<SelectedKey,KeyInfo> new_selection; + for (List<Pair<int,float> >::Element *E=new_selection_values.front();E;E=E->next()) { + + int track=E->get().first; + float time = E->get().second; + + int existing_idx = animation->track_find_key(track,time,true); + + if (existing_idx==-1) + continue; + SelectedKey sk2; + sk2.track=track; + sk2.key=existing_idx; + + KeyInfo ki; + ki.pos=time; + + new_selection[sk2]=ki; + + } + + + selection=new_selection; + track_editor->update(); + _edit_if_single_selection(); + + } +} + void AnimationKeyEditor::_menu_track(int p_type) { ERR_FAIL_COND(!animation.is_valid()); - last_menu_track_opt=p_type; switch(p_type) { @@ -766,108 +857,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { case TRACK_MENU_DUPLICATE: case TRACK_MENU_DUPLICATE_TRANSPOSE: { - - //duplicait! - if (selection.size() && animation.is_valid() && selected_track>=0 && selected_track<animation->get_track_count()) { - - - int top_track=0x7FFFFFFF; - float top_time = 1e10; - for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { - - const SelectedKey &sk = E->key(); - - float t = animation->track_get_key_time(sk.track,sk.key); - if (t<top_time) - top_time=t; - if (sk.track<top_track) - top_track=sk.track; - - - } - ERR_FAIL_COND( top_track == 0x7FFFFFFF || top_time==1e10 ); - - // - - int start_track = p_type==TRACK_MENU_DUPLICATE_TRANSPOSE ? selected_track : top_track; - - - undo_redo->create_action(TTR("Anim Duplicate Keys")); - - List<Pair<int,float> > new_selection_values; - - for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { - - const SelectedKey &sk = E->key(); - - float t = animation->track_get_key_time(sk.track,sk.key); - - float dst_time = t+(timeline_pos - top_time); - int dst_track = sk.track + (start_track - top_track); - - if (dst_track < 0 || dst_track>= animation->get_track_count()) - continue; - - if (animation->track_get_type(dst_track) != animation->track_get_type(sk.track)) - continue; - - int existing_idx = animation->track_find_key(dst_track,dst_time,true); - - undo_redo->add_do_method(animation.ptr(),"track_insert_key",dst_track,dst_time,animation->track_get_key_value(E->key().track,E->key().key),animation->track_get_key_transition(E->key().track,E->key().key)); - undo_redo->add_undo_method(animation.ptr(),"track_remove_key_at_pos",dst_track,dst_time); - - Pair<int,float> p; - p.first=dst_track; - p.second=dst_time; - new_selection_values.push_back( p ); - - if (existing_idx!=-1) { - - undo_redo->add_undo_method(animation.ptr(),"track_insert_key",dst_track,dst_time,animation->track_get_key_value(dst_track,existing_idx),animation->track_get_key_transition(dst_track,existing_idx)); - - } - - - - } - - undo_redo->commit_action(); - - //reselect duplicated - - Map<SelectedKey,KeyInfo> new_selection; - for (List<Pair<int,float> >::Element *E=new_selection_values.front();E;E=E->next()) { - - - int track=E->get().first; - float time = E->get().second; - - int existing_idx = animation->track_find_key(track,time,true); - - if (existing_idx==-1) - continue; - SelectedKey sk2; - sk2.track=track; - sk2.key=existing_idx; - - KeyInfo ki; - ki.pos=time; - - - new_selection[sk2]=ki; - - - } - - - selection=new_selection; - track_editor->update(); - _edit_if_single_selection(); - - - } - - + _anim_duplicate_keys(p_type==TRACK_MENU_DUPLICATE_TRANSPOSE); } break; case TRACK_MENU_SET_ALL_TRANS_LINEAR: case TRACK_MENU_SET_ALL_TRANS_CONSTANT: @@ -1356,7 +1346,6 @@ void AnimationKeyEditor::_track_editor_draw() { } } - Color sep_color=color; color.a*=0.5; for(int i=0;i<fit;i++) { @@ -1620,9 +1609,7 @@ void AnimationKeyEditor::_track_menu_selected(int p_idx) { undo_redo->add_do_method(animation.ptr(),"track_set_interpolation_type",interp_editing,p_idx); undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_type",interp_editing,animation->track_get_interpolation_type(interp_editing)); undo_redo->commit_action(); - } - - if (cont_editing!=-1) { + } else if (cont_editing!=-1) { ERR_FAIL_INDEX(cont_editing,animation->get_track_count()); @@ -1630,6 +1617,16 @@ void AnimationKeyEditor::_track_menu_selected(int p_idx) { undo_redo->add_do_method(animation.ptr(),"value_track_set_update_mode",cont_editing,p_idx); undo_redo->add_undo_method(animation.ptr(),"value_track_set_update_mode",cont_editing,animation->value_track_get_update_mode(cont_editing)); undo_redo->commit_action(); + } else { + switch (p_idx) { + + case RIGHT_MENU_DUPLICATE: + _anim_duplicate_keys(); break; + case RIGHT_MENU_DUPLICATE_TRANSPOSE: + _anim_duplicate_keys(true); break; + case RIGHT_MENU_REMOVE: + _anim_delete_keys(); break; + } } } @@ -1791,6 +1788,25 @@ bool AnimationKeyEditor::_edit_if_single_selection() { } +void AnimationKeyEditor::_anim_delete_keys() { + if (selection.size()) { + undo_redo->create_action(TTR("Anim Delete Keys")); + + for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { + + undo_redo->add_do_method(animation.ptr(),"track_remove_key",E->key().track,E->key().key); + undo_redo->add_undo_method(animation.ptr(),"track_insert_key",E->key().track,E->get().pos,animation->track_get_key_value(E->key().track,E->key().key),animation->track_get_key_transition(E->key().track,E->key().key)); + + } + undo_redo->add_do_method(this,"_clear_selection_for_anim",animation); + undo_redo->add_undo_method(this,"_clear_selection_for_anim",animation); + undo_redo->commit_action(); + //selection.clear(); + accept_event(); + _edit_if_single_selection(); + } +} + void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { Control *te=track_editor; @@ -1806,8 +1822,6 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { Ref<Font> font = te->get_font("font","Tree"); int sep = get_constant("vseparation","Tree"); int hsep = get_constant("hseparation","Tree"); - Color color = get_color("font_color","Tree"); - Color sepcolor = get_color("guide_color","Tree"); Ref<Texture> remove_icon = get_icon("Remove","EditorIcons"); Ref<Texture> move_up_icon = get_icon("MoveUp","EditorIcons"); Ref<Texture> move_down_icon = get_icon("MoveDown","EditorIcons"); @@ -1863,22 +1877,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { } else if (p_input.key.scancode==KEY_DELETE && p_input.key.pressed && click.click==ClickOver::CLICK_NONE) { - if (selection.size()) { - undo_redo->create_action(TTR("Anim Delete Keys")); - - for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) { - - undo_redo->add_do_method(animation.ptr(),"track_remove_key",E->key().track,E->key().key); - undo_redo->add_undo_method(animation.ptr(),"track_insert_key",E->key().track,E->get().pos,animation->track_get_key_value(E->key().track,E->key().key),animation->track_get_key_transition(E->key().track,E->key().key)); - - } - undo_redo->add_do_method(this,"_clear_selection_for_anim",animation); - undo_redo->add_undo_method(this,"_clear_selection_for_anim",animation); - undo_redo->commit_action(); - //selection.clear(); - accept_event(); - _edit_if_single_selection(); - } + _anim_delete_keys(); } else if (animation.is_valid() && animation->get_track_count()>0) { if (p_input.is_pressed() && (p_input.is_action("ui_up") || p_input.is_action("ui_page_up"))) { @@ -1938,6 +1937,116 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 ); } + if (mb.button_index==BUTTON_RIGHT && mb.pressed) { + + Point2 mpos = Point2(mb.x,mb.y)-ofs; + + if (selection.size() == 0) { + // Auto-select on right-click if nothing is selected + // Note: This code is pretty much duplicated from the left click code, + // both codes could be moved into a function to avoid the duplicated code. + Point2 mpos = Point2(mb.x,mb.y)-ofs; + + if (mpos.y < h ) { + return; + } + + mpos.y -= h; + + int idx = mpos.y / h; + idx+=v_scroll->get_val(); + if (idx <0 || idx>=animation->get_track_count()) + break; + + if (mpos.x < name_limit) { + } else if (mpos.x < settings_limit) { + float pos = mpos.x - name_limit; + pos/=_get_zoom_scale(); + pos+=h_scroll->get_val(); + float w_time = (type_icon[0]->get_width() / _get_zoom_scale())/2.0; + + int kidx = animation->track_find_key(idx,pos); + int kidx_n = kidx+1; + int key=-1; + + if (kidx>=0 && kidx<animation->track_get_key_count(idx)) { + + float kpos = animation->track_get_key_time(idx,kidx); + if (ABS(pos-kpos)<=w_time) { + + key=kidx; + } + } + + if (key==-1 && kidx_n>=0 && kidx_n<animation->track_get_key_count(idx)) { + + float kpos = animation->track_get_key_time(idx,kidx_n); + if (ABS(pos-kpos)<=w_time) { + + key=kidx_n; + } + } + + if (key==-1) { + + click.click=ClickOver::CLICK_SELECT_KEYS; + click.at=Point2(mb.x,mb.y); + click.to=click.at; + click.shift=mb.mod.shift; + selected_track=idx; + track_editor->update(); + //drag select region + return; + + } + + + + SelectedKey sk; + sk.track=idx; + sk.key=key; + KeyInfo ki; + ki.pos= animation->track_get_key_time(idx,key); + click.shift=mb.mod.shift; + click.selk=sk; + + + if (!mb.mod.shift && !selection.has(sk)) + _clear_selection(); + + selection.insert(sk,ki); + + click.click=ClickOver::CLICK_MOVE_KEYS; + click.at=Point2(mb.x,mb.y); + click.to=click.at; + update(); + selected_track=idx; + track_editor->update(); + + if (_edit_if_single_selection() && mb.mod.command) { + edit_button->set_pressed(true); + key_editor_tab->show(); + } + } + } + + if (selection.size()) { + // User has right clicked and we have a selection, show a popup menu with options + track_menu->clear(); + track_menu->set_size(Point2(1,1)); + track_menu->add_item(TTR("Duplicate Selection"), RIGHT_MENU_DUPLICATE); + track_menu->add_item(TTR("Duplicate Transposed"), RIGHT_MENU_DUPLICATE_TRANSPOSE); + track_menu->add_item(TTR("Remove Selection"), RIGHT_MENU_REMOVE); + + track_menu->set_pos(te->get_global_pos()+mpos); + + interp_editing=-1; + cont_editing=-1; + + track_menu->popup(); + } + } + if (mb.button_index==BUTTON_LEFT && !(mb.button_mask&~BUTTON_MASK_LEFT)) { @@ -3007,7 +3116,6 @@ void AnimationKeyEditor::_update_menu() { updating=true; - bool empty= !animation.is_valid(); if (animation.is_valid()) { length->set_val(animation->get_length()); @@ -3967,12 +4075,22 @@ AnimationKeyEditor::AnimationKeyEditor() { track_editor->set_h_size_flags(SIZE_EXPAND_FILL); + track_pos = memnew( Control ); track_pos->set_area_as_parent_rect(); track_pos->set_ignore_mouse(true); track_editor->add_child(track_pos); track_pos->connect("draw",this,"_track_pos_draw"); + select_anim_warning = memnew( Label ); + track_editor->add_child(select_anim_warning); + select_anim_warning->set_area_as_parent_rect(); + select_anim_warning->set_text(TTR("Select an AnimationPlayer from the Scene Tree to edit animations.")); + select_anim_warning->set_autowrap(true); + select_anim_warning->set_align(Label::ALIGN_CENTER); + select_anim_warning->set_valign(Label::VALIGN_CENTER); + + v_scroll = memnew( VScrollBar ); hb->add_child(v_scroll); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 413c73b4b9..3078b3288b 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -99,6 +99,12 @@ class AnimationKeyEditor : public VBoxContainer { CURVE_SET_CONSTANT }; + enum { + RIGHT_MENU_DUPLICATE, + RIGHT_MENU_DUPLICATE_TRANSPOSE, + RIGHT_MENU_REMOVE + }; + struct MouseOver { enum Over { @@ -262,6 +268,7 @@ class AnimationKeyEditor : public VBoxContainer { EditorSelection *editor_selection; + Label *select_anim_warning; float _get_zoom_scale() const; @@ -313,6 +320,9 @@ class AnimationKeyEditor : public VBoxContainer { void _add_call_track(const NodePath& p_base); + void _anim_duplicate_keys(bool transpose = false); + void _anim_delete_keys(); + void _root_removed(); protected: @@ -334,6 +344,7 @@ public: void insert_value_key(const String& p_property, const Variant& p_value, bool p_advance); void insert_transform_key(Spatial *p_node,const String& p_sub,const Transform& p_xform); + void show_select_node_warning(bool p_show) { select_anim_warning->set_hidden(!p_show); } AnimationKeyEditor(); ~AnimationKeyEditor(); }; diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index a2448921d7..4f685badfb 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -444,6 +444,13 @@ void EditorAssetLibraryItemDownload::_close() { void EditorAssetLibraryItemDownload::_install() { String file = download->get_download_file(); + + if (external_install) { + emit_signal("install_asset",file,title->get_text()); + return; + } + + asset_installer->open(file,1); } @@ -465,6 +472,8 @@ void EditorAssetLibraryItemDownload::_bind_methods() { ObjectTypeDB::bind_method("_close",&EditorAssetLibraryItemDownload::_close); ObjectTypeDB::bind_method("_make_request",&EditorAssetLibraryItemDownload::_make_request); + ADD_SIGNAL(MethodInfo("install_asset",PropertyInfo(Variant::STRING,"zip_path"),PropertyInfo(Variant::STRING,"name"))); + } EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { @@ -530,6 +539,8 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { prev_status=-1; + external_install=false; + } @@ -600,7 +611,8 @@ void EditorAssetLibrary::_install_asset() { EditorAssetLibraryItemDownload *d = downloads_hb->get_child(i)->cast_to<EditorAssetLibraryItemDownload>(); if (d && d->get_asset_id() == description->get_asset_id()) { - EditorNode::get_singleton()->show_warning("Download for this asset is already in progress!"); + if (EditorNode::get_singleton() != NULL) + EditorNode::get_singleton()->show_warning("Download for this asset is already in progress!"); return; } } @@ -610,6 +622,11 @@ void EditorAssetLibrary::_install_asset() { downloads_hb->add_child(download); download->configure(description->get_title(),description->get_asset_id(),description->get_preview_icon(),description->get_download_url(),description->get_sha256()); + if (templates_only) { + download->set_external_install(true); + download->connect("install_asset",this,"_install_external_asset"); + } + } const char* EditorAssetLibrary::sort_key[SORT_MAX]={ @@ -1258,6 +1275,11 @@ void EditorAssetLibrary::_manage_plugins() { +void EditorAssetLibrary::_install_external_asset(String p_zip_path,String p_title) { + + emit_signal("install_asset",p_zip_path,p_title); +} + void EditorAssetLibrary::_bind_methods() { ObjectTypeDB::bind_method("_http_request_completed",&EditorAssetLibrary::_http_request_completed); @@ -1273,6 +1295,11 @@ void EditorAssetLibrary::_bind_methods() { ObjectTypeDB::bind_method("_repository_changed",&EditorAssetLibrary::_repository_changed); ObjectTypeDB::bind_method("_support_toggled",&EditorAssetLibrary::_support_toggled); ObjectTypeDB::bind_method("_rerun_search",&EditorAssetLibrary::_rerun_search); + ObjectTypeDB::bind_method("_install_external_asset",&EditorAssetLibrary::_install_external_asset); + + + + ADD_SIGNAL(MethodInfo("install_asset",PropertyInfo(Variant::STRING,"zip_path"),PropertyInfo(Variant::STRING,"name"))); } @@ -1366,7 +1393,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { repository = memnew( OptionButton ); repository->add_item("Godot"); - repository->set_item_metadata(0, "http://godotengine.org/asset-library/api"); + repository->set_item_metadata(0, "https://godotengine.org/asset-library/api"); repository->add_item("Localhost"); // TODO: Maybe remove? repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api"); repository->connect("item_selected",this,"_repository_changed"); diff --git a/tools/editor/asset_library_editor_plugin.h b/tools/editor/asset_library_editor_plugin.h index 89663aa00b..fe40255af9 100644 --- a/tools/editor/asset_library_editor_plugin.h +++ b/tools/editor/asset_library_editor_plugin.h @@ -155,6 +155,8 @@ class EditorAssetLibraryItemDownload : public PanelContainer { int asset_id; + bool external_install; + EditorAssetInstaller *asset_installer; void _close(); @@ -168,6 +170,7 @@ protected: static void _bind_methods(); public: + void set_external_install(bool p_enable) { external_install=p_enable; } int get_asset_id() { return asset_id; } void configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url, const String& p_sha256_hash); EditorAssetLibraryItemDownload(); @@ -301,6 +304,8 @@ class EditorAssetLibrary : public PanelContainer { void _repository_changed(int p_repository_id); void _support_toggled(int p_support); + void _install_external_asset(String p_zip_path,String p_title); + friend class EditorAssetLibraryItemDescription; friend class EditorAssetLibraryItem; protected: diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 644478923c..6c8d25aa01 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -32,6 +32,7 @@ #include "scene/gui/separator.h" #include "scene/resources/dynamic_font.h" #include "os/keyboard.h" +#include "tools/editor/editor_scale.h" void GotoLineDialog::popup_find_line(TextEdit *p_edit) { @@ -132,8 +133,9 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) if (found) { if (!preserve_cursor) { - text_edit->cursor_set_line(line); - text_edit->cursor_set_column(col+text.length()); + text_edit->cursor_set_line(line, false); + text_edit->cursor_set_column(col+text.length(), false); + text_edit->center_viewport_to_cursor(); } text_edit->set_search_text(text); @@ -984,36 +986,47 @@ void CodeTextEditor::_text_editor_input_event(const InputEvent& p_event) { if (mb.pressed && mb.mod.command) { if (mb.button_index==BUTTON_WHEEL_UP) { - - font_resize_val+=1; - - if (font_resize_timer->get_time_left()==0) - font_resize_timer->start(); - + _zoom_in(); } else if (mb.button_index==BUTTON_WHEEL_DOWN) { - - font_resize_val-=1; - - if (font_resize_timer->get_time_left()==0) - font_resize_timer->start(); + _zoom_out(); } } } else if (p_event.type==InputEvent::KEY) { - const InputEventKey& k=p_event.key; + if (p_event.key.pressed) { + if (ED_IS_SHORTCUT("script_editor/zoom_in", p_event)) { + _zoom_in(); + } + if (ED_IS_SHORTCUT("script_editor/zoom_out", p_event)) { + _zoom_out(); + } + if (ED_IS_SHORTCUT("script_editor/reset_zoom", p_event)) { + _reset_zoom(); + } + } + } +} + +void CodeTextEditor::_zoom_in() { + font_resize_val+=1; + + if (font_resize_timer->get_time_left()==0) + font_resize_timer->start(); +} - if (k.pressed && k.mod.command) { +void CodeTextEditor::_zoom_out() { + font_resize_val-=1; - if (k.scancode==KEY_0) { // reset source font size to default + if (font_resize_timer->get_time_left()==0) + font_resize_timer->start(); +} - Ref<DynamicFont> font = text_editor->get_font("font"); +void CodeTextEditor::_reset_zoom() { + Ref<DynamicFont> font = text_editor->get_font("font"); // reset source font size to default - if (font.is_valid()) { - EditorSettings::get_singleton()->set("global/source_font_size",14); - font->set_size(14); - } - } - } + if (font.is_valid()) { + EditorSettings::get_singleton()->set("global/source_font_size",14); + font->set_size(14); } } @@ -1149,6 +1162,10 @@ void CodeTextEditor::_bind_methods() { CodeTextEditor::CodeTextEditor() { + ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD|KEY_EQUAL); + ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD|KEY_MINUS); + ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KEY_MASK_CMD|KEY_0); + find_replace_bar = memnew( FindReplaceBar ); add_child(find_replace_bar); find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1198,6 +1215,10 @@ CodeTextEditor::CodeTextEditor() { line_col = memnew( Label ); status_bar->add_child(line_col); line_col->set_valign(Label::VALIGN_CENTER); + line_col->set_autowrap(true); + line_col->set_v_size_flags(SIZE_FILL); + line_col->set_custom_minimum_size(Size2(100,1)*EDSCALE); + status_bar->add_child( memnew( Label ) ); //to keep the height if the other labels are not visible text_editor->connect("input_event", this,"_text_editor_input_event"); diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index bdfd295ded..7983c46f7a 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -214,6 +214,9 @@ class CodeTextEditor : public VBoxContainer { void _font_resize_timeout(); void _text_editor_input_event(const InputEvent& p_event); + void _zoom_in(); + void _zoom_out(); + void _reset_zoom(); protected: diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index faaae4360b..bdc420c70f 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -309,6 +309,7 @@ ConnectDialog::ConnectDialog() { tree = memnew(SceneTreeEditor(false)); + tree->get_scene_tree()->connect("item_activated",this,"_ok"); vbc_left->add_margin_child(TTR("Connect To Node:"),tree,true); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 5275e1beeb..3ab2e35242 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -42,12 +42,13 @@ void CreateDialog::popup(bool p_dontclear) { - popup_centered_ratio(0.6); + popup_centered_ratio(); if (p_dontclear) search_box->select_all(); else search_box->clear(); search_box->grab_focus(); + _update_search(); @@ -153,6 +154,9 @@ void CreateDialog::_update_search() { TreeItem *root = search_options->create_item(); root->set_text(0,base_type); + if (has_icon(base_type,"EditorIcons")) { + root->set_icon(0,get_icon(base_type,"EditorIcons")); + } List<StringName>::Element *I=type_list.front(); TreeItem *to_select=NULL; @@ -160,14 +164,18 @@ void CreateDialog::_update_search() { for(;I;I=I->next()) { + String type=I->get(); + if (base_type=="Node" && type.begins_with("Editor")) + continue; // do not show editor nodes if (!ObjectTypeDB::can_instance(type)) continue; // cant create what can't be instanced - if (search_box->get_text()=="") + + if (search_box->get_text()=="") { add_type(type,types,root,&to_select); - else { + } else { bool found=false; String type=I->get(); @@ -186,7 +194,7 @@ void CreateDialog::_update_search() { add_type(I->get(),types,root,&to_select); } - if (EditorNode::get_editor_data().get_custom_types().has(type)) { + if (EditorNode::get_editor_data().get_custom_types().has(type) && ObjectTypeDB::is_type(type, base_type)) { //there are custom types based on this... cool. //print_line("there are custom types"); @@ -198,6 +206,7 @@ void CreateDialog::_update_search() { if (!show) continue; + if (!types.has(type)) add_type(type,types,root,&to_select); @@ -216,7 +225,7 @@ void CreateDialog::_update_search() { } - if (!to_select && (search_box->get_text()=="" || ct[i].name.findn(search_box->get_text())!=-1)) { + if (!to_select) { to_select=item; } @@ -246,7 +255,6 @@ void CreateDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); - _update_search(); } if (p_what==NOTIFICATION_EXIT_TREE) { diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp index ad2eb57f00..049bcefc75 100644 --- a/tools/editor/dependency_editor.cpp +++ b/tools/editor/dependency_editor.cpp @@ -80,8 +80,6 @@ void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String continue; String path = efsd->get_file_path(i); - Map<String,String> &ss = candidates[file]; - for(Map<String,String>::Element *E=candidates[file].front();E;E=E->next()) { @@ -420,7 +418,7 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) { exist=false; owners->clear(); files.clear(); - TreeItem *root=owners->create_item(); + owners->create_item(); // root for(int i=0;i<to_erase.size();i++) { files[to_erase[i]]=NULL; } diff --git a/tools/editor/editor_asset_installer.cpp b/tools/editor/editor_asset_installer.cpp index ec36773d8d..b6051886c0 100644 --- a/tools/editor/editor_asset_installer.cpp +++ b/tools/editor/editor_asset_installer.cpp @@ -317,9 +317,11 @@ void EditorAssetInstaller::ok_pressed() { } msg+=failed_files[i]; } - EditorNode::get_singleton()->show_warning(msg); + if (EditorNode::get_singleton() != NULL) + EditorNode::get_singleton()->show_warning(msg); } else { - EditorNode::get_singleton()->show_warning("Package Installed Successfully!","Success!"); + if (EditorNode::get_singleton() != NULL) + EditorNode::get_singleton()->show_warning("Package Installed Successfully!","Success!"); } diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp new file mode 100644 index 0000000000..97062b1480 --- /dev/null +++ b/tools/editor/editor_autoload_settings.cpp @@ -0,0 +1,616 @@ +/*************************************************************************/ +/* editor_autoload_settings.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "editor_autoload_settings.h" + +#include "globals.h" +#include "global_constants.h" + +#include "editor_node.h" + +#define PREVIEW_LIST_MAX_SIZE 10 + +void EditorAutoloadSettings::_notification(int p_what) { + + if (p_what == NOTIFICATION_ENTER_TREE) { + + List<String> afn; + ResourceLoader::get_recognized_extensions_for_type("Script", &afn); + ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn); + + EditorFileDialog *file_dialog = autoload_add_path->get_file_dialog(); + + for (List<String>::Element *E = afn.front(); E; E = E->next()) { + + file_dialog->add_filter("*." + E->get()); + } + } +} + +bool EditorAutoloadSettings::_autoload_name_is_valid(const String& p_name, String* r_error) { + + if (!p_name.is_valid_identifier()) { + if (r_error) + *r_error = TTR("Invalid name.") + "\n" + TTR("Valid characters:")+" a-z, A-Z, 0-9 or _"; + + return false; + } + + if (ObjectTypeDB::type_exists(p_name)) { + if (r_error) + *r_error = TTR("Invalid name. Must not collide with an existing engine class name."); + + return false; + } + + for (int i = 0; i < Variant::VARIANT_MAX; i++) { + if (Variant::get_type_name( Variant::Type(i) ) == p_name) { + if (r_error) + *r_error = TTR("Invalid name. Must not collide with an existing buit-in type name."); + + return false; + } + } + + for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) { + if (GlobalConstants::get_global_constant_name(i) == p_name) { + if (r_error) + *r_error = TTR("Invalid name. Must not collide with an existing global constant name."); + + return false; + } + } + + return true; +} + +void EditorAutoloadSettings::_autoload_add() { + + String name = autoload_add_name->get_text(); + + String error; + if (!_autoload_name_is_valid(name, &error)) { + EditorNode::get_singleton()->show_warning(error); + return; + } + + String path = autoload_add_path->get_line_edit()->get_text(); + if (!FileAccess::exists(path)) { + EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("File does not exist.")); + return; + } + + if (!path.begins_with("res://")) { + EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n"+ TTR("Not in resource path.")); + return; + } + + name = "autoload/" + name; + + UndoRedo* undo_redo = EditorNode::get_singleton()->get_undo_redo(); + + undo_redo->create_action(TTR("Add AutoLoad")); + undo_redo->add_do_property(Globals::get_singleton(), name, "*" + path); + undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, true); + + if (Globals::get_singleton()->has(name)) { + undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name)); + } else { + undo_redo->add_undo_property(Globals::get_singleton(), name, Variant()); + } + + undo_redo->add_do_method(this, "update_autoload"); + undo_redo->add_undo_method(this, "update_autoload"); + + undo_redo->add_do_method(this, "emit_signal", autoload_changed); + undo_redo->add_undo_method(this, "emit_signal", autoload_changed); + + undo_redo->commit_action(); + + autoload_add_path->get_line_edit()->set_text(""); + autoload_add_name->set_text(""); +} + +void EditorAutoloadSettings::_autoload_selected() { + + TreeItem *ti = tree->get_selected(); + + if (!ti) + return; + + selected_autoload = "autoload/" + ti->get_text(0); +} + +void EditorAutoloadSettings::_autoload_edited() { + + if (updating_autoload) + return; + + TreeItem *ti = tree->get_edited(); + int column = tree->get_edited_column(); + + UndoRedo *undo_redo = EditorNode::get_undo_redo(); + + if (column == 0) { + String name = ti->get_text(0); + String old_name = selected_autoload.get_slice("/", 1); + + if (name == old_name) + return; + + String error; + if (!_autoload_name_is_valid(name, &error)) { + ti->set_text(0, old_name); + EditorNode::get_singleton()->show_warning(error); + return; + } + + if (Globals::get_singleton()->has("autoload/" + name)) { + ti->set_text(0, old_name); + EditorNode::get_singleton()->show_warning(vformat(TTR("Autoload '%s' already exists!"), name)); + return; + } + + updating_autoload = true; + + name = "autoload/" + name; + + bool persisting = Globals::get_singleton()->get(selected_autoload); + int order = Globals::get_singleton()->get(selected_autoload); + String path = Globals::get_singleton()->get(selected_autoload); + + undo_redo->create_action(TTR("Rename Autoload")); + + undo_redo->add_do_property(Globals::get_singleton(), name, path); + undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, persisting); + undo_redo->add_do_method(Globals::get_singleton(), "set_order", name, order); + undo_redo->add_do_method(Globals::get_singleton(), "clear", selected_autoload); + + undo_redo->add_undo_property(Globals::get_singleton(), selected_autoload, path); + undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", selected_autoload, persisting); + undo_redo->add_undo_method(Globals::get_singleton(), "set_order", selected_autoload, order); + undo_redo->add_undo_method(Globals::get_singleton(), "clear", name); + + undo_redo->add_do_method(this, "update_autoload"); + undo_redo->add_undo_method(this, "update_autoload"); + + undo_redo->add_do_method(this, "emit_signal", autoload_changed); + undo_redo->add_undo_method(this, "emit_signal", autoload_changed); + + undo_redo->commit_action(); + + selected_autoload = name; + } else if (column == 2) { + updating_autoload = true; + + bool checked = ti->is_checked(2); + String base = "autoload/" + ti->get_text(0); + + int order = Globals::get_singleton()->get_order(base); + String path = Globals::get_singleton()->get(base); + + if (path.begins_with("*")) + path = path.substr(1, path.length()); + + if (checked) + path = "*" + path; + + undo_redo->create_action(TTR("Toggle AutoLoad Globals")); + + undo_redo->add_do_property(Globals::get_singleton(), base, path); + undo_redo->add_undo_property(Globals::get_singleton(), base, Globals::get_singleton()->get(base)); + + undo_redo->add_do_method(Globals::get_singleton(),"set_order", base, order); + undo_redo->add_undo_method(Globals::get_singleton(),"set_order", base, order); + + undo_redo->add_do_method(this, "update_autoload"); + undo_redo->add_undo_method(this, "update_autoload"); + + undo_redo->add_do_method(this, "emit_signal", autoload_changed); + undo_redo->add_undo_method(this, "emit_signal", autoload_changed); + + undo_redo->commit_action(); + } + + updating_autoload = false; +} + +void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_column, int p_button) { + + TreeItem *ti = p_item->cast_to<TreeItem>(); + + String name = "autoload/" + ti->get_text(0); + + UndoRedo *undo_redo = EditorNode::get_undo_redo(); + + switch (p_button) { + + case BUTTON_MOVE_UP: + case BUTTON_MOVE_DOWN: { + + TreeItem *swap = NULL; + + if (p_button == BUTTON_MOVE_UP) { + swap = ti->get_prev(); + } else { + swap = ti->get_next(); + } + + if (!swap) + return; + + String swap_name = "autoload/" + swap->get_text(0); + + int order = Globals::get_singleton()->get_order(name); + int swap_order = Globals::get_singleton()->get_order(swap_name); + + undo_redo->create_action(TTR("Move Autoload")); + + undo_redo->add_do_method(Globals::get_singleton(), "set_order", name, swap_order); + undo_redo->add_undo_method(Globals::get_singleton(), "set_order", name, order); + + undo_redo->add_do_method(Globals::get_singleton(), "set_order", swap_name, order); + undo_redo->add_undo_method(Globals::get_singleton(), "set_order", swap_name, swap_order); + + undo_redo->add_do_method(this, "update_autoload"); + undo_redo->add_undo_method(this, "update_autoload"); + + undo_redo->add_do_method(this, "emit_signal", autoload_changed); + undo_redo->add_undo_method(this, "emit_signal", autoload_changed); + + undo_redo->commit_action(); + } break; + case BUTTON_DELETE: { + + int order = Globals::get_singleton()->get_order(name); + + undo_redo->create_action(TTR("Remove Autoload")); + + undo_redo->add_do_property(Globals::get_singleton(), name, Variant()); + + undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name)); + undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", name, true); + undo_redo->add_undo_method(Globals::get_singleton(), "set_order", order); + + undo_redo->add_do_method(this, "update_autoload"); + undo_redo->add_undo_method(this, "update_autoload"); + + undo_redo->add_do_method(this, "emit_signal", autoload_changed); + undo_redo->add_undo_method(this, "emit_signal", autoload_changed); + + undo_redo->commit_action(); + } break; + } +} + +void EditorAutoloadSettings::_autoload_file_callback(const String& p_path) { + + autoload_add_name->set_text(p_path.get_file().basename()); +} + +void EditorAutoloadSettings::update_autoload() { + + if (updating_autoload) + return; + + updating_autoload = true; + + autoload_cache.clear(); + + tree->clear(); + TreeItem *root = tree->create_item(); + + List<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + + for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { + + const PropertyInfo &pi = E->get(); + + if (!pi.name.begins_with("autoload/")) + continue; + + String name = pi.name.get_slice("/", 1); + String path = Globals::get_singleton()->get(pi.name); + + if (name.empty()) + continue; + + AutoLoadInfo info; + info.name = pi.name; + info.order = Globals::get_singleton()->get_order(pi.name); + + autoload_cache.push_back(info); + + bool global = false; + + if (path.begins_with("*")) { + global = true; + path = path.substr(1, path.length()); + } + + TreeItem *item = tree->create_item(root); + item->set_text(0, name); + item->set_editable(0, true); + + item->set_text(1, path); + item->set_selectable(1, false); + + item->set_cell_mode(2, TreeItem::CELL_MODE_CHECK); + item->set_editable(2, true); + item->set_text(2, TTR("Enable")); + item->set_checked(2, global); + + item->add_button(3, get_icon("MoveUp","EditorIcons"), BUTTON_MOVE_UP); + item->add_button(3, get_icon("MoveDown","EditorIcons"), BUTTON_MOVE_DOWN); + item->add_button(3, get_icon("Del","EditorIcons"), BUTTON_DELETE); + item->set_selectable(3, false); + } + + updating_autoload = false; +} + +Variant EditorAutoloadSettings::get_drag_data_fw(const Point2& p_point, Control *p_control) { + + if (autoload_cache.size() <= 1) + return false; + + StringArray autoloads; + + TreeItem *next = tree->get_next_selected(NULL); + + while (next) { + autoloads.push_back(next->get_text(0)); + next = tree->get_next_selected(next); + } + + if (autoloads.size() == 0 || autoloads.size() == autoload_cache.size()) + return Variant(); + + VBoxContainer *preview = memnew( VBoxContainer ); + + int max_size = MIN(PREVIEW_LIST_MAX_SIZE, autoloads.size()); + + for (int i = 0; i < max_size; i++) { + Label *label = memnew( Label(autoloads[i]) ); + label->set_self_opacity(Math::lerp(1, 0, float(i)/PREVIEW_LIST_MAX_SIZE)); + + preview->add_child(label); + } + + tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN); + tree->set_drag_preview(preview); + + Dictionary drop_data; + drop_data["type"] = "autoload"; + drop_data["autoloads"] = autoloads; + + return drop_data; +} + +bool EditorAutoloadSettings::can_drop_data_fw(const Point2& p_point, const Variant& p_data, Control *p_control) const { + if (updating_autoload) + return false; + + Dictionary drop_data = p_data; + + if (!drop_data.has("type")) + return false; + + if (drop_data.has("type")) { + TreeItem *ti = tree->get_item_at_pos(p_point); + + if (!ti) + return false; + + int section = tree->get_drop_section_at_pos(p_point); + + if (section < -1) + return false; + + return true; + } + + return false; +} + +void EditorAutoloadSettings::drop_data_fw(const Point2& p_point, const Variant& p_data, Control *p_control) { + + TreeItem *ti = tree->get_item_at_pos(p_point); + + if (!ti) + return; + + int section = tree->get_drop_section_at_pos(p_point); + + if (section < -1) + return; + + String name; + bool move_to_back = false; + + if (section < 0) { + name = ti->get_text(0); + } else if (ti->get_next()) { + name = ti->get_next()->get_text(0); + } else { + name = ti->get_text(0); + move_to_back = true; + } + + int order = Globals::get_singleton()->get_order("autoload/" + name); + + AutoLoadInfo aux; + List<AutoLoadInfo>::Element *E = NULL; + + if (!move_to_back) { + aux.order = order; + E = autoload_cache.find(aux); + } + + Dictionary drop_data = p_data; + StringArray autoloads = drop_data["autoloads"]; + + Vector<int> orders; + orders.resize(autoload_cache.size()); + + for (int i = 0; i < autoloads.size(); i++) { + aux.order = Globals::get_singleton()->get_order("autoload/" + autoloads[i]); + + List<AutoLoadInfo>::Element *I = autoload_cache.find(aux); + + if (move_to_back) { + autoload_cache.move_to_back(I); + } else if (E != I) { + autoload_cache.move_before(I, E); + } else if (E->next()) { + E = E->next(); + } else { + break; + } + } + + int i = 0; + + for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) { + orders[i++] = E->get().order; + } + + orders.sort(); + + UndoRedo *undo_redo = EditorNode::get_undo_redo(); + + undo_redo->create_action(TTR("Rearrange Autoloads")); + + i = 0; + + for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) { + undo_redo->add_do_method(Globals::get_singleton(), "set_order", E->get().name, orders[i++]); + undo_redo->add_undo_method(Globals::get_singleton(), "set_order", E->get().name, E->get().order); + } + + orders.clear(); + + undo_redo->add_do_method(this, "update_autoload"); + undo_redo->add_undo_method(this, "update_autoload"); + + undo_redo->add_do_method(this, "emit_signal", autoload_changed); + undo_redo->add_undo_method(this, "emit_signal", autoload_changed); + + undo_redo->commit_action(); +} + +void EditorAutoloadSettings::_bind_methods() { + + ObjectTypeDB::bind_method("_autoload_add", &EditorAutoloadSettings::_autoload_add); + ObjectTypeDB::bind_method("_autoload_selected", &EditorAutoloadSettings::_autoload_selected); + ObjectTypeDB::bind_method("_autoload_edited", &EditorAutoloadSettings::_autoload_edited); + ObjectTypeDB::bind_method("_autoload_button_pressed", &EditorAutoloadSettings::_autoload_button_pressed); + ObjectTypeDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback); + + ObjectTypeDB::bind_method("get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw); + ObjectTypeDB::bind_method("can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw); + ObjectTypeDB::bind_method("drop_data_fw", &EditorAutoloadSettings::drop_data_fw); + + ObjectTypeDB::bind_method("update_autoload", &EditorAutoloadSettings::update_autoload); + + ADD_SIGNAL(MethodInfo("autoload_changed")); +} + +EditorAutoloadSettings::EditorAutoloadSettings() { + + autoload_changed = "autoload_changed"; + + updating_autoload = false; + selected_autoload = ""; + + HBoxContainer *hbc = memnew( HBoxContainer ); + add_child(hbc); + + VBoxContainer *vbc_path = memnew( VBoxContainer ); + vbc_path->set_h_size_flags(SIZE_EXPAND_FILL); + + autoload_add_path = memnew( EditorLineEditFileChooser ); + autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); + + autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE); + autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback"); + + vbc_path->add_margin_child(TTR("Path:"), autoload_add_path); + hbc->add_child(vbc_path); + + VBoxContainer *vbc_name = memnew( VBoxContainer ); + vbc_name->set_h_size_flags(SIZE_EXPAND_FILL); + + HBoxContainer *hbc_name = memnew( HBoxContainer ); + + autoload_add_name = memnew( LineEdit ); + autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); + hbc_name->add_child(autoload_add_name); + + Button *add_autoload = memnew( Button ); + add_autoload->set_text(TTR("Add")); + hbc_name->add_child(add_autoload); + add_autoload->connect("pressed", this, "_autoload_add"); + + vbc_name->add_margin_child(TTR("Node Name:"), hbc_name); + hbc->add_child(vbc_name); + + tree = memnew( Tree ); + tree->set_hide_root(true); + tree->set_select_mode(Tree::SELECT_MULTI); + tree->set_single_select_cell_editing_only_when_already_selected(true); + + tree->set_drag_forwarding(this); + + tree->set_columns(4); + tree->set_column_titles_visible(true); + + tree->set_column_title(0,TTR("Name")); + tree->set_column_expand(0,true); + tree->set_column_min_width(0,100); + + tree->set_column_title(1,TTR("Path")); + tree->set_column_expand(1,true); + tree->set_column_min_width(1,100); + + tree->set_column_title(2,TTR("Singleton")); + tree->set_column_expand(2,false); + tree->set_column_min_width(2,80); + + tree->set_column_expand(3,false); + tree->set_column_min_width(3,80); + + tree->connect("cell_selected", this, "_autoload_selected"); + tree->connect("item_edited", this, "_autoload_edited"); + tree->connect("button_pressed", this, "_autoload_button_pressed"); + + add_margin_child(TTR("List:"), tree, true); +} + diff --git a/tools/editor/import_settings.h b/tools/editor/editor_autoload_settings.h index 5a383a1a1a..b61c44b9c2 100644 --- a/tools/editor/import_settings.h +++ b/tools/editor/editor_autoload_settings.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* import_settings.h */ +/* editor_autoload_settings.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,57 +26,69 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef IMPORT_SETTINGS_H -#define IMPORT_SETTINGS_H -#include "object.h" -#include "scene/gui/dialogs.h" +#ifndef EDITOR_AUTOLOAD_SETTINGS_H +#define EDITOR_AUTOLOAD_SETTINGS_H + #include "scene/gui/tree.h" -#include "scene/gui/label.h" -#include "scene/gui/option_button.h" -#include "scene/gui/line_edit.h" -#include "scene/gui/file_dialog.h" -#include "scene/gui/progress_bar.h" -#include "scene/gui/slider.h" -#include "scene/gui/spin_box.h" -#include "scene/resources/mesh.h" -#include "editor_import_export.h" -#include "editor_file_system.h" -#include "editor_dir_dialog.h" -class EditorNode; - - -class ImportSettingsDialog : public ConfirmationDialog { - - OBJ_TYPE(ImportSettingsDialog,ConfirmationDialog); - - TreeItem *edited; - EditorNode *editor; + +#include "editor_file_dialog.h" + +class EditorAutoloadSettings : public VBoxContainer { + + OBJ_TYPE( EditorAutoloadSettings, VBoxContainer ); + + enum { + BUTTON_MOVE_UP, + BUTTON_MOVE_DOWN, + BUTTON_DELETE + }; + + String autoload_changed; + + struct AutoLoadInfo { + String name; + int order; + + bool operator==(const AutoLoadInfo& p_info) { + return order == p_info.order; + } + }; + + List<AutoLoadInfo> autoload_cache; + + bool updating_autoload; + int number_of_autoloads; + String selected_autoload; + Tree *tree; - bool updating; + EditorLineEditFileChooser *autoload_add_path; + LineEdit *autoload_add_name; - void _button_pressed(Object *p_button, int p_col, int p_id); - void _item_pressed(int p_idx); - bool _generate_fs(TreeItem *p_parent,EditorFileSystemDirectory *p_dir); + bool _autoload_name_is_valid(const String& p_string, String *r_error = NULL); - String texformat; + void _autoload_add(); + void _autoload_selected(); + void _autoload_edited(); + void _autoload_button_pressed(Object *p_item, int p_column, int p_button); + void _autoload_file_callback(const String& p_path); - void _item_edited(); - virtual void ok_pressed(); + 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); protected: - void _notification(int p_what); static void _bind_methods(); -public: - void update_tree(); +public: + void update_autoload(); - void popup_import_settings(); - ImportSettingsDialog(EditorNode *p_editor); + EditorAutoloadSettings(); }; -#endif // IMPORT_SETTINGS_H +#endif + diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 4c4fecdd83..8d3fd6c9c2 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -326,6 +326,13 @@ Dictionary EditorData::get_editor_states() const { } +Dictionary EditorData::get_scene_editor_states(int p_idx) const +{ + ERR_FAIL_INDEX_V(p_idx,edited_scene.size(),Dictionary()); + EditedScene es = edited_scene[p_idx]; + return es.editor_states; +} + void EditorData::set_editor_states(const Dictionary& p_states) { List<Variant> keys; @@ -565,6 +572,8 @@ bool EditorData::check_and_update_scene(int p_idx) { bool must_reload = _find_updated_instances(edited_scene[p_idx].root,edited_scene[p_idx].root,checked_scenes); + print_line("MUST RELOAD? "+itos(must_reload)); + if (must_reload) { Ref<PackedScene> pscene; pscene.instance(); @@ -611,11 +620,14 @@ void EditorData::set_edited_scene(int p_idx){ current_edited_scene=p_idx; //swap } -Node* EditorData::get_edited_scene_root(){ - - ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),NULL); - - return edited_scene[current_edited_scene].root; +Node* EditorData::get_edited_scene_root(int p_idx){ + if (p_idx < 0) { + ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),NULL); + return edited_scene[current_edited_scene].root; + } else { + ERR_FAIL_INDEX_V(p_idx,edited_scene.size(),NULL); + return edited_scene[p_idx].root; + } } void EditorData::set_edited_scene_root(Node* p_root) { @@ -628,9 +640,14 @@ int EditorData::get_edited_scene_count() const { return edited_scene.size(); } -void EditorData::set_edited_scene_version(uint64_t version) { +void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) { ERR_FAIL_INDEX(current_edited_scene,edited_scene.size()); - edited_scene[current_edited_scene].version=version; + if (scene_idx < 0) { + edited_scene[current_edited_scene].version=version; + } else { + ERR_FAIL_INDEX(scene_idx,edited_scene.size()); + edited_scene[scene_idx].version=version; + } } @@ -756,12 +773,19 @@ void EditorData::set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_ } -Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata() const{ +Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata(int idx) const{ ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),Ref<ResourceImportMetadata>()); - return edited_scene[current_edited_scene].medatata; + if(idx<0) { + return edited_scene[current_edited_scene].medatata; + } else { + ERR_FAIL_INDEX_V(idx,edited_scene.size(),Ref<ResourceImportMetadata>()); + return edited_scene[idx].medatata; + } } + + void EditorData::clear_edited_scenes() { for(int i=0;i<edited_scene.size();i++) { diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index 319155655d..a0b716f560 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -156,6 +156,7 @@ public: void paste_object_params(Object *p_object); Dictionary get_editor_states() const; + Dictionary get_scene_editor_states(int p_idx) const; void set_editor_states(const Dictionary& p_states); void get_editor_breakpoints(List<String> *p_breakpoints); void clear_editor_states(); @@ -184,15 +185,15 @@ public: void set_edited_scene(int p_idx); void set_edited_scene_root(Node* p_root); void set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_mdata); - Ref<ResourceImportMetadata> get_edited_scene_import_metadata() const; + Ref<ResourceImportMetadata> get_edited_scene_import_metadata(int p_idx = -1) const; int get_edited_scene() const; - Node* get_edited_scene_root(); + Node* get_edited_scene_root(int p_idx = -1); int get_edited_scene_count() const; String get_scene_title(int p_idx) const; String get_scene_path(int p_idx) const; String get_scene_type(int p_idx) const; Ref<Script> get_scene_root_script(int p_idx) const; - void set_edited_scene_version(uint64_t version); + void set_edited_scene_version(uint64_t version, int p_scene_idx = -1); uint64_t get_edited_scene_version() const; uint64_t get_scene_version(int p_idx) const; void clear_edited_scenes(); diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index a6e231cf18..f6ce7bf3f8 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -99,8 +99,14 @@ void EditorDirDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { reload(); - tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); - EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload"); + + if (!tree->is_connected("item_collapsed",this,"_item_collapsed")) { + tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); + } + + if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed",this,"reload")) { + EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload"); + } } @@ -185,10 +191,14 @@ void EditorDirDialog::ok_pressed() { void EditorDirDialog::_make_dir() { TreeItem *ti=tree->get_selected(); - if (!ti) + if (!ti) { + mkdirerr->set_text("Please select a base directory first"); + mkdirerr->popup_centered_minsize(); return; + } makedialog->popup_centered_minsize(Size2(250,80)); + makedirname->grab_focus(); } void EditorDirDialog::_make_dir_confirm() { @@ -198,9 +208,11 @@ void EditorDirDialog::_make_dir_confirm() { return; String dir = ti->get_metadata(0); + DirAccess *d = DirAccess::open(dir); ERR_FAIL_COND(!d); Error err = d->make_dir(makedirname->get_text()); + if (err!=OK) { mkdirerr->popup_centered_minsize(Size2(250,80)); } else { diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index e68a53659b..b8abd1d32c 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -144,11 +144,11 @@ void EditorFileDialog::_unhandled_input(const InputEvent& p_event) { dir->grab_focus(); handled=true; } - if (ED_IS_SHORTCUT("file_dialog/mode_favorite_up", p_event)) { + if (ED_IS_SHORTCUT("file_dialog/move_favorite_up", p_event)) { _favorite_move_up(); handled=true; } - if (ED_IS_SHORTCUT("file_dialog/mode_favorite_down", p_event)) { + if (ED_IS_SHORTCUT("file_dialog/move_favorite_down", p_event)) { _favorite_move_down(); handled=true; } @@ -1290,14 +1290,14 @@ EditorFileDialog::EditorFileDialog() { ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT|KEY_LEFT); ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KEY_MASK_ALT|KEY_RIGHT); ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KEY_MASK_ALT|KEY_UP); - ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_MASK_CMD|KEY_F5); // ctrl + f5 else it launches the game as well.. + ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_F5); ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KEY_MASK_CMD|KEY_H); ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT|KEY_F); ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT|KEY_V); ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD|KEY_N); ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD|KEY_D); - ED_SHORTCUT("file_dialog/mode_favorite_up", TTR("Mode Favorite Up"), KEY_MASK_CMD|KEY_UP); - ED_SHORTCUT("file_dialog/mode_favorite_down", TTR("Mode Favorite Down"), KEY_MASK_CMD|KEY_DOWN); + ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KEY_MASK_CMD|KEY_UP); + ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KEY_MASK_CMD|KEY_DOWN); HBoxContainer *pathhb = memnew( HBoxContainer ); diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index c5c92b5228..582b9e2490 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -34,6 +34,7 @@ #include "editor_node.h" #include "io/resource_saver.h" #include "editor_settings.h" +#include "editor_resource_preview.h" EditorFileSystem *EditorFileSystem::singleton=NULL; @@ -621,33 +622,42 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess int total = dirs.size()+files.size(); int idx=0; + for (List<String>::Element *E=dirs.front();E;E=E->next(),idx++) { if (da->change_dir(E->get())==OK) { - EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory ); + String d = da->get_current_dir(); - efd->parent=p_dir; - efd->name=E->get(); + if (d==cd || !d.begins_with(cd)) { + da->change_dir(cd); //avoid recursion + } else { - _scan_new_dir(efd,da,p_progress.get_sub(idx,total)); - int idx=0; - for(int i=0;i<p_dir->subdirs.size();i++) { + EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory ); - if (efd->name<p_dir->subdirs[i]->name) - break; - idx++; - } - if (idx==p_dir->subdirs.size()) { - p_dir->subdirs.push_back(efd); - } else { - p_dir->subdirs.insert(idx,efd); - } + efd->parent=p_dir; + efd->name=E->get(); + + _scan_new_dir(efd,da,p_progress.get_sub(idx,total)); + + int idx=0; + for(int i=0;i<p_dir->subdirs.size();i++) { + + if (efd->name<p_dir->subdirs[i]->name) + break; + idx++; + } + if (idx==p_dir->subdirs.size()) { + p_dir->subdirs.push_back(efd); + } else { + p_dir->subdirs.insert(idx,efd); + } - da->change_dir(".."); + da->change_dir(".."); + } } else { - ERR_PRINTS(TTR("Cannot go into subdir:")+" "+E->get()); + ERR_PRINTS("Cannot go into subdir: "+E->get()); } p_progress.update(idx,total); @@ -821,12 +831,10 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } } + da->list_dir_end(); memdelete(da); - - - } for(int i=0;i<p_dir->files.size();i++) { @@ -841,6 +849,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S continue; } + if (_check_meta_sources(p_dir->files[i]->meta)) { ItemAction ia; ia.action=ItemAction::ACTION_FILE_SOURCES_CHANGED; @@ -851,6 +860,8 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } else { p_dir->files[i]->meta.sources_changed=false; } + + EditorResourcePreview::get_singleton()->check_for_invalidation(p_dir->get_file_path(i)); } for(int i=0;i<p_dir->subdirs.size();i++) { @@ -1321,6 +1332,7 @@ void EditorFileSystem::update_file(const String& p_file) { fs->files[cpos]->modified_time=FileAccess::get_modified_time(p_file); fs->files[cpos]->meta=_get_meta(p_file); + EditorResourcePreview::get_singleton()->call_deferred("check_for_invalidation",p_file); call_deferred("emit_signal","filesystem_changed"); //update later } @@ -1334,6 +1346,8 @@ void EditorFileSystem::_bind_methods() { } + + EditorFileSystem::EditorFileSystem() { diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h index b96e947569..fb768fb358 100644 --- a/tools/editor/editor_file_system.h +++ b/tools/editor/editor_file_system.h @@ -236,6 +236,7 @@ public: EditorFileSystemDirectory *get_path(const String& p_path); String get_file_type(const String& p_file) const; EditorFileSystemDirectory* find_file(const String& p_file,int* r_index) const; + EditorFileSystem(); ~EditorFileSystem(); }; diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 0b60db5ee3..1fc157098c 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -332,7 +332,7 @@ EditorHelpSearch::EditorHelpSearch() { register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); - set_title(TTR("Search Classes")); + set_title(TTR("Search Help")); // search_options->set_hide_root(true); @@ -526,6 +526,7 @@ EditorHelpIndex::EditorHelpIndex() { class_list->connect("item_activated",this,"_tree_item_selected"); get_ok()->set_text(TTR("Open")); + set_title(TTR("Search Classes")); } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index f6278e350a..30b89cacc5 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -168,6 +168,10 @@ void EditorNode::_update_title() { void EditorNode::_unhandled_input(const InputEvent& p_event) { + if (Node::get_viewport()->get_modal_stack_top()) + return; //ignore because of modal window + + if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) { @@ -504,8 +508,6 @@ void EditorNode::_rebuild_import_menu() for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) { p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i); } - //p->add_separator(); - //p->add_item(TTR("Re-Import.."), SETTINGS_IMPORT); } void EditorNode::_node_renamed() { @@ -563,8 +565,8 @@ void EditorNode::save_resource_in_path(const Ref<Resource>& p_resource,const Str int flg=0; if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; String path = Globals::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); @@ -593,7 +595,6 @@ void EditorNode::save_resource(const Ref<Resource>& p_resource) { void EditorNode::save_resource_as(const Ref<Resource>& p_resource,const String& p_at_path) { file->set_mode(EditorFileDialog::MODE_SAVE_FILE); - bool relpaths = (p_resource->has_meta("__editor_relpaths__") && p_resource->get_meta("__editor_relpaths__").operator bool()); current_option=RESOURCE_SAVE_AS; List<String> extensions; @@ -703,7 +704,7 @@ void EditorNode::_get_scene_metadata(const String& p_file) { cf.instance(); Error err = cf->load(path); - if (err!=OK) + if (err!=OK || !cf->has_section("editor_states")) return; //must not exist List<String> esl; @@ -724,9 +725,9 @@ void EditorNode::_get_scene_metadata(const String& p_file) { } -void EditorNode::_set_scene_metadata(const String& p_file) { +void EditorNode::_set_scene_metadata(const String& p_file, int p_idx) { - Node *scene = editor_data.get_edited_scene_root(); + Node *scene = editor_data.get_edited_scene_root(p_idx); if (!scene) return; @@ -739,7 +740,14 @@ void EditorNode::_set_scene_metadata(const String& p_file) { Ref<ConfigFile> cf; cf.instance(); - Dictionary md = editor_data.get_editor_states(); + Dictionary md; + + if (p_idx<0 || editor_data.get_edited_scene()==p_idx) { + md = editor_data.get_editor_states(); + } else { + md = editor_data.get_scene_editor_states(p_idx); + } + List<Variant> keys; md.get_key_list(&keys); @@ -953,9 +961,9 @@ void EditorNode::_save_scene_with_preview(String p_file) { } -void EditorNode::_save_scene(String p_file) { +void EditorNode::_save_scene(String p_file, int idx) { - Node *scene = editor_data.get_edited_scene_root(); + Node *scene = editor_data.get_edited_scene_root(idx); if (!scene) { @@ -969,7 +977,7 @@ void EditorNode::_save_scene(String p_file) { editor_data.apply_changes_in_editors(); - _set_scene_metadata(p_file); + _set_scene_metadata(p_file,idx); Ref<PackedScene> sdata; @@ -1000,12 +1008,12 @@ void EditorNode::_save_scene(String p_file) { return; } - sdata->set_import_metadata(editor_data.get_edited_scene_import_metadata()); + sdata->set_import_metadata(editor_data.get_edited_scene_import_metadata(idx)); int flg=0; if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; flg|=ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; @@ -1016,7 +1024,10 @@ void EditorNode::_save_scene(String p_file) { if (err==OK) { scene->set_filename( Globals::get_singleton()->localize_path(p_file) ); //EditorFileSystem::get_singleton()->update_file(p_file,sdata->get_type()); - set_current_version(editor_data.get_undo_redo().get_version()); + if (idx < 0 || idx == editor_data.get_edited_scene()) + set_current_version(editor_data.get_undo_redo().get_version()); + else + editor_data.set_edited_scene_version(0,idx); _update_title(); _update_scene_tabs(); } else { @@ -1161,7 +1172,13 @@ void EditorNode::_dialog_action(String p_file) { load_scene(p_file); } break; + case SETTINGS_PICK_MAIN_SCENE: { + Globals::get_singleton()->set("application/main_scene",p_file); + Globals::get_singleton()->set_persisting("application/main_scene",true); + Globals::get_singleton()->save(); + //would be nice to show the project manager opened with the hilighted field.. + } break; case FILE_SAVE_OPTIMIZED: { @@ -1543,9 +1560,10 @@ void EditorNode::_property_editor_back() { void EditorNode::_imported(Node *p_node) { - Node *scene = editor_data.get_edited_scene_root(); -// add_edited_scene(p_node); /* + Node *scene = editor_data.get_edited_scene_root(); + add_edited_scene(p_node); + if (scene) { String path = scene->get_filename(); p_node->set_filename(path); @@ -1605,6 +1623,7 @@ void EditorNode::_edit_current() { object_menu->set_disabled(true); bool is_resource = current_obj->is_type("Resource"); + bool is_node = current_obj->is_type("Node"); resource_save_button->set_disabled(!is_resource); if (is_resource) { @@ -1621,7 +1640,7 @@ void EditorNode::_edit_current() { //top_pallete->set_current_tab(1); - } else if (current_obj->is_type("Node")) { + } else if (is_node) { Node * current_node = current_obj->cast_to<Node>(); ERR_FAIL_COND(!current_node); @@ -1717,10 +1736,14 @@ void EditorNode::_edit_current() { p->add_shortcut(ED_SHORTCUT("property_editor/copy_resource",TTR("Copy Resource")),RESOURCE_COPY); p->add_shortcut(ED_SHORTCUT("property_editor/unref_resource",TTR("Make Built-In")),RESOURCE_UNREF); } - p->add_separator(); - p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique",TTR("Make Sub-Resources Unique")),OBJECT_UNIQUE_RESOURCES); - p->add_separator(); - p->add_icon_shortcut(gui_base->get_icon("Help","EditorIcons"),ED_SHORTCUT("property_editor/open_help",TTR("Open in Help")),OBJECT_REQUEST_HELP); + + if (is_resource || is_node) { + p->add_separator(); + p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique",TTR("Make Sub-Resources Unique")),OBJECT_UNIQUE_RESOURCES); + p->add_separator(); + p->add_icon_shortcut(gui_base->get_icon("Help","EditorIcons"),ED_SHORTCUT("property_editor/open_help",TTR("Open in Help")),OBJECT_REQUEST_HELP); + } + List<MethodInfo> methods; current_obj->get_method_list(&methods); @@ -1799,7 +1822,6 @@ void EditorNode::_run(bool p_current,const String& p_custom) { String args; - if (p_current || (editor_data.get_edited_scene_root() && p_custom==editor_data.get_edited_scene_root()->get_filename())) { Node *scene = editor_data.get_edited_scene_root(); @@ -1822,12 +1844,7 @@ void EditorNode::_run(bool p_current,const String& p_custom) { } - bool autosave = EDITOR_DEF("run/auto_save_before_running",true); - - if (autosave) { - _menu_option(FILE_SAVE_SCENE); - } if (run_settings_dialog->get_run_mode()==RunSettingsDialog::RUN_LOCAL_SCENE) { @@ -1850,10 +1867,29 @@ void EditorNode::_run(bool p_current,const String& p_custom) { current_option=-1; //accept->get_cancel()->hide(); - accept->get_ok()->set_text(TTR("I see..")); - accept->set_text(TTR("No main scene has ever been defined.\nSelect one from \"Project Settings\" under the 'application' category.")); - accept->popup_centered_minsize(); + pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in later in \"Project Settings\" under the 'application' category.")); + pick_main_scene->popup_centered_minsize(); + return; + } + + if (!FileAccess::exists(run_filename)) { + + current_option=-1; + //accept->get_cancel()->hide(); + pick_main_scene->set_text(vformat(TTR("Selected scene '%s' does not exist, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), run_filename)); + pick_main_scene->popup_centered_minsize(); return; + + } + + if (ResourceLoader::get_resource_type(run_filename)!="PackedScene") { + + current_option=-1; + //accept->get_cancel()->hide(); + pick_main_scene->set_text(vformat(TTR("Selected scene '%s' is not a scene file, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), run_filename)); + pick_main_scene->popup_centered_minsize(); + return; + } } @@ -1881,7 +1917,7 @@ void EditorNode::_run(bool p_current,const String& p_custom) { _save_scene_with_preview(scene->get_filename()); } } - + _menu_option(FILE_SAVE_ALL_SCENES); editor_data.save_editor_external_data(); } @@ -2102,7 +2138,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } file->set_mode(EditorFileDialog::MODE_SAVE_FILE); - bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool()); List<String> extensions; @@ -2128,7 +2163,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { String existing; if (extensions.size()) { String root_name(get_edited_scene()->get_name()); - existing=root_name+".tscn";//+extensions.front()->get().to_lower(); + existing=root_name+"."+extensions.front()->get().to_lower(); } file->set_current_path(existing); @@ -2138,6 +2173,19 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; + case FILE_SAVE_ALL_SCENES: { + for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { + Node *scene = editor_data.get_edited_scene_root(i); + if (scene && scene->get_filename()!="") { + // save in background if in the script editor + if (i != editor_data.get_edited_scene() || _get_current_main_editor() == EDITOR_SCRIPT) { + _save_scene(scene->get_filename(), i); + } else { + _save_scene_with_preview(scene->get_filename()); + } + }// else: ignore new scenes + } + } break; case FILE_SAVE_BEFORE_RUN: { if (!p_confirmed) { accept->get_ok()->set_text(TTR("Yes")); @@ -2183,8 +2231,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } - bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool()); - file->set_mode(EditorFileDialog::MODE_SAVE_FILE); file->set_current_path(cpath); @@ -2193,8 +2239,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case FILE_SAVE_OPTIMIZED: { - Node *scene = editor_data.get_edited_scene_root(); #if 0 + Node *scene = editor_data.get_edited_scene_root(); if (!scene) { current_option=-1; @@ -2467,7 +2513,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { #endif case RESOURCE_NEW: { - create_dialog->popup_centered_ratio(); + create_dialog->popup(true); } break; case RESOURCE_LOAD: { @@ -2638,11 +2684,16 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY_NATIVE: { - _menu_option_confirm(RUN_STOP,true); - emit_signal("play_pressed"); - editor_run.run_native_notify(); - - + + bool autosave = EDITOR_DEF("run/auto_save_before_running",true); + if (autosave) { + _menu_option_confirm(FILE_SAVE_ALL_SCENES, false); + } + if (run_native->is_deploy_debug_remote_enabled()){ + _menu_option_confirm(RUN_STOP,true); + emit_signal("play_pressed"); + editor_run.run_native_notify(); + } } break; case RUN_SCENE_SETTINGS: { @@ -2755,10 +2806,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { settings_config_dialog->popup_edit_settings(); } break; - case SETTINGS_IMPORT: { - - import_settings->popup_import_settings(); - } break; case SETTINGS_OPTIMIZED_PRESETS: { //optimized_presets->popup_centered_ratio(); @@ -2769,6 +2816,30 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { file_templates->popup_centered_ratio(); } break; + case SETTINGS_PICK_MAIN_SCENE: { + + + //print_tree(); + file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + //not for now? + List<String> extensions; + ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); + file->clear_filters(); + for(int i=0;i<extensions.size();i++) { + + file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); + } + + + //file->set_current_path(current_path); + Node *scene = editor_data.get_edited_scene_root(); + if (scene) { + file->set_current_path(scene->get_filename()); + }; + file->set_title(TTR("Pick a Main Scene")); + file->popup_centered_ratio(); + + } break; case SETTINGS_ABOUT: { about->popup_centered(Size2(500,130)*EDSCALE); @@ -2782,10 +2853,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { List<Ref<Resource> > cached; ResourceCache::get_cached_resources(&cached); - + //this should probably be done in a thread.. for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) { - if (!E->get()->can_reload_from_file()) + if (!E->get()->editor_can_reload_from_file()) + continue; + if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path()) continue; if (!FileAccess::exists(E->get()->get_path())) continue; @@ -2793,6 +2866,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (mt!=E->get()->get_last_modified_time()) { E->get()->reload_from_file(); } + } @@ -3079,6 +3153,11 @@ void EditorNode::_remove_edited_scene() { new_index=1; } + + + if (editor_data.get_scene_path(old_index)!=String()) { + ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index)); + } _scene_tab_changed(new_index); editor_data.remove_scene(old_index); editor_data.get_undo_redo().clear_history(); @@ -3376,7 +3455,10 @@ Dictionary EditorNode::_get_main_scene_state() { return state; } -void EditorNode::_set_main_scene_state(Dictionary p_state) { +void EditorNode::_set_main_scene_state(Dictionary p_state,Node* p_for_scene) { + + if (get_edited_scene()!=p_for_scene && p_for_scene!=NULL) + return; //not for this scene //print_line("set current 7 "); changing_scene=false; @@ -3520,7 +3602,7 @@ void EditorNode::set_current_scene(int p_idx) { }*/ //_set_main_scene_state(state); - call_deferred("_set_main_scene_state",state); //do after everything else is done setting up + call_deferred("_set_main_scene_state",state,get_edited_scene()); //do after everything else is done setting up //print_line("set current 6 "); @@ -3740,7 +3822,12 @@ void EditorNode::request_instance_scene(const String &p_path) { } -ScenesDock *EditorNode::get_scenes_dock() { +void EditorNode::request_instance_scenes(const Vector<String>& p_files) { + + scene_tree_dock->instance_scenes(p_files); +} + +FileSystemDock *EditorNode::get_scenes_dock() { return scenes_dock; } @@ -3749,10 +3836,9 @@ SceneTreeDock *EditorNode::get_scene_tree_dock() { return scene_tree_dock; } -void EditorNode::_instance_request(const String& p_path){ - +void EditorNode::_instance_request(const Vector<String>& p_files) { - request_instance_scene(p_path); + request_instance_scenes(p_files); } void EditorNode::_property_keyed(const String& p_keyed,const Variant& p_value,bool p_advance) { @@ -5062,6 +5148,78 @@ void EditorNode::_file_access_close_error_notify(const String& p_str) { add_io_error("Unable to write to file '"+p_str+"', file in use, locked or lacking permissions."); } + +void EditorNode::reload_scene(const String& p_path) { + + + //first of all, reload textures as they might have changed on disk + + List<Ref<Resource> > cached; + ResourceCache::get_cached_resources(&cached); + List<Ref<Resource> > to_clear; //clear internal resources from previous scene from being used + for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) { + + if (E->get()->get_path().begins_with(p_path+"::")) //subresources of existing scene + to_clear.push_back(E->get()); + + if (!E->get()->cast_to<Texture>()) + continue; + if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path()) + continue; + if (!FileAccess::exists(E->get()->get_path())) + continue; + uint64_t mt = FileAccess::get_modified_time(E->get()->get_path()); + if (mt!=E->get()->get_last_modified_time()) { + E->get()->reload_from_file(); + } + } + + //so reload reloads everything, clear subresources of previous scene + while(to_clear.front()) { + to_clear.front()->get()->set_path(""); + to_clear.pop_front(); + } + + int scene_idx=-1; + for(int i=0;i<editor_data.get_edited_scene_count();i++) { + + if (editor_data.get_scene_path(i)==p_path) { + scene_idx=i; + break; + } + } + + int current_tab = editor_data.get_edited_scene(); + + + if (scene_idx==-1) { + if (get_edited_scene()) { + //scene is not open, so at it might be instanced, just refresh, set tab to itself and it will reload + set_current_scene(current_tab); + editor_data.get_undo_redo().clear_history(); + } + return; + } + + + if (current_tab==scene_idx) { + editor_data.apply_changes_in_editors(); + _set_scene_metadata(p_path); + + } + //remove scene + _remove_scene(scene_idx); + //reload scene + load_scene(p_path); + //adjust index so tab is back a the previous position + editor_data.move_edited_scene_to_index(scene_idx); + get_undo_redo()->clear_history(); + //recover the tab + scene_tabs->set_current_tab(current_tab); + _scene_tab_changed(current_tab); +} + + void EditorNode::_bind_methods() { @@ -5510,8 +5668,6 @@ EditorNode::EditorNode() { ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_TAB); - Separator *vs=NULL; - file_menu->set_tooltip(TTR("Operations with scene files.")); p=file_menu->get_popup(); p->add_shortcut(ED_SHORTCUT("editor/new_scene",TTR("New Scene")),FILE_NEW_SCENE); @@ -5520,6 +5676,7 @@ EditorNode::EditorNode() { p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/save_scene",TTR("Save Scene"),KEY_MASK_CMD+KEY_S),FILE_SAVE_SCENE); p->add_shortcut(ED_SHORTCUT("editor/save_scene_as",TTR("Save Scene As.."),KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_S),FILE_SAVE_AS_SCENE); + p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes",TTR("Save all Scenes"),KEY_MASK_ALT+KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_S),FILE_SAVE_ALL_SCENES); p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/close_scene",TTR("Close Scene"),KEY_MASK_SHIFT+KEY_MASK_CTRL+KEY_W),FILE_CLOSE); p->add_separator(); @@ -5712,7 +5869,8 @@ EditorNode::EditorNode() { play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE); play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom","EditorIcons")); play_custom_scene_button->connect("pressed", this,"_menu_option",make_binds(RUN_PLAY_CUSTOM_SCENE)); - play_custom_scene_button->set_tooltip(TTR("Play custom scene")+" ("+keycode_get_string(KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_F5)+")."); + play_custom_scene_button->set_tooltip(TTR("Play custom scene")); + play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene",TTR("Play Custom Scene"),KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_F5)); debug_button = memnew( MenuButton ); debug_button->set_flat(true); @@ -6008,7 +6166,7 @@ EditorNode::EditorNode() { //node_dock->set_undoredo(&editor_data.get_undo_redo()); dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); - scenes_dock = memnew( ScenesDock(this) ); + scenes_dock = memnew( FileSystemDock(this) ); scenes_dock->set_name(TTR("FileSystem")); scenes_dock->set_use_thumbnails(int(EditorSettings::get_singleton()->get("file_dialog/display_mode"))==EditorFileDialog::DISPLAY_THUMBNAILS); dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scenes_dock); @@ -6160,8 +6318,6 @@ EditorNode::EditorNode() { open_recent_confirmation->connect("confirmed",this,"_open_recent_scene_confirm"); - import_settings= memnew(ImportSettingsDialog(this)); - gui_base->add_child(import_settings); run_settings_dialog = memnew( RunSettingsDialog ); gui_base->add_child( run_settings_dialog ); @@ -6432,7 +6588,7 @@ EditorNode::EditorNode() { load_error_dialog->add_child(load_errors); load_error_dialog->set_title(TTR("Load Errors")); load_error_dialog->set_child_rect(load_errors); - add_child(load_error_dialog); + gui_base->add_child(load_error_dialog); //EditorImport::add_importer( Ref<EditorImporterCollada>( memnew(EditorImporterCollada ))); @@ -6457,7 +6613,10 @@ EditorNode::EditorNode() { Node::set_human_readable_collision_renaming(true); - + pick_main_scene = memnew( ConfirmationDialog ); + gui_base->add_child(pick_main_scene); + pick_main_scene->get_ok()->set_text("Select"); + pick_main_scene->connect("confirmed",this,"_menu_option",varray(SETTINGS_PICK_MAIN_SCENE)); // Ref<ImageTexture> it = gui_base->get_icon("logo","Icons"); // OS::get_singleton()->set_icon( it->get_data() ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 75565118bc..793c148671 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -42,7 +42,7 @@ #include "scene/gui/split_container.h" #include "scene/gui/center_container.h" #include "scene/gui/texture_progress.h" -#include "tools/editor/scenes_dock.h" +#include "tools/editor/filesystem_dock.h" #include "tools/editor/scene_tree_editor.h" #include "tools/editor/property_editor.h" #include "tools/editor/create_dialog.h" @@ -74,7 +74,6 @@ #include "tools/editor/editor_sub_scene.h" #include "editor_import_export.h" #include "editor_reimport_dialog.h" -#include "import_settings.h" #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_name_dialog.h" @@ -125,6 +124,7 @@ private: FILE_OPEN_SCENE, FILE_SAVE_SCENE, FILE_SAVE_AS_SCENE, + FILE_SAVE_ALL_SCENES, FILE_SAVE_BEFORE_RUN, FILE_SAVE_AND_RUN, FILE_IMPORT_SUBSCENE, @@ -177,7 +177,6 @@ private: RUN_RELOAD_SCRIPTS, SETTINGS_UPDATE_ALWAYS, SETTINGS_UPDATE_CHANGES, - SETTINGS_IMPORT, SETTINGS_EXPORT_PREFERENCES, SETTINGS_PREFERENCES, SETTINGS_OPTIMIZED_PRESETS, @@ -185,6 +184,7 @@ private: SETTINGS_LAYOUT_DELETE, SETTINGS_LAYOUT_DEFAULT, SETTINGS_LOAD_EXPORT_TEMPLATES, + SETTINGS_PICK_MAIN_SCENE, SETTINGS_HELP, SETTINGS_ABOUT, SOURCES_REIMPORT, @@ -275,7 +275,7 @@ private: PropertyEditor *property_editor; NodeDock *node_dock; VBoxContainer *prop_editor_vb; - ScenesDock *scenes_dock; + FileSystemDock *scenes_dock; EditorRunNative *run_native; HBoxContainer *search_bar; @@ -287,6 +287,7 @@ private: ConfirmationDialog *confirmation; ConfirmationDialog *import_confirmation; ConfirmationDialog *open_recent_confirmation; + ConfirmationDialog *pick_main_scene; AcceptDialog *accept; AcceptDialog *about; AcceptDialog *warning; @@ -336,7 +337,6 @@ private: Vector<EditorPlugin*> editor_table; EditorReImportDialog *reimport_dialog; - ImportSettingsDialog *import_settings; ProgressDialog *progress_dialog; BackgroundProgress *progress_hb; @@ -439,7 +439,7 @@ private: void _node_renamed(); void _editor_select(int p_which); - void _set_scene_metadata(const String &p_file); + void _set_scene_metadata(const String &p_file, int p_idx=-1); void _get_scene_metadata(const String& p_file); void _update_title(); void _update_scene_tabs(); @@ -449,10 +449,10 @@ private: void _rebuild_import_menu(); - void _save_scene(String p_file); + void _save_scene(String p_file, int idx = -1); - void _instance_request(const String& p_path); + void _instance_request(const Vector<String>& p_files); void _property_keyed(const String& p_keyed, const Variant& p_value, bool p_advance); void _transform_keyed(Object *sp,const String& p_sub,const Transform& p_key); @@ -553,7 +553,7 @@ private: void _scene_tab_script_edited(int p_tab); Dictionary _get_main_scene_state(); - void _set_main_scene_state(Dictionary p_state); + void _set_main_scene_state(Dictionary p_state,Node* p_for_scene); int _get_current_main_editor(); @@ -666,7 +666,8 @@ public: static VSplitContainer *get_top_split() { return singleton->top_split; } void request_instance_scene(const String &p_path); - ScenesDock *get_scenes_dock(); + void request_instance_scenes(const Vector<String>& p_files); + FileSystemDock *get_scenes_dock(); SceneTreeDock *get_scene_tree_dock(); static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); } @@ -714,6 +715,8 @@ public: void update_keying(); + void reload_scene(const String& p_path); + bool is_exiting() const { return exiting; } ToolButton *get_pause_button() { return pause_button; } @@ -758,7 +761,7 @@ public: plugins_list = p_plugins_list; } - Vector<EditorPlugin*> get_plugins_list() { + Vector<EditorPlugin*>& get_plugins_list() { return plugins_list; } diff --git a/tools/editor/editor_path.cpp b/tools/editor/editor_path.cpp index 4cf98e832c..6b804b6a24 100644 --- a/tools/editor/editor_path.cpp +++ b/tools/editor/editor_path.cpp @@ -38,7 +38,6 @@ void EditorPath::_notification(int p_what) { RID ci=get_canvas_item(); Ref<Font> label_font = get_font("font","Label"); - Color label_color = get_color("font_color","Label"); Size2i size = get_size(); Ref<Texture> sn = get_icon("SmallNext","EditorIcons"); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 138e532ce8..01e6b613c0 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -27,6 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "editor_plugin.h" +#include "scene/3d/camera.h" #include "plugins/canvas_item_editor_plugin.h" #include "plugins/spatial_editor_plugin.h" #include "tools/editor/editor_node.h" diff --git a/tools/editor/editor_profiler.cpp b/tools/editor/editor_profiler.cpp index c9ee60cd54..13327f0be9 100644 --- a/tools/editor/editor_profiler.cpp +++ b/tools/editor/editor_profiler.cpp @@ -135,6 +135,8 @@ void EditorProfiler::_item_edited() { frame_delay->set_wait_time(0.1); frame_delay->start(); } + + _update_plot(); } void EditorProfiler::_update_plot() { diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 8975c0ec35..a02fe2a531 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -33,6 +33,7 @@ #include "io/resource_saver.h" #include "globals.h" #include "editor_scale.h" +#include "message_queue.h" Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String& p_path) { @@ -66,25 +67,27 @@ void EditorResourcePreview::_preview_ready(const String& p_str,const Ref<Texture String path = p_str; uint32_t hash=0; + uint64_t modified_time=0; if (p_str.begins_with("ID:")) { hash=p_str.get_slicec(':',2).to_int(); path="ID:"+p_str.get_slicec(':',1); + } else { + modified_time = FileAccess::get_modified_time(path); } Item item; item.order=order++; item.preview=p_texture; item.last_hash=hash; + item.modified_time=modified_time; cache[path]=item; - Object *recv = ObjectDB::get_instance(id); - if (recv) { - recv->call_deferred(p_func,path,p_texture,p_ud); - } - preview_mutex->unlock(); + + MessageQueue::get_singleton()->push_call(id,p_func,path,p_texture,p_ud); + } Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,const String& cache_base) { @@ -103,6 +106,7 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,co Ref<Texture> generated; for(int i=0;i<preview_generators.size();i++) { + if (!preview_generators[i]->handles(type)) continue; if (p_item.resource.is_valid()) { @@ -153,99 +157,107 @@ void EditorResourcePreview::_thread() { QueueItem item = queue.front()->get(); queue.pop_front(); - preview_mutex->unlock(); - - Ref<Texture> texture; - - //print_line("pop from queue "+item.path); - - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); - thumbnail_size*=EDSCALE; if (cache.has(item.path)) { //already has it because someone loaded it, just let it know it's ready if (item.resource.is_valid()) { item.path+=":"+itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below) } - call_deferred("_preview_ready",item.path,cache[item.path].preview,item.id,item.function,item.userdata); - - } else if (item.resource.is_valid()){ - texture=_generate_preview(item,String()); - //adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred - call_deferred("_preview_ready",item.path+":"+itos(item.resource->hash_edited_version()),texture,item.id,item.function,item.userdata); + _preview_ready(item.path,cache[item.path].preview,item.id,item.function,item.userdata); + preview_mutex->unlock(); } else { + preview_mutex->unlock(); - String temp_path=EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); - String cache_base = Globals::get_singleton()->globalize_path(item.path).md5_text(); - cache_base = temp_path.plus_file("resthumb-"+cache_base); + Ref<Texture> texture; - //does not have it, try to load a cached thumbnail + //print_line("pop from queue "+item.path); - String file = cache_base+".txt"; - //print_line("cachetxt at "+file); - FileAccess *f=FileAccess::open(file,FileAccess::READ); - if (!f) { + int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; - //print_line("generate because not cached"); - //generate - texture=_generate_preview(item,cache_base); + if (item.resource.is_valid()){ + + texture=_generate_preview(item,String()); + //adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred + _preview_ready(item.path+":"+itos(item.resource->hash_edited_version()),texture,item.id,item.function,item.userdata); + } else { - uint64_t modtime = FileAccess::get_modified_time(item.path); - int tsize = f->get_line().to_int64(); - uint64_t last_modtime = f->get_line().to_int64(); - bool cache_valid = true; + String temp_path=EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); + String cache_base = Globals::get_singleton()->globalize_path(item.path).md5_text(); + cache_base = temp_path.plus_file("resthumb-"+cache_base); - if (tsize!=thumbnail_size) { - cache_valid=false; - memdelete(f); - } else if (last_modtime!=modtime) { + //does not have it, try to load a cached thumbnail - String last_md5 = f->get_line(); - String md5 = FileAccess::get_md5(item.path); - memdelete(f); + String file = cache_base+".txt"; + //print_line("cachetxt at "+file); + FileAccess *f=FileAccess::open(file,FileAccess::READ); + if (!f) { - if (last_md5!=md5) { + //print_line("generate because not cached"); + //generate + texture=_generate_preview(item,cache_base); + } else { + + uint64_t modtime = FileAccess::get_modified_time(item.path); + int tsize = f->get_line().to_int64(); + uint64_t last_modtime = f->get_line().to_int64(); + + bool cache_valid = true; + + if (tsize!=thumbnail_size) { cache_valid=false; - } else { - //update modified time + memdelete(f); + } else if (last_modtime!=modtime) { + + String last_md5 = f->get_line(); + String md5 = FileAccess::get_md5(item.path); + memdelete(f); + + if (last_md5!=md5) { - f=FileAccess::open(file,FileAccess::WRITE); - f->store_line(itos(modtime)); - f->store_line(md5); + cache_valid=false; + } else { + //update modified time + + f=FileAccess::open(file,FileAccess::WRITE); + f->store_line(itos(modtime)); + f->store_line(md5); + memdelete(f); + } + } else { memdelete(f); } - } else { - memdelete(f); - } - if (cache_valid) { + if (cache_valid) { - texture = ResourceLoader::load(cache_base+".png","ImageTexture",true); - if (!texture.is_valid()) { - //well fuck - cache_valid=false; + texture = ResourceLoader::load(cache_base+".png","ImageTexture",true); + if (!texture.is_valid()) { + //well fuck + cache_valid=false; + } } - } - if (!cache_valid) { + if (!cache_valid) { - texture=_generate_preview(item,cache_base); - } + texture=_generate_preview(item,cache_base); + } - } + } - //print_line("notify of preview ready"); - call_deferred("_preview_ready",item.path,texture,item.id,item.function,item.userdata); + //print_line("notify of preview ready"); + _preview_ready(item.path,texture,item.id,item.function,item.userdata); + } } + } else { preview_mutex->unlock(); } @@ -263,6 +275,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource>& p preview_mutex->lock(); String path_id = "ID:"+itos(p_res->get_instance_ID()); + + if (cache.has(path_id) && cache[path_id].last_hash==p_res->hash_edited_version()) { cache[path_id].order=order++; @@ -272,6 +286,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource>& p } + cache.erase(path_id); //erase if exists, since it will be regen + //print_line("send to thread "+p_path); QueueItem item; item.function=p_receiver_func; @@ -322,6 +338,34 @@ EditorResourcePreview* EditorResourcePreview::get_singleton() { void EditorResourcePreview::_bind_methods() { ObjectTypeDB::bind_method("_preview_ready",&EditorResourcePreview::_preview_ready); + ObjectTypeDB::bind_method(_MD("check_for_invalidation","path"),&EditorResourcePreview::check_for_invalidation); + + + ADD_SIGNAL(MethodInfo("preview_invalidated",PropertyInfo(Variant::STRING,"path"))); +} + +void EditorResourcePreview::check_for_invalidation(const String& p_path) { + + preview_mutex->lock(); + + bool call_invalidated=false; + if (cache.has(p_path)) { + + uint64_t modified_time = FileAccess::get_modified_time(p_path); + if (modified_time!=cache[p_path].modified_time) { + cache.erase(p_path); + call_invalidated=true; + } + } + + preview_mutex->unlock(); + + if (call_invalidated) {//do outside mutex + call_deferred("emit_signal","preview_invalidated",p_path); + } + + + } EditorResourcePreview::EditorResourcePreview() { diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h index 63dc5c3dd3..51a00965eb 100644 --- a/tools/editor/editor_resource_preview.h +++ b/tools/editor/editor_resource_preview.h @@ -93,6 +93,7 @@ class EditorResourcePreview : public Node { Ref<Texture> preview; int order; uint32_t last_hash; + uint64_t modified_time; }; int order; @@ -106,6 +107,8 @@ class EditorResourcePreview : public Node { void _thread(); Vector<Ref<EditorResourcePreviewGenerator> > preview_generators; + + protected: static void _bind_methods(); @@ -118,6 +121,7 @@ public: void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata); void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator); + void check_for_invalidation(const String& p_path); EditorResourcePreview(); ~EditorResourcePreview(); diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp index 234dd03087..edbcc71284 100644 --- a/tools/editor/editor_run_native.cpp +++ b/tools/editor/editor_run_native.cpp @@ -101,10 +101,8 @@ void EditorRunNative::_run_native(int p_idx,const String& p_platform) { Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform); ERR_FAIL_COND(eep.is_null()); - if (deploy_debug_remote) { - emit_signal("native_run"); + emit_signal("native_run"); - } int flags=0; if (deploy_debug_remote) flags|=EditorExportPlatform::EXPORT_REMOTE_DEBUG; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index b89863289a..9dcf71e256 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -104,12 +104,17 @@ bool EditorSettings::_get(const StringName& p_name,Variant &r_ret) const { for (const Map<String,Ref<ShortCut> >::Element *E=shortcuts.front();E;E=E->next()) { Ref<ShortCut> sc=E->get(); - if (!sc->has_meta("original")) - continue; //this came from settings but is not any longer used - InputEvent original = sc->get_meta("original"); - if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE)) - continue; //not changed from default, don't save + if (optimize_save) { + if (!sc->has_meta("original")) { + continue; //this came from settings but is not any longer used + } + + InputEvent original = sc->get_meta("original"); + if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE)) + continue; //not changed from default, don't save + } + arr.push_back(E->key()); arr.push_back(sc->get_shortcut()); } @@ -161,7 +166,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const { for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) { int pinfo = 0; - if (E->get().save) { + if (E->get().save || !optimize_save) { pinfo|=PROPERTY_USAGE_STORAGE; } @@ -549,6 +554,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); + set("text_editor/block_caret", false); set("text_editor/caret_blink", false); set("text_editor/caret_blink_speed", 0.65); hints["text_editor/caret_blink_speed"]=PropertyInfo(Variant::REAL,"text_editor/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1, 10, 0.1"); @@ -605,8 +611,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("on_save/compress_binary_resources",true); set("on_save/save_modified_external_resources",true); - set("on_save/save_paths_as_relative",false); - set("on_save/save_paths_without_extension",false); + //set("on_save/save_paths_as_relative",false); + //set("on_save/save_paths_without_extension",false); set("text_editor/create_signal_callbacks",true); @@ -677,7 +683,10 @@ void EditorSettings::_load_default_text_editor_theme() { set("text_editor/completion_background_color", Color::html("2C2A32")); set("text_editor/completion_selected_color", Color::html("434244")); set("text_editor/completion_existing_color", Color::html("21dfdfdf")); + set("text_editor/completion_scroll_color", Color::html("ffffff")); + set("text_editor/completion_font_color", Color::html("aaaaaa")); set("text_editor/caret_color",Color::html("aaaaaa")); + set("text_editor/caret_background_color", Color::html("000000")); set("text_editor/line_number_color",Color::html("66aaaaaa")); set("text_editor/text_color",Color::html("aaaaaa")); set("text_editor/text_selected_color",Color::html("000000")); @@ -912,7 +921,10 @@ bool EditorSettings::_save_text_editor_theme(String p_file) { cf->set_value(theme_section, "completion_background_color", ((Color)get("text_editor/completion_background_color")).to_html()); cf->set_value(theme_section, "completion_selected_color", ((Color)get("text_editor/completion_selected_color")).to_html()); cf->set_value(theme_section, "completion_existing_color", ((Color)get("text_editor/completion_existing_color")).to_html()); + cf->set_value(theme_section, "completion_scroll_color", ((Color)get("text_editor/completion_scroll_color")).to_html()); + cf->set_value(theme_section, "completion_font_color", ((Color)get("text_editor/completion_font_color")).to_html()); cf->set_value(theme_section, "caret_color", ((Color)get("text_editor/caret_color")).to_html()); + cf->set_value(theme_section, "caret_background_color", ((Color)get("text_editor/caret_background_color")).to_html()); cf->set_value(theme_section, "line_number_color", ((Color)get("text_editor/line_number_color")).to_html()); cf->set_value(theme_section, "text_color", ((Color)get("text_editor/text_color")).to_html()); cf->set_value(theme_section, "text_selected_color", ((Color)get("text_editor/text_selected_color")).to_html()); @@ -976,6 +988,10 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) { } } +void EditorSettings::set_optimize_save(bool p_optimize) { + + optimize_save=p_optimize; +} void EditorSettings::_bind_methods() { @@ -998,6 +1014,7 @@ EditorSettings::EditorSettings() { //singleton=this; last_order=0; + optimize_save=true; save_changed_setting=true; EditorTranslationList *etl=_editor_translations; diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index d975a7ef86..937956a366 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -88,6 +88,7 @@ private: bool save_changed_setting; + bool optimize_save; //do not save stuff that came from config but was not set from engine void _load_defaults(Ref<ConfigFile> p_extra_config = NULL); void _load_default_text_editor_theme(); @@ -155,6 +156,8 @@ public: Ref<ShortCut> get_shortcut(const String&p_name) const; void get_shortcut_list(List<String> *r_shortcuts); + void set_optimize_save(bool p_optimize); + EditorSettings(); ~EditorSettings(); diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/filesystem_dock.cpp index cbd7df9d18..378edd6667 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "scenes_dock.h" +#include "filesystem_dock.h" #include "os/dir_access.h" #include "os/file_access.h" #include "globals.h" @@ -37,7 +37,9 @@ #include "editor_settings.h" #include "scene/main/viewport.h" -bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) { + + +bool FileSystemDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) { TreeItem *item = tree->create_item(p_parent); @@ -57,66 +59,14 @@ bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_di item->select(0); } - - //item->set_custom_bg_color(0,get_color("prop_subsection","Editor")); - - bool has_items=false; - - for(int i=0;i<p_dir->get_subdir_count();i++) { - - if (_create_tree(item,p_dir->get_subdir(i))) - has_items=true; - } -#if 0 - for (int i=0;i<p_dir->get_file_count();i++) { - - String file_name = p_dir->get_file(i); - String file_path = p_dir->get_file_path(i); - - // ScenesDockFilter::FILTER_PATH - String search_from = file_path.right(6); // trim "res://" - if (file_filter == ScenesDockFilter::FILTER_NAME) - search_from = file_name; - else if (file_filter == ScenesDockFilter::FILTER_FOLDER) - search_from = file_path.right(6).get_base_dir(); - - if (search_term!="" && search_from.findn(search_term)==-1) - continue; - - bool isfave = favorites.has(file_path); - if (button_favorite->is_pressed() && !isfave) - continue; - - TreeItem *fitem = tree->create_item(item); - fitem->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); - fitem->set_editable(0,true); - fitem->set_checked(0,isfave); - fitem->set_text(0,file_name); - - Ref<Texture> icon = get_icon( (has_icon(p_dir->get_file_type(i),"EditorIcons")?p_dir->get_file_type(i):String("Object")),"EditorIcons"); - fitem->set_icon(0, icon ); - - - fitem->set_metadata(0,file_path); - //if (p_dir->files[i]->icon.is_valid()) { -// fitem->set_icon(0,p_dir->files[i]->icon); -// } - has_items=true; - - } -#endif - /*if (!has_items) { - - memdelete(item); - return false; - - }*/ + for(int i=0;i<p_dir->get_subdir_count();i++) + _create_tree(item,p_dir->get_subdir(i)); return true; } -void ScenesDock::_update_tree() { +void FileSystemDock::_update_tree() { tree->clear(); updating_tree=true; @@ -147,7 +97,7 @@ void ScenesDock::_update_tree() { } -void ScenesDock::_notification(int p_what) { +void FileSystemDock::_notification(int p_what) { switch(p_what) { @@ -164,12 +114,14 @@ void ScenesDock::_notification(int p_what) { if (split_mode) { file_list_vb->hide(); + tree->set_custom_minimum_size(Size2(0,0)); tree->set_v_size_flags(SIZE_EXPAND_FILL); button_back->show(); } else { tree->show(); file_list_vb->show(); + tree->set_custom_minimum_size(Size2(0,200)*EDSCALE); tree->set_v_size_flags(SIZE_FILL); button_back->hide(); if (!EditorFileSystem::get_singleton()->is_scanning()) { @@ -187,6 +139,7 @@ void ScenesDock::_notification(int p_what) { initialized=true; EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"_fs_changed"); + EditorResourcePreview::get_singleton()->connect("preview_invalidated",this,"_preview_invalidated"); button_reload->set_icon( get_icon("Reload","EditorIcons")); button_favorite->set_icon( get_icon("Favorites","EditorIcons")); @@ -255,7 +208,7 @@ void ScenesDock::_notification(int p_what) { -void ScenesDock::_dir_selected() { +void FileSystemDock::_dir_selected() { TreeItem *ti = tree->get_selected(); if (!ti) @@ -288,7 +241,7 @@ void ScenesDock::_dir_selected() { } -void ScenesDock::_favorites_pressed() { +void FileSystemDock::_favorites_pressed() { TreeItem *sel = tree->get_selected(); if (!sel) @@ -317,7 +270,7 @@ void ScenesDock::_favorites_pressed() { } -String ScenesDock::get_selected_path() const { +String FileSystemDock::get_selected_path() const { TreeItem *sel = tree->get_selected(); if (!sel) @@ -326,12 +279,12 @@ String ScenesDock::get_selected_path() const { return "res://"+path; } -String ScenesDock::get_current_path() const { +String FileSystemDock::get_current_path() const { return path; } -void ScenesDock::_thumbnail_done(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata) { +void FileSystemDock::_thumbnail_done(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata) { bool valid=false; @@ -359,7 +312,7 @@ void ScenesDock::_thumbnail_done(const String& p_path,const Ref<Texture>& p_prev } -void ScenesDock::_change_file_display() { +void FileSystemDock::_change_file_display() { if (display_mode->is_pressed()) { display_mode->set_icon( get_icon("FileThumbnail","EditorIcons")); @@ -371,7 +324,7 @@ void ScenesDock::_change_file_display() { _update_files(true); } -void ScenesDock::_search(EditorFileSystemDirectory *p_path,List<FileInfo>* matches,int p_max_items) { +void FileSystemDock::_search(EditorFileSystemDirectory *p_path,List<FileInfo>* matches,int p_max_items) { if (matches->size()>p_max_items) return; @@ -418,7 +371,7 @@ void ScenesDock::_search(EditorFileSystemDirectory *p_path,List<FileInfo>* match } } -void ScenesDock::_update_files(bool p_keep_selection) { +void FileSystemDock::_update_files(bool p_keep_selection) { Set<String> cselection; @@ -631,13 +584,13 @@ void ScenesDock::_update_files(bool p_keep_selection) { } -void ScenesDock::_select_file(int p_idx) { +void FileSystemDock::_select_file(int p_idx) { files->select(p_idx,true); _file_option(FILE_OPEN); } -void ScenesDock::_go_to_tree() { +void FileSystemDock::_go_to_tree() { tree->show(); file_list_vb->hide(); @@ -649,7 +602,7 @@ void ScenesDock::_go_to_tree() { //file_options->hide(); } -void ScenesDock::_go_to_dir(const String& p_dir){ +void FileSystemDock::_go_to_dir(const String& p_dir){ DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); if (da->change_dir(p_dir)==OK) { @@ -661,7 +614,28 @@ void ScenesDock::_go_to_dir(const String& p_dir){ } -void ScenesDock::_fs_changed() { + +void FileSystemDock::_preview_invalidated(const String& p_path) { + + if (p_path.get_base_dir()==path && search_box->get_text()==String() && file_list_vb->is_visible()) { + + + for(int i=0;i<files->get_item_count();i++) { + + if (files->get_item_metadata(i)==p_path) { + //re-request preview + Array udata; + udata.resize(2); + udata[0]=i; + udata[1]=files->get_item_text(i); + EditorResourcePreview::get_singleton()->queue_resource_preview(p_path,this,"_thumbnail_done",udata); + break; + } + } + } +} + +void FileSystemDock::_fs_changed() { button_hist_prev->set_disabled(history_pos==0); button_hist_next->set_disabled(history_pos+1==history.size()); @@ -682,7 +656,7 @@ void ScenesDock::_fs_changed() { set_process(false); } -void ScenesDock::_set_scannig_mode() { +void FileSystemDock::_set_scannig_mode() { split_box->hide(); button_hist_prev->set_disabled(true); @@ -697,7 +671,7 @@ void ScenesDock::_set_scannig_mode() { } -void ScenesDock::_fw_history() { +void FileSystemDock::_fw_history() { if (history_pos<history.size()-1) history_pos++; @@ -721,7 +695,7 @@ void ScenesDock::_fw_history() { } -void ScenesDock::_bw_history() { +void FileSystemDock::_bw_history() { if (history_pos>0) history_pos--; @@ -745,7 +719,7 @@ void ScenesDock::_bw_history() { } -void ScenesDock::_push_to_history() { +void FileSystemDock::_push_to_history() { history.resize(history_pos+1); if (history[history_pos]!=path) { @@ -759,7 +733,7 @@ void ScenesDock::_push_to_history() { } -void ScenesDock::_find_inside_move_files(EditorFileSystemDirectory *efsd,Vector<String>& files) { +void FileSystemDock::_find_inside_move_files(EditorFileSystemDirectory *efsd,Vector<String>& files) { for(int i=0;i<efsd->get_subdir_count();i++) { _find_inside_move_files(efsd->get_subdir(i),files); @@ -770,7 +744,7 @@ void ScenesDock::_find_inside_move_files(EditorFileSystemDirectory *efsd,Vector< } -void ScenesDock::_find_remaps(EditorFileSystemDirectory *efsd,Map<String,String> &renames,List<String>& to_remaps) { +void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd,Map<String,String> &renames,List<String>& to_remaps) { for(int i=0;i<efsd->get_subdir_count();i++) { _find_remaps(efsd->get_subdir(i),renames,to_remaps); @@ -787,7 +761,7 @@ void ScenesDock::_find_remaps(EditorFileSystemDirectory *efsd,Map<String,String> } -void ScenesDock::_rename_operation(const String& p_to_path) { +void FileSystemDock::_rename_operation(const String& p_to_path) { if (move_files[0]==p_to_path) { EditorNode::get_singleton()->show_warning(TTR("Same source and destination files, doing nothing.")); @@ -834,7 +808,7 @@ void ScenesDock::_rename_operation(const String& p_to_path) { } -void ScenesDock::_move_operation(const String& p_to_path) { +void FileSystemDock::_move_operation(const String& p_to_path) { if (p_to_path==path) { EditorNode::get_singleton()->show_warning(TTR("Same source and destination paths, doing nothing.")); @@ -927,7 +901,7 @@ void ScenesDock::_move_operation(const String& p_to_path) { } -void ScenesDock::_file_option(int p_option) { +void FileSystemDock::_file_option(int p_option) { switch(p_option) { @@ -976,13 +950,20 @@ void ScenesDock::_file_option(int p_option) { } break; case FILE_INSTANCE: { - for (int i = 0; i<files->get_item_count(); i++) { + Vector<String> paths; + for (int i = 0; i<files->get_item_count(); i++) { + if (!files->is_selected(i)) + continue; String path =files->get_item_metadata(i); if (EditorFileSystem::get_singleton()->get_file_type(path)=="PackedScene") { - emit_signal("instance",path); + paths.push_back(path); } } + + if (!paths.empty()) { + emit_signal("instance", paths); + } } break; case FILE_DEPENDENCIES: { @@ -1111,7 +1092,7 @@ void ScenesDock::_file_option(int p_option) { } } -void ScenesDock::_open_pressed(){ +void FileSystemDock::_open_pressed(){ TreeItem *sel = tree->get_selected(); @@ -1142,7 +1123,7 @@ void ScenesDock::_open_pressed(){ } -void ScenesDock::_search_changed(const String& p_text) { +void FileSystemDock::_search_changed(const String& p_text) { if (!search_box->is_visible()) return; //wtf @@ -1150,29 +1131,29 @@ void ScenesDock::_search_changed(const String& p_text) { _update_files(false); } -void ScenesDock::_rescan() { +void FileSystemDock::_rescan() { _set_scannig_mode(); EditorFileSystem::get_singleton()->scan(); } -void ScenesDock::fix_dependencies(const String& p_for_file) { +void FileSystemDock::fix_dependencies(const String& p_for_file) { deps_editor->edit(p_for_file); } -void ScenesDock::focus_on_filter() { +void FileSystemDock::focus_on_filter() { } -void ScenesDock::set_use_thumbnails(bool p_use) { +void FileSystemDock::set_use_thumbnails(bool p_use) { display_mode->set_pressed(!p_use); } -Variant ScenesDock::get_drag_data_fw(const Point2& p_point,Control* p_from) { +Variant FileSystemDock::get_drag_data_fw(const Point2& p_point,Control* p_from) { if (p_from==tree) { @@ -1249,7 +1230,7 @@ Variant ScenesDock::get_drag_data_fw(const Point2& p_point,Control* p_from) { return Variant(); } -bool ScenesDock::can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const{ +bool FileSystemDock::can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const{ Dictionary drag_data = p_data; @@ -1315,7 +1296,7 @@ bool ScenesDock::can_drop_data_fw(const Point2& p_point,const Variant& p_data,Co return false; } -void ScenesDock::drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from){ +void FileSystemDock::drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from){ if (!can_drop_data_fw(p_point,p_data,p_from)) return; @@ -1467,7 +1448,7 @@ void ScenesDock::drop_data_fw(const Point2& p_point,const Variant& p_data,Contro } -void ScenesDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) { +void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) { Vector<String> filenames; @@ -1590,40 +1571,43 @@ void ScenesDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) { } -void ScenesDock::_bind_methods() { +void FileSystemDock::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_update_tree"),&ScenesDock::_update_tree); - ObjectTypeDB::bind_method(_MD("_rescan"),&ScenesDock::_rescan); - ObjectTypeDB::bind_method(_MD("_favorites_pressed"),&ScenesDock::_favorites_pressed); + ObjectTypeDB::bind_method(_MD("_update_tree"),&FileSystemDock::_update_tree); + ObjectTypeDB::bind_method(_MD("_rescan"),&FileSystemDock::_rescan); + ObjectTypeDB::bind_method(_MD("_favorites_pressed"),&FileSystemDock::_favorites_pressed); // ObjectTypeDB::bind_method(_MD("_instance_pressed"),&ScenesDock::_instance_pressed); - ObjectTypeDB::bind_method(_MD("_open_pressed"),&ScenesDock::_open_pressed); - - ObjectTypeDB::bind_method(_MD("_thumbnail_done"),&ScenesDock::_thumbnail_done); - ObjectTypeDB::bind_method(_MD("_select_file"), &ScenesDock::_select_file); - ObjectTypeDB::bind_method(_MD("_go_to_tree"), &ScenesDock::_go_to_tree); - ObjectTypeDB::bind_method(_MD("_go_to_dir"), &ScenesDock::_go_to_dir); - ObjectTypeDB::bind_method(_MD("_change_file_display"), &ScenesDock::_change_file_display); - ObjectTypeDB::bind_method(_MD("_fw_history"), &ScenesDock::_fw_history); - ObjectTypeDB::bind_method(_MD("_bw_history"), &ScenesDock::_bw_history); - ObjectTypeDB::bind_method(_MD("_fs_changed"), &ScenesDock::_fs_changed); - ObjectTypeDB::bind_method(_MD("_dir_selected"), &ScenesDock::_dir_selected); - ObjectTypeDB::bind_method(_MD("_file_option"), &ScenesDock::_file_option); - ObjectTypeDB::bind_method(_MD("_move_operation"), &ScenesDock::_move_operation); - ObjectTypeDB::bind_method(_MD("_rename_operation"), &ScenesDock::_rename_operation); - - ObjectTypeDB::bind_method(_MD("_search_changed"), &ScenesDock::_search_changed); - - ObjectTypeDB::bind_method(_MD("get_drag_data_fw"), &ScenesDock::get_drag_data_fw); - ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &ScenesDock::can_drop_data_fw); - ObjectTypeDB::bind_method(_MD("drop_data_fw"), &ScenesDock::drop_data_fw); - ObjectTypeDB::bind_method(_MD("_files_list_rmb_select"),&ScenesDock::_files_list_rmb_select); - - ADD_SIGNAL(MethodInfo("instance")); + ObjectTypeDB::bind_method(_MD("_open_pressed"),&FileSystemDock::_open_pressed); + + ObjectTypeDB::bind_method(_MD("_thumbnail_done"),&FileSystemDock::_thumbnail_done); + ObjectTypeDB::bind_method(_MD("_select_file"), &FileSystemDock::_select_file); + ObjectTypeDB::bind_method(_MD("_go_to_tree"), &FileSystemDock::_go_to_tree); + ObjectTypeDB::bind_method(_MD("_go_to_dir"), &FileSystemDock::_go_to_dir); + ObjectTypeDB::bind_method(_MD("_change_file_display"), &FileSystemDock::_change_file_display); + ObjectTypeDB::bind_method(_MD("_fw_history"), &FileSystemDock::_fw_history); + ObjectTypeDB::bind_method(_MD("_bw_history"), &FileSystemDock::_bw_history); + ObjectTypeDB::bind_method(_MD("_fs_changed"), &FileSystemDock::_fs_changed); + ObjectTypeDB::bind_method(_MD("_dir_selected"), &FileSystemDock::_dir_selected); + ObjectTypeDB::bind_method(_MD("_file_option"), &FileSystemDock::_file_option); + ObjectTypeDB::bind_method(_MD("_move_operation"), &FileSystemDock::_move_operation); + ObjectTypeDB::bind_method(_MD("_rename_operation"), &FileSystemDock::_rename_operation); + + ObjectTypeDB::bind_method(_MD("_search_changed"), &FileSystemDock::_search_changed); + + ObjectTypeDB::bind_method(_MD("get_drag_data_fw"), &FileSystemDock::get_drag_data_fw); + ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &FileSystemDock::can_drop_data_fw); + ObjectTypeDB::bind_method(_MD("drop_data_fw"), &FileSystemDock::drop_data_fw); + ObjectTypeDB::bind_method(_MD("_files_list_rmb_select"),&FileSystemDock::_files_list_rmb_select); + + ObjectTypeDB::bind_method(_MD("_preview_invalidated"),&FileSystemDock::_preview_invalidated); + + + ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::STRING_ARRAY, "files"))); ADD_SIGNAL(MethodInfo("open")); } -ScenesDock::ScenesDock(EditorNode *p_editor) { +FileSystemDock::FileSystemDock(EditorNode *p_editor) { editor=p_editor; @@ -1702,7 +1686,6 @@ ScenesDock::ScenesDock(EditorNode *p_editor) { tree->set_hide_root(true); split_box->add_child(tree); - tree->set_custom_minimum_size(Size2(0,200)*EDSCALE); tree->set_drag_forwarding(this); @@ -1790,6 +1773,6 @@ ScenesDock::ScenesDock(EditorNode *p_editor) { add_constant_override("separation",3); } -ScenesDock::~ScenesDock() { +FileSystemDock::~FileSystemDock() { } diff --git a/tools/editor/scenes_dock.h b/tools/editor/filesystem_dock.h index ed24711abb..171dbd16e9 100644 --- a/tools/editor/scenes_dock.h +++ b/tools/editor/filesystem_dock.h @@ -26,8 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef SCENES_DOCK_H -#define SCENES_DOCK_H +#ifndef FILESYSTEM_DOCK_H +#define FILESYSTEM_DOCK_H #include "scene/main/timer.h" #include "scene/gui/control.h" @@ -51,8 +51,8 @@ class EditorNode; -class ScenesDock : public VBoxContainer { - OBJ_TYPE( ScenesDock, VBoxContainer ); +class FileSystemDock : public VBoxContainer { + OBJ_TYPE( FileSystemDock, VBoxContainer ); enum FileMenu { FILE_OPEN, @@ -168,6 +168,8 @@ class ScenesDock : public VBoxContainer { 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); + void _preview_invalidated(const String& p_path); + protected: void _notification(int p_what); static void _bind_methods(); @@ -182,8 +184,8 @@ public: void set_use_thumbnails(bool p_use); - ScenesDock(EditorNode *p_editor); - ~ScenesDock(); + FileSystemDock(EditorNode *p_editor); + ~FileSystemDock(); }; diff --git a/tools/editor/groups_editor.cpp b/tools/editor/groups_editor.cpp index 898e1e115e..5b7bc1da78 100644 --- a/tools/editor/groups_editor.cpp +++ b/tools/editor/groups_editor.cpp @@ -31,7 +31,7 @@ #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "editor_node.h" - +#include "scene/resources/packed_scene.h" void GroupsEditor::_add_group(const String& p_group) { if (!node) @@ -107,9 +107,35 @@ void GroupsEditor::update_tree() { if (!gi.persistent) continue; + Node *n = node; + bool can_be_deleted=true; + + while(n) { + + Ref<SceneState> ss = (n==EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state(); + + if (ss.is_valid()) { + + int path = ss->find_node_by_path(n->get_path_to(node)); + if (path!=-1) { + if (ss->is_node_in_group(path,gi.name)) { + can_be_deleted=false; + } + } + } + + n=n->get_owner(); + } + + TreeItem *item=tree->create_item(root); item->set_text(0, gi.name); - item->add_button(0, get_icon("Remove", "EditorIcons"), 0); + if (can_be_deleted) { + item->add_button(0, get_icon("Remove", "EditorIcons"), 0); + } else { + item->set_selectable(0,false); + } + } } diff --git a/tools/editor/icons/2x/icon_group.png b/tools/editor/icons/2x/icon_group.png Binary files differindex 062e1bf3fe..158efa5fe4 100644 --- a/tools/editor/icons/2x/icon_group.png +++ b/tools/editor/icons/2x/icon_group.png diff --git a/tools/editor/icons/2x/icon_object.png b/tools/editor/icons/2x/icon_object.png Binary files differindex 36ac3457bf..dc0a94aacd 100644 --- a/tools/editor/icons/2x/icon_object.png +++ b/tools/editor/icons/2x/icon_object.png diff --git a/tools/editor/icons/2x/icon_ungroup.png b/tools/editor/icons/2x/icon_ungroup.png Binary files differindex 8aaccb40a1..bb46185370 100644 --- a/tools/editor/icons/2x/icon_ungroup.png +++ b/tools/editor/icons/2x/icon_ungroup.png diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 7132968c88..f2f5dcca48 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -65,7 +65,7 @@ def make_editor_icons_action(target, source, env): s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") s.write("\tImage img((editor_is_hidpi()&&p_hidpi_png)?p_hidpi_png:p_png);\n") - s.write("\tif (editor_is_hidpi() && !p_hidpi_png) img.expand_x2_hq2x();\n") + s.write("\tif (editor_is_hidpi() && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); }\n") s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") s.write("\treturn texture;\n") s.write("}\n\n") diff --git a/tools/editor/icons/icon_group.png b/tools/editor/icons/icon_group.png Binary files differindex e45ba2d892..5ffc90455e 100644 --- a/tools/editor/icons/icon_group.png +++ b/tools/editor/icons/icon_group.png diff --git a/tools/editor/icons/icon_object.png b/tools/editor/icons/icon_object.png Binary files differindex 7aef54bc05..f4f018c863 100644 --- a/tools/editor/icons/icon_object.png +++ b/tools/editor/icons/icon_object.png diff --git a/tools/editor/icons/icon_ungroup.png b/tools/editor/icons/icon_ungroup.png Binary files differindex 9553ef5654..b4c2e01814 100644 --- a/tools/editor/icons/icon_ungroup.png +++ b/tools/editor/icons/icon_ungroup.png diff --git a/tools/editor/icons/source/icon_group.svg b/tools/editor/icons/source/icon_group.svg index bccb23ade3..c8d20af9dd 100644 --- a/tools/editor/icons/source/icon_group.svg +++ b/tools/editor/icons/source/icon_group.svg @@ -15,7 +15,7 @@ id="svg2" version="1.1" inkscape:version="0.91 r13725" - inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_node.png" + inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_ungroup.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="icon_group.svg"> @@ -28,9 +28,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="31.999999" - inkscape:cx="6.3400278" - inkscape:cy="8.8086774" + inkscape:zoom="22.627417" + inkscape:cx="10.459761" + inkscape:cy="9.5219725" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -46,7 +46,11 @@ inkscape:window-height="1016" inkscape:window-x="0" inkscape:window-y="27" - inkscape:window-maximized="1"> + inkscape:window-maximized="1" + inkscape:snap-midpoints="false" + inkscape:snap-smooth-nodes="false" + inkscape:object-nodes="false" + showguides="false"> <inkscape:grid type="xygrid" id="grid3336" @@ -70,9 +74,1044 @@ id="layer1" transform="translate(0,-1036.3622)"> <path - style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - d="M 8 1 C 4.1340068 1 1 4.134 1 8 C 1 11.866 4.1340068 15 8 15 C 11.865993 15 15 11.866 15 8 C 15 4.134 11.865993 1 8 1 z M 8 3 A 2 2 0 0 1 10 5 A 2 2 0 0 1 8 7 A 2 2 0 0 1 6 5 A 2 2 0 0 1 8 3 z M 5 8 A 2 2 0 0 1 7 10 A 2 2 0 0 1 5 12 A 2 2 0 0 1 3 10 A 2 2 0 0 1 5 8 z M 11 8 A 2 2 0 0 1 13 10 A 2 2 0 0 1 11 12 A 2 2 0 0 1 9 10 A 2 2 0 0 1 11 8 z " - transform="translate(0,1036.3622)" - id="path4154" /> + style="opacity:1;fill:#e0e0e0;fill-opacity:0.39215687;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="M 7 1 L 7 3 L 7 7 L 3 7 C 3 6.9999766 2.554 7 2 7 C 1.446 7 1 6.9999766 1 7 L 1 9 L 1 13 C 1 13.000023 1.446 13 2 13 C 2.554 13 3 13.000023 3 13 L 3 9 L 7 9 L 7 13 L 3 13 C 2.9999766 13 3 13.446 3 14 C 3 14.554 2.9999766 15 3 15 L 7 15 C 7 15.000023 7.446 15 8 15 C 8.554 15 9 15.000023 9 15 L 9 13 L 9 9 L 13 9 C 13 9.0000234 13.446 9 14 9 C 14.554 9 15 9.0000234 15 9 L 15 7 L 15 3 C 15 2.9999766 14.554 3 14 3 C 13.446 3 13 2.9999766 13 3 L 13 7 L 9 7 L 9 3 L 13 3 C 13.000023 3 13 2.554 13 2 C 13 1.446 13.000023 1 13 1 L 9 1 C 9 0.99997659 8.554 1 8 1 C 7.446 1 7 0.99997659 7 1 z " + id="rect4697" + transform="translate(0,1036.3622)" /> + <rect + ry="4.3456585e-05" + rx="4.5000234" + y="996.36218" + x="-20.000004" + height="15.999995" + width="36.000008" + id="rect4379" + style="opacity:1;fill:#4b4b4b;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="8.6913296e-06" + rx="24" + y="17.999989" + x="998.36218" + height="1" + width="12" + id="rect4153" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4151" + width="12" + height="1" + x="-17.999989" + y="997.36218" + rx="24" + ry="8.6913296e-06" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4155" + width="12" + height="1" + x="998.36218" + y="4.99999" + rx="24" + ry="8.6913296e-06" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="8.6913296e-06" + rx="24" + y="1010.3622" + x="-17.999989" + height="1" + width="12" + id="rect4157" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4159" + width="4.9999809" + height="1.0000036" + x="1003.3622" + y="15.999995" + rx="9.9999619" + ry="8.6913606e-06" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="4.3456628e-05" + rx="2.0000134" + y="11.000003" + x="1002.3622" + height="4.9999976" + width="1.0000067" + id="rect4161" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="8.6913606e-06" + rx="9.9999619" + y="9.9999886" + x="1003.3622" + height="1.0000036" + width="4.9999809" + id="rect4163" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4165" + width="1.0000067" + height="4.9999976" + x="1008.3622" + y="11.000002" + rx="2.0000134" + ry="4.3456628e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4167" + sodipodi:type="arc" + sodipodi:cx="-17.999989" + sodipodi:cy="998.36218" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -17.999989,999.36218 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m 5.9999948,999.36218 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.8660254,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="998.36218" + sodipodi:cx="5.9999948" + sodipodi:type="arc" + id="path4169" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(-1,1)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + transform="scale(-1,1)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4171" + sodipodi:type="arc" + sodipodi:cx="5.9999948" + sodipodi:cy="1010.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 5.9999948,1011.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.8660254,-0.5 l 0,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m -17.999994,1011.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1010.3622" + sodipodi:cx="-17.999994" + sodipodi:type="arc" + id="path4173" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4175" + sodipodi:type="arc" + sodipodi:cx="-15.999995" + sodipodi:cy="1008.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -15.999995,1009.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m -15.999995,1004.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1003.3622" + sodipodi:cx="-15.999995" + sodipodi:type="arc" + id="path4177-3" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m 10.999986,1009.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1008.3622" + sodipodi:cx="10.999986" + sodipodi:type="arc" + id="path4179-6" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(-1,1)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4181" + sodipodi:type="arc" + sodipodi:cx="10.999986" + sodipodi:cy="1003.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 10.999986,1004.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + transform="scale(-1,1)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + inkscape:connector-curvature="0" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m -12.99999,999.36232 a 1,1 0 0 0 -0.865235,0.5 1,1 0 0 0 -0.134765,0.52348 l 0,0.9765 c 0.361502,0 0.445997,0 1,0 l 0,-1 5,0 0,1 0,1.5 0,2.5 -1,0 0,1 1,0 a 1,1 0 0 0 0.865234,-0.5 1,1 0 0 0 0.134766,-0.5 l 0,-2.5 0,-2.4765 a 1,1 0 0 0 0,-0.024 1,1 0 0 0 -0.134766,-0.49998 1,1 0 0 0 -0.865234,-0.5 l -5,-10e-5 z" + id="rect4183" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="8.6913606e-06" + rx="9.9999619" + y="-4.0000043" + x="1003.3622" + height="1.0000036" + width="4.9999809" + id="rect4389" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4391" + width="1.0000067" + height="4.9999976" + x="1002.3622" + y="-8.9999962" + rx="2.0000134" + ry="4.3456628e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4393" + width="4.9999809" + height="1.0000036" + x="1003.3622" + y="-10.00001" + rx="9.9999619" + ry="8.6913606e-06" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="4.3456628e-05" + rx="2.0000134" + y="-8.9999971" + x="1008.3622" + height="4.9999976" + width="1.0000067" + id="rect4395" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m 4.0000043,1009.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.8660254,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1008.3622" + sodipodi:cx="4.0000043" + sodipodi:type="arc" + id="path4405" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4407" + sodipodi:type="arc" + sodipodi:cx="4.0000043" + sodipodi:cy="1003.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 4.0000043,1004.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.8660254,-0.5 l 0,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + transform="scale(-1,1)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4409" + sodipodi:type="arc" + sodipodi:cx="-9.0000134" + sodipodi:cy="1008.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -9.0000133,1009.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 -10e-8,-1 1,1 0 0 1 0.8660255,-0.5 l -10e-8,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + transform="scale(-1,1)" + d="m -9.0000133,1004.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 -10e-8,-1 1,1 0 0 1 0.8660255,-0.5 l -10e-8,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1003.3622" + sodipodi:cx="-9.0000134" + sodipodi:type="arc" + id="path4411" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + id="path4413" + d="m 7.0000094,999.36232 a 1,1 0 0 0 -0.865235,0.5 1,1 0 0 0 -0.134765,0.52348 l 0,0.9765 c 0.361502,0 0.445997,0 1,0 l 0,-1 5.0000006,0 0,1 0,1.5 0,2.5 -1,0 0,1 1,0 a 1,1 0 0 0 0.865234,-0.5 1,1 0 0 0 0.134766,-0.5 l 0,-2.5 0,-2.4765 a 1,1 0 0 0 0,-0.024 1,1 0 0 0 -0.134766,-0.49998 1,1 0 0 0 -0.865234,-0.5 l -5.0000006,-10e-5 z" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#4b4b4b;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4415" + width="36.000008" + height="15.999995" + x="-19.999994" + y="1012.3622" + rx="4.5000234" + ry="4.3456585e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m -16.000053,1020.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1019.3622" + sodipodi:cx="-16.000053" + sodipodi:type="arc" + id="path4417" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m 11.000043,1025.3622 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1024.3622" + sodipodi:cx="11.000043" + sodipodi:type="arc" + id="path4419" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(-1,1)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4421" + width="2" + height="5" + x="-19.000053" + y="1020.3622" + rx="2.00001" + ry="4.3456599e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="1.7382426e-05" + rx="5.000021" + y="1018.3622" + x="-17.00005" + height="1.9999754" + width="4.9999962" + id="rect4423" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="4.3456599e-05" + rx="2.00001" + y="1020.3622" + x="-12.000043" + height="5" + width="2" + id="rect4425" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4427" + width="2" + height="5" + x="1025.3622" + y="12.000043" + rx="2.00001" + ry="4.3456599e-05" + transform="matrix(0,1,-1,0,0,0)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4429" + sodipodi:type="arc" + sodipodi:cx="-17.000048" + sodipodi:cy="1020.3622" + sodipodi:rx="2" + sodipodi:ry="2" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -17.000048,1022.3622 a 2,2 0 0 1 -1.73205,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.73205,-1 l 0,2 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m -17.000048,1027.3622 a 2,2 0 0 1 -1.73205,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.73205,-1 l 0,2 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="2" + sodipodi:rx="2" + sodipodi:cy="1025.3622" + sodipodi:cx="-17.000048" + sodipodi:type="arc" + id="path4431" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m 12.000043,1022.3622 a 2,2 0 0 1 -1.732051,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.732051,-1 l 0,2 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="2" + sodipodi:rx="2" + sodipodi:cy="1020.3622" + sodipodi:cx="12.000043" + sodipodi:type="arc" + id="path4433" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(-1,1)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4435" + sodipodi:type="arc" + sodipodi:cx="12.000043" + sodipodi:cy="1025.3622" + sodipodi:rx="2" + sodipodi:ry="2" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 12.000043,1027.3622 a 2,2 0 0 1 -1.732051,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.732051,-1 l 0,2 z" + transform="scale(-1,1)" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + inkscape:connector-curvature="0" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m -12.000048,1013.3622 a 2,2 0 0 0 -1.732422,1 2,2 0 0 0 -0.265625,1 l -0.0019,0 0,1 2,0 0,-1 2.5000001,0 2.5,0 0,3 0,2 -1,0 0,2 1,0 a 2,2 0 0 0 1.732422,-1 2,2 0 0 0 0.265625,-1 l 0.002,0 0,-5 -0.002,0 a 2,2 0 0 0 -0.265625,-1 2,2 0 0 0 -1.732422,-1 l -2.5,0 -2.5000001,0 z" + id="path4437" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + inkscape:connector-curvature="0" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m -17.000048,1013.3622 a 2,2 0 0 0 -1.732422,1 2,2 0 0 0 -0.265625,1 c 0,0 -0.0019,0 -0.0019,0 l 0,7 c 0,0 0.446,0 1,0 0.554,0 1,0 1,0 l 0,-5 0,-2 5,0 5.0000001,0 0,-2 -5.0000001,0 -5,0 z m 10.0000001,5 0,7 -4.5000001,0 -4.5,0 0,2 4.5,0 4.5000001,0 a 2,2 0 0 0 1.732422,-1 2,2 0 0 0 0.265625,-1 c 0,0 0.002,0 0.002,0 l 0,-7 c 0,0 -0.446,0 -1,0 -0.554,0 -1,0 -1,0 z" + id="path4439" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4441" + width="2" + height="2" + x="-14.000048" + y="1016.3622" + rx="2.00001" + ry="3.3799501e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="3.3799501e-05" + rx="2.00001" + y="1020.3622" + x="-10.000052" + height="2" + width="2" + id="rect4443" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4445" + sodipodi:type="arc" + sodipodi:cx="3.9999421" + sodipodi:cy="1019.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 3.9999421,1020.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.8660254,-0.5 l 0,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + transform="scale(-1,1)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4447" + sodipodi:type="arc" + sodipodi:cx="-8.9999523" + sodipodi:cy="1024.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -8.9999523,1025.3622 a 1,1 0 0 1 -0.8660254,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.8660254,-0.5 l 0,1 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="4.3456599e-05" + rx="2.00001" + y="1020.3622" + x="0.99994206" + height="5" + width="2" + id="rect4449" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4451" + width="4.9999962" + height="1.9999754" + x="2.9999459" + y="1018.3622" + rx="5.000021" + ry="1.7382426e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4453" + width="2" + height="5" + x="7.9999528" + y="1020.3622" + rx="2.00001" + ry="4.3456599e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + ry="4.3456599e-05" + rx="2.00001" + y="-7.9999528" + x="1025.3622" + height="5" + width="2" + id="rect4455" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + d="m 2.9999478,1022.3622 a 2,2 0 0 1 -1.7320508,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.7320508,-1 l 0,2 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="2" + sodipodi:rx="2" + sodipodi:cy="1020.3622" + sodipodi:cx="2.9999478" + sodipodi:type="arc" + id="path4457" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4459" + sodipodi:type="arc" + sodipodi:cx="2.9999478" + sodipodi:cy="1025.3622" + sodipodi:rx="2" + sodipodi:ry="2" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 2.9999478,1027.3622 a 2,2 0 0 1 -1.7320508,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.7320508,-1 l 0,2 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + transform="scale(-1,1)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4461" + sodipodi:type="arc" + sodipodi:cx="-7.9999528" + sodipodi:cy="1020.3622" + sodipodi:rx="2" + sodipodi:ry="2" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -7.9999527,1022.3622 a 2,2 0 0 1 -1.7320509,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.7320508,-1 l 0,2 z" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + transform="scale(-1,1)" + d="m -7.9999527,1027.3622 a 2,2 0 0 1 -1.7320509,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.7320508,-1 l 0,2 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="2" + sodipodi:rx="2" + sodipodi:cy="1025.3622" + sodipodi:cx="-7.9999528" + sodipodi:type="arc" + id="path4463" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <path + id="path4465" + d="m 7.9999475,1013.3622 a 2,2 0 0 0 -1.732422,1 2,2 0 0 0 -0.265625,1 l -0.0019,0 0,1 2,0 0,-1 2.5000005,0 2.5,0 0,3 0,2 -1,0 0,2 1,0 a 2,2 0 0 0 1.732422,-1 2,2 0 0 0 0.265625,-1 l 0.002,0 0,-5 -0.002,0 a 2,2 0 0 0 -0.265625,-1 2,2 0 0 0 -1.732422,-1 l -2.5,0 -2.5000005,0 z" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + ry="3.3799501e-05" + rx="2.00001" + y="1016.3622" + x="5.999948" + height="2" + width="2" + id="rect4469" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4471" + width="2" + height="2" + x="9.9999428" + y="1020.3622" + rx="2.00001" + ry="3.3799501e-05" + inkscape:export-filename="/home/djrm/rect4471.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4473" + width="12" + height="1" + x="1038.3622" + y="-35.500008" + rx="24" + ry="8.6913296e-06" /> + <rect + ry="8.6913296e-06" + rx="24" + y="1037.3622" + x="35.500008" + height="1" + width="12" + id="rect4475" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + ry="8.6913296e-06" + rx="24" + y="-48.500004" + x="1038.3622" + height="1" + width="12" + id="rect4477" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4479" + width="12" + height="1" + x="35.500008" + y="1050.3622" + rx="24" + ry="8.6913296e-06" /> + <rect + ry="8.6913606e-06" + rx="9.9999619" + y="-37.5" + x="1043.3622" + height="1.0000036" + width="4.9999809" + id="rect4481" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4483" + width="1.0000067" + height="4.9999976" + x="1042.3622" + y="-42.499992" + rx="2.0000134" + ry="4.3456628e-05" /> + <rect + transform="matrix(0,1,-1,0,0,0)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4485" + width="4.9999809" + height="1.0000036" + x="1043.3622" + y="-43.500008" + rx="9.9999619" + ry="8.6913606e-06" /> + <rect + ry="4.3456628e-05" + rx="2.0000134" + y="-42.499992" + x="1048.3622" + height="4.9999976" + width="1.0000067" + id="rect4487" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="matrix(0,1,-1,0,0,0)" /> + <path + d="m 35.500008,1039.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1038.3622" + sodipodi:cx="35.500008" + sodipodi:type="arc" + id="path4489" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + transform="scale(-1,1)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4491" + sodipodi:type="arc" + sodipodi:cx="-47.5" + sodipodi:cy="1038.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -47.5,1039.3622 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" /> + <path + d="m -47.5,1051.3622 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1050.3622" + sodipodi:cx="-47.5" + sodipodi:type="arc" + id="path4493" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(-1,1)" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4495" + sodipodi:type="arc" + sodipodi:cx="35.5" + sodipodi:cy="1050.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 35.5,1051.3622 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" /> + <path + d="m 37.5,1049.3622 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1048.3622" + sodipodi:cx="37.5" + sodipodi:type="arc" + id="path4497" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4499" + sodipodi:type="arc" + sodipodi:cx="37.5" + sodipodi:cy="1043.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m 37.5,1044.3622 a 1,1 0 0 1 -0.866025,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866025,-0.5 l 0,1 z" /> + <path + transform="scale(-1,1)" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4501" + sodipodi:type="arc" + sodipodi:cx="-42.500011" + sodipodi:cy="1048.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -42.500011,1049.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" /> + <path + transform="scale(-1,1)" + d="m -42.500011,1044.3622 a 1,1 0 0 1 -0.866026,-0.5 1,1 0 0 1 0,-1 1,1 0 0 1 0.866026,-0.5 l 0,1 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1043.3622" + sodipodi:cx="-42.500011" + sodipodi:type="arc" + id="path4503" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + id="path4505" + d="m 40.500005,1039.3623 a 1,1 0 0 0 -0.865235,0.5 1,1 0 0 0 -0.134765,0.5235 l 0,0.9765 c 0.361502,0 0.445997,0 1,0 l 0,-1 5,0 0,1 0,1.5 0,2.5 -1,0 0,1 1,0 a 1,1 0 0 0 0.865234,-0.5 1,1 0 0 0 0.134766,-0.5 l 0,-2.5 0,-2.4765 a 1,1 0 0 0 0,-0.024 1,1 0 0 0 -0.134766,-0.5 1,1 0 0 0 -0.865234,-0.5 l -5,-10e-5 z" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <rect + inkscape:export-ydpi="180" + inkscape:export-xdpi="180" + inkscape:export-filename="/home/djrm/rect4471.png" + ry="4.3456599e-05" + rx="2.00001" + y="1044.3622" + x="-18.000057" + height="5" + width="2" + id="rect4536" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + inkscape:export-ydpi="180" + inkscape:export-xdpi="180" + inkscape:export-filename="/home/djrm/rect4471.png" + transform="matrix(0,1,-1,0,0,0)" + ry="4.3456599e-05" + rx="2.00001" + y="11.000047" + x="1049.3622" + height="5" + width="2" + id="rect4542" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + inkscape:export-ydpi="180" + inkscape:export-xdpi="180" + inkscape:export-filename="/home/djrm/rect4471.png" + d="m -16.00005,1046.3622 a 2,2 0 0 1 -1.73205,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.73205,-1 l 0,2 z" + sodipodi:end="4.712389" + sodipodi:start="1.5707963" + sodipodi:ry="2" + sodipodi:rx="2" + sodipodi:cy="1044.3622" + sodipodi:cx="-16.00005" + sodipodi:type="arc" + id="path4544" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + inkscape:export-ydpi="180" + inkscape:export-xdpi="180" + inkscape:export-filename="/home/djrm/rect4471.png" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4546" + sodipodi:type="arc" + sodipodi:cx="-16.00005" + sodipodi:cy="1049.3622" + sodipodi:rx="2" + sodipodi:ry="2" + sodipodi:start="1.5707963" + sodipodi:end="4.712389" + d="m -16.00005,1051.3622 a 2,2 0 0 1 -1.73205,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.73205,-1 l 0,2 z" /> + <path + inkscape:export-ydpi="180" + inkscape:export-xdpi="180" + inkscape:export-filename="/home/djrm/rect4471.png" + id="path4554" + d="m -16.000053,1037.3622 a 2,2 0 0 0 -1.732422,1 2,2 0 0 0 -0.265625,1 c 0,0 -0.0019,0 -0.0019,0 l 0,7 c 0,0 0.446,0 1,0 0.554,0 1,0 1,0 l 0,-5 0,-2 5.000001,0 5,0 0,-2 -5,0 -5.000001,0 z m 10.000001,5 0,7 -4.5,0 -4.500001,0 0,2 4.500001,0 4.5,0 a 2,2 0 0 0 1.732422,-1 2,2 0 0 0 0.265625,-1 c 0,0 0.002,0 0.002,0 l 0,-7 c 0,0 -0.446,0 -1,0 -0.554,0 -1,0 -1,0 z" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4560" + width="4" + height="4" + x="-14" + y="1041.3622" + rx="2.00001" + ry="3.3799501e-05" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 33.000005,1021.3622 c 1.107999,0 2,0.892 2,2 l 0,5 c 0,1.108 -0.892001,2 -2,2 l -1,0 0,-3 a 2.9999926,2.9999926 0 0 0 -3,-3 l -3,0 0,-1 c 0,-1.108 0.892001,-2 2,-2 l 5,0 z m -7,6 a 2.9999926,2.9999926 0 0 0 3,3 l -1,0 c -1.107999,0 -2,-0.892 -2,-2 l 0,-1 z" + id="rect4562" + inkscape:connector-curvature="0" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4566" + width="8.9999924" + height="9.0000114" + x="-30.000002" + y="1026.3622" + rx="1.9999952" + ry="2.0000174" + transform="scale(-1,1)" /> + <rect + inkscape:export-ydpi="180" + inkscape:export-xdpi="180" + inkscape:export-filename="/home/djrm/rect4471.png" + style="opacity:1;fill:#4b4b4b;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4579" + width="36.000008" + height="15.999995" + x="-20.000004" + y="980.36218" + rx="4.5000234" + ry="4.3456585e-05" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m -32.000005,1037.3622 c -1.10801,0 -2,0.892 -2,2 l 0,10 c 0,1.108 0.89199,2 2,2 l 10,0 c 1.10801,0 2,-0.892 2,-2 l 0,-10 c 0,-1.108 -0.89199,-2 -2,-2 l -10,0 z m 0,2 10,0 0,10 -10,0 0,-10 z" + id="rect4601" + inkscape:connector-curvature="0" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 21,1044.3622 a 3.4999881,3.4999881 0 0 0 -3.5,3.5 3.4999881,3.4999881 0 0 0 3.5,3.5 3.4999881,3.4999881 0 0 0 3.5,-3.5 3.4999881,3.4999881 0 0 0 -3.5,-3.5 z m 0,2 a 1.5000153,1.5000153 0 0 1 1.5,1.5 1.5000153,1.5000153 0 0 1 -1.5,1.5 1.5000153,1.5000153 0 0 1 -1.5,-1.5 1.5000153,1.5000153 0 0 1 1.5,-1.5 z" + id="path4644" + inkscape:connector-curvature="0" /> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 28,1037.3622 a 3.4999881,3.4999881 0 0 0 -3.5,3.5 3.4999881,3.4999881 0 0 0 3.5,3.5 3.4999881,3.4999881 0 0 0 3.5,-3.5 3.4999881,3.4999881 0 0 0 -3.5,-3.5 z m 0,2 a 1.5000153,1.5000153 0 0 1 1.5,1.5 1.5000153,1.5000153 0 0 1 -1.5,1.5 1.5000153,1.5000153 0 0 1 -1.5,-1.5 1.5000153,1.5000153 0 0 1 1.5,-1.5 z" + id="circle4646" + inkscape:connector-curvature="0" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4679" + width="2" + height="1.9999826" + x="1" + y="1049.3622" + rx="2.5000134" + ry="4.2248896e-05" /> + <rect + ry="4.224963e-05" + rx="2.5000134" + y="1037.3622" + x="1" + height="2.0000174" + width="2" + id="rect4681" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4693" + width="2" + height="2.0000174" + x="13" + y="1037.3622" + rx="2.5000134" + ry="4.224963e-05" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4726" + width="2" + height="2.0000174" + x="13" + y="1049.3622" + rx="2.5000134" + ry="4.224963e-05" /> </g> </svg> diff --git a/tools/editor/icons/source/icon_object.svg b/tools/editor/icons/source/icon_object.svg index 6236f75c4d..6b36b61168 100644 --- a/tools/editor/icons/source/icon_object.svg +++ b/tools/editor/icons/source/icon_object.svg @@ -29,8 +29,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="32" - inkscape:cx="7.2827981" - inkscape:cy="6.8612677" + inkscape:cx="6.0308283" + inkscape:cy="7.6625569" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -74,27 +74,14 @@ id="layer1" transform="translate(0,-1036.3622)"> <path - style="fill:#cacad7;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" - d="m 8,1044.3622 6,-3 -6,-3 -6,3 z" - id="path4180" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccc" /> + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 8,1043.8622 0,6 6,-3 0,-6 z" + id="path4135" + inkscape:connector-curvature="0" /> <path - style="fill:#cacad7;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" - d="m 2,1047.3622 6,3 0,-6 -6,-3 z" - id="path4176" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccc" /> - <path - sodipodi:nodetypes="ccccc" - inkscape:connector-curvature="0" - id="path4178" - d="m 14,1047.3622 -6,3 0,-6 6,-3 z" - style="fill:#cacad7;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <path - style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#3b3a4d;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="M 7.9628906 1.0019531 A 1.0001 1.0001 0 0 0 7.5527344 1.1054688 L 1.5527344 4.1054688 A 1.0001 1.0001 0 0 0 1 5 L 1 11 A 1.0001 1.0001 0 0 0 1.5527344 11.894531 L 7.5527344 14.894531 A 1.0001 1.0001 0 0 0 8.4472656 14.894531 L 14.447266 11.894531 A 1.0001 1.0001 0 0 0 15 11 L 15 5 A 1.0001 1.0001 0 0 0 14.447266 4.1054688 L 8.4472656 1.1054688 A 1.0001 1.0001 0 0 0 7.9628906 1.0019531 z M 8 3.1191406 L 11.763672 5 L 8 6.8828125 L 4.2363281 5 L 8 3.1191406 z M 3 6.6171875 L 7 8.6171875 L 7 12.382812 L 3 10.382812 L 3 6.6171875 z M 13 6.6171875 L 13 10.382812 L 9 12.382812 L 9 8.6171875 L 13 6.6171875 z " - transform="translate(0,1036.3622)" - id="path4139" /> + id="path4139" + transform="translate(0,1036.3622)" /> </g> </svg> diff --git a/tools/editor/icons/source/icon_ungroup.svg b/tools/editor/icons/source/icon_ungroup.svg index c45e3e4cb9..f0b33465cd 100644 --- a/tools/editor/icons/source/icon_ungroup.svg +++ b/tools/editor/icons/source/icon_ungroup.svg @@ -29,8 +29,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="31.999999" - inkscape:cx="11.746278" - inkscape:cy="8.8711774" + inkscape:cx="2.9046561" + inkscape:cy="8.8085261" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -60,7 +60,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -70,9 +70,72 @@ id="layer1" transform="translate(0,-1036.3622)"> <path + inkscape:connector-curvature="0" + style="opacity:1;fill:#e0e0e0;fill-opacity:0.39215686;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 7,1037.3622 0,2 0,4 -4,0 c 0,0 -0.446,0 -1,0 -0.554,0 -1,0 -1,0 l 0,2 0,4 c 0,0 0.446,0 1,0 0.554,0 1,0 1,0 l 0,-4 4,0 0,4 -4,0 c -2.34e-5,0 0,0.446 0,1 0,0.554 -2.34e-5,1 0,1 l 4,0 c 0,0 0.446,0 1,0 0.554,0 1,0 1,0 l 0,-2 0,-4 4,0 c 0,0 0.446,0 1,0 0.554,0 1,0 1,0 l 0,-2 0,-4 c 0,0 -0.446,0 -1,0 -0.554,0 -1,0 -1,0 l 0,4 -4,0 0,-4 4,0 c 2.3e-5,0 0,-0.446 0,-1 0,-0.554 2.3e-5,-1 0,-1 l -4,0 c 0,0 -0.446,0 -1,0 -0.554,0 -1,0 -1,0 z" + id="rect4697" /> + <rect style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - d="M 8 3 A 2 2 0 0 0 6 5 A 2 2 0 0 0 8 7 A 2 2 0 0 0 10 5 A 2 2 0 0 0 8 3 z M 5 8 A 2 2 0 0 0 3 10 A 2 2 0 0 0 5 12 A 2 2 0 0 0 7 10 A 2 2 0 0 0 5 8 z M 11 8 A 2 2 0 0 0 9 10 A 2 2 0 0 0 11 12 A 2 2 0 0 0 13 10 A 2 2 0 0 0 11 8 z " - transform="translate(0,1036.3622)" - id="path4155" /> + id="rect4679" + width="2" + height="1.9999826" + x="1" + y="1049.3622" + rx="2.5000134" + ry="4.2248896e-05" /> + <rect + ry="4.224963e-05" + rx="2.5000134" + y="1043.3622" + x="1" + height="2.0000174" + width="2" + id="rect4681" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4693" + width="2" + height="2.0000174" + x="13" + y="1037.3622" + rx="2.5000134" + ry="4.224963e-05" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4726" + width="2" + height="2.0000174" + x="7" + y="1049.3622" + rx="2.5000134" + ry="4.224963e-05" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4157" + width="2" + height="2.0000174" + x="7" + y="1037.3622" + rx="2.5000134" + ry="4.224963e-05" /> + <rect + ry="4.224963e-05" + rx="2.5000134" + y="1043.3622" + x="7" + height="2.0000174" + width="2" + id="rect4159" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + ry="4.224963e-05" + rx="2.5000134" + y="1043.3622" + x="13" + height="2.0000174" + width="2" + id="rect4161" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> </g> </svg> diff --git a/tools/editor/import_settings.cpp b/tools/editor/import_settings.cpp deleted file mode 100644 index dfaeca03db..0000000000 --- a/tools/editor/import_settings.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/*************************************************************************/ -/* import_settings.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "import_settings.h" -#include "os/os.h" -#include "editor_node.h" - -void ImportSettingsDialog::_item_pressed(int p_idx) { - - if (!edited) - return; - - String p=edited->get_metadata(0); -#if 0 - if (EditorImportDB::get_singleton()->is_image(p)) { - - uint32_t flags = EditorImportDB::get_singleton()->get_image_flags(p); - bool pressed = !popup->is_item_checked(p_idx); - if (pressed) - flags|=(1<<p_idx); - else - flags&=~(1<<p_idx); - - - EditorImportDB::get_singleton()->set_image_flags(p,flags); - edited->set_text(2,_str_from_flags(flags)); - } -#endif -} - -void ImportSettingsDialog::_item_edited() { - - if (updating) - return; - TreeItem *it=tree->get_selected(); - int ec=tree->get_edited_column(); - - String p=it->get_metadata(0); -#if 0 - if (EditorImportDB::get_singleton()->is_image(p)) { - - if (ec==1) { - - - EditorImportDB::get_singleton()->set_image_format(p,EditorImport::ImageFormat(int(it->get_range(1)))); - - } else if (ec==2) { - - - int flags = EditorImportDB::get_singleton()->get_image_flags(p); - for(int i=0;i<popup->get_item_count();i++) { - - popup->set_item_checked(i,flags&(1<<i)); - } - - Rect2 r = tree->get_custom_popup_rect(); - popup->set_size(Size2(r.size.width,1)); - popup->set_pos(/*tree->get_global_pos()+*/r.pos+Point2(0,r.size.height)); - popup->popup(); - } - - edited=it; - - } -#endif - - -} - - -void ImportSettingsDialog::_button_pressed(Object *p_button, int p_col, int p_id) { - - TreeItem *ti=p_button->cast_to<TreeItem>(); - if (!ti) - return; - String path = ti->get_metadata(0); - print_line("PATH: "+path); - Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path); - ERR_FAIL_COND(rimd.is_null()); - Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor()); - ERR_FAIL_COND(!rimp.is_valid()); - rimp->import_dialog(path); - hide(); -} - -bool ImportSettingsDialog::_generate_fs(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) { - - bool valid=false; - - - for(int i=0;i<p_dir->get_subdir_count();i++) { - - EditorFileSystemDirectory *sd=p_dir->get_subdir(i); - TreeItem *ti = tree->create_item(p_parent); - ti->set_text(0,sd->get_name()+"/"); - ti->set_icon(0,get_icon("Folder","EditorIcons")); - - if (!_generate_fs(ti,sd)) { - memdelete(ti); - } else { - valid=true; - } - } - - - for(int i=0;i<p_dir->get_file_count();i++) { - - String path=p_dir->get_file_path(i); - if (!p_dir->get_file_meta(i)) - continue; - - valid=true; - - String f = p_dir->get_file(i); - TreeItem *ti = tree->create_item(p_parent); - String type = p_dir->get_file_type(i); - Ref<Texture> t; - if (has_icon(type,"EditorIcons")) - t = get_icon(type,"EditorIcons"); - else - t = get_icon("Object","EditorIcons"); - - - ti->set_icon(0,t); - ti->set_text(0,f); -// ti->add_button(0,get_icon("Reload","EditorIcons")); - ti->set_metadata(0,p_dir->get_file_path(i)); - String tt = p_dir->get_file_path(i); - - if (p_dir->is_missing_sources(i)) { - ti->set_icon(1,get_icon("ImportFail","EditorIcons")); - Vector<String> missing = p_dir->get_missing_sources(i); - for(int j=0;j<missing.size();j++) { - tt+="\nmissing: "+missing[j]; - } - - } else - ti->set_icon(1,get_icon("ImportCheck","EditorIcons")); - - ti->set_tooltip(0,tt); - ti->set_tooltip(1,tt); - - } - -#if 0 - if (!EditorImportDB::get_singleton()->is_image(path) && !EditorImportDB::get_singleton()->is_scene(path)) - continue; - - String f = p_dir->get_file(i); - TreeItem *ti = tree->create_item(p_parent); - ti->set_text(0,f); - String type = p_dir->get_file_type(i); - Ref<Texture> icon = get_icon( (has_icon(type,"EditorIcons")?type:String("Object")),"EditorIcons"); - - - if (EditorImportDB::get_singleton()->is_image(path)) { - - - ti->set_tooltip(0,"Type: Image\nSource: "+EditorImportDB::get_singleton()->get_file_source(path)+"\nSource MD5: "+EditorImportDB::get_singleton()->get_file_md5(path)); - ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE); - ti->set_editable(1,true); - ti->set_range_config(1,0,3,1); - ti->set_range(1,EditorImportDB::get_singleton()->get_image_format(path)); - ti->set_text(1,texformat); - ti->set_cell_mode(2,TreeItem::CELL_MODE_CUSTOM); - ti->set_editable(2,true); - ti->set_metadata(0,path); - - String txt; - uint32_t flags=EditorImportDB::get_singleton()->get_image_flags(path); - txt=_str_from_flags(flags); - - ti->set_text(2,txt); - } - - ti->set_icon(0, icon); - valid=true; -#endif - - - return valid; -} - -void ImportSettingsDialog::update_tree() { - - updating=true; - tree->clear(); - edited=NULL; - - - TreeItem *root = tree->create_item(); - EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem(); - - _generate_fs(root,fs); - updating=false; - - -} - -void ImportSettingsDialog::_notification(int p_what) { - - if (p_what==NOTIFICATION_ENTER_TREE) { - - EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"update_tree"); - } -} - - -void ImportSettingsDialog::_bind_methods() { - - ObjectTypeDB::bind_method("update_tree",&ImportSettingsDialog::update_tree); - ObjectTypeDB::bind_method("_item_edited",&ImportSettingsDialog::_item_edited); - ObjectTypeDB::bind_method("_item_pressed",&ImportSettingsDialog::_item_pressed); - ObjectTypeDB::bind_method("_button_pressed",&ImportSettingsDialog::_button_pressed); - - -} - - -void ImportSettingsDialog::popup_import_settings() { - - update_tree(); - popup_centered_ratio(); -} - -void ImportSettingsDialog::ok_pressed() { - - - TreeItem *ti = tree->get_selected(); - if (!ti) - return; - - String path = ti->get_metadata(0); - print_line("PATH: "+path); - Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path); - ERR_FAIL_COND(rimd.is_null()); - Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor()); - ERR_FAIL_COND(!rimp.is_valid()); - rimp->import_dialog(path); - hide(); - - -} - -ImportSettingsDialog::ImportSettingsDialog(EditorNode *p_editor) { - - editor=p_editor; - - get_ok()->set_text(TTR("Close")); - - tree = memnew( Tree ); - add_child(tree); - set_child_rect(tree); - set_title(TTR("Imported Resources")); - -// texformat="Keep,None,Disk,VRAM"; - - tree->set_hide_root(true); - tree->set_columns(2); - tree->set_column_expand(1,false); - tree->set_column_min_width(1,20); - - tree->connect("item_edited",this,"_item_edited"); - tree->connect("button_pressed",this,"_button_pressed"); - -// add_button("Re-Import","reimport"); - get_ok()->set_text(TTR("Re-Import")); - get_cancel()->set_text(TTR("Close")); - - updating=false; - edited=NULL; - set_hide_on_ok(false); - - -} - diff --git a/tools/editor/io_plugins/editor_atlas.cpp b/tools/editor/io_plugins/editor_atlas.cpp index f894e7e8b2..f69e383fb0 100644 --- a/tools/editor/io_plugins/editor_atlas.cpp +++ b/tools/editor/io_plugins/editor_atlas.cpp @@ -82,7 +82,6 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S //place them int ofs=0; - int limit_h=0; for(int j=0;j<wrects.size();j++) { @@ -106,8 +105,6 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S int end_h = from_y+wrects[j].s.height; int end_w = ofs+wrects[j].s.width; - if (ofs==0) - limit_h=end_h; for(int k=0;k<wrects[j].s.width;k++) { @@ -120,8 +117,7 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S if (end_w > max_w) max_w=end_w; - //if (ofs==0 || end_h>limit_h ) //while h limit not reched, keep stacking - ofs+=wrects[j].s.width; + ofs+=wrects[j].s.width; } diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 363cba3678..1130e2be30 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -2278,12 +2278,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones NodeMap &nm = node_map[at.target]; String path = scene->get_path_to(nm.node); - Collada::Node *cn = collada.state.scene_map[at.target]; - //if (cn->ignore_anim) { - // print_line("warning, ignoring property animation on node: "+nm.path); - //continue; - //} - animation->add_track(Animation::TYPE_VALUE); int track = animation->get_track_count() -1; @@ -2381,7 +2375,6 @@ Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_ state.create_animations(p_flags&IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); AnimationPlayer *ap = memnew( AnimationPlayer ); - ap->set_name("animations"); for(int i=0;i<state.animations.size();i++) { String name; if (state.animations[i]->get_name()=="") diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index 095c56a373..da608292c1 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -496,7 +496,6 @@ Error EditorMeshImportPlugin::import(const String& p_path, const Ref<ResourceImp } int vtx = face[idx][0].to_int()-1; - print_line("vtx: "+itos(vtx)+"/"+itos(vertices.size())); ERR_FAIL_INDEX_V(vtx,vertices.size(),ERR_PARSE_ERROR); Vector3 vertex = vertices[vtx]; @@ -520,7 +519,7 @@ Error EditorMeshImportPlugin::import(const String& p_path, const Ref<ResourceImp //new object/surface if (generate_normals || force_smooth) surf_tool->generate_normals(); - if (uvs.size() && (normals.size() || generate_normals)) + if (uvs.size() && (normals.size() || generate_normals) && generate_tangents) surf_tool->generate_tangents(); surf_tool->index(); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index d5d0fac2b6..fa62283e37 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -756,6 +756,8 @@ void EditorSceneImportDialog::_import(bool p_and_open) { } + // Scenes should always be imported as binary format since vertex data is large and would take + // up a lot of space and time to load if imported as text format (GH-5778) String save_file = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+".scn"); print_line("Saving to: "+save_file); @@ -2459,7 +2461,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, bool p_merge_material, Map<String, Ref<Material> > &materials, bool p_merge_anims, Map<String,Ref<Animation> >& merged_anims,Set<Ref<Mesh> > &tested_meshes) { - if (node->get_owner()!=scene) + if (node!=scene && node->get_owner()!=scene) return; String path = scene->get_path_to(node); @@ -2507,11 +2509,43 @@ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, for(int i=0;i<mesh->get_surface_count();i++) { Ref<Material> material = mesh->surface_get_material(i); - materials[mesh->get_name()+":surf:"+mesh->surface_get_name(i)]=material; + + if (material.is_valid()) { + + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=mesh->get_name()+":surf:"+sname; + materials[sname]=material; + } } tested_meshes.insert(mesh); } + + if (mesh.is_valid()) { + + for(int i=0;i<mesh->get_surface_count();i++) { + Ref<Material> material = mi->get_surface_material(i); + if (material.is_valid()) { + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=path+":inst_surf:"+sname; + materials[sname]=material; + } + } + + } + + Ref<Material> override = mi->get_material_override(); + + if (override.is_valid()) { + + materials[path+":override"]=override; + } } @@ -2525,11 +2559,13 @@ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bool p_merge_material, const Map<String, Ref<Material> > &materials, bool p_merge_anims, const Map<String,Ref<Animation> >& merged_anims, Set<Ref<Mesh> > &tested_meshes) { - if (node->get_owner()!=scene) + if (node!=scene && node->get_owner()!=scene) return; String path = scene->get_path_to(node); + print_line("at path: "+path); + if (node->cast_to<AnimationPlayer>()) { AnimationPlayer *ap = node->cast_to<AnimationPlayer>(); @@ -2570,15 +2606,48 @@ void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bo if (mesh.is_valid() && mesh->get_name()!=String() && !tested_meshes.has(mesh)) { for(int i=0;i<mesh->get_surface_count();i++) { - String sname = mesh->get_name()+":surf:"+mesh->surface_get_name(i); + + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=mesh->get_name()+":surf:"+sname; + if (materials.has(sname)) { + mesh->surface_set_material(i,materials[sname]); } } tested_meshes.insert(mesh); } + + if (mesh.is_valid()) { + + for(int i=0;i<mesh->get_surface_count();i++) { + + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=path+":inst_surf:"+sname; + + + if (materials.has(sname)) { + + mi->set_surface_material(i,materials[sname]); + } + } + + } + + + String opath = path+":override"; + if (materials.has(opath)) { + mi->set_material_override(materials[opath]); + } + } @@ -2613,12 +2682,6 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c progress.step(TTR("Importing Scene.."),2); - bool reimport = bool(from->get_option("reimport")); - int this_time_action = from->get_option("import_this_time"); - int next_time_action = from->get_option("import_next_time"); - - int import_action = reimport?this_time_action:next_time_action; - from->set_source_md5(0,FileAccess::get_md5(src_path)); from->set_editor(get_name()); @@ -2627,8 +2690,6 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c Map<Ref<Mesh>,Ref<Shape> > collision_map; - Ref<ResourceImportMetadata> imd = memnew(ResourceImportMetadata); - Map< Ref<ImageTexture>,TextureRole > imagemap; scene=_fix_node(scene,scene,collision_map,scene_flags,imagemap); @@ -2643,6 +2704,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c if (scene_flags&(SCENE_FLAG_MERGE_KEEP_MATERIALS|SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS) && FileAccess::exists(p_dest_path)) { //must merge! + print_line("MUST MERGE"); Ref<PackedScene> pscene = ResourceLoader::load(p_dest_path,"PackedScene",true); if (pscene.is_valid()) { @@ -2653,8 +2715,9 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c Set<Ref<Mesh> > tested_meshes; _find_resources_to_merge(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); + tested_meshes.clear(); - _merge_found_resources(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); + _merge_found_resources(scene,scene,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); memdelete(instance); } @@ -2742,7 +2805,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c target_path=target_path.basename()+".tex"; Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata ); - print_line("flags: "+itos(image_flags)); + uint32_t flags = image_flags; if (E->get()==TEXTURE_ROLE_DIFFUSE && scene_flags&SCENE_FLAG_LINEARIZE_DIFFUSE_TEXTURES) flags|=EditorTextureImportPlugin::IMAGE_FLAG_CONVERT_TO_LINEAR; @@ -2790,15 +2853,16 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c Ref<PackedScene> packer = memnew( PackedScene ); packer->pack(scene); - packer->set_path(p_dest_path); + //packer->set_path(p_dest_path); do not take over, let the changed files reload themselves packer->set_import_metadata(from); print_line("SAVING TO: "+p_dest_path); - err = ResourceSaver::save(p_dest_path,packer,ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); + err = ResourceSaver::save(p_dest_path,packer); //do not take over, let the changed files reload themselves //EditorFileSystem::get_singleton()->update_resource(packer); memdelete(scene); + /* scene->set_filename(p_dest_path); if (r_scene) { @@ -2818,6 +2882,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c */ + EditorNode::get_singleton()->reload_scene(p_dest_path); return err; diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 16ea803da4..60642999f2 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -147,8 +147,6 @@ void EditorImportTextureOptions::_changed() { void EditorImportTextureOptions::_bind_methods() { - print_line("bind toptions"); - ObjectTypeDB::bind_method("_changed",&EditorImportTextureOptions::_changed); ObjectTypeDB::bind_method("_changedp",&EditorImportTextureOptions::_changedp); @@ -1192,8 +1190,6 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc } ep.step(TTR("Converting Images"),sources.size()); - int base_index=0; - Map<uint64_t,int> source_md5; Map<int,List<int> > source_map; @@ -1760,7 +1756,6 @@ void EditorTextureImportPlugin::reimport_multiple_files(const Vector<String>& p_ Vector<String> valid; - bool warning=false; for(int i=0;i<p_list.size();i++) { Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_list[i]); @@ -1768,7 +1763,6 @@ void EditorTextureImportPlugin::reimport_multiple_files(const Vector<String>& p_ if (type=="texture" || type.begins_with("texture_")) { if ((rimd->has_option("atlas") && rimd->get_option("atlas")) || (rimd->has_option("large") && rimd->get_option("large"))) { - warning=true; continue; } diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index aa36fefdb7..9ee3e98486 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -425,7 +425,6 @@ Error EditorTranslationImportPlugin::import(const String& p_path, const Ref<Reso ERR_FAIL_COND_V( !f, ERR_INVALID_PARAMETER ); - bool first=false; bool skip_first = from->get_option("skip_first"); int index = from->get_option("index"); index+=1; @@ -439,7 +438,6 @@ Error EditorTranslationImportPlugin::import(const String& p_path, const Ref<Reso while(line.size()>1) { - if (!skip_first) { ERR_FAIL_INDEX_V(index,line.size(),ERR_INVALID_DATA ); translation->add_message(line[0].strip_edges(),line[index]); diff --git a/tools/editor/output_strings.cpp b/tools/editor/output_strings.cpp index f1b49d2326..a6126466c4 100644 --- a/tools/editor/output_strings.cpp +++ b/tools/editor/output_strings.cpp @@ -32,7 +32,6 @@ void OutputStrings::update_scrollbars() { - Size2 size = get_size(); Size2 hmin = h_scroll->get_combined_minimum_size(); Size2 vmin = v_scroll->get_combined_minimum_size(); diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 10c7bf79a3..b4d54c6b1e 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -43,6 +43,7 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) { key_editor->set_animation(Ref<Animation>()); key_editor->set_root(NULL); + key_editor->show_select_node_warning(true); _update_player(); //editor->animation_editor_make_visible(false); @@ -376,8 +377,8 @@ void AnimationPlayerEditor::_animation_save_in_path(const Ref<Resource>& p_resou int flg = 0; if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) flg |= ResourceSaver::FLAG_COMPRESS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - flg |= ResourceSaver::FLAG_RELATIVE_PATHS; + //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + // flg |= ResourceSaver::FLAG_RELATIVE_PATHS; String path = Globals::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); @@ -407,7 +408,6 @@ void AnimationPlayerEditor::_animation_save(const Ref<Resource>& p_resource) { void AnimationPlayerEditor::_animation_save_as(const Ref<Resource>& p_resource) { file->set_mode(EditorFileDialog::MODE_SAVE_FILE); - bool relpaths = (p_resource->has_meta("__editor_relpaths__") && p_resource->get_meta("__editor_relpaths__").operator bool()); List<String> extensions; ResourceSaver::get_recognized_extensions(p_resource, &extensions); @@ -833,6 +833,7 @@ void AnimationPlayerEditor::_update_player() { remove_anim->set_disabled(animlist.size()==0); resource_edit_anim->set_disabled(animlist.size()==0); save_anim->set_disabled(animlist.size() == 0); + tool_anim->set_disabled(player==NULL); int active_idx=-1; @@ -890,9 +891,11 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) { return; //ignore, pinned player=p_player; - if (player) + if (player) { _update_player(); - else { + key_editor->show_select_node_warning(false); + } else { + key_editor->show_select_node_warning(true); // hide(); @@ -1124,6 +1127,7 @@ void AnimationPlayerEditor::_hide_anim_editors() { key_editor->set_animation(Ref<Animation>()); key_editor->set_root(NULL); + key_editor->show_select_node_warning(true); // editor->animation_editor_make_visible(false); } @@ -1404,6 +1408,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { hb->add_child(animation); animation->set_h_size_flags(SIZE_EXPAND_FILL); animation->set_tooltip(TTR("Display list of animations in player.")); + animation->set_clip_text(true); autoplay = memnew( ToolButton ); hb->add_child(autoplay); @@ -1531,6 +1536,8 @@ void AnimationPlayerEditorPlugin::edit(Object *p_object) { if (!p_object) return; anim_editor->edit(p_object->cast_to<AnimationPlayer>()); + + } bool AnimationPlayerEditorPlugin::handles(Object *p_object) const { diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index a381ec4678..24914e4bc5 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -90,7 +90,6 @@ Size2 AnimationTreeEditor::get_node_size(const StringName& p_node) const { Ref<StyleBox> style = get_stylebox("panel","PopupMenu"); Ref<Font> font = get_font("font","PopupMenu"); - Color font_color = get_color("font_color","PopupMenu"); Size2 size = style->get_minimum_size(); @@ -633,7 +632,6 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2& Ref<StyleBox> style = get_stylebox("panel","PopupMenu"); Ref<Font> font = get_font("font","PopupMenu"); - Color font_color = get_color("font_color","PopupMenu"); float h = (font->get_height()+get_constant("vseparation","PopupMenu")); diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 1962f81e87..6a88ba4cbe 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -645,7 +645,6 @@ void BakedLightBaker::_octree_insert(int p_octant,Triangle* p_triangle, int p_de leaf_list=child_idx; cell_count++; - int lz = lights.size(); for(int ci=0;ci<8;ci++) { child->light_accum[ci][0]=0; child->light_accum[ci][1]=0; @@ -1016,8 +1015,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c //ray_aabb.expand_to(p_end); - const BVH *bvhptr = bvh; - bstack[0]=bvh; stack[0]=TEST_AABB_BIT; @@ -1693,7 +1690,7 @@ void BakedLightBaker::throw_rays(ThreadStack& thread_stack,int p_amount) { Vector3 from = dl.pos; double r1 = double(rand())/RAND_MAX; - double r2 = double(rand())/RAND_MAX; + //double r2 = double(rand())/RAND_MAX; double r3 = double(rand())/RAND_MAX; float d=Math::tan(Math::deg2rad(dl.spot_angle)); @@ -1994,7 +1991,6 @@ void BakedLightBaker::update_octree_images(DVector<uint8_t> &p_octree,DVector<ui const double *normptr=norm_arr.ptr(); */ double norm = 1.0/double(total_rays); - int lz=lights.size(); mult/=multiplier; double saturation = baked_light->get_saturation(); @@ -2261,8 +2257,6 @@ void BakedLightBaker::_plot_pixel_to_lightmap(int x, int y, int width, int heigh continue; n/=len; - const BVH *bvhptr = bvh; - bstack[0]=bvh; stack[0]=TEST_RAY_BIT; @@ -2404,8 +2398,6 @@ Error BakedLightBaker::transfer_to_lightmaps() { float gamma = baked_light->get_gamma_adjust(); float mult = baked_light->get_energy_multiplier(); - - const double *normptr=norm_arr.ptr(); for(int i=0;i<triangles.size();i++) { if (i%200==0) { @@ -2538,7 +2530,6 @@ Error BakedLightBaker::transfer_to_lightmaps() { Vector<uint8_t> copy_data=bt.data; uint8_t *data=bt.data.ptr(); - uint8_t *src_data=copy_data.ptr(); const int max_radius=8; const int shadow_radius=2; const int max_dist=0x7FFFFFFF; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 0cbc867b47..02a24f8ddb 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -41,6 +41,11 @@ #include "tools/editor/plugins/animation_player_editor_plugin.h" #include "scene/resources/packed_scene.h" + +#define MIN_ZOOM 0.01 +#define MAX_ZOOM 100 + + class SnapDialog : public ConfirmationDialog { OBJ_TYPE(SnapDialog,ConfirmationDialog); @@ -199,16 +204,12 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { if (!is_visible() || get_viewport()->gui_has_modal_stack()) return; + if (p_ev.key.mod.control) - // prevent to change tool mode when control key is pressed return; - if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_Q) - _tool_select(TOOL_SELECT); - if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_W) - _tool_select(TOOL_MOVE); - if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_E) - _tool_select(TOOL_ROTATE); + if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_V && drag==DRAG_NONE && can_move_pivot) { + if (p_ev.key.mod.shift) { //move drag pivot drag=DRAG_PIVOT; @@ -1066,6 +1067,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (b.button_index==BUTTON_WHEEL_DOWN) { + if (zoom<MIN_ZOOM) + return; + float prev_zoom=zoom; zoom=zoom*0.95; { @@ -1081,6 +1085,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (b.button_index==BUTTON_WHEEL_UP) { + if (zoom>MAX_ZOOM) + return; + float prev_zoom=zoom; zoom=zoom*(1.0/0.95); { @@ -1382,6 +1389,8 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { se->undo_state=canvas_item->edit_get_state(); if (canvas_item->cast_to<Node2D>()) se->undo_pivot=canvas_item->cast_to<Node2D>()->edit_get_pivot(); + if (canvas_item->cast_to<Control>()) + se->undo_pivot=Vector2(); return; } @@ -1566,14 +1575,34 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (drag==DRAG_ROTATE) { Vector2 center = canvas_item->get_global_transform_with_canvas().get_origin(); - if (Node2D *node = canvas_item->cast_to<Node2D>()) { - Matrix32 rot; - rot.elements[1] = (dfrom - center).normalized(); - rot.elements[0] = rot.elements[1].tangent(); - node->set_rot(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rot(), node->get_rot())); - display_rotate_to = dto; - display_rotate_from = center; - viewport->update(); + { + Node2D *node = canvas_item->cast_to<Node2D>(); + + + if (node) { + Matrix32 rot; + rot.elements[1] = (dfrom - center).normalized(); + rot.elements[0] = rot.elements[1].tangent(); + node->set_rot(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rot(), node->get_rot())); + display_rotate_to = dto; + display_rotate_from = center; + viewport->update(); + } + } + + { + Control *node = canvas_item->cast_to<Control>(); + + + if (node) { + Matrix32 rot; + rot.elements[1] = (dfrom - center).normalized(); + rot.elements[0] = rot.elements[1].tangent(); + node->set_rotation(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rotation(), node->get_rotation())); + display_rotate_to = dto; + display_rotate_from = center; + viewport->update(); + } } continue; @@ -1918,8 +1947,6 @@ void CanvasItemEditor::_viewport_draw() { Map<Node*,Object*> &selection = editor_selection->get_selection(); - CanvasItem *single_item=NULL; - bool pivot_found=false; for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) { @@ -1939,15 +1966,6 @@ void CanvasItemEditor::_viewport_draw() { Matrix32 xform=transform * canvas_item->get_global_transform_with_canvas(); VisualServer::get_singleton()->canvas_item_add_set_transform(ci,xform); - Point2 ofs=Point2();//get_global_pos(); - Rect2 draw_rect=rect; - Color light_edit_color=Color(1.0,0.8,0.8); - Color dark_edit_color=Color(0.4,0.1,0.1); - Size2 handle_size=Size2(handle_len,handle_len); - - //select_sb->draw(ci,draw_rect.grow(2)); - //DRAW_EMPTY_RECT( draw_rect.grow(2), light_edit_color ); - //DRAW_EMPTY_RECT( draw_rect.grow(1), dark_edit_color ); Vector2 endpoints[4]={ @@ -2519,12 +2537,17 @@ void CanvasItemEditor::_popup_callback(int p_op) { snap_dialog->popup_centered(Size2(220,160)); } break; case ZOOM_IN: { + if (zoom>MAX_ZOOM) + return; zoom=zoom*(1.0/0.5); _update_scroll(0); viewport->update(); return; } break; case ZOOM_OUT: { + if (zoom<MIN_ZOOM) + return; + zoom=zoom*0.5; _update_scroll(0); viewport->update(); @@ -3285,20 +3308,23 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { hb->add_child(select_button); select_button->connect("pressed",this,"_tool_select",make_binds(TOOL_SELECT)); select_button->set_pressed(true); - select_button->set_tooltip(TTR("Select Mode (Q)")+"\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Drag: Rotate")+"\n"+TTR("Alt+Drag: Move")+"\n"+TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).")+"\n"+TTR("Alt+RMB: Depth list selection")); + select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode",TTR("Select Mode"),KEY_Q)); + select_button->set_tooltip(TTR("Select Mode")+" $sc\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Drag: Rotate")+"\n"+TTR("Alt+Drag: Move")+"\n"+TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).")+"\n"+TTR("Alt+RMB: Depth list selection")); move_button = memnew( ToolButton ); move_button->set_toggle_mode(true); hb->add_child(move_button); move_button->connect("pressed",this,"_tool_select",make_binds(TOOL_MOVE)); - move_button->set_tooltip(TTR("Move Mode (W)")); + move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode",TTR("Move Mode"),KEY_W)); + move_button->set_tooltip(TTR("Move Mode")); rotate_button = memnew( ToolButton ); rotate_button->set_toggle_mode(true); hb->add_child(rotate_button); rotate_button->connect("pressed",this,"_tool_select",make_binds(TOOL_ROTATE)); - rotate_button->set_tooltip(TTR("Rotate Mode (E)")); + rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode",TTR("Rotate Mode"),KEY_E)); + rotate_button->set_tooltip(TTR("Rotate Mode")); hb->add_child(memnew(VSeparator)); @@ -3352,25 +3378,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { PopupMenu *p; p = edit_menu->get_popup(); - p->add_check_item(TTR("Use Snap"),SNAP_USE); - p->add_check_item(TTR("Show Grid"),SNAP_SHOW_GRID); - p->add_check_item(TTR("Use Rotation Snap"),SNAP_USE_ROTATION); - p->add_check_item(TTR("Snap Relative"),SNAP_RELATIVE); - p->add_item(TTR("Configure Snap.."),SNAP_CONFIGURE); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap")), SNAP_USE); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Show Grid")), SNAP_SHOW_GRID); + 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/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap..")), SNAP_CONFIGURE); p->add_separator(); - p->add_check_item(TTR("Use Pixel Snap"),SNAP_USE_PIXEL); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL); p->add_separator(); - p->add_item(TTR("Expand to Parent"),EXPAND_TO_PARENT,KEY_MASK_CMD|KEY_P); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/expand_to_parent", TTR("Expand to Parent"), KEY_MASK_CMD | KEY_P), EXPAND_TO_PARENT); p->add_separator(); p->add_submenu_item(TTR("Skeleton.."),"skeleton"); PopupMenu *p2 = memnew(PopupMenu); p->add_child(p2); p2->set_name("skeleton"); - p2->add_item(TTR("Make Bones"),SKELETON_MAKE_BONES,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_B); - p2->add_item(TTR("Clear Bones"),SKELETON_CLEAR_BONES); + p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B ),SKELETON_MAKE_BONES); + p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES); p2->add_separator(); - p2->add_item(TTR("Make IK Chain"),SKELETON_SET_IK_CHAIN); - p2->add_item(TTR("Clear IK Chain"),SKELETON_CLEAR_IK_CHAIN); + p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN); + p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN); p2->connect("item_pressed", this,"_popup_callback"); @@ -3387,13 +3413,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p = view_menu->get_popup(); - p->add_item(TTR("Zoom In"),ZOOM_IN); - p->add_item(TTR("Zoom Out"),ZOOM_OUT); - p->add_item(TTR("Zoom Reset"),ZOOM_RESET); - p->add_item(TTR("Zoom Set.."),ZOOM_SET); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_in", TTR("Zoom In")), ZOOM_IN); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_out", TTR("Zoom Out")), ZOOM_OUT); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset")), ZOOM_RESET); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_set", TTR("Zoom Set..")), ZOOM_SET); p->add_separator(); - p->add_item(TTR("Center Selection"), VIEW_CENTER_TO_SELECTION, KEY_F); - p->add_item(TTR("Frame Selection"), VIEW_FRAME_TO_SELECTION, KEY_MASK_CMD|KEY_F); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION); anchor_menu = memnew( MenuButton ); anchor_menu->set_text(TTR("Anchor")); @@ -3436,7 +3462,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { key_insert_button = memnew( Button ); key_insert_button->set_focus_mode(FOCUS_NONE); key_insert_button->connect("pressed",this,"_popup_callback",varray(ANIM_INSERT_KEY)); - key_insert_button->set_tooltip(TTR("Insert Keys (Ins)")); + key_insert_button->set_tooltip(TTR("Insert Keys")); + key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT)); animation_hb->add_child(key_insert_button); @@ -3447,12 +3474,12 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p = animation_menu->get_popup(); - p->add_item(TTR("Insert Key"),ANIM_INSERT_KEY,KEY_INSERT); - p->add_item(TTR("Insert Key (Existing Tracks)"),ANIM_INSERT_KEY_EXISTING,KEY_MASK_CMD+KEY_INSERT); + p->add_shortcut(ED_GET_SHORTCUT("canvas_item_editor/anim_insert_key"), ANIM_INSERT_KEY); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key_existing_tracks", TTR("Insert Key (Existing Tracks)"), KEY_MASK_CMD+KEY_INSERT), ANIM_INSERT_KEY_EXISTING); p->add_separator(); - p->add_item(TTR("Copy Pose"),ANIM_COPY_POSE); - p->add_item(TTR("Paste Pose"),ANIM_PASTE_POSE); - p->add_item(TTR("Clear Pose"),ANIM_CLEAR_POSE,KEY_MASK_SHIFT|KEY_K); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_copy_pose", TTR("Copy Pose")), ANIM_COPY_POSE); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_paste_pose", TTR("Paste Pose")), ANIM_PASTE_POSE); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_clear_pose", TTR("Clear Pose"), KEY_MASK_SHIFT | KEY_K), ANIM_CLEAR_POSE); snap_dialog = memnew( SnapDialog ); snap_dialog->connect("confirmed",this,"_snap_changed"); diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 5ed9f8ab5f..95364e8921 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -349,8 +349,6 @@ void CollisionPolygon2DEditor::_canvas_draw() { Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); - int len = poly.size(); - for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index b18afe7838..0b06b3ba21 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -381,8 +381,6 @@ void CollisionPolygonEditor::_polygon_draw() { poly=node->get_polygon(); - - int len = poly.size(); float depth = node->get_depth()*0.5; imgeom->clear(); @@ -586,7 +584,7 @@ CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) { handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); - Ref<Texture> handle= SpatialEditor::get_singleton()->get_icon("Editor3DHandle","EditorIcons"); + Ref<Texture> handle=editor->get_gui_base()->get_icon("Editor3DHandle","EditorIcons"); handle_material->set_point_size(handle->get_width()); handle_material->set_texture(FixedMaterial::PARAM_DIFFUSE,handle); diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index a057e6c2a1..b1bce60484 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -36,6 +36,7 @@ #include "scene/resources/mesh.h" #include "scene/resources/bit_mask.h" #include "tools/editor/editor_scale.h" + bool EditorTexturePreviewPlugin::handles(const String& p_type) const { return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture")); @@ -442,7 +443,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES& p_from) { Color keyword_color = EditorSettings::get_singleton()->get("text_editor/keyword_color"); Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color"); Color symbol_color = EditorSettings::get_singleton()->get("text_editor/symbol_color"); - Color comment_color = EditorSettings::get_singleton()->get("text_editor/comment_color"); for(int i=0;i<thumbnail_size;i++) { @@ -607,7 +607,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { -1, -1, -1, -1, 2, 4, 6, 8 }; - int16_t nibble,signed_nibble,diff,step; + int16_t nibble,diff,step; ima_adpcm.last_nibble++; const uint8_t *src_ptr=sdata; @@ -628,10 +628,6 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { if (ima_adpcm.step_index>88) ima_adpcm.step_index=88; - /* - signed_nibble = (nibble&7) * ((nibble&8)?-1:1); - diff = (2 * signed_nibble + 1) * step / 4; */ - diff = step >> 3 ; if (nibble & 1) diff += step >> 2 ; @@ -748,15 +744,13 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int j=0;j<h;j++) { - int half,ofs; + int half; float v; if (j<(h/2)) { half=0; - ofs=0; v = (j/(float)(h/2)) * 2.0 - 1.0; } else { half=1; - ofs=h/2; if( (float)(h/2) != 0 ) { v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; } else { diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp index 14e7b14fc3..56e58bc983 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -364,8 +364,6 @@ void LightOccluder2DEditor::_canvas_draw() { Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); - int len = poly.size(); - for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp index 5a8cd8791e..22546c72f3 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -427,8 +427,6 @@ void NavigationPolygonEditor::_canvas_draw() { poly = Variant(node->get_navigation_polygon()->get_outline(j)); } - int len = poly.size(); - for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 93e2fb2f38..7e20cc3f54 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -283,7 +283,6 @@ void ParticlesEditor::_generate_emission_points() { ofs=(Vector3(1,1,1)-dir)*Vector3(Math::randf(),Math::randf(),Math::randf())*aabb.size; ofs+=aabb.pos; - Vector3 dirv = -dir; Vector3 ofsv = ofs + aabb.size * dir; //space it a little diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index d78508c429..19d1ccc06f 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -466,8 +466,6 @@ void Polygon2DEditor::_canvas_draw() { Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); Ref<Texture> handle= get_icon("EditorHandle","EditorIcons"); - int len = poly.size(); - for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index b094184a29..7965fa54ae 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -151,7 +151,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag -1, -1, -1, -1, 2, 4, 6, 8 }; - int16_t nibble,signed_nibble,diff,step; + int16_t nibble,diff,step; ima_adpcm.last_nibble++; const uint8_t *src_ptr=sdata; @@ -172,10 +172,6 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag if (ima_adpcm.step_index>88) ima_adpcm.step_index=88; - /* - signed_nibble = (nibble&7) * ((nibble&8)?-1:1); - diff = (2 * signed_nibble + 1) * step / 4; */ - diff = step >> 3 ; if (nibble & 1) diff += step >> 2 ; @@ -285,15 +281,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int j=0;j<h;j++) { - int half,ofs; + int half; float v; if (j<(h/2)) { half=0; - ofs=0; v = (j/(float)(h/2)) * 2.0 - 1.0; } else { half=1; - ofs=h/2; v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; } @@ -324,12 +318,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag void SampleEditor::_update_sample() { player->stop_all(); - if (sample->get_format()==Sample::FORMAT_IMA_ADPCM) - return; //bye or unsupported generate_preview_texture(sample,peakdisplay); info_label->set_text(TTR("Length:")+" "+String::num(sample->get_length()/(float)sample->get_mix_rate(),2)+"s"); + if (library->has_sample("default")) + library->remove_sample("default"); + library->add_sample("default",sample); } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 10e4fc8475..4032a790d8 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -43,6 +43,28 @@ /*** SCRIPT EDITOR ****/ +static bool _can_open_in_editor(Script* p_script) { + + String path = p_script->get_path(); + + if (path.find("::")!=-1) { + //refuse handling this if it can't be edited + + bool valid=false; + for(int i=0;i<EditorNode::get_singleton()->get_editor_data().get_edited_scene_count();i++) { + if (path.begins_with(EditorNode::get_singleton()->get_editor_data().get_scene_path(i))) { + valid=true; + break; + } + } + + return valid; + } + + return true; +} + + class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache { @@ -290,9 +312,12 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0))); get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244"))); get_text_edit()->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/completion_existing_color", Color::html("21dfdfdf"))); + get_text_edit()->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/completion_scroll_color", Color::html("ffffff"))); + get_text_edit()->add_color_override("completion_font_color", EDITOR_DEF("text_editor/completion_font_color", Color::html("aaaaaa"))); get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_background_color",EDITOR_DEF("text_editor/caret_background_color",Color(0,0,0))); get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); @@ -585,7 +610,6 @@ void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>* Error err = script->get_language()->complete_code(p_code,script->get_path().get_base_dir(),base,r_options,hint); if (hint!="") { get_text_edit()->set_code_hint(hint); - print_line("hint: "+hint.replace(String::chr(0xFFFF),"|")); } } @@ -748,9 +772,9 @@ void ScriptEditor::_go_to_tab(int p_idx) { _update_script_colors(); } -void ScriptEditor::_close_current_tab() { +void ScriptEditor::_close_tab(int p_idx) { - int selected = tab_container->get_current_tab(); + int selected = p_idx; if (selected<0 || selected>=tab_container->get_child_count()) return; @@ -795,11 +819,32 @@ void ScriptEditor::_close_current_tab() { _update_script_names(); - EditorNode::get_singleton()->save_layout(); + _save_layout(); +} + +void ScriptEditor::_close_current_tab() { + + _close_tab(tab_container->get_current_tab()); + +} + +void ScriptEditor::_close_docs_tab() { + + int child_count = tab_container->get_child_count(); + for (int i = child_count-1; i>=0; i--) { + + EditorHelp *ste = tab_container->get_child(i)->cast_to<EditorHelp>(); + + if (ste) { + _close_tab(i); + } + + } } + void ScriptEditor::_resave_scripts(const String& p_str) { apply_scripts(); @@ -848,6 +893,15 @@ void ScriptEditor::_reload_scripts(){ } + uint64_t last_date = script->get_last_modified_time(); + uint64_t date = FileAccess::get_modified_time(script->get_path()); + + //printf("last date: %lli vs date: %lli\n",last_date,date); + if (last_date==date) { + continue; + } + + Ref<Script> rel_script = ResourceLoader::load(script->get_path(),script->get_type(),true); ERR_CONTINUE(!rel_script.is_valid()); script->set_source_code( rel_script->get_source_code() ); @@ -975,6 +1029,18 @@ void ScriptEditor::swap_lines(TextEdit *tx, int line1, int line2) tx->cursor_set_line(line2); } +void ScriptEditor::_breakpoint_toggled(const int p_row) { + int selected = tab_container->get_current_tab(); + if (selected<0 || selected>=tab_container->get_child_count()) { + return; + } + + ScriptTextEditor *current = tab_container->get_child(selected)->cast_to<ScriptTextEditor>(); + if (current) { + get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),p_row+1,current->get_text_edit()->is_line_set_as_breakpoint(p_row)); + } +} + void ScriptEditor::_file_dialog_action(String p_file) { switch (file_dialog_option) { @@ -1431,7 +1497,9 @@ void ScriptEditor::_menu_option(int p_option) { if (scr.is_null()) return; scr->set_source_code(te->get_text()); - scr->get_language()->reload_tool_script(scr,p_option==FILE_TOOL_RELOAD_SOFT); + bool soft = p_option==FILE_TOOL_RELOAD_SOFT || scr->get_instance_base_type()=="EditorPlugin"; //always soft-reload editor plugins + + scr->get_language()->reload_tool_script(scr,soft); } break; case EDIT_TRIM_TRAILING_WHITESAPCE: { _trim_trailing_whitespace(current->get_text_edit()); @@ -1561,6 +1629,9 @@ void ScriptEditor::_menu_option(int p_option) { _close_current_tab(); } } break; + case CLOSE_DOCS: { + _close_docs_tab(); + } break; case WINDOW_MOVE_LEFT: { if (tab_container->get_current_tab()>0) { @@ -1608,6 +1679,9 @@ void ScriptEditor::_menu_option(int p_option) { case FILE_CLOSE: { _close_current_tab(); } break; + case CLOSE_DOCS: { + _close_docs_tab(); + } break; } @@ -1682,6 +1756,33 @@ void ScriptEditor::_notification(int p_what) { } + +void ScriptEditor::close_builtin_scripts_from_scene(const String& p_scene) { + + + + for(int i=0;i<tab_container->get_child_count();i++) { + + ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>(); + + if (ste) { + + Ref<Script> script = ste->get_edited_script(); + if (!script.is_valid()) + continue; + + if (script->get_path().find("::")!=-1 && script->get_path().begins_with(p_scene)) { //is an internal script and belongs to scene being closed + _close_tab(i); + i--; + + } + } + + } + + +} + void ScriptEditor::edited_scene_changed() { _update_modified_scripts_for_external_editor(); @@ -1980,6 +2081,9 @@ void ScriptEditor::_update_script_colors() { void ScriptEditor::_update_script_names() { + if (restoring_layout) + return; + waiting_update_names=false; Set<Ref<Script> > used; Node* edited = EditorNode::get_singleton()->get_edited_scene(); @@ -2060,11 +2164,18 @@ void ScriptEditor::_update_script_names() { } + + void ScriptEditor::edit(const Ref<Script>& p_script) { if (p_script.is_null()) return; + // refuse to open built-in if scene is not loaded + + + + // see if already has it bool open_dominant = EditorSettings::get_singleton()->get("text_editor/open_dominant_script_on_scene_change"); @@ -2124,9 +2235,11 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); + ste->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); + ste->get_text_edit()->connect("breakpoint_toggled", this, "_breakpoint_toggled"); tab_container->add_child(ste); _go_to_tab(tab_container->get_tab_count()-1); @@ -2134,10 +2247,8 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { _update_script_names(); + _save_layout(); ste->connect("name_changed",this,"_update_script_names"); - if (!restoring_layout) { - EditorNode::get_singleton()->save_layout(); - } //test for modification, maybe the script was not edited but was loaded @@ -2257,6 +2368,15 @@ void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const } +void ScriptEditor::_save_layout() { + + if (restoring_layout) { + return; + } + + editor->save_layout(); +} + void ScriptEditor::_editor_settings_changed() { trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/trim_trailing_whitespace_on_save"); @@ -2291,6 +2411,7 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); + ste->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); } ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); @@ -2313,7 +2434,23 @@ void ScriptEditor::_tree_changed() { void ScriptEditor::_script_split_dragged(float) { - EditorNode::get_singleton()->save_layout(); + _save_layout(); +} + +void ScriptEditor::_unhandled_input(const InputEvent& p_event) { + if (p_event.key.pressed || !is_visible()) return; + if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { + int next_tab = script_list->get_current() + 1; + next_tab %= script_list->get_item_count(); + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } + if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { + int next_tab = script_list->get_current() - 1; + next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } } void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { @@ -2335,13 +2472,14 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { for(int i=0;i<scripts.size();i++) { String path = scripts[i]; + if (!FileAccess::exists(path)) + continue; Ref<Script> scr = ResourceLoader::load(path); if (scr.is_valid()) { edit(scr); } } - for(int i=0;i<helps.size();i++) { String path = helps[i]; @@ -2357,9 +2495,9 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { script_split->set_split_offset(p_layout->get_value("ScriptEditor","split_offset")); } - restoring_layout=false; + _update_script_names(); } void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) { @@ -2419,7 +2557,7 @@ void ScriptEditor::_help_class_open(const String& p_class) { eh->go_to_class(p_class,0); eh->connect("go_to_help",this,"_help_class_goto"); _update_script_names(); - + _save_layout(); } void ScriptEditor::_help_class_goto(const String& p_desc) { @@ -2448,7 +2586,7 @@ void ScriptEditor::_help_class_goto(const String& p_desc) { eh->go_to_help(p_desc); eh->connect("go_to_help",this,"_help_class_goto"); _update_script_names(); - + _save_layout(); } void ScriptEditor::_update_history_pos(int p_new_pos) { @@ -2512,7 +2650,7 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) { if (bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))) return; - if (open_dominant && p_script.is_valid()) { + if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) { edit(p_script); } } @@ -2573,6 +2711,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_tab_changed",&ScriptEditor::_tab_changed); ObjectTypeDB::bind_method("_menu_option",&ScriptEditor::_menu_option); ObjectTypeDB::bind_method("_close_current_tab",&ScriptEditor::_close_current_tab); + ObjectTypeDB::bind_method("_close_docs_tab", &ScriptEditor::_close_docs_tab); ObjectTypeDB::bind_method("_editor_play",&ScriptEditor::_editor_play); ObjectTypeDB::bind_method("_editor_pause",&ScriptEditor::_editor_pause); ObjectTypeDB::bind_method("_editor_stop",&ScriptEditor::_editor_stop); @@ -2582,6 +2721,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_res_saved_callback",&ScriptEditor::_res_saved_callback); ObjectTypeDB::bind_method("_goto_script_line",&ScriptEditor::_goto_script_line); ObjectTypeDB::bind_method("_goto_script_line2",&ScriptEditor::_goto_script_line2); + ObjectTypeDB::bind_method("_breakpoint_toggled", &ScriptEditor::_breakpoint_toggled); ObjectTypeDB::bind_method("_breaked",&ScriptEditor::_breaked); ObjectTypeDB::bind_method("_show_debugger",&ScriptEditor::_show_debugger); ObjectTypeDB::bind_method("_get_debug_tooltip",&ScriptEditor::_get_debug_tooltip); @@ -2598,6 +2738,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward); ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back); ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts); + ObjectTypeDB::bind_method("_unhandled_input",&ScriptEditor::_unhandled_input); } @@ -2631,6 +2772,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { tab_container->set_h_size_flags(SIZE_EXPAND_FILL); + ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_GREATER); + ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_LESS); + set_process_unhandled_input(true); + file_menu = memnew( MenuButton ); menu_hb->add_child(file_menu); file_menu->set_text(TTR("File")); @@ -2649,7 +2794,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_theme", TTR("Save Theme")), FILE_SAVE_THEME); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTR("Save Theme As")), FILE_SAVE_THEME_AS); file_menu->get_popup()->add_separator(); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD|KEY_W), FILE_CLOSE); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE); file_menu->get_popup()->connect("item_pressed", this,"_menu_option"); edit_menu = memnew( MenuButton ); @@ -2895,6 +3041,16 @@ void ScriptEditorPlugin::edit(Object *p_object) { bool ScriptEditorPlugin::handles(Object *p_object) const { + if (p_object->cast_to<Script>()) { + + bool valid = _can_open_in_editor(p_object->cast_to<Script>()); + + if (!valid) { //user tried to open it by clicking + EditorNode::get_singleton()->show_warning(TTR("Built-in scripts can only be edited when the scene they belong to is loaded")); + } + return valid; + } + return p_object->is_type("Script"); } diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 0636190a41..2f079b9fc7 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -127,6 +127,7 @@ class ScriptEditor : public VBoxContainer { FILE_SAVE_THEME, FILE_SAVE_THEME_AS, FILE_CLOSE, + CLOSE_DOCS, EDIT_UNDO, EDIT_REDO, EDIT_CUT, @@ -234,7 +235,10 @@ class ScriptEditor : public VBoxContainer { bool _test_script_times_on_disk(Ref<Script> p_for_script=Ref<Script>()); + void _close_tab(int p_idx); + void _close_current_tab(); + void _close_docs_tab(); bool grab_focus_block; @@ -266,6 +270,7 @@ class ScriptEditor : public VBoxContainer { void _update_window_menu(); void _script_created(Ref<Script> p_script); + void _save_layout(); void _editor_settings_changed(); void _autosave_scripts(); @@ -279,6 +284,8 @@ class ScriptEditor : public VBoxContainer { void _script_split_dragged(float); + void _unhandled_input(const InputEvent& p_event); + void _history_forward(); void _history_back(); @@ -317,6 +324,7 @@ public: void get_breakpoints(List<String> *p_breakpoints); void swap_lines(TextEdit *tx, int line1, int line2); + void _breakpoint_toggled(const int p_row); void save_all_scripts(); @@ -329,6 +337,8 @@ public: virtual void edited_scene_changed(); + void close_builtin_scripts_from_scene(const String& p_scene); + ScriptEditorDebugger *get_debugger() { return debugger; } void set_live_auto_reload_running_scripts(bool p_enabled); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 76042c3028..b3317e8313 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -81,9 +81,12 @@ void ShaderTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0))); get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244"))); get_text_edit()->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/completion_existing_color", Color::html("21dfdfdf"))); + get_text_edit()->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/completion_scroll_color", Color::html("ffffff"))); + get_text_edit()->add_color_override("completion_font_color", EDITOR_DEF("text_editor/completion_font_color", Color::html("aaaaaa"))); get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_background_color",EDITOR_DEF("text_editor/caret_background_color",Color(0,0,0))); get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); @@ -118,9 +121,10 @@ void ShaderTextEditor::_load_theme_settings() { get_text_edit()->add_color_region("/*","*/",comment_color,false); get_text_edit()->add_color_region("//","",comment_color,false); - //colorize strings + + /*//colorize strings Color string_color = EDITOR_DEF("text_editor/string_color",Color::hex(0x6b6f00ff)); - /* + List<String> strings; shader->get_shader_mode()->get_string_delimiters(&strings); @@ -378,6 +382,7 @@ void ShaderEditor::_editor_settings_changed() { vertex_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); vertex_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); vertex_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + vertex_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); fragment_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); fragment_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); @@ -389,6 +394,7 @@ void ShaderEditor::_editor_settings_changed() { fragment_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); fragment_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); fragment_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + fragment_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); light_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); light_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); @@ -400,6 +406,7 @@ void ShaderEditor::_editor_settings_changed() { light_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); light_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); light_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + light_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); } void ShaderEditor::_bind_methods() { @@ -499,7 +506,7 @@ ShaderEditor::ShaderEditor() { edit_menu->set_pos(Point2(5,-1)); edit_menu->set_text(TTR("Edit")); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO); - edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_Z), EDIT_REDO); + edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD|KEY_Y), EDIT_REDO); edit_menu->get_popup()->add_separator(); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/cut", TTR("Cut"), KEY_MASK_CMD|KEY_X), EDIT_CUT); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy", TTR("Copy"), KEY_MASK_CMD|KEY_C), EDIT_COPY); @@ -519,7 +526,7 @@ ShaderEditor::ShaderEditor() { search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/replace", TTR("Replace.."), KEY_MASK_CMD|KEY_R), SEARCH_REPLACE); search_menu->get_popup()->add_separator(); // search_menu->get_popup()->add_item("Locate Symbol..",SEARCH_LOCATE_SYMBOL,KEY_MASK_CMD|KEY_K); - search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_G), SEARCH_GOTO_LINE); + search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_L), SEARCH_GOTO_LINE); search_menu->get_popup()->connect("item_pressed", this,"_menu_option"); diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index d567c8e9b3..375220051c 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -176,7 +176,9 @@ void GraphColorRampEdit::_input_event(const InputEvent& p_event) { void GraphColorRampEdit::_notification(int p_what){ if (p_what==NOTIFICATION_ENTER_TREE) { - picker->connect("color_changed",this,"_color_changed"); + if (!picker->is_connected("color_changed",this,"_color_changed")) { + picker->connect("color_changed",this,"_color_changed"); + } } if (p_what==NOTIFICATION_DRAW) { @@ -184,9 +186,8 @@ void GraphColorRampEdit::_notification(int p_what){ Point prev; prev.offset=0; prev.color=Color(0,0,0); - int w = get_size().x; - int h = get_size().y; + int h = get_size().y; int total_w = get_size().width-get_size().height-3; for(int i=-1;i<points.size();i++) { diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 8d72178f23..a70df78697 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -53,8 +53,6 @@ void SpatialEditorViewport::_update_camera() { if (orthogonal) { - Size2 size = get_size(); - Size2 vpsize = Point2(cursor.distance*size.get_aspect(), cursor.distance / size.get_aspect()); //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar()); camera->set_orthogonal(2 * cursor.distance, 0.1, 8192); } @@ -79,21 +77,30 @@ void SpatialEditorViewport::_update_camera() { String SpatialEditorGizmo::get_handle_name(int p_idx) const { + if (get_script_instance() && get_script_instance()->has_method("get_handle_name")) + return get_script_instance()->call("get_handle_name", p_idx); + return ""; } Variant SpatialEditorGizmo::get_handle_value(int p_idx) const{ + if (get_script_instance() && get_script_instance()->has_method("get_handle_value")) + return get_script_instance()->call("get_handle_value", p_idx); + return Variant(); } void SpatialEditorGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point) { + if (get_script_instance() && get_script_instance()->has_method("set_handle")) + get_script_instance()->call("set_handle", p_idx, p_camera, p_point); } void SpatialEditorGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){ - + if (get_script_instance() && get_script_instance()->has_method("commit_handle")) + get_script_instance()->call("commit_handle", p_idx, p_restore, p_cancel); } bool SpatialEditorGizmo::intersect_frustum(const Camera *p_camera,const Vector<Plane> &p_frustum) { @@ -276,10 +283,6 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b r_includes_current=false; List<_RayResult> results; - Vector3 cn=_get_camera_normal(); - Plane cplane(pos,cn.normalized()); - - float min_d=1e20; for (int i=0;i<instances.size();i++) { @@ -649,21 +652,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili Vector3 ray_pos=_get_ray_pos( Vector2( p_screenpos.x, p_screenpos.y ) ); Vector3 ray=_get_ray( Vector2( p_screenpos.x, p_screenpos.y ) ); - Vector3 cn=_get_camera_normal(); - Plane cplane(ray_pos,cn.normalized()); - Transform gt = spatial_editor->get_gizmo_transform(); float gs=gizmo_scale; - /* - if (orthogonal) { - gs= cursor.distance/surface->get_size().get_aspect(); - - } else { - gs = cplane.distance_to(gt.origin); - } - - gs*=GIZMO_SCALE_DEFAULT; -*/ if (spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_MOVE) { @@ -1268,16 +1258,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (_edit.gizmo.is_valid()) { - Plane plane=Plane(_edit.gizmo_initial_pos,_get_camera_normal()); - - - Vector3 ray_pos=_get_ray_pos( Vector2( m.x, m.y ) ); - Vector3 ray=_get_ray( Vector2( m.x, m.y ) ); - - //Vector3 intersection; - //if (!plane.intersects_ray(ray_pos,ray,&intersection)) - // break; - _edit.gizmo->set_handle(_edit.gizmo_handle,camera,Vector2(m.x,m.y)); Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle); String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle); @@ -1658,136 +1638,89 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { default: {} } } break; - case InputEvent::KEY: { - const InputEventKey &k = p_event.key; if (!k.pressed) break; - switch(k.scancode) { - - case KEY_S: { - - if (_edit.mode!=TRANSFORM_NONE) { - - _edit.snap=true; - } - } break; - case KEY_7: - case KEY_KP_7: { - bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad"); - if (!emulate_numpad && k.scancode==KEY_7) - return; - cursor.y_rot=0; - if (k.mod.shift) { - cursor.x_rot=-Math_PI/2.0; - set_message(TTR("Bottom View."),2); - name=TTR("Bottom"); - _update_name(); - - } else { - cursor.x_rot=Math_PI/2.0; - set_message(TTR("Top View."),2); - name=TTR("Top"); - _update_name(); - } - } break; - case KEY_1: - case KEY_KP_1: { - bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad"); - if (!emulate_numpad && k.scancode==KEY_1) - return; - cursor.x_rot=0; - if (k.mod.shift) { - cursor.y_rot=Math_PI; - set_message(TTR("Rear View."),2); - name=TTR("Rear"); - _update_name(); - - } else { - cursor.y_rot=0; - set_message(TTR("Front View."),2); - name=TTR("Front"); - _update_name(); - } - - } break; - case KEY_3: - case KEY_KP_3: { - bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad"); - if (!emulate_numpad && k.scancode==KEY_3) - return; - cursor.x_rot=0; - if (k.mod.shift) { - cursor.y_rot=Math_PI/2.0; - set_message(TTR("Left View."),2); - name=TTR("Left"); - _update_name(); - } else { - cursor.y_rot=-Math_PI/2.0; - set_message(TTR("Right View."),2); - name=TTR("Right"); - _update_name(); - } - - } break; - case KEY_5: - case KEY_KP_5: { - bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad"); - if (!emulate_numpad && k.scancode==KEY_5) - return; - - //orthogonal = !orthogonal; - _menu_option(orthogonal?VIEW_PERSPECTIVE:VIEW_ORTHOGONAL); - _update_name(); - - - } break; - case KEY_K: { - - if (!get_selected_count() || _edit.mode!=TRANSFORM_NONE) - break; - - if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) { - set_message(TTR("Keying is disabled (no key inserted).")); - break; - } - - List<Node*> &selection = editor_selection->get_selected_node_list(); - - for(List<Node*>::Element *E=selection.front();E;E=E->next()) { - - Spatial *sp = E->get()->cast_to<Spatial>(); - if (!sp) - continue; - - emit_signal("transform_key_request",sp,"",sp->get_transform()); - } - - - set_message(TTR("Animation Key Inserted.")); + if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) { + if (_edit.mode != TRANSFORM_NONE) { + _edit.snap=true; + } + } + if (ED_IS_SHORTCUT("spatial_editor/bottom_view", p_event)) { + cursor.y_rot = 0; + cursor.x_rot = -Math_PI/2.0; + set_message(TTR("Bottom View."),2); + name = TTR("Bottom"); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/top_view", p_event)) { + cursor.y_rot = 0; + cursor.x_rot = Math_PI/2.0; + set_message(TTR("Top View."),2); + name = TTR("Top"); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/rear_view", p_event)) { + cursor.x_rot = 0; + cursor.y_rot = Math_PI; + set_message(TTR("Rear View."),2); + name = TTR("Rear"); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/front_view", p_event)) { + cursor.x_rot = 0; + cursor.y_rot=0; + set_message(TTR("Front View."),2); + name=TTR("Front"); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/left_view", p_event)) { + cursor.x_rot=0; + cursor.y_rot = Math_PI/2.0; + set_message(TTR("Left View."),2); + name = TTR("Left"); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/right_view", p_event)) { + cursor.x_rot=0; + cursor.y_rot = -Math_PI/2.0; + set_message(TTR("Right View."),2); + name = TTR("Right"); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/switch_perspective_orthogonal", p_event)) { + _menu_option(orthogonal?VIEW_PERSPECTIVE:VIEW_ORTHOGONAL); + _update_name(); + } + if (ED_IS_SHORTCUT("spatial_editor/insert_anim_key", p_event)) { + if (!get_selected_count() || _edit.mode!=TRANSFORM_NONE) + break; + if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) { + set_message(TTR("Keying is disabled (no key inserted).")); + break; + } - } break; + List<Node*> &selection = editor_selection->get_selected_node_list(); - case KEY_F: { + for(List<Node*>::Element *E=selection.front();E;E=E->next()) { - if (k.pressed && k.mod.shift && k.mod.control) { - _menu_option(VIEW_ALIGN_SELECTION_WITH_VIEW); - } else if (k.pressed) { - _menu_option(VIEW_CENTER_TO_SELECTION); - } + Spatial *sp = E->get()->cast_to<Spatial>(); + if (!sp) + continue; - } break; + emit_signal("transform_key_request",sp,"",sp->get_transform()); + } - case KEY_SPACE: { - if (!k.pressed) - emit_signal("toggle_maximize_view", this); - } break; + set_message(TTR("Animation Key Inserted.")); } + if (k.scancode == KEY_SPACE) { + if (!k.pressed) emit_signal("toggle_maximize_view", this); + } } break; @@ -1855,16 +1788,6 @@ void SpatialEditorViewport::_notification(int p_what) { continue; - /* - ?? - if (!se->poly_instance.is_valid()) - continue; - if (!ObjectDB::get_instance( E->key() )) { - VisualServer::get_singleton()->free( se->poly_instance ); - se->poly_instance=RID(); - continue; - } - */ VisualInstance *vi=sp->cast_to<VisualInstance>(); @@ -1902,35 +1825,6 @@ void SpatialEditorViewport::_notification(int p_what) { surface->update(); } - //grid - Vector3 grid_cam_axis=_get_camera_normal(); - /* - for(int i=0;i<3;i++) { - - - Vector3 axis; - axis[i]=1; - - bool should_be_visible= grid_enabled && (grid_enable[i] || (Math::abs(grid_cam_axis.dot(axis))>0.99 && orthogonal)); - - if (should_be_visible!=grid_visible[i]) { - - VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,should_be_visible); - grid_visible[i]=should_be_visible; - } - } - - if (last_grid_snap!=spatial_editor->get_translate_snap()) { - - - last_grid_snap=spatial_editor->get_translate_snap() - Transform gridt; - gridt.basis.scale(Vector3(last_grid_snap,last_grid_snap,last_grid_snap)); - for(int i=0;i<3;i++) - VisualServer::get_singleton()->instance_set_transform(grid_instance[i],gridt); - - }*/ - } if (p_what==NOTIFICATION_ENTER_TREE) { @@ -2470,29 +2364,28 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed surface->add_child(view_menu); view_menu->set_pos( Point2(4,4)); view_menu->set_self_opacity(0.5); - - view_menu->get_popup()->add_item(TTR("Top (Num7)"),VIEW_TOP); - view_menu->get_popup()->add_item(TTR("Bottom (Shift+Num7)"),VIEW_BOTTOM); - view_menu->get_popup()->add_item(TTR("Left (Num3)"),VIEW_LEFT); - view_menu->get_popup()->add_item(TTR("Right (Shift+Num3)"),VIEW_RIGHT); - view_menu->get_popup()->add_item(TTR("Front (Num1)"),VIEW_FRONT); - view_menu->get_popup()->add_item(TTR("Rear (Shift+Num1)"),VIEW_REAR); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/left_view"), VIEW_LEFT); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/right_view"), VIEW_RIGHT); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/front_view"), VIEW_FRONT); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/rear_view"), VIEW_REAR); view_menu->get_popup()->add_separator(); - view_menu->get_popup()->add_check_item(TTR("Perspective (Num5)"),VIEW_PERSPECTIVE); - view_menu->get_popup()->add_check_item(TTR("Orthogonal (Num5)"),VIEW_ORTHOGONAL); + view_menu->get_popup()->add_check_item(TTR("Perspective") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_PERSPECTIVE); + view_menu->get_popup()->add_check_item(TTR("Orthogonal") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_ORTHOGONAL); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_PERSPECTIVE),true); view_menu->get_popup()->add_separator(); - view_menu->get_popup()->add_check_item(TTR("Environment"),VIEW_ENVIRONMENT); + view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_environment", TTR("Environment")), VIEW_ENVIRONMENT); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_ENVIRONMENT),true); view_menu->get_popup()->add_separator(); - view_menu->get_popup()->add_check_item(TTR("Audio Listener"),VIEW_AUDIO_LISTENER); + view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_listener", TTR("Audio Listener")), VIEW_AUDIO_LISTENER); view_menu->get_popup()->add_separator(); - view_menu->get_popup()->add_check_item(TTR("Gizmos"),VIEW_GIZMOS); + view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_gizmos", TTR("Gizmos")),VIEW_GIZMOS); view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_GIZMOS),true); view_menu->get_popup()->add_separator(); - view_menu->get_popup()->add_item(TTR("Selection (F)"),VIEW_CENTER_TO_SELECTION); - view_menu->get_popup()->add_item(TTR("Align with view (Ctrl+Shift+F)"),VIEW_ALIGN_SELECTION_WITH_VIEW); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/focus_selection"), VIEW_CENTER_TO_SELECTION); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_selection_with_view"), VIEW_ALIGN_SELECTION_WITH_VIEW); view_menu->get_popup()->connect("item_pressed",this,"_menu_option"); preview_camera = memnew( Button ); @@ -2613,16 +2506,9 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { si->sbox_instance=VisualServer::get_singleton()->instance_create2(selection_box->get_rid(),sp->get_world()->get_scenario()); VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF); - RID inst = sp->call("_get_visual_instance_rid"); - -// if (inst.is_valid()) -// si->aabb = VisualServer::get_singleton()->instance_get_base_aabb(inst); - - if (get_tree()->is_editor_hint()) editor->call("edit_node",sp); - return si; } @@ -3951,6 +3837,19 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(vs); + ED_SHORTCUT("spatial_editor/bottom_view", TTR("Bottom View"), KEY_MASK_ALT+KEY_KP_7); + ED_SHORTCUT("spatial_editor/top_view", TTR("Top View"), KEY_KP_7); + ED_SHORTCUT("spatial_editor/rear_view", TTR("Rear View"), KEY_MASK_ALT+KEY_KP_1); + ED_SHORTCUT("spatial_editor/front_view", TTR("Front View"), KEY_KP_1); + ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KEY_MASK_ALT+KEY_KP_3); + ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), KEY_KP_3); + ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal view"), KEY_KP_5); + ED_SHORTCUT("spatial_editor/snap", TTR("Snap"), KEY_S); + ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K); + ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F); + ED_SHORTCUT("spatial_editor/align_selection_with_view", TTR("Align Selection With View"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_F); + + PopupMenu *p; transform_menu = memnew( MenuButton ); @@ -3958,13 +3857,13 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child( transform_menu ); p = transform_menu->get_popup(); - p->add_check_item(TTR("Use Snap"),MENU_TRANSFORM_USE_SNAP); - p->add_item(TTR("Configure Snap.."),MENU_TRANSFORM_CONFIGURE_SNAP); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_snap", TTR("Use Snap")), MENU_TRANSFORM_USE_SNAP); + p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap..")), MENU_TRANSFORM_CONFIGURE_SNAP); p->add_separator(); - p->add_check_item(TTR("Local Coords"),MENU_TRANSFORM_LOCAL_COORDS); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Local Coords")), MENU_TRANSFORM_LOCAL_COORDS); //p->set_item_checked(p->get_item_count()-1,true); p->add_separator(); - p->add_item(TTR("Transform Dialog.."),MENU_TRANSFORM_DIALOG); + p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog..")), MENU_TRANSFORM_DIALOG); p->connect("item_pressed", this,"_menu_item_pressed"); @@ -3975,27 +3874,27 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p = view_menu->get_popup(); - p->add_check_item(TTR("Use Default Light"),MENU_VIEW_USE_DEFAULT_LIGHT); - p->add_check_item(TTR("Use Default sRGB"),MENU_VIEW_USE_DEFAULT_SRGB); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_default_light", TTR("Use Default Light")), MENU_VIEW_USE_DEFAULT_LIGHT); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_default_srgb", TTR("Use Default sRGB")), MENU_VIEW_USE_DEFAULT_SRGB); p->add_separator(); - p->add_check_item(TTR("1 Viewport"),MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_CMD+KEY_1); - p->add_check_item(TTR("2 Viewports"),MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_CMD+KEY_2); - p->add_check_item(TTR("2 Viewports (Alt)"),MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_2); - p->add_check_item(TTR("3 Viewports"),MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_CMD+KEY_3); - p->add_check_item(TTR("3 Viewports (Alt)"),MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_3); - p->add_check_item(TTR("4 Viewports"),MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_CMD+KEY_4); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/1_viewport", TTR("1 Viewport"), KEY_MASK_CMD+KEY_1), MENU_VIEW_USE_1_VIEWPORT); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports", TTR("2 Viewports"), KEY_MASK_CMD+KEY_2), MENU_VIEW_USE_2_VIEWPORTS); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports_alt", TTR("2 Viewports (Alt)"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_2), MENU_VIEW_USE_2_VIEWPORTS_ALT); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTR("3 Viewports"),KEY_MASK_CMD+KEY_3), MENU_VIEW_USE_3_VIEWPORTS); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTR("3 Viewports (Alt)"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_3), MENU_VIEW_USE_3_VIEWPORTS_ALT); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTR("4 Viewports"), KEY_MASK_CMD+KEY_4), MENU_VIEW_USE_4_VIEWPORTS); p->add_separator(); - p->add_check_item(TTR("Display Normal"),MENU_VIEW_DISPLAY_NORMAL); - p->add_check_item(TTR("Display Wireframe"),MENU_VIEW_DISPLAY_WIREFRAME); - p->add_check_item(TTR("Display Overdraw"),MENU_VIEW_DISPLAY_OVERDRAW); - p->add_check_item(TTR("Display Shadeless"),MENU_VIEW_DISPLAY_SHADELESS); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_normal", TTR("Display Normal")), MENU_VIEW_DISPLAY_NORMAL); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_wireframe", TTR("Display Wireframe")), MENU_VIEW_DISPLAY_WIREFRAME); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_overdraw", TTR("Display Overdraw")), MENU_VIEW_DISPLAY_OVERDRAW); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_shadeless", TTR("Display Shadeless")), MENU_VIEW_DISPLAY_SHADELESS); p->add_separator(); - p->add_check_item(TTR("View Origin"),MENU_VIEW_ORIGIN); - p->add_check_item(TTR("View Grid"),MENU_VIEW_GRID); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_origin", TTR("View Origin")), MENU_VIEW_ORIGIN); + p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid")), MENU_VIEW_GRID); p->add_separator(); - p->add_item(TTR("Settings"),MENU_VIEW_CAMERA_SETTINGS); + p->add_shortcut(ED_SHORTCUT("spatial_editor/settings", TTR("Settings")), MENU_VIEW_CAMERA_SETTINGS); p->set_item_checked( p->get_item_index(MENU_VIEW_USE_DEFAULT_LIGHT), true ); diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 4f59287994..e29a0c8d52 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "io/resource_loader.h" #include "globals.h" #include "tools/editor/editor_settings.h" - +#include "scene/3d/sprite_3d.h" @@ -355,6 +355,35 @@ void SpriteFramesEditor::_animation_select() { } + +static void _find_anim_sprites(Node* p_node,List<Node*> *r_nodes,Ref<SpriteFrames> p_sfames) { + + Node *edited = EditorNode::get_singleton()->get_edited_scene(); + if (!edited) + return; + if (p_node!=edited && p_node->get_owner()!=edited) + return; + + { + AnimatedSprite *as = p_node->cast_to<AnimatedSprite>(); + if (as && as->get_sprite_frames()==p_sfames) { + r_nodes->push_back(p_node); + } + } + + { + AnimatedSprite3D *as = p_node->cast_to<AnimatedSprite3D>(); + if (as && as->get_sprite_frames()==p_sfames) { + r_nodes->push_back(p_node); + } + } + + for(int i=0;i<p_node->get_child_count();i++) { + _find_anim_sprites(p_node->get_child(i),r_nodes,p_sfames); + } + +} + void SpriteFramesEditor::_animation_name_edited(){ if (updating) @@ -381,9 +410,24 @@ void SpriteFramesEditor::_animation_name_edited(){ name=new_name+" "+itos(counter); } + List<Node*> nodes; + _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames)); + undo_redo->create_action(TTR("Rename Animation")); undo_redo->add_do_method(frames,"rename_animation",edited_anim,name); undo_redo->add_undo_method(frames,"rename_animation",name,edited_anim); + + for(List<Node*>::Element *E=nodes.front();E;E=E->next()) { + + String current = E->get()->call("get_animation"); + if (current!=edited_anim) + continue; + + undo_redo->add_do_method(E->get(),"set_animation",name); + undo_redo->add_undo_method(E->get(),"set_animation",edited_anim); + + } + undo_redo->add_do_method(this,"_update_library"); undo_redo->add_undo_method(this,"_update_library"); @@ -406,12 +450,28 @@ void SpriteFramesEditor::_animation_add(){ name=new_name+" "+itos(counter); } + List<Node*> nodes; + _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames)); + + undo_redo->create_action(TTR("Add Animation")); undo_redo->add_do_method(frames,"add_animation",name); undo_redo->add_undo_method(frames,"remove_animation",name); undo_redo->add_do_method(this,"_update_library"); undo_redo->add_undo_method(this,"_update_library"); + + for(List<Node*>::Element *E=nodes.front();E;E=E->next()) { + + String current = E->get()->call("get_animation"); + if (frames->has_animation(current)) + continue; + + undo_redo->add_do_method(E->get(),"set_animation",name); + undo_redo->add_undo_method(E->get(),"set_animation",current); + + } + edited_anim=new_name; undo_redo->commit_action(); @@ -426,6 +486,7 @@ void SpriteFramesEditor::_animation_remove(){ if (!frames->has_animation(edited_anim)) return; + undo_redo->create_action(TTR("Remove Animation")); undo_redo->add_do_method(frames,"remove_animation",edited_anim); undo_redo->add_undo_method(frames,"add_animation",edited_anim); diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 8515008982..db888208fb 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -302,7 +302,6 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input) } } } else if (edited_margin < 0) { - print_line("EDIT RECTANGLE!!!"); drag_from=mtx.affine_inverse().xform(Vector2(mb.x,mb.y)); if (snap_mode == SNAP_PIXEL) drag_from = drag_from.snapped(Vector2(1,1)); @@ -332,7 +331,6 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input) } } else if (drag) { - print_line("DRAGING!!!"); if (edited_margin >= 0) { undo_redo->create_action("Set Margin"); static Margin m[4] = {MARGIN_TOP,MARGIN_BOTTOM,MARGIN_LEFT,MARGIN_RIGHT}; @@ -705,14 +703,24 @@ void TextureRegionEditor::_edit_region() bool merged = true; while (merged) { merged = false; + bool queue_erase = false; for (List<Rect2>::Element *F = autoslice_cache.front(); F; F=F->next()) { + if (queue_erase){ + autoslice_cache.erase(F->prev()); + queue_erase = false; + } if (F==E) continue; if (E->get().grow(1).intersects(F->get())) { E->get().expand_to(F->get().pos); E->get().expand_to(F->get().pos+F->get().size); - F=F->prev(); - autoslice_cache.erase(F->next()); + if (F->prev()) { + F=F->prev(); + autoslice_cache.erase(F->next()); + } else { + queue_erase = true; + //Cant delete the first rect in the list. + } merged = true; } } @@ -776,6 +784,8 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor) snap_step=Vector2(10,10); snap_separation = Vector2(0,0); + edited_margin = -1; + drag_index = -1; drag=false; VBoxContainer *main_vb = memnew( VBoxContainer ); diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index d5f85d3333..d686c37d1a 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -223,7 +223,7 @@ void TileMapEditor::_update_palette() { String name; if (tileset->tile_get_name(E->get())!="") { - name = tileset->tile_get_name(E->get()); + name = itos(E->get())+" - "+tileset->tile_get_name(E->get()); } else { name = "#"+itos(E->get()); } @@ -412,6 +412,24 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h if (node->get_tile_origin()==TileMap::TILE_ORIGIN_TOP_LEFT) { rect.pos+=tile_ofs; + } else if (node->get_tile_origin()==TileMap::TILE_ORIGIN_BOTTOM_LEFT) { + Size2 cell_size = node->get_cell_size(); + + rect.pos+=tile_ofs; + + if(p_transpose) + { + if(p_flip_h) + rect.pos.x-=cell_size.x; + else + rect.pos.x+=cell_size.x; + } else { + if(p_flip_v) + rect.pos.y-=cell_size.y; + else + rect.pos.y+=cell_size.y; + } + } else if (node->get_tile_origin()==TileMap::TILE_ORIGIN_CENTER) { rect.pos+=node->get_cell_size()/2; Vector2 s = r.size; diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp index a2c7147bf3..39a15189e7 100644 --- a/tools/editor/plugins/tile_set_editor_plugin.cpp +++ b/tools/editor/plugins/tile_set_editor_plugin.cpp @@ -73,24 +73,24 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me p_library->tile_set_name(id,mi->get_name()); } - - p_library->tile_set_texture(id,texture); p_library->tile_set_material(id,material); Vector2 phys_offset; + Size2 s; - if (mi->is_centered()) { - Size2 s; - if (mi->is_region()) { - s=mi->get_region_rect().size; - } else { - s=texture->get_size(); - } - phys_offset+=-s/2; - } if (mi->is_region()) { + s=mi->get_region_rect().size; p_library->tile_set_region(id,mi->get_region_rect()); + } else { + const int frame = mi->get_frame(); + const int hframes = mi->get_hframes(); + s=texture->get_size()/Size2(hframes,mi->get_vframes()); + p_library->tile_set_region(id,Rect2(Vector2(frame%hframes,frame/hframes)*s,s)); + } + + if (mi->is_centered()) { + phys_offset+=-s/2; } Vector<Ref<Shape2D> >collisions; diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 3f82199fc3..103962716b 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -431,7 +431,6 @@ void ProjectExportDialog::_validate_platform() { void ProjectExportDialog::_export_mode_changed(int p_idx) { - bool do_all = p_idx==0; if (EditorImportExport::get_singleton()->get_export_filter()==p_idx) return; EditorImportExport::get_singleton()->set_export_filter(EditorImportExport::ExportFilter(p_idx)); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index d8814fd50e..caf116523a 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -31,6 +31,7 @@ #include "os/os.h" #include "os/dir_access.h" #include "os/file_access.h" +#include "os/keyboard.h" #include "editor_settings.h" #include "scene/gui/separator.h" #include "scene/gui/tool_button.h" @@ -46,20 +47,33 @@ #include "io/resource_saver.h" #include "editor_themes.h" - +#include "editor_initialize_ssl.h" #include "editor_scale.h" +#include "io/zip_io.h" + class NewProjectDialog : public ConfirmationDialog { OBJ_TYPE(NewProjectDialog,ConfirmationDialog); +public: - bool import_mode; + enum Mode { + MODE_NEW, + MODE_IMPORT, + MODE_INSTALL + }; +private: + + Mode mode; Label *pp,*pn; Label *error; LineEdit *project_path; LineEdit *project_name; FileDialog *fdialog; + String zip_path; + String zip_title; + AcceptDialog *dialog_error; bool _test_path() { @@ -72,7 +86,7 @@ class NewProjectDialog : public ConfirmationDialog { return false; } - if (!import_mode) { + if (mode!=MODE_IMPORT) { if (d->file_exists("engine.cfg")) { @@ -109,7 +123,7 @@ class NewProjectDialog : public ConfirmationDialog { if (lidx!=-1) { sp=sp.substr(lidx+1,sp.length()); } - if (sp=="" && import_mode ) + if (sp=="" && mode==MODE_IMPORT ) sp=TTR("Imported Project"); project_name->set_text(sp); @@ -119,7 +133,7 @@ class NewProjectDialog : public ConfirmationDialog { void _file_selected(const String& p_path) { String p = p_path; - if (import_mode) { + if (mode==MODE_IMPORT) { if (p.ends_with("engine.cfg")) { p=p.get_base_dir(); @@ -141,7 +155,7 @@ class NewProjectDialog : public ConfirmationDialog { void _browse_path() { - if (import_mode) { + if (mode==MODE_IMPORT) { fdialog->set_mode(FileDialog::MODE_OPEN_FILE); fdialog->clear_filters(); @@ -163,7 +177,7 @@ class NewProjectDialog : public ConfirmationDialog { String dir; - if (import_mode) { + if (mode==MODE_IMPORT) { dir=project_path->get_text(); @@ -179,26 +193,131 @@ class NewProjectDialog : public ConfirmationDialog { dir=d->get_current_dir(); memdelete(d); - FileAccess *f = FileAccess::open(dir.plus_file("/engine.cfg"),FileAccess::WRITE); - if (!f) { - error->set_text(TTR("Couldn't create engine.cfg in project path.")); - } else { + if (mode==MODE_NEW) { + + + + + FileAccess *f = FileAccess::open(dir.plus_file("/engine.cfg"),FileAccess::WRITE); + if (!f) { + error->set_text(TTR("Couldn't create engine.cfg in project path.")); + } else { + + f->store_line("; Engine configuration file."); + f->store_line("; It's best edited using the editor UI and not directly,"); + f->store_line("; since the parameters that go here are not all obvious."); + f->store_line("; "); + f->store_line("; Format: "); + f->store_line("; [section] ; section goes between []"); + f->store_line("; param=value ; assign values to parameters"); + f->store_line("\n"); + f->store_line("[application]"); + f->store_line("\n"); + f->store_line("name=\""+project_name->get_text()+"\""); + f->store_line("icon=\"res://icon.png\""); + + memdelete(f); + + ResourceSaver::save(dir.plus_file("/icon.png"),get_icon("DefaultProjectIcon","EditorIcons")); + } + + } else if (mode==MODE_INSTALL) { + + + FileAccess *src_f=NULL; + zlib_filefunc_def io = zipio_create_io_from_file(&src_f); + + unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io); + if (!pkg) { + + dialog_error->set_text("Error opening package file, not in zip format."); + return; + } + + int ret = unzGoToFirstFile(pkg); + + Vector<String> failed_files; + + int idx=0; + while(ret==UNZ_OK) { + + //get filename + unz_file_info info; + char fname[16384]; + ret = unzGetCurrentFileInfo(pkg,&info,fname,16384,NULL,0,NULL,0); + + String path=fname; + + int depth=1; //stuff from github comes with tag + bool skip=false; + while(depth>0) { + int pp = path.find("/"); + if (pp==-1) { + skip=true; + break; + } + path=path.substr(pp+1,path.length()); + depth--; + } + + + if (skip || path==String()) { + // + } else if (path.ends_with("/")) { // a dir + + path=path.substr(0,path.length()-1); + + DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + da->make_dir(dir.plus_file(path)); + memdelete(da); + + } else { + + Vector<uint8_t> data; + data.resize(info.uncompressed_size); + + //read + unzOpenCurrentFile(pkg); + unzReadCurrentFile(pkg,data.ptr(),data.size()); + unzCloseCurrentFile(pkg); + + FileAccess *f=FileAccess::open(dir.plus_file(path),FileAccess::WRITE); + + if (f) { + f->store_buffer(data.ptr(),data.size()); + memdelete(f); + } else { + failed_files.push_back(path); + } + + + } + + idx++; + ret = unzGoToNextFile(pkg); + } + + unzClose(pkg); + + if (failed_files.size()) { + String msg=TTR("The following files failed extraction from package:")+"\n\n"; + for(int i=0;i<failed_files.size();i++) { + + if (i>15) { + msg+="\nAnd "+itos(failed_files.size()-i)+" more files."; + break; + } + msg+=failed_files[i]+"\n"; + } + + dialog_error->set_text(msg); + dialog_error->popup_centered_minsize(); + + } else { + dialog_error->set_text(TTR("Package Installed Successfully!")); + dialog_error->popup_centered_minsize(); + } - f->store_line("; Engine configuration file."); - f->store_line("; It's best to edit using the editor UI, not directly,"); - f->store_line("; becausethe parameters that go here are not obvious."); - f->store_line("; "); - f->store_line("; Format: "); - f->store_line("; [section] ; section goes between []"); - f->store_line("; param=value ; assign values to parameters"); - f->store_line("\n"); - f->store_line("[application]"); - f->store_line("name=\""+project_name->get_text()+"\""); - f->store_line("icon=\"res://icon.png\""); - - memdelete(f); - - ResourceSaver::save(dir.plus_file("/icon.png"),get_icon("DefaultProjectIcon","EditorIcons")); } @@ -233,10 +352,16 @@ protected: public: + void set_zip_path(const String& p_path) { + zip_path=p_path; + } + void set_zip_title(const String& p_title) { + zip_title=p_title; + } - void set_import_mode(bool p_import ) { + void set_mode(Mode p_mode) { - import_mode=p_import; + mode=p_mode; } void show_dialog() { @@ -245,7 +370,7 @@ public: project_path->clear(); project_name->clear(); - if (import_mode) { + if (mode==MODE_IMPORT) { set_title(TTR("Import Existing Project")); get_ok()->set_text(TTR("Import")); pp->set_text(TTR("Project Path (Must Exist):")); @@ -253,9 +378,10 @@ public: pn->hide(); project_name->hide(); - popup_centered(Size2(500,125)); + popup_centered(Size2(500,125)*EDSCALE); + + } else if (mode==MODE_NEW){ - } else { set_title(TTR("Create New Project")); get_ok()->set_text(TTR("Create")); pp->set_text(TTR("Project Path:")); @@ -263,7 +389,16 @@ public: pn->show(); project_name->show(); - popup_centered(Size2(500,145)); + popup_centered(Size2(500,145)*EDSCALE); + } else if (mode==MODE_INSTALL){ + + set_title(TTR("Install Project:")+" "+zip_title); + get_ok()->set_text(TTR("Install")); + pp->set_text(TTR("Project Path:")); + pn->hide(); + project_name->hide(); + + popup_centered(Size2(500,125)*EDSCALE); } @@ -329,7 +464,10 @@ public: fdialog->connect("dir_selected", this,"_path_selected"); fdialog->connect("file_selected", this,"_file_selected"); set_hide_on_ok(false); - import_mode=false; + mode=MODE_NEW; + + dialog_error = memnew( AcceptDialog ); + add_child(dialog_error); } @@ -354,6 +492,10 @@ void ProjectManager::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { get_tree()->set_editor_hint(true); + + } else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + + set_process_unhandled_input(is_visible()); } } @@ -439,6 +581,134 @@ void ProjectManager::_panel_input(const InputEvent& p_ev,Node *p_hb) { } } +void ProjectManager::_unhandled_input(const InputEvent& p_ev) { + + if (p_ev.type==InputEvent::KEY) { + + const InputEventKey &k = p_ev.key; + + if (!k.pressed) + return; + + bool scancode_handled = true; + + switch (k.scancode) { + + case KEY_HOME: { + + for (int i=0; i<scroll_childs->get_child_count(); i++) { + + HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + if (hb) { + selected_list.clear(); + selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene")); + scroll->set_v_scroll(0); + break; + } + } + + } break; + case KEY_END: { + + for (int i=scroll_childs->get_child_count()-1; i>=0; i--) { + + HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + if (hb) { + selected_list.clear(); + selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene")); + scroll->set_v_scroll(scroll_childs->get_size().y); + break; + } + } + + } break; + case KEY_UP: { + + if (k.mod.shift) + break; + + if (selected_list.size()) { + + bool found = false; + + for (int i=scroll_childs->get_child_count()-1; i>=0; i--) { + + HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + if (!hb) continue; + + String current = hb->get_meta("name"); + + if (found) { + selected_list.clear(); + selected_list.insert(current, hb->get_meta("main_scene")); + + int offset_diff = scroll->get_v_scroll() - hb->get_pos().y; + + if (offset_diff > 0) + scroll->set_v_scroll(scroll->get_v_scroll() - offset_diff); + + break; + + } else if (current==selected_list.back()->key()) { + + found = true; + } + } + + break; + } + // else fallthrough to key_down + } + case KEY_DOWN: { + + if (k.mod.shift) + break; + + bool found = selected_list.empty(); + + for (int i=0; i<scroll_childs->get_child_count(); i++) { + + HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + if (!hb) continue; + + String current = hb->get_meta("name"); + + if (found) { + selected_list.clear(); + selected_list.insert(current, hb->get_meta("main_scene")); + + int last_y_visible = scroll->get_v_scroll() + scroll->get_size().y; + int offset_diff = (hb->get_pos().y + hb->get_size().y) - last_y_visible; + + if (offset_diff > 0) + scroll->set_v_scroll(scroll->get_v_scroll() + offset_diff); + + break; + + } else if (current==selected_list.back()->key()) { + + found = true; + } + } + + } break; + default: { + scancode_handled = false; + } break; + } + + if (scancode_handled) { + accept_event(); + + for(int i=0;i<scroll_childs->get_child_count();i++) { + CanvasItem *item = scroll_childs->get_child(i)->cast_to<CanvasItem>(); + if (item) + item->update(); + } + } + } +} + void ProjectManager::_favorite_pressed(Node *p_hb) { String clicked = p_hb->get_meta("name"); @@ -616,6 +886,8 @@ void ProjectManager::_load_recent_projects() { run_btn->set_disabled(selected_list.size()<1 || (selected_list.size()==1 && single_selected_main=="")); EditorSettings::get_singleton()->save(); + + tabs->set_current_tab(0); } void ProjectManager::_open_project_confirm() { @@ -755,14 +1027,14 @@ void ProjectManager::_scan_projects() { void ProjectManager::_new_project() { - npdialog->set_import_mode(false); + npdialog->set_mode(NewProjectDialog::MODE_NEW); npdialog->show_dialog(); } void ProjectManager::_import_project() { - npdialog->set_import_mode(true); + npdialog->set_mode(NewProjectDialog::MODE_IMPORT); npdialog->show_dialog(); } @@ -800,6 +1072,15 @@ void ProjectManager::_exit_dialog() { get_tree()->quit(); } + +void ProjectManager::_install_project(const String& p_zip_path,const String& p_title) { + + npdialog->set_mode(NewProjectDialog::MODE_INSTALL); + npdialog->set_zip_path(p_zip_path); + npdialog->set_zip_title(p_title); + npdialog->show_dialog(); +} + void ProjectManager::_bind_methods() { ObjectTypeDB::bind_method("_open_project",&ProjectManager::_open_project); @@ -816,20 +1097,22 @@ void ProjectManager::_bind_methods() { ObjectTypeDB::bind_method("_load_recent_projects",&ProjectManager::_load_recent_projects); ObjectTypeDB::bind_method("_panel_draw",&ProjectManager::_panel_draw); ObjectTypeDB::bind_method("_panel_input",&ProjectManager::_panel_input); + ObjectTypeDB::bind_method("_unhandled_input",&ProjectManager::_unhandled_input); ObjectTypeDB::bind_method("_favorite_pressed",&ProjectManager::_favorite_pressed); + ObjectTypeDB::bind_method("_install_project",&ProjectManager::_install_project); } ProjectManager::ProjectManager() { - int margin = get_constant("margin","Dialogs"); - int button_margin = get_constant("button_margin","Dialogs"); - // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); + + EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came + { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); if (dpi_mode==0) { @@ -871,9 +1154,6 @@ ProjectManager::ProjectManager() { HBoxContainer *top_hb = memnew( HBoxContainer); vb->add_child(top_hb); - TextureFrame *logo = memnew( TextureFrame ); - logo->set_texture(theme->get_icon("LogoSmall","EditorIcons")); - //top_hb->add_child( logo ); CenterContainer *ccl = memnew( CenterContainer ); Label *l = memnew( Label ); l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); @@ -981,10 +1261,10 @@ ProjectManager::ProjectManager() { if (StreamPeerSSL::is_available()) { - asset_library = memnew( EditorAssetLibrary(true) ); asset_library->set_name("Templates"); tabs->add_child(asset_library); + asset_library->connect("install_asset",this,"_install_project"); } else { WARN_PRINT("Asset Library not available, as it requires SSL to work."); } @@ -1018,8 +1298,6 @@ ProjectManager::ProjectManager() { gui_base->add_child(multi_run_ask); - - OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); @@ -1103,6 +1381,8 @@ void ProjectListFilter::_bind_methods() { ProjectListFilter::ProjectListFilter() { + editor_initialize_certificates(); //for asset sharing + _current_filter = FILTER_NAME; filter_option = memnew(OptionButton); diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h index 2db1bb839e..74d1d3693c 100644 --- a/tools/editor/project_manager.h +++ b/tools/editor/project_manager.h @@ -88,8 +88,11 @@ class ProjectManager : public Control { void _load_recent_projects(); void _scan_dir(DirAccess *da,float pos, float total,List<String> *r_projects); + void _install_project(const String& p_zip_path,const String& p_title); + void _panel_draw(Node *p_hb); void _panel_input(const InputEvent& p_ev,Node *p_hb); + void _unhandled_input(const InputEvent& p_ev); void _favorite_pressed(Node *p_hb); protected: diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 6822e50b73..6be1abf52f 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -100,16 +100,6 @@ void ProjectSettings::_notification(int p_what) { translation_res_file_open->add_filter("*."+E->get()); translation_res_option_file_open->add_filter("*."+E->get()); } - - List<String> afn; - ResourceLoader::get_recognized_extensions_for_type("Script",&afn); - ResourceLoader::get_recognized_extensions_for_type("PackedScene",&afn); - - for (List<String>::Element *E=afn.front();E;E=E->next()) { - - autoload_file_open->add_filter("*."+E->get()); - } - } } @@ -564,7 +554,7 @@ void ProjectSettings::popup_project_settings() { popup_centered_ratio(); globals_editor->update_category_list(); _update_translations(); - _update_autoload(); + autoload_settings->update_autoload(); plugin_settings->update_plugins(); } @@ -616,10 +606,26 @@ void ProjectSettings::_item_add() { String name = catname!="" ? catname+"/"+propname : propname; - Globals::get_singleton()->set(name,value); + undo_redo->create_action("Add Global Property"); + + undo_redo->add_do_property(Globals::get_singleton(), name, value); + undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, true); + + if (Globals::get_singleton()->has(name)) { + undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name)); + } else { + undo_redo->add_undo_property(Globals::get_singleton(), name, Variant()); + } + + undo_redo->add_do_method(globals_editor, "update_category_list"); + undo_redo->add_undo_method(globals_editor, "update_category_list"); + + undo_redo->add_do_method(this, "_settings_changed"); + undo_redo->add_undo_method(this, "_settings_changed"); + + undo_redo->commit_action(); globals_editor->set_current_section(catname); - globals_editor->update_category_list(); _settings_changed(); } @@ -633,10 +639,20 @@ void ProjectSettings::_item_del() { String name = catname!="" ? catname+"/"+propname : propname; - Globals::get_singleton()->set(name,Variant()); + undo_redo->create_action("Delete Global Property"); - globals_editor->set_current_section(catname); - globals_editor->update_category_list(); + undo_redo->add_do_property(Globals::get_singleton(), name, Variant()); + + undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name)); + undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", name, Globals::get_singleton()->is_persisting(name)); + + undo_redo->add_do_method(globals_editor, "update_category_list"); + undo_redo->add_undo_method(globals_editor, "update_category_list"); + + undo_redo->add_do_method(this, "_settings_changed"); + undo_redo->add_undo_method(this, "_settings_changed"); + + undo_redo->commit_action(); _settings_changed(); } @@ -811,263 +827,6 @@ void ProjectSettings::_translation_file_open() { translation_file_open->popup_centered_ratio(); } - -void ProjectSettings::_autoload_file_callback(const String& p_path) { - - autoload_add_path->set_text(p_path); - //if (autoload_add_name->get_text().strip_edges()==String()) { - - autoload_add_name->set_text( p_path.get_file().basename() ); - //} - - //_translation_add(p_translation); -} - -void ProjectSettings::_autoload_file_open() { - - autoload_file_open->popup_centered_ratio(); -} - -void ProjectSettings::_autoload_edited() { - - if (updating_autoload) - return; - - TreeItem *ti = autoload_list->get_edited(); - int column = autoload_list->get_edited_column(); - - if (!ti || (column != 0 && column != 2)) - return; - - if (column == 0) { - String name = ti->get_text(0); - String old_name = selected_autoload.substr(selected_autoload.find("/")+1,selected_autoload.length()); - - if (!name.is_valid_identifier()) { - ti->set_text(0,old_name); - message->set_text(TTR("Invalid name.")+"\n"+TTR("Valid characters:")+" a-z, A-Z, 0-9 or _"); - message->popup_centered(Size2(300,100)); - return; - } - - if (ObjectTypeDB::type_exists(name)) { - ti->set_text(0,old_name); - message->set_text(TTR("Invalid name. Must not collide with an existing engine class name.")); - message->popup_centered(Size2(400,100)); - return; - } - - for(int i=0;i<Variant::VARIANT_MAX;i++) { - if (Variant::get_type_name(Variant::Type(i))==name) { - ti->set_text(0,old_name); - message->set_text(TTR("Invalid name. Must not collide with an existing buit-in type name.")); - message->popup_centered(Size2(400,100)); - return; - } - } - - for(int i=0;i<GlobalConstants::get_global_constant_count();i++) { - if (GlobalConstants::get_global_constant_name(i)==name) { - ti->set_text(0,old_name); - message->set_text(TTR("Invalid name. Must not collide with an existing global constant name.")); - message->popup_centered(Size2(400,100)); - return; - } - } - - if (Globals::get_singleton()->has("autoload/"+name)) { - ti->set_text(0,old_name); - message->set_text(vformat(TTR("Autoload '%s' already exists!"),name)); - message->popup_centered(Size2(300,100)); - return; - } - - updating_autoload = true; - - name = "autoload/"+name; - String path = Globals::get_singleton()->get(selected_autoload); - bool is_persisting = Globals::get_singleton()->is_persisting(selected_autoload); - int order = Globals::get_singleton()->get_order(selected_autoload); - - undo_redo->create_action(TTR("Rename Autoload")); - undo_redo->add_do_property(Globals::get_singleton(),name,path); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,is_persisting); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",name,order); - undo_redo->add_do_method(Globals::get_singleton(),"clear",selected_autoload); - undo_redo->add_undo_property(Globals::get_singleton(),selected_autoload,path); - undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",selected_autoload,is_persisting); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",selected_autoload,order); - undo_redo->add_undo_method(Globals::get_singleton(),"clear",name); - undo_redo->add_do_method(this,"_update_autoload"); - undo_redo->add_undo_method(this,"_update_autoload"); - undo_redo->add_do_method(this,"_settings_changed"); - undo_redo->add_undo_method(this,"_settings_changed"); - undo_redo->commit_action(); - - selected_autoload = name; - } else if (column == 2) { - updating_autoload = true; - - bool checked = ti->is_checked(2); - String base = "autoload/"+ti->get_text(0); - String path = Globals::get_singleton()->get(base); - int order = Globals::get_singleton()->get_order(base); - - if (path.begins_with("*")) - path = path.substr(1,path.length()); - - if (checked) - path = "*" + path; - - undo_redo->create_action(TTR("Toggle AutoLoad Globals")); - undo_redo->add_do_property(Globals::get_singleton(),base,path); - undo_redo->add_undo_property(Globals::get_singleton(),base,Globals::get_singleton()->get(base)); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",base,order); // keep order, as config order matters for these - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",base,order); - undo_redo->add_do_method(this,"_update_autoload"); - undo_redo->add_undo_method(this,"_update_autoload"); - undo_redo->add_do_method(this,"_settings_changed"); - undo_redo->add_undo_method(this,"_settings_changed"); - undo_redo->commit_action(); - } - - updating_autoload = false; -} - -void ProjectSettings::_autoload_add() { - - String name = autoload_add_name->get_text(); - if (!name.is_valid_identifier()) { - message->set_text(TTR("Invalid name.")+"\n"+TTR("Valid characters:")+" a-z, A-Z, 0-9 or _"); - message->popup_centered(Size2(300,100)); - return; - - } - - if (ObjectTypeDB::type_exists(name)) { - - message->set_text(TTR("Invalid name. Must not collide with an existing engine class name.")); - message->popup_centered(Size2(300,100)); - return; - - } - - for(int i=0;i<Variant::VARIANT_MAX;i++) { - if (Variant::get_type_name(Variant::Type(i))==name) { - - message->set_text(TTR("Invalid name. Must not collide with an existing buit-in type name.")); - message->popup_centered(Size2(300,100)); - return; - - } - } - - for(int i=0;i<GlobalConstants::get_global_constant_count();i++) { - - if (GlobalConstants::get_global_constant_name(i)==name) { - - message->set_text(TTR("Invalid name. Must not collide with an existing global constant name.")); - message->popup_centered(Size2(300,100)); - return; - } - - } - - String path = autoload_add_path->get_text(); - if (!FileAccess::exists(path)) { - message->set_text("Invalid Path.\nFile does not exist."); - message->popup_centered(Size2(300,100)); - return; - - } - if (!path.begins_with("res://")) { - message->set_text("Invalid Path.\nNot in resource path."); - message->popup_centered(Size2(300,100)); - return; - - } - - undo_redo->create_action(TTR("Add Autoload")); - name = "autoload/"+name; - undo_redo->add_do_property(Globals::get_singleton(),name,"*"+path); - if (Globals::get_singleton()->has(name)) - undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name)); - else - undo_redo->add_undo_property(Globals::get_singleton(),name,Variant()); - - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true); - undo_redo->add_do_method(this,"_update_autoload"); - undo_redo->add_undo_method(this,"_update_autoload"); - undo_redo->add_do_method(this,"_settings_changed"); - undo_redo->add_undo_method(this,"_settings_changed"); - undo_redo->commit_action(); - - autoload_add_path->set_text(""); - autoload_add_name->set_text(""); - - //autoload_file_open->popup_centered_ratio(); -} - -void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button) { - - - TreeItem *ti=p_item->cast_to<TreeItem>(); - String name = "autoload/"+ti->get_text(0); - - if (p_button==0) { - //delete - int order = Globals::get_singleton()->get_order(name); - undo_redo->create_action(TTR("Remove Autoload")); - undo_redo->add_do_property(Globals::get_singleton(),name,Variant()); - undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name)); - undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",name,true); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,order); - undo_redo->add_do_method(this,"_update_autoload"); - undo_redo->add_undo_method(this,"_update_autoload"); - undo_redo->add_do_method(this,"_settings_changed"); - undo_redo->add_undo_method(this,"_settings_changed"); - undo_redo->commit_action(); - } else { - - TreeItem *swap = NULL; - - if (p_button==1) { - swap=ti->get_prev(); - } else if (p_button==2) { - swap=ti->get_next(); - } - if (!swap) - return; - - String swap_name= "autoload/"+swap->get_text(0); - - int order = Globals::get_singleton()->get_order(name); - int swap_order = Globals::get_singleton()->get_order(swap_name); - - undo_redo->create_action(TTR("Move Autoload")); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",swap_name,order); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",name,swap_order); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",swap_name,swap_order); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,order); - undo_redo->add_do_method(this,"_update_autoload"); - undo_redo->add_undo_method(this,"_update_autoload"); - undo_redo->add_do_method(this,"_settings_changed"); - undo_redo->add_undo_method(this,"_settings_changed"); - undo_redo->commit_action(); - - } - -} - -void ProjectSettings::_autoload_selected() { - TreeItem *ti = autoload_list->get_selected(); - - if (!ti) - return; - - selected_autoload = "autoload/"+ti->get_text(0); -} - void ProjectSettings::_translation_delete(Object *p_item,int p_column, int p_button) { TreeItem *ti = p_item->cast_to<TreeItem>(); @@ -1393,55 +1152,6 @@ void ProjectSettings::_update_translations() { } -void ProjectSettings::_update_autoload() { - - if (updating_autoload) - return; - - updating_autoload=true; - - autoload_list->clear(); - TreeItem *root = autoload_list->create_item(); - autoload_list->set_hide_root(true); - - List<PropertyInfo> props; - Globals::get_singleton()->get_property_list(&props); - - for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { - - const PropertyInfo &pi=E->get(); - if (!pi.name.begins_with("autoload/")) - continue; - - String name = pi.name.get_slice("/",1); - String path = Globals::get_singleton()->get(pi.name); - - if (name=="") - continue; - bool global=false; - if (path.begins_with("*")) { - path=path.substr(1,path.length()); - global=true; - } - TreeItem *t = autoload_list->create_item(root); - t->set_text(0,name); - t->set_editable(0,true); - t->set_text(1,path); - t->set_cell_mode(2,TreeItem::CELL_MODE_CHECK); - t->set_editable(2,true); - t->set_text(2,TTR("Enable")); - t->set_checked(2,global); - t->add_button(3,get_icon("MoveUp","EditorIcons"),1); - t->add_button(3,get_icon("MoveDown","EditorIcons"),2); - t->add_button(3,get_icon("Del","EditorIcons"),0); - - - } - - updating_autoload=false; - -} - void ProjectSettings::_toggle_search_bar(bool p_pressed) { globals_editor->get_property_editor()->set_use_filter(p_pressed); @@ -1508,14 +1218,6 @@ void ProjectSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("_translation_res_delete"),&ProjectSettings::_translation_res_delete); ObjectTypeDB::bind_method(_MD("_translation_res_option_delete"),&ProjectSettings::_translation_res_option_delete); - ObjectTypeDB::bind_method(_MD("_autoload_add"),&ProjectSettings::_autoload_add); - ObjectTypeDB::bind_method(_MD("_autoload_file_open"),&ProjectSettings::_autoload_file_open); - ObjectTypeDB::bind_method(_MD("_autoload_file_callback"),&ProjectSettings::_autoload_file_callback); - ObjectTypeDB::bind_method(_MD("_update_autoload"),&ProjectSettings::_update_autoload); - ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete); - ObjectTypeDB::bind_method(_MD("_autoload_edited"),&ProjectSettings::_autoload_edited); - ObjectTypeDB::bind_method(_MD("_autoload_selected"),&ProjectSettings::_autoload_selected); - ObjectTypeDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box); ObjectTypeDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar); @@ -1858,69 +1560,10 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { { - VBoxContainer *avb = memnew( VBoxContainer ); - tab_container->add_child(avb); - avb->set_name(TTR("AutoLoad")); - HBoxContainer *ahb = memnew( HBoxContainer); - avb->add_child(ahb); - - - VBoxContainer *avb_path = memnew( VBoxContainer ); - avb_path->set_h_size_flags(SIZE_EXPAND_FILL); - HBoxContainer *ahb_path = memnew( HBoxContainer ); - autoload_add_path = memnew(LineEdit); - autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); - ahb_path->add_child(autoload_add_path); - Button *browseaa = memnew( Button("..") ); - ahb_path->add_child(browseaa); - browseaa->connect("pressed",this,"_autoload_file_open"); - - avb_path->add_margin_child(TTR("Path:"),ahb_path); - ahb->add_child(avb_path); - - VBoxContainer *avb_name = memnew( VBoxContainer ); - avb_name->set_h_size_flags(SIZE_EXPAND_FILL); - - HBoxContainer *ahb_name = memnew( HBoxContainer ); - autoload_add_name = memnew(LineEdit); - autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); - ahb_name->add_child(autoload_add_name); - avb_name->add_margin_child(TTR("Node Name:"),ahb_name); - Button *addaa = memnew( Button(TTR("Add")) ); - ahb_name->add_child(addaa); - addaa->connect("pressed",this,"_autoload_add"); - - ahb->add_child(avb_name); - - autoload_list = memnew( Tree ); - autoload_list->set_v_size_flags(SIZE_EXPAND_FILL); - avb->add_margin_child(TTR("List:"),autoload_list,true); - - autoload_file_open=memnew( EditorFileDialog ); - add_child(autoload_file_open); - autoload_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); - autoload_file_open->connect("file_selected",this,"_autoload_file_callback"); - - autoload_list->set_columns(4); - autoload_list->set_column_titles_visible(true); - autoload_list->set_column_title(0,TTR("Name")); - autoload_list->set_column_expand(0,true); - autoload_list->set_column_min_width(0,100); - autoload_list->set_column_title(1,TTR("Path")); - autoload_list->set_column_expand(1,true); - autoload_list->set_column_min_width(1,100); - autoload_list->set_column_title(2,TTR("Singleton")); - autoload_list->set_column_expand(2,false); - autoload_list->set_column_min_width(2,80); - autoload_list->set_column_expand(3,false); - autoload_list->set_column_min_width(3,80); - - autoload_list->connect("button_pressed",this,"_autoload_delete"); - autoload_list->connect("item_edited",this,"_autoload_edited"); - autoload_list->connect("cell_selected", this, "_autoload_selected"); - - updating_autoload=false; - + autoload_settings = memnew( EditorAutoloadSettings ); + autoload_settings->set_name(TTR("AutoLoad")); + tab_container->add_child(autoload_settings); + autoload_settings->connect("autoload_changed", this, "_settings_changed"); } { diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index 79e1acf75e..46e98f69ad 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -34,6 +34,7 @@ #include "undo_redo.h" #include "editor_data.h" #include "scene/gui/tab_container.h" +#include "editor_autoload_settings.h" #include "editor_plugin_settings.h" //#include "project_export_settings.h" @@ -88,26 +89,10 @@ class ProjectSettings : public AcceptDialog { Tree *translation_remap; Tree *translation_remap_options; - - Tree *autoload_list; - String selected_autoload; - EditorFileDialog *autoload_file_open; - LineEdit *autoload_add_name; - LineEdit *autoload_add_path; - + EditorAutoloadSettings *autoload_settings; EditorPluginSettings *plugin_settings; - void _update_autoload(); - void _autoload_file_callback(const String& p_path); - void _autoload_add(); - void _autoload_edited(); - void _autoload_file_open(); - void _autoload_delete(Object *p_item,int p_column, int p_button); - void _autoload_selected(); - bool updating_autoload; - - void _item_selected(); void _item_adds(String); void _item_add(); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 246785932d..54d197f10d 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -389,7 +389,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty List<String> names; names.push_back("value:"); config_value_editors(1,1,50,names); - Vector3 vec=v; value_editor[0]->set_text( String::num(v) ); } @@ -436,7 +435,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty List<String> names; names.push_back("string:"); config_value_editors(1,1,50,names); - Vector3 vec=v; value_editor[0]->set_text( v ); } @@ -612,6 +610,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA); color_picker->set_color(v); set_size( Size2(300*EDSCALE, color_picker->get_combined_minimum_size().height+10*EDSCALE)); + color_picker->set_focus_on_line_edit(); /* int ofs=80; int m=10; @@ -2980,10 +2979,8 @@ void PropertyEditor::update_tree() { else item->set_cell_mode( 1, TreeItem::CELL_MODE_RANGE_EXPRESSION ); - if (p.hint==PROPERTY_HINT_SPRITE_FRAME) { - item->set_range_config(1,0,99999,1); - } else if (p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) { + if (p.hint==PROPERTY_HINT_SPRITE_FRAME || p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) { int c = p.hint_string.get_slice_count(","); float min=0,max=100,step=1; @@ -3346,7 +3343,6 @@ void PropertyEditor::update_tree() { String type; if (p.hint==PROPERTY_HINT_RESOURCE_TYPE) type=p.hint_string; - bool notnil=false; if (obj->get( p.name ).get_type() == Variant::NIL || obj->get( p.name ).operator RefPtr().is_null()) { item->set_text(1,"<null>"); @@ -3369,8 +3365,7 @@ void PropertyEditor::update_tree() { } else { item->set_text(1,"<"+res->get_type()+">"); - }; - notnil=true; + } if (has_icon(res->get_type(),"EditorIcons")) { type=res->get_type(); @@ -4192,6 +4187,8 @@ public: void SectionedPropertyEditor::_bind_methods() { ObjectTypeDB::bind_method("_section_selected",&SectionedPropertyEditor::_section_selected); + + ObjectTypeDB::bind_method("update_category_list", &SectionedPropertyEditor::update_category_list); } void SectionedPropertyEditor::_section_selected(int p_which) { @@ -4235,19 +4232,32 @@ String SectionedPropertyEditor::get_full_item_path(const String& p_item) { void SectionedPropertyEditor::edit(Object* p_object) { - if (p_object) { - obj=p_object->get_instance_ID(); - update_category_list(); - } else { + if (!p_object) { + obj = -1; sections->clear(); + + filter->set_edited(NULL); + editor->edit(NULL); + + return; } - filter->set_edited(p_object); - editor->edit(filter); + ObjectID id = p_object->get_instance_ID(); - sections->select(0); - _section_selected(0); + if (obj != id) { + + obj = id; + update_category_list(); + filter->set_edited(p_object); + editor->edit(filter); + + sections->select(0); + _section_selected(0); + } else { + + update_category_list(); + } } void SectionedPropertyEditor::update_category_list() { @@ -4303,6 +4313,8 @@ PropertyEditor *SectionedPropertyEditor::get_property_editor() { SectionedPropertyEditor::SectionedPropertyEditor() { + obj = -1; + VBoxContainer *left_vb = memnew( VBoxContainer); left_vb->set_custom_minimum_size(Size2(160,0)*EDSCALE); add_child(left_vb); diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp index fc2a2241ab..e18dc584d5 100644 --- a/tools/editor/quick_open.cpp +++ b/tools/editor/quick_open.cpp @@ -109,16 +109,27 @@ void EditorQuickOpen::_sbox_input(const InputEvent& p_ie) { } -void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { +float EditorQuickOpen::_path_cmp(String search, String path) const { + + if (search == path) { + return 1.2f; + } + if (path.findn(search) != -1) { + return 1.1f; + } + return path.to_lower().similarity(search.to_lower()); +} + +void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector< Pair< String, Ref<Texture> > > &list) { if (!add_directories) { for(int i=0;i<efsd->get_subdir_count();i++) { - _parse_fs(efsd->get_subdir(i)); + _parse_fs(efsd->get_subdir(i), list); } } - TreeItem *root = search_options->get_root(); + String search_text = search_box->get_text(); if (add_directories) { String path = efsd->get_path(); @@ -126,11 +137,27 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { path+="/"; if (path!="res://") { path=path.substr(6,path.length()); - if (search_box->get_text().is_subsequence_ofi(path)) { - TreeItem *ti = search_options->create_item(root); - ti->set_text(0,path); - Ref<Texture> icon = get_icon("folder","FileDialog"); - ti->set_icon(0,icon); + if (search_text.is_subsequence_ofi(path)) { + Pair< String, Ref<Texture> > pair; + pair.first = path; + pair.second = get_icon("folder", "FileDialog"); + + if (search_text != String() && list.size() > 0) { + + float this_sim = _path_cmp(search_text, path); + float other_sim = _path_cmp(list[0].first, path); + int pos = 1; + + while (pos < list.size() && this_sim <= other_sim) { + other_sim = _path_cmp(list[pos++].first, path); + } + + pos = this_sim >= other_sim ? pos - 1 : pos; + list.insert(pos, pair); + + } else { + list.push_back(pair); + } } } } @@ -138,12 +165,29 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { String file = efsd->get_file_path(i); file=file.substr(6,file.length()); - if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_box->get_text().is_subsequence_ofi(file))) { - TreeItem *ti = search_options->create_item(root); - ti->set_text(0,file); - Ref<Texture> icon = get_icon( (has_icon(efsd->get_file_type(i),ei)?efsd->get_file_type(i):ot),ei); - ti->set_icon(0,icon); + if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_text.is_subsequence_ofi(file))) { + Pair< String, Ref<Texture> > pair; + pair.first = file; + pair.second = get_icon((has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei); + + if (search_text != String() && list.size() > 0) { + + float this_sim = _path_cmp(search_text, file); + float other_sim = _path_cmp(list[0].first, file); + int pos = 1; + + while (pos < list.size() && this_sim <= other_sim) { + other_sim = _path_cmp(list[pos++].first, file); + } + + pos = this_sim >= other_sim ? pos - 1 : pos; + list.insert(pos, pair); + + } else { + + list.push_back(pair); + } } } @@ -151,7 +195,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { if (add_directories) { for(int i=0;i<efsd->get_subdir_count();i++) { - _parse_fs(efsd->get_subdir(i)); + _parse_fs(efsd->get_subdir(i), list); } } @@ -159,10 +203,18 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) { void EditorQuickOpen::_update_search() { - search_options->clear(); TreeItem *root = search_options->create_item(); - _parse_fs(EditorFileSystem::get_singleton()->get_filesystem()); + EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem(); + Vector< Pair< String, Ref<Texture> > > list; + + _parse_fs(efsd, list); + + for (int i = 0; i < list.size(); i++) { + TreeItem *ti = search_options->create_item(root); + ti->set_text(0, list[i].first); + ti->set_icon(0, list[i].second); + } if (root->get_children()) { TreeItem *ti = root->get_children(); diff --git a/tools/editor/quick_open.h b/tools/editor/quick_open.h index 520f7e569d..c253f7606e 100644 --- a/tools/editor/quick_open.h +++ b/tools/editor/quick_open.h @@ -32,6 +32,7 @@ #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" #include "editor_file_system.h" +#include "pair.h" class EditorQuickOpen : public ConfirmationDialog { OBJ_TYPE(EditorQuickOpen,ConfirmationDialog ) @@ -47,7 +48,8 @@ class EditorQuickOpen : public ConfirmationDialog { void _update_search(); void _sbox_input(const InputEvent& p_ie); - void _parse_fs(EditorFileSystemDirectory *efsd); + void _parse_fs(EditorFileSystemDirectory *efsd, Vector< Pair< String,Ref <Texture> > > &list); + float _path_cmp(String search, String path) const; void _confirmed(); diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index 10292ed10d..c73c8c081c 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -126,8 +126,8 @@ void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_re int flg=0; if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; String path = Globals::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 30ffdf6664..35ddb49465 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -39,16 +39,20 @@ #include "multi_node_edit.h" #include "tools/editor/plugins/animation_player_editor_plugin.h" #include "animation_editor.h" - +#include "scene/main/viewport.h" void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { + if (get_viewport()->get_modal_stack_top()) + return; //ignore because of modal window + uint32_t sc = p_event.key.get_scancode_with_modifiers(); if (!p_event.key.pressed || p_event.key.echo) return; + if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) { _tool_selected(TOOL_NEW); } @@ -102,11 +106,30 @@ void SceneTreeDock::instance(const String& p_file) { Vector<String> scenes; scenes.push_back(p_file); - instance_scenes(scenes,parent,-1); + _perform_instance_scenes(scenes,parent,-1); + +} + +void SceneTreeDock::instance_scenes(const Vector<String>& p_files, Node *p_parent) { + + Node *parent = p_parent; + + if (!parent) { + parent = scene_tree->get_selected(); + } + + if (!parent || !edited_scene) { + + accept->get_ok()->set_text(TTR("OK")); + accept->set_text(TTR("No parent to instance the scenes at.")); + accept->popup_centered_minsize(); + return; + }; + _perform_instance_scenes(p_files, parent, -1); } -void SceneTreeDock::instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos) { +void SceneTreeDock::_perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos) { @@ -239,7 +262,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { //if (!_validate_no_foreign()) // break; - create_dialog->popup_centered_ratio(); + create_dialog->popup(true); } break; case TOOL_INSTANCE: { @@ -277,7 +300,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } break; case TOOL_REPLACE: { - create_dialog->popup_centered_ratio(); + create_dialog->popup(false); } break; case TOOL_CONNECT: { @@ -378,11 +401,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { ERR_FAIL_COND(!top_node->get_parent()); ERR_FAIL_COND(!bottom_node->get_parent()); - int top_node_pos = top_node->get_index(); int bottom_node_pos = bottom_node->get_index(); - - int top_node_pos_next = top_node_pos + (MOVING_DOWN ? 1 : -1); - int bottom_node_pos_next = bottom_node_pos + (MOVING_DOWN ? 1 : -1); + int top_node_pos_next = top_node->get_index() + (MOVING_DOWN ? 1 : -1); editor_data->get_undo_redo().add_do_method(top_node->get_parent(), "move_child", top_node, top_node_pos_next); editor_data->get_undo_redo().add_undo_method(bottom_node->get_parent(), "move_child", bottom_node, bottom_node_pos); @@ -1065,6 +1085,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec List<Pair<NodePath,NodePath> > path_renames; + int inc=0; + for(int ni=0;ni<p_nodes.size();ni++) { //no undo for now, sorry @@ -1081,12 +1103,16 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec } + if (new_parent==node->get_parent() && node->get_index() < p_position_in_parent+ni) { + //if child will generate a gap when moved, adjust + inc--; + } editor_data->get_undo_redo().add_do_method(node->get_parent(),"remove_child",node); editor_data->get_undo_redo().add_do_method(new_parent,"add_child",node); if (p_position_in_parent>=0) - editor_data->get_undo_redo().add_do_method(new_parent,"move_child",node,p_position_in_parent+ni); + editor_data->get_undo_redo().add_do_method(new_parent,"move_child",node,p_position_in_parent+inc); ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); String new_name = new_parent->validate_child_name(node->get_name()); @@ -1098,17 +1124,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec editor_data->get_undo_redo().add_do_method(node,"set_global_transform",node->cast_to<Node2D>()->get_global_transform()); if (node->cast_to<Spatial>()) editor_data->get_undo_redo().add_do_method(node,"set_global_transform",node->cast_to<Spatial>()->get_global_transform()); - if (node->cast_to<Control>()) { - bool can_do_it=false; - Control *c=node->cast_to<Control>(); - if (c->get_parent()->cast_to<Container>()) - can_do_it=false; - for(int i=0;i<4;i++) { - if (c->get_anchor(Margin(i))!=ANCHOR_BEGIN) - can_do_it=false; - } + if (node->cast_to<Control>()) editor_data->get_undo_redo().add_do_method(node,"set_global_pos",node->cast_to<Control>()->get_global_pos()); - } } editor_data->get_undo_redo().add_do_method(this,"_set_owners",edited_scene,owners); @@ -1118,6 +1135,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec editor_data->get_undo_redo().add_undo_method(new_parent,"remove_child",node); + inc++; + } //add and move in a second step.. (so old order is preserved) @@ -1149,17 +1168,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec editor_data->get_undo_redo().add_undo_method(node,"set_transform",node->cast_to<Node2D>()->get_transform()); if (node->cast_to<Spatial>()) editor_data->get_undo_redo().add_undo_method(node,"set_transform",node->cast_to<Spatial>()->get_transform()); - if (node->cast_to<Control>()) { - bool can_do_it=false; - Control *c=node->cast_to<Control>(); - if (c->get_parent()->cast_to<Container>()) - can_do_it=false; - for(int i=0;i<4;i++) { - if (c->get_anchor(Margin(i))!=ANCHOR_BEGIN) - can_do_it=false; - } + if (node->cast_to<Control>()) editor_data->get_undo_redo().add_undo_method(node,"set_pos",node->cast_to<Control>()->get_pos()); - } } @@ -1498,8 +1508,8 @@ void SceneTreeDock::_new_scene_from(String p_file) { int flg=0; if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; err = ResourceSaver::save(p_file,sdata,flg); @@ -1539,7 +1549,7 @@ static bool _has_visible_children(Node* p_node) { for(int i=0;i<p_node->get_child_count();i++) { Node* child = p_node->get_child(i); - if (!_is_node_visible(p_node)) + if (!_is_node_visible(child)) continue; return true; @@ -1551,9 +1561,9 @@ static bool _has_visible_children(Node* p_node) { -static Node* _find_last_visible(Node*p_node) { +static Node* _find_last_visible(Node* p_node) { - Node*last=NULL; + Node* last=NULL; bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false; @@ -1579,18 +1589,16 @@ static Node* _find_last_visible(Node*p_node) { } -void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { +void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) { to_pos=-1; - if (p_type==1 && to_node==EditorNode::get_singleton()->get_edited_scene()) { - //if at lower sibling of root node - to_pos=0; //just insert at begining of root node - } else if (p_type==-1) { + if (p_type==-1) { //drop at above selected node if (to_node==EditorNode::get_singleton()->get_edited_scene()) { to_node=NULL; - ERR_FAIL_COND(to_node==EditorNode::get_singleton()->get_edited_scene()); + ERR_EXPLAIN("Cannot perform drop above the root node!"); + ERR_FAIL(); } Node* upper_sibling=NULL; @@ -1620,13 +1628,15 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { //just insert over this node because nothing is above at the same level to_pos=to_node->get_index(); to_node=to_node->get_parent(); + } } else if (p_type==1) { //drop at below selected node if (to_node==EditorNode::get_singleton()->get_edited_scene()) { - to_node=NULL; - ERR_FAIL_COND(to_node==EditorNode::get_singleton()->get_edited_scene()); + //if at lower sibling of root node + to_pos=0; //just insert at begining of root node + return; } @@ -1646,12 +1656,13 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { break; } } - if (lower_sibling) { to_pos=lower_sibling->get_index(); } to_node=to_node->get_parent(); + + } #if 0 //quite complicated, look for next visible in tree @@ -1685,7 +1696,7 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files,NodePath p_to,int p_ty int to_pos=-1; _normalize_drop(node,to_pos,p_type); - instance_scenes(p_files,node,to_pos); + _perform_instance_scenes(p_files,node,to_pos); } void SceneTreeDock::_nodes_dragged(Array p_nodes,NodePath p_to,int p_type) { diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index 60bec9b4f4..04ed16967f 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -139,7 +139,7 @@ class SceneTreeDock : public VBoxContainer { void _fill_path_renames(Vector<StringName> base_path,Vector<StringName> new_base_path,Node * p_node, List<Pair<NodePath,NodePath> > *p_renames); - void _normalize_drop(Node*& to_node, int &to_pos,int p_type); + void _normalize_drop(Node*& to_node, int &to_pos, int p_type); void _nodes_dragged(Array p_nodes,NodePath p_to,int p_type); void _files_dropped(Vector<String> p_files,NodePath p_to,int p_type); @@ -148,6 +148,8 @@ class SceneTreeDock : public VBoxContainer { void _filter_changed(const String& p_filter); + void _perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos); + protected: void _notification(int p_what); @@ -160,7 +162,7 @@ public: void import_subscene(); void set_edited_scene(Node* p_scene); void instance(const String& p_path); - void instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos); + void instance_scenes(const Vector<String>& p_files, Node *p_parent=NULL); void set_selected(Node *p_node, bool p_emit_selected=false); void fill_path_renames(Node* p_node, Node *p_new_parent, List<Pair<NodePath,NodePath> > *p_renames); void perform_node_renames(Node* p_base,List<Pair<NodePath,NodePath> > *p_renames, Map<Ref<Animation>, Set<int> > *r_rem_anims=NULL); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index a155f0c0cf..73358e805d 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -260,13 +260,21 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) } else if (p_id==BUTTON_SIGNALS) { - item->select(0); + editor_selection->clear(); + editor_selection->add_node(n); + + set_selected(n); + NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index()); NodeDock::singleton->show_connections(); } else if (p_id==BUTTON_GROUPS) { - item->select(0); + editor_selection->clear(); + editor_selection->add_node(n); + + set_selected(n); + NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index()); NodeDock::singleton->show_groups(); } @@ -302,8 +310,15 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { item->set_selectable(0,true); if (can_rename) { - - bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false; +#ifdef ENABLE_DEPRECATED + if (p_node->has_meta("_editor_collapsed")) { + //remove previous way of storing folding, which did not get along with scene inheritance and instancing + if ((bool)p_node->get_meta("_editor_collapsed")) + p_node->set_display_folded(true); + p_node->set_meta("_editor_collapsed",Variant()); + } +#endif + bool collapsed = p_node->is_displayed_folded(); if (collapsed) item->set_collapsed(true); } @@ -896,10 +911,7 @@ void SceneTreeEditor::_cell_collapsed(Object *p_obj) { Node *n=get_node(np); ERR_FAIL_COND(!n); - if (collapsed) - n->set_meta("_editor_collapsed",true); - else - n->set_meta("_editor_collapsed",Variant()); + n->set_display_folded(collapsed); } @@ -971,6 +983,14 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2& p_point,const Variant& p_da if (!d.has("type")) return false; + TreeItem *item = tree->get_item_at_pos(p_point); + if (!item) + return false; + + int section = tree->get_drop_section_at_pos(p_point); + if (section<-1 || (section==-1 && !item->get_parent())) + return false; + if (String(d["type"])=="files") { Vector<String> files = d["files"]; @@ -993,15 +1013,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2& p_point,const Variant& p_da if (String(d["type"])=="nodes") { - TreeItem *item = tree->get_item_at_pos(p_point); - if (!item) - return false; - int section = tree->get_drop_section_at_pos(p_point); - if (section<-1 || (section==-1 && !item->get_parent())) - return false; - return true; - } return false; diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 6d8f54d88f..b6390e5aae 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -338,8 +338,9 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat docontinue->set_disabled(false); emit_signal("breaked",true,can_continue); OS::get_singleton()->move_window_to_foreground(); - if (!profiler->is_seeking()) + if (error!="") { tabs->set_current_tab(0); + } profiler->set_enabled(false); @@ -819,7 +820,6 @@ void ScriptEditorDebugger::_performance_draw() { if(which.empty()) return; - Color graph_color=get_color("font_color","TextEdit"); Ref<StyleBox> graph_sb = get_stylebox("normal","TextEdit"); Ref<Font> graph_font = get_font("font","TextEdit"); diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index e1a2ea162e..50989ea5cb 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -46,9 +46,18 @@ void EditorSettingsDialog::ok_pressed() { void EditorSettingsDialog::_settings_changed() { - timer->start(); - property_editor->get_property_editor()->update_tree(); // else color's won't update when theme is selected. +} + +void EditorSettingsDialog::_settings_property_edited(const String& p_name) { + + String full_name = property_editor->get_full_item_path(p_name); + + // Small usability workaround to update the text color settings when the + // color theme is changed + if (full_name == "text_editor/color_theme") { + property_editor->get_property_editor()->update_tree(); + } } void EditorSettingsDialog::_settings_save() { @@ -97,11 +106,24 @@ void EditorSettingsDialog::_clear_search_box() { property_editor->get_property_editor()->update_tree(); } +void EditorSettingsDialog::_clear_shortcut_search_box() { + if (shortcut_search_box->get_text()=="") + return; + + shortcut_search_box->clear(); +} + +void EditorSettingsDialog::_filter_shortcuts(const String& p_filter) { + shortcut_filter = p_filter; + _update_shortcuts(); +} + void EditorSettingsDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { clear_button->set_icon(get_icon("Close","EditorIcons")); + shortcut_clear_button->set_icon(get_icon("Close","EditorIcons")); } } @@ -137,26 +159,30 @@ void EditorSettingsDialog::_update_shortcuts() { sections[section_name]=section; section->set_custom_bg_color(0,get_color("prop_subsection","Editor")); section->set_custom_bg_color(1,get_color("prop_subsection","Editor")); - } - TreeItem *item = shortcuts->create_item(section); - - - item->set_text(0,sc->get_name()); - item->set_text(1,sc->get_as_text()); - if (!sc->is_shortcut(original) && !(sc->get_shortcut().type==InputEvent::NONE && original.type==InputEvent::NONE)) { - item->add_button(1,get_icon("Reload","EditorIcons"),2); + if (shortcut_filter.is_subsequence_ofi(sc->get_name())) { + TreeItem *item = shortcuts->create_item(section); + + item->set_text(0,sc->get_name()); + item->set_text(1,sc->get_as_text()); + if (!sc->is_shortcut(original) && !(sc->get_shortcut().type==InputEvent::NONE && original.type==InputEvent::NONE)) { + item->add_button(1,get_icon("Reload","EditorIcons"),2); + } + item->add_button(1,get_icon("Edit","EditorIcons"),0); + item->add_button(1,get_icon("Close","EditorIcons"),1); + item->set_tooltip(0,E->get()); + item->set_metadata(0,E->get()); } - item->add_button(1,get_icon("Edit","EditorIcons"),0); - item->add_button(1,get_icon("Close","EditorIcons"),1); - item->set_tooltip(0,E->get()); - item->set_metadata(0,E->get()); } - - - + // remove sections with no shortcuts + for(Map<String,TreeItem*>::Element *E=sections.front();E;E=E->next()) { + TreeItem *section = E->get(); + if (section->get_children() == NULL) { + root->remove_child(section); + } + } } void EditorSettingsDialog::_shortcut_button_pressed(Object* p_item,int p_column,int p_idx) { @@ -264,8 +290,11 @@ void EditorSettingsDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_settings_save"),&EditorSettingsDialog::_settings_save); ObjectTypeDB::bind_method(_MD("_settings_changed"),&EditorSettingsDialog::_settings_changed); + ObjectTypeDB::bind_method(_MD("_settings_property_edited"),&EditorSettingsDialog::_settings_property_edited); ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box); + ObjectTypeDB::bind_method(_MD("_clear_shortcut_search_box"),&EditorSettingsDialog::_clear_shortcut_search_box); ObjectTypeDB::bind_method(_MD("_shortcut_button_pressed"),&EditorSettingsDialog::_shortcut_button_pressed); + ObjectTypeDB::bind_method(_MD("_filter_shortcuts"),&EditorSettingsDialog::_filter_shortcuts); ObjectTypeDB::bind_method(_MD("_update_shortcuts"),&EditorSettingsDialog::_update_shortcuts); ObjectTypeDB::bind_method(_MD("_press_a_key_confirm"),&EditorSettingsDialog::_press_a_key_confirm); ObjectTypeDB::bind_method(_MD("_wait_for_key"),&EditorSettingsDialog::_wait_for_key); @@ -306,11 +335,29 @@ EditorSettingsDialog::EditorSettingsDialog() { property_editor->get_property_editor()->register_text_enter(search_box); property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(property_editor); + property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited"); vbc = memnew( VBoxContainer ); tabs->add_child(vbc); vbc->set_name(TTR("Shortcuts")); + hbc = memnew( HBoxContainer ); + hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); + vbc->add_child(hbc); + + l = memnew( Label ); + l->set_text(TTR("Search:")+" "); + hbc->add_child(l); + + shortcut_search_box = memnew( LineEdit ); + shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); + hbc->add_child(shortcut_search_box); + shortcut_search_box->connect("text_changed", this, "_filter_shortcuts"); + + shortcut_clear_button = memnew( ToolButton ); + hbc->add_child(shortcut_clear_button); + shortcut_clear_button->connect("pressed",this,"_clear_shortcut_search_box"); + shortcuts = memnew( Tree ); vbc->add_margin_child("Shortcut List:",shortcuts,true); shortcuts->set_columns(2); diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h index c930de6a77..3b91c7f019 100644 --- a/tools/editor/settings_config_dialog.h +++ b/tools/editor/settings_config_dialog.h @@ -45,7 +45,9 @@ class EditorSettingsDialog : public AcceptDialog { TabContainer *tabs; LineEdit *search_box; + LineEdit *shortcut_search_box; ToolButton *clear_button; + ToolButton *shortcut_clear_button; SectionedPropertyEditor *property_editor; Timer *timer; @@ -56,11 +58,13 @@ class EditorSettingsDialog : public AcceptDialog { Label *press_a_key_label; InputEvent last_wait_for_key; String shortcut_configured; + String shortcut_filter; virtual void cancel_pressed(); virtual void ok_pressed(); void _settings_changed(); + void _settings_property_edited(const String& p_name); void _settings_save(); void _notification(int p_what); @@ -69,8 +73,11 @@ class EditorSettingsDialog : public AcceptDialog { void _press_a_key_confirm(); void _wait_for_key(const InputEvent& p_event); + void _clear_shortcut_search_box(); void _clear_search_box(); + void _filter_shortcuts(const String& p_filter); + void _update_shortcuts(); void _shortcut_button_pressed(Object* p_item,int p_column,int p_idx); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 1ca62d3a63..480d33fd0a 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -424,16 +424,11 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po } Transform ti=t.affine_inverse(); - Vector3 ray_from=ti.xform(p_camera->project_ray_origin(p_point)); - Vector3 ray_dir=t.basis.xform_inv(p_camera->project_ray_normal(p_point)).normalized(); - Vector3 ray_to = ray_from+ray_dir*4096; float min_d=1e20; int idx=-1; for(int i=0;i<secondary_handles.size();i++) { -#if 1 - Vector3 hpos = t.xform(secondary_handles[i]); Vector2 p = p_camera->unproject_position(hpos); @@ -449,31 +444,7 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po idx=i+handles.size(); } - } - -#else - AABB aabb; - aabb.pos=Vector3(-1,-1,-1)*HANDLE_HALF_SIZE; - aabb.size=aabb.pos*-2; - aabb.pos+=secondary_handles[i]; - - - Vector3 rpos,rnorm; - - if (aabb.intersects_segment(ray_from,ray_to,&rpos,&rnorm)) { - - real_t dp = ray_dir.dot(rpos); - if (dp<min_d) { - - r_pos=t.xform(rpos); - r_normal=ti.basis.xform_inv(rnorm).normalized(); - min_d=dp; - idx=i+handles.size(); - - } - } -#endif } if (p_sec_first && idx!=-1) { @@ -486,9 +457,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po for(int i=0;i<handles.size();i++) { -#if 1 - - Vector3 hpos = t.xform(handles[i]); Vector2 p = p_camera->unproject_position(hpos); if (p.distance_to(p_point)<SpatialEditorGizmos::singleton->handle_t->get_width()*0.6) { @@ -503,32 +471,7 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po idx=i; } - - } - -#else - - AABB aabb; - aabb.pos=Vector3(-1,-1,-1)*HANDLE_HALF_SIZE; - aabb.size=aabb.pos*-2; - aabb.pos+=handles[i]; - - - Vector3 rpos,rnorm; - - if (aabb.intersects_segment(ray_from,ray_to,&rpos,&rnorm)) { - - real_t dp = ray_dir.dot(rpos); - if (dp<min_d) { - - r_pos=t.xform(rpos); - r_normal=ti.basis.xform_inv(rnorm).normalized(); - min_d=dp; - idx=i; - - } } -#endif } if (idx>=0) { @@ -612,9 +555,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po Vector3 ray_dir=ai.basis.xform(p_camera->project_ray_normal(p_point)).normalized(); Vector3 rpos,rnorm; -#if 1 - - if (collision_mesh->intersect_ray(ray_from,ray_dir,rpos,rnorm)) { @@ -622,16 +562,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po r_normal=gt.basis.xform(rnorm).normalized(); return true; } -#else - - if (collision_mesh->intersect_segment(ray_from,ray_from+ray_dir*4906.0,rpos,rnorm)) { - - r_pos=gt.xform(rpos); - r_normal=gt.basis.xform(rnorm).normalized(); - return true; - } - -#endif } return false; @@ -693,12 +623,11 @@ void EditorSpatialGizmo::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_unscaled_billboard","material:Material","default_scale"),&EditorSpatialGizmo::add_unscaled_billboard,DEFVAL(1)); ObjectTypeDB::bind_method(_MD("add_handles","handles","billboard","secondary"),&EditorSpatialGizmo::add_handles,DEFVAL(false),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("set_spatial_node","node:Spatial"),&EditorSpatialGizmo::_set_spatial_node); + ObjectTypeDB::bind_method(_MD("clear"),&EditorSpatialGizmo::clear); BIND_VMETHOD( MethodInfo("redraw")); BIND_VMETHOD( MethodInfo(Variant::STRING,"get_handle_name",PropertyInfo(Variant::INT,"index"))); - { - BIND_VMETHOD( MethodInfo("get_handle_value:Variant",PropertyInfo(Variant::INT,"index"))); - } + BIND_VMETHOD( MethodInfo("get_handle_value:Variant",PropertyInfo(Variant::INT,"index"))); BIND_VMETHOD( MethodInfo("set_handle",PropertyInfo(Variant::INT,"index"),PropertyInfo(Variant::OBJECT,"camera:Camera"),PropertyInfo(Variant::VECTOR2,"point"))); MethodInfo cm = MethodInfo("commit_handle",PropertyInfo(Variant::INT,"index"),PropertyInfo(Variant::NIL,"restore:Variant"),PropertyInfo(Variant::BOOL,"cancel")); cm.default_arguments.push_back(false); @@ -2250,7 +2179,6 @@ void VisibilityNotifierGizmo::set_handle(int p_idx,Camera *p_camera, const Point if (d<0.001) d=0.001; - Vector3 he = aabb.size; aabb.pos[p_idx]=(aabb.pos[p_idx]+aabb.size[p_idx]*0.5)-d; aabb.size[p_idx]=d*2; notifier->set_aabb(aabb); @@ -2456,8 +2384,6 @@ void HingeJointSpatialGizmo::redraw() { if (p3d->get_flag(HingeJoint::FLAG_USE_LIMIT) && ll<ul) { const int points = 32; - float step = (ul-ll)/points; - for(int i=0;i<points;i++) { @@ -2573,8 +2499,6 @@ void SliderJointSpatialGizmo::redraw() { if (ll<ul) { const int points = 32; - float step = (ul-ll)/points; - for(int i=0;i<points;i++) { @@ -2641,7 +2565,6 @@ SliderJointSpatialGizmo::SliderJointSpatialGizmo(SliderJoint* p_p3d) { void ConeTwistJointSpatialGizmo::redraw() { clear(); - float cs = 0.25; Vector<Vector3> points; float r = 1.0; @@ -2837,8 +2760,6 @@ void Generic6DOFJointSpatialGizmo::redraw() { if (enable_ang && ll<=ul) { const int points = 32; - float step = (ul-ll)/points; - for(int i=0;i<points;i++) { |