Browse Source

Merge pull request #64642 from aaronfranke/mesh-cleanup

Rémi Verschelde 3 years ago
parent
commit
43ff5dd890

+ 0 - 1
editor/import/resource_importer_texture_atlas.cpp

@@ -382,7 +382,6 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
 			mesh_texture->set_mesh(mesh);
 
 			texture = mesh_texture;
-			//mesh
 		}
 
 		String save_path = p_base_paths[E.key] + ".res";

+ 0 - 1
main/performance.h

@@ -85,7 +85,6 @@ public:
 		PHYSICS_3D_ACTIVE_OBJECTS,
 		PHYSICS_3D_COLLISION_PAIRS,
 		PHYSICS_3D_ISLAND_COUNT,
-		//physics
 		AUDIO_OUTPUT_LATENCY,
 		MONITOR_MAX
 	};

+ 3 - 5
scene/animation/animation_player.cpp

@@ -323,10 +323,8 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim, Node *p_root_ov
 
 #endif // _3D_DISABLED
 
-		{
-			if (!child->is_connected("tree_exiting", callable_mp(this, &AnimationPlayer::_node_removed))) {
-				child->connect("tree_exiting", callable_mp(this, &AnimationPlayer::_node_removed).bind(child), CONNECT_ONESHOT);
-			}
+		if (!child->is_connected("tree_exiting", callable_mp(this, &AnimationPlayer::_node_removed))) {
+			child->connect("tree_exiting", callable_mp(this, &AnimationPlayer::_node_removed).bind(child), CONNECT_ONESHOT);
 		}
 
 		TrackNodeCacheKey key;
@@ -375,7 +373,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim, Node *p_root_ov
 					node_cache->init_rot = rest.basis.get_rotation_quaternion();
 					node_cache->init_scale = rest.basis.get_scale();
 				} else {
-					// no property, just use spatialnode
+					// Not a skeleton, the node can be accessed with the node_3d member.
 					node_cache->skeleton = nullptr;
 				}
 			}

+ 8 - 10
scene/register_scene_types.cpp

@@ -158,8 +158,8 @@
 #include "scene/resources/immediate_mesh.h"
 #include "scene/resources/label_settings.h"
 #include "scene/resources/material.h"
-#include "scene/resources/mesh.h"
 #include "scene/resources/mesh_data_tool.h"
+#include "scene/resources/multimesh.h"
 #include "scene/resources/navigation_mesh.h"
 #include "scene/resources/packed_scene.h"
 #include "scene/resources/particles_material.h"
@@ -260,7 +260,7 @@
 #include "scene/resources/fog_material.h"
 #include "scene/resources/importer_mesh.h"
 #include "scene/resources/mesh_library.h"
-#endif
+#endif // _3D_DISABLED
 
 static Ref<ResourceFormatSaverText> resource_saver_text;
 static Ref<ResourceFormatLoaderText> resource_loader_text;
