summaryrefslogtreecommitdiff
path: root/editor/spatial_editor_gizmos.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/spatial_editor_gizmos.cpp')
-rw-r--r--editor/spatial_editor_gizmos.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 4f1928d20c..7a4b7d091f 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -1235,8 +1235,8 @@ void CameraSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx
Vector3 s[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) };
if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) {
- Transform gt = camera->get_global_transform();
- float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt);
+ Transform gt2 = camera->get_global_transform();
+ float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt2);
camera->set("fov", a * 2.0);
} else {
@@ -2414,8 +2414,8 @@ void ParticlesGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx,
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Particles AABB"));
- ur->add_do_method(particles, "set_custom_aabb", particles->get_visibility_aabb());
- ur->add_undo_method(particles, "set_custom_aabb", p_restore);
+ ur->add_do_method(particles, "set_visibility_aabb", particles->get_visibility_aabb());
+ ur->add_undo_method(particles, "set_visibility_aabb", p_restore);
ur->commit_action();
}
@@ -3019,20 +3019,20 @@ Variant CollisionShapeSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p
if (Object::cast_to<CapsuleShape>(*s)) {
- Ref<CapsuleShape> cs = s;
- return p_idx == 0 ? cs->get_radius() : cs->get_height();
+ Ref<CapsuleShape> cs2 = s;
+ return p_idx == 0 ? cs2->get_radius() : cs2->get_height();
}
if (Object::cast_to<CylinderShape>(*s)) {
- Ref<CylinderShape> cs = s;
- return p_idx == 0 ? cs->get_radius() : cs->get_height();
+ Ref<CylinderShape> cs2 = s;
+ return p_idx == 0 ? cs2->get_radius() : cs2->get_height();
}
if (Object::cast_to<RayShape>(*s)) {
- Ref<RayShape> cs = s;
- return cs->get_length();
+ Ref<RayShape> cs2 = s;
+ return cs2->get_length();
}
return Variant();
@@ -3098,26 +3098,26 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
Vector3 axis;
axis[p_idx == 0 ? 0 : 2] = 1.0;
- Ref<CapsuleShape> cs = s;
+ Ref<CapsuleShape> cs2 = s;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
if (p_idx == 1)
- d -= cs->get_radius();
+ d -= cs2->get_radius();
if (d < 0.001)
d = 0.001;
if (p_idx == 0)
- cs->set_radius(d);
+ cs2->set_radius(d);
else if (p_idx == 1)
- cs->set_height(d * 2.0);
+ cs2->set_height(d * 2.0);
}
if (Object::cast_to<CylinderShape>(*s)) {
Vector3 axis;
axis[p_idx == 0 ? 0 : 1] = 1.0;
- Ref<CylinderShape> cs = s;
+ Ref<CylinderShape> cs2 = s;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
@@ -3126,9 +3126,9 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
d = 0.001;
if (p_idx == 0)
- cs->set_radius(d);
+ cs2->set_radius(d);
else if (p_idx == 1)
- cs->set_height(d * 2.0);
+ cs2->set_height(d * 2.0);
}
}
void CollisionShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
@@ -3328,9 +3328,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
if (Object::cast_to<CapsuleShape>(*s)) {
- Ref<CapsuleShape> cs = s;
- float radius = cs->get_radius();
- float height = cs->get_height();
+ Ref<CapsuleShape> cs2 = s;
+ float radius = cs2->get_radius();
+ float height = cs2->get_height();
Vector<Vector3> points;
@@ -3396,16 +3396,16 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles;
- handles.push_back(Vector3(cs->get_radius(), 0, 0));
- handles.push_back(Vector3(0, 0, cs->get_height() * 0.5 + cs->get_radius()));
+ handles.push_back(Vector3(cs2->get_radius(), 0, 0));
+ handles.push_back(Vector3(0, 0, cs2->get_height() * 0.5 + cs2->get_radius()));
p_gizmo->add_handles(handles, handles_material);
}
if (Object::cast_to<CylinderShape>(*s)) {
- Ref<CylinderShape> cs = s;
- float radius = cs->get_radius();
- float height = cs->get_height();
+ Ref<CylinderShape> cs2 = s;
+ float radius = cs2->get_radius();
+ float height = cs2->get_height();
Vector<Vector3> points;
@@ -3457,8 +3457,8 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles;
- handles.push_back(Vector3(cs->get_radius(), 0, 0));
- handles.push_back(Vector3(0, cs->get_height() * 0.5, 0));
+ handles.push_back(Vector3(cs2->get_radius(), 0, 0));
+ handles.push_back(Vector3(0, cs2->get_height() * 0.5, 0));
p_gizmo->add_handles(handles, handles_material);
}
@@ -3503,23 +3503,23 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Geometry::MeshData md;
Error err = QuickHull::build(varr, md);
if (err == OK) {
- Vector<Vector3> points;
- points.resize(md.edges.size() * 2);
+ Vector<Vector3> points2;
+ points2.resize(md.edges.size() * 2);
for (int i = 0; i < md.edges.size(); i++) {
- points.write[i * 2 + 0] = md.vertices[md.edges[i].a];
- points.write[i * 2 + 1] = md.vertices[md.edges[i].b];
+ points2.write[i * 2 + 0] = md.vertices[md.edges[i].a];
+ points2.write[i * 2 + 1] = md.vertices[md.edges[i].b];
}
- p_gizmo->add_lines(points, material);
- p_gizmo->add_collision_segments(points);
+ p_gizmo->add_lines(points2, material);
+ p_gizmo->add_collision_segments(points2);
}
}
}
if (Object::cast_to<ConcavePolygonShape>(*s)) {
- Ref<ConcavePolygonShape> cs = s;
- Ref<ArrayMesh> mesh = cs->get_debug_mesh()->duplicate();
+ Ref<ConcavePolygonShape> cs2 = s;
+ Ref<ArrayMesh> mesh = cs2->get_debug_mesh()->duplicate();
mesh->surface_set_material(0, material);
p_gizmo->add_mesh(mesh);
}
@@ -3584,10 +3584,10 @@ void CollisionPolygonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
////
NavigationMeshSpatialGizmoPlugin::NavigationMeshSpatialGizmoPlugin() {
- create_material("navigation_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge", Color(0.5, 1, 1)));
- create_material("navigation_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge_disabled", Color(0.7, 0.7, 0.7)));
- create_material("navigation_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid", Color(0.5, 1, 1, 0.4)));
- create_material("navigation_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid_disabled", Color(0.7, 0.7, 0.7, 0.4)));
+ create_material("navigation_edge_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge", Color(0.5, 1, 1)));
+ create_material("navigation_edge_material_disabled", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge_disabled", Color(0.7, 0.7, 0.7)));
+ create_material("navigation_solid_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid", Color(0.5, 1, 1, 0.4)));
+ create_material("navigation_solid_material_disabled", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid_disabled", Color(0.7, 0.7, 0.7, 0.4)));
}
bool NavigationMeshSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
@@ -3602,10 +3602,10 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
NavigationMeshInstance *navmesh = Object::cast_to<NavigationMeshInstance>(p_gizmo->get_spatial_node());
- Ref<Material> edge_material = get_material("navigation_material", p_gizmo);
- Ref<Material> edge_material_disabled = get_material("navigation_material", p_gizmo);
- Ref<Material> solid_material = get_material("navigation_material", p_gizmo);
- Ref<Material> solid_material_disabled = get_material("navigation_material", p_gizmo);
+ Ref<Material> edge_material = get_material("navigation_edge_material", p_gizmo);
+ Ref<Material> edge_material_disabled = get_material("navigation_edge_material_disabled", p_gizmo);
+ Ref<Material> solid_material = get_material("navigation_solid_material", p_gizmo);
+ Ref<Material> solid_material_disabled = get_material("navigation_solid_material_disabled", p_gizmo);
p_gizmo->clear();
Ref<NavigationMesh> navmeshie = navmesh->get_navigation_mesh();
@@ -3652,11 +3652,11 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
if (ek.from < ek.to)
SWAP(ek.from, ek.to);
- Map<_EdgeKey, bool>::Element *E = edge_map.find(ek);
+ Map<_EdgeKey, bool>::Element *F = edge_map.find(ek);
- if (E) {
+ if (F) {
- E->get() = false;
+ F->get() = false;
} else {