[MP] Fix replication config reload error

Override the `reset_state` method to properly handle reloading the
resource from disk.
This commit is contained in:
Fabio Alessandrelli 2024-03-03 11:13:00 +01:00
parent f2045ba822
commit 45e8fa10c1
2 changed files with 10 additions and 0 deletions

View file

@ -103,6 +103,14 @@ void SceneReplicationConfig::_get_property_list(List<PropertyInfo> *p_list) cons
} }
} }
void SceneReplicationConfig::reset_state() {
dirty = false;
properties.clear();
sync_props.clear();
spawn_props.clear();
watch_props.clear();
}
TypedArray<NodePath> SceneReplicationConfig::get_properties() const { TypedArray<NodePath> SceneReplicationConfig::get_properties() const {
TypedArray<NodePath> paths; TypedArray<NodePath> paths;
for (const ReplicationProperty &prop : properties) { for (const ReplicationProperty &prop : properties) {

View file

@ -79,6 +79,8 @@ protected:
void _get_property_list(List<PropertyInfo> *p_list) const; void _get_property_list(List<PropertyInfo> *p_list) const;
public: public:
virtual void reset_state() override; // Required since we use variable amount of properties.
TypedArray<NodePath> get_properties() const; TypedArray<NodePath> get_properties() const;
void add_property(const NodePath &p_path, int p_index = -1); void add_property(const NodePath &p_path, int p_index = -1);