Merge pull request #10166 from toger5/asset_lib_style_overrides

fixed loading old theme styleboxes.
This commit is contained in:
Juan Linietsky 2017-08-15 20:00:44 -03:00 committed by GitHub
commit 6380975ee2
9 changed files with 72 additions and 55 deletions

View File

@ -189,7 +189,14 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
} break;
}
}
void EditorAssetLibraryItemDescription::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
} break;
}
}
void EditorAssetLibraryItemDescription::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_image"), &EditorAssetLibraryItemDescription::set_image);
ClassDB::bind_method(D_METHOD("_link_click"), &EditorAssetLibraryItemDescription::_link_click);
@ -274,23 +281,21 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
desc_vbox->add_child(item);
desc_vbox->set_custom_minimum_size(Size2(300, 0));
PanelContainer *desc_bg = memnew(PanelContainer);
desc_bg = memnew(PanelContainer);
desc_vbox->add_child(desc_bg);
desc_bg->set_v_size_flags(SIZE_EXPAND_FILL);
description = memnew(RichTextLabel);
description->connect("meta_clicked", this, "_link_click");
desc_bg->add_child(description);
desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
preview = memnew(TextureRect);
preview->set_custom_minimum_size(Size2(640, 345));
hbox->add_child(preview);
PanelContainer *previews_bg = memnew(PanelContainer);
previews_bg = memnew(PanelContainer);
vbox->add_child(previews_bg);
previews_bg->set_custom_minimum_size(Size2(0, 85));
previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
previews = memnew(ScrollContainer);
previews_bg->add_child(previews);
@ -525,53 +530,62 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
////////////////////////////////////////////////////////////////////////////////
void EditorAssetLibrary::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
TextureRect *tf = memnew(TextureRect);
tf->set_texture(get_icon("Error", "EditorIcons"));
reverse->set_icon(get_icon("Updown", "EditorIcons"));
switch (p_what) {
case NOTIFICATION_READY: {
error_hb->add_child(tf);
error_label->raise();
}
TextureRect *tf = memnew(TextureRect);
tf->set_texture(get_icon("Error", "EditorIcons"));
reverse->set_icon(get_icon("Updown", "EditorIcons"));
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (is_visible()) {
_repository_changed(0); // Update when shown for the first time
}
}
error_hb->add_child(tf);
error_label->raise();
} break;
if (p_what == NOTIFICATION_PROCESS) {
case NOTIFICATION_VISIBILITY_CHANGED: {
HTTPClient::Status s = request->get_http_client_status();
bool visible = s != HTTPClient::STATUS_DISCONNECTED;
if (visible != load_status->is_visible()) {
load_status->set_visible(visible);
}
if (visible) {
switch (s) {
case HTTPClient::STATUS_RESOLVING: {
load_status->set_value(0.1);
} break;
case HTTPClient::STATUS_CONNECTING: {
load_status->set_value(0.2);
} break;
case HTTPClient::STATUS_REQUESTING: {
load_status->set_value(0.3);
} break;
case HTTPClient::STATUS_BODY: {
load_status->set_value(0.4);
} break;
default: {}
if (is_visible()) {
_repository_changed(0); // Update when shown for the first time
}
}
} break;
bool no_downloads = downloads_hb->get_child_count() == 0;
if (no_downloads == downloads_scroll->is_visible()) {
downloads_scroll->set_visible(!no_downloads);
}
case NOTIFICATION_PROCESS: {
HTTPClient::Status s = request->get_http_client_status();
bool visible = s != HTTPClient::STATUS_DISCONNECTED;
if (visible != load_status->is_visible()) {
load_status->set_visible(visible);
}
if (visible) {
switch (s) {
case HTTPClient::STATUS_RESOLVING: {
load_status->set_value(0.1);
} break;
case HTTPClient::STATUS_CONNECTING: {
load_status->set_value(0.2);
} break;
case HTTPClient::STATUS_REQUESTING: {
load_status->set_value(0.3);
} break;
case HTTPClient::STATUS_BODY: {
load_status->set_value(0.4);
} break;
default: {}
}
}
bool no_downloads = downloads_hb->get_child_count() == 0;
if (no_downloads == downloads_scroll->is_visible()) {
downloads_scroll->set_visible(!no_downloads);
}
} break;
case NOTIFICATION_THEME_CHANGED: {
library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
} break;
}
}
@ -1360,9 +1374,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
/////////
PanelContainer *library_scroll_bg = memnew(PanelContainer);
library_scroll_bg = memnew(PanelContainer);
library_main->add_child(library_scroll_bg);
library_scroll_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
library_scroll_bg->set_v_size_flags(SIZE_EXPAND_FILL);
library_scroll = memnew(ScrollContainer);

View File

@ -89,6 +89,8 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
RichTextLabel *description;
ScrollContainer *previews;
HBoxContainer *preview_hb;
PanelContainer *previews_bg;
PanelContainer *desc_bg;
struct Preview {
int id;
@ -113,6 +115,7 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
void _preview_click(int p_index);
protected:
void _notification(int p_what);
static void _bind_methods();
public:
@ -179,6 +182,7 @@ class EditorAssetLibrary : public PanelContainer {
void _asset_open();
void _asset_file_selected(const String &p_file);
PanelContainer *library_scroll_bg;
ScrollContainer *library_scroll;
VBoxContainer *library_vb;
LineEdit *filter;

View File

@ -1788,7 +1788,7 @@ void EditorHelpBit::_bind_methods() {
void EditorHelpBit::_notification(int p_what) {
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles"));
}
}

View File

@ -1307,7 +1307,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
//confirm_import->set_child_rect(cvb);
PanelContainer *pc = memnew( PanelContainer );
pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal","TextEdit"));
//ec->add_child(pc);
missing_files = memnew( RichTextLabel );
cvb->add_margin_child(TTR("The Following Files are Missing:"),pc,true);

View File

@ -1246,7 +1246,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
set_focus_mode(FOCUS_ALL);
player = NULL;
add_style_override("panel", get_stylebox("panel", "Panel"));
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
Label *l;

View File

@ -362,7 +362,7 @@ void ResourcePreloaderEditor::_bind_methods() {
ResourcePreloaderEditor::ResourcePreloaderEditor() {
//add_style_override("panel", get_stylebox("panel","Panel"));
//add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);

View File

@ -360,7 +360,7 @@ SampleEditor::SampleEditor() {
player = memnew(SamplePlayer);
add_child(player);
add_style_override("panel", get_stylebox("panel","Panel"));
add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
library = Ref<SampleLibrary>(memnew(SampleLibrary));
player->set_sample_library(library);
sample_texframe = memnew( TextureRect );

View File

@ -432,7 +432,7 @@ SampleLibraryEditor::SampleLibraryEditor() {
player = memnew(SamplePlayer);
add_child(player);
add_style_override("panel", get_stylebox("panel","Panel"));
add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
load = memnew( Button );

View File

@ -714,7 +714,7 @@ void SpriteFramesEditor::_bind_methods() {
SpriteFramesEditor::SpriteFramesEditor() {
//add_style_override("panel", get_stylebox("panel","Panel"));
//add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
split = memnew(HSplitContainer);
add_child(split);