@@ -575,7 +575,7 @@ void register_scene_types() {
 	GDREGISTER_CLASS(NavigationObstacle3D);
 
 	OS::get_singleton()->yield(); // may take time to init
-#endif
+#endif // _3D_DISABLED
 
 	/* REGISTER SHADER */
 
@@ -765,10 +765,6 @@ void register_scene_types() {
 	SceneTree::add_idle_callback(ParticlesMaterial::flush_changes);
 	ParticlesMaterial::init_shaders();
 
-	GDREGISTER_CLASS(ProceduralSkyMaterial);
-	GDREGISTER_CLASS(PanoramaSkyMaterial);
-	GDREGISTER_CLASS(PhysicalSkyMaterial);
-
 	GDREGISTER_VIRTUAL_CLASS(Mesh);
 	GDREGISTER_CLASS(ArrayMesh);
 	GDREGISTER_CLASS(PlaceholderMesh);
@@ -796,6 +792,9 @@ void register_scene_types() {
 	GDREGISTER_CLASS(StandardMaterial3D);
 	GDREGISTER_CLASS(ORMMaterial3D);
 	GDREGISTER_CLASS(PlaceholderMaterial);
+	GDREGISTER_CLASS(ProceduralSkyMaterial);
+	GDREGISTER_CLASS(PanoramaSkyMaterial);
+	GDREGISTER_CLASS(PhysicalSkyMaterial);
 	SceneTree::add_idle_callback(BaseMaterial3D::flush_changes);
 	BaseMaterial3D::init_shaders();
 
@@ -824,7 +823,7 @@ void register_scene_types() {
 	ClassDB::register_class<SkeletonModification3DStackHolder>();
 
 	OS::get_singleton()->yield(); // may take time to init
-#endif
+#endif // _3D_DISABLED
 
 	GDREGISTER_CLASS(PhysicsMaterial);
 	GDREGISTER_CLASS(World3D);
@@ -1203,11 +1202,10 @@ void unregister_scene_types() {
 	// StandardMaterial3D is not initialised when 3D is disabled, so it shouldn't be cleaned up either
 #ifndef _3D_DISABLED
 	BaseMaterial3D::finish_shaders();
-#endif // _3D_DISABLED
-
 	PhysicalSkyMaterial::cleanup_shader();
 	PanoramaSkyMaterial::cleanup_shader();
 	ProceduralSkyMaterial::cleanup_shader();
+#endif // _3D_DISABLED
 
 	ParticlesMaterial::finish_shaders();
 	CanvasItemMaterial::finish_shaders();

+ 2 - 3
scene/resources/mesh.cpp

@@ -32,11 +32,10 @@
 
 #include "core/math/convex_hull.h"
 #include "core/templates/pair.h"
+#include "scene/resources/surface_tool.h"
+
 #include "scene/resources/concave_polygon_shape_3d.h"
 #include "scene/resources/convex_polygon_shape_3d.h"
-#include "surface_tool.h"
-
-#include <stdlib.h>
 
 Mesh::ConvexDecompositionFunc Mesh::convex_decomposition_function = nullptr;
 

+ 2 - 3
scene/resources/mesh.h

@@ -169,9 +169,6 @@ public:
 	void generate_debug_mesh_lines(Vector<Vector3> &r_lines);
 	void generate_debug_mesh_indices(Vector<Vector3> &r_points);
 
-	Ref<Shape3D> create_trimesh_shape() const;
-	Ref<Shape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const;
-
 	Ref<Mesh> create_outline(float p_margin) const;
 
 	void set_lightmap_size_hint(const Size2i &p_size);
@@ -214,6 +211,8 @@ public:
 	static ConvexDecompositionFunc convex_decomposition_function;
 
 	Vector<Ref<Shape3D>> convex_decompose(const ConvexDecompositionSettings &p_settings) const;
+	Ref<Shape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const;
+	Ref<Shape3D> create_trimesh_shape() const;
 
 	virtual int get_builtin_bind_pose_count() const;
 	virtual Transform3D get_builtin_bind_pose(int p_index) const;

+ 1 - 1
scene/resources/mesh_library.h

@@ -33,8 +33,8 @@
 
 #include "core/io/resource.h"
 #include "core/templates/rb_map.h"
-#include "mesh.h"
 #include "scene/3d/navigation_region_3d.h"
+#include "scene/resources/mesh.h"
 #include "shape_3d.h"
 
 class MeshLibrary : public Resource {

+ 0 - 2
scene/resources/navigation_mesh.h

@@ -33,8 +33,6 @@
 
 #include "scene/resources/mesh.h"
 
-class Mesh;
-
 class NavigationMesh : public Resource {
 	GDCLASS(NavigationMesh, Resource);
 

+ 1 - 1
scene/resources/texture.cpp

@@ -35,8 +35,8 @@
 #include "core/io/marshalls.h"
 #include "core/math/geometry_2d.h"
 #include "core/os/os.h"
-#include "mesh.h"
 #include "scene/resources/bit_map.h"
+#include "scene/resources/mesh.h"
 #include "servers/camera/camera_feed.h"
 int Texture2D::get_width() const {
 	int ret;