feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "grid_map_editor_plugin.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_main_screen.h"
|
||||
|
|
@ -100,14 +98,14 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
Basis r;
|
||||
if (input_action == INPUT_PASTE) {
|
||||
r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);
|
||||
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 1, 0), -Math::PI / 2.0);
|
||||
paste_indicator.orientation = node->get_orthogonal_index_from_basis(r);
|
||||
_update_paste_indicator();
|
||||
break;
|
||||
}
|
||||
|
||||
r = node->get_basis_with_orthogonal_index(cursor_rot);
|
||||
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 1, 0), -Math::PI / 2.0);
|
||||
cursor_rot = node->get_orthogonal_index_from_basis(r);
|
||||
_update_cursor_transform();
|
||||
} break;
|
||||
|
|
@ -115,14 +113,14 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
Basis r;
|
||||
if (input_action == INPUT_PASTE) {
|
||||
r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);
|
||||
r.rotate(Vector3(1, 0, 0), -Math_PI / 2.0);
|
||||
r.rotate(Vector3(1, 0, 0), -Math::PI / 2.0);
|
||||
paste_indicator.orientation = node->get_orthogonal_index_from_basis(r);
|
||||
_update_paste_indicator();
|
||||
break;
|
||||
}
|
||||
|
||||
r = node->get_basis_with_orthogonal_index(cursor_rot);
|
||||
r.rotate(Vector3(1, 0, 0), -Math_PI / 2.0);
|
||||
r.rotate(Vector3(1, 0, 0), -Math::PI / 2.0);
|
||||
cursor_rot = node->get_orthogonal_index_from_basis(r);
|
||||
_update_cursor_transform();
|
||||
} break;
|
||||
|
|
@ -130,14 +128,14 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
Basis r;
|
||||
if (input_action == INPUT_PASTE) {
|
||||
r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);
|
||||
r.rotate(Vector3(0, 0, 1), -Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 0, 1), -Math::PI / 2.0);
|
||||
paste_indicator.orientation = node->get_orthogonal_index_from_basis(r);
|
||||
_update_paste_indicator();
|
||||
break;
|
||||
}
|
||||
|
||||
r = node->get_basis_with_orthogonal_index(cursor_rot);
|
||||
r.rotate(Vector3(0, 0, 1), -Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 0, 1), -Math::PI / 2.0);
|
||||
cursor_rot = node->get_orthogonal_index_from_basis(r);
|
||||
_update_cursor_transform();
|
||||
} break;
|
||||
|
|
@ -145,14 +143,14 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
Basis r;
|
||||
if (input_action == INPUT_PASTE) {
|
||||
r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);
|
||||
r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 1, 0), Math::PI / 2.0);
|
||||
paste_indicator.orientation = node->get_orthogonal_index_from_basis(r);
|
||||
_update_paste_indicator();
|
||||
break;
|
||||
}
|
||||
|
||||
r = node->get_basis_with_orthogonal_index(cursor_rot);
|
||||
r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 1, 0), Math::PI / 2.0);
|
||||
cursor_rot = node->get_orthogonal_index_from_basis(r);
|
||||
_update_cursor_transform();
|
||||
} break;
|
||||
|
|
@ -160,14 +158,14 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
Basis r;
|
||||
if (input_action == INPUT_PASTE) {
|
||||
r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);
|
||||
r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
|
||||
r.rotate(Vector3(1, 0, 0), Math::PI / 2.0);
|
||||
paste_indicator.orientation = node->get_orthogonal_index_from_basis(r);
|
||||
_update_paste_indicator();
|
||||
break;
|
||||
}
|
||||
|
||||
r = node->get_basis_with_orthogonal_index(cursor_rot);
|
||||
r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
|
||||
r.rotate(Vector3(1, 0, 0), Math::PI / 2.0);
|
||||
cursor_rot = node->get_orthogonal_index_from_basis(r);
|
||||
_update_cursor_transform();
|
||||
} break;
|
||||
|
|
@ -175,14 +173,14 @@ void GridMapEditor::_menu_option(int p_option) {
|
|||
Basis r;
|
||||
if (input_action == INPUT_PASTE) {
|
||||
r = node->get_basis_with_orthogonal_index(paste_indicator.orientation);
|
||||
r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 0, 1), Math::PI / 2.0);
|
||||
paste_indicator.orientation = node->get_orthogonal_index_from_basis(r);
|
||||
_update_paste_indicator();
|
||||
break;
|
||||
}
|
||||
|
||||
r = node->get_basis_with_orthogonal_index(cursor_rot);
|
||||
r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
|
||||
r.rotate(Vector3(0, 0, 1), Math::PI / 2.0);
|
||||
cursor_rot = node->get_orthogonal_index_from_basis(r);
|
||||
_update_cursor_transform();
|
||||
} break;
|
||||
|
|
@ -674,7 +672,9 @@ void GridMapEditor::_show_viewports_transform_gizmo(bool p_value) {
|
|||
}
|
||||
|
||||
EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
|
||||
if (!node) {
|
||||
// If the mouse is currently captured, we are most likely in freelook mode.
|
||||
// In this case, disable shortcuts to avoid conflicts with freelook navigation.
|
||||
if (!node || Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) {
|
||||
return EditorPlugin::AFTER_GUI_INPUT_PASS;
|
||||
}
|
||||
|
||||
|
|
@ -867,7 +867,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
|
|||
const real_t delta = pan_gesture->get_delta().y * 0.5;
|
||||
accumulated_floor_delta += delta;
|
||||
int step = 0;
|
||||
if (ABS(accumulated_floor_delta) > 1.0) {
|
||||
if (Math::abs(accumulated_floor_delta) > 1.0) {
|
||||
step = SIGN(accumulated_floor_delta);
|
||||
accumulated_floor_delta -= step;
|
||||
}
|
||||
|
|
@ -1367,6 +1367,7 @@ GridMapEditor::GridMapEditor() {
|
|||
settings_pick_distance->set_min(500.0f);
|
||||
settings_pick_distance->set_step(1.0f);
|
||||
settings_pick_distance->set_value(EDITOR_GET("editors/grid_map/pick_distance"));
|
||||
settings_pick_distance->set_accessibility_name(TTRC("Pick Distance"));
|
||||
settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance);
|
||||
|
||||
options->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &GridMapEditor::_menu_option));
|
||||
|
|
@ -1384,6 +1385,7 @@ GridMapEditor::GridMapEditor() {
|
|||
transform_mode_button->set_toggle_mode(true);
|
||||
transform_mode_button->set_button_group(mode_buttons_group);
|
||||
transform_mode_button->set_shortcut(ED_SHORTCUT("grid_map/transform_tool", TTRC("Transform"), Key::T, true));
|
||||
transform_mode_button->set_accessibility_name(TTRC("Transform"));
|
||||
transform_mode_button->connect(SceneStringName(toggled),
|
||||
callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1));
|
||||
mode_buttons->add_child(transform_mode_button);
|
||||
|
|
@ -1396,6 +1398,7 @@ GridMapEditor::GridMapEditor() {
|
|||
select_mode_button->set_toggle_mode(true);
|
||||
select_mode_button->set_button_group(mode_buttons_group);
|
||||
select_mode_button->set_shortcut(ED_SHORTCUT("grid_map/selection_tool", TTRC("Selection"), Key::Q, true));
|
||||
select_mode_button->set_accessibility_name(TTRC("Select"));
|
||||
select_mode_button->connect(SceneStringName(toggled),
|
||||
callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1));
|
||||
mode_buttons->add_child(select_mode_button);
|
||||
|
|
@ -1406,6 +1409,7 @@ GridMapEditor::GridMapEditor() {
|
|||
erase_mode_button->set_toggle_mode(true);
|
||||
erase_mode_button->set_button_group(mode_buttons_group);
|
||||
erase_mode_button->set_shortcut(ED_SHORTCUT("grid_map/erase_tool", TTRC("Erase"), Key::W, true));
|
||||
erase_mode_button->set_accessibility_name(TTRC("Erase"));
|
||||
mode_buttons->add_child(erase_mode_button);
|
||||
erase_mode_button->connect(SceneStringName(toggled),
|
||||
callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1));
|
||||
|
|
@ -1416,6 +1420,7 @@ GridMapEditor::GridMapEditor() {
|
|||
paint_mode_button->set_toggle_mode(true);
|
||||
paint_mode_button->set_button_group(mode_buttons_group);
|
||||
paint_mode_button->set_shortcut(ED_SHORTCUT("grid_map/paint_tool", TTRC("Paint"), Key::E, true));
|
||||
paint_mode_button->set_accessibility_name(TTRC("Paint"));
|
||||
paint_mode_button->connect(SceneStringName(toggled),
|
||||
callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1));
|
||||
mode_buttons->add_child(paint_mode_button);
|
||||
|
|
@ -1426,6 +1431,7 @@ GridMapEditor::GridMapEditor() {
|
|||
pick_mode_button->set_toggle_mode(true);
|
||||
pick_mode_button->set_button_group(mode_buttons_group);
|
||||
pick_mode_button->set_shortcut(ED_SHORTCUT("grid_map/pick_tool", TTRC("Pick"), Key::R, true));
|
||||
pick_mode_button->set_accessibility_name(TTRC("Pick"));
|
||||
pick_mode_button->connect(SceneStringName(toggled),
|
||||
callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1));
|
||||
mode_buttons->add_child(pick_mode_button);
|
||||
|
|
@ -1440,6 +1446,7 @@ GridMapEditor::GridMapEditor() {
|
|||
fill_action_button = memnew(Button);
|
||||
fill_action_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
fill_action_button->set_shortcut(ED_SHORTCUT("grid_map/fill_tool", TTRC("Fill"), Key::Z, true));
|
||||
fill_action_button->set_accessibility_name(TTRC("Fill"));
|
||||
fill_action_button->connect(SceneStringName(pressed),
|
||||
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_FILL));
|
||||
action_buttons->add_child(fill_action_button);
|
||||
|
|
@ -1448,6 +1455,7 @@ GridMapEditor::GridMapEditor() {
|
|||
move_action_button = memnew(Button);
|
||||
move_action_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
move_action_button->set_shortcut(ED_SHORTCUT("grid_map/move_tool", TTRC("Move"), Key::X, true));
|
||||
fill_action_button->set_accessibility_name(TTRC("Move"));
|
||||
move_action_button->connect(SceneStringName(pressed),
|
||||
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_CUT));
|
||||
action_buttons->add_child(move_action_button);
|
||||
|
|
@ -1456,6 +1464,7 @@ GridMapEditor::GridMapEditor() {
|
|||
duplicate_action_button = memnew(Button);
|
||||
duplicate_action_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
duplicate_action_button->set_shortcut(ED_SHORTCUT("grid_map/duplicate_tool", TTRC("Duplicate"), Key::C, true));
|
||||
duplicate_action_button->set_accessibility_name(TTRC("Duplicate"));
|
||||
duplicate_action_button->connect(SceneStringName(pressed),
|
||||
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_DUPLICATE));
|
||||
action_buttons->add_child(duplicate_action_button);
|
||||
|
|
@ -1464,6 +1473,7 @@ GridMapEditor::GridMapEditor() {
|
|||
delete_action_button = memnew(Button);
|
||||
delete_action_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
delete_action_button->set_shortcut(ED_SHORTCUT("grid_map/delete_tool", TTRC("Delete"), Key::V, true));
|
||||
delete_action_button->set_accessibility_name(TTRC("Delete"));
|
||||
delete_action_button->connect(SceneStringName(pressed),
|
||||
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_CLEAR));
|
||||
action_buttons->add_child(delete_action_button);
|
||||
|
|
@ -1478,6 +1488,7 @@ GridMapEditor::GridMapEditor() {
|
|||
rotate_x_button = memnew(Button);
|
||||
rotate_x_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
rotate_x_button->set_shortcut(ED_SHORTCUT("grid_map/cursor_rotate_x", TTRC("Cursor Rotate X"), Key::A, true));
|
||||
rotate_x_button->set_accessibility_name(TTRC("Rotate X"));
|
||||
rotate_x_button->connect(SceneStringName(pressed),
|
||||
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_CURSOR_ROTATE_X));
|
||||
rotation_buttons->add_child(rotate_x_button);
|
||||
|
|
@ -1486,6 +1497,7 @@ GridMapEditor::GridMapEditor() {
|
|||
rotate_y_button = memnew(Button);
|
||||
rotate_y_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
rotate_y_button->set_shortcut(ED_SHORTCUT("grid_map/cursor_rotate_y", TTRC("Cursor Rotate Y"), Key::S, true));
|
||||
rotate_y_button->set_accessibility_name(TTRC("Rotate Y"));
|
||||
rotate_y_button->connect(SceneStringName(pressed),
|
||||
callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_CURSOR_ROTATE_Y));
|
||||
rotation_buttons->add_child(rotate_y_button);
|
||||
|
|
@ -1509,6 +1521,7 @@ GridMapEditor::GridMapEditor() {
|
|||
floor->set_min(-32767);
|
||||
floor->set_max(32767);
|
||||
floor->set_step(1);
|
||||
floor->set_accessibility_name(TTRC("Grid Floor"));
|
||||
floor->set_tooltip_text(
|
||||
vformat(TTR("Change Grid Floor:\nPrevious Plane (%s)\nNext Plane (%s)"),
|
||||
ED_GET_SHORTCUT("grid_map/previous_floor")->get_as_text(),
|
||||
|
|
@ -1523,6 +1536,7 @@ GridMapEditor::GridMapEditor() {
|
|||
search_box = memnew(LineEdit);
|
||||
search_box->add_theme_constant_override("minimum_character_width", 10);
|
||||
search_box->set_placeholder(TTR("Filter Meshes"));
|
||||
search_box->set_accessibility_name(TTRC("Filter Meshes"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
toolbar->add_child(search_box);
|
||||
search_box->connect(SceneStringName(text_changed), callable_mp(this, &GridMapEditor::_text_changed));
|
||||
|
|
@ -1539,6 +1553,7 @@ GridMapEditor::GridMapEditor() {
|
|||
mode_thumbnail = memnew(Button);
|
||||
mode_thumbnail->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
mode_thumbnail->set_toggle_mode(true);
|
||||
mode_thumbnail->set_accessibility_name(TTRC("View as Thumbnails"));
|
||||
mode_thumbnail->set_pressed(true);
|
||||
toolbar->add_child(mode_thumbnail);
|
||||
mode_thumbnail->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_set_display_mode).bind(DISPLAY_THUMBNAIL));
|
||||
|
|
@ -1546,6 +1561,7 @@ GridMapEditor::GridMapEditor() {
|
|||
mode_list = memnew(Button);
|
||||
mode_list->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
mode_list->set_toggle_mode(true);
|
||||
mode_list->set_accessibility_name(TTRC("View as List"));
|
||||
mode_list->set_pressed(false);
|
||||
toolbar->add_child(mode_list);
|
||||
mode_list->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_set_display_mode).bind(DISPLAY_LIST));
|
||||
|
|
@ -1877,11 +1893,3 @@ int GridMapEditorPlugin::get_selected_palette_item() const {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
GridMapEditorPlugin::GridMapEditorPlugin() {
|
||||
}
|
||||
|
||||
GridMapEditorPlugin::~GridMapEditorPlugin() {
|
||||
}
|
||||
|
||||
#endif // TOOLS_ENABLED
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GRID_MAP_EDITOR_PLUGIN_H
|
||||
#define GRID_MAP_EDITOR_PLUGIN_H
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#pragma once
|
||||
|
||||
#include "../grid_map.h"
|
||||
|
||||
|
|
@ -295,11 +292,4 @@ public:
|
|||
Array get_selected_cells() const;
|
||||
void set_selected_palette_item(int p_item) const;
|
||||
int get_selected_palette_item() const;
|
||||
|
||||
GridMapEditorPlugin();
|
||||
~GridMapEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
#endif // GRID_MAP_EDITOR_PLUGIN_H
|
||||
|
|
|
|||
|
|
@ -45,11 +45,14 @@
|
|||
#include "scene/resources/3d/sphere_shape_3d.h"
|
||||
#include "scene/resources/physics_material.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
#include "servers/navigation_server_3d.h"
|
||||
|
||||
Callable GridMap::_navmesh_source_geometry_parsing_callback;
|
||||
RID GridMap::_navmesh_source_geometry_parser;
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
bool GridMap::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String name = p_name;
|
||||
|
|
@ -146,6 +149,7 @@ void GridMap::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
p_list->push_back(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE));
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
void GridMap::set_collision_layer(uint32_t p_layer) {
|
||||
collision_layer = p_layer;
|
||||
_update_physics_bodies_collision_properties();
|
||||
|
|
@ -235,6 +239,7 @@ Array GridMap::get_collision_shapes() const {
|
|||
|
||||
return shapes;
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
void GridMap::set_bake_navigation(bool p_bake_navigation) {
|
||||
bake_navigation = p_bake_navigation;
|
||||
|
|
@ -245,6 +250,7 @@ bool GridMap::is_baking_navigation() {
|
|||
return bake_navigation;
|
||||
}
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
void GridMap::set_navigation_map(RID p_navigation_map) {
|
||||
map_override = p_navigation_map;
|
||||
for (const KeyValue<OctantKey, Octant *> &E : octant_map) {
|
||||
|
|
@ -265,6 +271,7 @@ RID GridMap::get_navigation_map() const {
|
|||
}
|
||||
return RID();
|
||||
}
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
void GridMap::set_mesh_library(const Ref<MeshLibrary> &p_mesh_library) {
|
||||
if (mesh_library.is_valid()) {
|
||||
|
|
@ -338,9 +345,9 @@ void GridMap::set_cell_item(const Vector3i &p_position, int p_item, int p_rot) {
|
|||
_recreate_octant_data();
|
||||
}
|
||||
|
||||
ERR_FAIL_INDEX(ABS(p_position.x), 1 << 20);
|
||||
ERR_FAIL_INDEX(ABS(p_position.y), 1 << 20);
|
||||
ERR_FAIL_INDEX(ABS(p_position.z), 1 << 20);
|
||||
ERR_FAIL_INDEX(Math::abs(p_position.x), 1 << 20);
|
||||
ERR_FAIL_INDEX(Math::abs(p_position.y), 1 << 20);
|
||||
ERR_FAIL_INDEX(Math::abs(p_position.z), 1 << 20);
|
||||
|
||||
IndexKey key;
|
||||
key.x = p_position.x;
|
||||
|
|
@ -373,6 +380,7 @@ void GridMap::set_cell_item(const Vector3i &p_position, int p_item, int p_rot) {
|
|||
//create octant because it does not exist
|
||||
Octant *g = memnew(Octant);
|
||||
g->dirty = true;
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
g->static_body = PhysicsServer3D::get_singleton()->body_create();
|
||||
PhysicsServer3D::get_singleton()->body_set_mode(g->static_body, PhysicsServer3D::BODY_MODE_STATIC);
|
||||
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id());
|
||||
|
|
@ -383,6 +391,7 @@ void GridMap::set_cell_item(const Vector3i &p_position, int p_item, int p_rot) {
|
|||
PhysicsServer3D::get_singleton()->body_set_param(g->static_body, PhysicsServer3D::BODY_PARAM_FRICTION, physics_material->computed_friction());
|
||||
PhysicsServer3D::get_singleton()->body_set_param(g->static_body, PhysicsServer3D::BODY_PARAM_BOUNCE, physics_material->computed_bounce());
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
|
||||
if (st && st->is_debugging_collisions_hint()) {
|
||||
|
|
@ -412,9 +421,9 @@ void GridMap::set_cell_item(const Vector3i &p_position, int p_item, int p_rot) {
|
|||
}
|
||||
|
||||
int GridMap::get_cell_item(const Vector3i &p_position) const {
|
||||
ERR_FAIL_INDEX_V(ABS(p_position.x), 1 << 20, INVALID_CELL_ITEM);
|
||||
ERR_FAIL_INDEX_V(ABS(p_position.y), 1 << 20, INVALID_CELL_ITEM);
|
||||
ERR_FAIL_INDEX_V(ABS(p_position.z), 1 << 20, INVALID_CELL_ITEM);
|
||||
ERR_FAIL_INDEX_V(Math::abs(p_position.x), 1 << 20, INVALID_CELL_ITEM);
|
||||
ERR_FAIL_INDEX_V(Math::abs(p_position.y), 1 << 20, INVALID_CELL_ITEM);
|
||||
ERR_FAIL_INDEX_V(Math::abs(p_position.z), 1 << 20, INVALID_CELL_ITEM);
|
||||
|
||||
IndexKey key;
|
||||
key.x = p_position.x;
|
||||
|
|
@ -428,9 +437,9 @@ int GridMap::get_cell_item(const Vector3i &p_position) const {
|
|||
}
|
||||
|
||||
int GridMap::get_cell_item_orientation(const Vector3i &p_position) const {
|
||||
ERR_FAIL_INDEX_V(ABS(p_position.x), 1 << 20, -1);
|
||||
ERR_FAIL_INDEX_V(ABS(p_position.y), 1 << 20, -1);
|
||||
ERR_FAIL_INDEX_V(ABS(p_position.z), 1 << 20, -1);
|
||||
ERR_FAIL_INDEX_V(Math::abs(p_position.x), 1 << 20, -1);
|
||||
ERR_FAIL_INDEX_V(Math::abs(p_position.y), 1 << 20, -1);
|
||||
ERR_FAIL_INDEX_V(Math::abs(p_position.z), 1 << 20, -1);
|
||||
|
||||
IndexKey key;
|
||||
key.x = p_position.x;
|
||||
|
|
@ -529,12 +538,15 @@ Vector3 GridMap::map_to_local(const Vector3i &p_map_position) const {
|
|||
void GridMap::_octant_transform(const OctantKey &p_key) {
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
|
||||
if (g.collision_debug_instance.is_valid()) {
|
||||
RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform());
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
// update transform for NavigationServer regions and navigation debugmesh instances
|
||||
for (const KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
|
||||
if (bake_navigation) {
|
||||
|
|
@ -546,6 +558,7 @@ void GridMap::_octant_transform(const OctantKey &p_key) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform());
|
||||
|
|
@ -559,6 +572,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
//erase body shapes
|
||||
PhysicsServer3D::get_singleton()->body_clear_shapes(g.static_body);
|
||||
|
||||
|
|
@ -566,7 +580,9 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
if (g.collision_debug.is_valid()) {
|
||||
RS::get_singleton()->mesh_clear(g.collision_debug);
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
//erase navigation
|
||||
for (KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
|
||||
if (E.value.region.is_valid()) {
|
||||
|
|
@ -579,6 +595,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
}
|
||||
}
|
||||
g.navigation_cell_ids.clear();
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
//erase multimeshes
|
||||
|
||||
|
|
@ -588,7 +605,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
}
|
||||
g.multimesh_instances.clear();
|
||||
|
||||
if (g.cells.size() == 0) {
|
||||
if (g.cells.is_empty()) {
|
||||
//octant no longer needed
|
||||
_octant_clean_up(p_key);
|
||||
return true;
|
||||
|
|
@ -620,7 +637,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
xform.basis = _ortho_bases[c.rot];
|
||||
xform.set_origin(cellpos * cell_size + ofs);
|
||||
xform.basis.scale(Vector3(cell_scale, cell_scale, cell_scale));
|
||||
if (baked_meshes.size() == 0) {
|
||||
if (baked_meshes.is_empty()) {
|
||||
if (mesh_library->get_item_mesh(c.item).is_valid()) {
|
||||
if (!multimesh_items.has(c.item)) {
|
||||
multimesh_items[c.item] = List<Pair<Transform3D, IndexKey>>();
|
||||
|
|
@ -633,6 +650,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
Vector<MeshLibrary::ShapeData> shapes = mesh_library->get_item_shapes(c.item);
|
||||
// add the item's shape at given xform to octant's static_body
|
||||
for (int i = 0; i < shapes.size(); i++) {
|
||||
|
|
@ -645,7 +663,9 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
shapes.write[i].shape->add_vertices_to_array(col_debug, xform * shapes[i].local_transform);
|
||||
}
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
// add the item's navigation_mesh at given xform to GridMap's Navigation ancestor
|
||||
Ref<NavigationMesh> navigation_mesh = mesh_library->get_item_navigation_mesh(c.item);
|
||||
if (navigation_mesh.is_valid()) {
|
||||
|
|
@ -686,16 +706,17 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
}
|
||||
g.navigation_cell_ids[E] = nm;
|
||||
}
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
if (bake_navigation) {
|
||||
_update_octant_navigation_debug_edge_connections_mesh(p_key);
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
|
||||
//update multimeshes, only if not baked
|
||||
if (baked_meshes.size() == 0) {
|
||||
if (baked_meshes.is_empty()) {
|
||||
for (const KeyValue<int, List<Pair<Transform3D, IndexKey>>> &E : multimesh_items) {
|
||||
Octant::MultimeshInstance mmi;
|
||||
|
||||
|
|
@ -736,6 +757,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
if (col_debug.size()) {
|
||||
Array arr;
|
||||
arr.resize(RS::ARRAY_MAX);
|
||||
|
|
@ -747,12 +769,14 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
RS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid());
|
||||
}
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
g.dirty = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
void GridMap::_update_physics_bodies_collision_properties() {
|
||||
for (const KeyValue<OctantKey, Octant *> &E : octant_map) {
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_layer(E.value->static_body, collision_layer);
|
||||
|
|
@ -773,10 +797,12 @@ void GridMap::_update_physics_bodies_characteristics() {
|
|||
PhysicsServer3D::get_singleton()->body_set_param(E.value->static_body, PhysicsServer3D::BODY_PARAM_BOUNCE, bounce);
|
||||
}
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
void GridMap::_octant_enter_world(const OctantKey &p_key) {
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_set_space(g.static_body, get_world_3d()->get_space());
|
||||
|
||||
|
|
@ -784,12 +810,14 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
|
|||
RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world_3d()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform());
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world_3d()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform());
|
||||
}
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
if (bake_navigation && mesh_library.is_valid()) {
|
||||
for (KeyValue<IndexKey, Octant::NavigationCell> &F : g.navigation_cell_ids) {
|
||||
if (cell_map.has(F.key) && F.value.region.is_valid() == false) {
|
||||
|
|
@ -824,26 +852,35 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
|
|||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
}
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
}
|
||||
|
||||
void GridMap::_octant_exit_world(const OctantKey &p_key) {
|
||||
ERR_FAIL_NULL(RenderingServer::get_singleton());
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_set_space(g.static_body, RID());
|
||||
|
||||
if (g.collision_debug_instance.is_valid()) {
|
||||
RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID());
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID());
|
||||
}
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
for (KeyValue<IndexKey, Octant::NavigationCell> &F : g.navigation_cell_ids) {
|
||||
if (F.value.region.is_valid()) {
|
||||
NavigationServer3D::get_singleton()->free(F.value.region);
|
||||
|
|
@ -854,6 +891,7 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
|
|||
F.value.navigation_mesh_debug_instance = RID();
|
||||
}
|
||||
}
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (bake_navigation) {
|
||||
|
|
@ -870,12 +908,17 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
|
|||
|
||||
void GridMap::_octant_clean_up(const OctantKey &p_key) {
|
||||
ERR_FAIL_NULL(RenderingServer::get_singleton());
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
if (g.collision_debug.is_valid()) {
|
||||
RS::get_singleton()->free(g.collision_debug);
|
||||
}
|
||||
|
|
@ -884,7 +927,9 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) {
|
|||
}
|
||||
|
||||
PhysicsServer3D::get_singleton()->free(g.static_body);
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
// Erase navigation
|
||||
for (const KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
|
||||
if (E.value.region.is_valid()) {
|
||||
|
|
@ -895,6 +940,7 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) {
|
|||
}
|
||||
}
|
||||
g.navigation_cell_ids.clear();
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (bake_navigation) {
|
||||
|
|
@ -933,11 +979,11 @@ void GridMap::_notification(int p_what) {
|
|||
} break;
|
||||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
if (bake_navigation && NavigationServer3D::get_singleton()->get_debug_navigation_enabled()) {
|
||||
_update_navigation_debug_edge_connections();
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
_update_visibility();
|
||||
} break;
|
||||
|
||||
|
|
@ -1061,6 +1107,7 @@ void GridMap::_update_octants_callback() {
|
|||
}
|
||||
|
||||
void GridMap::_bind_methods() {
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &GridMap::set_collision_layer);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_layer"), &GridMap::get_collision_layer);
|
||||
|
||||
|
|
@ -1078,12 +1125,15 @@ void GridMap::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("set_physics_material", "material"), &GridMap::set_physics_material);
|
||||
ClassDB::bind_method(D_METHOD("get_physics_material"), &GridMap::get_physics_material);
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_bake_navigation", "bake_navigation"), &GridMap::set_bake_navigation);
|
||||
ClassDB::bind_method(D_METHOD("is_baking_navigation"), &GridMap::is_baking_navigation);
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &GridMap::set_navigation_map);
|
||||
ClassDB::bind_method(D_METHOD("get_navigation_map"), &GridMap::get_navigation_map);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_mesh_library", "mesh_library"), &GridMap::set_mesh_library);
|
||||
ClassDB::bind_method(D_METHOD("get_mesh_library"), &GridMap::get_mesh_library);
|
||||
|
|
@ -1139,10 +1189,12 @@ void GridMap::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_y"), "set_center_y", "get_center_y");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_z"), "set_center_z", "get_center_z");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell_scale"), "set_cell_scale", "get_cell_scale");
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
ADD_GROUP("Collision", "collision_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_priority"), "set_collision_priority", "get_collision_priority");
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
ADD_GROUP("Navigation", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bake_navigation"), "set_bake_navigation", "is_baking_navigation");
|
||||
|
||||
|
|
@ -1344,12 +1396,13 @@ RID GridMap::get_bake_mesh_instance(int p_idx) {
|
|||
|
||||
GridMap::GridMap() {
|
||||
set_notify_transform(true);
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &GridMap::_navigation_map_changed));
|
||||
NavigationServer3D::get_singleton()->connect("navigation_debug_changed", callable_mp(this, &GridMap::_update_navigation_debug_edge_connections));
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
}
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
void GridMap::navmesh_parse_init() {
|
||||
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
|
||||
if (!_navmesh_source_geometry_parser.is_valid()) {
|
||||
|
|
@ -1367,7 +1420,9 @@ void GridMap::navmesh_parse_source_geometry(const Ref<NavigationMesh> &p_navigat
|
|||
}
|
||||
|
||||
NavigationMesh::ParsedGeometryType parsed_geometry_type = p_navigation_mesh->get_parsed_geometry_type();
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
uint32_t parsed_collision_mask = p_navigation_mesh->get_collision_mask();
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
if (parsed_geometry_type == NavigationMesh::PARSED_GEOMETRY_MESH_INSTANCES || parsed_geometry_type == NavigationMesh::PARSED_GEOMETRY_BOTH) {
|
||||
Array meshes = gridmap->get_meshes();
|
||||
|
|
@ -1379,7 +1434,7 @@ void GridMap::navmesh_parse_source_geometry(const Ref<NavigationMesh> &p_navigat
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
else if ((parsed_geometry_type == NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS || parsed_geometry_type == NavigationMesh::PARSED_GEOMETRY_BOTH) && (gridmap->get_collision_layer() & parsed_collision_mask)) {
|
||||
Array shapes = gridmap->get_collision_shapes();
|
||||
for (int i = 0; i < shapes.size(); i += 2) {
|
||||
|
|
@ -1485,9 +1540,11 @@ void GridMap::navmesh_parse_source_geometry(const Ref<NavigationMesh> &p_navigat
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
}
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
void GridMap::_update_navigation_debug_edge_connections() {
|
||||
if (bake_navigation) {
|
||||
for (const KeyValue<OctantKey, Octant *> &E : octant_map) {
|
||||
|
|
@ -1501,17 +1558,17 @@ void GridMap::_navigation_map_changed(RID p_map) {
|
|||
_update_navigation_debug_edge_connections();
|
||||
}
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
|
||||
GridMap::~GridMap() {
|
||||
clear();
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
NavigationServer3D::get_singleton()->disconnect("map_changed", callable_mp(this, &GridMap::_navigation_map_changed));
|
||||
NavigationServer3D::get_singleton()->disconnect("navigation_debug_changed", callable_mp(this, &GridMap::_update_navigation_debug_edge_connections));
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
void GridMap::_update_octant_navigation_debug_edge_connections_mesh(const OctantKey &p_key) {
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
|
|
@ -1585,7 +1642,7 @@ void GridMap::_update_octant_navigation_debug_edge_connections_mesh(const Octant
|
|||
}
|
||||
}
|
||||
|
||||
if (vertex_array.size() == 0) {
|
||||
if (vertex_array.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1609,4 +1666,4 @@ void GridMap::_update_octant_navigation_debug_edge_connections_mesh(const Octant
|
|||
RS::get_singleton()->instance_set_visible(g.navigation_debug_edge_connections_instance, false);
|
||||
}
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GRID_MAP_H
|
||||
#define GRID_MAP_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/3d/mesh_library.h"
|
||||
|
|
@ -40,7 +39,9 @@
|
|||
|
||||
class NavigationMesh;
|
||||
class NavigationMeshSourceGeometryData3D;
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
class PhysicsMaterial;
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
class GridMap : public Node3D {
|
||||
GDCLASS(GridMap, Node3D);
|
||||
|
|
@ -151,10 +152,12 @@ class GridMap : public Node3D {
|
|||
OctantKey() {}
|
||||
};
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
uint32_t collision_layer = 1;
|
||||
uint32_t collision_mask = 1;
|
||||
real_t collision_priority = 1.0;
|
||||
Ref<PhysicsMaterial> physics_material;
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
bool bake_navigation = false;
|
||||
RID map_override;
|
||||
|
||||
|
|
@ -188,18 +191,20 @@ class GridMap : public Node3D {
|
|||
return Vector3(p_key.x, p_key.y, p_key.z) * cell_size * octant_size;
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
void _update_physics_bodies_collision_properties();
|
||||
void _update_physics_bodies_characteristics();
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
void _octant_enter_world(const OctantKey &p_key);
|
||||
void _octant_exit_world(const OctantKey &p_key);
|
||||
bool _octant_update(const OctantKey &p_key);
|
||||
void _octant_clean_up(const OctantKey &p_key);
|
||||
void _octant_transform(const OctantKey &p_key);
|
||||
#ifdef DEBUG_ENABLED
|
||||
#if defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
void _update_octant_navigation_debug_edge_connections_mesh(const OctantKey &p_key);
|
||||
void _navigation_map_changed(RID p_map);
|
||||
void _update_navigation_debug_edge_connections();
|
||||
#endif // DEBUG_ENABLED
|
||||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
bool awaiting_update = false;
|
||||
|
||||
void _queue_octants_dirty();
|
||||
|
|
@ -234,6 +239,7 @@ public:
|
|||
INVALID_CELL_ITEM = -1
|
||||
};
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
void set_collision_layer(uint32_t p_layer);
|
||||
uint32_t get_collision_layer() const;
|
||||
|
||||
|
|
@ -253,12 +259,15 @@ public:
|
|||
Ref<PhysicsMaterial> get_physics_material() const;
|
||||
|
||||
Array get_collision_shapes() const;
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
void set_bake_navigation(bool p_bake_navigation);
|
||||
bool is_baking_navigation();
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
void set_navigation_map(RID p_navigation_map);
|
||||
RID get_navigation_map() const;
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
void set_mesh_library(const Ref<MeshLibrary> &p_mesh_library);
|
||||
Ref<MeshLibrary> get_mesh_library() const;
|
||||
|
|
@ -302,16 +311,18 @@ public:
|
|||
Array get_bake_meshes();
|
||||
RID get_bake_mesh_instance(int p_idx);
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
private:
|
||||
static Callable _navmesh_source_geometry_parsing_callback;
|
||||
static RID _navmesh_source_geometry_parser;
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
public:
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
static void navmesh_parse_init();
|
||||
static void navmesh_parse_source_geometry(const Ref<NavigationMesh> &p_navigation_mesh, Ref<NavigationMeshSourceGeometryData3D> p_source_geometry_data, Node *p_node);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
GridMap();
|
||||
~GridMap();
|
||||
};
|
||||
|
||||
#endif // GRID_MAP_H
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#fc7f7f" d="m8 1-6 3v8l6 3 6-3v-2l-2-1-4 2-2-1v-4l2-1v-2l2-1zm4 2-2 1v2l2 1 2-1v-2z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#fc7f7f" d="m8 1-6 3v8l6 3 6-3v-2l-2-1-4 2-2-1v-4l2-1v-2l2-1zm4 2-2 1v2l2 1 2-1v-2z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 168 B |
|
|
@ -43,7 +43,9 @@
|
|||
void initialize_gridmap_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
GDREGISTER_CLASS(GridMap);
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
GridMap::navmesh_parse_init();
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
}
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||
|
|
|
|||
|
|
@ -28,12 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GRIDMAP_REGISTER_TYPES_H
|
||||
#define GRIDMAP_REGISTER_TYPES_H
|
||||
#pragma once
|
||||
|
||||
#include "modules/register_module_types.h"
|
||||
|
||||
void initialize_gridmap_module(ModuleInitializationLevel p_level);
|
||||
void uninitialize_gridmap_module(ModuleInitializationLevel p_level);
|
||||
|
||||
#endif // GRIDMAP_REGISTER_TYPES_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue