Skip to content

Commit

Permalink
GH-444 Add compatibility for Godot 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jul 10, 2024
1 parent a4f079b commit e38942d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/script/node_pin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ Ref<OScriptNodePin> OScriptNodePin::create(OScriptNode* p_owning_node, const Pro
pin->_owning_node = p_owning_node;
pin->_property = p_property;

#if GODOT_VERSION < 0x040300
if (pin->_property.usage == 7)
pin->_property.usage = PROPERTY_USAGE_DEFAULT;
#endif

if (PropertyUtils::is_enum(p_property))
{
pin->_flags.set_flag(ENUM);
Expand Down Expand Up @@ -135,6 +140,11 @@ bool OScriptNodePin::_load(const Dictionary& p_data)
if (p_data.has("usage"))
_property.usage = p_data["usage"];

#if GODOT_VERSION < 0x040300
if (_property.usage == 7)
_property.usage = PROPERTY_USAGE_DEFAULT;
#endif

return true;
}

Expand Down Expand Up @@ -177,6 +187,11 @@ Dictionary OScriptNodePin::_save()
if (!_property.hint_string.is_empty())
data["hint_string"] = _property.hint_string;

#if GODOT_VERSION < 0x040300
if (_property.usage == 7)
_property.usage = PROPERTY_USAGE_DEFAULT;
#endif

if (_property.usage != PROPERTY_USAGE_DEFAULT)
data["usage"] = _property.usage;

Expand Down

0 comments on commit e38942d

Please sign in to comment.