mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-24 01:57:18 +01:00
Cleaned GLTFDocumentExtensionConvertImporterMesh too.
This commit is contained in:
parent
5e5ae40009
commit
53fcf8b2d3
@ -10,6 +10,8 @@ env_gltf.add_source_files(env.modules_sources, "register_types.cpp")
|
||||
|
||||
env_gltf.add_source_files(env.modules_sources, "gltf_state.cpp")
|
||||
env_gltf.add_source_files(env.modules_sources, "gltf_document_extension.cpp")
|
||||
env_gltf.add_source_files(env.modules_sources, "gltf_document_extension_convert_importer_mesh.cpp")
|
||||
|
||||
#env_gltf.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
env_gltf.add_source_files(env.modules_sources, "extensions/*.cpp")
|
||||
|
@ -35,22 +35,26 @@
|
||||
#include "core/error_macros.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/resources/importer_mesh.h"
|
||||
#include "scene/3d/importer_mesh_instance_3d.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
void GLTFDocumentExtensionConvertImporterMesh::_bind_methods() {
|
||||
}
|
||||
|
||||
Error GLTFDocumentExtensionConvertImporterMesh::import_post(Ref<GLTFState> p_state, Node *p_root) {
|
||||
ERR_FAIL_NULL_V(p_root, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER);
|
||||
|
||||
List<Node *> queue;
|
||||
queue.push_back(p_root);
|
||||
List<Node *> delete_queue;
|
||||
while (!queue.is_empty()) {
|
||||
while (!queue.empty()) {
|
||||
List<Node *>::Element *E = queue.front();
|
||||
Node *node = E->get();
|
||||
ImporterMeshInstance3D *mesh_3d = cast_to<ImporterMeshInstance3D>(node);
|
||||
if (mesh_3d) {
|
||||
MeshInstance3D *mesh_instance_node_3d = memnew(MeshInstance3D);
|
||||
MeshInstance *mesh_instance_node_3d = memnew(MeshInstance);
|
||||
Ref<ImporterMesh> mesh = mesh_3d->get_mesh();
|
||||
if (mesh.is_valid()) {
|
||||
Ref<ArrayMesh> array_mesh = mesh->get_mesh();
|
||||
@ -71,11 +75,13 @@ Error GLTFDocumentExtensionConvertImporterMesh::import_post(Ref<GLTFState> p_sta
|
||||
}
|
||||
queue.pop_front();
|
||||
}
|
||||
while (!queue.is_empty()) {
|
||||
|
||||
while (!queue.empty()) {
|
||||
List<Node *>::Element *E = delete_queue.front();
|
||||
Node *node = E->get();
|
||||
memdelete(node);
|
||||
delete_queue.pop_front();
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -31,11 +31,12 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "gltf_document_extension.h"
|
||||
|
||||
#include "scene/3d/importer_mesh_instance_3d.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/resources/importer_mesh.h"
|
||||
class GLTFState;
|
||||
class Node;
|
||||
|
||||
class GLTFDocumentExtensionConvertImporterMesh : public GLTFDocumentExtension {
|
||||
GDCLASS(GLTFDocumentExtensionConvertImporterMesh, GLTFDocumentExtension);
|
||||
@ -44,7 +45,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
Error import_post(Ref<GLTFState> p_state, Node *p_root) override;
|
||||
Error import_post(Ref<GLTFState> p_state, Node *p_root);
|
||||
};
|
||||
|
||||
#endif // GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "extensions/gltf_spec_gloss.h"
|
||||
|
||||
#include "gltf_document_extension.h"
|
||||
#include "gltf_document_extension_convert_importer_mesh.h"
|
||||
#include "gltf_state.h"
|
||||
|
||||
void register_gltf_types() {
|
||||
@ -64,7 +65,7 @@ void register_gltf_types() {
|
||||
|
||||
//ClassDB::register_class<GLTFDocument>();
|
||||
ClassDB::register_class<GLTFDocumentExtension>();
|
||||
//ClassDB::register_class<GLTFDocumentExtensionConvertImporterMesh>();
|
||||
ClassDB::register_class<GLTFDocumentExtensionConvertImporterMesh>();
|
||||
ClassDB::register_class<GLTFState>();
|
||||
}
|
||||
|
||||
@ -74,7 +75,7 @@ void unregister_gltf_types() {
|
||||
/*
|
||||
|
||||
#include "gltf_document.h"
|
||||
#include "gltf_document_extension_convert_importer_mesh.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user