summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-12-12 07:41:55 +0100
committerRémi Verschelde <rverschelde@gmail.com>2019-12-12 07:47:08 +0100
commit37d164e24e22633985a6555121a992abf1b130e0 (patch)
treed5b4002e4d968d9c50037be7b86b3c76556a611a
parent371de5132ce6315e0b60cc74ebd47c134c275361 (diff)
CharFXTransform: Drop unnecessary get_value_or()
See https://github.com/godotengine/godot/pull/23658#issuecomment-562706669 The method was implemented back when Dictionary.get(key, default) did not exist, but now that it does we do not need a custom method in CharFXTransform. It's a new feature in 3.2, so does not break compat with 3.1.x.
-rw-r--r--doc/classes/CharFXTransform.xml11
-rw-r--r--doc/classes/ProjectSettings.xml2
-rw-r--r--scene/gui/rich_text_effect.cpp13
-rw-r--r--scene/gui/rich_text_effect.h2
4 files changed, 1 insertions, 27 deletions
diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml
index 399530bb5d..ef9a366c86 100644
--- a/doc/classes/CharFXTransform.xml
+++ b/doc/classes/CharFXTransform.xml
@@ -11,17 +11,6 @@
<link>https://github.com/Eoin-ONeill-Yokai/Godot-Rich-Text-Effect-Test-Project</link>
</tutorials>
<methods>
- <method name="get_value_or">
- <return type="Variant">
- </return>
- <argument index="0" name="key" type="String">
- </argument>
- <argument index="1" name="default_value" type="Variant">
- </argument>
- <description>
- Returns the value for [code]key[/code] in the [member env] [Dictionary], or [code]default_value[/code] if [code]key[/code] isn't defined in [member env]. If the value's type doesn't match [code]default_value[/code]'s type, this method will return [code]default_value[/code].
- </description>
- </method>
</methods>
<members>
<member name="absolute_index" type="int" setter="set_absolute_index" getter="get_absolute_index" default="0">
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 1d00bb5712..57940a2507 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -348,7 +348,7 @@
<member name="debug/gdscript/warnings/unused_argument" type="bool" setter="" getter="" default="true">
If [code]true[/code], enables warnings when a function parameter is unused.
</member>
- <member name="debug/gdscript/warnings/unused_class_variable" type="bool" setter="" getter="" default="true">
+ <member name="debug/gdscript/warnings/unused_class_variable" type="bool" setter="" getter="" default="false">
If [code]true[/code], enables warnings when a member variable is unused.
</member>
<member name="debug/gdscript/warnings/unused_signal" type="bool" setter="" getter="" default="true">
diff --git a/scene/gui/rich_text_effect.cpp b/scene/gui/rich_text_effect.cpp
index f9e0be5b31..ab2f8d2172 100644
--- a/scene/gui/rich_text_effect.cpp
+++ b/scene/gui/rich_text_effect.cpp
@@ -89,8 +89,6 @@ void CharFXTransform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_character"), &CharFXTransform::get_character);
ClassDB::bind_method(D_METHOD("set_character", "character"), &CharFXTransform::set_character);
- ClassDB::bind_method(D_METHOD("get_value_or", "key", "default_value"), &CharFXTransform::get_value_or);
-
ADD_PROPERTY(PropertyInfo(Variant::INT, "relative_index"), "set_relative_index", "get_relative_index");
ADD_PROPERTY(PropertyInfo(Variant::INT, "absolute_index"), "set_absolute_index", "get_absolute_index");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "elapsed_time"), "set_elapsed_time", "get_elapsed_time");
@@ -101,17 +99,6 @@ void CharFXTransform::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "character"), "set_character", "get_character");
}
-Variant CharFXTransform::get_value_or(String p_key, Variant p_default_value) {
- if (!this->environment.has(p_key))
- return p_default_value;
-
- Variant r = environment[p_key];
- if (r.get_type() != p_default_value.get_type())
- return p_default_value;
-
- return r;
-}
-
CharFXTransform::CharFXTransform() {
relative_index = 0;
absolute_index = 0;
diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h
index 4330cebfe6..9e0065b199 100644
--- a/scene/gui/rich_text_effect.h
+++ b/scene/gui/rich_text_effect.h
@@ -82,8 +82,6 @@ public:
void set_character(int p_char) { character = (CharType)p_char; }
Dictionary get_environment() { return environment; }
void set_environment(Dictionary p_environment) { environment = p_environment; }
-
- Variant get_value_or(String p_key, Variant p_default_value);
};
#endif // RICH_TEXT_EFFECT_H