summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-10-07 16:31:57 +0200
committerGitHub <noreply@github.com>2018-10-07 16:31:57 +0200
commit604810f611d0dc1174d9e0b012bbb5a7cfceaf6c (patch)
treea9345a5641e23ccb81a62d39c8eac11933de0772 /editor
parente0871b0f525f9b605542307512ef773955a6999a (diff)
parenta9ec69663fd23ab15e5211588fb0fcf56bf2c7f9 (diff)
Merge pull request #22771 from guilhermefelipecgs/fix_inspector_preview
Fix inspector preview
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_properties.cpp10
-rw-r--r--editor/editor_properties.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index c5c78b2590..6eba9a9b67 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2102,12 +2102,18 @@ void EditorPropertyResource::_menu_option(int p_which) {
}
}
-void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture> &p_preview, ObjectID p_obj) {
+void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, ObjectID p_obj) {
RES p = get_edited_object()->get(get_edited_property());
if (p.is_valid() && p->get_instance_id() == p_obj) {
+ String type = p->get_class_name();
+
+ if (ClassDB::is_parent_class(type, "Script")) {
+ assign->set_text(p->get_path().get_file());
+ return;
+ }
+
if (p_preview.is_valid()) {
- String type = p->get_class_name();
preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_constant("hseparation", "Button"));
if (type == "GradientTexture") {
preview->set_stretch_mode(TextureRect::STRETCH_SCALE);
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 18e70345aa..35d8f4d306 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -548,7 +548,7 @@ class EditorPropertyResource : public EditorProperty {
void _file_selected(const String &p_path);
void _menu_option(int p_which);
- void _resource_preview(const String &p_path, const Ref<Texture> &p_preview, ObjectID p_obj);
+ void _resource_preview(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, ObjectID p_obj);
void _resource_selected();
void _viewport_selected(const NodePath &p_path);