diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-30 14:58:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-30 14:58:33 +0200 |
commit | 9dc9434b1bcde48259fa68066a7a3e2cff5d5eab (patch) | |
tree | 10e597c0df84b6eb358e56a408800440535b12ce /scene/resources/material.cpp | |
parent | c991379b81e660e6c9d28620d61b87e9c0cb5233 (diff) | |
parent | ca1935d6f776a789dda9e046e5624ba0715e2671 (diff) |
Merge pull request #24437 from mateusfccp/single_quotes_option
Add settings for single-quotes on completion
Diffstat (limited to 'scene/resources/material.cpp')
-rw-r--r-- | scene/resources/material.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 536eb11a27..766c7bbd9f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -30,6 +30,10 @@ #include "material.h" +#ifdef TOOLS_ENABLED +#include "editor/editor_settings.h" +#endif + #include "scene/scene_string_names.h" void Material::set_next_pass(const Ref<Material> &p_pass) { @@ -236,6 +240,12 @@ void ShaderMaterial::_bind_methods() { void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { +#ifdef TOOLS_ENABLED + const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\""; +#else + const String quote_style = "\""; +#endif + String f = p_function.operator String(); if ((f == "get_shader_param" || f == "set_shader_param") && p_idx == 0) { @@ -243,7 +253,7 @@ void ShaderMaterial::get_argument_options(const StringName &p_function, int p_id List<PropertyInfo> pl; shader->get_param_list(&pl); for (List<PropertyInfo>::Element *E = pl.front(); E; E = E->next()) { - r_options->push_back("\"" + E->get().name.replace_first("shader_param/", "") + "\""); + r_options->push_back(quote_style + E->get().name.replace_first("shader_param/", "") + quote_style); } } } |