android fixes, please test

(can' t build android atm)
This commit is contained in:
Juan Linietsky 2015-03-23 11:31:03 -03:00
parent 393e5605c9
commit 7ad7f2f6a9
9 changed files with 59 additions and 3 deletions

View file

@ -105,6 +105,12 @@ bool DirAccessJAndroid::current_is_dir() const{
return true; return true;
} }
bool DirAccessJAndroid::current_is_hidden() const {
return current!="." && current!=".." && current.begins_with(".");
}
bool DirAccessAndroid::current_is_hidden() const{ bool DirAccessAndroid::current_is_hidden() const{
return current!="." && current!=".." && current.begins_with("."); return current!="." && current!=".." && current.begins_with(".");
} }

View file

@ -60,6 +60,7 @@ public:
virtual bool list_dir_begin(); ///< This starts dir listing virtual bool list_dir_begin(); ///< This starts dir listing
virtual String get_next(); virtual String get_next();
virtual bool current_is_dir() const; virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;
virtual void list_dir_end(); ///< virtual void list_dir_end(); ///<
virtual int get_drive_count(); virtual int get_drive_count();

View file

@ -291,6 +291,11 @@ void OS_Android::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen)
p_list->push_back(default_videomode); 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() { String OS_Android::get_name() {
return "Android"; return "Android";

View file

@ -170,6 +170,8 @@ public:
virtual VideoMode get_video_mode(int p_screen=0) const; virtual VideoMode get_video_mode(int p_screen=0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const;
virtual Size2 get_window_size() const;
virtual String get_name(); virtual String get_name();
virtual MainLoop *get_main_loop() const; virtual MainLoop *get_main_loop() const;

View file

@ -33,6 +33,9 @@
void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) {
if (unparenting)
return;
CollisionObject2D *co = p_obj->cast_to<CollisionObject2D>(); CollisionObject2D *co = p_obj->cast_to<CollisionObject2D>();
ERR_FAIL_COND(!co); ERR_FAIL_COND(!co);
@ -96,6 +99,9 @@ void CollisionPolygon2D::_notification(int p_what) {
switch(p_what) { switch(p_what) {
case NOTIFICATION_ENTER_TREE: {
unparenting=false;
} break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (!is_inside_tree()) if (!is_inside_tree())
@ -123,6 +129,11 @@ void CollisionPolygon2D::_notification(int p_what) {
} }
#endif #endif
} break; } break;
case NOTIFICATION_UNPARENTED: {
unparenting = true;
_update_parent();
} break;
} }
} }
@ -203,6 +214,7 @@ CollisionPolygon2D::CollisionPolygon2D() {
aabb=Rect2(-10,-10,20,20); aabb=Rect2(-10,-10,20,20);
build_mode=BUILD_SOLIDS; build_mode=BUILD_SOLIDS;
trigger=false; trigger=false;
unparenting=false;
} }

View file

@ -51,6 +51,7 @@ protected:
BuildMode build_mode; BuildMode build_mode;
Vector<Point2> polygon; Vector<Point2> polygon;
bool trigger; bool trigger;
bool unparenting;
void _add_to_collision_object(Object *p_obj); void _add_to_collision_object(Object *p_obj);
void _update_parent(); void _update_parent();

View file

@ -30,7 +30,7 @@
#include "scene/gui/label.h" #include "scene/gui/label.h"
#include "print_string.h" #include "print_string.h"
#include "os/keyboard.h" #include "os/keyboard.h"
#include "tools/editor/editor_settings.h"
FileDialog::GetIconFunc FileDialog::get_icon_func=NULL; FileDialog::GetIconFunc FileDialog::get_icon_func=NULL;
@ -281,7 +281,7 @@ void FileDialog::update_file_list() {
bool isdir; bool isdir;
bool ishidden; bool ishidden;
bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); bool show_hidden = show_hidden_files;
String item; String item;
while ((item=dir_access->get_next(&isdir))!="") { 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() { void FileDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_tree_selected"),&FileDialog::_tree_selected); 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("get_vbox:VBoxContainer"),&FileDialog::get_vbox);
ObjectTypeDB::bind_method(_MD("set_access","access"),&FileDialog::set_access); ObjectTypeDB::bind_method(_MD("set_access","access"),&FileDialog::set_access);
ObjectTypeDB::bind_method(_MD("get_access"),&FileDialog::get_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("_select_drive"),&FileDialog::_select_drive);
ObjectTypeDB::bind_method(_MD("_make_dir"),&FileDialog::_make_dir); ObjectTypeDB::bind_method(_MD("_make_dir"),&FileDialog::_make_dir);
ObjectTypeDB::bind_method(_MD("_make_dir_confirm"),&FileDialog::_make_dir_confirm); 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() { FileDialog::FileDialog() {
show_hidden_files=true;
VBoxContainer *vbc = memnew( VBoxContainer ); VBoxContainer *vbc = memnew( VBoxContainer );
add_child(vbc); add_child(vbc);
set_child_rect(vbc); set_child_rect(vbc);

View file

@ -89,6 +89,10 @@ private:
Vector<String> filters; Vector<String> filters;
static bool default_show_hidden_files;
bool show_hidden_files;
bool invalidated; bool invalidated;
void update_dir(); void update_dir();
@ -141,6 +145,11 @@ public:
void set_access(Access p_access); void set_access(Access p_access);
Access get_access() const; 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(); void invalidate();
FileDialog(); FileDialog();

View file

@ -3279,6 +3279,7 @@ EditorNode::EditorNode() {
singleton=this; singleton=this;
FileAccess::set_backup_save(true); 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 PathRemap::get_singleton()->clear_remaps();; //editor uses no remaps
TranslationServer::get_singleton()->set_enabled(false); TranslationServer::get_singleton()->set_enabled(false);