diff options
-rw-r--r-- | core/bind/core_bind.cpp | 6 | ||||
-rw-r--r-- | core/bind/core_bind.h | 1 | ||||
-rw-r--r-- | core/os/os.h | 1 | ||||
-rw-r--r-- | doc/base/classes.xml | 5 | ||||
-rw-r--r-- | platform/osx/os_osx.h | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 5 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 11 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 1 | ||||
-rw-r--r-- | scene/resources/world_2d.cpp | 51 | ||||
-rw-r--r-- | tools/editor/create_dialog.cpp | 3 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 6 | ||||
-rw-r--r-- | tools/editor/filesystem_dock.cpp (renamed from tools/editor/scenes_dock.cpp) | 125 | ||||
-rw-r--r-- | tools/editor/filesystem_dock.h (renamed from tools/editor/scenes_dock.h) | 12 | ||||
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 16 |
15 files changed, 166 insertions, 83 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 9cc934bb6f..e56684dc5e 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -944,6 +944,11 @@ void _OS::native_video_stop() { OS::get_singleton()->native_video_stop(); }; +void _OS::request_attention() { + + OS::get_singleton()->request_attention(); +} + bool _OS::is_debug_build() const { #ifdef DEBUG_ENABLED @@ -1042,6 +1047,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized); ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized); ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized); + ObjectTypeDB::bind_method(_MD("request_attention"), &_OS::request_attention); ObjectTypeDB::bind_method(_MD("set_borderless_window", "borderless"), &_OS::set_borderless_window); ObjectTypeDB::bind_method(_MD("get_borderless_window"), &_OS::get_borderless_window); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index b43c5246ed..9ca439a454 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -158,6 +158,7 @@ public: virtual bool is_window_minimized() const; virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; + virtual void request_attention(); virtual void set_borderless_window(bool p_borderless); virtual bool get_borderless_window() const; diff --git a/core/os/os.h b/core/os/os.h index 40f3989a55..2521d67e29 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -174,6 +174,7 @@ public: virtual bool is_window_minimized() const { return false; } virtual void set_window_maximized(bool p_enabled) {} virtual bool is_window_maximized() const { return true; } + virtual void request_attention() { } virtual void set_borderless_window(int p_borderless) {} virtual bool get_borderless_window() { return 0; } diff --git a/doc/base/classes.xml b/doc/base/classes.xml index b8156133de..3f203170b3 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -22877,6 +22877,11 @@ <description> </description> </method> + <method name="request_attention"> + <description> + Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX. + </description> + </method> <method name="set_borderless_window"> <argument index="0" name="borderless" type="bool"> </argument> diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index e1c33cb018..8f89695a68 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -202,7 +202,7 @@ public: virtual bool is_window_minimized() const; virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; - + virtual void request_attention(); void run(); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 45c500ec39..dc87f767f6 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1577,6 +1577,11 @@ void OS_OSX::move_window_to_foreground() { [window_object orderFrontRegardless]; } +void OS_OSX::request_attention() { + + [NSApp requestUserAttention:NSCriticalRequest]; +} + String OS_OSX::get_executable_path() const { int ret; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index b0a50ca4b8..c73e66f2b2 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1683,6 +1683,17 @@ bool OS_Windows::get_borderless_window() { return video_mode.borderless_window; } +void OS_Windows::request_attention() { + + FLASHWINFO info; + info.cbSize = sizeof(FLASHWINFO); + info.hwnd = hWnd; + info.dwFlags = FLASHW_TRAY; + info.dwTimeout = 0; + info.uCount = 2; + FlashWindowEx(&info); +} + void OS_Windows::print_error(const char* p_function, const char* p_file, int p_line, const char* p_code, const char* p_rationale, ErrorType p_type) { HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 5acb300c0f..e3e037e57b 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -230,6 +230,7 @@ public: virtual bool is_window_minimized() const; virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; + virtual void request_attention(); virtual void set_borderless_window(int p_borderless); virtual bool get_borderless_window(); diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index e96cac170b..6b329a1a73 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -235,19 +235,20 @@ struct SpatialIndexer2D { List<VisibilityNotifier2D*> added; List<VisibilityNotifier2D*> removed; - for(int i=begin.x;i<=end.x;i++) { + int visible_cells=(end.x-begin.x)*(end.y-begin.y); - for(int j=begin.y;j<=end.y;j++) { + if (visible_cells>10000) { - CellKey ck; - ck.x=i; - ck.y=j; + //well you zoomed out a lot, it's your problem. To avoid freezing in the for loops below, we'll manually check cell by cell - Map<CellKey,CellData>::Element *F=cells.find(ck); - if (!F) { - continue; - } + for (Map<CellKey,CellData>::Element *F=cells.front();F;F=F->next()) { + + const CellKey &ck=F->key(); + if (ck.x<begin.x || ck.x>end.x) + continue; + if (ck.y<begin.y || ck.y>end.y) + continue; //notifiers in cell for (Map<VisibilityNotifier2D*,CellRef>::Element *G=F->get().notifiers.front();G;G=G->next()) { @@ -262,6 +263,38 @@ struct SpatialIndexer2D { } } } + + } else { + + //check cells in grid fashion + for(int i=begin.x;i<=end.x;i++) { + + for(int j=begin.y;j<=end.y;j++) { + + CellKey ck; + ck.x=i; + ck.y=j; + + Map<CellKey,CellData>::Element *F=cells.find(ck); + if (!F) { + continue; + } + + + //notifiers in cell + for (Map<VisibilityNotifier2D*,CellRef>::Element *G=F->get().notifiers.front();G;G=G->next()) { + + Map<VisibilityNotifier2D*,uint64_t>::Element *H=E->get().notifiers.find(G->key()); + if (!H) { + + H=E->get().notifiers.insert(G->key(),pass); + added.push_back(G->key()); + } else { + H->get()=pass; + } + } + } + } } for (Map<VisibilityNotifier2D*,uint64_t>::Element *F=E->get().notifiers.front();F;F=F->next()) { diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 07d1566ab8..3ab2e35242 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -164,8 +164,11 @@ 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 diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index d843b6ef6a..3f93c05919 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3822,7 +3822,7 @@ void EditorNode::request_instance_scene(const String &p_path) { } -ScenesDock *EditorNode::get_scenes_dock() { +FileSystemDock *EditorNode::get_scenes_dock() { return scenes_dock; } @@ -6162,7 +6162,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); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index d18de1c531..9a227d3644 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" @@ -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; @@ -666,7 +666,7 @@ public: static VSplitContainer *get_top_split() { return singleton->top_split; } void request_instance_scene(const String &p_path); - ScenesDock *get_scenes_dock(); + FileSystemDock *get_scenes_dock(); SceneTreeDock *get_scene_tree_dock(); static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); } diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/filesystem_dock.cpp index 75c983994e..3be122cc7d 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" @@ -39,7 +39,7 @@ #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); @@ -66,7 +66,7 @@ bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_di } -void ScenesDock::_update_tree() { +void FileSystemDock::_update_tree() { tree->clear(); updating_tree=true; @@ -97,7 +97,7 @@ void ScenesDock::_update_tree() { } -void ScenesDock::_notification(int p_what) { +void FileSystemDock::_notification(int p_what) { switch(p_what) { @@ -208,7 +208,7 @@ void ScenesDock::_notification(int p_what) { -void ScenesDock::_dir_selected() { +void FileSystemDock::_dir_selected() { TreeItem *ti = tree->get_selected(); if (!ti) @@ -241,7 +241,7 @@ void ScenesDock::_dir_selected() { } -void ScenesDock::_favorites_pressed() { +void FileSystemDock::_favorites_pressed() { TreeItem *sel = tree->get_selected(); if (!sel) @@ -270,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) @@ -279,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; @@ -312,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")); @@ -324,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; @@ -371,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; @@ -584,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(); @@ -602,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) { @@ -615,7 +615,7 @@ void ScenesDock::_go_to_dir(const String& p_dir){ } -void ScenesDock::_preview_invalidated(const String& p_path) { +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()) { @@ -635,7 +635,7 @@ void ScenesDock::_preview_invalidated(const String& p_path) { } } -void ScenesDock::_fs_changed() { +void FileSystemDock::_fs_changed() { button_hist_prev->set_disabled(history_pos==0); button_hist_next->set_disabled(history_pos+1==history.size()); @@ -656,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); @@ -671,7 +671,7 @@ void ScenesDock::_set_scannig_mode() { } -void ScenesDock::_fw_history() { +void FileSystemDock::_fw_history() { if (history_pos<history.size()-1) history_pos++; @@ -695,7 +695,7 @@ void ScenesDock::_fw_history() { } -void ScenesDock::_bw_history() { +void FileSystemDock::_bw_history() { if (history_pos>0) history_pos--; @@ -719,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) { @@ -733,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); @@ -744,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); @@ -761,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.")); @@ -808,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.")); @@ -901,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) { @@ -951,7 +951,8 @@ void ScenesDock::_file_option(int p_option) { case FILE_INSTANCE: { 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); @@ -1085,7 +1086,7 @@ void ScenesDock::_file_option(int p_option) { } } -void ScenesDock::_open_pressed(){ +void FileSystemDock::_open_pressed(){ TreeItem *sel = tree->get_selected(); @@ -1116,7 +1117,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 @@ -1124,29 +1125,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) { @@ -1223,7 +1224,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; @@ -1289,7 +1290,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; @@ -1441,7 +1442,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; @@ -1564,35 +1565,35 @@ 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("_open_pressed"),&FileSystemDock::_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("_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"), &ScenesDock::_search_changed); + ObjectTypeDB::bind_method(_MD("_search_changed"), &FileSystemDock::_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); + 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"),&ScenesDock::_preview_invalidated); + ObjectTypeDB::bind_method(_MD("_preview_invalidated"),&FileSystemDock::_preview_invalidated); ADD_SIGNAL(MethodInfo("instance")); @@ -1600,7 +1601,7 @@ void ScenesDock::_bind_methods() { } -ScenesDock::ScenesDock(EditorNode *p_editor) { +FileSystemDock::FileSystemDock(EditorNode *p_editor) { editor=p_editor; @@ -1766,6 +1767,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 0973fce250..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, @@ -184,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/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index ec5ac8592b..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); @@ -1062,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; { @@ -1077,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); { @@ -2526,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(); |