Merge pull request #71966 from lawnjelly/occluder_portal_index_docs

Improve error messages and classref for occluders and portals
This commit is contained in:
Rémi Verschelde 2023-01-26 13:21:52 +01:00
commit 768e998b7a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
8 changed files with 28 additions and 32 deletions

View File

@ -17,7 +17,8 @@
<argument index="0" name="index" type="int" /> <argument index="0" name="index" type="int" />
<argument index="1" name="position" type="Vector2" /> <argument index="1" name="position" type="Vector2" />
<description> <description>
Sets an individual hole point position. Sets an individual hole point position. Primarily for use by the editor.
[b]Note:[/b] This function will not resize the hole point array. Set [member hole_points] to set the number of points.
</description> </description>
</method> </method>
<method name="set_polygon_point"> <method name="set_polygon_point">
@ -25,7 +26,8 @@
<argument index="0" name="index" type="int" /> <argument index="0" name="index" type="int" />
<argument index="1" name="position" type="Vector2" /> <argument index="1" name="position" type="Vector2" />
<description> <description>
Sets an individual polygon point position. Sets an individual polygon point position. Primarily for use by the editor.
[b]Note:[/b] This function will not resize the polygon point array. Set [member polygon_points] to set the number of points.
</description> </description>
</method> </method>
</methods> </methods>

View File

@ -15,7 +15,7 @@
<argument index="0" name="index" type="int" /> <argument index="0" name="index" type="int" />
<argument index="1" name="position" type="Vector3" /> <argument index="1" name="position" type="Vector3" />
<description> <description>
Sets an individual sphere's position. Sets an individual sphere's position. Primarily for use by the editor.
</description> </description>
</method> </method>
<method name="set_sphere_radius"> <method name="set_sphere_radius">
@ -23,7 +23,7 @@
<argument index="0" name="index" type="int" /> <argument index="0" name="index" type="int" />
<argument index="1" name="radius" type="float" /> <argument index="1" name="radius" type="float" />
<description> <description>
Sets an individual sphere's radius. Sets an individual sphere's radius. Primarily for use by the editor.
</description> </description>
</method> </method>
</methods> </methods>

View File

@ -18,6 +18,7 @@
<argument index="1" name="position" type="Vector2" /> <argument index="1" name="position" type="Vector2" />
<description> <description>
Sets individual points. Primarily for use by the editor. Sets individual points. Primarily for use by the editor.
[b]Note:[/b] This function will not resize the point array. Set [member points] to set the number of points.
</description> </description>
</method> </method>
</methods> </methods>

View File

@ -19,6 +19,7 @@
<argument index="1" name="position" type="Vector3" /> <argument index="1" name="position" type="Vector3" />
<description> <description>
Sets individual points. Primarily for use by the editor. Sets individual points. Primarily for use by the editor.
[b]Note:[/b] This function will not resize the point array. Set [member points] to set the number of points.
</description> </description>
</method> </method>
</methods> </methods>

View File

@ -115,9 +115,7 @@ String Portal::get_configuration_warning() const {
} }
void Portal::set_point(int p_idx, const Vector2 &p_point) { void Portal::set_point(int p_idx, const Vector2 &p_point) {
if (p_idx >= _pts_local_raw.size()) { ERR_FAIL_INDEX_MSG(p_idx, _pts_local_raw.size(), "Index out of bounds. Call set_points() to set the size of the array.");
return;
}
_pts_local_raw.set(p_idx, p_point); _pts_local_raw.set(p_idx, p_point);
_sanitize_points(); _sanitize_points();

View File

@ -131,9 +131,7 @@ void Room::set_use_default_simplify(bool p_use) {
} }
void Room::set_point(int p_idx, const Vector3 &p_point) { void Room::set_point(int p_idx, const Vector3 &p_point) {
if (p_idx >= _bound_pts.size()) { ERR_FAIL_INDEX_MSG(p_idx, _bound_pts.size(), "Index out of bounds. Call set_points() to set the size of the array.");
return;
}
_bound_pts.set(p_idx, p_point); _bound_pts.set(p_idx, p_point);

View File

@ -210,29 +210,29 @@ void OccluderShapeSphere::set_spheres(const Vector<Plane> &p_spheres) {
} }
void OccluderShapeSphere::set_sphere_position(int p_idx, const Vector3 &p_position) { void OccluderShapeSphere::set_sphere_position(int p_idx, const Vector3 &p_position) {
if ((p_idx >= 0) && (p_idx < _spheres.size())) { ERR_FAIL_INDEX(p_idx, _spheres.size());
Plane p = _spheres[p_idx];
p.normal = p_position; Plane p = _spheres[p_idx];
_spheres.set(p_idx, p); p.normal = p_position;
_spheres.set(p_idx, p);
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
_update_aabb(); _update_aabb();
#endif #endif
update_shape_to_visual_server(); update_shape_to_visual_server();
notify_change_to_owners(); notify_change_to_owners();
}
} }
void OccluderShapeSphere::set_sphere_radius(int p_idx, real_t p_radius) { void OccluderShapeSphere::set_sphere_radius(int p_idx, real_t p_radius) {
if ((p_idx >= 0) && (p_idx < _spheres.size())) { ERR_FAIL_INDEX(p_idx, _spheres.size());
Plane p = _spheres[p_idx];
p.d = MAX(p_radius, _min_radius); Plane p = _spheres[p_idx];
_spheres.set(p_idx, p); p.d = MAX(p_radius, _min_radius);
_spheres.set(p_idx, p);
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
_update_aabb(); _update_aabb();
#endif #endif
update_shape_to_visual_server(); update_shape_to_visual_server();
notify_change_to_owners(); notify_change_to_owners();
}
} }
OccluderShapeSphere::OccluderShapeSphere() { OccluderShapeSphere::OccluderShapeSphere() {

View File

@ -102,9 +102,7 @@ void OccluderShapePolygon::_sanitize_points() {
} }
void OccluderShapePolygon::set_polygon_point(int p_idx, const Vector2 &p_point) { void OccluderShapePolygon::set_polygon_point(int p_idx, const Vector2 &p_point) {
if (p_idx >= _poly_pts_local_raw.size()) { ERR_FAIL_INDEX_MSG(p_idx, _poly_pts_local_raw.size(), "Index out of bounds. Call set_polygon_points() to set the size of the array.");
return;
}
_poly_pts_local_raw.set(p_idx, p_point); _poly_pts_local_raw.set(p_idx, p_point);
_sanitize_points(); _sanitize_points();
@ -113,9 +111,7 @@ void OccluderShapePolygon::set_polygon_point(int p_idx, const Vector2 &p_point)
} }
void OccluderShapePolygon::set_hole_point(int p_idx, const Vector2 &p_point) { void OccluderShapePolygon::set_hole_point(int p_idx, const Vector2 &p_point) {
if (p_idx >= _hole_pts_local_raw.size()) { ERR_FAIL_INDEX_MSG(p_idx, _hole_pts_local_raw.size(), "Index out of bounds. Call set_hole_points() to set the size of the array.");
return;
}
_hole_pts_local_raw.set(p_idx, p_point); _hole_pts_local_raw.set(p_idx, p_point);
_sanitize_points(); _sanitize_points();