From c3a760c5079670854b5f0c197c15218b1606bb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 27 Mar 2020 08:06:40 +0100 Subject: Fix build with disable_3d=yes, remove dependency on WorldEnvironment --- scene/3d/SCsub | 7 ++----- scene/main/viewport.cpp | 10 ++++++++-- scene/register_scene_types.cpp | 14 ++++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/scene/3d/SCsub b/scene/3d/SCsub index 31a443bad1..45b96bd9c4 100644 --- a/scene/3d/SCsub +++ b/scene/3d/SCsub @@ -3,10 +3,7 @@ Import('env') if env['disable_3d']: - env.add_source_files(env.scene_sources, "spatial.cpp") - env.add_source_files(env.scene_sources, "skeleton.cpp") - env.add_source_files(env.scene_sources, "particles.cpp") - env.add_source_files(env.scene_sources, "visual_instance.cpp") - env.add_source_files(env.scene_sources, "world_environment.cpp") + env.add_source_files(env.scene_sources, "node_3d.cpp") + env.add_source_files(env.scene_sources, "skeleton_3d.cpp") else: env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index aaebd448b2..2f131631af 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1223,17 +1223,20 @@ void Viewport::_propagate_enter_world(Node *p_node) { if (!p_node->is_inside_tree()) //may not have entered scene yet return; +#ifndef _3D_DISABLED if (Object::cast_to(p_node) || Object::cast_to(p_node)) { - p_node->notification(Node3D::NOTIFICATION_ENTER_WORLD); } else { +#endif Viewport *v = Object::cast_to(p_node); if (v) { if (v->world.is_valid() || v->own_world.is_valid()) return; } +#ifndef _3D_DISABLED } +#endif } for (int i = 0; i < p_node->get_child_count(); i++) { @@ -1260,17 +1263,20 @@ void Viewport::_propagate_exit_world(Node *p_node) { if (!p_node->is_inside_tree()) //may have exited scene already return; +#ifndef _3D_DISABLED if (Object::cast_to(p_node) || Object::cast_to(p_node)) { - p_node->notification(Node3D::NOTIFICATION_EXIT_WORLD); } else { +#endif Viewport *v = Object::cast_to(p_node); if (v) { if (v->world.is_valid() || v->own_world.is_valid()) return; } +#ifndef _3D_DISABLED } +#endif } for (int i = 0; i < p_node->get_child_count(); i++) { diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index d9a0d4c682..f94d7a00ac 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -173,6 +173,10 @@ #include "scene/resources/world_margin_shape_3d.h" #include "scene/scene_string_names.h" +// Needed by animation code, so keep when 3D disabled. +#include "scene/3d/node_3d.h" +#include "scene/3d/skeleton_3d.h" + #ifndef _3D_DISABLED #include "scene/3d/area_3d.h" #include "scene/3d/arvr_nodes.h" @@ -186,7 +190,6 @@ #include "scene/3d/gi_probe.h" #include "scene/3d/gpu_particles_3d.h" #include "scene/3d/immediate_geometry_3d.h" - #include "scene/3d/light_3d.h" #include "scene/3d/listener_3d.h" #include "scene/3d/mesh_instance_3d.h" @@ -195,7 +198,6 @@ #include "scene/3d/navigation_agent_3d.h" #include "scene/3d/navigation_obstacle_3d.h" #include "scene/3d/navigation_region_3d.h" -#include "scene/3d/node_3d.h" #include "scene/3d/path_3d.h" #include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_joint_3d.h" @@ -204,7 +206,6 @@ #include "scene/3d/ray_cast_3d.h" #include "scene/3d/reflection_probe.h" #include "scene/3d/remote_transform_3d.h" -#include "scene/3d/skeleton_3d.h" #include "scene/3d/soft_body_3d.h" #include "scene/3d/spring_arm_3d.h" #include "scene/3d/sprite_3d.h" @@ -367,12 +368,13 @@ void register_scene_types() { /* REGISTER 3D */ - ClassDB::register_class(); - ClassDB::register_virtual_class(); - + // Needed even with _3D_DISABLED as used in animation code. ClassDB::register_class(); ClassDB::register_virtual_class(); + ClassDB::register_class(); + ClassDB::register_virtual_class(); ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); -- cgit v1.2.3