@@ -119,6 +119,18 @@ void AnimationNodeBlendTreeEditor::update_graph() {
119119	if  (updating || blend_tree.is_null ()) {
120120		return ;
121121	}
122+ 	if  (graph_update_queued) {
123+ 		return ;
124+ 	}
125+ 	graph_update_queued = true ;
126+ 	//  Defer to idle time, so multiple requests can be merged.
127+ 	callable_mp (this , &AnimationNodeBlendTreeEditor::update_graph_immediately).call_deferred ();
128+ }
129+ 
130+ void  AnimationNodeBlendTreeEditor::update_graph_immediately () {
131+ 	if  (updating || blend_tree.is_null ()) {
132+ 		return ;
133+ 	}
122134
123135	AnimationTree *tree = AnimationTreeEditor::get_singleton ()->get_animation_tree ();
124136	if  (!tree) {
@@ -174,8 +186,8 @@ void AnimationNodeBlendTreeEditor::update_graph() {
174186			name->set_custom_minimum_size (Vector2 (100 , 0 ) * EDSCALE);
175187			node->add_child (name);
176188			node->set_slot (0 , false , 0 , Color (), true , read_only ? -1  : 0 , get_theme_color (SceneStringName (font_color), SNAME (" Label"  )));
177- 			name->connect (SceneStringName (text_submitted), callable_mp (this , &AnimationNodeBlendTreeEditor::_node_renamed).bind (agnode), CONNECT_DEFERRED);
178- 			name->connect (SceneStringName (focus_exited), callable_mp (this , &AnimationNodeBlendTreeEditor::_node_renamed_focus_out).bind (agnode), CONNECT_DEFERRED);
189+ 			name->connect (SceneStringName (text_submitted), callable_mp (this , &AnimationNodeBlendTreeEditor::_node_renamed).bind (agnode, E ), CONNECT_DEFERRED);
190+ 			name->connect (SceneStringName (focus_exited), callable_mp (this , &AnimationNodeBlendTreeEditor::_node_renamed_focus_out).bind (agnode, E ), CONNECT_DEFERRED);
179191			name->connect (SceneStringName (text_changed), callable_mp (this , &AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed), CONNECT_DEFERRED);
180192			base = 1 ;
181193			agnode->set_deletable (true );
@@ -198,7 +210,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
198210			node->set_slot (base + i, true , read_only ? -1  : 0 , get_theme_color (SceneStringName (font_color), SNAME (" Label"  )), false , 0 , Color ());
199211		}
200212
201- 		List <PropertyInfo> pinfo;
213+ 		LocalVector <PropertyInfo> pinfo;
202214		agnode->get_parameter_list (&pinfo);
203215		for  (const  PropertyInfo &F : pinfo) {
204216			if  (!(F.usage  & PROPERTY_USAGE_EDITOR)) {
@@ -218,7 +230,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
218230				}
219231				prop->set_name_split_ratio (ratio);
220232				prop->update_property ();
221- 				prop->connect (" property_changed"  , callable_mp (this , &AnimationNodeBlendTreeEditor::_property_changed));
233+ 				prop->connect (SNAME ( " property_changed" ) , callable_mp (this , &AnimationNodeBlendTreeEditor::_property_changed));
222234
223235				if  (F.hint  == PROPERTY_HINT_RESOURCE_TYPE) {
224236					//  Give the resource editor some more space to make the inside readable.
@@ -232,7 +244,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
232244			}
233245		}
234246
235- 		node->connect (" dragged"  , callable_mp (this , &AnimationNodeBlendTreeEditor::_node_dragged).bind (E));
247+ 		node->connect (SNAME ( " dragged" ) , callable_mp (this , &AnimationNodeBlendTreeEditor::_node_dragged).bind (E));
236248
237249		if  (AnimationTreeEditor::get_singleton ()->can_edit (agnode)) {
238250			node->add_child (memnew (HSeparator));
@@ -272,7 +284,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
272284
273285			ProgressBar *pb = memnew (ProgressBar);
274286
275- 			List <StringName> anims;
287+ 			LocalVector <StringName> anims;
276288			tree->get_animation_list (&anims);
277289
278290			for  (const  StringName &F : anims) {
@@ -285,25 +297,25 @@ void AnimationNodeBlendTreeEditor::update_graph() {
285297			animations[E] = pb;
286298			node->add_child (pb);
287299
288- 			mb->get_popup ()->connect (" index_pressed"  , callable_mp (this , &AnimationNodeBlendTreeEditor::_anim_selected).bind (options, E), CONNECT_DEFERRED);
300+ 			mb->get_popup ()->connect (SNAME ( " index_pressed" ) , callable_mp (this , &AnimationNodeBlendTreeEditor::_anim_selected).bind (options, E), CONNECT_DEFERRED);
289301		}
290302
291- 		Ref<StyleBox> sb_panel = node->get_theme_stylebox (SceneStringName (panel), " GraphNode"  )->duplicate ();
303+ 		Ref<StyleBox> sb_panel = node->get_theme_stylebox (SceneStringName (panel), SNAME ( " GraphNode" ) )->duplicate ();
292304		if  (sb_panel.is_valid ()) {
293305			sb_panel->set_content_margin (SIDE_TOP, 12  * EDSCALE);
294306			sb_panel->set_content_margin (SIDE_BOTTOM, 12  * EDSCALE);
295307			node->add_theme_style_override (SceneStringName (panel), sb_panel);
296308		}
297309
298- 		node->add_theme_constant_override (" separation"  , 4  * EDSCALE);
310+ 		node->add_theme_constant_override (SNAME ( " separation" ) , 4  * EDSCALE);
299311	}
300312
301313	List<AnimationNodeBlendTree::NodeConnection> node_connections;
302314	blend_tree->get_node_connections (&node_connections);
303315
304316	for  (const  AnimationNodeBlendTree::NodeConnection &E : node_connections) {
305- 		StringName from = E.output_node ;
306- 		StringName to = E.input_node ;
317+ 		const   StringName & from = E.output_node ;
318+ 		const   StringName & to = E.input_node ;
307319		int  to_idx = E.input_index ;
308320
309321		graph->connect_node (from, 0 , to, to_idx);
@@ -324,6 +336,8 @@ void AnimationNodeBlendTreeEditor::update_graph() {
324336			}
325337		}
326338	}
339+ 
340+ 	graph_update_queued = false ;
327341}
328342
329343void  AnimationNodeBlendTreeEditor::_file_opened (const  String &p_file) {
@@ -795,16 +809,16 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
795809
796810	updating = true ;
797811
798- 	HashSet<String > paths;
799- 	HashMap<String , RBSet<String>> types;
812+ 	HashSet<NodePath > paths;
813+ 	HashMap<NodePath , RBSet<String>> types;
800814	{
801- 		List <StringName> animation_list;
815+ 		LocalVector <StringName> animation_list;
802816		tree->get_animation_list (&animation_list);
803817
804818		for  (const  StringName &E : animation_list) {
805819			Ref<Animation> anim = tree->get_animation (E);
806820			for  (int  i = 0 ; i < anim->get_track_count (); i++) {
807- 				String  track_path = String ( anim->track_get_path (i) );
821+ 				NodePath  track_path = anim->track_get_path (i);
808822				paths.insert (track_path);
809823
810824				String track_type_name;
@@ -835,8 +849,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
835849
836850	HashMap<String, TreeItem *> parenthood;
837851
838- 	for  (const  String &E : paths) {
839- 		NodePath path = E;
852+ 	for  (const  NodePath &path : paths) {
840853		TreeItem *ti = nullptr ;
841854		String accum;
842855		for  (int  i = 0 ; i < path.get_name_count (); i++) {
@@ -856,8 +869,8 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
856869				ti->set_selectable (0 , false );
857870				ti->set_editable (0 , false );
858871
859- 				if  ( base->has_node (accum)) { 
860- 					Node *node = base-> get_node (accum); 
872+ 				Node *node =  base->get_node_or_null (accum); 
873+ 				if  (node) { 
861874					ti->set_icon (0 , EditorNode::get_singleton ()->get_object_icon (node));
862875				}
863876
@@ -866,10 +879,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
866879			}
867880		}
868881
869- 		Node *node = nullptr ;
870- 		if  (base->has_node (accum)) {
871- 			node = base->get_node (accum);
872- 		}
882+ 		Node *node = base->get_node_or_null (accum);
873883		if  (!node) {
874884			continue ; // no node, can't edit
875885		}
@@ -1007,6 +1017,10 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
10071017				return ; //  Node has been changed.
10081018			}
10091019
1020+ 			if  (graph_update_queued) {
1021+ 				return ;
1022+ 			}
1023+ 
10101024			String error;
10111025
10121026			error = tree->get_editor_error_message ();
@@ -1094,7 +1108,7 @@ void AnimationNodeBlendTreeEditor::_node_changed(const StringName &p_node_name)
10941108	update_graph ();
10951109}
10961110
1097- void  AnimationNodeBlendTreeEditor::_node_renamed (const  String &p_text, Ref<AnimationNode> p_node) {
1111+ void  AnimationNodeBlendTreeEditor::_node_renamed (const  String &p_text, Ref<AnimationNode> p_node,  const  StringName p_name ) {
10981112	if  (blend_tree.is_null ()) {
10991113		return ;
11001114	}
@@ -1104,7 +1118,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
11041118		return ;
11051119	}
11061120
1107- 	String prev_name = blend_tree-> get_node_name (p_node) ;
1121+ 	String prev_name = p_name ;
11081122	ERR_FAIL_COND (prev_name.is_empty ());
11091123	GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node (prev_name));
11101124	ERR_FAIL_NULL (gn);
@@ -1175,11 +1189,11 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
11751189	current_node_rename_text = String ();
11761190}
11771191
1178- void  AnimationNodeBlendTreeEditor::_node_renamed_focus_out (Ref<AnimationNode> p_node) {
1192+ void  AnimationNodeBlendTreeEditor::_node_renamed_focus_out (Ref<AnimationNode> p_node,  const  StringName p_name ) {
11791193	if  (current_node_rename_text.is_empty ()) {
11801194		return ; //  The text_submitted signal triggered the graph update and freed the LineEdit.
11811195	}
1182- 	_node_renamed (current_node_rename_text, p_node);
1196+ 	_node_renamed (current_node_rename_text, p_node, p_name );
11831197}
11841198
11851199void  AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed (const  String &p_text) {
0 commit comments