summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-15 20:00:44 -0300
committerGitHub <noreply@github.com>2017-08-15 20:00:44 -0300
commit6380975ee277db907c52a9aa621c01281b5c12d4 (patch)
tree11df5af6f8b534efb52eea365501dfe7cdc15a02 /editor
parent1ecb48b8c275f8c895ed34ac7e267871859daf1e (diff)
parenta9da258a656c7c21a006589a2ba0a4c1fd9be6f7 (diff)
Merge pull request #10166 from toger5/asset_lib_style_overrides
fixed loading old theme styleboxes.
Diffstat (limited to 'editor')
-rw-r--r--editor/asset_library_editor_plugin.cpp103
-rw-r--r--editor/asset_library_editor_plugin.h4
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/io_plugins/editor_scene_import_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/sample_editor_plugin.cpp2
-rw-r--r--editor/plugins/sample_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
9 files changed, 69 insertions, 52 deletions
diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp
index 2a22cde2fb..0a2799c51f 100644
--- a/editor/asset_library_editor_plugin.cpp
+++ b/editor/asset_library_editor_plugin.cpp
@@ -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 (is_visible()) {
+ _repository_changed(0); // Update when shown for the first time
+ }
+ } break;
- if (visible != load_status->is_visible()) {
- load_status->set_visible(visible);
- }
+ case NOTIFICATION_PROCESS: {
- if (visible) {
- switch (s) {
+ HTTPClient::Status s = request->get_http_client_status();
+ bool visible = s != HTTPClient::STATUS_DISCONNECTED;
- 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 (visible != load_status->is_visible()) {
+ load_status->set_visible(visible);
}
- }
- bool no_downloads = downloads_hb->get_child_count() == 0;
- if (no_downloads == downloads_scroll->is_visible()) {
- downloads_scroll->set_visible(!no_downloads);
- }
+ 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);
diff --git a/editor/asset_library_editor_plugin.h b/editor/asset_library_editor_plugin.h
index 9e4a240101..8b68677b6c 100644
--- a/editor/asset_library_editor_plugin.h
+++ b/editor/asset_library_editor_plugin.h
@@ -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;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f80c4ee0e2..8b1f558c0a 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -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"));
}
}
diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp
index aa96f731ce..1890ca906a 100644
--- a/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -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);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index c4e79bf263..ecae272b6d 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -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;
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 2703da12fe..ccefbc1843 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -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);
diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp
index c4f04f0a80..1d6417e2d5 100644
--- a/editor/plugins/sample_editor_plugin.cpp
+++ b/editor/plugins/sample_editor_plugin.cpp
@@ -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 );
diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp
index 9e2bc211cf..3deb634491 100644
--- a/editor/plugins/sample_library_editor_plugin.cpp
+++ b/editor/plugins/sample_library_editor_plugin.cpp
@@ -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 );
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 6a010062f2..0f008552d0 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -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);