Skip to content

Commit

Permalink
Add exporting glTF2.
Browse files Browse the repository at this point in the history
* Support KHR_texture_transform.
* Support exporting glTF2
* Support exporting instanced scenes
* Extract into a gltf state and gltf document
* Add a tools menu for exporting gltf2
  • Loading branch information
fire committed Dec 23, 2020
1 parent 8ad0ff8 commit 4b4efd2
Show file tree
Hide file tree
Showing 45 changed files with 10,426 additions and 4,091 deletions.
8 changes: 2 additions & 6 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
#include "editor/export_template_manager.h"
#include "editor/filesystem_dock.h"
#include "editor/import/editor_import_collada.h"
#include "editor/import/editor_scene_importer_gltf.h"
#include "editor/import/resource_importer_bitmask.h"
#include "editor/import/resource_importer_csv.h"
#include "editor/import/resource_importer_csv_translation.h"
Expand All @@ -103,6 +102,7 @@
#include "editor/import/resource_importer_texture.h"
#include "editor/import/resource_importer_texture_atlas.h"
#include "editor/import/resource_importer_wav.h"
#include "editor/import/scene_importer_mesh_node_3d.h"
#include "editor/import_dock.h"
#include "editor/multi_node_edit.h"
#include "editor/node_dock.h"
Expand Down Expand Up @@ -3673,7 +3673,7 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorFeatureProfile>();
ClassDB::register_class<EditorSpinSlider>();
ClassDB::register_class<EditorSceneImporterMesh>();
ClassDB::register_class<EditorSceneImporterMeshNode>();
ClassDB::register_class<EditorSceneImporterMeshNode3D>();

ClassDB::register_virtual_class<FileSystemDock>();

Expand Down Expand Up @@ -5712,10 +5712,6 @@ EditorNode::EditorNode() {
import_obj2.instance();
import_scene->add_importer(import_obj2);

Ref<EditorSceneImporterGLTF> import_gltf;
import_gltf.instance();
import_scene->add_importer(import_gltf);

Ref<EditorSceneImporterESCN> import_escn;
import_escn.instance();
import_scene->add_importer(import_escn);
Expand Down
9 changes: 5 additions & 4 deletions editor/import/editor_import_collada.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/os/os.h"
#include "editor/editor_node.h"
#include "editor/import/collada.h"
#include "editor/import/scene_importer_mesh_node_3d.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
Expand Down Expand Up @@ -278,8 +279,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
node = memnew(Path3D);
} else {
//mesh since nothing else
node = memnew(EditorSceneImporterMeshNode);
//Object::cast_to<EditorSceneImporterMeshNode>(node)->set_flag(GeometryInstance3D::FLAG_USE_BAKED_LIGHT, true);
node = memnew(EditorSceneImporterMeshNode3D);
//Object::cast_to<EditorSceneImporterMeshNode3D>(node)->set_flag(GeometryInstance3D::FLAG_USE_BAKED_LIGHT, true);
}
} break;
case Collada::Node::TYPE_SKELETON: {
Expand Down Expand Up @@ -1003,10 +1004,10 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
}
}

if (Object::cast_to<EditorSceneImporterMeshNode>(node)) {
if (Object::cast_to<EditorSceneImporterMeshNode3D>(node)) {
Collada::NodeGeometry *ng2 = static_cast<Collada::NodeGeometry *>(p_node);

EditorSceneImporterMeshNode *mi = Object::cast_to<EditorSceneImporterMeshNode>(node);
EditorSceneImporterMeshNode3D *mi = Object::cast_to<EditorSceneImporterMeshNode3D>(node);

ERR_FAIL_COND_V(!mi, ERR_BUG);

Expand Down
Loading

0 comments on commit 4b4efd2

Please sign in to comment.