示例#1
0
void EditorHelpIndex::popup() {

	popup_centered_ratio(0.6);

	search_box->set_text("");
	_update_class_list();
}
示例#2
0
void EditorHelpSearch::popup() {
	popup_centered_ratio(0.6);
	if (search_box->get_text()!="") {
		search_box->select_all();
		_update_search();
	}
	search_box->grab_focus();
}
示例#3
0
void ProjectSettings::popup_project_settings() {

	//popup_centered(Size2(500,400));
	popup_centered_ratio();
	globals_editor->edit(NULL);
	globals_editor->edit(Globals::get_singleton());
	_update_translations();
	_update_autoload();
}
示例#4
0
void DependencyEditorOwners::show(const String &p_path) {

	editing = p_path;
	owners->clear();
	_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
	popup_centered_ratio();

	set_title(TTR("Owners Of:") + " " + p_path.get_file());
}
示例#5
0
void EditorHelpSearch::popup(const String& p_term) {

	popup_centered_ratio(0.6);
	if (p_term!="") {
		search_box->set_text(p_term);
		search_box->select_all();
		_update_search();
	} else
		search_box->clear();
	search_box->grab_focus();
}
示例#6
0
void CreateDialog::popup(bool p_dontclear) {

	popup_centered_ratio(0.6);
	if (p_dontclear)
		search_box->select_all();
	else
		search_box->clear();
	search_box->grab_focus();
	_update_search();


}
示例#7
0
void EditorQuickOpen::popup(const String& p_base, bool p_dontclear) {

    popup_centered_ratio(0.6);
    if (p_dontclear)
        search_box->select_all();
    else
        search_box->clear();
    search_box->grab_focus();
    base_type=p_base;
    _update_search();


}
示例#8
0
void ScriptEditorQuickOpen::popup(const Vector<String>& p_functions, bool p_dontclear) {

	popup_centered_ratio(0.6);
	if (p_dontclear)
		search_box->select_all();
	else
		search_box->clear();
	search_box->grab_focus();
	functions=p_functions;
	_update_search();


}
示例#9
0
void DependencyEditor::edit(const String &p_path) {

	editing = p_path;
	set_title(TTR("Dependencies For:") + " " + p_path.get_file());

	_update_list();
	popup_centered_ratio();

	if (EditorNode::get_singleton()->is_scene_open(p_path)) {
		EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will not take effect unless reloaded."), p_path.get_file()));
	} else if (ResourceCache::has(p_path)) {
		EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will take effect when reloaded."), p_path.get_file()));
	}
}
示例#10
0
void PropertySelector::select_property_from_base_type(const String& p_base,const String& p_current) {

	base_type=p_base;
	selected=p_current;
	type=Variant::NIL;
	script=0;
	properties=true;
	instance=NULL;

	popup_centered_ratio(0.6);
	search_box->set_text("");
	search_box->grab_focus();
	_update_search();
}
示例#11
0
void PropertySelector::select_method_from_script(const Ref<Script>& p_script,const String& p_current){

	ERR_FAIL_COND( p_script.is_null() );
	base_type=p_script->get_instance_base_type();
	selected=p_current;
	type=Variant::NIL;
	script=p_script->get_instance_ID();
	properties=false;
	instance=NULL;

	popup_centered_ratio(0.6);
	search_box->set_text("");
	search_box->grab_focus();
	_update_search();

}
示例#12
0
void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const String &p_current){

	ERR_FAIL_COND(p_type==Variant::NIL);
	base_type="";
	selected=p_current;
	type=p_type;
	script=0;
	properties=false;
	instance=NULL;

	popup_centered_ratio(0.6);
	search_box->set_text("");
	search_box->grab_focus();
	_update_search();

}
示例#13
0
void EditorSettingsDialog::popup_edit_settings() {

	if (!EditorSettings::get_singleton())
		return;

	EditorSettings::get_singleton()->list_text_editor_themes(); // make sure we have an up to date list of themes

	property_editor->edit(EditorSettings::get_singleton());
	property_editor->get_property_editor()->update_tree();

	search_box->select_all();
	search_box->grab_focus();

	_update_shortcuts();
	popup_centered_ratio(0.7);
}
示例#14
0
void EditorQuickOpen::popup(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) {

	add_directories = p_add_dirs;
	popup_centered_ratio(0.6);
	if (p_dontclear)
		search_box->select_all();
	else
		search_box->clear();
	if (p_enable_multi)
		search_options->set_select_mode(Tree::SELECT_MULTI);
	else
		search_options->set_select_mode(Tree::SELECT_SINGLE);
	search_box->grab_focus();
	base_type = p_base;
	_update_search();
}
示例#15
0
void ProjectExportDialog::popup_export() {

	add_preset->get_popup()->clear();
	for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {

		Ref<EditorExportPlatform> plat = EditorExport::get_singleton()->get_export_platform(i);

		add_preset->get_popup()->add_icon_item(plat->get_logo(), plat->get_name());
	}

	_update_presets();

	// Restore valid window bounds or pop up at default size.
	if (EditorSettings::get_singleton()->has("interface/dialogs/export_bounds")) {
		popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds"));
	} else {
		popup_centered_ratio();
	}
}
示例#16
0
void PropertySelector::select_method_from_instance(Object* p_instance, const String &p_current){


	base_type=p_instance->get_type();
	selected=p_current;
	type=Variant::NIL;
	script=0;
	{
		Ref<Script> scr = p_instance->get_script();
		if (scr.is_valid())
			script=scr->get_instance_ID();
	}
	properties=false;
	instance=NULL;

	popup_centered_ratio(0.6);
	search_box->set_text("");
	search_box->grab_focus();
	_update_search();

}
示例#17
0
void EditorSettingsDialog::popup_edit_settings() {

	if (!EditorSettings::get_singleton())
		return;

	EditorSettings::get_singleton()->list_text_editor_themes(); // make sure we have an up to date list of themes

	property_editor->edit(EditorSettings::get_singleton());
	property_editor->get_property_editor()->update_tree();

	search_box->select_all();
	search_box->grab_focus();

	_update_shortcuts();

	// Restore valid window bounds or pop up at default size.
	if (EditorSettings::get_singleton()->has("interface/dialogs/editor_settings_bounds")) {
		popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds"));
	} else {
		popup_centered_ratio(0.7);
	}
}
示例#18
0
void CreateDialog::popup_create(bool p_dontclear) {

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("create_recent." + base_type), FileAccess::READ);

	if (f) {

		TreeItem *root = recent->create_item();

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {

				TreeItem *ti = recent->create_item(root);
				ti->set_text(0, l);
				if (has_icon(l, "EditorIcons")) {

					ti->set_icon(0, get_icon(l, "EditorIcons"));
				} else {
					ti->set_icon(0, get_icon("Object", "EditorIcons"));
				}
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("favorites." + base_type), FileAccess::READ);

	favorite_list.clear();

	if (f) {

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {
				favorite_list.push_back(l);
			}
		}

		memdelete(f);
	}

	_update_favorite_list();


	// Restore valid window bounds or pop up at default size.
	if (EditorSettings::get_singleton()->has("interface/dialogs/create_new_node_bounds")) {
		popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds"));	
	} else {
		popup_centered_ratio();
	}


	if (p_dontclear)
		search_box->select_all();
	else {
		search_box->clear();
	}
	search_box->grab_focus();

	_update_search();
}
void OrphanResourcesDialog::show(){

	refresh();
	popup_centered_ratio();
}
示例#20
0
void CreateDialog::popup(bool p_dontclear) {

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("create_recent." + base_type), FileAccess::READ);

	if (f) {

		TreeItem *root = recent->create_item();

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {

				TreeItem *ti = recent->create_item(root);
				ti->set_text(0, l);
				if (has_icon(l, "EditorIcons")) {

					ti->set_icon(0, get_icon(l, "EditorIcons"));
				} else {
					ti->set_icon(0, get_icon("Object", "EditorIcons"));
				}
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_path().plus_file("favorites." + base_type), FileAccess::READ);

	favorite_list.clear();

	if (f) {

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {
				favorite_list.push_back(l);
			}
		}

		memdelete(f);
	} else {
#if 0
// I think this was way too confusing
		if (base_type=="Node") {
			//harcode some favorites :D
			favorite_list.push_back("Panel");
			favorite_list.push_back("Button");
			favorite_list.push_back("Label");
			favorite_list.push_back("LineEdit");
			favorite_list.push_back("Node2D");
			favorite_list.push_back("Sprite");
			favorite_list.push_back("Camera2D");
			favorite_list.push_back("Area2D");
			favorite_list.push_back("CollisionShape2D");
			favorite_list.push_back("Spatial");
			favorite_list.push_back("Camera");
			favorite_list.push_back("Area");
			favorite_list.push_back("CollisionShape");
			favorite_list.push_back("TestCube");
			favorite_list.push_back("AnimationPlayer");

		}
#endif
	}

	_update_favorite_list();

	popup_centered_ratio();
	if (p_dontclear)
		search_box->select_all();
	else {
		search_box->clear();
	}
	search_box->grab_focus();

	_update_search();
}
示例#21
0
void EditorAssetInstaller::open(const String& p_path,int p_depth) {


	package_path=p_path;
	Set<String> files_sorted;

	FileAccess *src_f=NULL;
	zlib_filefunc_def io = zipio_create_io_from_file(&src_f);

	unzFile pkg = unzOpen2(p_path.utf8().get_data(), &io);
	if (!pkg) {

		error->set_text("Error opening package file, not in zip format.");
		return;
	}

	int ret = unzGoToFirstFile(pkg);


	while(ret==UNZ_OK) {

		//get filename
		unz_file_info info;
		char fname[16384];
		ret = unzGetCurrentFileInfo(pkg,&info,fname,16384,NULL,0,NULL,0);

		String name=fname;
		files_sorted.insert(name);

		ret = unzGoToNextFile(pkg);
	}


	Map<String,Ref<Texture> > extension_guess;
	{
		extension_guess["png"]=get_icon("Texture","EditorIcons");
		extension_guess["jpg"]=get_icon("Texture","EditorIcons");
		extension_guess["tex"]=get_icon("Texture","EditorIcons");
		extension_guess["atex"]=get_icon("Texture","EditorIcons");
		extension_guess["dds"]=get_icon("Texture","EditorIcons");
		extension_guess["scn"]=get_icon("PackedScene","EditorIcons");
		extension_guess["tscn"]=get_icon("PackedScene","EditorIcons");
		extension_guess["xml"]=get_icon("PackedScene","EditorIcons");
		extension_guess["xscn"]=get_icon("PackedScene","EditorIcons");
		extension_guess["mtl"]=get_icon("Material","EditorIcons");
		extension_guess["shd"]=get_icon("Shader","EditorIcons");
		extension_guess["gd"]=get_icon("GDScript","EditorIcons");
	}

	Ref<Texture> generic_extension = get_icon("Object","EditorIcons");


	unzClose(pkg);

	updating=true;
	tree->clear();
	TreeItem *root=tree->create_item();
	root->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
	root->set_checked(0,true);
	root->set_icon(0,get_icon("folder","FileDialog"));
	root->set_text(0,"res://");
	root->set_editable(0,true);
	Map<String,TreeItem*> dir_map;

	for(Set<String>::Element *E=files_sorted.front();E;E=E->next()) {

		String path = E->get();
		int depth=p_depth;
		bool skip=false;
		while(depth>0) {
			int pp = path.find("/");
			if (pp==-1) {
				skip=true;
				break;
			}
			path=path.substr(pp+1,path.length());
			depth--;
		}

		if (skip || path==String())
			continue;

		bool isdir=false;

		if (path.ends_with("/")) {
			//a directory
			path=path.substr(0,path.length()-1);
			isdir=true;
		}

		int pp = path.find_last("/");


		TreeItem *parent;
		if (pp==-1) {
			parent=root;
		} else {
			String ppath=path.substr(0,pp);
			print_line("PPATH IS: "+ppath);
			ERR_CONTINUE(!dir_map.has(ppath));
			parent=dir_map[ppath];

		}

		TreeItem *ti = tree->create_item(parent);
		ti->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
		ti->set_checked(0,true);
		ti->set_editable(0,true);
		if (isdir) {
			dir_map[path]=ti;
			ti->set_text(0,path.get_file()+"/");
			ti->set_icon(0,get_icon("folder","FileDialog"));
		} else {
			String file = path.get_file();
			String extension = file.extension().to_lower();
			if (extension_guess.has(extension)) {
				ti->set_icon(0,extension_guess[extension]);
			} else {
				ti->set_icon(0,generic_extension);
			}
			ti->set_text(0,file);


			String res_path = "res://"+path;
			if (FileAccess::exists(res_path)) {
				ti->set_custom_color(0,Color(1,0.3,0.2));
				ti->set_tooltip(0,res_path+" (Already Exists)");
				ti->set_checked(0,false);
			} else {
				ti->set_tooltip(0,res_path);

			}

			ti->set_metadata(0,res_path);

		}

		status_map[E->get()]=ti;



	}
	popup_centered_ratio();
	updating=false;

}