aboutsummaryrefslogtreecommitdiff
path: root/editor/plugins/material_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-10-20 23:55:58 +0200
committerGitHub2017-10-20 23:55:58 +0200
commit8cb76888aefbbf2891440a5e485219a60886ac3a (patch)
tree163098640e1ca26f38182779192e9e6f31f460eb /editor/plugins/material_editor_plugin.cpp
parent7969565de731a67e77a3a475de75088d87b36e4f (diff)
parent3bd2a4c42169eb141a71fb30e4786d4339e3789a (diff)
downloadgodot-8cb76888aefbbf2891440a5e485219a60886ac3a.tar.gz
godot-8cb76888aefbbf2891440a5e485219a60886ac3a.tar.zst
godot-8cb76888aefbbf2891440a5e485219a60886ac3a.zip
Merge pull request #12228 from hi-ogawa/fix-spatial-shader-conversion-with-texture
Fix spatial shader conversion with texture
Diffstat (limited to 'editor/plugins/material_editor_plugin.cpp')
-rw-r--r--editor/plugins/material_editor_plugin.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 420673329..bd4891ccb 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -450,8 +450,16 @@ Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_re
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+
+ // Texture parameter has to be treated specially since SpatialMaterial saved it
+ // as RID but ShaderMaterial needs Texture itself
+ Ref<Texture> texture = mat->get_texture_by_name(E->get().name);
+ if (texture.is_valid()) {
+ smat->set_shader_param(E->get().name, texture);
+ } else {
+ Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
+ smat->set_shader_param(E->get().name, value);
+ }
}
smat->set_render_priority(mat->get_render_priority());