summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml8
-rw-r--r--core/input/godotcontrollerdb.txt3
-rw-r--r--core/io/marshalls.cpp4
-rw-r--r--core/io/resource_format_binary.cpp4
-rw-r--r--core/math/camera_matrix.cpp12
-rw-r--r--core/math/geometry.cpp4
-rw-r--r--core/math/math_fieldwise.cpp2
-rw-r--r--core/math/plane.cpp18
-rw-r--r--core/math/plane.h30
-rw-r--r--core/math/transform.h4
-rw-r--r--core/variant.cpp4
-rw-r--r--core/variant_call.cpp2
-rw-r--r--core/variant_op.cpp10
-rw-r--r--core/variant_parser.cpp2
-rw-r--r--doc/classes/Plane.xml6
-rw-r--r--doc/classes/String.xml13
-rw-r--r--editor/editor_properties.cpp4
-rw-r--r--editor/import/editor_import_collada.cpp6
-rw-r--r--editor/node_3d_editor_gizmos.cpp12
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp4
-rw-r--r--editor/property_editor.cpp4
-rw-r--r--main/tests/test_math.cpp2
-rw-r--r--modules/bullet/shape_bullet.cpp2
-rw-r--r--modules/gdnative/gdnative/plane.cpp12
-rw-r--r--modules/gdnative/gdnative_api.json4
-rw-r--r--modules/gdnative/include/gdnative/plane.h4
-rw-r--r--modules/gdnavigation/nav_map.cpp2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp4
-rw-r--r--modules/mono/build_scripts/godot_tools_build.py2
-rw-r--r--modules/mono/build_scripts/solution_builder.py68
-rw-r--r--modules/mono/csharp_script.cpp172
-rw-r--r--modules/mono/csharp_script.h3
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj16
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe0
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs26
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs50
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildTool.cs10
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs53
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/BuildManager.cs52
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs3
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj1
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs46
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj1
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj1
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h8
-rw-r--r--scene/2d/visibility_notifier_2d.cpp17
-rw-r--r--scene/3d/camera_3d.cpp2
-rw-r--r--scene/3d/xr_nodes.cpp2
-rw-r--r--scene/gui/line_edit.cpp4
-rw-r--r--scene/resources/curve.cpp4
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/mesh_data_tool.cpp2
-rw-r--r--scene/resources/surface_tool.cpp6
-rw-r--r--scene/resources/world_margin_shape_3d.cpp12
-rw-r--r--servers/physics_3d/collision_solver_3d_sat.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp4
59 files changed, 470 insertions, 297 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 3f6e932050..e2105be6c0 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -39,3 +39,11 @@ before_build:
build_script:
- scons platform=%GD_PLATFORM% target=%TARGET% tools=%TOOLS% %OPTIONS% %EXTRA_ARGS%
+
+after_build:
+ - 7z a godot_build.zip bin\*.exe
+
+artifacts:
+ - path: godot_build.zip
+ name: Build
+ type: zip
diff --git a/core/input/godotcontrollerdb.txt b/core/input/godotcontrollerdb.txt
index adc3649d64..51ddda1e4e 100644
--- a/core/input/godotcontrollerdb.txt
+++ b/core/input/godotcontrollerdb.txt
@@ -4,6 +4,9 @@
# Windows
__XINPUT_DEVICE__,XInput Gamepad,a:b12,b:b13,x:b14,y:b15,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpdown:b1,dpleft:b2,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Windows,
+# Android
+Default Android Gamepad,Default Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,back:b4,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,platform:Android,
+
# Javascript
Default HTML5 Gamepad, Default Mapping,leftx:a0,lefty:a1,dpdown:b13,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:b14,lefttrigger:a6,x:b2,dpup:b12,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:b15,righttrigger:a7,b:b1,platform:Javascript,
c2a94d6963726f736f66742058626f78,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,platform:Javascript,
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 1396683d25..81bc45b2f7 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -277,7 +277,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
val.normal.x = decode_float(&buf[0]);
val.normal.y = decode_float(&buf[4]);
val.normal.z = decode_float(&buf[8]);
- val.distance = decode_float(&buf[12]);
+ val.d = decode_float(&buf[12]);
r_variant = val;
if (r_len)
@@ -1140,7 +1140,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
encode_float(p.normal.x, &buf[0]);
encode_float(p.normal.y, &buf[4]);
encode_float(p.normal.z, &buf[8]);
- encode_float(p.distance, &buf[12]);
+ encode_float(p.d, &buf[12]);
}
r_len += 4 * 4;
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 5907143810..8c7559479b 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -214,7 +214,7 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
v.normal.x = f->get_real();
v.normal.y = f->get_real();
v.normal.z = f->get_real();
- v.distance = f->get_real();
+ v.d = f->get_real();
r_v = v;
} break;
case VARIANT_QUAT: {
@@ -1458,7 +1458,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
f->store_real(val.normal.x);
f->store_real(val.normal.y);
f->store_real(val.normal.z);
- f->store_real(val.distance);
+ f->store_real(val.d);
} break;
case Variant::QUAT: {
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index a091b5d00d..76321b0679 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -59,10 +59,10 @@ Plane CameraMatrix::xform4(const Plane &p_vec4) const {
Plane ret;
- ret.normal.x = matrix[0][0] * p_vec4.normal.x + matrix[1][0] * p_vec4.normal.y + matrix[2][0] * p_vec4.normal.z + matrix[3][0] * p_vec4.distance;
- ret.normal.y = matrix[0][1] * p_vec4.normal.x + matrix[1][1] * p_vec4.normal.y + matrix[2][1] * p_vec4.normal.z + matrix[3][1] * p_vec4.distance;
- ret.normal.z = matrix[0][2] * p_vec4.normal.x + matrix[1][2] * p_vec4.normal.y + matrix[2][2] * p_vec4.normal.z + matrix[3][2] * p_vec4.distance;
- ret.distance = matrix[0][3] * p_vec4.normal.x + matrix[1][3] * p_vec4.normal.y + matrix[2][3] * p_vec4.normal.z + matrix[3][3] * p_vec4.distance;
+ ret.normal.x = matrix[0][0] * p_vec4.normal.x + matrix[1][0] * p_vec4.normal.y + matrix[2][0] * p_vec4.normal.z + matrix[3][0] * p_vec4.d;
+ ret.normal.y = matrix[0][1] * p_vec4.normal.x + matrix[1][1] * p_vec4.normal.y + matrix[2][1] * p_vec4.normal.z + matrix[3][1] * p_vec4.d;
+ ret.normal.z = matrix[0][2] * p_vec4.normal.x + matrix[1][2] * p_vec4.normal.y + matrix[2][2] * p_vec4.normal.z + matrix[3][2] * p_vec4.d;
+ ret.d = matrix[0][3] * p_vec4.normal.x + matrix[1][3] * p_vec4.normal.y + matrix[2][3] * p_vec4.normal.z + matrix[3][3] * p_vec4.d;
return ret;
}
@@ -233,7 +233,7 @@ real_t CameraMatrix::get_z_far() const {
new_plane.normal = -new_plane.normal;
new_plane.normalize();
- return new_plane.distance;
+ return new_plane.d;
}
real_t CameraMatrix::get_z_near() const {
@@ -244,7 +244,7 @@ real_t CameraMatrix::get_z_near() const {
-matrix[15] - matrix[14]);
new_plane.normalize();
- return new_plane.distance;
+ return new_plane.d;
}
Vector2 CameraMatrix::get_viewport_half_extents() const {
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 95789f97ea..e556eb3b9c 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -781,7 +781,7 @@ Geometry::MeshData Geometry::build_convex_mesh(const Vector<Plane> &p_planes) {
if (Math::is_zero_approx(den))
continue; // Point too short.
- real_t dist = -(clip.normal.dot(edge0_A) - clip.distance) / den;
+ real_t dist = -(clip.normal.dot(edge0_A) - clip.d) / den;
Vector3 inters = edge0_A + rel * dist;
new_vertices.push_back(inters);
}
@@ -1224,7 +1224,7 @@ Vector<Vector3> Geometry::compute_convex_mesh_points(const Plane *p_planes, int
for (int n = 0; n < p_plane_count; n++) {
if (n != i && n != j && n != k) {
real_t dp = p_planes[n].normal.dot(convex_shape_point);
- if (dp - p_planes[n].distance > CMP_EPSILON) {
+ if (dp - p_planes[n].d > CMP_EPSILON) {
excluded = true;
break;
}
diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp
index e42c399ba4..a47d4ef7ad 100644
--- a/core/math/math_fieldwise.cpp
+++ b/core/math/math_fieldwise.cpp
@@ -89,7 +89,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
/**/ TRY_TRANSFER_FIELD("x", normal.x)
else TRY_TRANSFER_FIELD("y", normal.y)
else TRY_TRANSFER_FIELD("z", normal.z)
- else TRY_TRANSFER_FIELD("d", distance)
+ else TRY_TRANSFER_FIELD("d", d)
return target;
}
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index c375913756..a3818698bc 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -45,7 +45,7 @@ void Plane::normalize() {
return;
}
normal /= l;
- distance /= l;
+ d /= l;
}
Plane Plane::normalized() const {
@@ -57,7 +57,7 @@ Plane Plane::normalized() const {
Vector3 Plane::get_any_point() const {
- return get_normal() * distance;
+ return get_normal() * d;
}
Vector3 Plane::get_any_perpendicular_normal() const {
@@ -92,9 +92,9 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r
return false;
if (r_result) {
- *r_result = ((vec3_cross(normal1, normal2) * p_plane0.distance) +
- (vec3_cross(normal2, normal0) * p_plane1.distance) +
- (vec3_cross(normal0, normal1) * p_plane2.distance)) /
+ *r_result = ((vec3_cross(normal1, normal2) * p_plane0.d) +
+ (vec3_cross(normal2, normal0) * p_plane1.d) +
+ (vec3_cross(normal0, normal1) * p_plane2.d)) /
denom;
}
@@ -112,7 +112,7 @@ bool Plane::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3
return false;
}
- real_t dist = (normal.dot(p_from) - distance) / den;
+ real_t dist = (normal.dot(p_from) - d) / den;
//printf("dist is %i\n",dist);
if (dist > CMP_EPSILON) { //this is a ray, before the emitting pos (p_from) doesn't exist
@@ -137,7 +137,7 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
return false;
}
- real_t dist = (normal.dot(p_begin) - distance) / den;
+ real_t dist = (normal.dot(p_begin) - d) / den;
//printf("dist is %i\n",dist);
if (dist < -CMP_EPSILON || dist > (1.0 + CMP_EPSILON)) {
@@ -155,10 +155,10 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
bool Plane::is_equal_approx(const Plane &p_plane) const {
- return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(distance, p_plane.distance);
+ return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(d, p_plane.d);
}
Plane::operator String() const {
- return normal.operator String() + ", " + rtos(distance);
+ return normal.operator String() + ", " + rtos(d);
}
diff --git a/core/math/plane.h b/core/math/plane.h
index 1409a4140f..771c8fc705 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -36,7 +36,7 @@
class Plane {
public:
Vector3 normal;
- real_t distance;
+ real_t d;
void set_normal(const Vector3 &p_normal);
_FORCE_INLINE_ Vector3 get_normal() const { return normal; }; ///Point is coplanar, CMP_EPSILON for precision
@@ -46,7 +46,7 @@ public:
/* Plane-Point operations */
- _FORCE_INLINE_ Vector3 center() const { return normal * distance; }
+ _FORCE_INLINE_ Vector3 center() const { return normal * d; }
Vector3 get_any_point() const;
Vector3 get_any_perpendicular_normal() const;
@@ -67,7 +67,7 @@ public:
/* misc */
- Plane operator-() const { return Plane(-normal, -distance); }
+ Plane operator-() const { return Plane(-normal, -d); }
bool is_equal_approx(const Plane &p_plane) const;
_FORCE_INLINE_ bool operator==(const Plane &p_plane) const;
@@ -75,41 +75,41 @@ public:
operator String() const;
_FORCE_INLINE_ Plane() :
- distance(0) {}
+ d(0) {}
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
normal(p_a, p_b, p_c),
- distance(p_d) {}
+ d(p_d) {}
- _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_distance);
+ _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
_FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal);
_FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE);
};
bool Plane::is_point_over(const Vector3 &p_point) const {
- return (normal.dot(p_point) > distance);
+ return (normal.dot(p_point) > d);
}
real_t Plane::distance_to(const Vector3 &p_point) const {
- return (normal.dot(p_point) - distance);
+ return (normal.dot(p_point) - d);
}
bool Plane::has_point(const Vector3 &p_point, real_t _epsilon) const {
- real_t dist = normal.dot(p_point) - distance;
+ real_t dist = normal.dot(p_point) - d;
dist = ABS(dist);
return (dist <= _epsilon);
}
-Plane::Plane(const Vector3 &p_normal, real_t p_distance) :
+Plane::Plane(const Vector3 &p_normal, real_t p_d) :
normal(p_normal),
- distance(p_distance) {
+ d(p_d) {
}
Plane::Plane(const Vector3 &p_point, const Vector3 &p_normal) :
normal(p_normal),
- distance(p_normal.dot(p_point)) {
+ d(p_normal.dot(p_point)) {
}
Plane::Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir) {
@@ -120,17 +120,17 @@ Plane::Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_
normal = (p_point1 - p_point2).cross(p_point1 - p_point3);
normal.normalize();
- distance = normal.dot(p_point1);
+ d = normal.dot(p_point1);
}
bool Plane::operator==(const Plane &p_plane) const {
- return normal == p_plane.normal && distance == p_plane.distance;
+ return normal == p_plane.normal && d == p_plane.d;
}
bool Plane::operator!=(const Plane &p_plane) const {
- return normal != p_plane.normal || distance != p_plane.distance;
+ return normal != p_plane.normal || d != p_plane.d;
}
#endif // PLANE_H
diff --git a/core/math/transform.h b/core/math/transform.h
index edbabc9c8b..c6e3be4c70 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -132,7 +132,7 @@ _FORCE_INLINE_ Vector3 Transform::xform_inv(const Vector3 &p_vector) const {
_FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const {
- Vector3 point = p_plane.normal * p_plane.distance;
+ Vector3 point = p_plane.normal * p_plane.d;
Vector3 point_dir = point + p_plane.normal;
point = xform(point);
point_dir = xform(point_dir);
@@ -145,7 +145,7 @@ _FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const {
}
_FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const {
- Vector3 point = p_plane.normal * p_plane.distance;
+ Vector3 point = p_plane.normal * p_plane.d;
Vector3 point_dir = point + p_plane.normal;
xform_inv(point);
xform_inv(point_dir);
diff --git a/core/variant.cpp b/core/variant.cpp
index 4a20e569cc..2eacb5d58c 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -3277,7 +3277,7 @@ uint32_t Variant::hash() const {
uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.x);
hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.y, hash);
hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.z, hash);
- return hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->distance, hash);
+ return hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->d, hash);
} break;
/*
@@ -3625,7 +3625,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
const Plane *r = reinterpret_cast<const Plane *>(p_variant._data._mem);
return (hash_compare_vector3(l->normal, r->normal)) &&
- (hash_compare_scalar(l->distance, r->distance));
+ (hash_compare_scalar(l->d, r->d));
} break;
case AABB: {
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 7f333d18cc..416a1a5fb8 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -262,6 +262,7 @@ struct _VariantCall {
VCALL_LOCALMEM3R(String, split);
VCALL_LOCALMEM3R(String, rsplit);
VCALL_LOCALMEM2R(String, split_floats);
+ VCALL_LOCALMEM1R(String, join);
VCALL_LOCALMEM0R(String, to_upper);
VCALL_LOCALMEM0R(String, to_lower);
VCALL_LOCALMEM1R(String, left);
@@ -1816,6 +1817,7 @@ void register_variant_methods() {
ADDFUNC3R(STRING, PACKED_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));
ADDFUNC3R(STRING, PACKED_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));
ADDFUNC2R(STRING, PACKED_FLOAT32_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true));
+ ADDFUNC1R(STRING, STRING, String, join, PACKED_STRING_ARRAY, "parts", varray());
ADDFUNC0R(STRING, STRING, String, to_upper, varray());
ADDFUNC0R(STRING, STRING, String, to_lower, varray());
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index c37ec61d58..4c9848f26a 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1588,7 +1588,7 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
v->normal.z = p_value._data._int;
valid = true;
} else if (p_index == CoreStringNames::singleton->d) {
- v->distance = p_value._data._int;
+ v->d = p_value._data._int;
valid = true;
}
} else if (p_value.type == Variant::FLOAT) {
@@ -1603,7 +1603,7 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
v->normal.z = p_value._data._float;
valid = true;
} else if (p_index == CoreStringNames::singleton->d) {
- v->distance = p_value._data._float;
+ v->d = p_value._data._float;
valid = true;
}
@@ -1889,7 +1889,7 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
} else if (p_index == CoreStringNames::singleton->z) {
return v->normal.z;
} else if (p_index == CoreStringNames::singleton->d) {
- return v->distance;
+ return v->d;
} else if (p_index == CoreStringNames::singleton->normal) {
return v->normal;
}
@@ -2373,7 +2373,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
return;
} else if (*str == "d") {
valid = true;
- v->distance = p_value;
+ v->d = p_value;
return;
}
}
@@ -2880,7 +2880,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
return v->normal;
} else if (*str == "d") {
valid = true;
- return v->distance;
+ return v->d;
}
}
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 1f0f0977f9..c9678c9933 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1561,7 +1561,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
case Variant::PLANE: {
Plane p = p_variant;
- p_store_string_func(p_store_string_ud, "Plane( " + rtosfix(p.normal.x) + ", " + rtosfix(p.normal.y) + ", " + rtosfix(p.normal.z) + ", " + rtosfix(p.distance) + " )");
+ p_store_string_func(p_store_string_ud, "Plane( " + rtosfix(p.normal.x) + ", " + rtosfix(p.normal.y) + ", " + rtosfix(p.normal.z) + ", " + rtosfix(p.d) + " )");
} break;
case Variant::AABB: {
diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml
index d8a204a2b9..292acd8b5d 100644
--- a/doc/classes/Plane.xml
+++ b/doc/classes/Plane.xml
@@ -19,10 +19,10 @@
</argument>
<argument index="2" name="c" type="float">
</argument>
- <argument index="3" name="distance" type="float">
+ <argument index="3" name="d" type="float">
</argument>
<description>
- Creates a plane from the four parameters. The three components of the resulting plane's [member normal] are [code]a[/code], [code]b[/code] and [code]c[/code], and the plane has a distance of [code]distance[/code] from the origin.
+ Creates a plane from the four parameters. The three components of the resulting plane's [member normal] are [code]a[/code], [code]b[/code] and [code]c[/code], and the plane has a distance of [code]d[/code] from the origin.
</description>
</method>
<method name="Plane">
@@ -43,7 +43,7 @@
</return>
<argument index="0" name="normal" type="Vector3">
</argument>
- <argument index="1" name="distance" type="float">
+ <argument index="1" name="d" type="float">
</argument>
<description>
Creates a plane from the normal and the plane's distance to the origin.
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index a72b8f05d8..03f62732c4 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -837,6 +837,19 @@
Returns a copy of the string with characters removed from the right.
</description>
</method>
+ <method name="join">
+ <return type="String">
+ </return>
+ <argument index="0" name="parts" type="PackedStringArray">
+ </argument>
+ <description>
+ Return a [String] which is the concatenation of the [code]parts[/code]. The separator between elements is the string providing this method.
+ Example:
+ [codeblock]
+ print(", ".join(["One", "Two", "Three", "Four"]))
+ [/codeblock]
+ </description>
+ </method>
<method name="sha1_buffer">
<return type="PackedByteArray">
</return>
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index d411b6dec4..c5772e0ea7 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1611,7 +1611,7 @@ void EditorPropertyPlane::_value_changed(double val, const String &p_name) {
p.normal.x = spin[0]->get_value();
p.normal.y = spin[1]->get_value();
p.normal.z = spin[2]->get_value();
- p.distance = spin[3]->get_value();
+ p.d = spin[3]->get_value();
emit_changed(get_edited_property(), p, p_name);
}
@@ -1621,7 +1621,7 @@ void EditorPropertyPlane::update_property() {
spin[0]->set_value(val.normal.x);
spin[1]->set_value(val.normal.y);
spin[2]->set_value(val.normal.z);
- spin[3]->set_value(val.distance);
+ spin[3]->set_value(val.d);
setting = false;
}
void EditorPropertyPlane::_notification(int p_what) {
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 7e7a982501..697ddfba96 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -766,7 +766,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
Vector3 tangent = Vector3(tangent_src->array[tangent_pos + 0], tangent_src->array[tangent_pos + 1], tangent_src->array[tangent_pos + 2]);
vertex.tangent.normal = tangent;
- vertex.tangent.distance = vertex.normal.cross(tangent).dot(binormal) > 0 ? 1 : -1;
+ vertex.tangent.d = vertex.normal.cross(tangent).dot(binormal) > 0 ? 1 : -1;
}
}
@@ -794,7 +794,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
#ifndef NO_UP_AXIS_SWAP
if (collada.state.up_axis == Vector3::AXIS_Z) {
- Vector3 bn = vertex.normal.cross(vertex.tangent.normal) * vertex.tangent.distance;
+ Vector3 bn = vertex.normal.cross(vertex.tangent.normal) * vertex.tangent.d;
SWAP(vertex.vertex.z, vertex.vertex.y);
vertex.vertex.z = -vertex.vertex.z;
@@ -805,7 +805,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
SWAP(bn.z, bn.y);
bn.z = -bn.z;
- vertex.tangent.distance = vertex.normal.cross(vertex.tangent.normal).dot(bn) > 0 ? 1 : -1;
+ vertex.tangent.d = vertex.normal.cross(vertex.tangent.normal).dot(bn) > 0 ? 1 : -1;
}
#endif
diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp
index 901dfdfb38..2a399087b2 100644
--- a/editor/node_3d_editor_gizmos.cpp
+++ b/editor/node_3d_editor_gizmos.cpp
@@ -3753,10 +3753,10 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector3 n2 = p.normal.cross(n1).normalized();
Vector3 pface[4] = {
- p.normal * p.distance + n1 * 10.0 + n2 * 10.0,
- p.normal * p.distance + n1 * 10.0 + n2 * -10.0,
- p.normal * p.distance + n1 * -10.0 + n2 * -10.0,
- p.normal * p.distance + n1 * -10.0 + n2 * 10.0,
+ p.normal * p.d + n1 * 10.0 + n2 * 10.0,
+ p.normal * p.d + n1 * 10.0 + n2 * -10.0,
+ p.normal * p.d + n1 * -10.0 + n2 * -10.0,
+ p.normal * p.d + n1 * -10.0 + n2 * 10.0,
};
points.push_back(pface[0]);
@@ -3767,8 +3767,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
points.push_back(pface[3]);
points.push_back(pface[3]);
points.push_back(pface[0]);
- points.push_back(p.normal * p.distance);
- points.push_back(p.normal * p.distance + p.normal * 3);
+ points.push_back(p.normal * p.d);
+ points.push_back(p.normal * p.d + p.normal * 3);
p_gizmo->add_lines(points, material);
p_gizmo->add_collision_segments(points);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index bac00ed038..1bf5999906 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -682,11 +682,11 @@ void Node3DEditorViewport::_select_region() {
}
Plane near(cam_pos, -_get_camera_normal());
- near.distance -= get_znear();
+ near.d -= get_znear();
frustum.push_back(near);
Plane far = -near;
- far.distance += get_zfar();
+ far.d += get_zfar();
frustum.push_back(far);
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world_3d()->get_scenario());
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 15fbf19fdb..60329fb7bc 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -752,7 +752,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
value_editor[0]->set_text(String::num(plane.normal.x));
value_editor[1]->set_text(String::num(plane.normal.y));
value_editor[2]->set_text(String::num(plane.normal.z));
- value_editor[3]->set_text(String::num(plane.distance));
+ value_editor[3]->set_text(String::num(plane.d));
} break;
case Variant::QUAT: {
@@ -1598,7 +1598,7 @@ void CustomPropertyEditor::_modified(String p_string) {
pl.normal.x = _parse_real_expression(value_editor[0]->get_text());
pl.normal.y = _parse_real_expression(value_editor[1]->get_text());
pl.normal.z = _parse_real_expression(value_editor[2]->get_text());
- pl.distance = _parse_real_expression(value_editor[3]->get_text());
+ pl.d = _parse_real_expression(value_editor[3]->get_text());
v = pl;
_emit_changed_whole_or_field();
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index d0bebaad72..b6ef573b36 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -380,7 +380,7 @@ void test_vec(Plane p_vec) {
Plane v0 = cm.xform4(p_vec);
print_line("out: " + v0);
- v0.normal.z = (v0.distance / 100.0 * 2.0 - 1.0) * v0.distance;
+ v0.normal.z = (v0.d / 100.0 * 2.0 - 1.0) * v0.d;
print_line("out_F: " + v0);
}
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index f5932ac32d..5bcb4743c9 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -189,7 +189,7 @@ void PlaneShapeBullet::setup(const Plane &p_plane) {
btCollisionShape *PlaneShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
btVector3 btPlaneNormal;
G_TO_B(plane.normal, btPlaneNormal);
- return prepare(PlaneShapeBullet::create_shape_plane(btPlaneNormal, plane.distance));
+ return prepare(PlaneShapeBullet::create_shape_plane(btPlaneNormal, plane.d));
}
/* Sphere */
diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp
index 054673d9cc..17221fe081 100644
--- a/modules/gdnative/gdnative/plane.cpp
+++ b/modules/gdnative/gdnative/plane.cpp
@@ -37,10 +37,10 @@
extern "C" {
#endif
-void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_distance) {
+void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) {
Plane *dest = (Plane *)r_dest;
- *dest = Plane(p_a, p_b, p_c, p_distance);
+ *dest = Plane(p_a, p_b, p_c, p_d);
}
void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3) {
@@ -162,14 +162,14 @@ godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self) {
return *v3;
}
-godot_real GDAPI godot_plane_get_distance(const godot_plane *p_self) {
+godot_real GDAPI godot_plane_get_d(const godot_plane *p_self) {
const Plane *self = (const Plane *)p_self;
- return self->distance;
+ return self->d;
}
-void GDAPI godot_plane_set_distance(godot_plane *p_self, const godot_real p_distance) {
+void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d) {
Plane *self = (Plane *)p_self;
- self->distance = p_distance;
+ self->d = p_d;
}
#ifdef __cplusplus
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index c4b8098fc6..d5ab62dc61 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -3120,14 +3120,14 @@
]
},
{
- "name": "godot_plane_get_distance",
+ "name": "godot_plane_get_d",
"return_type": "godot_real",
"arguments": [
["const godot_plane *", "p_self"]
]
},
{
- "name": "godot_plane_set_distance",
+ "name": "godot_plane_set_d",
"return_type": "void",
"arguments": [
["godot_plane *", "p_self"],
diff --git a/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h
index 6bd28d7363..b759a8cc1a 100644
--- a/modules/gdnative/include/gdnative/plane.h
+++ b/modules/gdnative/include/gdnative/plane.h
@@ -92,9 +92,9 @@ void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_no
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self);
-godot_real GDAPI godot_plane_get_distance(const godot_plane *p_self);
+godot_real GDAPI godot_plane_get_d(const godot_plane *p_self);
-void GDAPI godot_plane_set_distance(godot_plane *p_self, const godot_real p_distance);
+void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d);
#ifdef __cplusplus
}
diff --git a/modules/gdnavigation/nav_map.cpp b/modules/gdnavigation/nav_map.cpp
index 9652938251..7e6a3f7a26 100644
--- a/modules/gdnavigation/nav_map.cpp
+++ b/modules/gdnavigation/nav_map.cpp
@@ -783,7 +783,7 @@ void NavMap::clip_path(const std::vector<gd::NavigationPoly> &p_navigation_polys
if (cut_plane.normal == Vector3())
return;
cut_plane.normal.normalize();
- cut_plane.distance = cut_plane.normal.dot(from);
+ cut_plane.d = cut_plane.normal.dot(from);
while (from_poly != p_to_poly) {
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index b0c2c75c19..9abbac6a0b 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -385,7 +385,7 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
Plane p;
p.normal[edit_axis] = 1.0;
- p.distance = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
+ p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
Vector3 inters;
if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_value(), &inters))
@@ -1137,7 +1137,7 @@ void GridMapEditor::_notification(int p_what) {
Plane p;
p.normal[edit_axis] = 1.0;
- p.distance = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
+ p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
p = node->get_transform().xform(p); // plane to snap
Node3DEditorPlugin *sep = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen());
diff --git a/modules/mono/build_scripts/godot_tools_build.py b/modules/mono/build_scripts/godot_tools_build.py
index 8e77f3bb44..7391e8790d 100644
--- a/modules/mono/build_scripts/godot_tools_build.py
+++ b/modules/mono/build_scripts/godot_tools_build.py
@@ -15,7 +15,7 @@ def build_godot_tools(source, target, env):
from .solution_builder import build_solution
- build_solution(env, solution_path, build_config, restore=True)
+ build_solution(env, solution_path, build_config)
# No need to copy targets. The GodotTools csproj takes care of copying them.
diff --git a/modules/mono/build_scripts/solution_builder.py b/modules/mono/build_scripts/solution_builder.py
index e8ddb7114e..371819fd72 100644
--- a/modules/mono/build_scripts/solution_builder.py
+++ b/modules/mono/build_scripts/solution_builder.py
@@ -4,7 +4,29 @@ import os
verbose = False
-def find_msbuild_unix(filename):
+def find_dotnet_cli():
+ import os.path
+
+ if os.name == "nt":
+ windows_exts = os.environ["PATHEXT"]
+ windows_exts = windows_exts.split(os.pathsep) if windows_exts else []
+
+ for hint_dir in os.environ["PATH"].split(os.pathsep):
+ hint_dir = hint_dir.strip('"')
+ hint_path = os.path.join(hint_dir, "dotnet")
+ if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
+ return hint_path
+ if os.path.isfile(hint_path + ".exe") and os.access(hint_path + ".exe", os.X_OK):
+ return hint_path + ".exe"
+ else:
+ for hint_dir in os.environ["PATH"].split(os.pathsep):
+ hint_dir = hint_dir.strip('"')
+ hint_path = os.path.join(hint_dir, "dotnet")
+ if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
+ return hint_path
+
+
+def find_msbuild_unix():
import os.path
import sys
@@ -86,15 +108,7 @@ def run_command(command, args, env_override=None, name=None):
raise RuntimeError("'%s' exited with error code: %s" % (name, e.returncode))
-def nuget_restore(env, *args):
- global verbose
- verbose = env["verbose"]
-
- # Do NuGet restore
- run_command(nuget_path, ["restore"] + list(args), name="nuget restore")
-
-
-def build_solution(env, solution_path, build_config, extra_msbuild_args=[], restore=False):
+def build_solution(env, solution_path, build_config, extra_msbuild_args=[]):
global verbose
verbose = env["verbose"]
@@ -104,27 +118,33 @@ def build_solution(env, solution_path, build_config, extra_msbuild_args=[], rest
if "PLATFORM" in msbuild_env:
del msbuild_env["PLATFORM"]
- # Find MSBuild
- if os.name == "nt":
- msbuild_info = find_msbuild_windows(env)
- if msbuild_info is None:
- raise RuntimeError("Cannot find MSBuild executable")
- msbuild_path = msbuild_info[0]
- msbuild_env.update(msbuild_info[1])
+ msbuild_args = []
+
+ dotnet_cli = find_dotnet_cli()
+
+ if dotnet_cli:
+ msbuild_path = dotnet_cli
+ msbuild_args += ["msbuild"] # `dotnet msbuild` command
else:
- msbuild_path = find_msbuild_unix("msbuild")
- if msbuild_path is None:
- raise RuntimeError("Cannot find MSBuild executable")
+ # Find MSBuild
+ if os.name == "nt":
+ msbuild_info = find_msbuild_windows(env)
+ if msbuild_info is None:
+ raise RuntimeError("Cannot find MSBuild executable")
+ msbuild_path = msbuild_info[0]
+ msbuild_env.update(msbuild_info[1])
+ else:
+ msbuild_path = find_msbuild_unix()
+ if msbuild_path is None:
+ raise RuntimeError("Cannot find MSBuild executable")
print("MSBuild path: " + msbuild_path)
# Build solution
- targets = ["Build"]
- if restore:
- targets.insert(0, "Restore")
+ targets = ["Restore", "Build"]
- msbuild_args = [solution_path, "/t:%s" % ",".join(targets), "/p:Configuration=" + build_config]
+ msbuild_args += [solution_path, "/t:%s" % ",".join(targets), "/p:Configuration=" + build_config]
msbuild_args += extra_msbuild_args
run_command(msbuild_path, msbuild_args, env_override=msbuild_env, name="msbuild")
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 6c1c8b87ef..7d00d2d314 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -2421,58 +2421,68 @@ void CSharpScript::_update_member_info_no_exports() {
bool CSharpScript::_update_exports() {
#ifdef TOOLS_ENABLED
- if (!Engine::get_singleton()->is_editor_hint())
- return false;
-
- placeholder_fallback_enabled = true; // until proven otherwise
-
+ bool is_editor = Engine::get_singleton()->is_editor_hint();
+ if (is_editor)
+ placeholder_fallback_enabled = true; // until proven otherwise
+#endif
if (!valid)
return false;
bool changed = false;
- if (exports_invalidated) {
+#ifdef TOOLS_ENABLED
+ if (exports_invalidated)
+#endif
+ {
GD_MONO_SCOPE_THREAD_ATTACH;
- exports_invalidated = false;
-
changed = true;
member_info.clear();
- exported_members_cache.clear();
- exported_members_defval_cache.clear();
- // Here we create a temporary managed instance of the class to get the initial values
+#ifdef TOOLS_ENABLED
+ MonoObject *tmp_object = nullptr;
+ Object *tmp_native = nullptr;
+ uint32_t tmp_pinned_gchandle = 0;
- MonoObject *tmp_object = mono_object_new(mono_domain_get(), script_class->get_mono_ptr());
+ if (is_editor) {
+ exports_invalidated = false;
- if (!tmp_object) {
- ERR_PRINT("Failed to allocate temporary MonoObject.");
- return false;
- }
+ exported_members_cache.clear();
+ exported_members_defval_cache.clear();
- uint32_t tmp_pinned_gchandle = GDMonoUtils::new_strong_gchandle_pinned(tmp_object); // pin it (not sure if needed)
+ // Here we create a temporary managed instance of the class to get the initial values
+ tmp_object = mono_object_new(mono_domain_get(), script_class->get_mono_ptr());
- GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
+ if (!tmp_object) {
+ ERR_PRINT("Failed to allocate temporary MonoObject.");
+ return false;
+ }
- ERR_FAIL_NULL_V_MSG(ctor, false,
- "Cannot construct temporary MonoObject because the class does not define a parameterless constructor: '" + get_path() + "'.");
+ tmp_pinned_gchandle = GDMonoUtils::new_strong_gchandle_pinned(tmp_object); // pin it (not sure if needed)
- MonoException *ctor_exc = nullptr;
- ctor->invoke(tmp_object, nullptr, &ctor_exc);
+ GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
- Object *tmp_native = GDMonoMarshal::unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(tmp_object));
+ ERR_FAIL_NULL_V_MSG(ctor, false,
+ "Cannot construct temporary MonoObject because the class does not define a parameterless constructor: '" + get_path() + "'.");
- if (ctor_exc) {
- // TODO: Should we free 'tmp_native' if the exception was thrown after its creation?
+ MonoException *ctor_exc = nullptr;
+ ctor->invoke(tmp_object, nullptr, &ctor_exc);
- GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
- tmp_object = nullptr;
+ tmp_native = GDMonoMarshal::unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(tmp_object));
- ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
- GDMonoUtils::debug_print_unhandled_exception(ctor_exc);
- return false;
+ if (ctor_exc) {
+ // TODO: Should we free 'tmp_native' if the exception was thrown after its creation?
+
+ GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
+ tmp_object = nullptr;
+
+ ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
+ GDMonoUtils::debug_print_unhandled_exception(ctor_exc);
+ return false;
+ }
}
+#endif
GDMonoClass *top = script_class;
@@ -2488,16 +2498,16 @@ bool CSharpScript::_update_exports() {
if (_get_member_export(field, /* inspect export: */ true, prop_info, exported)) {
StringName member_name = field->get_name();
- if (exported) {
- member_info[member_name] = prop_info;
+ member_info[member_name] = prop_info;
+#ifdef TOOLS_ENABLED
+ if (is_editor && exported) {
exported_members_cache.push_front(prop_info);
if (tmp_object) {
exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
}
- } else {
- member_info[member_name] = prop_info;
}
+#endif
}
}
@@ -2509,10 +2519,10 @@ bool CSharpScript::_update_exports() {
if (_get_member_export(property, /* inspect export: */ true, prop_info, exported)) {
StringName member_name = property->get_name();
- if (exported) {
- member_info[member_name] = prop_info;
+ member_info[member_name] = prop_info;
+#ifdef TOOLS_ENABLED
+ if (is_editor && exported) {
exported_members_cache.push_front(prop_info);
-
if (tmp_object) {
MonoException *exc = nullptr;
MonoObject *ret = property->get_value(tmp_object, &exc);
@@ -2523,57 +2533,62 @@ bool CSharpScript::_update_exports() {
exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(ret);
}
}
- } else {
- member_info[member_name] = prop_info;
}
+#endif
}
}
top = top->get_parent_class();
}
- // Need to check this here, before disposal
- bool base_ref = Object::cast_to<Reference>(tmp_native) != nullptr;
+#ifdef TOOLS_ENABLED
+ if (is_editor) {
+ // Need to check this here, before disposal
+ bool base_ref = Object::cast_to<Reference>(tmp_native) != nullptr;
- // Dispose the temporary managed instance
+ // Dispose the temporary managed instance
- MonoException *exc = nullptr;
- GDMonoUtils::dispose(tmp_object, &exc);
+ MonoException *exc = nullptr;
+ GDMonoUtils::dispose(tmp_object, &exc);
- if (exc) {
- ERR_PRINT("Exception thrown from method Dispose() of temporary MonoObject:");
- GDMonoUtils::debug_print_unhandled_exception(exc);
- }
+ if (exc) {
+ ERR_PRINT("Exception thrown from method Dispose() of temporary MonoObject:");
+ GDMonoUtils::debug_print_unhandled_exception(exc);
+ }
- GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
- tmp_object = nullptr;
+ GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
+ tmp_object = nullptr;
- if (tmp_native && !base_ref) {
- Node *node = Object::cast_to<Node>(tmp_native);
- if (node && node->is_inside_tree()) {
- ERR_PRINT("Temporary instance was added to the scene tree.");
- } else {
- memdelete(tmp_native);
+ if (tmp_native && !base_ref) {
+ Node *node = Object::cast_to<Node>(tmp_native);
+ if (node && node->is_inside_tree()) {
+ ERR_PRINT("Temporary instance was added to the scene tree.");
+ } else {
+ memdelete(tmp_native);
+ }
}
}
+#endif
}
- placeholder_fallback_enabled = false;
+#ifdef TOOLS_ENABLED
+ if (is_editor) {
+ placeholder_fallback_enabled = false;
- if (placeholders.size()) {
- // Update placeholders if any
- Map<StringName, Variant> values;
- List<PropertyInfo> propnames;
- _update_exports_values(values, propnames);
+ if (placeholders.size()) {
+ // Update placeholders if any
+ Map<StringName, Variant> values;
+ List<PropertyInfo> propnames;
+ _update_exports_values(values, propnames);
- for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(propnames, values);
+ for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
+ E->get()->update(propnames, values);
+ }
}
}
+#endif
return changed;
-#endif
- return false;
}
void CSharpScript::load_script_signals(GDMonoClass *p_class, GDMonoClass *p_native_class) {
@@ -2679,7 +2694,6 @@ bool CSharpScript::_get_signal(GDMonoClass *p_class, GDMonoMethod *p_delegate_in
return true;
}
-#ifdef TOOLS_ENABLED
/**
* Returns false if there was an error, otherwise true.
* If there was an error, r_prop_info and r_exported are not assigned any value.
@@ -2693,8 +2707,10 @@ bool CSharpScript::_get_member_export(IMonoClassMember *p_member, bool p_inspect
(m_member->get_enclosing_class()->get_full_name() + "." + (String)m_member->get_name())
if (p_member->is_static()) {
+#ifdef TOOLS_ENABLED
if (p_member->has_attribute(CACHED_CLASS(ExportAttribute)))
ERR_PRINT("Cannot export member because it is static: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'.");
+#endif
return false;
}
@@ -2716,13 +2732,17 @@ bool CSharpScript::_get_member_export(IMonoClassMember *p_member, bool p_inspect
if (p_member->get_member_type() == IMonoClassMember::MEMBER_TYPE_PROPERTY) {
GDMonoProperty *property = static_cast<GDMonoProperty *>(p_member);
if (!property->has_getter()) {
+#ifdef TOOLS_ENABLED
if (exported)
ERR_PRINT("Read-only property cannot be exported: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'.");
+#endif
return false;
}
if (!property->has_setter()) {
+#ifdef TOOLS_ENABLED
if (exported)
ERR_PRINT("Write-only property (without getter) cannot be exported: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'.");
+#endif
return false;
}
}
@@ -2742,10 +2762,13 @@ bool CSharpScript::_get_member_export(IMonoClassMember *p_member, bool p_inspect
String hint_string;
if (variant_type == Variant::NIL && !nil_is_variant) {
+#ifdef TOOLS_ENABLED
ERR_PRINT("Unknown exported member type: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'.");
+#endif
return false;
}
+#ifdef TOOLS_ENABLED
int hint_res = _try_get_member_export_hint(p_member, type, variant_type, /* allow_generics: */ true, hint, hint_string);
ERR_FAIL_COND_V_MSG(hint_res == -1, false,
@@ -2756,6 +2779,7 @@ bool CSharpScript::_get_member_export(IMonoClassMember *p_member, bool p_inspect
hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr));
hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr);
}
+#endif
uint32_t prop_usage = PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE;
@@ -2772,6 +2796,7 @@ bool CSharpScript::_get_member_export(IMonoClassMember *p_member, bool p_inspect
#undef MEMBER_FULL_QUALIFIED_NAME
}
+#ifdef TOOLS_ENABLED
int CSharpScript::_try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string) {
if (p_variant_type == Variant::NIL) {
@@ -3542,10 +3567,15 @@ bool CSharpScript::inherits_script(const Ref<Script> &p_script) const {
return false;
}
-#ifndef _MSC_VER
-#warning TODO: Implement CSharpScript::inherits_script and other relevant changes after GH-38063.
-#endif
- return false;
+ if (script_class == nullptr || cs->script_class == nullptr) {
+ return false;
+ }
+
+ if (script_class == cs->script_class) {
+ return true;
+ }
+
+ return cs->script_class->is_assignable_from(script_class);
}
Ref<Script> CSharpScript::get_base_script() const {
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 05e2857538..c9ea482c36 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -147,8 +147,9 @@ private:
bool _get_signal(GDMonoClass *p_class, GDMonoMethod *p_delegate_invoke, Vector<SignalParameter> &params);
bool _update_exports();
-#ifdef TOOLS_ENABLED
+
bool _get_member_export(IMonoClassMember *p_member, bool p_inspect_export, PropertyInfo &r_prop_info, bool &r_exported);
+#ifdef TOOLS_ENABLED
static int _try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string);
#endif
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj
index 3bb136e374..9cb50014b0 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj
@@ -6,18 +6,18 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="16.5.0" />
- <PackageReference Include="Microsoft.Build.Runtime" Version="16.5.0" />
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GodotTools.Core\GodotTools.Core.csproj" />
</ItemGroup>
- <PropertyGroup>
+ <ItemGroup>
<!--
- The 'Microsoft.Build.Runtime' package includes an mscorlib reference assembly in contentFiles.
- This causes our project build to fail. As a workaround, we remove {CandidateAssemblyFiles}
- from AssemblySearchPaths as described here: https://github.com/microsoft/msbuild/issues/3486.
+ The Microsoft.Build.Runtime package is too problematic so we create a MSBuild.exe stub. The workaround described
+ here doesn't work with Microsoft.NETFramework.ReferenceAssemblies: https://github.com/microsoft/msbuild/issues/3486
+ We need a MSBuild.exe file as there's an issue in Microsoft.Build where it executes platform dependent code when
+ searching for MSBuild.exe before the fallback to not using it. A stub is fine as it should never be executed.
-->
- <AssemblySearchPaths>$([System.String]::Copy('$(AssemblySearchPaths)').Replace('{CandidateAssemblyFiles}', ''))</AssemblySearchPaths>
- <AssemblySearchPaths Condition=" '$(MSBuildRuntimeVersion)' != '' ">$(AssemblySearchPaths.Split(';'))</AssemblySearchPaths>
- </PropertyGroup>
+ <None Include="MSBuild.exe" CopyToOutputDirectory="Always" />
+ </ItemGroup>
</Project>
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
index cbe3afaedd..fb2beb6995 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs
@@ -125,6 +125,12 @@ namespace GodotTools.ProjectEditor
// References
var referenceGroup = root.AddItemGroup();
referenceGroup.AddItem("Reference", "System");
+ var frameworkRefAssembliesItem = referenceGroup.AddItem("PackageReference", "Microsoft.NETFramework.ReferenceAssemblies");
+
+ // Use metadata (child nodes) instead of attributes for the PackageReference.
+ // This is for compatibility with 3.2, where GodotTools uses an old Microsoft.Build.
+ frameworkRefAssembliesItem.AddMetadata("Version", "1.0.0");
+ frameworkRefAssembliesItem.AddMetadata("PrivateAssets", "All");
root.AddImport(Path.Combine("$(MSBuildBinPath)", "Microsoft.CSharp.targets").Replace("/", "\\"));
diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs
index a0356d0f49..069a1edaa3 100644
--- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs
@@ -173,7 +173,7 @@ namespace GodotTools.ProjectEditor
void AddPropertyIfNotPresent(string name, string condition, string value)
{
if (root.PropertyGroups
- .Any(g => (g.Condition == string.Empty || g.Condition.Trim() == condition) &&
+ .Any(g => (string.IsNullOrEmpty(g.Condition) || g.Condition.Trim() == condition) &&
g.Properties
.Any(p => p.Name == name &&
p.Value == value &&
@@ -264,7 +264,7 @@ namespace GodotTools.ProjectEditor
bool hasGodotProjectGeneratorVersion = false;
bool foundOldConfiguration = false;
- foreach (var propertyGroup in root.PropertyGroups.Where(g => g.Condition == string.Empty))
+ foreach (var propertyGroup in root.PropertyGroups.Where(g => string.IsNullOrEmpty(g.Condition)))
{
if (!hasGodotProjectGeneratorVersion && propertyGroup.Properties.Any(p => p.Name == "GodotProjectGeneratorVersion"))
hasGodotProjectGeneratorVersion = true;
@@ -280,7 +280,7 @@ namespace GodotTools.ProjectEditor
if (!hasGodotProjectGeneratorVersion)
{
- root.PropertyGroups.First(g => g.Condition == string.Empty)?
+ root.PropertyGroups.First(g => string.IsNullOrEmpty(g.Condition))?
.AddProperty("GodotProjectGeneratorVersion", Assembly.GetExecutingAssembly().GetName().Version.ToString());
project.HasUnsavedChanges = true;
}
@@ -348,5 +348,25 @@ namespace GodotTools.ProjectEditor
MigrateConfigurationConditions("Tools", "Debug"); // Must be last
}
}
+
+ public static void EnsureHasNugetNetFrameworkRefAssemblies(MSBuildProject project)
+ {
+ var root = project.Root;
+
+ bool found = root.ItemGroups.Any(g => string.IsNullOrEmpty(g.Condition) && g.Items.Any(
+ item => item.ItemType == "PackageReference" && item.Include == "Microsoft.NETFramework.ReferenceAssemblies"));
+
+ if (found)
+ return;
+
+ var frameworkRefAssembliesItem = root.AddItem("PackageReference", "Microsoft.NETFramework.ReferenceAssemblies");
+
+ // Use metadata (child nodes) instead of attributes for the PackageReference.
+ // This is for compatibility with 3.2, where GodotTools uses an old Microsoft.Build.
+ frameworkRefAssembliesItem.AddMetadata("Version", "1.0.0");
+ frameworkRefAssembliesItem.AddMetadata("PrivateAssets", "All");
+
+ project.HasUnsavedChanges = true;
+ }
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
index f4cda3e522..e55558c100 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
@@ -14,16 +14,6 @@ namespace GodotTools.Build
{
public static class BuildSystem
{
- private static string GetMsBuildPath()
- {
- string msbuildPath = MsBuildFinder.FindMsBuild();
-
- if (msbuildPath == null)
- throw new FileNotFoundException("Cannot find the MSBuild executable.");
-
- return msbuildPath;
- }
-
private static string MonoWindowsBinDir
{
get
@@ -46,8 +36,8 @@ namespace GodotTools.Build
{
if (OS.IsWindows)
{
- return (BuildManager.BuildTool)EditorSettings.GetSetting("mono/builds/build_tool")
- == BuildManager.BuildTool.MsBuildMono;
+ return (BuildTool)EditorSettings.GetSetting("mono/builds/build_tool")
+ == BuildTool.MsBuildMono;
}
return false;
@@ -57,16 +47,21 @@ namespace GodotTools.Build
private static bool PrintBuildOutput =>
(bool)EditorSettings.GetSetting("mono/builds/print_build_output");
- private static Process LaunchBuild(string solution, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
+ private static Process LaunchBuild(string solution, IEnumerable<string> targets, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
{
+ (string msbuildPath, BuildTool buildTool) = MsBuildFinder.FindMsBuild();
+
+ if (msbuildPath == null)
+ throw new FileNotFoundException("Cannot find the MSBuild executable.");
+
var customPropertiesList = new List<string>();
if (customProperties != null)
customPropertiesList.AddRange(customProperties);
- string compilerArgs = BuildArguments(solution, config, loggerOutputDir, customPropertiesList);
+ string compilerArgs = BuildArguments(buildTool, solution, targets, config, loggerOutputDir, customPropertiesList);
- var startInfo = new ProcessStartInfo(GetMsBuildPath(), compilerArgs);
+ var startInfo = new ProcessStartInfo(msbuildPath, compilerArgs);
bool redirectOutput = !IsDebugMsBuildRequested() && !PrintBuildOutput;
@@ -90,7 +85,7 @@ namespace GodotTools.Build
// Needed when running from Developer Command Prompt for VS
RemovePlatformVariable(startInfo.EnvironmentVariables);
- var process = new Process { StartInfo = startInfo };
+ var process = new Process {StartInfo = startInfo};
process.Start();
@@ -105,19 +100,19 @@ namespace GodotTools.Build
public static int Build(BuildInfo buildInfo)
{
- return Build(buildInfo.Solution, buildInfo.Configuration,
+ return Build(buildInfo.Solution, buildInfo.Targets, buildInfo.Configuration,
buildInfo.LogsDirPath, buildInfo.CustomProperties);
}
public static Task<int> BuildAsync(BuildInfo buildInfo)
{
- return BuildAsync(buildInfo.Solution, buildInfo.Configuration,
+ return BuildAsync(buildInfo.Solution, buildInfo.Targets, buildInfo.Configuration,
buildInfo.LogsDirPath, buildInfo.CustomProperties);
}
- public static int Build(string solution, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
+ public static int Build(string solution, string[] targets, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
{
- using (var process = LaunchBuild(solution, config, loggerOutputDir, customProperties))
+ using (var process = LaunchBuild(solution, targets, config, loggerOutputDir, customProperties))
{
process.WaitForExit();
@@ -125,9 +120,9 @@ namespace GodotTools.Build
}
}
- public static async Task<int> BuildAsync(string solution, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
+ public static async Task<int> BuildAsync(string solution, IEnumerable<string> targets, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
{
- using (var process = LaunchBuild(solution, config, loggerOutputDir, customProperties))
+ using (var process = LaunchBuild(solution, targets, config, loggerOutputDir, customProperties))
{
await process.WaitForExitAsync();
@@ -135,10 +130,15 @@ namespace GodotTools.Build
}
}
- private static string BuildArguments(string solution, string config, string loggerOutputDir, List<string> customProperties)
+ private static string BuildArguments(BuildTool buildTool, string solution, IEnumerable<string> targets, string config, string loggerOutputDir, IEnumerable<string> customProperties)
{
- string arguments = $@"""{solution}"" /v:normal /t:Build ""/p:{"Configuration=" + config}"" " +
- $@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{loggerOutputDir}""";
+ string arguments = string.Empty;
+
+ if (buildTool == BuildTool.DotnetCli)
+ arguments += "msbuild "; // `dotnet msbuild` command
+
+ arguments += $@"""{solution}"" /v:normal /t:{string.Join(",", targets)} ""/p:{"Configuration=" + config}"" " +
+ $@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{loggerOutputDir}""";
foreach (string customProperty in customProperties)
{
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildTool.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildTool.cs
new file mode 100644
index 0000000000..a1a69334e3
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildTool.cs
@@ -0,0 +1,10 @@
+namespace GodotTools.Build
+{
+ public enum BuildTool
+ {
+ MsBuildMono,
+ MsBuildVs,
+ JetBrainsMsBuild,
+ DotnetCli
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
index 73de09c116..f36e581a5f 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
@@ -17,16 +17,24 @@ namespace GodotTools.Build
private static string _msbuildToolsPath = string.Empty;
private static string _msbuildUnixPath = string.Empty;
- public static string FindMsBuild()
+ public static (string, BuildTool) FindMsBuild()
{
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
- var buildTool = (BuildManager.BuildTool)editorSettings.GetSetting("mono/builds/build_tool");
+ var buildTool = (BuildTool)editorSettings.GetSetting("mono/builds/build_tool");
if (OS.IsWindows)
{
switch (buildTool)
{
- case BuildManager.BuildTool.MsBuildVs:
+ case BuildTool.DotnetCli:
+ {
+ string dotnetCliPath = OS.PathWhich("dotnet");
+ if (!string.IsNullOrEmpty(dotnetCliPath))
+ return (dotnetCliPath, BuildTool.DotnetCli);
+ GD.PushError("Cannot find dotnet CLI executable. Fallback to MSBuild from Visual Studio.");
+ goto case BuildTool.MsBuildVs;
+ }
+ case BuildTool.MsBuildVs:
{
if (string.IsNullOrEmpty(_msbuildToolsPath) || !File.Exists(_msbuildToolsPath))
{
@@ -40,18 +48,18 @@ namespace GodotTools.Build
if (!_msbuildToolsPath.EndsWith("\\"))
_msbuildToolsPath += "\\";
- return Path.Combine(_msbuildToolsPath, "MSBuild.exe");
+ return (Path.Combine(_msbuildToolsPath, "MSBuild.exe"), BuildTool.MsBuildVs);
}
- case BuildManager.BuildTool.MsBuildMono:
+ case BuildTool.MsBuildMono:
{
string msbuildPath = Path.Combine(Internal.MonoWindowsInstallRoot, "bin", "msbuild.bat");
if (!File.Exists(msbuildPath))
throw new FileNotFoundException($"Cannot find executable for '{BuildManager.PropNameMSBuildMono}'. Tried with path: {msbuildPath}");
- return msbuildPath;
+ return (msbuildPath, BuildTool.MsBuildMono);
}
- case BuildManager.BuildTool.JetBrainsMsBuild:
+ case BuildTool.JetBrainsMsBuild:
{
var editorPath = (string)editorSettings.GetSetting(RiderPathManager.EditorPathSettingName);
@@ -65,7 +73,7 @@ namespace GodotTools.Build
if (!File.Exists(msbuildPath))
throw new FileNotFoundException($"Cannot find executable for '{BuildManager.PropNameMSBuildJetBrains}'. Tried with path: {msbuildPath}");
- return msbuildPath;
+ return (msbuildPath, BuildTool.JetBrainsMsBuild);
}
default:
throw new IndexOutOfRangeException("Invalid build tool in editor settings");
@@ -74,21 +82,32 @@ namespace GodotTools.Build
if (OS.IsUnixLike)
{
- if (buildTool == BuildManager.BuildTool.MsBuildMono)
+ switch (buildTool)
{
- if (string.IsNullOrEmpty(_msbuildUnixPath) || !File.Exists(_msbuildUnixPath))
+ case BuildTool.DotnetCli:
{
- // Try to search it again if it wasn't found last time or if it was removed from its location
- _msbuildUnixPath = FindBuildEngineOnUnix("msbuild");
+ string dotnetCliPath = OS.PathWhich("dotnet");
+ if (!string.IsNullOrEmpty(dotnetCliPath))
+ return (dotnetCliPath, BuildTool.DotnetCli);
+ GD.PushError("Cannot find dotnet CLI executable. Fallback to MSBuild from Mono.");
+ goto case BuildTool.MsBuildMono;
}
+ case BuildTool.MsBuildMono:
+ {
+ if (string.IsNullOrEmpty(_msbuildUnixPath) || !File.Exists(_msbuildUnixPath))
+ {
+ // Try to search it again if it wasn't found last time or if it was removed from its location
+ _msbuildUnixPath = FindBuildEngineOnUnix("msbuild");
+ }
- if (string.IsNullOrEmpty(_msbuildUnixPath))
- throw new FileNotFoundException($"Cannot find binary for '{BuildManager.PropNameMSBuildMono}'");
+ if (string.IsNullOrEmpty(_msbuildUnixPath))
+ throw new FileNotFoundException($"Cannot find binary for '{BuildManager.PropNameMSBuildMono}'");
- return _msbuildUnixPath;
+ return (_msbuildUnixPath, BuildTool.MsBuildMono);
+ }
+ default:
+ throw new IndexOutOfRangeException("Invalid build tool in editor settings");
}
-
- throw new IndexOutOfRangeException("Invalid build tool in editor settings");
}
throw new PlatformNotSupportedException();
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs
index 70bd552f2f..cca0983c01 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs
@@ -10,6 +10,7 @@ namespace GodotTools
public sealed class BuildInfo : Reference // TODO Remove Reference once we have proper serialization
{
public string Solution { get; }
+ public string[] Targets { get; }
public string Configuration { get; }
public Array<string> CustomProperties { get; } = new Array<string>(); // TODO Use List once we have proper serialization
@@ -38,9 +39,10 @@ namespace GodotTools
{
}
- public BuildInfo(string solution, string configuration)
+ public BuildInfo(string solution, string[] targets, string configuration)
{
Solution = solution;
+ Targets = targets;
Configuration = configuration;
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
index 2d1b873808..598787ba03 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
@@ -18,17 +18,11 @@ namespace GodotTools
public const string PropNameMSBuildMono = "MSBuild (Mono)";
public const string PropNameMSBuildVs = "MSBuild (VS Build Tools)";
public const string PropNameMSBuildJetBrains = "MSBuild (JetBrains Rider)";
+ public const string PropNameDotnetCli = "dotnet CLI";
public const string MsBuildIssuesFileName = "msbuild_issues.csv";
public const string MsBuildLogFileName = "msbuild_log.txt";
- public enum BuildTool
- {
- MsBuildMono,
- MsBuildVs,
- JetBrainsMsBuild
- }
-
private static void RemoveOldIssuesFile(BuildInfo buildInfo)
{
var issuesFile = GetIssuesFilePath(buildInfo);
@@ -181,10 +175,12 @@ namespace GodotTools
{
pr.Step("Building project solution", 0);
- var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, config);
+ var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, targets: new[] {"Restore", "Build"}, config);
+
+ bool escapeNeedsDoubleBackslash = buildTool == BuildTool.MsBuildMono || buildTool == BuildTool.DotnetCli;
// Add Godot defines
- string constants = buildTool != BuildTool.MsBuildMono ? "GodotDefineConstants=\"" : "GodotDefineConstants=\\\"";
+ string constants = !escapeNeedsDoubleBackslash ? "GodotDefineConstants=\"" : "GodotDefineConstants=\\\"";
foreach (var godotDefine in godotDefines)
constants += $"GODOT_{godotDefine.ToUpper().Replace("-", "_").Replace(" ", "_").Replace(";", "_")};";
@@ -192,7 +188,7 @@ namespace GodotTools
if (Internal.GodotIsRealTDouble())
constants += "GODOT_REAL_T_IS_DOUBLE;";
- constants += buildTool != BuildTool.MsBuildMono ? "\"" : "\\\"";
+ constants += !escapeNeedsDoubleBackslash ? "\"" : "\\\"";
buildInfo.CustomProperties.Add(constants);
@@ -250,20 +246,44 @@ namespace GodotTools
{
// Build tool settings
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
- var msbuild = BuildTool.MsBuildMono;
+
+ BuildTool msbuildDefault;
+
if (OS.IsWindows)
- msbuild = RiderPathManager.IsExternalEditorSetToRider(editorSettings) ? BuildTool.JetBrainsMsBuild : BuildTool.MsBuildVs;
+ {
+ if (RiderPathManager.IsExternalEditorSetToRider(editorSettings))
+ msbuildDefault = BuildTool.JetBrainsMsBuild;
+ else
+ msbuildDefault = !string.IsNullOrEmpty(OS.PathWhich("dotnet")) ? BuildTool.DotnetCli : BuildTool.MsBuildVs;
+ }
+ else
+ {
+ msbuildDefault = !string.IsNullOrEmpty(OS.PathWhich("dotnet")) ? BuildTool.DotnetCli : BuildTool.MsBuildMono;
+ }
+
+ EditorDef("mono/builds/build_tool", msbuildDefault);
- EditorDef("mono/builds/build_tool", msbuild);
+ string hintString;
+
+ if (OS.IsWindows)
+ {
+ hintString = $"{PropNameMSBuildMono}:{(int)BuildTool.MsBuildMono}," +
+ $"{PropNameMSBuildVs}:{(int)BuildTool.MsBuildVs}," +
+ $"{PropNameMSBuildJetBrains}:{(int)BuildTool.JetBrainsMsBuild}," +
+ $"{PropNameDotnetCli}:{(int)BuildTool.DotnetCli}";
+ }
+ else
+ {
+ hintString = $"{PropNameMSBuildMono}:{(int)BuildTool.MsBuildMono}," +
+ $"{PropNameDotnetCli}:{(int)BuildTool.DotnetCli}";
+ }
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
{
["type"] = Godot.Variant.Type.Int,
["name"] = "mono/builds/build_tool",
["hint"] = Godot.PropertyHint.Enum,
- ["hint_string"] = OS.IsWindows ?
- $"{PropNameMSBuildMono},{PropNameMSBuildVs},{PropNameMSBuildJetBrains}" :
- $"{PropNameMSBuildMono}"
+ ["hint_string"] = hintString
});
EditorDef("mono/builds/print_build_output", false);
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index ec3cae00d5..eb7696685f 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -461,6 +461,9 @@ namespace GodotTools
// Make sure the existing project has Api assembly references configured correctly
ProjectUtils.FixApiHintPath(msbuildProject);
+ // Make sure the existing project references the Microsoft.NETFramework.ReferenceAssemblies nuget package
+ ProjectUtils.EnsureHasNugetNetFrameworkRefAssemblies(msbuildProject);
+
if (msbuildProject.HasUnsavedChanges)
{
// Save a copy of the project before replacing it
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
index 6857663a4c..ba527ca3b5 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
@@ -17,6 +17,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3.0" ExcludeAssets="runtime" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<Reference Include="GodotSharp">
<HintPath>$(GodotApiAssembliesDir)/GodotSharp.dll</HintPath>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 55a83642fd..885845e3a4 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
@@ -56,29 +56,29 @@ namespace Godot
}
}
- public real_t Distance { get; set; }
+ public real_t D { get; set; }
public Vector3 Center
{
get
{
- return _normal * Distance;
+ return _normal * D;
}
}
public real_t DistanceTo(Vector3 point)
{
- return _normal.Dot(point) - Distance;
+ return _normal.Dot(point) - D;
}
public Vector3 GetAnyPoint()
{
- return _normal * Distance;
+ return _normal * D;
}
public bool HasPoint(Vector3 point, real_t epsilon = Mathf.Epsilon)
{
- real_t dist = _normal.Dot(point) - Distance;
+ real_t dist = _normal.Dot(point) - D;
return Mathf.Abs(dist) <= epsilon;
}
@@ -89,9 +89,9 @@ namespace Godot
if (Mathf.IsZeroApprox(denom))
return null;
- Vector3 result = b._normal.Cross(c._normal) * Distance +
- c._normal.Cross(_normal) * b.Distance +
- _normal.Cross(b._normal) * c.Distance;
+ Vector3 result = b._normal.Cross(c._normal) * D +
+ c._normal.Cross(_normal) * b.D +
+ _normal.Cross(b._normal) * c.D;
return result / denom;
}
@@ -103,7 +103,7 @@ namespace Godot
if (Mathf.IsZeroApprox(den))
return null;
- real_t dist = (_normal.Dot(from) - Distance) / den;
+ real_t dist = (_normal.Dot(from) - D) / den;
// This is a ray, before the emitting pos (from) does not exist
if (dist > Mathf.Epsilon)
@@ -120,7 +120,7 @@ namespace Godot
if (Mathf.IsZeroApprox(den))
return null;
- real_t dist = (_normal.Dot(begin) - Distance) / den;
+ real_t dist = (_normal.Dot(begin) - D) / den;
// Only allow dist to be in the range of 0 to 1, with tolerance.
if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon)
@@ -131,7 +131,7 @@ namespace Godot
public bool IsPointOver(Vector3 point)
{
- return _normal.Dot(point) > Distance;
+ return _normal.Dot(point) > D;
}
public Plane Normalized()
@@ -141,7 +141,7 @@ namespace Godot
if (len == 0)
return new Plane(0, 0, 0, 0);
- return new Plane(_normal / len, Distance / len);
+ return new Plane(_normal / len, D / len);
}
public Vector3 Project(Vector3 point)
@@ -159,27 +159,27 @@ namespace Godot
public static Plane PlaneXY { get { return _planeXY; } }
// Constructors
- public Plane(real_t a, real_t b, real_t c, real_t distance)
+ public Plane(real_t a, real_t b, real_t c, real_t d)
{
_normal = new Vector3(a, b, c);
- this.Distance = distance;
+ this.D = d;
}
- public Plane(Vector3 normal, real_t distance)
+ public Plane(Vector3 normal, real_t d)
{
this._normal = normal;
- this.Distance = distance;
+ this.D = d;
}
public Plane(Vector3 v1, Vector3 v2, Vector3 v3)
{
_normal = (v1 - v3).Cross(v1 - v2);
_normal.Normalize();
- Distance = _normal.Dot(v1);
+ D = _normal.Dot(v1);
}
public static Plane operator -(Plane plane)
{
- return new Plane(-plane._normal, -plane.Distance);
+ return new Plane(-plane._normal, -plane.D);
}
public static bool operator ==(Plane left, Plane right)
@@ -204,17 +204,17 @@ namespace Godot
public bool Equals(Plane other)
{
- return _normal == other._normal && Distance == other.Distance;
+ return _normal == other._normal && D == other.D;
}
public bool IsEqualApprox(Plane other)
{
- return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(Distance, other.Distance);
+ return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(D, other.D);
}
public override int GetHashCode()
{
- return _normal.GetHashCode() ^ Distance.GetHashCode();
+ return _normal.GetHashCode() ^ D.GetHashCode();
}
public override string ToString()
@@ -222,7 +222,7 @@ namespace Godot
return String.Format("({0}, {1})", new object[]
{
_normal.ToString(),
- Distance.ToString()
+ D.ToString()
});
}
@@ -231,7 +231,7 @@ namespace Godot
return String.Format("({0}, {1})", new object[]
{
_normal.ToString(format),
- Distance.ToString(format)
+ D.ToString(format)
});
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
index ba0bbd7630..b5ac124c9a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
+++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
@@ -30,6 +30,7 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
diff --git a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
index 22853797c1..8785931312 100644
--- a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
+++ b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj
@@ -30,6 +30,7 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index fd645f1608..f2d887e6d6 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -274,7 +274,7 @@ enum {
MATCHES_Plane = (MATCHES_Vector3 && MATCHES_real_t && (sizeof(Plane) == (sizeof(Vector3) + sizeof(real_t))) &&
offsetof(Plane, normal) == 0 &&
- offsetof(Plane, distance) == sizeof(Vector3))
+ offsetof(Plane, d) == sizeof(Vector3))
};
// In the future we may force this if we want to ref return these structs
@@ -466,14 +466,14 @@ struct M_Color {
struct M_Plane {
M_Vector3 normal;
- real_t distance;
+ real_t d;
static _FORCE_INLINE_ Plane convert_to(const M_Plane &p_from) {
- return Plane(M_Vector3::convert_to(p_from.normal), p_from.distance);
+ return Plane(M_Vector3::convert_to(p_from.normal), p_from.d);
}
static _FORCE_INLINE_ M_Plane convert_from(const Plane &p_from) {
- M_Plane ret = { M_Vector3::convert_from(p_from.normal), p_from.distance };
+ M_Plane ret = { M_Vector3::convert_from(p_from.normal), p_from.d };
return ret;
}
};
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index c374dd5faa..780d08693d 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -248,10 +248,19 @@ void VisibilityEnabler2D::_notification(int p_what) {
_find_nodes(from);
- if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent())
- get_parent()->set_physics_process(false);
- if (enabler[ENABLER_PARENT_PROCESS] && get_parent())
- get_parent()->set_process(false);
+ // We need to defer the call of set_process and set_physics_process,
+ // otherwise they are overwritten inside NOTIFICATION_READY.
+ // We can't use call_deferred, because it happens after a physics frame.
+ // The ready signal works as it's emitted immediately after NOTIFICATION_READY.
+
+ if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent()) {
+ get_parent()->connect(SceneStringNames::get_singleton()->ready,
+ callable_mp(get_parent(), &Node::set_physics_process), varray(false), CONNECT_ONESHOT);
+ }
+ if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) {
+ get_parent()->connect(SceneStringNames::get_singleton()->ready,
+ callable_mp(get_parent(), &Node::set_process), varray(false), CONNECT_ONESHOT);
+ }
}
if (p_what == NOTIFICATION_EXIT_TREE) {
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 7d02befee6..871f3119bc 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -376,7 +376,7 @@ Point2 Camera3D::unproject_position(const Vector3 &p_pos) const {
Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
p = cm.xform4(p);
- p.normal /= p.distance;
+ p.normal /= p.d;
Point2 res;
res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x;
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index 05e282533b..6f41629bac 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -111,7 +111,7 @@ Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const {
Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
p = cm.xform4(p);
- p.normal /= p.distance;
+ p.normal /= p.d;
Point2 res;
res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 8574b05016..bb177ae0e7 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -277,10 +277,14 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
} break;
#ifdef APPLE_STYLE_KEYS
case (KEY_LEFT): { // Go to start of text - like HOME key.
+ shift_selection_check_pre(k->get_shift());
set_cursor_position(0);
+ shift_selection_check_post(k->get_shift());
} break;
case (KEY_RIGHT): { // Go to end of text - like END key.
+ shift_selection_check_pre(k->get_shift());
set_cursor_position(text.length());
+ shift_selection_check_post(k->get_shift());
} break;
#endif
default: {
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index d96013a081..ae705a47e8 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -1237,7 +1237,7 @@ void Curve3D::_bake() const {
p = mid;
Plane post;
post.normal = pos;
- post.distance = Math::lerp(points[i].tilt, points[i + 1].tilt, mid);
+ post.d = Math::lerp(points[i].tilt, points[i + 1].tilt, mid);
pointlist.push_back(post);
} else {
@@ -1274,7 +1274,7 @@ void Curve3D::_bake() const {
for (List<Plane>::Element *E = pointlist.front(); E; E = E->next()) {
w[idx] = E->get().normal;
- wt[idx] = E->get().distance;
+ wt[idx] = E->get().d;
if (!up_vector_enabled) {
idx++;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index adecf5cf8f..401b689145 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1522,7 +1522,7 @@ Error ArrayMesh::lightmap_unwrap_cached(int *&r_cache_data, unsigned int &r_cach
if (lightmap_surfaces[surface].format & ARRAY_FORMAT_TANGENT) {
Plane t;
t.normal = v.tangent;
- t.distance = v.binormal.dot(v.normal.cross(v.tangent)) < 0 ? -1 : 1;
+ t.d = v.binormal.dot(v.normal.cross(v.tangent)) < 0 ? -1 : 1;
surfaces_tools.write[surface]->add_tangent(t);
}
if (lightmap_surfaces[surface].format & ARRAY_FORMAT_BONES) {
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index e4d402479f..76d96786bc 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -255,7 +255,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
ta[i * 4 + 0] = vtx.tangent.normal.x;
ta[i * 4 + 1] = vtx.tangent.normal.y;
ta[i * 4 + 2] = vtx.tangent.normal.z;
- ta[i * 4 + 3] = vtx.tangent.distance;
+ ta[i * 4 + 3] = vtx.tangent.d;
}
if (uv)
uv[i] = vtx.uv;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index c5e1aa7c80..4b392e23b7 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -107,7 +107,7 @@ void SurfaceTool::add_vertex(const Vector3 &p_vertex) {
vtx.weights = last_weights;
vtx.bones = last_bones;
vtx.tangent = last_tangent.normal;
- vtx.binormal = last_normal.cross(last_tangent.normal).normalized() * last_tangent.distance;
+ vtx.binormal = last_normal.cross(last_tangent.normal).normalized() * last_tangent.d;
const int expected_vertices = 4;
@@ -575,7 +575,7 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
if (lformat & RS::ARRAY_FORMAT_TANGENT) {
Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]);
v.tangent = p.normal;
- v.binormal = p.normal.cross(v.tangent).normalized() * p.distance;
+ v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
}
if (lformat & RS::ARRAY_FORMAT_COLOR)
v.color = carr[i];
@@ -658,7 +658,7 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li
if (lformat & RS::ARRAY_FORMAT_TANGENT) {
Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]);
v.tangent = p.normal;
- v.binormal = p.normal.cross(v.tangent).normalized() * p.distance;
+ v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
}
if (lformat & RS::ARRAY_FORMAT_COLOR)
v.color = carr[i];
diff --git a/scene/resources/world_margin_shape_3d.cpp b/scene/resources/world_margin_shape_3d.cpp
index 833e7725ae..aa96f8aa68 100644
--- a/scene/resources/world_margin_shape_3d.cpp
+++ b/scene/resources/world_margin_shape_3d.cpp
@@ -41,10 +41,10 @@ Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() {
Vector3 n2 = p.normal.cross(n1).normalized();
Vector3 pface[4] = {
- p.normal * p.distance + n1 * 10.0 + n2 * 10.0,
- p.normal * p.distance + n1 * 10.0 + n2 * -10.0,
- p.normal * p.distance + n1 * -10.0 + n2 * -10.0,
- p.normal * p.distance + n1 * -10.0 + n2 * 10.0,
+ p.normal * p.d + n1 * 10.0 + n2 * 10.0,
+ p.normal * p.d + n1 * 10.0 + n2 * -10.0,
+ p.normal * p.d + n1 * -10.0 + n2 * -10.0,
+ p.normal * p.d + n1 * -10.0 + n2 * 10.0,
};
points.push_back(pface[0]);
@@ -55,8 +55,8 @@ Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() {
points.push_back(pface[3]);
points.push_back(pface[3]);
points.push_back(pface[0]);
- points.push_back(p.normal * p.distance);
- points.push_back(p.normal * p.distance + p.normal * 3);
+ points.push_back(p.normal * p.d);
+ points.push_back(p.normal * p.d + p.normal * 3);
return points;
}
diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp
index d663209f6d..5096b080ab 100644
--- a/servers/physics_3d/collision_solver_3d_sat.cpp
+++ b/servers/physics_3d/collision_solver_3d_sat.cpp
@@ -194,7 +194,7 @@ static void _generate_contacts_face_face(const Vector3 *p_points_A, int p_point_
// calculate intersection
Vector3 rel = edge1_A - edge0_A;
real_t den = clip.normal.dot(rel);
- real_t dist = -(clip.normal.dot(edge0_A) - clip.distance) / den;
+ real_t dist = -(clip.normal.dot(edge0_A) - clip.d) / den;
Vector3 inters = edge0_A + rel * dist;
ERR_FAIL_COND(dst_idx >= max_clip);
diff --git a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
index afd1296002..d469dd97ca 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
@@ -558,7 +558,7 @@ void RasterizerEffectsRD::sub_surface_scattering(RID p_diffuse, RID p_diffuse2,
int32_t y_groups = (p_screen_size.height - 1) / 8 + 1;
Plane p = p_camera.xform4(Plane(1, 0, -1, 1));
- p.normal /= p.distance;
+ p.normal /= p.d;
float unit_size = p.normal.x;
{ //scale color and depth to half
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 8ca8446c23..8d299d623a 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -1368,7 +1368,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
gui[0] = v.normal.x;
gui[1] = v.normal.y;
gui[2] = v.normal.z;
- gui[3] = v.distance;
+ gui[3] = v.d;
}
} break;
case ShaderLanguage::TYPE_MAT2: {
@@ -4929,7 +4929,7 @@ void RasterizerStorageRD::_global_variable_store_in_buffer(int32_t p_index, RS::
bv.x = v.normal.x;
bv.y = v.normal.y;
bv.z = v.normal.z;
- bv.w = v.distance;
+ bv.w = v.d;
} break;
case RS::GLOBAL_VAR_TYPE_COLOR: {
GlobalVariables::Value &bv = global_variables.buffer_values[p_index];