From 2aee6ab0bbb5600210a7b2ed6b7747578a7e56c7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 29 Aug 2022 16:49:00 +0200 Subject: [PATCH] Renamed World to World3D. --- doc/classes/NavigationAgent.xml | 2 +- doc/classes/NavigationMeshInstance.xml | 2 +- doc/classes/RenderingServer.xml | 6 +-- doc/classes/Spatial.xml | 8 +-- doc/classes/Viewport.xml | 10 ++-- doc/classes/World.xml | 2 +- doc/translations/classes.pot | 18 +++---- doc/translations/hu.po | 18 +++---- editor/icons/icon_world.svg | 54 ++++++++++++++++++- editor/icons/icon_world_3d.svg | 1 + editor/plugins/material_editor_plugin.cpp | 2 +- editor/plugins/mesh_editor_plugin.cpp | 2 +- main/tests/test_oa_hash_map.cpp | 2 +- modules/props/prop_instance_prop_job.cpp | 2 +- .../skeleton_modification_3d_jiggle.cpp | 2 +- .../world/default/terrain_chunk_default.cpp | 4 +- .../terraman/world/jobs/terrain_prop_job.cpp | 2 +- .../default/terrain_2d_chunk_default.cpp | 2 +- .../world/jobs/terrain_2d_prop_job.cpp | 2 +- .../world/default/voxel_chunk_default.cpp | 4 +- .../voxelman/world/jobs/voxel_prop_job.cpp | 2 +- scene/3d/audio_stream_player_3d.cpp | 2 +- scene/3d/collision_object.cpp | 2 +- scene/3d/ray_cast.cpp | 2 +- scene/3d/room_manager.cpp | 6 +-- scene/3d/shape_cast.cpp | 2 +- scene/3d/spatial.cpp | 6 +-- scene/3d/spatial.h | 4 +- scene/3d/visibility_notifier.h | 4 +- scene/main/scene_tree.cpp | 2 +- scene/main/viewport.cpp | 16 +++--- scene/main/viewport.h | 12 ++--- scene/register_scene_types.cpp | 2 +- scene/resources/world.cpp | 54 +++++++++---------- scene/resources/world.h | 15 +++--- 35 files changed, 165 insertions(+), 111 deletions(-) create mode 100644 editor/icons/icon_world_3d.svg diff --git a/doc/classes/NavigationAgent.xml b/doc/classes/NavigationAgent.xml index ceacf25d2..0939b0d96 100644 --- a/doc/classes/NavigationAgent.xml +++ b/doc/classes/NavigationAgent.xml @@ -4,7 +4,7 @@ 3D agent used in navigation for collision avoidance. - 3D agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent] is physics safe. + 3D agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent] is physics safe. [b]Note:[/b] After [method set_target_location] is used it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node. diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationMeshInstance.xml index d955bf8f1..54ee7fcf6 100644 --- a/doc/classes/NavigationMeshInstance.xml +++ b/doc/classes/NavigationMeshInstance.xml @@ -2,7 +2,7 @@ An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. - By default this node will register to the default [World] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node. + By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node. Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using [method NavigationServer.map_set_edge_connection_margin]. [b]Note:[/b] Overlapping two regions' navmeshes is not enough for connecting two regions. They must share a similar edge. The cost of entering this region from another region can be controlled with the [member enter_cost] value. diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 5a9b80aed..8f77e758b 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -1296,7 +1296,7 @@ - Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. @@ -1305,7 +1305,7 @@ - Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. @@ -1315,7 +1315,7 @@ - Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index c2a9b9697..bd737737c 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -58,9 +58,9 @@ - + - Returns the current [World] resource this [Spatial] node is registered to. + Returns the current [World3D] resource this [Spatial] node is registered to. @@ -338,10 +338,10 @@ In order for [constant NOTIFICATION_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_transform]. The notification is also sent if the node is in the editor context and it has at least one valid gizmo. - Spatial nodes receives this notification when they are registered to new [World] resource. + Spatial nodes receives this notification when they are registered to new [World3D] resource. - Spatial nodes receives this notification when they are unregistered from current [World] resource. + Spatial nodes receives this notification when they are unregistered from current [World3D] resource. Spatial nodes receives this notification when their visibility changes. diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 55252587e..c7b18dc2c 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -24,9 +24,9 @@ - + - Returns the first valid [World] for this viewport, searching the [member world] property of itself and any Viewport ancestor. + Returns the first valid [World3D] for this viewport, searching the [member world] property of itself and any Viewport ancestor. @@ -246,7 +246,7 @@ The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems. - If [code]true[/code], the viewport will use a unique copy of the [World] defined in [member world]. + If [code]true[/code], the viewport will use a unique copy of the [World3D] defined in [member world]. If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process. @@ -301,8 +301,8 @@ [b]Note:[/b] Enabling this setting does not improve rendering quality. Using full floating-point precision is slower, and is generally only needed for advanced shaders that require a high level of precision. To reduce banding, enable [member debanding] instead. [b]Note:[/b] Only available on the GLES3 backend. - - The custom [World] which can be used as 3D environment source. + + The custom [World3D] which can be used as 3D environment source. The custom [World2D] which can be used as 2D environment source. diff --git a/doc/classes/World.xml b/doc/classes/World.xml index 44a3def0f..790704608 100644 --- a/doc/classes/World.xml +++ b/doc/classes/World.xml @@ -1,5 +1,5 @@ - + Class that has everything pertaining to a world. diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot index a552d229d..22392ec84 100644 --- a/doc/translations/classes.pot +++ b/doc/translations/classes.pot @@ -52644,7 +52644,7 @@ msgstr "" #: doc/classes/Spatial.xml msgid "" -"Returns the current [World] resource this [Spatial] node is registered to." +"Returns the current [World3D] resource this [Spatial] node is registered to." msgstr "" #: doc/classes/Spatial.xml @@ -52905,13 +52905,13 @@ msgstr "" #: doc/classes/Spatial.xml msgid "" "Spatial nodes receives this notification when they are registered to new " -"[World] resource." +"[World3D] resource." msgstr "" #: doc/classes/Spatial.xml msgid "" "Spatial nodes receives this notification when they are unregistered from " -"current [World] resource." +"current [World3D] resource." msgstr "" #: doc/classes/Spatial.xml @@ -63061,7 +63061,7 @@ msgstr "" #: doc/classes/Viewport.xml msgid "" -"Returns the first valid [World] for this viewport, searching the [member " +"Returns the first valid [World3D] for this viewport, searching the [member " "world] property of itself and any Viewport ancestor." msgstr "" @@ -63282,7 +63282,7 @@ msgstr "" #: doc/classes/Viewport.xml msgid "" -"If [code]true[/code], the viewport will use [World] defined in [code]world[/" +"If [code]true[/code], the viewport will use [World3D] defined in [code]world[/" "code] property." msgstr "" @@ -63385,7 +63385,7 @@ msgid "" msgstr "" #: doc/classes/Viewport.xml -msgid "The custom [World] which can be used as 3D environment source." +msgid "The custom [World3D] which can be used as 3D environment source." msgstr "" #: doc/classes/Viewport.xml @@ -66605,7 +66605,7 @@ msgid "" "visual 3D nodes are considered, such as [MeshInstance] or " "[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the " "actual nodes. A scenario RID must be provided, which is available in the " -"[World] you want to query. This forces an update for all resources queued to " +"[World3D] you want to query. This forces an update for all resources queued to " "update.\n" "[b]Warning:[/b] This function is primarily intended for editor usage. For in-" "game use cases, prefer physics collision." @@ -66617,7 +66617,7 @@ msgid "" "Only visual 3D nodes are considered, such as [MeshInstance] or " "[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the " "actual nodes. A scenario RID must be provided, which is available in the " -"[World] you want to query. This forces an update for all resources queued to " +"[World3D] you want to query. This forces an update for all resources queued to " "update.\n" "[b]Warning:[/b] This function is primarily intended for editor usage. For in-" "game use cases, prefer physics collision." @@ -66629,7 +66629,7 @@ msgid "" "visual 3D nodes are considered, such as [MeshInstance] or " "[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the " "actual nodes. A scenario RID must be provided, which is available in the " -"[World] you want to query. This forces an update for all resources queued to " +"[World3D] you want to query. This forces an update for all resources queued to " "update.\n" "[b]Warning:[/b] This function is primarily intended for editor usage. For in-" "game use cases, prefer physics collision." diff --git a/doc/translations/hu.po b/doc/translations/hu.po index 3c0ab1472..bcb454e11 100644 --- a/doc/translations/hu.po +++ b/doc/translations/hu.po @@ -52729,7 +52729,7 @@ msgstr "" #: doc/classes/Spatial.xml msgid "" -"Returns the current [World] resource this [Spatial] node is registered to." +"Returns the current [World3D] resource this [Spatial] node is registered to." msgstr "" #: doc/classes/Spatial.xml @@ -52990,13 +52990,13 @@ msgstr "" #: doc/classes/Spatial.xml msgid "" "Spatial nodes receives this notification when they are registered to new " -"[World] resource." +"[World3D] resource." msgstr "" #: doc/classes/Spatial.xml msgid "" "Spatial nodes receives this notification when they are unregistered from " -"current [World] resource." +"current [World3D] resource." msgstr "" #: doc/classes/Spatial.xml @@ -63146,7 +63146,7 @@ msgstr "" #: doc/classes/Viewport.xml msgid "" -"Returns the first valid [World] for this viewport, searching the [member " +"Returns the first valid [World3D] for this viewport, searching the [member " "world] property of itself and any Viewport ancestor." msgstr "" @@ -63367,7 +63367,7 @@ msgstr "" #: doc/classes/Viewport.xml msgid "" -"If [code]true[/code], the viewport will use [World] defined in [code]world[/" +"If [code]true[/code], the viewport will use [World3D] defined in [code]world[/" "code] property." msgstr "" @@ -63470,7 +63470,7 @@ msgid "" msgstr "" #: doc/classes/Viewport.xml -msgid "The custom [World] which can be used as 3D environment source." +msgid "The custom [World3D] which can be used as 3D environment source." msgstr "" #: doc/classes/Viewport.xml @@ -66690,7 +66690,7 @@ msgid "" "visual 3D nodes are considered, such as [MeshInstance] or " "[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the " "actual nodes. A scenario RID must be provided, which is available in the " -"[World] you want to query. This forces an update for all resources queued to " +"[World3D] you want to query. This forces an update for all resources queued to " "update.\n" "[b]Warning:[/b] This function is primarily intended for editor usage. For in-" "game use cases, prefer physics collision." @@ -66702,7 +66702,7 @@ msgid "" "Only visual 3D nodes are considered, such as [MeshInstance] or " "[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the " "actual nodes. A scenario RID must be provided, which is available in the " -"[World] you want to query. This forces an update for all resources queued to " +"[World3D] you want to query. This forces an update for all resources queued to " "update.\n" "[b]Warning:[/b] This function is primarily intended for editor usage. For in-" "game use cases, prefer physics collision." @@ -66714,7 +66714,7 @@ msgid "" "visual 3D nodes are considered, such as [MeshInstance] or " "[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the " "actual nodes. A scenario RID must be provided, which is available in the " -"[World] you want to query. This forces an update for all resources queued to " +"[World3D] you want to query. This forces an update for all resources queued to " "update.\n" "[b]Warning:[/b] This function is primarily intended for editor usage. For in-" "game use cases, prefer physics collision." diff --git a/editor/icons/icon_world.svg b/editor/icons/icon_world.svg index acb1083b8..c272b0dfb 100644 --- a/editor/icons/icon_world.svg +++ b/editor/icons/icon_world.svg @@ -1 +1,53 @@ - + + + + + + + + + diff --git a/editor/icons/icon_world_3d.svg b/editor/icons/icon_world_3d.svg new file mode 100644 index 000000000..acb1083b8 --- /dev/null +++ b/editor/icons/icon_world_3d.svg @@ -0,0 +1 @@ + diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 614f4966a..3ceb2c90f 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -141,7 +141,7 @@ MaterialEditor::MaterialEditor() { add_child(vc); vc->set_anchors_and_margins_preset(PRESET_WIDE); viewport = memnew(Viewport); - Ref world; + Ref world; world.instance(); viewport->set_world(world); //use own world vc->add_child(viewport); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 92684dc24..1cb8461e2 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -133,7 +133,7 @@ void MeshEditor::_bind_methods() { MeshEditor::MeshEditor() { viewport = memnew(Viewport); - Ref world; + Ref world; world.instance(); viewport->set_world(world); //use own world add_child(viewport); diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp index efbe903b6..baaab8bfc 100644 --- a/main/tests/test_oa_hash_map.cpp +++ b/main/tests/test_oa_hash_map.cpp @@ -118,7 +118,7 @@ MainLoop *test() { OAHashMap map; map.set("Hello", 1); - map.set("World", 2); + map.set("World3D", 2); map.set("Pandemonium rocks", 42); for (OAHashMap::Iterator it = map.iter(); it.valid; it = map.next_iter(it)) { diff --git a/modules/props/prop_instance_prop_job.cpp b/modules/props/prop_instance_prop_job.cpp index 4105557cb..491d4f18e 100644 --- a/modules/props/prop_instance_prop_job.cpp +++ b/modules/props/prop_instance_prop_job.cpp @@ -235,7 +235,7 @@ void PropInstancePropJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, _prop_instace->get_collision_mask()); if (_prop_instace->is_inside_tree() && _prop_instace->is_inside_world()) { - Ref world = _prop_instace->get_world(); + Ref world = _prop_instace->get_world(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/skeleton_3d/resources/skeleton_modification_3d_jiggle.cpp b/modules/skeleton_3d/resources/skeleton_modification_3d_jiggle.cpp index bacb7bf92..b01d8c780 100644 --- a/modules/skeleton_3d/resources/skeleton_modification_3d_jiggle.cpp +++ b/modules/skeleton_3d/resources/skeleton_modification_3d_jiggle.cpp @@ -199,7 +199,7 @@ void SkeletonModification3DJiggle::_execute_jiggle_joint(int p_joint_idx, Spatia // Collision detection/response if (use_colliders) { if (execution_mode == SkeletonModificationStack3D::EXECUTION_MODE::execution_mode_physics_process) { - Ref world_3d = stack->skeleton->get_world(); + Ref world_3d = stack->skeleton->get_world(); ERR_FAIL_COND(world_3d.is_null()); PhysicsDirectSpaceState *space_state = PhysicsServer::get_singleton()->space_get_direct_state(world_3d->get_space()); PhysicsDirectSpaceState::RayResult ray_result; diff --git a/modules/terraman/world/default/terrain_chunk_default.cpp b/modules/terraman/world/default/terrain_chunk_default.cpp index 02f2984e3..550102bd5 100644 --- a/modules/terraman/world/default/terrain_chunk_default.cpp +++ b/modules/terraman/world/default/terrain_chunk_default.cpp @@ -382,7 +382,7 @@ void TerrainChunkDefault::colliders_create(const int mesh_index, const int layer PhysicsServer::get_singleton()->body_set_state(body_rid, PhysicsServer::BODY_STATE_TRANSFORM, get_transform()); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->get_world(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->body_set_space(body_rid, world->get_space()); @@ -420,7 +420,7 @@ void TerrainChunkDefault::colliders_create_area(const int mesh_index, const int PhysicsServer::get_singleton()->area_set_collision_mask(area_rid, layer_mask); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->get_world(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space()); diff --git a/modules/terraman/world/jobs/terrain_prop_job.cpp b/modules/terraman/world/jobs/terrain_prop_job.cpp index 8d8543c8f..69bd81425 100644 --- a/modules/terraman/world/jobs/terrain_prop_job.cpp +++ b/modules/terraman/world/jobs/terrain_prop_job.cpp @@ -109,7 +109,7 @@ void TerrainPropJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, 1); if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) { - Ref world = chunk->get_voxel_world()->get_world(); + Ref world = chunk->get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp index 2f651fd77..1a2da5a62 100644 --- a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp +++ b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp @@ -348,7 +348,7 @@ void Terrain2DChunkDefault::colliders_create(const int mesh_index, const int lay Physics2DServer::get_singleton()->body_set_state(body_rid, Physics2DServer::BODY_STATE_TRANSFORM, get_transform()); if (get_voxel_world()->is_inside_tree()) { - Ref world = get_voxel_world()->get_world_2d(); + Ref world = get_voxel_world()->get_world_2d(); if (world.is_valid() && world->get_space() != RID()) Physics2DServer::get_singleton()->body_set_space(body_rid, world->get_space()); diff --git a/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp b/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp index 11c0ff61b..a8bbe953f 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp +++ b/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp @@ -88,7 +88,7 @@ void Terrain2DProp2DJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, 1); if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) { - Ref world = chunk->get_voxel_world()->get_world_2d(); + Ref world = chunk->get_voxel_world()->get_world_2d(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/voxelman/world/default/voxel_chunk_default.cpp b/modules/voxelman/world/default/voxel_chunk_default.cpp index 31c069077..374ed9b03 100644 --- a/modules/voxelman/world/default/voxel_chunk_default.cpp +++ b/modules/voxelman/world/default/voxel_chunk_default.cpp @@ -380,7 +380,7 @@ void VoxelChunkDefault::colliders_create(const int mesh_index, const int layer_m PhysicsServer::get_singleton()->body_set_state(body_rid, PhysicsServer::BODY_STATE_TRANSFORM, get_transform()); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->get_world(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->body_set_space(body_rid, world->get_space()); @@ -418,7 +418,7 @@ void VoxelChunkDefault::colliders_create_area(const int mesh_index, const int la PhysicsServer::get_singleton()->area_set_collision_mask(area_rid, layer_mask); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->get_world(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space()); diff --git a/modules/voxelman/world/jobs/voxel_prop_job.cpp b/modules/voxelman/world/jobs/voxel_prop_job.cpp index e3f1226a1..c9ad1cadd 100644 --- a/modules/voxelman/world/jobs/voxel_prop_job.cpp +++ b/modules/voxelman/world/jobs/voxel_prop_job.cpp @@ -110,7 +110,7 @@ void VoxelPropJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, 1); if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) { - Ref world = chunk->get_voxel_world()->get_world(); + Ref world = chunk->get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index d50f35047..92410b269 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -375,7 +375,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { linear_velocity = velocity_tracker->get_tracked_linear_velocity(); } - Ref world = get_world(); + Ref world = get_world(); ERR_FAIL_COND(world.is_null()); int new_output_count = 0; diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index a614055b8..c4d11272a 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -62,7 +62,7 @@ void CollisionObject::_notification(int p_what) { PhysicsServer::get_singleton()->body_set_state(rid, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); } - Ref world_ref = get_world(); + Ref world_ref = get_world(); ERR_FAIL_COND(!world_ref.is_valid()); RID space = world_ref->get_space(); if (area) { diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 4e5158d66..4f6e086fd 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -199,7 +199,7 @@ void RayCast::_notification(int p_what) { } void RayCast::_update_raycast_state() { - Ref w3d = get_world(); + Ref w3d = get_world(); ERR_FAIL_COND(w3d.is_null()); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); diff --git a/scene/3d/room_manager.cpp b/scene/3d/room_manager.cpp index 7f65e5b04..60702bbc6 100644 --- a/scene/3d/room_manager.cpp +++ b/scene/3d/room_manager.cpp @@ -86,7 +86,7 @@ bool RoomManager::static_rooms_get_active() { bool RoomManager::static_rooms_get_active_and_loaded() { if (active_room_manager) { if (active_room_manager->rooms_get_active()) { - Ref world = active_room_manager->get_world(); + Ref world = active_room_manager->get_world(); RID scenario = world->get_scenario(); return active_room_manager->rooms_get_active() && RenderingServer::get_singleton()->rooms_is_loaded(scenario); } @@ -148,7 +148,7 @@ String RoomManager::get_configuration_warning() const { } void RoomManager::_preview_camera_update() { - Ref world = get_world(); + Ref world = get_world(); RID scenario = world->get_scenario(); if (_pandemonium_preview_camera_ID != (ObjectID)-1) { @@ -237,7 +237,7 @@ void RoomManager::_notification(int p_what) { } if (_settings_gameplay_monitor_enabled) { - Ref world = get_world(); + Ref world = get_world(); RID scenario = world->get_scenario(); List cameras; diff --git a/scene/3d/shape_cast.cpp b/scene/3d/shape_cast.cpp index edf3187e0..8e181fc0d 100644 --- a/scene/3d/shape_cast.cpp +++ b/scene/3d/shape_cast.cpp @@ -378,7 +378,7 @@ void ShapeCast::_update_shapecast_state() { ERR_FAIL_COND_MSG(shape.is_null(), "Null reference to shape. ShapeCast requires a Shape3D to sweep for collisions."); - Ref w3d = get_world(); + Ref w3d = get_world(); ERR_FAIL_COND(w3d.is_null()); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 605ff9be5..d3a75a8d3 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -701,9 +701,9 @@ bool Spatial::is_set_as_toplevel() const { return data.toplevel; } -Ref Spatial::get_world() const { - ERR_FAIL_COND_V(!is_inside_world(), Ref()); - ERR_FAIL_COND_V(!data.viewport, Ref()); +Ref Spatial::get_world() const { + ERR_FAIL_COND_V(!is_inside_world(), Ref()); + ERR_FAIL_COND_V(!data.viewport, Ref()); return data.viewport->find_world(); } diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index ca20b8c9f..083776eca 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -33,7 +33,7 @@ #include "scene/main/node.h" #include "scene/main/scene_tree.h" -class World; +class World3D; class SpatialGizmo : public Reference { GDCLASS(SpatialGizmo, Reference); @@ -152,7 +152,7 @@ public: virtual void notification_callback(int p_message_type); Spatial *get_parent_spatial() const; - Ref get_world() const; + Ref get_world() const; void set_translation(const Vector3 &p_translation); void set_rotation(const Vector3 &p_euler_rad); diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h index 957f7b421..97657e79b 100644 --- a/scene/3d/visibility_notifier.h +++ b/scene/3d/visibility_notifier.h @@ -32,13 +32,13 @@ #include "scene/3d/cull_instance.h" -class World; +class World3D; class Camera; class VisibilityNotifier : public CullInstance { GDCLASS(VisibilityNotifier, CullInstance); - Ref world; + Ref world; Set cameras; AABB aabb; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 6073be1a6..99e7293f4 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -2208,7 +2208,7 @@ SceneTree::SceneTree() { root->set_name("root"); root->set_handle_input_locally(false); if (!root->get_world().is_valid()) { - root->set_world(Ref(memnew(World))); + root->set_world(Ref(memnew(World3D))); } set_physics_interpolation_enabled(GLOBAL_DEF("physics/common/physics_interpolation", false)); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index dceb7a4e2..87642e132 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1110,7 +1110,7 @@ void Viewport::_propagate_exit_world(Node *p_node) { } } -void Viewport::set_world(const Ref &p_world) { +void Viewport::set_world(const Ref &p_world) { if (world == p_world) { return; } @@ -1130,7 +1130,7 @@ void Viewport::set_world(const Ref &p_world) { own_world = world->duplicate(); world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } else { - own_world = Ref(memnew(World)); + own_world = Ref(memnew(World3D)); } } @@ -1145,7 +1145,7 @@ void Viewport::set_world(const Ref &p_world) { _update_listener(); } -Ref Viewport::get_world() const { +Ref Viewport::get_world() const { return world; } @@ -1153,7 +1153,7 @@ Ref Viewport::get_world_2d() const { return world_2d; } -Ref Viewport::find_world() const { +Ref Viewport::find_world() const { if (own_world.is_valid()) { return own_world; } else if (world.is_valid()) { @@ -1161,7 +1161,7 @@ Ref Viewport::find_world() const { } else if (parent) { return parent->find_world(); } else { - return Ref(); + return Ref(); } } @@ -2911,10 +2911,10 @@ void Viewport::set_use_own_world(bool p_use_own_world) { own_world = world->duplicate(); world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } else { - own_world = Ref(memnew(World)); + own_world = Ref(memnew(World3D)); } } else { - own_world = Ref(); + own_world = Ref(); if (world.is_valid()) { world->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } @@ -3333,7 +3333,7 @@ void Viewport::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "size_override_stretch"), "set_size_override_stretch", "is_size_override_stretch_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world"), "set_use_own_world", "is_using_own_world"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world", PROPERTY_HINT_RESOURCE_TYPE, "World"), "set_world", "get_world"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world", PROPERTY_HINT_RESOURCE_TYPE, "World3D"), "set_world", "get_world"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_2d", PROPERTY_HINT_RESOURCE_TYPE, "World2D", 0), "set_world_2d", "get_world_2d"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent_bg"), "set_transparent_background", "has_transparent_background"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "handle_input_locally"), "set_handle_input_locally", "is_handling_input_locally"); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 11d264271..8ce50a5e2 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -48,7 +48,7 @@ class Timer; class Viewport; class CollisionObject; class SceneTreeTimer; -class World; +class World3D; class World2D; class ViewportTexture : public Texture { @@ -251,8 +251,8 @@ private: Map physics_2d_mouseover; Ref world_2d; - Ref world; - Ref own_world; + Ref world; + Ref own_world; StringName input_group; StringName gui_input_group; @@ -459,10 +459,10 @@ public: Rect2 get_visible_rect() const; RID get_viewport_rid() const; - void set_world(const Ref &p_world); + void set_world(const Ref &p_world); void set_world_2d(const Ref &p_world_2d); - Ref get_world() const; - Ref find_world() const; + Ref get_world() const; + Ref find_world() const; Ref get_world_2d() const; Ref find_world_2d() const; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index ad76058be..fecbd97e5 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -601,7 +601,7 @@ void register_scene_types() { #endif ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_virtual_class(); diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index 5d5d0a0e9..bc1450a4f 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -214,59 +214,59 @@ struct SpatialIndexer { } }; -void World::_register_camera(Camera *p_camera) { +void World3D::_register_camera(Camera *p_camera) { #ifndef _3D_DISABLED indexer->_add_camera(p_camera); #endif } -void World::_update_camera(Camera *p_camera) { +void World3D::_update_camera(Camera *p_camera) { #ifndef _3D_DISABLED indexer->_update_camera(p_camera); #endif } -void World::_remove_camera(Camera *p_camera) { +void World3D::_remove_camera(Camera *p_camera) { #ifndef _3D_DISABLED indexer->_remove_camera(p_camera); #endif } -void World::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { +void World3D::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_add(p_notifier, p_rect); #endif } -void World::_update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { +void World3D::_update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_update(p_notifier, p_rect); #endif } -void World::_remove_notifier(VisibilityNotifier *p_notifier) { +void World3D::_remove_notifier(VisibilityNotifier *p_notifier) { #ifndef _3D_DISABLED indexer->_notifier_remove(p_notifier); #endif } -void World::_update(uint64_t p_frame) { +void World3D::_update(uint64_t p_frame) { #ifndef _3D_DISABLED indexer->_update(p_frame); #endif } -RID World::get_space() const { +RID World3D::get_space() const { return space; } -RID World::get_scenario() const { +RID World3D::get_scenario() const { return scenario; } -RID World::get_navigation_map() const { +RID World3D::get_navigation_map() const { return navigation_map; } -void World::set_environment(const Ref &p_environment) { +void World3D::set_environment(const Ref &p_environment) { if (environment == p_environment) { return; } @@ -281,11 +281,11 @@ void World::set_environment(const Ref &p_environment) { emit_changed(); } -Ref World::get_environment() const { +Ref World3D::get_environment() const { return environment; } -void World::set_fallback_environment(const Ref &p_environment) { +void World3D::set_fallback_environment(const Ref &p_environment) { if (fallback_environment == p_environment) { return; } @@ -300,29 +300,29 @@ void World::set_fallback_environment(const Ref &p_environment) { emit_changed(); } -Ref World::get_fallback_environment() const { +Ref World3D::get_fallback_environment() const { return fallback_environment; } -PhysicsDirectSpaceState *World::get_direct_space_state() { +PhysicsDirectSpaceState *World3D::get_direct_space_state() { return PhysicsServer::get_singleton()->space_get_direct_state(space); } -void World::get_camera_list(List *r_cameras) { +void World3D::get_camera_list(List *r_cameras) { for (Map::Element *E = indexer->cameras.front(); E; E = E->next()) { r_cameras->push_back(E->key()); } } -void World::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_space"), &World::get_space); - ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario); - ClassDB::bind_method(D_METHOD("get_navigation_map"), &World::get_navigation_map); - ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment); - ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment); - ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment); - ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment); - ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); +void World3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space); + ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario); + ClassDB::bind_method(D_METHOD("get_navigation_map"), &World3D::get_navigation_map); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment); + ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World3D::set_fallback_environment); + ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World3D::get_fallback_environment); + ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World3D::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); @@ -331,7 +331,7 @@ void World::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); } -World::World() { +World3D::World3D() { space = RID_PRIME(PhysicsServer::get_singleton()->space_create()); scenario = RID_PRIME(RenderingServer::get_singleton()->scenario_create()); @@ -358,7 +358,7 @@ World::World() { #endif } -World::~World() { +World3D::~World3D() { PhysicsServer::get_singleton()->free(space); RenderingServer::get_singleton()->free(scenario); NavigationServer::get_singleton()->free(navigation_map); diff --git a/scene/resources/world.h b/scene/resources/world.h index 1276ebc81..c9de8f5c4 100644 --- a/scene/resources/world.h +++ b/scene/resources/world.h @@ -1,5 +1,6 @@ -#ifndef WORLD_H -#define WORLD_H +#ifndef WORLD_3D_H +#define WORLD_3D_H + /*************************************************************************/ /* world.h */ /*************************************************************************/ @@ -39,9 +40,9 @@ class Camera; class VisibilityNotifier; struct SpatialIndexer; -class World : public Resource { - GDCLASS(World, Resource); - RES_BASE_EXTENSION("world"); +class World3D : public Resource { + GDCLASS(World3D, Resource); + RES_BASE_EXTENSION("world3d"); private: RID space; @@ -82,8 +83,8 @@ public: PhysicsDirectSpaceState *get_direct_space_state(); - World(); - ~World(); + World3D(); + ~World3D(); }; #endif // WORLD_H