diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-02-23 17:52:49 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2019-02-23 17:55:09 -0300 |
commit | fd68bb2596bff1990711862f90b4763553d2edac (patch) | |
tree | 24024f57e3b3697bd51316e97bccf323cf10a87b /scene | |
parent | 07fbc341951352c7d0b00bf4370dccb94449d37a (diff) |
-Treat scalar conversions when calling functions as error, closes #24261
-Make shader editor display errors if exist when just opening it
-Make ShaderMaterial not lose parameters if opened in error.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/material.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 190dc707c4..9a52e9a6bb 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -113,6 +113,9 @@ bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) { if (n.find("param/") == 0) { //backwards compatibility pr = n.substr(6, n.length()); } + if (n.find("shader_param/") == 0) { //backwards compatibility + pr = n.replace_first("shader_param/", ""); + } } if (pr) { VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value); @@ -128,6 +131,16 @@ bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const { if (shader.is_valid()) { StringName pr = shader->remap_param(p_name); + if (!pr) { + String n = p_name; + if (n.find("param/") == 0) { //backwards compatibility + pr = n.substr(6, n.length()); + } + if (n.find("shader_param/") == 0) { //backwards compatibility + pr = n.replace_first("shader_param/", ""); + } + } + if (pr) { r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr); return true; |