Added asset library on project manager for templates
This commit is contained in:
parent
47944098c2
commit
b847aec864
5 changed files with 141 additions and 100 deletions
|
@ -55,7 +55,7 @@ void EditorAssetLibraryItem::configure(const String& p_title,int p_asset_id,cons
|
|||
|
||||
void EditorAssetLibraryItem::set_image(int p_type,int p_index,const Ref<Texture>& p_image) {
|
||||
|
||||
ERR_FAIL_COND(p_type!=EditorAddonLibrary::IMAGE_QUEUE_ICON);
|
||||
ERR_FAIL_COND(p_type!=EditorAssetLibrary::IMAGE_QUEUE_ICON);
|
||||
ERR_FAIL_COND(p_index!=0);
|
||||
|
||||
icon->set_normal_texture(p_image);
|
||||
|
@ -163,16 +163,16 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void EditorAddonLibraryItemDescription::set_image(int p_type,int p_index,const Ref<Texture>& p_image) {
|
||||
void EditorAssetLibraryItemDescription::set_image(int p_type,int p_index,const Ref<Texture>& p_image) {
|
||||
|
||||
switch(p_type) {
|
||||
|
||||
case EditorAddonLibrary::IMAGE_QUEUE_ICON: {
|
||||
case EditorAssetLibrary::IMAGE_QUEUE_ICON: {
|
||||
|
||||
item->call("set_image",p_type,p_index,p_image);
|
||||
icon=p_image;
|
||||
} break;
|
||||
case EditorAddonLibrary::IMAGE_QUEUE_THUMBNAIL: {
|
||||
case EditorAssetLibrary::IMAGE_QUEUE_THUMBNAIL: {
|
||||
|
||||
for(int i=0;i<preview_images.size();i++) {
|
||||
if (preview_images[i].id==p_index) {
|
||||
|
@ -182,7 +182,7 @@ void EditorAddonLibraryItemDescription::set_image(int p_type,int p_index,const R
|
|||
}
|
||||
//item->call("set_image",p_type,p_index,p_image);
|
||||
} break;
|
||||
case EditorAddonLibrary::IMAGE_QUEUE_SCREENSHOT: {
|
||||
case EditorAssetLibrary::IMAGE_QUEUE_SCREENSHOT: {
|
||||
|
||||
for(int i=0;i<preview_images.size();i++) {
|
||||
if (preview_images[i].id==p_index) {
|
||||
|
@ -198,19 +198,19 @@ void EditorAddonLibraryItemDescription::set_image(int p_type,int p_index,const R
|
|||
}
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDescription::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("set_image"),&EditorAddonLibraryItemDescription::set_image);
|
||||
ObjectTypeDB::bind_method(_MD("_link_click"),&EditorAddonLibraryItemDescription::_link_click);
|
||||
ObjectTypeDB::bind_method(_MD("_preview_click"),&EditorAddonLibraryItemDescription::_preview_click);
|
||||
void EditorAssetLibraryItemDescription::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("set_image"),&EditorAssetLibraryItemDescription::set_image);
|
||||
ObjectTypeDB::bind_method(_MD("_link_click"),&EditorAssetLibraryItemDescription::_link_click);
|
||||
ObjectTypeDB::bind_method(_MD("_preview_click"),&EditorAssetLibraryItemDescription::_preview_click);
|
||||
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDescription::_link_click(const String& p_url) {
|
||||
void EditorAssetLibraryItemDescription::_link_click(const String& p_url) {
|
||||
ERR_FAIL_COND(!p_url.begins_with("http"));
|
||||
OS::get_singleton()->shell_open(p_url);
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDescription::_preview_click(int p_id) {
|
||||
void EditorAssetLibraryItemDescription::_preview_click(int p_id) {
|
||||
for(int i=0;i<preview_images.size();i++) {
|
||||
if(preview_images[i].id==p_id) {
|
||||
preview_images[i].button->set_pressed(true);
|
||||
|
@ -227,7 +227,7 @@ void EditorAddonLibraryItemDescription::_preview_click(int p_id) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDescription::configure(const String& p_title,int p_asset_id,const String& p_category,int p_category_id,const String& p_author,int p_author_id,int p_rating,const String& p_cost,int p_version,const String& p_version_string,const String& p_description,const String& p_download_url,const String& p_browse_url) {
|
||||
void EditorAssetLibraryItemDescription::configure(const String& p_title,int p_asset_id,const String& p_category,int p_category_id,const String& p_author,int p_author_id,int p_rating,const String& p_cost,int p_version,const String& p_version_string,const String& p_description,const String& p_download_url,const String& p_browse_url) {
|
||||
|
||||
asset_id=p_asset_id;
|
||||
title=p_title;
|
||||
|
@ -244,7 +244,7 @@ void EditorAddonLibraryItemDescription::configure(const String& p_title,int p_as
|
|||
set_title(p_title);
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDescription::add_preview(int p_id, bool p_video,const String& p_url){
|
||||
void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video,const String& p_url){
|
||||
|
||||
Preview preview;
|
||||
preview.id=p_id;
|
||||
|
@ -265,7 +265,7 @@ void EditorAddonLibraryItemDescription::add_preview(int p_id, bool p_video,const
|
|||
preview_images.push_back(preview);
|
||||
}
|
||||
|
||||
EditorAddonLibraryItemDescription::EditorAddonLibraryItemDescription() {
|
||||
EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
|
||||
|
||||
VBoxContainer *vbox = memnew( VBoxContainer );
|
||||
add_child(vbox);
|
||||
|
@ -320,7 +320,7 @@ EditorAddonLibraryItemDescription::EditorAddonLibraryItemDescription() {
|
|||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void EditorAddonLibraryItemDownload::_http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) {
|
||||
void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) {
|
||||
|
||||
|
||||
String error_text;
|
||||
|
@ -384,7 +384,7 @@ void EditorAddonLibraryItemDownload::_http_download_completed(int p_status, int
|
|||
}
|
||||
|
||||
|
||||
void EditorAddonLibraryItemDownload::configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url) {
|
||||
void EditorAssetLibraryItemDownload::configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url) {
|
||||
|
||||
title->set_text(p_title);
|
||||
icon->set_texture(p_preview);
|
||||
|
@ -399,7 +399,7 @@ void EditorAddonLibraryItemDownload::configure(const String& p_title,int p_asset
|
|||
}
|
||||
|
||||
|
||||
void EditorAddonLibraryItemDownload::_notification(int p_what) {
|
||||
void EditorAssetLibraryItemDownload::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_PROCESS) {
|
||||
|
||||
|
@ -429,7 +429,7 @@ void EditorAddonLibraryItemDownload::_notification(int p_what) {
|
|||
|
||||
}
|
||||
}
|
||||
void EditorAddonLibraryItemDownload::_close() {
|
||||
void EditorAssetLibraryItemDownload::_close() {
|
||||
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
da->remove(download->get_download_file()); //clean up removed file
|
||||
|
@ -437,13 +437,13 @@ void EditorAddonLibraryItemDownload::_close() {
|
|||
queue_delete();
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDownload::_install() {
|
||||
void EditorAssetLibraryItemDownload::_install() {
|
||||
|
||||
String file = download->get_download_file();
|
||||
asset_installer->open(file,1);
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDownload::_make_request() {
|
||||
void EditorAssetLibraryItemDownload::_make_request() {
|
||||
download->cancel_request();
|
||||
download->set_download_file(EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("tmp_asset_"+itos(asset_id))+".zip");
|
||||
Error err = download->request(host);
|
||||
|
@ -454,16 +454,16 @@ void EditorAddonLibraryItemDownload::_make_request() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorAddonLibraryItemDownload::_bind_methods() {
|
||||
void EditorAssetLibraryItemDownload::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method("_http_download_completed",&EditorAddonLibraryItemDownload::_http_download_completed);
|
||||
ObjectTypeDB::bind_method("_install",&EditorAddonLibraryItemDownload::_install);
|
||||
ObjectTypeDB::bind_method("_close",&EditorAddonLibraryItemDownload::_close);
|
||||
ObjectTypeDB::bind_method("_make_request",&EditorAddonLibraryItemDownload::_make_request);
|
||||
ObjectTypeDB::bind_method("_http_download_completed",&EditorAssetLibraryItemDownload::_http_download_completed);
|
||||
ObjectTypeDB::bind_method("_install",&EditorAssetLibraryItemDownload::_install);
|
||||
ObjectTypeDB::bind_method("_close",&EditorAssetLibraryItemDownload::_close);
|
||||
ObjectTypeDB::bind_method("_make_request",&EditorAssetLibraryItemDownload::_make_request);
|
||||
|
||||
}
|
||||
|
||||
EditorAddonLibraryItemDownload::EditorAddonLibraryItemDownload() {
|
||||
EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
|
||||
|
||||
HBoxContainer *hb = memnew( HBoxContainer);
|
||||
add_child(hb);
|
||||
|
@ -532,7 +532,7 @@ EditorAddonLibraryItemDownload::EditorAddonLibraryItemDownload() {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void EditorAddonLibrary::_notification(int p_what) {
|
||||
void EditorAssetLibrary::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_READY) {
|
||||
TextureFrame *tf = memnew(TextureFrame);
|
||||
|
@ -581,13 +581,13 @@ void EditorAddonLibrary::_notification(int p_what) {
|
|||
}
|
||||
|
||||
|
||||
void EditorAddonLibrary::_install_asset() {
|
||||
void EditorAssetLibrary::_install_asset() {
|
||||
|
||||
ERR_FAIL_COND(!description);
|
||||
|
||||
for(int i=0;i<downloads_hb->get_child_count();i++) {
|
||||
|
||||
EditorAddonLibraryItemDownload *d = downloads_hb->get_child(i)->cast_to<EditorAddonLibraryItemDownload>();
|
||||
EditorAssetLibraryItemDownload *d = downloads_hb->get_child(i)->cast_to<EditorAssetLibraryItemDownload>();
|
||||
if (d && d->get_asset_id() == description->get_asset_id()) {
|
||||
|
||||
EditorNode::get_singleton()->show_warning("Download for this asset is already in progress!");
|
||||
|
@ -596,13 +596,13 @@ void EditorAddonLibrary::_install_asset() {
|
|||
}
|
||||
|
||||
|
||||
EditorAddonLibraryItemDownload * download = memnew( EditorAddonLibraryItemDownload );
|
||||
EditorAssetLibraryItemDownload * download = memnew( EditorAssetLibraryItemDownload );
|
||||
downloads_hb->add_child(download);
|
||||
download->configure(description->get_title(),description->get_asset_id(),description->get_preview_icon(),description->get_download_url());
|
||||
|
||||
}
|
||||
|
||||
const char* EditorAddonLibrary::sort_key[SORT_MAX]={
|
||||
const char* EditorAssetLibrary::sort_key[SORT_MAX]={
|
||||
"rating",
|
||||
"downloads",
|
||||
"name",
|
||||
|
@ -610,7 +610,7 @@ const char* EditorAddonLibrary::sort_key[SORT_MAX]={
|
|||
"updated"
|
||||
};
|
||||
|
||||
const char* EditorAddonLibrary::sort_text[SORT_MAX]={
|
||||
const char* EditorAssetLibrary::sort_text[SORT_MAX]={
|
||||
"Rating",
|
||||
"Downloads",
|
||||
"Name",
|
||||
|
@ -619,12 +619,12 @@ const char* EditorAddonLibrary::sort_text[SORT_MAX]={
|
|||
};
|
||||
|
||||
|
||||
void EditorAddonLibrary::_select_author(int p_id) {
|
||||
void EditorAssetLibrary::_select_author(int p_id) {
|
||||
|
||||
//opemn author window
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_select_category(int p_id){
|
||||
void EditorAssetLibrary::_select_category(int p_id){
|
||||
|
||||
for(int i=0;i<categories->get_item_count();i++) {
|
||||
|
||||
|
@ -638,7 +638,7 @@ void EditorAddonLibrary::_select_category(int p_id){
|
|||
}
|
||||
}
|
||||
}
|
||||
void EditorAddonLibrary::_select_asset(int p_id){
|
||||
void EditorAssetLibrary::_select_asset(int p_id){
|
||||
|
||||
_api_request("asset/"+itos(p_id), REQUESTING_ASSET);
|
||||
|
||||
|
@ -648,12 +648,12 @@ void EditorAddonLibrary::_select_asset(int p_id){
|
|||
}
|
||||
|
||||
|
||||
description = memnew( EditorAddonLibraryItemDescription );
|
||||
description = memnew( EditorAssetLibraryItemDescription );
|
||||
add_child(description);
|
||||
description->popup_centered_minsize();*/
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_image_update(bool use_cache, bool final, const ByteArray& p_data, int p_queue_id) {
|
||||
void EditorAssetLibrary::_image_update(bool use_cache, bool final, const ByteArray& p_data, int p_queue_id) {
|
||||
Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target);
|
||||
|
||||
if (obj) {
|
||||
|
@ -707,7 +707,7 @@ void EditorAddonLibrary::_image_update(bool use_cache, bool final, const ByteArr
|
|||
}
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_image_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data,int p_queue_id) {
|
||||
void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data,int p_queue_id) {
|
||||
|
||||
ERR_FAIL_COND( !image_queue.has(p_queue_id) );
|
||||
|
||||
|
@ -758,7 +758,7 @@ void EditorAddonLibrary::_image_request_completed(int p_status, int p_code, cons
|
|||
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_update_image_queue() {
|
||||
void EditorAssetLibrary::_update_image_queue() {
|
||||
|
||||
int max_images=2;
|
||||
int current_images=0;
|
||||
|
@ -798,7 +798,7 @@ void EditorAddonLibrary::_update_image_queue() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_request_image(ObjectID p_for,String p_image_url,ImageType p_type,int p_image_index) {
|
||||
void EditorAssetLibrary::_request_image(ObjectID p_for,String p_image_url,ImageType p_type,int p_image_index) {
|
||||
|
||||
|
||||
ImageQueue iq;
|
||||
|
@ -823,13 +823,13 @@ void EditorAddonLibrary::_request_image(ObjectID p_for,String p_image_url,ImageT
|
|||
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_repository_changed(int p_repository_id) {
|
||||
void EditorAssetLibrary::_repository_changed(int p_repository_id) {
|
||||
host=repository->get_item_metadata(p_repository_id);
|
||||
print_line(".." + host);
|
||||
_api_request("configure", REQUESTING_CONFIG);
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_search(int p_page) {
|
||||
void EditorAssetLibrary::_search(int p_page) {
|
||||
|
||||
String args;
|
||||
|
||||
|
@ -856,7 +856,7 @@ void EditorAddonLibrary::_search(int p_page) {
|
|||
_api_request("asset",REQUESTING_SEARCH,args);
|
||||
}
|
||||
|
||||
HBoxContainer* EditorAddonLibrary::_make_pages(int p_page,int p_page_count,int p_page_len,int p_total_items,int p_current_items) {
|
||||
HBoxContainer* EditorAssetLibrary::_make_pages(int p_page,int p_page_count,int p_page_len,int p_total_items,int p_current_items) {
|
||||
|
||||
HBoxContainer * hbc = memnew( HBoxContainer );
|
||||
|
||||
|
@ -940,7 +940,7 @@ HBoxContainer* EditorAddonLibrary::_make_pages(int p_page,int p_page_count,int p
|
|||
}
|
||||
|
||||
|
||||
void EditorAddonLibrary::_api_request(const String& p_request, RequestType p_request_type, const String& p_arguments) {
|
||||
void EditorAssetLibrary::_api_request(const String& p_request, RequestType p_request_type, const String& p_arguments) {
|
||||
|
||||
if (requesting!=REQUESTING_NONE) {
|
||||
request->cancel_request();
|
||||
|
@ -953,7 +953,7 @@ void EditorAddonLibrary::_api_request(const String& p_request, RequestType p_req
|
|||
|
||||
|
||||
|
||||
void EditorAddonLibrary::_http_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) {
|
||||
void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data) {
|
||||
|
||||
|
||||
String str;
|
||||
|
@ -1134,7 +1134,7 @@ void EditorAddonLibrary::_http_request_completed(int p_status, int p_code, const
|
|||
memdelete(description);
|
||||
}
|
||||
|
||||
description = memnew( EditorAddonLibraryItemDescription );
|
||||
description = memnew( EditorAssetLibraryItemDescription );
|
||||
add_child(description);
|
||||
description->popup_centered_minsize();
|
||||
description->connect("confirmed",this,"_install_asset");
|
||||
|
@ -1185,7 +1185,7 @@ void EditorAddonLibrary::_http_request_completed(int p_status, int p_code, const
|
|||
}
|
||||
|
||||
|
||||
void EditorAddonLibrary::_asset_file_selected(const String& p_file) {
|
||||
void EditorAssetLibrary::_asset_file_selected(const String& p_file) {
|
||||
|
||||
if (asset_installer) {
|
||||
memdelete( asset_installer );
|
||||
|
@ -1199,12 +1199,12 @@ void EditorAddonLibrary::_asset_file_selected(const String& p_file) {
|
|||
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_asset_open() {
|
||||
void EditorAssetLibrary::_asset_open() {
|
||||
|
||||
asset_open->popup_centered_ratio();
|
||||
}
|
||||
|
||||
void EditorAddonLibrary::_manage_plugins() {
|
||||
void EditorAssetLibrary::_manage_plugins() {
|
||||
|
||||
ProjectSettings::get_singleton()->popup_project_settings();
|
||||
ProjectSettings::get_singleton()->set_plugins_page();
|
||||
|
@ -1212,24 +1212,25 @@ void EditorAddonLibrary::_manage_plugins() {
|
|||
|
||||
|
||||
|
||||
void EditorAddonLibrary::_bind_methods() {
|
||||
void EditorAssetLibrary::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method("_http_request_completed",&EditorAddonLibrary::_http_request_completed);
|
||||
ObjectTypeDB::bind_method("_select_asset",&EditorAddonLibrary::_select_asset);
|
||||
ObjectTypeDB::bind_method("_select_author",&EditorAddonLibrary::_select_author);
|
||||
ObjectTypeDB::bind_method("_select_category",&EditorAddonLibrary::_select_category);
|
||||
ObjectTypeDB::bind_method("_image_request_completed",&EditorAddonLibrary::_image_request_completed);
|
||||
ObjectTypeDB::bind_method("_search",&EditorAddonLibrary::_search,DEFVAL(0));
|
||||
ObjectTypeDB::bind_method("_install_asset",&EditorAddonLibrary::_install_asset);
|
||||
ObjectTypeDB::bind_method("_manage_plugins",&EditorAddonLibrary::_manage_plugins);
|
||||
ObjectTypeDB::bind_method("_asset_open",&EditorAddonLibrary::_asset_open);
|
||||
ObjectTypeDB::bind_method("_asset_file_selected",&EditorAddonLibrary::_asset_file_selected);
|
||||
ObjectTypeDB::bind_method("_repository_changed",&EditorAddonLibrary::_repository_changed);
|
||||
ObjectTypeDB::bind_method("_http_request_completed",&EditorAssetLibrary::_http_request_completed);
|
||||
ObjectTypeDB::bind_method("_select_asset",&EditorAssetLibrary::_select_asset);
|
||||
ObjectTypeDB::bind_method("_select_author",&EditorAssetLibrary::_select_author);
|
||||
ObjectTypeDB::bind_method("_select_category",&EditorAssetLibrary::_select_category);
|
||||
ObjectTypeDB::bind_method("_image_request_completed",&EditorAssetLibrary::_image_request_completed);
|
||||
ObjectTypeDB::bind_method("_search",&EditorAssetLibrary::_search,DEFVAL(0));
|
||||
ObjectTypeDB::bind_method("_install_asset",&EditorAssetLibrary::_install_asset);
|
||||
ObjectTypeDB::bind_method("_manage_plugins",&EditorAssetLibrary::_manage_plugins);
|
||||
ObjectTypeDB::bind_method("_asset_open",&EditorAssetLibrary::_asset_open);
|
||||
ObjectTypeDB::bind_method("_asset_file_selected",&EditorAssetLibrary::_asset_file_selected);
|
||||
ObjectTypeDB::bind_method("_repository_changed",&EditorAssetLibrary::_repository_changed);
|
||||
|
||||
}
|
||||
|
||||
EditorAddonLibrary::EditorAddonLibrary() {
|
||||
EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
||||
|
||||
templates_only=p_templates_only;
|
||||
|
||||
Ref<StyleBoxEmpty> border;
|
||||
border.instance();
|
||||
|
@ -1260,7 +1261,8 @@ EditorAddonLibrary::EditorAddonLibrary() {
|
|||
search->connect("pressed",this,"_search");
|
||||
search_hb->add_child(search);
|
||||
|
||||
search_hb->add_child(memnew( VSeparator ));
|
||||
if (!p_templates_only)
|
||||
search_hb->add_child(memnew( VSeparator ));
|
||||
|
||||
Button * open_asset = memnew( Button );
|
||||
open_asset->set_text("Import");
|
||||
|
@ -1272,6 +1274,11 @@ EditorAddonLibrary::EditorAddonLibrary() {
|
|||
search_hb->add_child(plugins);
|
||||
plugins->connect("pressed",this,"_manage_plugins");
|
||||
|
||||
if (p_templates_only) {
|
||||
open_asset->hide();
|
||||
plugins->hide();
|
||||
}
|
||||
|
||||
|
||||
library_vb->add_child(search_hb);
|
||||
|
||||
|
@ -1428,7 +1435,7 @@ void AssetLibraryEditorPlugin::make_visible(bool p_visible) {
|
|||
AssetLibraryEditorPlugin::AssetLibraryEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor=p_node;
|
||||
addon_library = memnew( EditorAddonLibrary );
|
||||
addon_library = memnew( EditorAssetLibrary );
|
||||
addon_library->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
editor->get_viewport()->add_child(addon_library);
|
||||
addon_library->set_area_as_parent_rect();
|
||||
|
|
|
@ -86,9 +86,9 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class EditorAddonLibraryItemDescription : public ConfirmationDialog {
|
||||
class EditorAssetLibraryItemDescription : public ConfirmationDialog {
|
||||
|
||||
OBJ_TYPE(EditorAddonLibraryItemDescription, ConfirmationDialog);
|
||||
OBJ_TYPE(EditorAssetLibraryItemDescription, ConfirmationDialog);
|
||||
|
||||
EditorAssetLibraryItem *item;
|
||||
RichTextLabel *description;
|
||||
|
@ -127,13 +127,13 @@ public:
|
|||
Ref<Texture> get_preview_icon() { return icon; }
|
||||
String get_download_url() { return download_url; }
|
||||
int get_asset_id() { return asset_id; }
|
||||
EditorAddonLibraryItemDescription();
|
||||
EditorAssetLibraryItemDescription();
|
||||
|
||||
};
|
||||
|
||||
class EditorAddonLibraryItemDownload : public PanelContainer {
|
||||
class EditorAssetLibraryItemDownload : public PanelContainer {
|
||||
|
||||
OBJ_TYPE(EditorAddonLibraryItemDownload, PanelContainer);
|
||||
OBJ_TYPE(EditorAssetLibraryItemDownload, PanelContainer);
|
||||
|
||||
|
||||
TextureFrame *icon;
|
||||
|
@ -167,12 +167,12 @@ public:
|
|||
|
||||
int get_asset_id() { return asset_id; }
|
||||
void configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url);
|
||||
EditorAddonLibraryItemDownload();
|
||||
EditorAssetLibraryItemDownload();
|
||||
|
||||
};
|
||||
|
||||
class EditorAddonLibrary : public PanelContainer {
|
||||
OBJ_TYPE(EditorAddonLibrary,PanelContainer);
|
||||
class EditorAssetLibrary : public PanelContainer {
|
||||
OBJ_TYPE(EditorAssetLibrary,PanelContainer);
|
||||
|
||||
String host;
|
||||
|
||||
|
@ -204,6 +204,8 @@ class EditorAddonLibrary : public PanelContainer {
|
|||
|
||||
HTTPRequest *request;
|
||||
|
||||
bool templates_only;
|
||||
|
||||
|
||||
enum SortOrder {
|
||||
SORT_RATING,
|
||||
|
@ -251,7 +253,7 @@ class EditorAddonLibrary : public PanelContainer {
|
|||
HBoxContainer* _make_pages(int p_page, int p_page_count, int p_page_len, int p_total_items, int p_current_items);
|
||||
|
||||
//
|
||||
EditorAddonLibraryItemDescription *description;
|
||||
EditorAssetLibraryItemDescription *description;
|
||||
//
|
||||
|
||||
enum RequestType {
|
||||
|
@ -286,26 +288,26 @@ class EditorAddonLibrary : public PanelContainer {
|
|||
|
||||
void _repository_changed(int p_repository_id);
|
||||
|
||||
friend class EditorAddonLibraryItemDescription;
|
||||
friend class EditorAssetLibraryItemDescription;
|
||||
friend class EditorAssetLibraryItem;
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
public:
|
||||
EditorAddonLibrary();
|
||||
EditorAssetLibrary(bool p_templates_only=false);
|
||||
};
|
||||
|
||||
class AssetLibraryEditorPlugin : public EditorPlugin {
|
||||
|
||||
OBJ_TYPE( AssetLibraryEditorPlugin, EditorPlugin );
|
||||
|
||||
EditorAddonLibrary *addon_library;
|
||||
EditorAssetLibrary *addon_library;
|
||||
EditorNode *editor;
|
||||
|
||||
public:
|
||||
|
||||
virtual String get_name() const { return "Addons"; }
|
||||
virtual String get_name() const { return "AssetLib"; }
|
||||
bool has_main_screen() const { return true; }
|
||||
virtual void edit(Object *p_object) {}
|
||||
virtual bool handles(Object *p_object) const { return false; }
|
||||
|
|
BIN
tools/editor/icons/icon_logo_small.png
Normal file
BIN
tools/editor/icons/icon_logo_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "scene/gui/line_edit.h"
|
||||
#include "scene/gui/panel_container.h"
|
||||
#include "scene/gui/center_container.h"
|
||||
|
||||
|
||||
#include "scene/gui/texture_frame.h"
|
||||
|
@ -864,26 +865,46 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
VBoxContainer *vb = memnew( VBoxContainer );
|
||||
panel->add_child(vb);
|
||||
vb->set_area_as_parent_rect(20);
|
||||
vb->set_area_as_parent_rect(20*EDSCALE);
|
||||
vb->set_margin(MARGIN_TOP,4*EDSCALE);
|
||||
vb->set_margin(MARGIN_BOTTOM,4*EDSCALE);
|
||||
vb->add_constant_override("separation",15*EDSCALE);
|
||||
|
||||
OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+TTR(" - Project Manager"));
|
||||
String cp;
|
||||
cp.push_back(0xA9);
|
||||
cp.push_back(0);
|
||||
OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")+" - "+cp+" 2008-2016 Juan Linietsky, Ariel Manzur.");
|
||||
|
||||
HBoxContainer *top_hb = memnew( HBoxContainer);
|
||||
vb->add_child(top_hb);
|
||||
TextureFrame *logo = memnew( TextureFrame );
|
||||
logo->set_texture(theme->get_icon("LogoSmall","EditorIcons"));
|
||||
//top_hb->add_child( logo );
|
||||
CenterContainer *ccl = memnew( CenterContainer );
|
||||
Label *l = memnew( Label );
|
||||
l->set_text(_MKSTR(VERSION_NAME)+TTR(" - Project Manager"));
|
||||
l->add_font_override("font",get_font("large","Fonts"));
|
||||
l->set_align(Label::ALIGN_CENTER);
|
||||
vb->add_child(l);
|
||||
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
|
||||
l->add_font_override("font",get_font("doc","EditorFonts"));
|
||||
ccl->add_child(l);
|
||||
top_hb->add_child(ccl);
|
||||
top_hb->add_spacer();
|
||||
l = memnew( Label );
|
||||
l->set_text("v" VERSION_MKSTRING);
|
||||
//l->add_font_override("font",get_font("bold","Fonts"));
|
||||
l->set_align(Label::ALIGN_CENTER);
|
||||
vb->add_child(l);
|
||||
vb->add_child(memnew(HSeparator));
|
||||
vb->add_margin_child("\n",memnew(Control));
|
||||
top_hb->add_child(l);
|
||||
//vb->add_child(memnew(HSeparator));
|
||||
//vb->add_margin_child("\n",memnew(Control));
|
||||
|
||||
tabs = memnew( TabContainer );
|
||||
vb->add_child(tabs);
|
||||
tabs->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
HBoxContainer *tree_hb = memnew( HBoxContainer);
|
||||
vb->add_margin_child(TTR("Recent Projects:"),tree_hb,true);
|
||||
projects_hb = tree_hb;
|
||||
|
||||
projects_hb->set_name(TTR("Project List"));
|
||||
|
||||
tabs->add_child(tree_hb);
|
||||
|
||||
VBoxContainer *search_tree_vb = memnew(VBoxContainer);
|
||||
search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
@ -964,23 +985,22 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
tree_vb->add_spacer();
|
||||
|
||||
|
||||
|
||||
asset_library = memnew( EditorAssetLibrary(true) );
|
||||
asset_library->set_name("Templates");
|
||||
tabs->add_child(asset_library);
|
||||
|
||||
|
||||
CenterContainer *cc = memnew( CenterContainer );
|
||||
Button * cancel = memnew( Button );
|
||||
cancel->set_text(TTR("Exit"));
|
||||
tree_vb->add_child(cancel);
|
||||
cancel->set_custom_minimum_size(Size2(100,1)*EDSCALE);
|
||||
cc->add_child(cancel);
|
||||
cancel->connect("pressed", this,"_exit_dialog");
|
||||
vb->add_child(cc);
|
||||
|
||||
|
||||
vb->add_margin_child("\n",memnew(Control));
|
||||
vb->add_child(memnew(HSeparator));
|
||||
|
||||
l = memnew( Label );
|
||||
String cp;
|
||||
cp.push_back(0xA9);
|
||||
cp.push_back(0);
|
||||
l->set_text(cp+" 2008-2016 Juan Linietsky, Ariel Manzur.");
|
||||
l->set_align(Label::ALIGN_CENTER);
|
||||
vb->add_child(l);
|
||||
|
||||
//
|
||||
|
||||
erase_ask = memnew( ConfirmationDialog );
|
||||
erase_ask->get_ok()->set_text(TTR("Remove"));
|
||||
|
@ -1000,6 +1020,11 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
add_child(multi_run_ask);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
OS::get_singleton()->set_low_processor_usage_mode(true);
|
||||
|
||||
npdialog = memnew( NewProjectDialog );
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "scene/gui/scroll_container.h"
|
||||
#include "scene/gui/file_dialog.h"
|
||||
#include "scene/gui/tool_button.h"
|
||||
#include "tools/editor/asset_library_editor_plugin.h"
|
||||
|
||||
class NewProjectDialog;
|
||||
class ProjectListFilter;
|
||||
|
@ -47,6 +48,8 @@ class ProjectManager : public Control {
|
|||
|
||||
FileDialog *scan_dir;
|
||||
|
||||
EditorAssetLibrary *asset_library;
|
||||
|
||||
ProjectListFilter *project_filter;
|
||||
|
||||
ConfirmationDialog *erase_ask;
|
||||
|
@ -60,6 +63,10 @@ class ProjectManager : public Control {
|
|||
String single_selected_main;
|
||||
bool importing;
|
||||
|
||||
HBoxContainer *projects_hb;
|
||||
|
||||
TabContainer *tabs;
|
||||
|
||||
void _item_doubleclicked();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue