Fix build with disable_3d=yes, remove dependency on WorldEnvironment

This commit is contained in:
Rémi Verschelde 2020-03-27 08:06:40 +01:00
parent eaae4b6408
commit c3a760c507
3 changed files with 18 additions and 13 deletions

View file

@ -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")

View file

@ -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<Node3D>(p_node) || Object::cast_to<WorldEnvironment>(p_node)) {
p_node->notification(Node3D::NOTIFICATION_ENTER_WORLD);
} else {
#endif
Viewport *v = Object::cast_to<Viewport>(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<Node3D>(p_node) || Object::cast_to<WorldEnvironment>(p_node)) {
p_node->notification(Node3D::NOTIFICATION_EXIT_WORLD);
} else {
#endif
Viewport *v = Object::cast_to<Viewport>(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++) {

View file

@ -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<Skin>();
ClassDB::register_virtual_class<SkinReference>();
// Needed even with _3D_DISABLED as used in animation code.
ClassDB::register_class<Node3D>();
ClassDB::register_virtual_class<Node3DGizmo>();
ClassDB::register_class<Skin>();
ClassDB::register_virtual_class<SkinReference>();
ClassDB::register_class<Skeleton3D>();
ClassDB::register_class<AnimationPlayer>();
ClassDB::register_class<Tween>();