feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -31,8 +31,14 @@
|
|||
#include "polygon_2d.h"
|
||||
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h"
|
||||
#include "scene/resources/2d/navigation_polygon.h"
|
||||
#include "servers/navigation_server_2d.h"
|
||||
#include "skeleton_2d.h"
|
||||
|
||||
Callable Polygon2D::_navmesh_source_geometry_parsing_callback;
|
||||
RID Polygon2D::_navmesh_source_geometry_parser;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Dictionary Polygon2D::_edit_get_state() const {
|
||||
Dictionary state = Node2D::_edit_get_state();
|
||||
|
|
@ -57,7 +63,9 @@ Point2 Polygon2D::_edit_get_pivot() const {
|
|||
bool Polygon2D::_edit_use_pivot() const {
|
||||
return true;
|
||||
}
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
Rect2 Polygon2D::_edit_get_rect() const {
|
||||
if (rect_cache_dirty) {
|
||||
int l = polygon.size();
|
||||
|
|
@ -88,7 +96,7 @@ bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toler
|
|||
}
|
||||
return Geometry2D::is_point_in_polygon(p_point - get_offset(), polygon2d);
|
||||
}
|
||||
#endif
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
void Polygon2D::_validate_property(PropertyInfo &p_property) const {
|
||||
if (!invert && p_property.name == "invert_border") {
|
||||
|
|
@ -602,6 +610,36 @@ NodePath Polygon2D::get_skeleton() const {
|
|||
return skeleton;
|
||||
}
|
||||
|
||||
void Polygon2D::navmesh_parse_init() {
|
||||
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
|
||||
if (!_navmesh_source_geometry_parser.is_valid()) {
|
||||
_navmesh_source_geometry_parsing_callback = callable_mp_static(&Polygon2D::navmesh_parse_source_geometry);
|
||||
_navmesh_source_geometry_parser = NavigationServer2D::get_singleton()->source_geometry_parser_create();
|
||||
NavigationServer2D::get_singleton()->source_geometry_parser_set_callback(_navmesh_source_geometry_parser, _navmesh_source_geometry_parsing_callback);
|
||||
}
|
||||
}
|
||||
|
||||
void Polygon2D::navmesh_parse_source_geometry(const Ref<NavigationPolygon> &p_navigation_mesh, Ref<NavigationMeshSourceGeometryData2D> p_source_geometry_data, Node *p_node) {
|
||||
Polygon2D *polygon_2d = Object::cast_to<Polygon2D>(p_node);
|
||||
|
||||
if (polygon_2d == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
NavigationPolygon::ParsedGeometryType parsed_geometry_type = p_navigation_mesh->get_parsed_geometry_type();
|
||||
|
||||
if (parsed_geometry_type == NavigationPolygon::PARSED_GEOMETRY_MESH_INSTANCES || parsed_geometry_type == NavigationPolygon::PARSED_GEOMETRY_BOTH) {
|
||||
const Transform2D polygon_2d_xform = p_source_geometry_data->root_node_transform * polygon_2d->get_global_transform();
|
||||
|
||||
Vector<Vector2> shape_outline = polygon_2d->get_polygon();
|
||||
for (int i = 0; i < shape_outline.size(); i++) {
|
||||
shape_outline.write[i] = polygon_2d_xform.xform(shape_outline[i]);
|
||||
}
|
||||
|
||||
p_source_geometry_data->add_obstruction_outline(shape_outline);
|
||||
}
|
||||
}
|
||||
|
||||
void Polygon2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_polygon", "polygon"), &Polygon2D::set_polygon);
|
||||
ClassDB::bind_method(D_METHOD("get_polygon"), &Polygon2D::get_polygon);
|
||||
|
|
@ -682,7 +720,7 @@ void Polygon2D::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "uv"), "set_uv", "get_uv");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons"), "set_polygons", "get_polygons");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "_set_bones", "_get_bones");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "_set_bones", "_get_bones");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "internal_vertex_count", PROPERTY_HINT_RANGE, "0,1000"), "set_internal_vertex_count", "get_internal_vertex_count");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue