Browse Source

Fix some build errors with `disable_3d=Yes`

* Some tests were incorrectly included
* SCU builds with animation
* Animation `switch`
A Thousand Ships 1 year ago
parent
commit
c6a1ae7875

+ 4 - 11
scene/animation/animation_mixer.cpp

@@ -953,19 +953,12 @@ Variant AnimationMixer::post_process_key_value(const Ref<Animation> &p_anim, int
 }
 
 Variant AnimationMixer::_post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx) {
-	switch (p_anim->track_get_type(p_track)) {
 #ifndef _3D_DISABLED
-		case Animation::TYPE_POSITION_3D: {
-			if (p_object_idx >= 0) {
-				const Skeleton3D *skel = Object::cast_to<Skeleton3D>(p_object);
-				return Vector3(p_value) * skel->get_motion_scale();
-			}
-			return p_value;
-		} break;
-#endif // _3D_DISABLED
-		default: {
-		} break;
+	if (p_object_idx >= 0 && p_anim->track_get_type(p_track) == Animation::TYPE_POSITION_3D) {
+		const Skeleton3D *skel = Object::cast_to<Skeleton3D>(p_object);
+		return Vector3(p_value) * skel->get_motion_scale();
 	}
+#endif // _3D_DISABLED
 	return p_value;
 }
 

+ 4 - 0
scene/animation/root_motion_view.cpp

@@ -28,6 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
 /**************************************************************************/
 
+#ifndef _3D_DISABLED
+
 #include "root_motion_view.h"
 
 #include "scene/animation/animation_tree.h"
@@ -203,3 +205,5 @@ RootMotionView::RootMotionView() {
 RootMotionView::~RootMotionView() {
 	set_base(RID());
 }
+
+#endif // _3D_DISABLED

+ 1 - 1
scene/register_scene_types.cpp

@@ -78,7 +78,6 @@
 #include "scene/animation/animation_node_state_machine.h"
 #include "scene/animation/animation_player.h"
 #include "scene/animation/animation_tree.h"
-#include "scene/animation/root_motion_view.h"
 #include "scene/animation/tween.h"
 #include "scene/audio/audio_stream_player.h"
 #include "scene/debugger/scene_debugger.h"
@@ -273,6 +272,7 @@
 #include "scene/3d/voxel_gi.h"
 #include "scene/3d/world_environment.h"
 #include "scene/3d/xr_nodes.h"
+#include "scene/animation/root_motion_view.h"
 #include "scene/resources/environment.h"
 #include "scene/resources/fog_material.h"
 #include "scene/resources/importer_mesh.h"

+ 9 - 6
tests/test_main.cpp

@@ -94,7 +94,6 @@
 #include "tests/scene/test_arraymesh.h"
 #include "tests/scene/test_audio_stream_wav.h"
 #include "tests/scene/test_bit_map.h"
-#include "tests/scene/test_camera_3d.h"
 #include "tests/scene/test_code_edit.h"
 #include "tests/scene/test_color_picker.h"
 #include "tests/scene/test_control.h"
@@ -103,16 +102,12 @@
 #include "tests/scene/test_curve_3d.h"
 #include "tests/scene/test_gradient.h"
 #include "tests/scene/test_navigation_agent_2d.h"
-#include "tests/scene/test_navigation_agent_3d.h"
 #include "tests/scene/test_navigation_obstacle_2d.h"
-#include "tests/scene/test_navigation_obstacle_3d.h"
 #include "tests/scene/test_navigation_region_2d.h"
-#include "tests/scene/test_navigation_region_3d.h"
 #include "tests/scene/test_node.h"
 #include "tests/scene/test_node_2d.h"
 #include "tests/scene/test_packed_scene.h"
 #include "tests/scene/test_path_2d.h"
-#include "tests/scene/test_path_3d.h"
 #include "tests/scene/test_primitives.h"
 #include "tests/scene/test_sprite_frames.h"
 #include "tests/scene/test_text_edit.h"
@@ -122,10 +117,18 @@
 #include "tests/scene/test_window.h"
 #include "tests/servers/rendering/test_shader_preprocessor.h"
 #include "tests/servers/test_navigation_server_2d.h"
-#include "tests/servers/test_navigation_server_3d.h"
 #include "tests/servers/test_text_server.h"
 #include "tests/test_validate_testing.h"
 
+#ifndef _3D_DISABLED
+#include "tests/scene/test_camera_3d.h"
+#include "tests/scene/test_navigation_agent_3d.h"
+#include "tests/scene/test_navigation_obstacle_3d.h"
+#include "tests/scene/test_navigation_region_3d.h"
+#include "tests/scene/test_path_3d.h"
+#include "tests/servers/test_navigation_server_3d.h"
+#endif // _3D_DISABLED
+
 #include "modules/modules_tests.gen.h"
 
 #include "tests/display_server_mock.h"