update EditorDirDialog on external change, closes #4629

This commit is contained in:
Juan Linietsky 2016-06-18 16:03:00 -03:00
parent 81a10795dc
commit 5e7f1fc79b
3 changed files with 12 additions and 2 deletions

View File

@ -110,6 +110,7 @@ static bool use_debug_profiler=false;
static bool force_lowdpi=false; static bool force_lowdpi=false;
static int init_screen=-1; static int init_screen=-1;
static bool use_vsync=true; static bool use_vsync=true;
static bool editor=false;
static String unescape_cmdline(const String& p_str) { static String unescape_cmdline(const String& p_str) {
@ -281,7 +282,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
packed_data->add_pack_source(zip_packed_data); packed_data->add_pack_source(zip_packed_data);
#endif #endif
bool editor=false;
while(I) { while(I) {
@ -953,7 +954,7 @@ Error Main::setup2() {
Globals::get_singleton()->set_custom_property_info("application/icon",PropertyInfo(Variant::STRING,"application/icon",PROPERTY_HINT_FILE,"*.png,*.webp")); Globals::get_singleton()->set_custom_property_info("application/icon",PropertyInfo(Variant::STRING,"application/icon",PROPERTY_HINT_FILE,"*.png,*.webp"));
if (bool(GLOBAL_DEF("display/emulate_touchscreen",false))) { if (bool(GLOBAL_DEF("display/emulate_touchscreen",false))) {
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) { if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) {
//only if no touchscreen ui hint, set emulation //only if no touchscreen ui hint, set emulation
InputDefault *id = Input::get_singleton()->cast_to<InputDefault>(); InputDefault *id = Input::get_singleton()->cast_to<InputDefault>();
if (id) if (id)

View File

@ -30,6 +30,7 @@
#include "os/os.h" #include "os/os.h"
#include "os/keyboard.h" #include "os/keyboard.h"
#include "tools/editor/editor_settings.h" #include "tools/editor/editor_settings.h"
#include "tools/editor/editor_file_system.h"
void EditorDirDialog::_update_dir(TreeItem* p_item) { void EditorDirDialog::_update_dir(TreeItem* p_item) {
@ -86,11 +87,14 @@ void EditorDirDialog::reload() {
_item_collapsed(root); _item_collapsed(root);
} }
void EditorDirDialog::_notification(int p_what) { void EditorDirDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) { if (p_what==NOTIFICATION_ENTER_TREE) {
reload(); reload();
tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED);
EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload");
} }
} }
@ -198,6 +202,7 @@ void EditorDirDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_item_collapsed"),&EditorDirDialog::_item_collapsed); ObjectTypeDB::bind_method(_MD("_item_collapsed"),&EditorDirDialog::_item_collapsed);
ObjectTypeDB::bind_method(_MD("_make_dir"),&EditorDirDialog::_make_dir); ObjectTypeDB::bind_method(_MD("_make_dir"),&EditorDirDialog::_make_dir);
ObjectTypeDB::bind_method(_MD("_make_dir_confirm"),&EditorDirDialog::_make_dir_confirm); ObjectTypeDB::bind_method(_MD("_make_dir_confirm"),&EditorDirDialog::_make_dir_confirm);
ObjectTypeDB::bind_method(_MD("reload"),&EditorDirDialog::reload);
ADD_SIGNAL(MethodInfo("dir_selected",PropertyInfo(Variant::STRING,"dir"))); ADD_SIGNAL(MethodInfo("dir_selected",PropertyInfo(Variant::STRING,"dir")));
} }
@ -238,4 +243,6 @@ EditorDirDialog::EditorDirDialog() {
get_ok()->set_text(TTR("Choose")); get_ok()->set_text(TTR("Choose"));
} }

View File

@ -53,6 +53,8 @@ class EditorDirDialog : public ConfirmationDialog {
void _make_dir_confirm(); void _make_dir_confirm();
void ok_pressed(); void ok_pressed();
protected: protected:
void _notification(int p_what); void _notification(int p_what);