From 0e66587dbf0210948e270b9e2fea7b0b6fabc499 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Mon, 24 Jan 2022 10:01:24 +0300 Subject: [PATCH] Remove incorrect items from completion of main functions in shader --- servers/rendering/shader_language.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index cb1329d33c2..f16f66544a5 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -9060,6 +9060,19 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_ } break; case COMPLETION_MAIN_FUNCTION: { for (const KeyValue &E : p_info.functions) { + if (!E.value.main_function) { + continue; + } + bool found = false; + for (int i = 0; i < shader->functions.size(); i++) { + if (shader->functions[i].name == E.key) { + found = true; + break; + } + } + if (found) { + continue; + } ScriptCodeCompletionOption option(E.key, ScriptCodeCompletionOption::KIND_FUNCTION); r_options->push_back(option); }