diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index e31d6e7ee..cd43f056c 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1442,7 +1442,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the default gravity at runtime, use the following code sample: [codeblock] # Set the default gravity strength to 9.8. - PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 9.8) + PhysicsServer.area_set_param(get_viewport().find_world_3d().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 9.8) [/codeblock] @@ -1450,7 +1450,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the default gravity vector at runtime, use the following code sample: [codeblock] # Set the default gravity direction to `Vector3(0, -1, 0)`. - PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0)) + PhysicsServer.area_set_param(get_viewport().find_world_3d().get_space(), PhysicsServer.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0)) [/codeblock] diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index bd737737c..0909797ff 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -57,7 +57,7 @@ Returns the parent [Spatial], or an empty [Object] if no parent exists or parent is not of type [Spatial]. - + Returns the current [World3D] resource this [Spatial] node is registered to. diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index c7b18dc2c..b85ce3c37 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -23,7 +23,7 @@ https://godotengine.org/asset-library/asset/586 - + Returns the first valid [World3D] for this viewport, searching the [member world] property of itself and any Viewport ancestor. @@ -245,7 +245,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 [World3D] defined in [member world]. @@ -301,7 +301,7 @@ [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 [World3D] which can be used as 3D environment source. diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot index 5afd3068d..a0440048c 100644 --- a/doc/translations/classes.pot +++ b/doc/translations/classes.pot @@ -46657,7 +46657,7 @@ msgid "" "the default gravity at runtime, use the following code sample:\n" "[codeblock]\n" "# Set the default gravity strength to 9.8.\n" -"PhysicsServer.area_set_param(get_viewport().find_world().get_space(), " +"PhysicsServer.area_set_param(get_viewport().find_world_3d().get_space(), " "PhysicsServer.AREA_PARAM_GRAVITY, 9.8)\n" "[/codeblock]" msgstr "" @@ -46669,7 +46669,7 @@ msgid "" "the default gravity vector at runtime, use the following code sample:\n" "[codeblock]\n" "# Set the default gravity direction to `Vector3(0, -1, 0)`.\n" -"PhysicsServer.area_set_param(get_viewport().find_world().get_space(), " +"PhysicsServer.area_set_param(get_viewport().find_world_3d().get_space(), " "PhysicsServer.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0))\n" "[/codeblock]" msgstr "" diff --git a/doc/translations/hu.po b/doc/translations/hu.po index ba65f0e2d..3c145596a 100644 --- a/doc/translations/hu.po +++ b/doc/translations/hu.po @@ -46742,7 +46742,7 @@ msgid "" "the default gravity at runtime, use the following code sample:\n" "[codeblock]\n" "# Set the default gravity strength to 9.8.\n" -"PhysicsServer.area_set_param(get_viewport().find_world().get_space(), " +"PhysicsServer.area_set_param(get_viewport().find_world_3d().get_space(), " "PhysicsServer.AREA_PARAM_GRAVITY, 9.8)\n" "[/codeblock]" msgstr "" @@ -46754,7 +46754,7 @@ msgid "" "the default gravity vector at runtime, use the following code sample:\n" "[codeblock]\n" "# Set the default gravity direction to `Vector3(0, -1, 0)`.\n" -"PhysicsServer.area_set_param(get_viewport().find_world().get_space(), " +"PhysicsServer.area_set_param(get_viewport().find_world_3d().get_space(), " "PhysicsServer.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0))\n" "[/codeblock]" msgstr "" diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0b654d2df..40b45e8f9 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1894,7 +1894,7 @@ void EditorNode::push_item(Object *p_object, const String &p_property, bool p_in } void EditorNode::_save_default_environment() { - Ref fallback = get_tree()->get_root()->get_world()->get_fallback_environment(); + Ref fallback = get_tree()->get_root()->get_world_3d()->get_fallback_environment(); if (fallback.is_valid() && fallback->get_path().is_resource_file()) { Map processed; diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 4f32c774a..a299506e5 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -143,7 +143,7 @@ MaterialEditor::MaterialEditor() { viewport = memnew(Viewport); Ref world; world.instance(); - viewport->set_world(world); //use own world + viewport->set_world_3d(world); //use own world vc->add_child(viewport); viewport->set_disable_input(true); viewport->set_transparent_background(true); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index f0a186b74..c15b5b8ea 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -135,7 +135,7 @@ MeshEditor::MeshEditor() { viewport = memnew(Viewport); Ref world; world.instance(); - viewport->set_world(world); //use own world + viewport->set_world_3d(world); //use own world add_child(viewport); viewport->set_disable_input(true); viewport->set_msaa(Viewport::MSAA_2X); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 1be7fb8bc..62274e5fd 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -539,7 +539,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos) { Vector3 pos = _get_ray_pos(p_pos); Vector2 shrinked_pos = p_pos / viewport_container->get_stretch_shrink(); - Vector instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario()); + Vector instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world_3d()->get_scenario()); Set> found_gizmos; Node *edited_scene = get_tree()->get_edited_scene_root(); @@ -602,7 +602,7 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayR Vector3 ray = _get_ray(p_pos); Vector3 pos = _get_ray_pos(p_pos); - Vector instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario()); + Vector instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world_3d()->get_scenario()); Set found_nodes; for (int i = 0; i < instances.size(); i++) { @@ -783,7 +783,7 @@ void SpatialEditorViewport::_select_region() { _clear_selected(); } - Vector instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario()); + Vector instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world_3d()->get_scenario()); Set found_nodes; Vector selected; @@ -3454,7 +3454,7 @@ void SpatialEditorViewport::_menu_option(int p_option) { } break; case VIEW_DISPLAY_OVERDRAW: { viewport->set_debug_draw(Viewport::DEBUG_DRAW_OVERDRAW); - RenderingServer::get_singleton()->scenario_set_debug(get_tree()->get_root()->get_world()->get_scenario(), RenderingServer::SCENARIO_DEBUG_OVERDRAW); + RenderingServer::get_singleton()->scenario_set_debug(get_tree()->get_root()->get_world_3d()->get_scenario(), RenderingServer::SCENARIO_DEBUG_OVERDRAW); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_NORMAL), false); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_WIREFRAME), false); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_OVERDRAW), true); @@ -3463,7 +3463,7 @@ void SpatialEditorViewport::_menu_option(int p_option) { } break; case VIEW_DISPLAY_SHADELESS: { viewport->set_debug_draw(Viewport::DEBUG_DRAW_UNSHADED); - RenderingServer::get_singleton()->scenario_set_debug(get_tree()->get_root()->get_world()->get_scenario(), RenderingServer::SCENARIO_DEBUG_SHADELESS); + RenderingServer::get_singleton()->scenario_set_debug(get_tree()->get_root()->get_world_3d()->get_scenario(), RenderingServer::SCENARIO_DEBUG_SHADELESS); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_NORMAL), false); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_WIREFRAME), false); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_OVERDRAW), false); @@ -3494,7 +3494,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { for (int i = 0; i < 3; i++) { move_gizmo_instance[i] = RID_PRIME(RS::get_singleton()->instance_create()); RS::get_singleton()->instance_set_base(move_gizmo_instance[i], spatial_editor->get_move_gizmo(i)->get_rid()); - RS::get_singleton()->instance_set_scenario(move_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(move_gizmo_instance[i], get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(move_gizmo_instance[i], false); RS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF); RS::get_singleton()->instance_set_layer_mask(move_gizmo_instance[i], layer); @@ -3502,7 +3502,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { move_plane_gizmo_instance[i] = RID_PRIME(RS::get_singleton()->instance_create()); RS::get_singleton()->instance_set_base(move_plane_gizmo_instance[i], spatial_editor->get_move_plane_gizmo(i)->get_rid()); - RS::get_singleton()->instance_set_scenario(move_plane_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(move_plane_gizmo_instance[i], get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false); RS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_plane_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF); RS::get_singleton()->instance_set_layer_mask(move_plane_gizmo_instance[i], layer); @@ -3510,7 +3510,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { rotate_gizmo_instance[i] = RID_PRIME(RS::get_singleton()->instance_create()); RS::get_singleton()->instance_set_base(rotate_gizmo_instance[i], spatial_editor->get_rotate_gizmo(i)->get_rid()); - RS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i], get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], false); RS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF); RS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[i], layer); @@ -3518,7 +3518,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { scale_gizmo_instance[i] = RID_PRIME(RS::get_singleton()->instance_create()); RS::get_singleton()->instance_set_base(scale_gizmo_instance[i], spatial_editor->get_scale_gizmo(i)->get_rid()); - RS::get_singleton()->instance_set_scenario(scale_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(scale_gizmo_instance[i], get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false); RS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF); RS::get_singleton()->instance_set_layer_mask(scale_gizmo_instance[i], layer); @@ -3526,7 +3526,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { scale_plane_gizmo_instance[i] = RID_PRIME(RS::get_singleton()->instance_create()); RS::get_singleton()->instance_set_base(scale_plane_gizmo_instance[i], spatial_editor->get_scale_plane_gizmo(i)->get_rid()); - RS::get_singleton()->instance_set_scenario(scale_plane_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(scale_plane_gizmo_instance[i], get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], false); RS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_plane_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF); RS::get_singleton()->instance_set_layer_mask(scale_plane_gizmo_instance[i], layer); @@ -3536,7 +3536,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { // Rotation white outline rotate_gizmo_instance[3] = RID_PRIME(RS::get_singleton()->instance_create()); RS::get_singleton()->instance_set_base(rotate_gizmo_instance[3], spatial_editor->get_rotate_gizmo(3)->get_rid()); - RS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[3], get_tree()->get_root()->get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[3], get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(rotate_gizmo_instance[3], false); RS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[3], RS::SHADOW_CASTING_SETTING_OFF); RS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[3], layer); @@ -3962,7 +3962,7 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const Vector3 point = world_pos + world_ray * MAX_DISTANCE; - PhysicsDirectSpaceState *ss = get_tree()->get_root()->get_world()->get_direct_space_state(); + PhysicsDirectSpaceState *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state(); PhysicsDirectSpaceState::RayResult result; if (ss->intersect_ray(world_pos, world_pos + world_ray * MAX_DISTANCE, result)) { @@ -3979,7 +3979,7 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const Vector3 world_ray = _get_ray(p_pos); Vector3 world_pos = _get_ray_pos(p_pos); - Vector instances = RenderingServer::get_singleton()->instances_cull_ray(world_pos, world_ray, get_tree()->get_root()->get_world()->get_scenario()); + Vector instances = RenderingServer::get_singleton()->instances_cull_ray(world_pos, world_ray, get_tree()->get_root()->get_world_3d()->get_scenario()); Set> found_gizmos; float closest_dist = MAX_DISTANCE; @@ -5062,10 +5062,10 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { si->sp = sp; si->sbox_instance = RenderingServer::get_singleton()->instance_create2( selection_box->get_rid(), - sp->get_world()->get_scenario()); + sp->get_world_3d()->get_scenario()); si->sbox_instance_offset = RenderingServer::get_singleton()->instance_create2( selection_box->get_rid(), - sp->get_world()->get_scenario()); + sp->get_world_3d()->get_scenario()); RS::get_singleton()->instance_geometry_set_cast_shadows_setting( si->sbox_instance, RS::SHADOW_CASTING_SETTING_OFF); @@ -5075,10 +5075,10 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { RS::get_singleton()->instance_set_layer_mask(si->sbox_instance_offset, 1 << SpatialEditorViewport::GIZMO_EDIT_LAYER); si->sbox_instance_xray = RenderingServer::get_singleton()->instance_create2( selection_box_xray->get_rid(), - sp->get_world()->get_scenario()); + sp->get_world_3d()->get_scenario()); si->sbox_instance_xray_offset = RenderingServer::get_singleton()->instance_create2( selection_box_xray->get_rid(), - sp->get_world()->get_scenario()); + sp->get_world_3d()->get_scenario()); RS::get_singleton()->instance_geometry_set_cast_shadows_setting( si->sbox_instance_xray, RS::SHADOW_CASTING_SETTING_OFF); @@ -5828,7 +5828,7 @@ void SpatialEditor::_init_indicators() { RenderingServer::get_singleton()->mesh_add_surface_from_arrays(origin, RenderingServer::PRIMITIVE_LINES, d); RenderingServer::get_singleton()->mesh_surface_set_material(origin, 0, indicator_mat->get_rid()); - origin_instance = RenderingServer::get_singleton()->instance_create2(origin, get_tree()->get_root()->get_world()->get_scenario()); + origin_instance = RenderingServer::get_singleton()->instance_create2(origin, get_tree()->get_root()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_layer_mask(origin_instance, 1 << SpatialEditorViewport::GIZMO_GRID_LAYER); RenderingServer::get_singleton()->instance_geometry_set_cast_shadows_setting(origin_instance, RS::SHADOW_CASTING_SETTING_OFF); @@ -6390,7 +6390,7 @@ void SpatialEditor::_init_grid() { d[RenderingServer::ARRAY_NORMAL] = grid_normals[c]; RenderingServer::get_singleton()->mesh_add_surface_from_arrays(grid[c], RenderingServer::PRIMITIVE_LINES, d); RenderingServer::get_singleton()->mesh_surface_set_material(grid[c], 0, grid_mat[c]->get_rid()); - grid_instance[c] = RenderingServer::get_singleton()->instance_create2(grid[c], get_tree()->get_root()->get_world()->get_scenario()); + grid_instance[c] = RenderingServer::get_singleton()->instance_create2(grid[c], get_tree()->get_root()->get_world_3d()->get_scenario()); // Yes, the end of this line is supposed to be a. RenderingServer::get_singleton()->instance_set_visible(grid_instance[c], grid_visible[a]); @@ -6583,7 +6583,7 @@ void SpatialEditor::snap_selected_nodes_to_floor() { } } - PhysicsDirectSpaceState *ss = get_tree()->get_root()->get_world()->get_direct_space_state(); + PhysicsDirectSpaceState *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state(); PhysicsDirectSpaceState::RayResult result; Array keys = snap_data.keys(); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 3b74c281d..860647e67 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -277,7 +277,7 @@ EditorSpatialGizmo::Instance::~Instance() { } void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base, bool p_hidden) { - instance = RS::get_singleton()->instance_create2(mesh->get_rid(), p_base->get_world()->get_scenario()); + instance = RS::get_singleton()->instance_create2(mesh->get_rid(), p_base->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_portal_mode(instance, RenderingServer::INSTANCE_PORTAL_MODE_GLOBAL); RS::get_singleton()->instance_attach_object_instance_id(instance, p_base->get_instance_id()); diff --git a/modules/props/prop_instance_merger.cpp b/modules/props/prop_instance_merger.cpp index ca1d8342c..bb11b02f1 100644 --- a/modules/props/prop_instance_merger.cpp +++ b/modules/props/prop_instance_merger.cpp @@ -181,8 +181,8 @@ void PropInstanceMerger::meshes_create(const int num) { for (int i = 0; i < num; ++i) { RID mesh_instance_rid = RS::get_singleton()->instance_create(); - if (get_world().is_valid()) { - RS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_world()->get_scenario()); + if (get_world_3d().is_valid()) { + RS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_world_3d()->get_scenario()); } RID mesh_rid = RS::get_singleton()->mesh_create(); @@ -372,8 +372,8 @@ void PropInstanceMerger::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = RenderingServer::get_singleton()->instance_create(); - if (get_world().is_valid()) { - RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_world()->get_scenario()); + if (get_world_3d().is_valid()) { + RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_world_3d()->get_scenario()); } RS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); @@ -493,7 +493,7 @@ void PropInstanceMerger::_build() { return; } - if (!is_inside_tree() || !get_world().is_valid()) { + if (!is_inside_tree() || !get_world_3d().is_valid()) { queue_build(); return; } diff --git a/modules/props/prop_instance_prop_job.cpp b/modules/props/prop_instance_prop_job.cpp index c27145031..f5f842fc8 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_3d(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/props/tiled_wall/tiled_wall.cpp b/modules/props/tiled_wall/tiled_wall.cpp index 22cefb44c..e04505c93 100644 --- a/modules/props/tiled_wall/tiled_wall.cpp +++ b/modules/props/tiled_wall/tiled_wall.cpp @@ -253,7 +253,7 @@ void TiledWall::create_colliders() { free_colliders(); - ERR_FAIL_COND(!get_world().is_valid() && get_world()->get_space() == RID()); + ERR_FAIL_COND(!get_world_3d().is_valid() && get_world_3d()->get_space() == RID()); _physics_shape_rid = PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_BOX); @@ -304,7 +304,7 @@ void TiledWall::_notification(int p_what) { PhysicsServer::get_singleton()->body_set_state(_physics_body_rid, PhysicsServer::BODY_STATE_TRANSFORM, t); - RID space = get_world()->get_space(); + RID space = get_world_3d()->get_space(); PhysicsServer::get_singleton()->body_set_space(_physics_body_rid, space); refresh(); diff --git a/modules/skeleton_3d/resources/skeleton_modification_3d_jiggle.cpp b/modules/skeleton_3d/resources/skeleton_modification_3d_jiggle.cpp index 04b05bbb4..ff8536e2d 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_3d(); 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 85c141081..17418caa3 100644 --- a/modules/terraman/world/default/terrain_chunk_default.cpp +++ b/modules/terraman/world/default/terrain_chunk_default.cpp @@ -302,8 +302,8 @@ void TerrainChunkDefault::meshes_create(const int mesh_index, const int mesh_cou for (int i = 0; i < mesh_count; ++i) { RID mesh_instance_rid = RS::get_singleton()->instance_create(); - if (get_voxel_world()->get_world().is_valid()) - RS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->get_world()->get_scenario()); + if (get_voxel_world()->get_world_3d().is_valid()) + RS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->get_world_3d()->get_scenario()); RID mesh_rid = RS::get_singleton()->mesh_create(); @@ -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_3d(); 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_3d(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space()); @@ -533,8 +533,8 @@ void TerrainChunkDefault::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = RenderingServer::get_singleton()->instance_create(); - if (get_voxel_world() && get_voxel_world()->get_world().is_valid()) { - RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world()->get_scenario()); + if (get_voxel_world() && get_voxel_world()->get_world_3d().is_valid()) { + RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world_3d()->get_scenario()); } RS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); diff --git a/modules/terraman/world/jobs/terrain_prop_job.cpp b/modules/terraman/world/jobs/terrain_prop_job.cpp index a915d722d..a34d50e77 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_3d(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/terraman/world/terrain_world_editor.cpp b/modules/terraman/world/terrain_world_editor.cpp index 056f688bf..48c1939b9 100644 --- a/modules/terraman/world/terrain_world_editor.cpp +++ b/modules/terraman/world/terrain_world_editor.cpp @@ -83,7 +83,7 @@ EditorPlugin::AfterGUIInput TerrainWorldEditor::do_input_action(Camera *p_camera from = local_xform.xform(from); to = local_xform.xform(to); - PhysicsDirectSpaceState *ss = _world->get_world()->get_direct_space_state(); + PhysicsDirectSpaceState *ss = _world->get_world_3d()->get_direct_space_state(); PhysicsDirectSpaceState::RayResult res; 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 e7f6780b6..7ed3c77cb 100644 --- a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp +++ b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp @@ -493,8 +493,8 @@ void Terrain2DChunkDefault::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = RenderingServer::get_singleton()->instance_create(); - //if (get_voxel_world()->get_world().is_valid()) - // RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world()->get_scenario()); + //if (get_voxel_world()->get_world_3d().is_valid()) + // RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); //RS::get_singleton()->instance_set_transform(_debug_mesh_instance, get_transform()); diff --git a/modules/voxelman/world/default/voxel_chunk_default.cpp b/modules/voxelman/world/default/voxel_chunk_default.cpp index d47ec5d65..5aea61538 100644 --- a/modules/voxelman/world/default/voxel_chunk_default.cpp +++ b/modules/voxelman/world/default/voxel_chunk_default.cpp @@ -300,8 +300,8 @@ void VoxelChunkDefault::meshes_create(const int mesh_index, const int mesh_count for (int i = 0; i < mesh_count; ++i) { RID mesh_instance_rid = RS::get_singleton()->instance_create(); - if (get_voxel_world()->get_world().is_valid()) - RS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->get_world()->get_scenario()); + if (get_voxel_world()->get_world_3d().is_valid()) + RS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->get_world_3d()->get_scenario()); RID mesh_rid = RS::get_singleton()->mesh_create(); @@ -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_3d(); 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_3d(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space()); @@ -531,8 +531,8 @@ void VoxelChunkDefault::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = RenderingServer::get_singleton()->instance_create(); - if (get_voxel_world() && get_voxel_world()->get_world().is_valid()) { - RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world()->get_scenario()); + if (get_voxel_world() && get_voxel_world()->get_world_3d().is_valid()) { + RS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world_3d()->get_scenario()); } RS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); diff --git a/modules/voxelman/world/jobs/voxel_prop_job.cpp b/modules/voxelman/world/jobs/voxel_prop_job.cpp index cac44a5a7..f6b4a7051 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_3d(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/voxelman/world/voxel_world_editor.cpp b/modules/voxelman/world/voxel_world_editor.cpp index 5c88c5317..8aab13ff0 100644 --- a/modules/voxelman/world/voxel_world_editor.cpp +++ b/modules/voxelman/world/voxel_world_editor.cpp @@ -83,7 +83,7 @@ EditorPlugin::AfterGUIInput VoxelWorldEditor::do_input_action(Camera *p_camera, from = local_xform.xform(from); to = local_xform.xform(to); - PhysicsDirectSpaceState *ss = _world->get_world()->get_direct_space_state(); + PhysicsDirectSpaceState *ss = _world->get_world_3d()->get_direct_space_state(); PhysicsDirectSpaceState::RayResult res; diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 747ef6af2..8e3e2400c 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_3d(); ERR_FAIL_COND(world.is_null()); int new_output_count = 0; diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index f3bf18d8f..bd03681b4 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -98,8 +98,8 @@ void Camera::_update_camera() { get_viewport()->_camera_transform_changed_notify(); - if (get_world().is_valid()) { - get_world()->_update_camera(this); + if (get_world_3d().is_valid()) { + get_world_3d()->_update_camera(this); } } @@ -121,8 +121,8 @@ void Camera::_notification(int p_what) { viewport->_camera_set(this); } - ERR_FAIL_COND(get_world().is_null()); - RenderingServer::get_singleton()->camera_set_scenario(camera, get_world()->get_scenario()); + ERR_FAIL_COND(get_world_3d().is_null()); + RenderingServer::get_singleton()->camera_set_scenario(camera, get_world_3d()->get_scenario()); } break; case NOTIFICATION_TRANSFORM_CHANGED: { @@ -157,12 +157,12 @@ void Camera::_notification(int p_what) { } break; case NOTIFICATION_BECAME_CURRENT: { if (viewport) { - viewport->find_world()->_register_camera(this); + viewport->find_world_3d()->_register_camera(this); } } break; case NOTIFICATION_LOST_CURRENT: { if (viewport) { - viewport->find_world()->_remove_camera(this); + viewport->find_world_3d()->_remove_camera(this); } } break; } @@ -724,7 +724,7 @@ void ClippedCamera::_notification(int p_what) { return; } - PhysicsDirectSpaceState *dspace = get_world()->get_direct_space_state(); + PhysicsDirectSpaceState *dspace = get_world_3d()->get_direct_space_state(); ERR_FAIL_COND(!dspace); // most likely physics set to threads Vector3 cam_fw = -get_global_transform().basis.get_axis(Vector3::AXIS_Z).normalized(); diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 58d73409c..4da2056a2 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_3d(); ERR_FAIL_COND(!world_ref.is_valid()); RID space = world_ref->get_space(); if (area) { @@ -247,7 +247,7 @@ void CollisionObject::_update_debug_shapes() { } if (!s.debug_shape.is_valid()) { s.debug_shape = RID_PRIME(RS::get_singleton()->instance_create()); - RS::get_singleton()->instance_set_scenario(s.debug_shape, get_world()->get_scenario()); + RS::get_singleton()->instance_set_scenario(s.debug_shape, get_world_3d()->get_scenario()); if (!s.shape->is_connected("changed", this, "_shape_changed")) { s.shape->connect("changed", this, "_shape_changed", varray(s.shape), CONNECT_DEFERRED); diff --git a/scene/3d/navigation_agent.cpp b/scene/3d/navigation_agent.cpp index 5146822db..029345c6b 100644 --- a/scene/3d/navigation_agent.cpp +++ b/scene/3d/navigation_agent.cpp @@ -268,7 +268,7 @@ void NavigationAgent::set_agent_parent(Node *p_agent_parent) { NavigationServer::get_singleton()->agent_set_map(get_rid(), navigation->get_rid()); } else { // no navigation node found in parent nodes, use default navigation map from world resource - NavigationServer::get_singleton()->agent_set_map(get_rid(), agent_parent->get_world()->get_navigation_map()); + NavigationServer::get_singleton()->agent_set_map(get_rid(), agent_parent->get_world_3d()->get_navigation_map()); } // create new avoidance callback if enabled @@ -301,7 +301,7 @@ RID NavigationAgent::get_navigation_map() const { if (map_override.is_valid()) { return map_override; } else if (agent_parent != nullptr) { - return agent_parent->get_world()->get_navigation_map(); + return agent_parent->get_world_3d()->get_navigation_map(); } return RID(); } @@ -475,7 +475,7 @@ void NavigationAgent::update_navigation() { } else if (navigation != nullptr) { navigation_path = NavigationServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_location, true, navigation_layers); } else { - navigation_path = NavigationServer::get_singleton()->map_get_path(agent_parent->get_world()->get_navigation_map(), o, target_location, true, navigation_layers); + navigation_path = NavigationServer::get_singleton()->map_get_path(agent_parent->get_world_3d()->get_navigation_map(), o, target_location, true, navigation_layers); } navigation_finished = false; diff --git a/scene/3d/navigation_mesh_instance.cpp b/scene/3d/navigation_mesh_instance.cpp index 8ab2e654b..fc39c5188 100644 --- a/scene/3d/navigation_mesh_instance.cpp +++ b/scene/3d/navigation_mesh_instance.cpp @@ -54,7 +54,7 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) { if (navigation) { NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid()); } else { - NavigationServer::get_singleton()->region_set_map(region, get_world()->get_navigation_map()); + NavigationServer::get_singleton()->region_set_map(region, get_world_3d()->get_navigation_map()); } } @@ -127,7 +127,7 @@ void NavigationMeshInstance::_notification(int p_what) { if (enabled && navigation == nullptr) { // did not find a valid navigation node parent, fallback to default navigation map on world resource - NavigationServer::get_singleton()->region_set_map(region, get_world()->get_navigation_map()); + NavigationServer::get_singleton()->region_set_map(region, get_world_3d()->get_navigation_map()); } if (navmesh.is_valid() && get_tree()->is_debugging_navigation_hint()) { diff --git a/scene/3d/occluder.cpp b/scene/3d/occluder.cpp index 273f14040..4f129cfb7 100644 --- a/scene/3d/occluder.cpp +++ b/scene/3d/occluder.cpp @@ -51,7 +51,7 @@ void Occluder::set_shape(const Ref &p_shape) { if (_shape.is_valid()) { _shape->register_owner(this); - if (is_inside_world() && get_world().is_valid()) { + if (is_inside_world() && get_world_3d().is_valid()) { if (_occluder_instance.is_valid()) { RenderingServer::get_singleton()->occluder_instance_link_resource(_occluder_instance, p_shape->get_rid()); } @@ -106,10 +106,10 @@ String Occluder::get_configuration_warning() const { void Occluder::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - ERR_FAIL_COND(get_world().is_null()); + ERR_FAIL_COND(get_world_3d().is_null()); if (_occluder_instance.is_valid()) { - RenderingServer::get_singleton()->occluder_instance_set_scenario(_occluder_instance, get_world()->get_scenario()); + RenderingServer::get_singleton()->occluder_instance_set_scenario(_occluder_instance, get_world_3d()->get_scenario()); if (get_shape().is_valid()) { RenderingServer::get_singleton()->occluder_instance_link_resource(_occluder_instance, get_shape()->get_rid()); } diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index f447c894c..b0ee2d2e8 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -163,10 +163,10 @@ void Portal::clear() { void Portal::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - ERR_FAIL_COND(get_world().is_null()); + ERR_FAIL_COND(get_world_3d().is_null()); // defer full creation of the visual server portal to when the editor portal is in the scene tree - RenderingServer::get_singleton()->portal_set_scenario(_portal_rid, get_world()->get_scenario()); + RenderingServer::get_singleton()->portal_set_scenario(_portal_rid, get_world_3d()->get_scenario()); // we can't calculate world points until we have entered the tree portal_update(); diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 0f5f6b920..9bfa43d6e 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_3d(); ERR_FAIL_COND(w3d.is_null()); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); diff --git a/scene/3d/room.cpp b/scene/3d/room.cpp index 934769d98..134592239 100644 --- a/scene/3d/room.cpp +++ b/scene/3d/room.cpp @@ -267,8 +267,8 @@ void Room::_changed(bool p_regenerate_bounds) { void Room::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - ERR_FAIL_COND(get_world().is_null()); - RenderingServer::get_singleton()->room_set_scenario(_room_rid, get_world()->get_scenario()); + ERR_FAIL_COND(get_world_3d().is_null()); + RenderingServer::get_singleton()->room_set_scenario(_room_rid, get_world_3d()->get_scenario()); } break; case NOTIFICATION_EXIT_WORLD: { RenderingServer::get_singleton()->room_set_scenario(_room_rid, RID()); diff --git a/scene/3d/room_group.cpp b/scene/3d/room_group.cpp index e5f7c5373..9afe31b00 100644 --- a/scene/3d/room_group.cpp +++ b/scene/3d/room_group.cpp @@ -91,8 +91,8 @@ void RoomGroup::_changed() { void RoomGroup::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - ERR_FAIL_COND(get_world().is_null()); - RenderingServer::get_singleton()->roomgroup_set_scenario(_room_group_rid, get_world()->get_scenario()); + ERR_FAIL_COND(get_world_3d().is_null()); + RenderingServer::get_singleton()->roomgroup_set_scenario(_room_group_rid, get_world_3d()->get_scenario()); } break; case NOTIFICATION_EXIT_WORLD: { RenderingServer::get_singleton()->roomgroup_set_scenario(_room_group_rid, RID()); diff --git a/scene/3d/room_manager.cpp b/scene/3d/room_manager.cpp index 9bc0ad077..c4beb1e2d 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_3d(); 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_3d(); 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_3d(); RID scenario = world->get_scenario(); List cameras; @@ -362,8 +362,8 @@ void RoomManager::set_preview_camera_path(const NodePath &p_path) { } // if we are turning camera override off, must inform visual server - if (!camera_on && is_inside_world() && get_world().is_valid() && get_world()->get_scenario().is_valid()) { - RenderingServer::get_singleton()->rooms_override_camera(get_world()->get_scenario(), false, Vector3(), nullptr); + if (!camera_on && is_inside_world() && get_world_3d().is_valid() && get_world_3d()->get_scenario().is_valid()) { + RenderingServer::get_singleton()->rooms_override_camera(get_world_3d()->get_scenario(), false, Vector3(), nullptr); } // we couldn't resolve the path, let's set it to null @@ -383,16 +383,16 @@ real_t RoomManager::get_room_simplify() const { void RoomManager::set_portal_depth_limit(int p_limit) { _settings_portal_depth_limit = p_limit; - if (is_inside_world() && get_world().is_valid()) { - RenderingServer::get_singleton()->rooms_set_params(get_world()->get_scenario(), p_limit, _settings_roaming_expansion_margin); + if (is_inside_world() && get_world_3d().is_valid()) { + RenderingServer::get_singleton()->rooms_set_params(get_world_3d()->get_scenario(), p_limit, _settings_roaming_expansion_margin); } } void RoomManager::set_roaming_expansion_margin(real_t p_dist) { _settings_roaming_expansion_margin = p_dist; - if (is_inside_world() && get_world().is_valid()) { - RenderingServer::get_singleton()->rooms_set_params(get_world()->get_scenario(), _settings_portal_depth_limit, _settings_roaming_expansion_margin); + if (is_inside_world() && get_world_3d().is_valid()) { + RenderingServer::get_singleton()->rooms_set_params(get_world_3d()->get_scenario(), _settings_portal_depth_limit, _settings_roaming_expansion_margin); } } @@ -445,8 +445,8 @@ bool RoomManager::get_show_margins() const { } void RoomManager::set_debug_sprawl(bool p_enable) { - if (is_inside_world() && get_world().is_valid()) { - RenderingServer::get_singleton()->rooms_set_debug_feature(get_world()->get_scenario(), RenderingServer::ROOMS_DEBUG_SPRAWL, p_enable); + if (is_inside_world() && get_world_3d().is_valid()) { + RenderingServer::get_singleton()->rooms_set_debug_feature(get_world_3d()->get_scenario(), RenderingServer::ROOMS_DEBUG_SPRAWL, p_enable); _debug_sprawl = p_enable; } } @@ -488,8 +488,8 @@ void RoomManager::debug_print_line(String p_string, int p_priority) { } void RoomManager::rooms_set_active(bool p_active) { - if (is_inside_world() && get_world().is_valid()) { - RenderingServer::get_singleton()->rooms_set_active(get_world()->get_scenario(), p_active); + if (is_inside_world() && get_world_3d().is_valid()) { + RenderingServer::get_singleton()->rooms_set_active(get_world_3d()->get_scenario(), p_active); _active = p_active; #ifdef TOOLS_ENABLED @@ -525,15 +525,15 @@ String RoomManager::get_pvs_filename() const { void RoomManager::_rooms_changed(String p_reason) { _rooms.clear(); - if (is_inside_world() && get_world().is_valid()) { - RenderingServer::get_singleton()->rooms_unload(get_world()->get_scenario(), p_reason); + if (is_inside_world() && get_world_3d().is_valid()) { + RenderingServer::get_singleton()->rooms_unload(get_world_3d()->get_scenario(), p_reason); } } void RoomManager::rooms_clear() { _rooms.clear(); - if (is_inside_world() && get_world().is_valid()) { - RenderingServer::get_singleton()->rooms_and_portals_clear(get_world()->get_scenario()); + if (is_inside_world() && get_world_3d().is_valid()) { + RenderingServer::get_singleton()->rooms_and_portals_clear(get_world_3d()->get_scenario()); } } @@ -567,7 +567,7 @@ void RoomManager::rooms_convert() { return; } - ERR_FAIL_COND(!is_inside_world() || !get_world().is_valid()); + ERR_FAIL_COND(!is_inside_world() || !get_world_3d().is_valid()); // every time we run convert we increment this, // to prevent individual rooms / portals being converted @@ -633,7 +633,7 @@ void RoomManager::rooms_convert() { } break; } - RenderingServer::get_singleton()->rooms_finalize(get_world()->get_scenario(), generate_pvs, pvs_cull, _settings_use_secondary_pvs, _settings_use_signals, _pvs_filename, _settings_use_simple_pvs, _settings_log_pvs_generation); + RenderingServer::get_singleton()->rooms_finalize(get_world_3d()->get_scenario(), generate_pvs, pvs_cull, _settings_use_secondary_pvs, _settings_use_signals, _pvs_filename, _settings_use_simple_pvs, _settings_log_pvs_generation); // refresh portal depth limit set_portal_depth_limit(get_portal_depth_limit()); diff --git a/scene/3d/shape_cast.cpp b/scene/3d/shape_cast.cpp index a0bdb1070..326276a7f 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_3d(); ERR_FAIL_COND(w3d.is_null()); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index d4b6ba264..5cff9eb54 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -268,7 +268,7 @@ void SoftBody::_notification(int p_what) { add_change_receptor(this); } - RID space = get_world()->get_space(); + RID space = get_world_3d()->get_space(); PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, space); _prepare_physics_server(); } break; diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index f5020206f..2532b00a5 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -701,11 +701,11 @@ bool Spatial::is_set_as_toplevel() const { return data.toplevel; } -Ref Spatial::get_world() const { +Ref Spatial::get_world_3d() const { ERR_FAIL_COND_V(!is_inside_world(), Ref()); ERR_FAIL_COND_V(!data.viewport, Ref()); - return data.viewport->find_world(); + return data.viewport->find_world_3d(); } void Spatial::_propagate_visibility_changed() { @@ -944,7 +944,7 @@ void Spatial::_bind_methods() { ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel); ClassDB::bind_method(D_METHOD("set_disable_scale", "disable"), &Spatial::set_disable_scale); ClassDB::bind_method(D_METHOD("is_scale_disabled"), &Spatial::is_scale_disabled); - ClassDB::bind_method(D_METHOD("get_world"), &Spatial::get_world); + ClassDB::bind_method(D_METHOD("get_world_3d"), &Spatial::get_world_3d); ClassDB::bind_method(D_METHOD("force_update_transform"), &Spatial::force_update_transform); diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index 083776eca..c170a9d5c 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -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_3d() const; void set_translation(const Vector3 &p_translation); void set_rotation(const Vector3 &p_euler_rad); diff --git a/scene/3d/spring_arm.cpp b/scene/3d/spring_arm.cpp index 2549c18d4..7ce2d048b 100644 --- a/scene/3d/spring_arm.cpp +++ b/scene/3d/spring_arm.cpp @@ -149,7 +149,7 @@ void SpringArm::process_spring() { if (shape.is_null()) { motion = Vector3(cast_direction * (spring_length)); PhysicsDirectSpaceState::RayResult r; - bool intersected = get_world()->get_direct_space_state()->intersect_ray(get_global_transform().origin, get_global_transform().origin + motion, r, excluded_objects, mask); + bool intersected = get_world_3d()->get_direct_space_state()->intersect_ray(get_global_transform().origin, get_global_transform().origin + motion, r, excluded_objects, mask); if (intersected) { float dist = get_global_transform().origin.distance_to(r.position); dist -= margin; @@ -157,7 +157,7 @@ void SpringArm::process_spring() { } } else { motion = Vector3(cast_direction * spring_length); - get_world()->get_direct_space_state()->cast_motion(shape->get_rid(), get_global_transform(), motion, 0, motion_delta, motion_delta_unsafe, excluded_objects, mask); + get_world_3d()->get_direct_space_state()->cast_motion(shape->get_rid(), get_global_transform(), motion, 0, motion_delta, motion_delta_unsafe, excluded_objects, mask); } current_spring_length = spring_length * motion_delta; diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index dbec00ef9..4b578fc97 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -99,7 +99,7 @@ void VisibilityNotifier::set_aabb(const AABB &p_aabb) { if (is_inside_world()) { AABB world_aabb = get_global_transform().xform(aabb); - get_world()->_update_notifier(this, world_aabb); + get_world_3d()->_update_notifier(this, world_aabb); _world_aabb_center = world_aabb.get_center(); } @@ -122,9 +122,9 @@ void VisibilityNotifier::_refresh_portal_mode() { _cull_instance_rid = RID_PRIME(RenderingServer::get_singleton()->ghost_create()); } - if (is_inside_world() && get_world().is_valid() && get_world()->get_scenario().is_valid() && is_inside_tree()) { + if (is_inside_world() && get_world_3d().is_valid() && get_world_3d()->get_scenario().is_valid() && is_inside_tree()) { AABB world_aabb = get_global_transform().xform(aabb); - RenderingServer::get_singleton()->ghost_set_scenario(_cull_instance_rid, get_world()->get_scenario(), get_instance_id(), world_aabb); + RenderingServer::get_singleton()->ghost_set_scenario(_cull_instance_rid, get_world_3d()->get_scenario(), get_instance_id(), world_aabb); } } else { if (_cull_instance_rid != RID()) { @@ -144,7 +144,7 @@ void VisibilityNotifier::_refresh_portal_mode() { void VisibilityNotifier::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - world = get_world(); + world = get_world_3d(); ERR_FAIL_COND(!world.is_valid()); AABB world_aabb = get_global_transform().xform(aabb); diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 1373557c7..8099f7421 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -93,8 +93,8 @@ void VisualInstance::_notification(int p_what) { if (skeleton) RenderingServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() ); */ - ERR_FAIL_COND(get_world().is_null()); - RenderingServer::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); + ERR_FAIL_COND(get_world_3d().is_null()); + RenderingServer::get_singleton()->instance_set_scenario(instance, get_world_3d()->get_scenario()); _update_visibility(); } break; diff --git a/scene/3d/world_environment_3d.cpp b/scene/3d/world_environment_3d.cpp index 54de820d4..1ec90df42 100644 --- a/scene/3d/world_environment_3d.cpp +++ b/scene/3d/world_environment_3d.cpp @@ -38,35 +38,35 @@ void WorldEnvironment3D::_notification(int p_what) { if (p_what == Spatial::NOTIFICATION_ENTER_WORLD || p_what == Spatial::NOTIFICATION_ENTER_TREE) { if (environment.is_valid()) { - if (get_viewport()->find_world()->get_environment().is_valid()) { + if (get_viewport()->find_world_3d()->get_environment().is_valid()) { WARN_PRINT("World already has an environment (Another WorldEnvironment3D?), overriding."); } - get_viewport()->find_world()->set_environment(environment); - add_to_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id())); + get_viewport()->find_world_3d()->set_environment(environment); + add_to_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id())); } } else if (p_what == Spatial::NOTIFICATION_EXIT_WORLD || p_what == Spatial::NOTIFICATION_EXIT_TREE) { - if (environment.is_valid() && get_viewport()->find_world()->get_environment() == environment) { - get_viewport()->find_world()->set_environment(Ref()); - remove_from_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id())); + if (environment.is_valid() && get_viewport()->find_world_3d()->get_environment() == environment) { + get_viewport()->find_world_3d()->set_environment(Ref()); + remove_from_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id())); } } } void WorldEnvironment3D::set_environment(const Ref &p_environment) { - if (is_inside_tree() && environment.is_valid() && get_viewport()->find_world()->get_environment() == environment) { - get_viewport()->find_world()->set_environment(Ref()); - remove_from_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id())); + if (is_inside_tree() && environment.is_valid() && get_viewport()->find_world_3d()->get_environment() == environment) { + get_viewport()->find_world_3d()->set_environment(Ref()); + remove_from_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id())); //clean up } environment = p_environment; if (is_inside_tree() && environment.is_valid()) { - if (get_viewport()->find_world()->get_environment().is_valid()) { + if (get_viewport()->find_world_3d()->get_environment().is_valid()) { WARN_PRINT("World already has an environment (Another WorldEnvironment3D?), overriding."); } - get_viewport()->find_world()->set_environment(environment); - add_to_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id())); + get_viewport()->find_world_3d()->set_environment(environment); + add_to_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id())); } update_configuration_warning(); @@ -91,7 +91,7 @@ String WorldEnvironment3D::get_configuration_warning() const { } List nodes; - get_tree()->get_nodes_in_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id()), &nodes); + get_tree()->get_nodes_in_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), &nodes); if (nodes.size() > 1) { if (warning != String()) { diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index ede9783ea..cce5dbbcd 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -513,8 +513,8 @@ void SceneTree::set_physics_interpolation_enabled(bool p_enabled) { _physics_interpolation_enabled = p_enabled; - if (root->get_world().is_valid()) { - RID scenario = root->get_world()->get_scenario(); + if (root->get_world_3d().is_valid()) { + RID scenario = root->get_world_3d()->get_scenario(); if (scenario.is_valid()) { RenderingServer::get_singleton()->scenario_set_physics_interpolation_enabled(scenario, p_enabled); } @@ -548,8 +548,8 @@ bool SceneTree::iteration(float p_time) { current_frame++; - if (root->get_world().is_valid()) { - RID scenario = root->get_world()->get_scenario(); + if (root->get_world_3d().is_valid()) { + RID scenario = root->get_world_3d()->get_scenario(); if (scenario.is_valid()) { RenderingServer::get_singleton()->scenario_tick(scenario); } @@ -684,7 +684,7 @@ bool SceneTree::idle(float p_time) { String env_path = ProjectSettings::get_singleton()->get("rendering/environment/default_environment"); env_path = env_path.strip_edges(); //user may have added a space or two String cpath; - Ref fallback = get_root()->get_world()->get_fallback_environment(); + Ref fallback = get_root()->get_world_3d()->get_fallback_environment(); if (fallback.is_valid()) { cpath = fallback->get_path(); } @@ -698,14 +698,14 @@ bool SceneTree::idle(float p_time) { } else { fallback.unref(); } - get_root()->get_world()->set_fallback_environment(fallback); + get_root()->get_world_3d()->set_fallback_environment(fallback); } } #endif - if (root->get_world().is_valid()) { - RID scenario = root->get_world()->get_scenario(); + if (root->get_world_3d().is_valid()) { + RID scenario = root->get_world_3d()->get_scenario(); if (scenario.is_valid()) { RenderingServer::get_singleton()->scenario_pre_draw(scenario, true); } @@ -2207,8 +2207,8 @@ SceneTree::SceneTree() { root = memnew(Viewport); root->set_name("root"); root->set_handle_input_locally(false); - if (!root->get_world().is_valid()) { - root->set_world(Ref(memnew(World3D))); + if (!root->get_world_3d().is_valid()) { + root->set_world_3d(Ref(memnew(World3D))); } set_physics_interpolation_enabled(GLOBAL_DEF("physics/common/physics_interpolation", false)); @@ -2255,7 +2255,7 @@ SceneTree::SceneTree() { const bool use_32_bpc_depth = GLOBAL_GET("rendering/quality/depth/use_32_bpc_depth"); root->set_use_32_bpc_depth(use_32_bpc_depth); - RS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(), ref_atlas_size, ref_atlas_subdiv); + RS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world_3d()->get_scenario(), ref_atlas_size, ref_atlas_subdiv); { //load default fallback environment //get possible extensions @@ -2276,7 +2276,7 @@ SceneTree::SceneTree() { if (env_path != String()) { Ref env = ResourceLoader::load(env_path); if (env.is_valid()) { - root->get_world()->set_fallback_environment(env); + root->get_world_3d()->set_fallback_environment(env); } else { if (Engine::get_singleton()->is_editor_hint()) { //file was erased, clear the field. diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index c80ac80a2..54e1768d9 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -227,7 +227,7 @@ void Viewport::update_worlds() { find_world_2d()->_update_viewport(this, xformed_rect); find_world_2d()->_update(); - find_world()->_update(get_tree()->get_frame()); + find_world_3d()->_update(get_tree()->get_frame()); } void Viewport::_collision_object_input_event(CollisionObject *p_object, Camera *p_camera, const Ref &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape) { @@ -248,22 +248,22 @@ void Viewport::_collision_object_input_event(CollisionObject *p_object, Camera * physics_last_id = id; } -void Viewport::_own_world_changed() { - ERR_FAIL_COND(world.is_null()); - ERR_FAIL_COND(own_world.is_null()); +void Viewport::_own_world_3d_changed() { + ERR_FAIL_COND(world_3d.is_null()); + ERR_FAIL_COND(own_world_3d.is_null()); if (is_inside_tree()) { _propagate_exit_world(this); } - own_world = world->duplicate(); + own_world_3d = world_3d->duplicate(); if (is_inside_tree()) { _propagate_enter_world(this); } if (is_inside_tree()) { - RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world_3d()->get_scenario()); } _update_listener(); @@ -280,7 +280,7 @@ void Viewport::_notification(int p_what) { } current_canvas = find_world_2d()->get_canvas(); - RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world_3d()->get_scenario()); RenderingServer::get_singleton()->viewport_attach_canvas(viewport, current_canvas); _update_listener(); @@ -295,14 +295,14 @@ void Viewport::_notification(int p_what) { contact_2d_debug = RID_PRIME(RenderingServer::get_singleton()->canvas_item_create()); RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, find_world_2d()->get_canvas()); //3D - PhysicsServer::get_singleton()->space_set_debug_contacts(find_world()->get_space(), get_tree()->get_collision_debug_contact_count()); + PhysicsServer::get_singleton()->space_set_debug_contacts(find_world_3d()->get_space(), get_tree()->get_collision_debug_contact_count()); contact_3d_debug_multimesh = RID_PRIME(RenderingServer::get_singleton()->multimesh_create()); RenderingServer::get_singleton()->multimesh_allocate(contact_3d_debug_multimesh, get_tree()->get_collision_debug_contact_count(), RS::MULTIMESH_TRANSFORM_3D, RS::MULTIMESH_COLOR_8BIT); RenderingServer::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh, 0); RenderingServer::get_singleton()->multimesh_set_mesh(contact_3d_debug_multimesh, get_tree()->get_debug_contact_mesh()->get_rid()); contact_3d_debug_instance = RID_PRIME(RenderingServer::get_singleton()->instance_create()); RenderingServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh); - RenderingServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world()->get_scenario()); + RenderingServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world_3d()->get_scenario()); //RenderingServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, RS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true); } @@ -386,8 +386,8 @@ void Viewport::_notification(int p_what) { } if (get_tree()->is_debugging_collisions_hint() && contact_3d_debug_multimesh.is_valid()) { - Vector points = PhysicsServer::get_singleton()->space_get_contacts(find_world()->get_space()); - int point_count = PhysicsServer::get_singleton()->space_get_contact_count(find_world()->get_space()); + Vector points = PhysicsServer::get_singleton()->space_get_contacts(find_world_3d()->get_space()); + int point_count = PhysicsServer::get_singleton()->space_get_contact_count(find_world_3d()->get_space()); RS::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh, point_count); @@ -648,7 +648,7 @@ void Viewport::_process_picking(bool p_ignore_paused) { Vector3 dir = camera->project_ray_normal(pos); float far = camera->far; - PhysicsDirectSpaceState *space = PhysicsServer::get_singleton()->space_get_direct_state(find_world()->get_space()); + PhysicsDirectSpaceState *space = PhysicsServer::get_singleton()->space_get_direct_state(find_world_3d()->get_space()); if (space) { bool col = space->intersect_ray(from, from + dir * far, result, Set(), 0xFFFFFFFF, true, true, true); ObjectID new_collider = 0; @@ -744,7 +744,7 @@ Size2 Viewport::get_size() const { void Viewport::_update_listener() { /* if (is_inside_tree() && audio_listener && (camera || listener) && (!get_parent() || (Object::cast_to(get_parent()) && Object::cast_to(get_parent())->is_visible_in_tree()))) { - SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, find_world()->get_sound_space()); + SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, find_world_3d()->get_sound_space()); } else { SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, RID()); } @@ -1064,7 +1064,7 @@ void Viewport::_propagate_enter_world(Node *p_node) { } else { Viewport *v = Object::cast_to(p_node); if (v) { - if (v->world.is_valid() || v->own_world.is_valid()) { + if (v->world_3d.is_valid() || v->own_world_3d.is_valid()) { return; } } @@ -1098,7 +1098,7 @@ void Viewport::_propagate_exit_world(Node *p_node) { } else { Viewport *v = Object::cast_to(p_node); if (v) { - if (v->world.is_valid() || v->own_world.is_valid()) { + if (v->world_3d.is_valid() || v->own_world_3d.is_valid()) { return; } } @@ -1110,8 +1110,8 @@ void Viewport::_propagate_exit_world(Node *p_node) { } } -void Viewport::set_world(const Ref &p_world) { - if (world == p_world) { +void Viewport::set_world_3d(const Ref &p_world_3d) { + if (world_3d == p_world_3d) { return; } @@ -1119,18 +1119,18 @@ void Viewport::set_world(const Ref &p_world) { _propagate_exit_world(this); } - if (own_world.is_valid() && world.is_valid()) { - world->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + if (own_world_3d.is_valid() && world_3d.is_valid()) { + world_3d->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_3d_changed"); } - world = p_world; + world_3d = p_world_3d; - if (own_world.is_valid()) { - if (world.is_valid()) { - own_world = world->duplicate(); - world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + if (own_world_3d.is_valid()) { + if (world_3d.is_valid()) { + own_world_3d = world_3d->duplicate(); + world_3d->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_3d_changed"); } else { - own_world = Ref(memnew(World3D)); + own_world_3d = Ref(memnew(World3D)); } } @@ -1139,27 +1139,27 @@ void Viewport::set_world(const Ref &p_world) { } if (is_inside_tree()) { - RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world_3d()->get_scenario()); } _update_listener(); } -Ref Viewport::get_world() const { - return world; +Ref Viewport::get_world_3d() const { + return world_3d; } Ref Viewport::get_world_2d() const { return world_2d; } -Ref Viewport::find_world() const { - if (own_world.is_valid()) { - return own_world; - } else if (world.is_valid()) { - return world; +Ref Viewport::find_world_3d() const { + if (own_world_3d.is_valid()) { + return own_world_3d; + } else if (world_3d.is_valid()) { + return world_3d; } else if (parent) { - return parent->find_world(); + return parent->find_world_3d(); } else { return Ref(); } @@ -2897,8 +2897,8 @@ void Viewport::unhandled_input(const Ref &p_event) { } } -void Viewport::set_use_own_world(bool p_use_own_world) { - if (p_use_own_world == own_world.is_valid()) { +void Viewport::set_use_own_world_3d(bool p_use_own_world_3d) { + if (p_use_own_world_3d == own_world_3d.is_valid()) { return; } @@ -2906,17 +2906,17 @@ void Viewport::set_use_own_world(bool p_use_own_world) { _propagate_exit_world(this); } - if (p_use_own_world) { - if (world.is_valid()) { - own_world = world->duplicate(); - world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + if (p_use_own_world_3d) { + if (world_3d.is_valid()) { + own_world_3d = world_3d->duplicate(); + world_3d->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_3d_changed"); } else { - own_world = Ref(memnew(World3D)); + own_world_3d = Ref(memnew(World3D)); } } else { - own_world = Ref(); - if (world.is_valid()) { - world->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + own_world_3d = Ref(); + if (world_3d.is_valid()) { + world_3d->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_3d_changed"); } } @@ -2925,14 +2925,14 @@ void Viewport::set_use_own_world(bool p_use_own_world) { } if (is_inside_tree()) { - RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world_3d()->get_scenario()); } _update_listener(); } -bool Viewport::is_using_own_world() const { - return own_world.is_valid(); +bool Viewport::is_using_own_world_3d() const { + return own_world_3d.is_valid(); } void Viewport::set_attach_to_screen_rect(const Rect2 &p_rect) { @@ -3200,9 +3200,9 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_world_2d", "world_2d"), &Viewport::set_world_2d); ClassDB::bind_method(D_METHOD("get_world_2d"), &Viewport::get_world_2d); ClassDB::bind_method(D_METHOD("find_world_2d"), &Viewport::find_world_2d); - ClassDB::bind_method(D_METHOD("set_world", "world"), &Viewport::set_world); - ClassDB::bind_method(D_METHOD("get_world"), &Viewport::get_world); - ClassDB::bind_method(D_METHOD("find_world"), &Viewport::find_world); + ClassDB::bind_method(D_METHOD("set_world_3d", "world"), &Viewport::set_world_3d); + ClassDB::bind_method(D_METHOD("get_world_3d"), &Viewport::get_world_3d); + ClassDB::bind_method(D_METHOD("find_world_3d"), &Viewport::find_world_3d); ClassDB::bind_method(D_METHOD("set_canvas_transform", "xform"), &Viewport::set_canvas_transform); ClassDB::bind_method(D_METHOD("get_canvas_transform"), &Viewport::get_canvas_transform); @@ -3271,8 +3271,8 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("update_worlds"), &Viewport::update_worlds); - ClassDB::bind_method(D_METHOD("set_use_own_world", "enable"), &Viewport::set_use_own_world); - ClassDB::bind_method(D_METHOD("is_using_own_world"), &Viewport::is_using_own_world); + ClassDB::bind_method(D_METHOD("set_use_own_world_3d", "enable"), &Viewport::set_use_own_world_3d); + ClassDB::bind_method(D_METHOD("is_using_own_world_3d"), &Viewport::is_using_own_world_3d); ClassDB::bind_method(D_METHOD("get_camera"), &Viewport::get_camera); ClassDB::bind_method(D_METHOD("get_camera_2d"), &Viewport::get_camera_2d); @@ -3326,14 +3326,14 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("_subwindow_visibility_changed"), &Viewport::_subwindow_visibility_changed); - ClassDB::bind_method(D_METHOD("_own_world_changed"), &Viewport::_own_world_changed); + ClassDB::bind_method(D_METHOD("_own_world_3d_changed"), &Viewport::_own_world_3d_changed); ClassDB::bind_method(D_METHOD("_process_picking", "ignore_paused"), &Viewport::_process_picking); 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, "World3D"), "set_world", "get_world"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world_3d"), "set_use_own_world_3d", "is_using_own_world_3d"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world", PROPERTY_HINT_RESOURCE_TYPE, "World3D"), "set_world_3d", "get_world_3d"); 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 8ce50a5e2..84ad89918 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -251,8 +251,8 @@ private: Map physics_2d_mouseover; Ref world_2d; - Ref world; - Ref own_world; + Ref world_3d; + Ref own_world_3d; StringName input_group; StringName gui_input_group; @@ -423,7 +423,7 @@ private: void _update_canvas_items(Node *p_node); - void _own_world_changed(); + void _own_world_3d_changed(); protected: void _notification(int p_what); @@ -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_3d(const Ref &p_world); void set_world_2d(const Ref &p_world_2d); - Ref get_world() const; - Ref find_world() const; + Ref get_world_3d() const; + Ref find_world_3d() const; Ref get_world_2d() const; Ref find_world_2d() const; @@ -528,8 +528,8 @@ public: Vector2 get_camera_coords(const Vector2 &p_viewport_coords) const; Vector2 get_camera_rect_size() const; - void set_use_own_world(bool p_use_own_world); - bool is_using_own_world() const; + void set_use_own_world_3d(bool p_use_own_world_3d); + bool is_using_own_world_3d() const; void input(const Ref &p_event); void unhandled_input(const Ref &p_event);