From 4dd1eee769018f1818692ec5d41a5f85d0ab61e6 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Sat, 22 Feb 2020 11:09:06 +0300 Subject: [PATCH] Enables passing out built-in parameter from parent function in shaders (cherry picked from commit 7a2c6a8c0e48f04e30dae753a3b3023f27ad3f39) --- servers/visual/shader_language.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index f5755aafb6b..809901d9924 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2167,6 +2167,14 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, OperatorNode *p valid = true; break; } + if (b->parent_function) { + for (int i = 0; i < b->parent_function->arguments.size(); i++) { + if (b->parent_function->arguments[i].name == var_name) { + valid = true; + break; + } + } + } b = b->parent_block; }