diff options
author | Hiroshi Ogawa <hi.ogawa.zz@gmail.com> | 2017-10-16 18:14:39 +0900 |
---|---|---|
committer | Hiroshi Ogawa <hi.ogawa.zz@gmail.com> | 2017-10-19 16:10:24 +0900 |
commit | 3bd2a4c42169eb141a71fb30e4786d4339e3789a (patch) | |
tree | 59aec107171bcccbf6f2b866497110ace53b3cb0 /editor/plugins/material_editor_plugin.cpp | |
parent | f52ab8d86418a67ddee247ed7765e72935b0c57f (diff) |
Fix spatial shader conversion with texture
Diffstat (limited to 'editor/plugins/material_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 6b613c1bcc..043a0f3199 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -449,8 +449,16 @@ Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_re VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); 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()); |