summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-03 17:27:36 +0100
committerGitHub <noreply@github.com>2021-11-03 17:27:36 +0100
commit25bea735449d4e762e3c5f6b960d5f5b9cf79ac1 (patch)
tree5850097d1c902ca28daf5bbf2c5cbccb132aedd1 /scene/2d
parentbbee1939579bc5f359af149068cb1e3385038d55 (diff)
parent8d9619ad4699f32c246cdcbefa3760c70ffaaba6 (diff)
Merge pull request #54527 from nekomatata/fix-polygon-bone-path-errors
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/polygon_2d.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 7366be5a7d..510746c53f 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -554,7 +554,9 @@ void Polygon2D::set_bone_path(int p_index, const NodePath &p_path) {
Array Polygon2D::_get_bones() const {
Array bones;
for (int i = 0; i < get_bone_count(); i++) {
- bones.push_back(get_bone_path(i));
+ // Convert path property to String to avoid errors due to invalid node path in editor,
+ // because it's relative to the Skeleton2D node and not Polygon2D.
+ bones.push_back(String(get_bone_path(i)));
bones.push_back(get_bone_weights(i));
}
return bones;
@@ -564,7 +566,8 @@ void Polygon2D::_set_bones(const Array &p_bones) {
ERR_FAIL_COND(p_bones.size() & 1);
clear_bones();
for (int i = 0; i < p_bones.size(); i += 2) {
- add_bone(p_bones[i], p_bones[i + 1]);
+ // Convert back from String to NodePath.
+ add_bone(NodePath(p_bones[i]), p_bones[i + 1]);
}
}