summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/navigation_polygon.cpp8
-rw-r--r--scene/2d/node_2d.cpp7
-rw-r--r--scene/2d/node_2d.h2
-rw-r--r--scene/2d/tile_map.cpp4
4 files changed, 11 insertions, 10 deletions
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 792f079ab0..4c00d8cec9 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -273,7 +273,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
if (navpoly.is_valid()) {
- nav_id = navigation->navpoly_create(navpoly,get_relative_transform(navigation),this);
+ nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this);
}
}
@@ -309,7 +309,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
if (enabled && navpoly.is_valid()) {
- nav_id = navigation->navpoly_create(navpoly,get_relative_transform(navigation),this);
+ nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this);
}
break;
}
@@ -321,7 +321,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
case NOTIFICATION_TRANSFORM_CHANGED: {
if (navigation && nav_id!=-1) {
- navigation->navpoly_set_transform(nav_id,get_relative_transform(navigation));
+ navigation->navpoly_set_transform(nav_id,get_relative_transform_to_parent(navigation));
}
} break;
@@ -409,7 +409,7 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg
}
if (navigation && navpoly.is_valid() && enabled) {
- nav_id = navigation->navpoly_create(navpoly,get_relative_transform(navigation),this);
+ nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this);
}
//update_gizmo();
_change_notify("navpoly");
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 975827bc7e..0683d31fc6 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -333,17 +333,18 @@ int Node2D::get_z() const{
return z;
}
-Matrix32 Node2D::get_relative_transform(const Node *p_parent) const {
+Matrix32 Node2D::get_relative_transform_to_parent(const Node *p_parent) const {
if (p_parent==this)
return Matrix32();
Node2D *parent_2d = get_parent()->cast_to<Node2D>();
+
ERR_FAIL_COND_V(!parent_2d,Matrix32());
if (p_parent==parent_2d)
return get_transform();
else
- return parent_2d->get_relative_transform(p_parent) * get_transform();
+ return parent_2d->get_relative_transform_to_parent(p_parent) * get_transform();
}
@@ -396,7 +397,7 @@ void Node2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("edit_set_pivot","pivot"),&Node2D::edit_set_pivot);
- ObjectTypeDB::bind_method(_MD("get_relative_transform","parent"),&Node2D::get_relative_transform);
+ ObjectTypeDB::bind_method(_MD("get_relative_transform_to_parent","parent"),&Node2D::get_relative_transform_to_parent);
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos"));
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd"));
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index 8efce33cda..a964a6ae34 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -99,7 +99,7 @@ public:
void set_z_as_relative(bool p_enabled);
bool is_z_relative() const;
- Matrix32 get_relative_transform(const Node *p_parent) const;
+ Matrix32 get_relative_transform_to_parent(const Node *p_parent) const;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 1d48a9c8a0..679ff719c5 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -118,7 +118,7 @@ void TileMap::_update_quadrant_transform() {
Matrix32 nav_rel;
if (navigation)
- nav_rel = get_relative_transform(navigation);
+ nav_rel = get_relative_transform_to_parent(navigation);
for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) {
@@ -261,7 +261,7 @@ void TileMap::_update_dirty_quadrants() {
Vector2 tcenter = cell_size/2;
Matrix32 nav_rel;
if (navigation)
- nav_rel = get_relative_transform(navigation);
+ nav_rel = get_relative_transform_to_parent(navigation);
Vector2 qofs;