From 0e29f7974b59e4440cf02e1388fb9d8ab2b5c5fd Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Wed, 25 Jul 2018 03:11:03 +0200 Subject: Reduce unnecessary COW on Vector by make writing explicit This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case. --- editor/plugins/abstract_polygon_2d_editor.cpp | 4 ++-- editor/plugins/animation_blend_space_2d_editor.cpp | 2 +- editor/plugins/animation_player_editor_plugin.cpp | 4 ++-- editor/plugins/animation_state_machine_editor.cpp | 4 ++-- editor/plugins/asset_library_editor_plugin.cpp | 2 +- editor/plugins/audio_stream_editor_plugin.cpp | 4 ++-- editor/plugins/canvas_item_editor_plugin.cpp | 2 +- editor/plugins/collision_polygon_editor_plugin.cpp | 2 +- .../plugins/collision_shape_2d_editor_plugin.cpp | 20 ++++++++++---------- editor/plugins/light_occluder_2d_editor_plugin.cpp | 2 +- editor/plugins/particles_2d_editor_plugin.cpp | 22 +++++++++++----------- editor/plugins/script_editor_plugin.cpp | 12 ++++++------ editor/plugins/skeleton_editor_plugin.cpp | 6 +++--- editor/plugins/spatial_editor_plugin.cpp | 18 +++++++++--------- editor/plugins/sprite_editor_plugin.cpp | 2 +- editor/plugins/tile_map_editor_plugin.cpp | 12 ++++++------ editor/plugins/visual_shader_editor_plugin.cpp | 2 +- 17 files changed, 60 insertions(+), 60 deletions(-) (limited to 'editor/plugins') diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 5052b69e24..2d341cdd93 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -345,7 +345,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) Vector vertices = _get_polygon(edited_point.polygon); ERR_FAIL_INDEX_V(edited_point.vertex, vertices.size(), false); - vertices[edited_point.vertex] = edited_point.pos - _get_offset(edited_point.polygon); + vertices.write[edited_point.vertex] = edited_point.pos - _get_offset(edited_point.polygon); undo_redo->create_action(TTR("Edit Poly")); _action_set_polygon(edited_point.polygon, pre_move_edit, vertices); @@ -445,7 +445,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref &p_event) Vector vertices = _get_polygon(edited_point.polygon); ERR_FAIL_INDEX_V(edited_point.vertex, vertices.size(), false); - vertices[edited_point.vertex] = cpoint - _get_offset(edited_point.polygon); + vertices.write[edited_point.vertex] = cpoint - _get_offset(edited_point.polygon); _set_polygon(edited_point.polygon, vertices); } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 8d17062248..27df60f87a 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -414,7 +414,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space()); point *= s; point.y = s.height - point.y; - points[j] = point; + points.write[j] = point; } for (int j = 0; j < 3; j++) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 23eeef9f20..9ab5436de8 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1333,7 +1333,7 @@ void AnimationPlayerEditor::_allocate_onion_layers() { bool is_present = onion.differences_only && i == captures - 1; // Each capture is a viewport with a canvas item attached that renders a full-size rect with the contents of the main viewport - onion.captures[i] = VS::get_singleton()->viewport_create(); + onion.captures.write[i] = VS::get_singleton()->viewport_create(); VS::get_singleton()->viewport_set_usage(onion.captures[i], VS::VIEWPORT_USAGE_2D); VS::get_singleton()->viewport_set_size(onion.captures[i], capture_size.width, capture_size.height); VS::get_singleton()->viewport_set_update_mode(onion.captures[i], VS::VIEWPORT_UPDATE_ALWAYS); @@ -1473,7 +1473,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { float pos = cpos + step_off * anim->get_step(); bool valid = anim->has_loop() || (pos >= 0 && pos <= anim->get_length()); - onion.captures_valid[cidx] = valid; + onion.captures_valid.write[cidx] = valid; if (valid) { player->seek(pos, true); get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 04bd5f0cec..ee450333c8 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -679,7 +679,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { Ref sb = name == selected_node ? style_selected : style; int strsize = font->get_string_size(name).width; - NodeRect &nr = node_rects[i]; + NodeRect &nr = node_rects.write[i]; Vector2 offset = nr.node.position; int h = nr.node.size.height; @@ -771,7 +771,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() { if (idx == -1) return; - NodeRect &nr = node_rects[idx]; + const NodeRect &nr = node_rects[idx]; Vector2 from; from.x = nr.play.position.x; diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 505dd4ab76..e98dfceb90 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -197,7 +197,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const for (int i = 0; i < preview_images.size(); i++) { if (preview_images[i].id == p_index) { - preview_images[i].image = p_image; + preview_images.write[i].image = p_image; if (preview_images[i].button->is_pressed()) { _preview_click(p_index); } diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index ddb03d0250..454a5d72f2 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -81,8 +81,8 @@ void AudioStreamEditor::_draw_preview() { float min = preview->get_min(ofs, ofs_n) * 0.5 + 0.5; int idx = i; - lines[idx * 2 + 0] = Vector2(i + 1, rect.position.y + min * rect.size.y); - lines[idx * 2 + 1] = Vector2(i + 1, rect.position.y + max * rect.size.y); + lines.write[idx * 2 + 0] = Vector2(i + 1, rect.position.y + min * rect.size.y); + lines.write[idx * 2 + 1] = Vector2(i + 1, rect.position.y + max * rect.size.y); } Vector color; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 1d20c63969..eed6b5a95c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -533,7 +533,7 @@ void CanvasItemEditor::_get_canvas_items_at_pos(const Point2 &p_pos, Vector<_Sel r_items.remove(i); i--; } else { - r_items[i].item = canvas_item; + r_items.write[i].item = canvas_item; } } } diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index e837359d0c..5109379add 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -276,7 +276,7 @@ bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Refcreate_action(TTR("Edit Poly")); undo_redo->add_do_method(node, "set_polygon", poly); undo_redo->add_undo_method(node, "set_polygon", pre_move_edit); diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index b003664dca..9e052bb027 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -446,8 +446,8 @@ void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) { float radius = shape->get_radius(); float height = shape->get_height() / 2; - handles[0] = Point2(radius, -height); - handles[1] = Point2(0, -(height + radius)); + handles.write[0] = Point2(radius, -height); + handles.write[1] = Point2(0, -(height + radius)); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); p_overlay->draw_texture(h, gt.xform(handles[1]) - size); @@ -458,7 +458,7 @@ void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) { Ref shape = node->get_shape(); handles.resize(1); - handles[0] = Point2(shape->get_radius(), 0); + handles.write[0] = Point2(shape->get_radius(), 0); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); @@ -476,8 +476,8 @@ void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) { Ref shape = node->get_shape(); handles.resize(2); - handles[0] = shape->get_normal() * shape->get_d(); - handles[1] = shape->get_normal() * (shape->get_d() + 30.0); + handles.write[0] = shape->get_normal() * shape->get_d(); + handles.write[1] = shape->get_normal() * (shape->get_d() + 30.0); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); p_overlay->draw_texture(h, gt.xform(handles[1]) - size); @@ -488,7 +488,7 @@ void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) { Ref shape = node->get_shape(); handles.resize(1); - handles[0] = Point2(0, shape->get_length()); + handles.write[0] = Point2(0, shape->get_length()); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); @@ -499,8 +499,8 @@ void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) { handles.resize(2); Vector2 ext = shape->get_extents(); - handles[0] = Point2(ext.x, 0); - handles[1] = Point2(0, -ext.y); + handles.write[0] = Point2(ext.x, 0); + handles.write[1] = Point2(0, -ext.y); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); p_overlay->draw_texture(h, gt.xform(handles[1]) - size); @@ -511,8 +511,8 @@ void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) { Ref shape = node->get_shape(); handles.resize(2); - handles[0] = shape->get_a(); - handles[1] = shape->get_b(); + handles.write[0] = shape->get_a(); + handles.write[1] = shape->get_b(); p_overlay->draw_texture(h, gt.xform(handles[0]) - size); p_overlay->draw_texture(h, gt.xform(handles[1]) - size); diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp index a3be10dc33..3351e5918f 100644 --- a/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -255,7 +255,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref &p_event) { //apply ERR_FAIL_INDEX_V(edited_point, poly.size(), false); - poly[edited_point] = edited_point_pos; + poly.write[edited_point] = edited_point_pos; undo_redo->create_action(TTR("Edit Poly")); undo_redo->add_do_method(node->get_occluder_polygon().ptr(), "set_polygon", poly); undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", pre_move_edit); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 6d11079759..c2b17189ef 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -165,12 +165,12 @@ void Particles2DEditorPlugin::_generate_emission_mask() { if (emode == EMISSION_MODE_SOLID) { if (capture_colors) { - valid_colors[vpc * 4 + 0] = r[(j * s.width + i) * 4 + 0]; - valid_colors[vpc * 4 + 1] = r[(j * s.width + i) * 4 + 1]; - valid_colors[vpc * 4 + 2] = r[(j * s.width + i) * 4 + 2]; - valid_colors[vpc * 4 + 3] = r[(j * s.width + i) * 4 + 3]; + valid_colors.write[vpc * 4 + 0] = r[(j * s.width + i) * 4 + 0]; + valid_colors.write[vpc * 4 + 1] = r[(j * s.width + i) * 4 + 1]; + valid_colors.write[vpc * 4 + 2] = r[(j * s.width + i) * 4 + 2]; + valid_colors.write[vpc * 4 + 3] = r[(j * s.width + i) * 4 + 3]; } - valid_positions[vpc++] = Point2(i, j); + valid_positions.write[vpc++] = Point2(i, j); } else { @@ -189,7 +189,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() { } if (on_border) { - valid_positions[vpc] = Point2(i, j); + valid_positions.write[vpc] = Point2(i, j); if (emode == EMISSION_MODE_BORDER_DIRECTED) { Vector2 normal; @@ -206,14 +206,14 @@ void Particles2DEditorPlugin::_generate_emission_mask() { } normal.normalize(); - valid_normals[vpc] = normal; + valid_normals.write[vpc] = normal; } if (capture_colors) { - valid_colors[vpc * 4 + 0] = r[(j * s.width + i) * 4 + 0]; - valid_colors[vpc * 4 + 1] = r[(j * s.width + i) * 4 + 1]; - valid_colors[vpc * 4 + 2] = r[(j * s.width + i) * 4 + 2]; - valid_colors[vpc * 4 + 3] = r[(j * s.width + i) * 4 + 3]; + valid_colors.write[vpc * 4 + 0] = r[(j * s.width + i) * 4 + 0]; + valid_colors.write[vpc * 4 + 1] = r[(j * s.width + i) * 4 + 1]; + valid_colors.write[vpc * 4 + 2] = r[(j * s.width + i) * 4 + 2]; + valid_colors.write[vpc * 4 + 3] = r[(j * s.width + i) * 4 + 3]; } vpc++; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 94d1b96b91..3f28cfd858 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -342,11 +342,11 @@ void ScriptEditor::_save_history() { if (Object::cast_to(n)) { - history[history_pos].state = Object::cast_to(n)->get_edit_state(); + history.write[history_pos].state = Object::cast_to(n)->get_edit_state(); } if (Object::cast_to(n)) { - history[history_pos].state = Object::cast_to(n)->get_scroll(); + history.write[history_pos].state = Object::cast_to(n)->get_scroll(); } } @@ -373,11 +373,11 @@ void ScriptEditor::_go_to_tab(int p_idx) { if (Object::cast_to(n)) { - history[history_pos].state = Object::cast_to(n)->get_edit_state(); + history.write[history_pos].state = Object::cast_to(n)->get_edit_state(); } if (Object::cast_to(n)) { - history[history_pos].state = Object::cast_to(n)->get_scroll(); + history.write[history_pos].state = Object::cast_to(n)->get_scroll(); } } @@ -2612,11 +2612,11 @@ void ScriptEditor::_update_history_pos(int p_new_pos) { if (Object::cast_to(n)) { - history[history_pos].state = Object::cast_to(n)->get_edit_state(); + history.write[history_pos].state = Object::cast_to(n)->get_edit_state(); } if (Object::cast_to(n)) { - history[history_pos].state = Object::cast_to(n)->get_scroll(); + history.write[history_pos].state = Object::cast_to(n)->get_scroll(); } history_pos = p_new_pos; diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index 40a696119e..fe7d1df50c 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -68,16 +68,16 @@ void SkeletonEditor::create_physical_skeleton() { if (parent < 0) { - bones_infos[bone_id].relative_rest = skeleton->get_bone_rest(bone_id); + bones_infos.write[bone_id].relative_rest = skeleton->get_bone_rest(bone_id); } else { - bones_infos[bone_id].relative_rest = bones_infos[parent].relative_rest * skeleton->get_bone_rest(bone_id); + bones_infos.write[bone_id].relative_rest = bones_infos[parent].relative_rest * skeleton->get_bone_rest(bone_id); /// create physical bone on parent if (!bones_infos[parent].physical_bone) { - bones_infos[parent].physical_bone = create_physical_bone(parent, bone_id, bones_infos); + bones_infos.write[parent].physical_bone = create_physical_bone(parent, bone_id, bones_infos); ur->create_action(TTR("Create physical bones")); ur->add_do_method(skeleton, "add_child", bones_infos[parent].physical_bone); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index f0c874a150..4ac6636bc8 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -5009,7 +5009,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_SELECT]->set_flat(true); tool_button[TOOL_MODE_SELECT]->set_pressed(true); - button_binds[0] = MENU_TOOL_SELECT; + button_binds.write[0] = MENU_TOOL_SELECT; tool_button[TOOL_MODE_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_SELECT]->set_tooltip(TTR("Select Mode (Q)") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection")); @@ -5017,7 +5017,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]); tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true); tool_button[TOOL_MODE_MOVE]->set_flat(true); - button_binds[0] = MENU_TOOL_MOVE; + button_binds.write[0] = MENU_TOOL_MOVE; tool_button[TOOL_MODE_MOVE]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_MOVE]->set_tooltip(TTR("Move Mode (W)")); @@ -5025,7 +5025,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(tool_button[TOOL_MODE_ROTATE]); tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true); tool_button[TOOL_MODE_ROTATE]->set_flat(true); - button_binds[0] = MENU_TOOL_ROTATE; + button_binds.write[0] = MENU_TOOL_ROTATE; tool_button[TOOL_MODE_ROTATE]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_ROTATE]->set_tooltip(TTR("Rotate Mode (E)")); @@ -5033,7 +5033,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(tool_button[TOOL_MODE_SCALE]); tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true); tool_button[TOOL_MODE_SCALE]->set_flat(true); - button_binds[0] = MENU_TOOL_SCALE; + button_binds.write[0] = MENU_TOOL_SCALE; tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_SCALE]->set_tooltip(TTR("Scale Mode (R)")); @@ -5041,19 +5041,19 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(tool_button[TOOL_MODE_LIST_SELECT]); tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true); - button_binds[0] = MENU_TOOL_LIST_SELECT; + button_binds.write[0] = MENU_TOOL_LIST_SELECT; tool_button[TOOL_MODE_LIST_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); tool_button[TOOL_LOCK_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_LOCK_SELECTED]); - button_binds[0] = MENU_LOCK_SELECTED; + button_binds.write[0] = MENU_LOCK_SELECTED; tool_button[TOOL_LOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]); - button_binds[0] = MENU_UNLOCK_SELECTED; + button_binds.write[0] = MENU_UNLOCK_SELECTED; tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved).")); @@ -5064,7 +5064,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true); - button_binds[0] = MENU_TOOL_LOCAL_COORDS; + button_binds.write[0] = MENU_TOOL_LOCAL_COORDS; tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", this, "_menu_item_toggled", button_binds); ED_SHORTCUT("spatial_editor/local_coords", TTR("Local Coords"), KEY_T); sct = ED_GET_SHORTCUT("spatial_editor/local_coords").ptr()->get_as_text(); @@ -5074,7 +5074,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { hbc_menu->add_child(tool_option_button[TOOL_OPT_USE_SNAP]); tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true); tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true); - button_binds[0] = MENU_TOOL_USE_SNAP; + button_binds.write[0] = MENU_TOOL_USE_SNAP; tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", this, "_menu_item_toggled", button_binds); ED_SHORTCUT("spatial_editor/snap", TTR("Snap"), KEY_Y); sct = ED_GET_SHORTCUT("spatial_editor/snap").ptr()->get_as_text(); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 66673cca00..9bf1178b58 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -169,7 +169,7 @@ void SpriteEditor::_update_mesh_data() { Size2 img_size = Vector2(image->get_width(), image->get_height()); for (int j = 0; j < lines.size(); j++) { - lines[j] = expand(lines[j], rect, epsilon); + lines.write[j] = expand(lines[j], rect, epsilon); int index_ofs = computed_vertices.size(); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 484da3b4f3..435ef229c5 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -196,7 +196,7 @@ Vector TileMapEditor::get_selected_tiles() const { } for (int i = items.size() - 1; i >= 0; i--) { - items[i] = palette->get_item_metadata(items[i]); + items.write[i] = palette->get_item_metadata(items[i]); } return items; } @@ -983,7 +983,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { ids.push_back(0); for (List::Element *E = copydata.front(); E; E = E->next()) { - ids[0] = E->get().cell; + ids.write[0] = E->get().cell; _set_cell(E->get().pos + ofs, ids, E->get().flip_h, E->get().flip_v, E->get().transpose); } _finish_undo(); @@ -1006,7 +1006,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { } for (List::Element *E = copydata.front(); E; E = E->next()) { - ids[0] = E->get().cell; + ids.write[0] = E->get().cell; _set_cell(E->get().pos + ofs, ids, E->get().flip_h, E->get().flip_v, E->get().transpose); } _finish_undo(); @@ -1228,7 +1228,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { for (Map::Element *E = paint_undo.front(); E; E = E->next()) { - tmp_cell[0] = E->get().idx; + tmp_cell.write[0] = E->get().idx; _set_cell(E->key(), tmp_cell, E->get().xf, E->get().yf, E->get().tr); } } @@ -1265,7 +1265,7 @@ bool TileMapEditor::forward_gui_input(const Ref &p_event) { for (Map::Element *E = paint_undo.front(); E; E = E->next()) { - tmp_cell[0] = E->get().idx; + tmp_cell.write[0] = E->get().idx; _set_cell(E->key(), tmp_cell, E->get().xf, E->get().yf, E->get().tr); } } @@ -1750,7 +1750,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { bucket_cache_visited = 0; invalid_cell.resize(1); - invalid_cell[0] = TileMap::INVALID_CELL; + invalid_cell.write[0] = TileMap::INVALID_CELL; ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase Selection"), KEY_DELETE); ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find Tile"), KEY_MASK_CMD + KEY_F); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index b9b8b07a2e..9218fed907 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -190,7 +190,7 @@ void VisualShaderEditor::_update_graph() { } for (int i = 0; i < plugins.size(); i++) { - custom_editor = plugins[i]->create_editor(vsnode); + custom_editor = plugins.write[i]->create_editor(vsnode); if (custom_editor) { break; } -- cgit v1.2.3