@@ -69,7 +69,7 @@ void Polygon2DEditor::_set_node(Node *p_polygon) {
6969 if (node) {
7070 canvas->set_texture_filter (node->get_texture_filter_in_tree ());
7171
72- _update_bone_list ();
72+ _update_bone_list (node );
7373 _update_available_modes ();
7474 if (current_mode == MODE_MAX) {
7575 _select_mode (MODE_POINTS); // Initialize when opening the first time.
@@ -200,12 +200,17 @@ void Polygon2DEditor::_sync_bones() {
200200 undo_redo->create_action (TTR (" Sync Bones" ));
201201 undo_redo->add_do_method (node, " _set_bones" , new_bones);
202202 undo_redo->add_undo_method (node, " _set_bones" , prev_bones);
203- undo_redo->add_do_method (this , " _update_bone_list" );
204- undo_redo->add_undo_method (this , " _update_bone_list" );
203+ undo_redo->add_do_method (this , " _update_bone_list" , node );
204+ undo_redo->add_undo_method (this , " _update_bone_list" , node );
205205 undo_redo->commit_action ();
206206}
207207
208- void Polygon2DEditor::_update_bone_list () {
208+ void Polygon2DEditor::_update_bone_list (const Polygon2D *p_for_node) {
209+ ERR_FAIL_NULL (p_for_node);
210+ if (p_for_node != node) {
211+ return ;
212+ }
213+
209214 NodePath selected;
210215 while (bone_scroll_vb->get_child_count ()) {
211216 CheckBox *cb = Object::cast_to<CheckBox>(bone_scroll_vb->get_child (0 ));
@@ -297,7 +302,7 @@ void Polygon2DEditor::_select_mode(int p_mode) {
297302 bone_paint_strength->show ();
298303 bone_paint_radius->show ();
299304 bone_paint_radius_label->show ();
300- _update_bone_list ();
305+ _update_bone_list (node );
301306 bone_paint_pos = Vector2 (-100000 , -100000 ); // Send brush away when switching.
302307 } break ;
303308 default :
@@ -1260,7 +1265,7 @@ void Polygon2DEditor::_canvas_draw() {
12601265}
12611266
12621267void Polygon2DEditor::_bind_methods () {
1263- ClassDB::bind_method (D_METHOD (" _update_bone_list" ), &Polygon2DEditor::_update_bone_list);
1268+ ClassDB::bind_method (D_METHOD (" _update_bone_list" , " for_node " ), &Polygon2DEditor::_update_bone_list);
12641269 ClassDB::bind_method (D_METHOD (" _update_polygon_editing_state" ), &Polygon2DEditor::_update_polygon_editing_state);
12651270}
12661271
0 commit comments