Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
This commit is contained in:
parent
b76dfde329
commit
6631f66c2a
236 changed files with 3694 additions and 3670 deletions
|
|
@ -235,7 +235,7 @@ void NavigationAgent2D::_avoidance_done(Vector3 p_new_velocity) {
|
|||
}
|
||||
velocity_submitted = false;
|
||||
|
||||
emit_signal("velocity_computed", velocity);
|
||||
emit_signal(SNAME("velocity_computed"), velocity);
|
||||
}
|
||||
|
||||
TypedArray<String> NavigationAgent2D::get_configuration_warnings() const {
|
||||
|
|
@ -287,7 +287,7 @@ void NavigationAgent2D::update_navigation() {
|
|||
navigation_path = NavigationServer2D::get_singleton()->map_get_path(agent_parent->get_world_2d()->get_navigation_map(), o, target_location, true, navigable_layers);
|
||||
navigation_finished = false;
|
||||
nav_path_index = 0;
|
||||
emit_signal("path_changed");
|
||||
emit_signal(SNAME("path_changed"));
|
||||
}
|
||||
|
||||
if (navigation_path.size() == 0) {
|
||||
|
|
@ -303,7 +303,7 @@ void NavigationAgent2D::update_navigation() {
|
|||
_check_distance_to_target();
|
||||
nav_path_index -= 1;
|
||||
navigation_finished = true;
|
||||
emit_signal("navigation_finished");
|
||||
emit_signal(SNAME("navigation_finished"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ void NavigationAgent2D::update_navigation() {
|
|||
void NavigationAgent2D::_check_distance_to_target() {
|
||||
if (!target_reached) {
|
||||
if (distance_to_target() < target_desired_distance) {
|
||||
emit_signal("target_reached");
|
||||
emit_signal(SNAME("target_reached"));
|
||||
target_reached = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue