summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-23 11:31:03 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-23 11:31:23 -0300
commit7ad7f2f6a986fa6598ae10f2bb940e15c3658f44 (patch)
treef8019c0ab73f7a2eb9088429ec6e3673d299f95d /scene
parent393e5605c9e1b5baa91bff9ad61c7a0118b10cac (diff)
android fixes, please test
(can' t build android atm)
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/collision_polygon_2d.cpp12
-rw-r--r--scene/2d/collision_polygon_2d.h1
-rw-r--r--scene/gui/file_dialog.cpp25
-rw-r--r--scene/gui/file_dialog.h9
4 files changed, 44 insertions, 3 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 1c0be60764..049017c0a5 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<CollisionObject2D>();
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 b8e27b6fb4..735110efad 100644
--- a/scene/2d/collision_polygon_2d.h
+++ b/scene/2d/collision_polygon_2d.h
@@ -51,6 +51,7 @@ protected:
BuildMode build_mode;
Vector<Point2> 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 47f862a58d..2e8a84e39b 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 bda1797696..6b35035829 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -89,6 +89,10 @@ private:
Vector<String> 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();