Merge pull request #57436 from AnilBK/change-scopes

Scope Changes for some variables.
This commit is contained in:
Rémi Verschelde 2022-03-13 22:10:16 +01:00 committed by GitHub
commit 4f40a71e03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 11 deletions

View File

@ -292,15 +292,14 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
_commit_action();
return true;
} else {
Vector<Vector2> vertices2 = _get_polygon(insert.polygon);
pre_move_edit = vertices2;
pre_move_edit = vertices;
edited_point = PosVertex(insert.polygon, insert.vertex + 1, xform.affine_inverse().xform(insert.pos));
vertices2.insert(edited_point.vertex, edited_point.pos);
vertices.insert(edited_point.vertex, edited_point.pos);
selected_point = Vertex(edited_point.polygon, edited_point.vertex);
edge_point = PosVertex();
undo_redo->create_action(TTR("Insert Point"));
_action_set_polygon(insert.polygon, vertices2);
_action_set_polygon(insert.polygon, vertices);
_commit_action();
return true;
}

View File

@ -265,15 +265,15 @@ bool Line2D::get_antialiased() const {
}
void Line2D::_draw() {
if (_points.size() <= 1 || _width == 0.f) {
int len = _points.size();
if (len <= 1 || _width == 0.f) {
return;
}
// TODO Is this really needed?
// Copy points for faster access
Vector<Vector2> points;
points.resize(_points.size());
int len = points.size();
points.resize(len);
{
const Vector2 *points_read = _points.ptr();
for (int i = 0; i < len; ++i) {

View File

@ -244,10 +244,9 @@ Point2 Node2D::get_global_position() const {
}
void Node2D::set_global_position(const Point2 &p_pos) {
Transform2D inv;
CanvasItem *pi = get_parent_item();
if (pi) {
inv = pi->get_global_transform().affine_inverse();
Transform2D inv = pi->get_global_transform().affine_inverse();
set_position(inv.xform(p_pos));
} else {
set_position(p_pos);

View File

@ -295,14 +295,14 @@ void Polygon2D::_notification(int p_what) {
}
Vector<Color> colors;
colors.resize(len);
if (vertex_colors.size() == points.size()) {
colors.resize(len);
const Color *color_r = vertex_colors.ptr();
for (int i = 0; i < len; i++) {
colors.write[i] = color_r[i];
}
} else {
colors.resize(len);
for (int i = 0; i < len; i++) {
colors.write[i] = color;
}