summaryrefslogtreecommitdiff
path: root/scene/resources/scene_replication_config.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-23 16:10:06 +0200
committerGitHub <noreply@github.com>2022-05-23 16:10:06 +0200
commit1e699a92f0ec7f3396d2f1dcede23590bfe5fd6d (patch)
tree13830fb3bf3463c703e9eedb56574e5e16357ae4 /scene/resources/scene_replication_config.cpp
parent9b7db785ebafee5a0c185fea4ff73638bfd5bb57 (diff)
parent12474fd87ae5de819eee58d0d0bf0b9e2c521cfb (diff)
Merge pull request #61297 from reduz/improve-synchronizer-usability
Improve MultiplayerSynchronizer and MultiplayerSpawner editor usability
Diffstat (limited to 'scene/resources/scene_replication_config.cpp')
-rw-r--r--scene/resources/scene_replication_config.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/scene_replication_config.cpp b/scene/resources/scene_replication_config.cpp
index 2acc0f1922..4aea04bf87 100644
--- a/scene/resources/scene_replication_config.cpp
+++ b/scene/resources/scene_replication_config.cpp
@@ -124,6 +124,15 @@ void SceneReplicationConfig::remove_property(const NodePath &p_path) {
properties.erase(p_path);
}
+bool SceneReplicationConfig::has_property(const NodePath &p_path) const {
+ for (int i = 0; i < properties.size(); i++) {
+ if (properties[i].name == p_path) {
+ return true;
+ }
+ }
+ return false;
+}
+
int SceneReplicationConfig::property_get_index(const NodePath &p_path) const {
for (int i = 0; i < properties.size(); i++) {
if (properties[i].name == p_path) {
@@ -178,6 +187,7 @@ void SceneReplicationConfig::property_set_sync(const NodePath &p_path, bool p_en
void SceneReplicationConfig::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_properties"), &SceneReplicationConfig::get_properties);
ClassDB::bind_method(D_METHOD("add_property", "path", "index"), &SceneReplicationConfig::add_property, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("has_property", "path"), &SceneReplicationConfig::has_property);
ClassDB::bind_method(D_METHOD("remove_property", "path"), &SceneReplicationConfig::remove_property);
ClassDB::bind_method(D_METHOD("property_get_index", "path"), &SceneReplicationConfig::property_get_index);
ClassDB::bind_method(D_METHOD("property_get_spawn", "path"), &SceneReplicationConfig::property_get_spawn);