summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-04-03 15:59:26 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-04-03 15:59:26 +0200
commit7f332ec78cf6da75db0adf8c53880c349d9e9126 (patch)
tree29eb1b60262852b2ec371cda7df9baee997b10e8
parent1d956d095081883b9ca0719222b8dbf4e736ca47 (diff)
parent390bb23675a3e7c05881a8e55705b8848d0da086 (diff)
downloadredot-engine-7f332ec78cf6da75db0adf8c53880c349d9e9126.tar.gz
Merge pull request #73249 from KoBeWi/image_for_your_inspector
Improve Image preview in the inspector
-rw-r--r--editor/plugins/texture_editor_plugin.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 2fb624b713..283e906052 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -152,11 +152,15 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
}
bool EditorInspectorPluginTexture::can_handle(Object *p_object) {
- return Object::cast_to<ImageTexture>(p_object) != nullptr || Object::cast_to<AtlasTexture>(p_object) != nullptr || Object::cast_to<CompressedTexture2D>(p_object) != nullptr || Object::cast_to<AnimatedTexture>(p_object) != nullptr;
+ return Object::cast_to<ImageTexture>(p_object) != nullptr || Object::cast_to<AtlasTexture>(p_object) != nullptr || Object::cast_to<CompressedTexture2D>(p_object) != nullptr || Object::cast_to<AnimatedTexture>(p_object) != nullptr || Object::cast_to<Image>(p_object) != nullptr;
}
void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
Ref<Texture> texture(Object::cast_to<Texture>(p_object));
+ if (texture.is_null()) {
+ Ref<Image> image(Object::cast_to<Image>(p_object));
+ texture = ImageTexture::create_from_image(image);
+ }
add_custom_control(memnew(TexturePreview(texture, true)));
}