浏览代码

Fix project manager category list, small enchancements as well

Bojidar Marinov 9 年之前
父节点
当前提交
1e08387ce0
共有 2 个文件被更改,包括 22 次插入3 次删除
  1. 21 3
      tools/editor/asset_library_editor_plugin.cpp
  2. 1 0
      tools/editor/asset_library_editor_plugin.h

+ 21 - 3
tools/editor/asset_library_editor_plugin.cpp

@@ -842,19 +842,33 @@ void EditorAssetLibrary::_request_image(ObjectID p_for,String p_image_url,ImageT
 void EditorAssetLibrary::_repository_changed(int p_repository_id) {
 	host=repository->get_item_metadata(p_repository_id);
 	print_line(".." + host);
-	_api_request("configure", REQUESTING_CONFIG);
+	if(templates_only) {
+		_api_request("configure", REQUESTING_CONFIG, "?type=project");
+	} else {
+		_api_request("configure", REQUESTING_CONFIG);
+	}
 }
 
 void EditorAssetLibrary::_support_toggled(int p_support) {
-	print_line(support_key[p_support]);
 	support->get_popup()->set_item_checked(p_support, !support->get_popup()->is_item_checked(p_support));
+	_search();
+}
+
+void EditorAssetLibrary::_rerun_search(int p_ignore) {
+	_search();
 }
 
 void EditorAssetLibrary::_search(int p_page) {
 
 	String args;
 
-	args=String()+"?sort="+sort_key[sort->get_selected()];
+	if(templates_only) {
+		args += "?type=project&";
+	} else {
+		args += "?";
+	}
+	args+=String()+"sort="+sort_key[sort->get_selected()];
+
 	
 	String support_list;
 	for(int i = 0; i < SUPPORT_MAX; i++) {
@@ -1258,6 +1272,7 @@ void EditorAssetLibrary::_bind_methods() {
 	ObjectTypeDB::bind_method("_asset_file_selected",&EditorAssetLibrary::_asset_file_selected);
 	ObjectTypeDB::bind_method("_repository_changed",&EditorAssetLibrary::_repository_changed);
 	ObjectTypeDB::bind_method("_support_toggled",&EditorAssetLibrary::_support_toggled);
+	ObjectTypeDB::bind_method("_rerun_search",&EditorAssetLibrary::_rerun_search);
 
 }
 
@@ -1325,9 +1340,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
 	search_hb2->add_child(sort);
 
 	sort->set_h_size_flags(SIZE_EXPAND_FILL);
+	sort->connect("item_selected", this, "_rerun_search");
 
 	reverse = memnew( ToolButton );
 	reverse->set_toggle_mode(true);
+	reverse->connect("toggled", this, "_rerun_search");
 	//reverse->set_text(TTR("Reverse"));
 	search_hb2->add_child(reverse);
 
@@ -1341,6 +1358,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
 	search_hb2->add_child(categories);
 	categories->set_h_size_flags(SIZE_EXPAND_FILL);
 	//search_hb2->add_spacer();
+	categories->connect("item_selected", this, "_rerun_search");
 
 	search_hb2->add_child(memnew(VSeparator));
 

+ 1 - 0
tools/editor/asset_library_editor_plugin.h

@@ -293,6 +293,7 @@ class EditorAssetLibrary : public PanelContainer {
 	void _manage_plugins();
 
 	void _search(int p_page=0);
+	void _rerun_search(int p_ignore);
 	void _api_request(const String& p_request, RequestType p_request_type, const String &p_arguments="");
 	void _http_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data);
 	void _http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data);