-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial editor saver plugin and resource saver scene. Begin EditorSceneSaverGLTF. Rename to save scene and save animation. Rename get save flags for saving. Initial work on save scene and save animation. Move editor scene saver gltf and its plugin out. Work on EditorSceneExporter. Keep the exporter names in sync. Extract EditorSceneImporterGLTF into a GLTFDocument. Extract gltf_document. Work on export from gltf documents. Work on _generate_gltf_scene. Work on _convert_mesh_instance. Convert camera and convert spatial. Link children and parents of a gltf node. Improve _convert_mesh_instances. Can export json. Export basic gltf2 nodes without meshes. Initial all elements of the matrix array. Stub encoding accessor. Create a stub of _encode_accessor. Checkpoint. Scene shows. Can see triangles now! Can now duplicate meshes. Default byte_stride to -1. Need to cascade change to byte_stride. Add normals, uv1 and uv2. Add tangent, weight_0 and bone_0. Avoid crashing in uvs. Serialize materials. Avoid crashes and improve materials. A mesh instances has meshes, not just array meshes. Avoid crashes. Partial material support. Save to folders. If the material is transparent, set it as blend. Support more materials. Tangents must be reordered. Size must be greater than zero. Don't process mesh_instances twice. Revert "Tangents must be reordered." This reverts commit 70e0e53a3854973f1e02cac1da88bcb2517cd281. Remove joints and weights. Cleanup. Remove old code from savers and exporters. Divide the gltf classes that are serializing and converting. Add copyrights. Whitespace changes. Whitespace. Whitespace. Code cleanup from cicd. Cleanup. Whitespace. Fixing cicd errors. Error is not being used. CICD errors. CICD fixes. Restore GDCLASS on resource saver. Don't double nest the root node. Avoid material crash. Don't need to set gltf parent. Don't lose root node. Create hierarchy for skeleton. Better skeleton. Restore skins. Add work on skins. Buggy. Disable skeletal animation for now. Revert "Disable skeletal animation for now." This reverts commit 1dc939c753ec7f249d4a065384386f2e273f414b. Disable skeletal animation. Whitespace changes. Handle materials in mesh instancce and geometry material overrides. Whitespace changes. Images array cannot be empty. Restore animations and bugfix scene conversion. Disable animations. Set the skeleton node to have the global transform removed. Revert "Set the skeleton node to have the global transform removed." This reverts commit f4a9b5e79af6938ec05d1d9e3b30a06c200f6a7e. Revert "Disable animations." This reverts commit 15513b7d2c113d7b4110b8daebebc988a1d8ab45. Support blend shapes. Add wip. Bugfixes. Restore blend shape support. Add error message. Better blend supports. Whitespace. Avoid code warnings. Duplicate and reown removed the top node. Break apart matrix. Remove duplication of code in _convert_scene_node. Change textures to srgb. Undo correction. Skins work! Whitespace. Skeleton skins meshes. Use a type that exists on windows. numerical limit of min is not lowest. Redo max and min accessor values. Change accessors for encoding. Checkin wip. Fix normalization math and don't normalize. Disable animations. Consistently use get_rotation_quat. Avoid warnings. Normalizing weights is not needed. Handle empty materials. Indices is a boolean value. Save tangent directly. Avoid gltf validation errors. Avoid invalid camera data in the nodes. Bugfixes Stepify matrix to avoid min and max float problems. Normalize tangent and normals. Add some storage for bone to node mappings and node to parent mappings. Add a material cache. Make more robust. Renumber comments. Support all meshes not just array meshes. Support gridmaps. The scene does not have extra nodes now. Save only visible nodes. Cleanup skeletons. Make the code less messy by storing the skeleton to node mapping. Remove the duplication of the skeleton node. Cleanup and make bone animations work. Avoid variable shadowing. Remove comment. Cleanup and support blend shape animations. Cleanup. Cleanup parenting logic. Find mesh or skeleton by name. Use full paths again to get nodes.
- Loading branch information
Showing
27 changed files
with
7,814 additions
and
3,134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/*************************************************************************/ | ||
/* resource_exporter.h */ | ||
/*************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* https://godotengine.org */ | ||
/*************************************************************************/ | ||
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ | ||
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ | ||
/* */ | ||
/* Permission is hereby granted, free of charge, to any person obtaining */ | ||
/* a copy of this software and associated documentation files (the */ | ||
/* "Software"), to deal in the Software without restriction, including */ | ||
/* without limitation the rights to use, copy, modify, merge, publish, */ | ||
/* distribute, sublicense, and/or sell copies of the Software, and to */ | ||
/* permit persons to whom the Software is furnished to do so, subject to */ | ||
/* the following conditions: */ | ||
/* */ | ||
/* The above copyright notice and this permission notice shall be */ | ||
/* included in all copies or substantial portions of the Software. */ | ||
/* */ | ||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ | ||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ | ||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ | ||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ | ||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ | ||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ | ||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ | ||
/*************************************************************************/ | ||
|
||
#ifndef RESOURCE_EXPORTER_H | ||
#define RESOURCE_EXPORTER_H | ||
|
||
#include "core/io/resource_loader.h" | ||
#include "resource_saver.h" | ||
|
||
class ResourceExporter; | ||
|
||
class ResourceFormatExporter : public ResourceFormatSaver { | ||
|
||
struct PathAndType { | ||
String path; | ||
String type; | ||
String exporter; | ||
String group_file; | ||
Variant metadata; | ||
}; | ||
|
||
Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid = NULL) const; | ||
|
||
static ResourceFormatExporter *singleton; | ||
|
||
//need them to stay in order to compute the settings hash | ||
struct SortExporterByName { | ||
bool operator()(const Ref<ResourceExporter> &p_a, const Ref<ResourceExporter> &p_b) const; | ||
}; | ||
|
||
Vector<Ref<ResourceExporter> > exporters; | ||
|
||
public: | ||
static ResourceFormatExporter *get_singleton() { return singleton; } | ||
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); | ||
virtual void get_recognized_exporter_extensions(List<String> *p_extensions) const; | ||
virtual void get_recognized_exporter_extensions_for_type(const String &p_type, List<String> *p_extensions) const; | ||
virtual bool recognize_path(const String &p_path) const; | ||
virtual bool handles_type(const String &p_type) const; | ||
virtual String get_resource_type(const String &p_path) const; | ||
virtual Variant get_resource_metadata(const String &p_path) const; | ||
virtual bool is_export_valid(const String &p_path) const; | ||
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false); | ||
virtual bool is_exported(const String &p_path) const { return recognize_path(p_path); } | ||
//TODO | ||
virtual String get_export_group_file(const String &p_path) const; | ||
virtual bool exists(const String &p_path) const; | ||
//TODO | ||
virtual bool can_be_exported(const String &p_path) const; | ||
//TODO | ||
virtual int get_export_order(const String &p_path) const; | ||
|
||
String get_internal_resource_path(const String &p_path) const; | ||
void get_internal_resource_path_list(const String &p_path, List<String> *r_paths); | ||
|
||
void add_exporter(const Ref<ResourceExporter> &p_exporter) { | ||
exporters.push_back(p_exporter); | ||
} | ||
void remove_exporter(const Ref<ResourceExporter> &p_exporter) { exporters.erase(p_exporter); } | ||
Ref<ResourceExporter> get_exporter_by_name(const String &p_name) const; | ||
Ref<ResourceExporter> get_exporter_by_extension(const String &p_extension) const; | ||
void get_exporters_for_extension(const String &p_extension, List<Ref<ResourceExporter> > *r_exporters); | ||
|
||
bool are_export_settings_valid(const String &p_path) const; | ||
//TODO | ||
String get_export_settings_hash() const; | ||
//TODO | ||
String get_export_base_path(const String &p_for_file) const; | ||
ResourceFormatExporter(); | ||
~ResourceFormatExporter() {} | ||
}; | ||
|
||
class ResourceExporter : public Reference { | ||
|
||
GDCLASS(ResourceExporter, Reference); | ||
|
||
public: | ||
virtual String get_exporter_name() const = 0; | ||
virtual String get_visible_name() const = 0; | ||
virtual void get_recognized_extensions(List<String> *p_extensions) const = 0; | ||
virtual String get_save_extension() const = 0; | ||
virtual String get_resource_type() const = 0; | ||
virtual float get_priority() const { return 1.0; } | ||
virtual int get_export_order() const { return 0; } | ||
|
||
struct ExportOption { | ||
PropertyInfo option; | ||
Variant default_value; | ||
|
||
ExportOption(const PropertyInfo &p_info, const Variant &p_default) : | ||
option(p_info), | ||
default_value(p_default) { | ||
} | ||
ExportOption() {} | ||
}; | ||
|
||
virtual int get_preset_count() const { return 0; } | ||
virtual String get_preset_name(int p_idx) const { return String(); } | ||
|
||
virtual void get_export_options(List<ExportOption> *r_options, int p_preset = 0) const = 0; | ||
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0; | ||
virtual String get_option_group_file() const { return String(); } | ||
|
||
virtual Error export_(Node *p_node, 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, Variant *r_metadata = NULL) = 0; | ||
|
||
virtual Error export_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; } | ||
virtual bool are_export_settings_valid(const String &p_path) const { return true; } | ||
virtual String get_export_settings_string() const { return String(); } | ||
}; | ||
|
||
#endif // RESOURCE_EXPORTER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.