Exemple #1
0
void EditorHelpSearch::popup() {
	popup_centered_ratio(0.6);
	if (search_box->get_text()!="") {
		search_box->select_all();
		_update_search();
	}
	search_box->grab_focus();
}
Exemple #2
0
void CreateDialog::_history_selected() {

	TreeItem *item = recent->get_selected();
	if (!item)
		return;

	search_box->set_text(item->get_text(0));
	_update_search();
}
Exemple #3
0
void CreateDialog::_favorite_selected() {

	TreeItem *item = favorites->get_selected();
	if (!item)
		return;

	search_box->set_text(item->get_text(0));
	_update_search();
}
Exemple #4
0
void CreateDialog::_favorite_selected() {

	TreeItem *item = favorites->get_selected();
	if (!item)
		return;

	search_box->set_text(item->get_text(0).get_slicec(' ', 0));
	recent->deselect_all();
	_update_search();
}
Exemple #5
0
void CreateDialog::set_base_type(const String &p_base) {

	base_type = p_base;
	if (is_replace_mode)
		set_title(vformat(TTR("Change %s Type"), p_base));
	else
		set_title(vformat(TTR("Create New %s"), p_base));

	_update_search();
}
Exemple #6
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();
}
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();


}
Exemple #8
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();


}
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();


}
Exemple #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();
}
void VisualScriptPropertySelector::select_from_visual_script(const String &p_base, const bool p_connecting) {
	base_type = p_base;
	selected = "";
	type = Variant::NIL;
	script = 0;
	properties = true;
	visual_script_generic = true;
	instance = NULL;
	virtuals_only = false;
	show_window(.5f);
	search_box->set_text("");
	search_box->grab_focus();
	connecting = p_connecting;

	_update_search();
}
Exemple #12
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();
}
Exemple #13
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();

}
Exemple #14
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();

}
void VisualScriptPropertySelector::select_method_from_base_type(const String &p_base, const String &p_current, const bool p_virtuals_only, const bool p_connecting) {

	base_type = p_base;
	selected = p_current;
	type = Variant::NIL;
	script = 0;
	properties = false;
	instance = NULL;
	virtuals_only = p_virtuals_only;

	show_window(.5f);
	search_box->set_text("");
	search_box->grab_focus();
	connecting = p_connecting;

	_update_search();
}
Exemple #16
0
void EditorHelpSearch::_notification(int p_what) {

	if (p_what==NOTIFICATION_ENTER_SCENE) {

		connect("confirmed",this,"_confirmed");
		_update_search();
	}

	if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {

		if (is_visible()) {

			search_box->call_deferred("grab_focus"); // still not visible
			search_box->select_all();
		}
	}

}
void VisualScriptPropertySelector::select_from_basic_type(Variant::Type p_type, const String &p_current, const bool p_connecting) {
	ERR_FAIL_COND(p_type == Variant::NIL);
	base_type = "";
	selected = p_current;
	type = p_type;
	script = 0;
	properties = true;
	visual_script_generic = false;
	instance = NULL;
	virtuals_only = false;

	show_window(.5f);
	search_box->set_text("");
	search_box->grab_focus();
	seq_connect = false;
	connecting = p_connecting;

	_update_search();
}
void VisualScriptPropertySelector::select_from_script(const Ref<Script> &p_script, const String &p_current, const bool p_connecting) {
	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 = true;
	visual_script_generic = false;
	instance = NULL;
	virtuals_only = false;

	show_window(.5f);
	search_box->set_text("");
	search_box->grab_focus();
	seq_connect = false;
	connecting = p_connecting;

	_update_search();
}
Exemple #19
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();

}
void CreateDialog::_text_changed(const String& p_newtext) {

	_update_search();
}
Exemple #21
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 CreateDialog::set_base_type(const String& p_base) {

	base_type=p_base;
	set_title("Create New "+p_base);
	_update_search();
}
Exemple #23
0
void EditorQuickOpen::_text_changed(const String& p_newtext) {

    _update_search();
}
Exemple #24
0
void EditorHelpSearch::_text_changed(const String& p_newtext) {

	_update_search();
}
Exemple #25
0
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_select_type) {

	type_list.clear();
	ClassDB::get_class_list(&type_list);
	ScriptServer::get_global_class_list(&type_list);
	type_list.sort_custom<StringName::AlphCompare>();

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().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();
			String name = l.split(" ")[0];

			if (ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) {
				TreeItem *ti = recent->create_item(root);
				ti->set_text(0, l);
				ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().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);
	}

	_save_and_update_favorite_list();

	// Restore valid window bounds or pop up at default size.
	Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
	if (saved_size != Rect2()) {
		popup(saved_size);
	} else {
		popup_centered_clamped(Size2(900, 700) * EDSCALE, 0.8);
	}

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

	search_box->grab_focus();

	_update_search();

	is_replace_mode = p_replace_mode;

	if (p_replace_mode) {
		select_type(p_select_type);
		set_title(vformat(TTR("Change %s Type"), base_type));
		get_ok()->set_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		get_ok()->set_text(TTR("Create"));
	}
}
void VisualScriptPropertySelector::_text_changed(const String &p_newtext) {
	_update_search();
}
Exemple #27
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();
}
Exemple #28
0
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {

	type_list.clear();
	ClassDB::get_class_list(&type_list);
	ScriptServer::get_global_class_list(&type_list);
	type_list.sort_custom<StringName::AlphCompare>();

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().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);
				ti->set_icon(0, _get_editor_icon(l));
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().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_setting("interface/dialogs/create_new_node_bounds")) {
		popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds"));
	} else {

		Size2 popup_size = Size2(900, 700) * editor_get_scale();
		Size2 window_size = get_viewport_rect().size;

		popup_size.x = MIN(window_size.x * 0.8, popup_size.x);
		popup_size.y = MIN(window_size.y * 0.8, popup_size.y);

		popup_centered(popup_size);
	}

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

	search_box->grab_focus();

	_update_search();

	bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines");
	Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color");

	if (enable_rl) {
		search_options->add_constant_override("draw_relationship_lines", 1);
		search_options->add_color_override("relationship_line_color", rl_color);
	} else {
		search_options->add_constant_override("draw_relationship_lines", 0);
	}

	is_replace_mode = p_replace_mode;

	if (p_replace_mode) {
		set_title(vformat(TTR("Change %s Type"), base_type));
		get_ok()->set_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		get_ok()->set_text(TTR("Create"));
	}
}