Update NavPoly in the editor canvas when the resource is changed via the Inspector
This commit is contained in:
parent
ce3f3a9f82
commit
f69dbc0953
1 changed files with 5 additions and 5 deletions
|
@ -349,8 +349,6 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
|
||||||
|
|
||||||
if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())
|
if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())
|
||||||
update();
|
update();
|
||||||
|
|
||||||
//update_gizmo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NavigationPolygonInstance::is_enabled() const {
|
bool NavigationPolygonInstance::is_enabled() const {
|
||||||
|
@ -461,26 +459,28 @@ void NavigationPolygonInstance::_notification(int p_what) {
|
||||||
|
|
||||||
void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) {
|
void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) {
|
||||||
|
|
||||||
if (p_navpoly == navpoly)
|
if (p_navpoly == navpoly) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (navigation && nav_id != -1) {
|
if (navigation && nav_id != -1) {
|
||||||
navigation->navpoly_remove(nav_id);
|
navigation->navpoly_remove(nav_id);
|
||||||
nav_id = -1;
|
nav_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navpoly.is_valid()) {
|
if (navpoly.is_valid()) {
|
||||||
navpoly->disconnect(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed");
|
navpoly->disconnect(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed");
|
||||||
}
|
}
|
||||||
navpoly = p_navpoly;
|
navpoly = p_navpoly;
|
||||||
|
|
||||||
if (navpoly.is_valid()) {
|
if (navpoly.is_valid()) {
|
||||||
navpoly->connect(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed");
|
navpoly->connect(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed");
|
||||||
}
|
}
|
||||||
|
_navpoly_changed();
|
||||||
|
|
||||||
if (navigation && navpoly.is_valid() && enabled) {
|
if (navigation && navpoly.is_valid() && enabled) {
|
||||||
nav_id = navigation->navpoly_add(navpoly, get_relative_transform_to_parent(navigation), this);
|
nav_id = navigation->navpoly_add(navpoly, get_relative_transform_to_parent(navigation), this);
|
||||||
}
|
}
|
||||||
//update_gizmo();
|
|
||||||
_change_notify("navpoly");
|
_change_notify("navpoly");
|
||||||
update_configuration_warning();
|
update_configuration_warning();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue