diff options
Diffstat (limited to 'modules/gridmap')
-rw-r--r-- | modules/gridmap/SCsub | 4 | ||||
-rw-r--r-- | modules/gridmap/config.py | 3 | ||||
-rw-r--r-- | modules/gridmap/doc_classes/GridMap.xml | 2 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 158 | ||||
-rw-r--r-- | modules/gridmap/grid_map.h | 14 | ||||
-rw-r--r-- | modules/gridmap/grid_map_editor_plugin.cpp | 171 | ||||
-rw-r--r-- | modules/gridmap/grid_map_editor_plugin.h | 10 |
7 files changed, 183 insertions, 179 deletions
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub index 62b8a0ff93..970ce534f0 100644 --- a/modules/gridmap/SCsub +++ b/modules/gridmap/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_gridmap = env_modules.Clone() diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index 5022116c9b..a6319fe1ea 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "GridMap", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 37ebb3e5d5..a213069e19 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GridMap" inherits="Spatial" version="4.0"> +<class name="GridMap" inherits="Node3D" version="4.0"> <brief_description> Node for 3D tile-based maps. </brief_description> diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 7273a014f0..df7c2f397f 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -32,12 +32,12 @@ #include "core/io/marshalls.h" #include "core/message_queue.h" -#include "scene/3d/light.h" +#include "scene/3d/light_3d.h" #include "scene/resources/mesh_library.h" #include "scene/resources/surface_tool.h" #include "scene/scene_string_names.h" -#include "servers/navigation_server.h" -#include "servers/visual_server.h" +#include "servers/navigation_server_3d.h" +#include "servers/rendering_server.h" bool GridMap::_set(const StringName &p_name, const Variant &p_value) { @@ -76,12 +76,12 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) { BakedMesh bm; bm.mesh = meshes[i]; ERR_CONTINUE(!bm.mesh.is_valid()); - bm.instance = VS::get_singleton()->instance_create(); - VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); - VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); + bm.instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); + RS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); if (is_inside_tree()) { - VS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); } baked_meshes.push_back(bm); } @@ -306,17 +306,17 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) { //create octant because it does not exist Octant *g = memnew(Octant); g->dirty = true; - g->static_body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC); - PhysicsServer::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id()); - PhysicsServer::get_singleton()->body_set_collision_layer(g->static_body, collision_layer); - PhysicsServer::get_singleton()->body_set_collision_mask(g->static_body, collision_mask); + g->static_body = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC); + PhysicsServer3D::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id()); + PhysicsServer3D::get_singleton()->body_set_collision_layer(g->static_body, collision_layer); + PhysicsServer3D::get_singleton()->body_set_collision_mask(g->static_body, collision_mask); SceneTree *st = SceneTree::get_singleton(); if (st && st->is_debugging_collisions_hint()) { - g->collision_debug = VisualServer::get_singleton()->mesh_create(); - g->collision_debug_instance = VisualServer::get_singleton()->instance_create(); - VisualServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug); + g->collision_debug = RenderingServer::get_singleton()->mesh_create(); + g->collision_debug_instance = RenderingServer::get_singleton()->instance_create(); + RenderingServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug); } octant_map[octantkey] = g; @@ -392,14 +392,14 @@ void GridMap::_octant_transform(const OctantKey &p_key) { ERR_FAIL_COND(!octant_map.has(p_key)); Octant &g = *octant_map[p_key]; - PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); + PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); if (g.collision_debug_instance.is_valid()) { - VS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); + RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); } for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); } } @@ -410,17 +410,17 @@ bool GridMap::_octant_update(const OctantKey &p_key) { return false; //erase body shapes - PhysicsServer::get_singleton()->body_clear_shapes(g.static_body); + PhysicsServer3D::get_singleton()->body_clear_shapes(g.static_body); //erase body shapes debug if (g.collision_debug.is_valid()) { - VS::get_singleton()->mesh_clear(g.collision_debug); + RS::get_singleton()->mesh_clear(g.collision_debug); } //erase navigation for (Map<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) { - NavigationServer::get_singleton()->free(E->get().region); + NavigationServer3D::get_singleton()->free(E->get().region); } g.navmesh_ids.clear(); @@ -428,8 +428,8 @@ bool GridMap::_octant_update(const OctantKey &p_key) { for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->free(g.multimesh_instances[i].instance); - VS::get_singleton()->free(g.multimesh_instances[i].multimesh); + RS::get_singleton()->free(g.multimesh_instances[i].instance); + RS::get_singleton()->free(g.multimesh_instances[i].multimesh); } g.multimesh_instances.clear(); @@ -484,7 +484,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { // add the item's shape if (!shapes[i].shape.is_valid()) continue; - PhysicsServer::get_singleton()->body_add_shape(g.static_body, shapes[i].shape->get_rid(), xform * shapes[i].local_transform); + PhysicsServer3D::get_singleton()->body_add_shape(g.static_body, shapes[i].shape->get_rid(), xform * shapes[i].local_transform); if (g.collision_debug.is_valid()) { shapes.write[i].shape->add_vertices_to_array(col_debug, xform * shapes[i].local_transform); } @@ -497,10 +497,10 @@ bool GridMap::_octant_update(const OctantKey &p_key) { nm.xform = xform * mesh_library->get_item_navmesh_transform(c.item); if (navigation) { - RID region = NavigationServer::get_singleton()->region_create(); - NavigationServer::get_singleton()->region_set_navmesh(region, navmesh); - NavigationServer::get_singleton()->region_set_transform(region, navigation->get_global_transform() * nm.xform); - NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid()); + RID region = NavigationServer3D::get_singleton()->region_create(); + NavigationServer3D::get_singleton()->region_set_navmesh(region, navmesh); + NavigationServer3D::get_singleton()->region_set_transform(region, navigation->get_global_transform() * nm.xform); + NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid()); nm.region = region; } g.navmesh_ids[E->get()] = nm; @@ -513,13 +513,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) { for (Map<int, List<Pair<Transform, IndexKey>>>::Element *E = multimesh_items.front(); E; E = E->next()) { Octant::MultimeshInstance mmi; - RID mm = VS::get_singleton()->multimesh_create(); - VS::get_singleton()->multimesh_allocate(mm, E->get().size(), VS::MULTIMESH_TRANSFORM_3D); - VS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid()); + RID mm = RS::get_singleton()->multimesh_create(); + RS::get_singleton()->multimesh_allocate(mm, E->get().size(), RS::MULTIMESH_TRANSFORM_3D); + RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid()); int idx = 0; for (List<Pair<Transform, IndexKey>>::Element *F = E->get().front(); F; F = F->next()) { - VS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first); + RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first); #ifdef TOOLS_ENABLED Octant::MultimeshInstance::Item it; @@ -532,12 +532,12 @@ bool GridMap::_octant_update(const OctantKey &p_key) { idx++; } - RID instance = VS::get_singleton()->instance_create(); - VS::get_singleton()->instance_set_base(instance, mm); + RID instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->instance_set_base(instance, mm); if (is_inside_tree()) { - VS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(instance, get_global_transform()); } mmi.multimesh = mm; @@ -550,13 +550,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) { if (col_debug.size()) { Array arr; - arr.resize(VS::ARRAY_MAX); - arr[VS::ARRAY_VERTEX] = col_debug; + arr.resize(RS::ARRAY_MAX); + arr[RS::ARRAY_VERTEX] = col_debug; - VS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, VS::PRIMITIVE_LINES, arr); + RS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, RS::PRIMITIVE_LINES, arr); SceneTree *st = SceneTree::get_singleton(); if (st) { - VS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid()); + RS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid()); } } @@ -567,8 +567,8 @@ bool GridMap::_octant_update(const OctantKey &p_key) { void GridMap::_reset_physic_bodies_collision_filters() { for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) { - PhysicsServer::get_singleton()->body_set_collision_layer(E->get()->static_body, collision_layer); - PhysicsServer::get_singleton()->body_set_collision_mask(E->get()->static_body, collision_mask); + PhysicsServer3D::get_singleton()->body_set_collision_layer(E->get()->static_body, collision_layer); + PhysicsServer3D::get_singleton()->body_set_collision_mask(E->get()->static_body, collision_mask); } } @@ -576,17 +576,17 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { ERR_FAIL_COND(!octant_map.has(p_key)); Octant &g = *octant_map[p_key]; - PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); - PhysicsServer::get_singleton()->body_set_space(g.static_body, get_world()->get_space()); + 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()->get_space()); if (g.collision_debug_instance.is_valid()) { - VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); } for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); } if (navigation && mesh_library.is_valid()) { @@ -595,10 +595,10 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { if (cell_map.has(F->key()) && F->get().region.is_valid() == false) { Ref<NavigationMesh> nm = mesh_library->get_item_navmesh(cell_map[F->key()].item); if (nm.is_valid()) { - RID region = NavigationServer::get_singleton()->region_create(); - NavigationServer::get_singleton()->region_set_navmesh(region, nm); - NavigationServer::get_singleton()->region_set_transform(region, navigation->get_global_transform() * F->get().xform); - NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid()); + RID region = NavigationServer3D::get_singleton()->region_create(); + NavigationServer3D::get_singleton()->region_set_navmesh(region, nm); + NavigationServer3D::get_singleton()->region_set_transform(region, navigation->get_global_transform() * F->get().xform); + NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid()); F->get().region = region; } } @@ -610,23 +610,23 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) { ERR_FAIL_COND(!octant_map.has(p_key)); Octant &g = *octant_map[p_key]; - PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); - PhysicsServer::get_singleton()->body_set_space(g.static_body, RID()); + 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()) { - VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID()); + RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID()); } for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID()); + RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID()); } if (navigation) { for (Map<IndexKey, Octant::NavMesh>::Element *F = g.navmesh_ids.front(); F; F = F->next()) { if (F->get().region.is_valid()) { - NavigationServer::get_singleton()->free(F->get().region); + NavigationServer3D::get_singleton()->free(F->get().region); F->get().region = RID(); } } @@ -639,15 +639,15 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) { Octant &g = *octant_map[p_key]; if (g.collision_debug.is_valid()) - VS::get_singleton()->free(g.collision_debug); + RS::get_singleton()->free(g.collision_debug); if (g.collision_debug_instance.is_valid()) - VS::get_singleton()->free(g.collision_debug_instance); + RS::get_singleton()->free(g.collision_debug_instance); - PhysicsServer::get_singleton()->free(g.static_body); + PhysicsServer3D::get_singleton()->free(g.static_body); // Erase navigation for (Map<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) { - NavigationServer::get_singleton()->free(E->get().region); + NavigationServer3D::get_singleton()->free(E->get().region); } g.navmesh_ids.clear(); @@ -655,8 +655,8 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) { for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->free(g.multimesh_instances[i].instance); - VS::get_singleton()->free(g.multimesh_instances[i].multimesh); + RS::get_singleton()->free(g.multimesh_instances[i].instance); + RS::get_singleton()->free(g.multimesh_instances[i].multimesh); } g.multimesh_instances.clear(); } @@ -667,14 +667,14 @@ void GridMap::_notification(int p_what) { case NOTIFICATION_ENTER_WORLD: { - Spatial *c = this; + Node3D *c = this; while (c) { - navigation = Object::cast_to<Navigation>(c); + navigation = Object::cast_to<Navigation3D>(c); if (navigation) { break; } - c = Object::cast_to<Spatial>(c->get_parent()); + c = Object::cast_to<Node3D>(c->get_parent()); } last_transform = get_global_transform(); @@ -684,8 +684,8 @@ void GridMap::_notification(int p_what) { } for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); } } break; @@ -702,7 +702,7 @@ void GridMap::_notification(int p_what) { last_transform = new_xform; for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); } } break; @@ -712,13 +712,13 @@ void GridMap::_notification(int p_what) { _octant_exit_world(E->key()); } - navigation = NULL; + navigation = nullptr; //_queue_octants_dirty(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS); //_update_octants_callback(); //_update_area_instances(); for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, RID()); + RS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, RID()); } } break; @@ -738,7 +738,7 @@ void GridMap::_update_visibility() { Octant *octant = e->value(); for (int i = 0; i < octant->multimesh_instances.size(); i++) { const Octant::MultimeshInstance &mi = octant->multimesh_instances[i]; - VS::get_singleton()->instance_set_visible(mi.instance, is_visible()); + RS::get_singleton()->instance_set_visible(mi.instance, is_visible()); } } } @@ -975,7 +975,7 @@ Vector3 GridMap::_get_offset() const { void GridMap::clear_baked_meshes() { for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->free(baked_meshes[i].instance); + RS::get_singleton()->free(baked_meshes[i].instance); } baked_meshes.clear(); @@ -1050,12 +1050,12 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe BakedMesh bm; bm.mesh = mesh; - bm.instance = VS::get_singleton()->instance_create(); - VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); - VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); + bm.instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); + RS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); if (is_inside_tree()) { - VS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); } if (p_gen_lightmap_uv) { @@ -1107,7 +1107,7 @@ GridMap::GridMap() { clip_above = true; cell_scale = 1.0; - navigation = NULL; + navigation = nullptr; set_notify_transform(true); recreating_octants = false; } diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index cc1c8c2923..3f3da09fe9 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -31,17 +31,17 @@ #ifndef GRID_MAP_H #define GRID_MAP_H -#include "scene/3d/navigation.h" -#include "scene/3d/spatial.h" +#include "scene/3d/navigation_3d.h" +#include "scene/3d/node_3d.h" #include "scene/resources/mesh_library.h" #include "scene/resources/multimesh.h" //heh heh, godotsphir!! this shares no code and the design is completely different with previous projects i've done.. //should scale better with hardware that supports instancing -class GridMap : public Spatial { +class GridMap : public Node3D { - GDCLASS(GridMap, Spatial); + GDCLASS(GridMap, Node3D); enum { MAP_DIRTY_TRANSFORMS = 1, @@ -147,7 +147,7 @@ class GridMap : public Spatial { int octant_size; bool center_x, center_y, center_z; float cell_scale; - Navigation *navigation; + Navigation3D *navigation; bool clip; bool clip_above; @@ -166,10 +166,10 @@ class GridMap : public Spatial { struct BakeLight { - VS::LightType type; + RS::LightType type; Vector3 pos; Vector3 dir; - float param[VS::LIGHT_PARAM_MAX]; + float param[RS::LIGHT_PARAM_MAX]; }; _FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const { diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index a656ee8b63..9c3101945a 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -29,19 +29,20 @@ /*************************************************************************/ #include "grid_map_editor_plugin.h" -#include "core/os/input.h" +#include "core/input/input.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" -#include "editor/plugins/spatial_editor_plugin.h" -#include "scene/3d/camera.h" +#include "editor/plugins/node_3d_editor_plugin.h" +#include "scene/3d/camera_3d.h" #include "core/math/geometry.h" #include "core/os/keyboard.h" +#include "scene/main/window.h" void GridMapEditor::_node_removed(Node *p_node) { if (p_node == node) - node = NULL; + node = nullptr; } void GridMapEditor::_configure() { @@ -280,8 +281,8 @@ void GridMapEditor::_update_cursor_transform() { cursor_transform = node->get_global_transform() * cursor_transform; if (cursor_instance.is_valid()) { - VisualServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); - VisualServer::get_singleton()->instance_set_visible(cursor_instance, cursor_visible); + RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); + RenderingServer::get_singleton()->instance_set_visible(cursor_instance, cursor_visible); } } @@ -291,9 +292,9 @@ void GridMapEditor::_update_selection_transform() { if (!selection.active) { - VisualServer::get_singleton()->instance_set_transform(selection_instance, xf_zero); + RenderingServer::get_singleton()->instance_set_transform(selection_instance, xf_zero); for (int i = 0; i < 3; i++) { - VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); + RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); } return; } @@ -302,11 +303,11 @@ void GridMapEditor::_update_selection_transform() { xf.scale((Vector3(1, 1, 1) + (selection.end - selection.begin)) * node->get_cell_size()); xf.origin = selection.begin * node->get_cell_size(); - VisualServer::get_singleton()->instance_set_transform(selection_instance, node->get_global_transform() * xf); + RenderingServer::get_singleton()->instance_set_transform(selection_instance, node->get_global_transform() * xf); for (int i = 0; i < 3; i++) { if (i != edit_axis || (edit_floor[edit_axis] < selection.begin[edit_axis]) || (edit_floor[edit_axis] > selection.end[edit_axis] + 1)) { - VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); + RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); } else { Vector3 scale = (selection.end - selection.begin + Vector3(1, 1, 1)); @@ -321,7 +322,7 @@ void GridMapEditor::_update_selection_transform() { xf2.basis.scale(scale); xf2.origin = pos; - VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2); + RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2); } } } @@ -361,7 +362,7 @@ void GridMapEditor::_set_selection(bool p_active, const Vector3 &p_begin, const options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_SELECTION_FILL), !selection.active); } -bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click) { +bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, bool p_click) { if (!spatial_editor) return false; @@ -374,7 +375,7 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo if (input_action != INPUT_PICK && input_action != INPUT_SELECT && input_action != INPUT_PASTE && !mesh_library->has_item(selected_palette)) return false; - Camera *camera = p_camera; + Camera3D *camera = p_camera; Vector3 from = camera->project_ray_origin(p_point); Vector3 normal = camera->project_ray_normal(p_point); Transform local_xform = node->get_global_transform().affine_inverse(); @@ -415,7 +416,7 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo } } - VS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform); + RS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform); if (cursor_instance.is_valid()) { @@ -527,7 +528,7 @@ void GridMapEditor::_clear_clipboard_data() { for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) { - VisualServer::get_singleton()->free(E->get().instance); + RenderingServer::get_singleton()->free(E->get().instance); } clipboard_items.clear(); @@ -555,7 +556,7 @@ void GridMapEditor::_set_clipboard_data() { item.cell_item = itm; item.grid_offset = Vector3(i, j, k) - selection.begin; item.orientation = node->get_cell_item_orientation(i, j, k); - item.instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); + item.instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); clipboard_items.push_back(item); } @@ -569,7 +570,7 @@ void GridMapEditor::_update_paste_indicator() { Transform xf; xf.basis.set_zero(); - VisualServer::get_singleton()->instance_set_transform(paste_instance, xf); + RenderingServer::get_singleton()->instance_set_transform(paste_instance, xf); return; } @@ -583,7 +584,7 @@ void GridMapEditor::_update_paste_indicator() { xf.basis = rot * xf.basis; xf.translate((-center * node->get_cell_size()) / scale); - VisualServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf); + RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf); for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) { @@ -598,7 +599,7 @@ void GridMapEditor::_update_paste_indicator() { item_rot.set_orthogonal_index(item.orientation); xf.basis = item_rot * xf.basis * node->get_cell_scale(); - VisualServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf); + RenderingServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf); } } @@ -638,7 +639,7 @@ void GridMapEditor::_do_paste() { _clear_clipboard_data(); } -bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) { +bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<InputEvent> &p_event) { if (!node) { return false; } @@ -659,8 +660,8 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu } if (mb->is_pressed()) { - SpatialEditorViewport::NavigationScheme nav_scheme = (SpatialEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); - if ((nav_scheme == SpatialEditorViewport::NAVIGATION_MAYA || nav_scheme == SpatialEditorViewport::NAVIGATION_MODO) && mb->get_alt()) { + Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->get_alt()) { input_action = INPUT_NONE; } else if (mb->get_button_index() == BUTTON_LEFT) { @@ -895,7 +896,7 @@ void GridMapEditor::update_palette() { Ref<MeshLibrary> mesh_library = node->get_mesh_library(); if (mesh_library.is_null()) { - last_mesh_library = NULL; + last_mesh_library = nullptr; search_box->set_text(""); search_box->set_editable(false); info_message->show(); @@ -963,16 +964,16 @@ void GridMapEditor::edit(GridMap *p_gridmap) { _update_selection_transform(); _update_paste_indicator(); - spatial_editor = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen()); + spatial_editor = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen()); if (!node) { set_process(false); for (int i = 0; i < 3; i++) { - VisualServer::get_singleton()->instance_set_visible(grid_instance[i], false); + RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], false); } if (cursor_instance.is_valid()) { - VisualServer::get_singleton()->instance_set_visible(cursor_instance, false); + RenderingServer::get_singleton()->instance_set_visible(cursor_instance, false); } return; @@ -1010,7 +1011,7 @@ void GridMapEditor::update_grid() { edit_grid_xform.basis = Basis(); for (int i = 0; i < 3; i++) { - VisualServer::get_singleton()->instance_set_visible(grid_instance[i], i == edit_axis); + RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], i == edit_axis); } updating = true; @@ -1022,7 +1023,7 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) { Vector3 edited_floor = node->has_meta("_editor_floor_") ? node->get_meta("_editor_floor_") : Variant(); for (int i = 0; i < 3; i++) { - VS::get_singleton()->mesh_clear(grid[i]); + RS::get_singleton()->mesh_clear(grid[i]); edit_floor[i] = edited_floor[i]; } @@ -1064,11 +1065,11 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) { } Array d; - d.resize(VS::ARRAY_MAX); - d[VS::ARRAY_VERTEX] = grid_points[i]; - d[VS::ARRAY_COLOR] = grid_colors[i]; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], VisualServer::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid()); + d.resize(RS::ARRAY_MAX); + d[RS::ARRAY_VERTEX] = grid_points[i]; + d[RS::ARRAY_COLOR] = grid_colors[i]; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], RenderingServer::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid()); } } @@ -1081,13 +1082,13 @@ void GridMapEditor::_notification(int p_what) { mesh_library_palette->connect("item_selected", callable_mp(this, &GridMapEditor::_item_selected_cbk)); for (int i = 0; i < 3; i++) { - grid[i] = VS::get_singleton()->mesh_create(); - grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario()); - selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario()); + grid[i] = RS::get_singleton()->mesh_create(); + grid_instance[i] = RS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario()); + selection_level_instance[i] = RenderingServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario()); } - selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario()); - paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario()); + selection_instance = RenderingServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario()); + paste_instance = RenderingServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario()); _update_selection_transform(); _update_paste_indicator(); @@ -1099,15 +1100,15 @@ void GridMapEditor::_notification(int p_what) { for (int i = 0; i < 3; i++) { - VS::get_singleton()->free(grid_instance[i]); - VS::get_singleton()->free(grid[i]); + RS::get_singleton()->free(grid_instance[i]); + RS::get_singleton()->free(grid[i]); grid_instance[i] = RID(); grid[i] = RID(); - VisualServer::get_singleton()->free(selection_level_instance[i]); + RenderingServer::get_singleton()->free(selection_level_instance[i]); } - VisualServer::get_singleton()->free(selection_instance); - VisualServer::get_singleton()->free(paste_instance); + RenderingServer::get_singleton()->free(selection_instance); + RenderingServer::get_singleton()->free(paste_instance); selection_instance = RID(); paste_instance = RID(); } break; @@ -1122,7 +1123,7 @@ void GridMapEditor::_notification(int p_what) { if (xf != grid_xform) { for (int i = 0; i < 3; i++) { - VS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform); + RS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform); } grid_xform = xf; } @@ -1139,15 +1140,15 @@ void GridMapEditor::_notification(int p_what) { p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis]; p = node->get_transform().xform(p); // plane to snap - SpatialEditorPlugin *sep = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen()); + Node3DEditorPlugin *sep = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen()); if (sep) sep->snap_cursor_to_plane(p); } } break; case NOTIFICATION_THEME_CHANGED: { - options->set_icon(get_icon("GridMap", "EditorIcons")); - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + options->set_icon(get_theme_icon("GridMap", "EditorIcons")); + search_box->set_right_icon(get_theme_icon("Search", "EditorIcons")); } break; } } @@ -1158,7 +1159,7 @@ void GridMapEditor::_update_cursor_instance() { } if (cursor_instance.is_valid()) - VisualServer::get_singleton()->free(cursor_instance); + RenderingServer::get_singleton()->free(cursor_instance); cursor_instance = RID(); if (selected_palette >= 0) { @@ -1167,8 +1168,8 @@ void GridMapEditor::_update_cursor_instance() { Ref<Mesh> mesh = node->get_mesh_library()->get_item_mesh(selected_palette); if (!mesh.is_null() && mesh->get_rid().is_valid()) { - cursor_instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); - VisualServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); + cursor_instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); + RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); } } } @@ -1216,7 +1217,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { spatial_editor_hb = memnew(HBoxContainer); spatial_editor_hb->set_h_size_flags(SIZE_EXPAND_FILL); spatial_editor_hb->set_alignment(BoxContainer::ALIGN_END); - SpatialEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb); + Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb); spin_box_label = memnew(Label); spin_box_label->set_text(TTR("Floor:")); @@ -1226,7 +1227,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { floor->set_min(-32767); floor->set_max(32767); floor->set_step(1); - floor->get_line_edit()->add_constant_override("minimum_spaces", 16); + floor->get_line_edit()->add_theme_constant_override("minimum_spaces", 16); spatial_editor_hb->add_child(floor); floor->connect("value_changed", callable_mp(this, &GridMapEditor::_floor_changed)); @@ -1304,14 +1305,14 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { mode_thumbnail = memnew(ToolButton); mode_thumbnail->set_toggle_mode(true); mode_thumbnail->set_pressed(true); - mode_thumbnail->set_icon(p_editor->get_gui_base()->get_icon("FileThumbnail", "EditorIcons")); + mode_thumbnail->set_icon(p_editor->get_gui_base()->get_theme_icon("FileThumbnail", "EditorIcons")); hb->add_child(mode_thumbnail); mode_thumbnail->connect("pressed", callable_mp(this, &GridMapEditor::_set_display_mode), varray(DISPLAY_THUMBNAIL)); mode_list = memnew(ToolButton); mode_list->set_toggle_mode(true); mode_list->set_pressed(false); - mode_list->set_icon(p_editor->get_gui_base()->get_icon("FileList", "EditorIcons")); + mode_list->set_icon(p_editor->get_gui_base()->get_theme_icon("FileList", "EditorIcons")); hb->add_child(mode_list); mode_list->connect("pressed", callable_mp(this, &GridMapEditor::_set_display_mode), varray(DISPLAY_LIST)); @@ -1352,8 +1353,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { lock_view = false; cursor_rot = 0; - selection_mesh = VisualServer::get_singleton()->mesh_create(); - paste_mesh = VisualServer::get_singleton()->mesh_create(); + selection_mesh = RenderingServer::get_singleton()->mesh_create(); + paste_mesh = RenderingServer::get_singleton()->mesh_create(); { // Selection mesh create. @@ -1430,16 +1431,16 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { } Array d; - d.resize(VS::ARRAY_MAX); + d.resize(RS::ARRAY_MAX); inner_mat.instance(); inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.2)); inner_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); inner_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); - d[VS::ARRAY_VERTEX] = triangles; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_TRIANGLES, d); - VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 0, inner_mat->get_rid()); + d[RS::ARRAY_VERTEX] = triangles; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_TRIANGLES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(selection_mesh, 0, inner_mat->get_rid()); outer_mat.instance(); outer_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.8)); @@ -1453,23 +1454,23 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { selection_floor_mat->set_on_top_of_alpha(); selection_floor_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); - d[VS::ARRAY_VERTEX] = lines; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid()); + d[RS::ARRAY_VERTEX] = lines; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid()); - d[VS::ARRAY_VERTEX] = triangles; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_TRIANGLES, d); - VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid()); + d[RS::ARRAY_VERTEX] = triangles; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, RS::PRIMITIVE_TRIANGLES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid()); - d[VS::ARRAY_VERTEX] = lines; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid()); + d[RS::ARRAY_VERTEX] = lines; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, RS::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid()); for (int i = 0; i < 3; i++) { - d[VS::ARRAY_VERTEX] = square[i]; - selection_level_mesh[i] = VS::get_singleton()->mesh_create(); - VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_level_mesh[i], VS::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(selection_level_mesh[i], 0, selection_floor_mat->get_rid()); + d[RS::ARRAY_VERTEX] = square[i]; + selection_level_mesh[i] = RS::get_singleton()->mesh_create(); + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_level_mesh[i], RS::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(selection_level_mesh[i], 0, selection_floor_mat->get_rid()); } } @@ -1492,24 +1493,24 @@ GridMapEditor::~GridMapEditor() { for (int i = 0; i < 3; i++) { if (grid[i].is_valid()) - VisualServer::get_singleton()->free(grid[i]); + RenderingServer::get_singleton()->free(grid[i]); if (grid_instance[i].is_valid()) - VisualServer::get_singleton()->free(grid_instance[i]); + RenderingServer::get_singleton()->free(grid_instance[i]); if (cursor_instance.is_valid()) - VisualServer::get_singleton()->free(cursor_instance); + RenderingServer::get_singleton()->free(cursor_instance); if (selection_level_instance[i].is_valid()) - VisualServer::get_singleton()->free(selection_level_instance[i]); + RenderingServer::get_singleton()->free(selection_level_instance[i]); if (selection_level_mesh[i].is_valid()) - VisualServer::get_singleton()->free(selection_level_mesh[i]); + RenderingServer::get_singleton()->free(selection_level_mesh[i]); } - VisualServer::get_singleton()->free(selection_mesh); + RenderingServer::get_singleton()->free(selection_mesh); if (selection_instance.is_valid()) - VisualServer::get_singleton()->free(selection_instance); + RenderingServer::get_singleton()->free(selection_instance); - VisualServer::get_singleton()->free(paste_mesh); + RenderingServer::get_singleton()->free(paste_mesh); if (paste_instance.is_valid()) - VisualServer::get_singleton()->free(paste_instance); + RenderingServer::get_singleton()->free(paste_instance); } void GridMapEditorPlugin::_notification(int p_what) { @@ -1518,10 +1519,10 @@ void GridMapEditorPlugin::_notification(int p_what) { switch ((int)EditorSettings::get_singleton()->get("editors/grid_map/editor_side")) { case 0: { // Left. - SpatialEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 0); + Node3DEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 0); } break; case 1: { // Right. - SpatialEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 1); + Node3DEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 1); } break; } } @@ -1547,7 +1548,7 @@ void GridMapEditorPlugin::make_visible(bool p_visible) { grid_map_editor->spatial_editor_hb->hide(); grid_map_editor->hide(); - grid_map_editor->edit(NULL); + grid_map_editor->edit(nullptr); grid_map_editor->set_process(false); } } diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index d6459cee0a..fd880e8b7b 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -36,7 +36,7 @@ #include "editor/pane_drag.h" #include "grid_map.h" -class SpatialEditorPlugin; +class Node3DEditorPlugin; class GridMapEditor : public VBoxContainer { GDCLASS(GridMapEditor, VBoxContainer); @@ -188,7 +188,7 @@ class GridMapEditor : public VBoxContainer { }; - SpatialEditorPlugin *spatial_editor; + Node3DEditorPlugin *spatial_editor; struct AreaDisplay { @@ -232,7 +232,7 @@ class GridMapEditor : public VBoxContainer { void _delete_selection(); void _fill_selection(); - bool do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click); + bool do_input_action(Camera3D *p_camera, const Point2 &p_point, bool p_click); friend class GridMapEditorPlugin; @@ -242,7 +242,7 @@ protected: static void _bind_methods(); public: - bool forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event); + bool forward_spatial_input_event(Camera3D *p_camera, const Ref<InputEvent> &p_event); void edit(GridMap *p_gridmap); GridMapEditor() {} @@ -261,7 +261,7 @@ protected: void _notification(int p_what); public: - virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return grid_map_editor->forward_spatial_input_event(p_camera, p_event); } + virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { return grid_map_editor->forward_spatial_input_event(p_camera, p_event); } virtual String get_name() const { return "GridMap"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); |