mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Scene import more or less working, needs some missing features.
This commit is contained in:
parent
d2b2d6801f
commit
27eae4ada1
@ -103,6 +103,7 @@
|
||||
#include "import/resource_importer_csv_translation.h"
|
||||
#include "import/resource_importer_wav.h"
|
||||
#include "import/resource_importer_obj.h"
|
||||
#include "import/resource_importer_scene.h"
|
||||
// end
|
||||
#include "editor_settings.h"
|
||||
#include "io_plugins/editor_texture_import_plugin.h"
|
||||
@ -113,7 +114,7 @@
|
||||
#include "io_plugins/editor_bitmask_import_plugin.h"
|
||||
#include "io_plugins/editor_mesh_import_plugin.h"
|
||||
#include "io_plugins/editor_export_scene.h"
|
||||
#include "io_plugins/editor_import_collada.h"
|
||||
#include "import/editor_import_collada.h"
|
||||
#include "io_plugins/editor_scene_importer_fbxconv.h"
|
||||
|
||||
#include "plugins/editor_preview_plugins.h"
|
||||
@ -5137,6 +5138,16 @@ EditorNode::EditorNode() {
|
||||
import_obj.instance();
|
||||
ResourceFormatImporter::get_singleton()->add_importer(import_obj);
|
||||
|
||||
Ref<ResourceImporterScene> import_scene;
|
||||
import_scene.instance();
|
||||
ResourceFormatImporter::get_singleton()->add_importer(import_scene);
|
||||
|
||||
{
|
||||
Ref<EditorSceneImporterCollada> import_collada;
|
||||
import_collada.instance();
|
||||
import_scene->add_importer(import_collada);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_pvrtc_register_compressors();
|
||||
|
@ -28,7 +28,7 @@
|
||||
/*************************************************************************/
|
||||
#include "editor_import_collada.h"
|
||||
|
||||
#if 0
|
||||
|
||||
#include "collada/collada.h"
|
||||
#include "scene/3d/spatial.h"
|
||||
#include "scene/3d/skeleton.h"
|
||||
@ -2465,4 +2465,4 @@ EditorSceneImporterCollada::EditorSceneImporterCollada() {
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -29,9 +29,9 @@
|
||||
#ifndef EDITOR_IMPORT_COLLADA_H
|
||||
#define EDITOR_IMPORT_COLLADA_H
|
||||
|
||||
#include "tools/editor/io_plugins/editor_scene_import_plugin.h"
|
||||
#include "tools/editor/import/resource_importer_scene.h"
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
class EditorSceneImporterCollada : public EditorSceneImporter {
|
||||
|
||||
@ -46,6 +46,6 @@ public:
|
||||
EditorSceneImporterCollada();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
1193
tools/editor/import/resource_importer_scene.cpp
Normal file
1193
tools/editor/import/resource_importer_scene.cpp
Normal file
File diff suppressed because it is too large
Load Diff
87
tools/editor/import/resource_importer_scene.h
Normal file
87
tools/editor/import/resource_importer_scene.h
Normal file
@ -0,0 +1,87 @@
|
||||
#ifndef RESOURCEIMPORTERSCENE_H
|
||||
#define RESOURCEIMPORTERSCENE_H
|
||||
|
||||
#include "io/resource_import.h"
|
||||
#include "scene/resources/animation.h"
|
||||
#include "scene/resources/shape.h"
|
||||
|
||||
class EditorSceneImporter : public Reference {
|
||||
|
||||
GDCLASS(EditorSceneImporter,Reference );
|
||||
public:
|
||||
|
||||
enum ImportFlags {
|
||||
IMPORT_SCENE=1,
|
||||
IMPORT_ANIMATION=2,
|
||||
IMPORT_ANIMATION_DETECT_LOOP=4,
|
||||
IMPORT_ANIMATION_OPTIMIZE=8,
|
||||
IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS=16,
|
||||
IMPORT_ANIMATION_KEEP_VALUE_TRACKS=32,
|
||||
IMPORT_GENERATE_TANGENT_ARRAYS=256,
|
||||
IMPORT_FAIL_ON_MISSING_DEPENDENCIES=512
|
||||
|
||||
};
|
||||
|
||||
virtual uint32_t get_import_flags() const=0;
|
||||
virtual void get_extensions(List<String> *r_extensions) const=0;
|
||||
virtual Node* import_scene(const String& p_path,uint32_t p_flags,int p_bake_fps,List<String> *r_missing_deps,Error* r_err=NULL)=0;
|
||||
virtual Ref<Animation> import_animation(const String& p_path,uint32_t p_flags)=0;
|
||||
|
||||
|
||||
|
||||
EditorSceneImporter() {}
|
||||
};
|
||||
|
||||
class EditorScenePostImport : public Reference {
|
||||
|
||||
GDCLASS(EditorScenePostImport,Reference );
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
virtual Node* post_import(Node* p_scene);
|
||||
EditorScenePostImport();
|
||||
};
|
||||
|
||||
|
||||
class ResourceImporterScene : public ResourceImporter {
|
||||
GDCLASS(ResourceImporterScene,ResourceImporter)
|
||||
|
||||
Set< Ref<EditorSceneImporter> > importers;
|
||||
|
||||
static ResourceImporterScene *singleton;
|
||||
public:
|
||||
|
||||
static ResourceImporterScene *get_singleton() { return singleton; }
|
||||
|
||||
const Set< Ref<EditorSceneImporter> >& get_importers() const { return importers; }
|
||||
|
||||
void add_importer(Ref<EditorSceneImporter> p_importer) { importers.insert(p_importer); }
|
||||
|
||||
virtual String get_importer_name() const;
|
||||
virtual String get_visible_name() const;
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual String get_save_extension() const;
|
||||
virtual String get_resource_type() const;
|
||||
|
||||
|
||||
virtual int get_preset_count() const;
|
||||
virtual String get_preset_name(int p_idx) const;
|
||||
|
||||
virtual void get_import_options(List<ImportOption> *r_options,int p_preset=0) const;
|
||||
virtual bool get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const;
|
||||
|
||||
Node* _fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>,Ref<Shape> > &collision_map);
|
||||
|
||||
void _create_clips(Node *scene, const Array& p_clips,bool p_bake_all);
|
||||
void _filter_anim_tracks(Ref<Animation> anim,Set<String> &keep);
|
||||
void _filter_tracks(Node *scene, const String& p_text);
|
||||
void _optimize_animations(Node *scene, float p_max_lin_error,float p_max_ang_error,float p_max_angle);
|
||||
|
||||
virtual Error import(const String& p_source_file,const String& p_save_path,const Map<StringName,Variant>& p_options,List<String>* r_platform_variants,List<String>* r_gen_files=NULL);
|
||||
|
||||
ResourceImporterScene();
|
||||
};
|
||||
|
||||
#endif // RESOURCEIMPORTERSCENE_H
|
Loading…
Reference in New Issue
Block a user