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.
This commit is contained in:
parent
371de5132c
commit
37d164e24e
4 changed files with 1 additions and 27 deletions
|
@ -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">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue