diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index fda4ca73572..97c5bfed619 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -105,6 +105,12 @@ bool DirAccessJAndroid::current_is_dir() const{ return true; } + +bool DirAccessJAndroid::current_is_hidden() const { + + return current!="." && current!=".." && current.begins_with("."); +} + bool DirAccessAndroid::current_is_hidden() const{ return current!="." && current!=".." && current.begins_with("."); } diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 958ea34891e..0a696506e64 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -60,6 +60,7 @@ public: virtual bool list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; + virtual bool current_is_hidden() const; virtual void list_dir_end(); ///< virtual int get_drive_count(); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 6b91c01dfcf..f00e9c2d77d 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -291,6 +291,11 @@ void OS_Android::get_fullscreen_mode_list(List *p_list,int p_screen) p_list->push_back(default_videomode); } +Size2 OS_Android::get_window_size() const { + + return Vector2(default_videomode.width,default_videomode.height); +} + String OS_Android::get_name() { return "Android"; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 26dbf4a5093..bea5371bbc5 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -170,6 +170,8 @@ public: virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List *p_list,int p_screen=0) const; + virtual Size2 get_window_size() const; + virtual String get_name(); virtual MainLoop *get_main_loop() const; diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 1c0be607646..049017c0a5b 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -33,6 +33,9 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { + if (unparenting) + return; + CollisionObject2D *co = p_obj->cast_to(); ERR_FAIL_COND(!co); @@ -96,6 +99,9 @@ void CollisionPolygon2D::_notification(int p_what) { switch(p_what) { + case NOTIFICATION_ENTER_TREE: { + unparenting=false; + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (!is_inside_tree()) @@ -123,6 +129,11 @@ void CollisionPolygon2D::_notification(int p_what) { } #endif } break; + case NOTIFICATION_UNPARENTED: { + unparenting = true; + _update_parent(); + } break; + } } @@ -203,6 +214,7 @@ CollisionPolygon2D::CollisionPolygon2D() { aabb=Rect2(-10,-10,20,20); build_mode=BUILD_SOLIDS; trigger=false; + unparenting=false; } diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h index b8e27b6fb40..735110efad7 100644 --- a/scene/2d/collision_polygon_2d.h +++ b/scene/2d/collision_polygon_2d.h @@ -51,6 +51,7 @@ protected: BuildMode build_mode; Vector polygon; bool trigger; + bool unparenting; void _add_to_collision_object(Object *p_obj); void _update_parent(); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 47f862a58d6..2e8a84e39b0 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -30,7 +30,7 @@ #include "scene/gui/label.h" #include "print_string.h" #include "os/keyboard.h" -#include "tools/editor/editor_settings.h" + FileDialog::GetIconFunc FileDialog::get_icon_func=NULL; @@ -281,7 +281,7 @@ void FileDialog::update_file_list() { bool isdir; bool ishidden; - bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); + bool show_hidden = show_hidden_files; String item; while ((item=dir_access->get_next(&isdir))!="") { @@ -625,6 +625,9 @@ void FileDialog::_update_drives() { } } +bool FileDialog::default_show_hidden_files=true; + + void FileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_tree_selected"),&FileDialog::_tree_selected); @@ -649,6 +652,8 @@ void FileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_vbox:VBoxContainer"),&FileDialog::get_vbox); ObjectTypeDB::bind_method(_MD("set_access","access"),&FileDialog::set_access); ObjectTypeDB::bind_method(_MD("get_access"),&FileDialog::get_access); + ObjectTypeDB::bind_method(_MD("set_show_hidden_files"),&FileDialog::set_show_hidden_files); + ObjectTypeDB::bind_method(_MD("is_showing_hidden_files"),&FileDialog::is_showing_hidden_files); ObjectTypeDB::bind_method(_MD("_select_drive"),&FileDialog::_select_drive); ObjectTypeDB::bind_method(_MD("_make_dir"),&FileDialog::_make_dir); ObjectTypeDB::bind_method(_MD("_make_dir_confirm"),&FileDialog::_make_dir_confirm); @@ -673,9 +678,23 @@ void FileDialog::_bind_methods() { } +void FileDialog::set_show_hidden_files(bool p_show) { + show_hidden_files=p_show; + invalidate(); +} + +bool FileDialog::is_showing_hidden_files() const { + return show_hidden_files; +} + +void FileDialog::set_default_show_hidden_files(bool p_show) { + default_show_hidden_files=p_show; +} FileDialog::FileDialog() { - + + show_hidden_files=true; + VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index bda1797696b..6b350358291 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -89,6 +89,10 @@ private: Vector filters; + + static bool default_show_hidden_files; + bool show_hidden_files; + bool invalidated; void update_dir(); @@ -141,6 +145,11 @@ public: void set_access(Access p_access); Access get_access() const; + void set_show_hidden_files(bool p_show); + bool is_showing_hidden_files() const; + + static void set_default_show_hidden_files(bool p_show); + void invalidate(); FileDialog(); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 5e571373ea8..f49597b1e24 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3279,6 +3279,7 @@ EditorNode::EditorNode() { singleton=this; FileAccess::set_backup_save(true); + FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); PathRemap::get_singleton()->clear_remaps();; //editor uses no remaps TranslationServer::get_singleton()->set_enabled(false);