Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
@ -69,21 +69,25 @@
|
||||
bool EditorSpatialGizmo::is_editable() const {
|
||||
ERR_FAIL_COND_V(!spatial_node, false);
|
||||
Node *edited_root = spatial_node->get_tree()->get_edited_scene_root();
|
||||
if (spatial_node == edited_root)
|
||||
if (spatial_node == edited_root) {
|
||||
return true;
|
||||
if (spatial_node->get_owner() == edited_root)
|
||||
}
|
||||
if (spatial_node->get_owner() == edited_root) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (edited_root->is_editable_instance(spatial_node->get_owner()))
|
||||
if (edited_root->is_editable_instance(spatial_node->get_owner())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EditorSpatialGizmo::clear() {
|
||||
for (int i = 0; i < instances.size(); i++) {
|
||||
if (instances[i].instance.is_valid())
|
||||
if (instances[i].instance.is_valid()) {
|
||||
VS::get_singleton()->free(instances[i].instance);
|
||||
}
|
||||
}
|
||||
|
||||
billboard_handle = false;
|
||||
@ -159,10 +163,12 @@ void EditorSpatialGizmo::set_spatial_node(Spatial *p_node) {
|
||||
void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base, bool p_hidden) {
|
||||
instance = VS::get_singleton()->instance_create2(mesh->get_rid(), p_base->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_attach_object_instance_id(instance, p_base->get_instance_id());
|
||||
if (skin_reference.is_valid())
|
||||
if (skin_reference.is_valid()) {
|
||||
VS::get_singleton()->instance_attach_skeleton(instance, skin_reference->get_skeleton());
|
||||
if (extra_margin)
|
||||
}
|
||||
if (extra_margin) {
|
||||
VS::get_singleton()->instance_set_extra_visibility_margin(instance, 1);
|
||||
}
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance, VS::SHADOW_CASTING_SETTING_OFF);
|
||||
int layer = p_hidden ? 0 : 1 << SpatialEditorViewport::GIZMO_EDIT_LAYER;
|
||||
VS::get_singleton()->instance_set_layer_mask(instance, layer); //gizmos are 26
|
||||
@ -206,10 +212,11 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat
|
||||
{
|
||||
PoolVector<Color>::Write w = color.write();
|
||||
for (int i = 0; i < p_lines.size(); i++) {
|
||||
if (is_selected())
|
||||
if (is_selected()) {
|
||||
w[i] = Color(1, 1, 1, 0.8) * p_modulate;
|
||||
else
|
||||
} else {
|
||||
w[i] = Color(1, 1, 1, 0.2) * p_modulate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,8 +316,9 @@ void EditorSpatialGizmo::add_collision_segments(const Vector<Vector3> &p_lines)
|
||||
void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<Material> &p_material, bool p_billboard, bool p_secondary) {
|
||||
billboard_handle = p_billboard;
|
||||
|
||||
if (!is_selected() || !is_editable())
|
||||
if (!is_selected() || !is_editable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND(!spatial_node);
|
||||
|
||||
@ -327,11 +335,13 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref
|
||||
PoolVector<Color>::Write w = colors.write();
|
||||
for (int i = 0; i < p_handles.size(); i++) {
|
||||
Color col(1, 1, 1, 1);
|
||||
if (is_handle_highlighted(i))
|
||||
if (is_handle_highlighted(i)) {
|
||||
col = Color(0, 0, 1, 0.9);
|
||||
}
|
||||
|
||||
if (SpatialEditor::get_singleton()->get_over_gizmo_handle() != i)
|
||||
if (SpatialEditor::get_singleton()->get_over_gizmo_handle() != i) {
|
||||
col.a = 0.8;
|
||||
}
|
||||
|
||||
w[i] = col;
|
||||
}
|
||||
@ -399,8 +409,9 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
|
||||
ERR_FAIL_COND_V(!spatial_node, false);
|
||||
ERR_FAIL_COND_V(!valid, false);
|
||||
|
||||
if (hidden && !gizmo_plugin->is_selectable_when_hidden())
|
||||
if (hidden && !gizmo_plugin->is_selectable_when_hidden()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selectable_icon_size > 0.0f) {
|
||||
Vector3 origin = spatial_node->get_global_transform().get_origin();
|
||||
@ -437,12 +448,14 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (any_out)
|
||||
if (any_out) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!any_out)
|
||||
if (!any_out) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (collision_mesh.is_valid()) {
|
||||
@ -473,8 +486,9 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
|
||||
ERR_FAIL_COND_V(!spatial_node, false);
|
||||
ERR_FAIL_COND_V(!valid, false);
|
||||
|
||||
if (hidden && !gizmo_plugin->is_selectable_when_hidden())
|
||||
if (hidden && !gizmo_plugin->is_selectable_when_hidden()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (r_gizmo_handle && !hidden) {
|
||||
Transform t = spatial_node->get_global_transform();
|
||||
@ -608,8 +622,9 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
|
||||
tcp = a;
|
||||
}
|
||||
|
||||
if (camp.distance_to(tcp) < p_camera->get_znear())
|
||||
if (camp.distance_to(tcp) < p_camera->get_znear()) {
|
||||
continue;
|
||||
}
|
||||
cp = tcp;
|
||||
cpd = pd;
|
||||
}
|
||||
@ -671,8 +686,9 @@ void EditorSpatialGizmo::free() {
|
||||
ERR_FAIL_COND(!valid);
|
||||
|
||||
for (int i = 0; i < instances.size(); i++) {
|
||||
if (instances[i].instance.is_valid())
|
||||
if (instances[i].instance.is_valid()) {
|
||||
VS::get_singleton()->free(instances[i].instance);
|
||||
}
|
||||
instances.write[i].instance = RID();
|
||||
}
|
||||
|
||||
@ -733,8 +749,9 @@ EditorSpatialGizmo::EditorSpatialGizmo() {
|
||||
}
|
||||
|
||||
EditorSpatialGizmo::~EditorSpatialGizmo() {
|
||||
if (gizmo_plugin != nullptr)
|
||||
if (gizmo_plugin != nullptr) {
|
||||
gizmo_plugin->unregister_gizmo(this);
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -773,18 +790,21 @@ int LightSpatialGizmoPlugin::get_priority() const {
|
||||
}
|
||||
|
||||
String LightSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const {
|
||||
if (p_idx == 0)
|
||||
if (p_idx == 0) {
|
||||
return "Radius";
|
||||
else
|
||||
} else {
|
||||
return "Aperture";
|
||||
}
|
||||
}
|
||||
|
||||
Variant LightSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const {
|
||||
Light *light = Object::cast_to<Light>(p_gizmo->get_spatial_node());
|
||||
if (p_idx == 0)
|
||||
if (p_idx == 0) {
|
||||
return light->get_param(Light::PARAM_RANGE);
|
||||
if (p_idx == 1)
|
||||
}
|
||||
if (p_idx == 1) {
|
||||
return light->get_param(Light::PARAM_SPOT_ANGLE);
|
||||
}
|
||||
|
||||
return Variant();
|
||||
}
|
||||
@ -835,8 +855,9 @@ void LightSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx,
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d <= 0) // Equal is here for negative zero.
|
||||
if (d <= 0) { // Equal is here for negative zero.
|
||||
d = 0;
|
||||
}
|
||||
|
||||
light->set_param(Light::PARAM_RANGE, d);
|
||||
} else if (Object::cast_to<OmniLight>(light)) {
|
||||
@ -1422,8 +1443,9 @@ void MeshInstanceSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
|
||||
Ref<Mesh> m = mesh->get_mesh();
|
||||
|
||||
if (!m.is_valid())
|
||||
if (!m.is_valid()) {
|
||||
return; //none
|
||||
}
|
||||
|
||||
Ref<TriangleMesh> tm = m->generate_triangle_mesh();
|
||||
if (tm.is_valid()) {
|
||||
@ -1584,8 +1606,9 @@ void SkeletonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
float dp = Math::abs(grests[parent].basis[j].normalized().dot(d));
|
||||
if (j == 0 || dp > closest_d)
|
||||
if (j == 0 || dp > closest_d) {
|
||||
closest = j;
|
||||
}
|
||||
}
|
||||
|
||||
//find closest other
|
||||
@ -1603,8 +1626,9 @@ void SkeletonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
surface_tool->add_color(rootcolor);
|
||||
surface_tool->add_vertex(v0 + grests[parent].basis[j].normalized() * dist * 0.05);
|
||||
|
||||
if (j == closest)
|
||||
if (j == closest) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector3 axis;
|
||||
if (first == Vector3()) {
|
||||
@ -1615,8 +1639,9 @@ void SkeletonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
}
|
||||
|
||||
for (int k = 0; k < 2; k++) {
|
||||
if (k == 1)
|
||||
if (k == 1) {
|
||||
axis = -axis;
|
||||
}
|
||||
Vector3 point = v0 + d * dist * 0.2;
|
||||
point += axis * dist * 0.1;
|
||||
|
||||
@ -1740,20 +1765,24 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
|
||||
PhysicalBone *physical_bone = Object::cast_to<PhysicalBone>(p_gizmo->get_spatial_node());
|
||||
|
||||
if (!physical_bone)
|
||||
if (!physical_bone) {
|
||||
return;
|
||||
}
|
||||
|
||||
Skeleton *sk(physical_bone->find_skeleton_parent());
|
||||
if (!sk)
|
||||
if (!sk) {
|
||||
return;
|
||||
}
|
||||
|
||||
PhysicalBone *pb(sk->get_physical_bone(physical_bone->get_bone_id()));
|
||||
if (!pb)
|
||||
if (!pb) {
|
||||
return;
|
||||
}
|
||||
|
||||
PhysicalBone *pbp(sk->get_physical_bone_parent(physical_bone->get_bone_id()));
|
||||
if (!pbp)
|
||||
if (!pbp) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<Vector3> points;
|
||||
|
||||
@ -2162,8 +2191,9 @@ void VisibilityNotifierGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
//resize
|
||||
aabb.position[p_idx] = (aabb.position[p_idx] + aabb.size[p_idx] * 0.5) - d;
|
||||
aabb.size[p_idx] = d * 2;
|
||||
@ -2350,8 +2380,9 @@ void ParticlesGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Ca
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
//resize
|
||||
aabb.position[p_idx] = (aabb.position[p_idx] + aabb.size[p_idx] * 0.5) - d;
|
||||
aabb.size[p_idx] = d * 2;
|
||||
@ -2496,8 +2527,9 @@ void ReflectionProbeGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
extents[p_idx] = d;
|
||||
probe->set_extents(extents);
|
||||
@ -2674,8 +2706,9 @@ void GIProbeGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Came
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
extents[p_idx] = d;
|
||||
probe->set_extents(extents);
|
||||
@ -2835,8 +2868,9 @@ void BakedIndirectLightGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
extents[p_idx] = d;
|
||||
baker->set_extents(extents);
|
||||
@ -2988,8 +3022,9 @@ String CollisionShapeSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizm
|
||||
const CollisionShape *cs = Object::cast_to<CollisionShape>(p_gizmo->get_spatial_node());
|
||||
|
||||
Ref<Shape> s = cs->get_shape();
|
||||
if (s.is_null())
|
||||
if (s.is_null()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (Object::cast_to<SphereShape>(*s)) {
|
||||
return "Radius";
|
||||
@ -3018,8 +3053,9 @@ Variant CollisionShapeSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p
|
||||
CollisionShape *cs = Object::cast_to<CollisionShape>(p_gizmo->get_spatial_node());
|
||||
|
||||
Ref<Shape> s = cs->get_shape();
|
||||
if (s.is_null())
|
||||
if (s.is_null()) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
if (Object::cast_to<SphereShape>(*s)) {
|
||||
Ref<SphereShape> ss = s;
|
||||
@ -3052,8 +3088,9 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
|
||||
CollisionShape *cs = Object::cast_to<CollisionShape>(p_gizmo->get_spatial_node());
|
||||
|
||||
Ref<Shape> s = cs->get_shape();
|
||||
if (s.is_null())
|
||||
if (s.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Transform gt = cs->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
@ -3072,8 +3109,9 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
ss->set_radius(d);
|
||||
}
|
||||
@ -3087,8 +3125,9 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
rs->set_length(d);
|
||||
}
|
||||
@ -3104,8 +3143,9 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
Vector3 he = bs->get_extents();
|
||||
he[p_idx] = d;
|
||||
@ -3119,20 +3159,23 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
|
||||
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)
|
||||
if (p_idx == 1) {
|
||||
d -= cs2->get_radius();
|
||||
}
|
||||
|
||||
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
if (p_idx == 0)
|
||||
if (p_idx == 0) {
|
||||
cs2->set_radius(d);
|
||||
else if (p_idx == 1)
|
||||
} else if (p_idx == 1) {
|
||||
cs2->set_height(d * 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Object::cast_to<CylinderShape>(*s)) {
|
||||
@ -3146,21 +3189,24 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
|
||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||
}
|
||||
|
||||
if (d < 0.001)
|
||||
if (d < 0.001) {
|
||||
d = 0.001;
|
||||
}
|
||||
|
||||
if (p_idx == 0)
|
||||
if (p_idx == 0) {
|
||||
cs2->set_radius(d);
|
||||
else if (p_idx == 1)
|
||||
} else if (p_idx == 1) {
|
||||
cs2->set_height(d * 2.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CollisionShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
|
||||
CollisionShape *cs = Object::cast_to<CollisionShape>(p_gizmo->get_spatial_node());
|
||||
|
||||
Ref<Shape> s = cs->get_shape();
|
||||
if (s.is_null())
|
||||
if (s.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object::cast_to<SphereShape>(*s)) {
|
||||
Ref<SphereShape> ss = s;
|
||||
@ -3193,10 +3239,11 @@ void CollisionShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo
|
||||
if (Object::cast_to<CapsuleShape>(*s)) {
|
||||
Ref<CapsuleShape> ss = s;
|
||||
if (p_cancel) {
|
||||
if (p_idx == 0)
|
||||
if (p_idx == 0) {
|
||||
ss->set_radius(p_restore);
|
||||
else
|
||||
} else {
|
||||
ss->set_height(p_restore);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3217,10 +3264,11 @@ void CollisionShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo
|
||||
if (Object::cast_to<CylinderShape>(*s)) {
|
||||
Ref<CylinderShape> ss = s;
|
||||
if (p_cancel) {
|
||||
if (p_idx == 0)
|
||||
if (p_idx == 0) {
|
||||
ss->set_radius(p_restore);
|
||||
else
|
||||
} else {
|
||||
ss->set_height(p_restore);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3262,8 +3310,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
p_gizmo->clear();
|
||||
|
||||
Ref<Shape> s = cs->get_shape();
|
||||
if (s.is_null())
|
||||
if (s.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Ref<Material> material =
|
||||
get_material(!cs->is_disabled() ? "shape_material" : "shape_material_disabled", p_gizmo);
|
||||
@ -3623,8 +3672,9 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
|
||||
p_gizmo->clear();
|
||||
Ref<NavigationMesh> navmeshie = navmesh->get_navigation_mesh();
|
||||
if (navmeshie.is_null())
|
||||
if (navmeshie.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PoolVector<Vector3> vertices = navmeshie->get_vertices();
|
||||
PoolVector<Vector3>::Read vr = vertices.read();
|
||||
@ -3642,8 +3692,9 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
}
|
||||
}
|
||||
|
||||
if (faces.empty())
|
||||
if (faces.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<_EdgeKey, bool> edge_map;
|
||||
PoolVector<Vector3> tmeshfaces;
|
||||
@ -3661,8 +3712,9 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
_EdgeKey ek;
|
||||
ek.from = f.vertex[j].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON));
|
||||
ek.to = f.vertex[(j + 1) % 3].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON));
|
||||
if (ek.from < ek.to)
|
||||
if (ek.from < ek.to) {
|
||||
SWAP(ek.from, ek.to);
|
||||
}
|
||||
|
||||
Map<_EdgeKey, bool>::Element *F = edge_map.find(ek);
|
||||
|
||||
@ -3687,8 +3739,9 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
Ref<TriangleMesh> tmesh = memnew(TriangleMesh);
|
||||
tmesh->create(tmeshfaces);
|
||||
|
||||
if (lines.size())
|
||||
if (lines.size()) {
|
||||
p_gizmo->add_lines(lines, navmesh->is_enabled() ? edge_material : edge_material_disabled);
|
||||
}
|
||||
p_gizmo->add_collision_triangles(tmesh);
|
||||
Ref<ArrayMesh> m = memnew(ArrayMesh);
|
||||
Array a;
|
||||
@ -4196,7 +4249,7 @@ void JointSpatialGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset,
|
||||
r_points.push_back(p_offset.translated(Vector3(-cs * 2, 0, 0)).origin);
|
||||
}
|
||||
|
||||
if (r_body_a_points)
|
||||
if (r_body_a_points) {
|
||||
JointGizmosDrawer::draw_circle(
|
||||
Vector3::AXIS_X,
|
||||
BODY_A_RADIUS,
|
||||
@ -4205,8 +4258,9 @@ void JointSpatialGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset,
|
||||
p_angular_limit_lower,
|
||||
p_angular_limit_upper,
|
||||
*r_body_a_points);
|
||||
}
|
||||
|
||||
if (r_body_b_points)
|
||||
if (r_body_b_points) {
|
||||
JointGizmosDrawer::draw_circle(
|
||||
Vector3::AXIS_X,
|
||||
BODY_B_RADIUS,
|
||||
@ -4216,24 +4270,27 @@ void JointSpatialGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset,
|
||||
p_angular_limit_upper,
|
||||
*r_body_b_points,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
void JointSpatialGizmoPlugin::CreateConeTwistJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
if (r_body_a_points)
|
||||
if (r_body_a_points) {
|
||||
JointGizmosDrawer::draw_cone(
|
||||
p_offset,
|
||||
JointGizmosDrawer::look_body(p_trs_joint, p_trs_body_a),
|
||||
p_swing,
|
||||
p_twist,
|
||||
*r_body_a_points);
|
||||
}
|
||||
|
||||
if (r_body_b_points)
|
||||
if (r_body_b_points) {
|
||||
JointGizmosDrawer::draw_cone(
|
||||
p_offset,
|
||||
JointGizmosDrawer::look_body(p_trs_joint, p_trs_body_b),
|
||||
p_swing,
|
||||
p_twist,
|
||||
*r_body_b_points);
|
||||
}
|
||||
}
|
||||
|
||||
void JointSpatialGizmoPlugin::CreateGeneric6DOFJointGizmo(
|
||||
@ -4353,7 +4410,7 @@ void JointSpatialGizmoPlugin::CreateGeneric6DOFJointGizmo(
|
||||
ul = -1;
|
||||
}
|
||||
|
||||
if (r_body_a_points)
|
||||
if (r_body_a_points) {
|
||||
JointGizmosDrawer::draw_circle(
|
||||
static_cast<Vector3::Axis>(ax),
|
||||
BODY_A_RADIUS,
|
||||
@ -4363,8 +4420,9 @@ void JointSpatialGizmoPlugin::CreateGeneric6DOFJointGizmo(
|
||||
ul,
|
||||
*r_body_a_points,
|
||||
true);
|
||||
}
|
||||
|
||||
if (r_body_b_points)
|
||||
if (r_body_b_points) {
|
||||
JointGizmosDrawer::draw_circle(
|
||||
static_cast<Vector3::Axis>(ax),
|
||||
BODY_B_RADIUS,
|
||||
@ -4373,6 +4431,7 @@ void JointSpatialGizmoPlugin::CreateGeneric6DOFJointGizmo(
|
||||
ll,
|
||||
ul,
|
||||
*r_body_b_points);
|
||||
}
|
||||
}
|
||||
|
||||
#undef ADD_VTX
|
||||
|
||||
Reference in New Issue
Block a user