forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get animations to import fix animation name replacement logic for scene resource imports given "/" prefix scheme from "get_animation_list" still debugging animations Apply code formatting. Implement QBODocument. Move into modules. Add append_from_buffer. Calculate skins before skeletons. Add qbo editor import. Apply code style. Add error checking. Fixes. Handling for Closing Braces (} to correctly pop the parent stack when a joint's block ends. Set the node names correctly. Set the gltf node to be a joint. Finish parsing animations _create_skeletons isn't working. Reduce. Save work. Apply format. Add debug. Fixes Add a qbo unit test. Add unit tests for QBODocument. I tested with `./bin/godot.macos.editor.dev.double.arm64 --test --test-case="*[QBODocument]*"` and ` scons vulkan=no precision=double compiledb=yes tests=yes dev_build=yes`. Update modules/qbo/config.py Update modules/qbo/qbo_document.cpp Add more logging. Use p_state. Avoid crash. compute qbo node heights Make the tests work. Handle surface indexing better, and satisfy gltf node's mesh instance child expectation Update tests. Tune down the logging. Reverse triangle winding. Fix skeleton offset axis convention first. Fix skeleton axis convention try 2. Revert. Co-Authored-By: Pierce Brooks <[email protected]>
- Loading branch information
1 parent
296de7d
commit d6609bb
Showing
17 changed files
with
1,398 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
from misc.utility.scons_hints import * | ||
|
||
Import("env") | ||
Import("env_modules") | ||
|
||
env_qbo = env_modules.Clone() | ||
|
||
# Thirdparty source files | ||
|
||
thirdparty_obj = [] | ||
|
||
env_thirdparty = env_qbo.Clone() | ||
env_thirdparty.disable_warnings() | ||
|
||
thirdparty_sources = [] | ||
|
||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) | ||
env.modules_sources += thirdparty_obj | ||
|
||
# Godot source files | ||
|
||
module_obj = [] | ||
|
||
env_qbo.add_source_files(module_obj, "*.cpp") | ||
|
||
env.modules_sources += module_obj | ||
|
||
# Needed to force rebuilding the module files when the thirdparty library is updated. | ||
env.Depends(module_obj, thirdparty_obj) | ||
|
||
if env.editor_build: | ||
env_qbo.add_source_files(env.modules_sources, "editor/*.cpp") |
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,15 @@ | ||
def can_build(env, platform): | ||
env.module_add_dependencies("qbo", ["gltf"]) | ||
return not env["disable_3d"] | ||
|
||
|
||
def configure(env): | ||
pass | ||
|
||
|
||
def get_doc_classes(): | ||
return ["QBODocument", "EditorSceneFormatImporterQBO"] | ||
|
||
|
||
def get_doc_path(): | ||
return "doc_classes" |
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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="EditorSceneFormatImporterQBO" inherits="EditorSceneFormatImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
</brief_description> | ||
<description> | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
</class> |
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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="QBODocument" inherits="GLTFDocument" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> | ||
<brief_description> | ||
</brief_description> | ||
<description> | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
</class> |
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,77 @@ | ||
/**************************************************************************/ | ||
/* editor_scene_importer_qbo.cpp */ | ||
/**************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* https://godotengine.org */ | ||
/**************************************************************************/ | ||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | ||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ | ||
/* */ | ||
/* 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. */ | ||
/**************************************************************************/ | ||
|
||
#include "editor_scene_importer_qbo.h" | ||
|
||
#ifdef TOOLS_ENABLED | ||
|
||
#include "modules/qbo/qbo_document.h" | ||
|
||
void EditorSceneFormatImporterQBO::get_extensions(List<String> *r_extensions) const { | ||
r_extensions->push_back("qbo"); | ||
} | ||
|
||
Node *EditorSceneFormatImporterQBO::import_scene(const String &p_path, uint32_t p_flags, | ||
const HashMap<StringName, Variant> &p_options, | ||
List<String> *r_missing_deps, Error *r_err) { | ||
Ref<QBODocument> gltf; | ||
gltf.instantiate(); | ||
Ref<GLTFState> state; | ||
state.instantiate(); | ||
if (p_options.has("gltf/naming_version")) { | ||
int naming_version = p_options["gltf/naming_version"]; | ||
gltf->set_naming_version(naming_version); | ||
} | ||
if (p_options.has("gltf/embedded_image_handling")) { | ||
int32_t enum_option = p_options["gltf/embedded_image_handling"]; | ||
state->set_handle_binary_image(enum_option); | ||
} | ||
if (p_options.has(SNAME("nodes/import_as_skeleton_bones")) ? (bool)p_options[SNAME("nodes/import_as_skeleton_bones")] : false) { | ||
state->set_import_as_skeleton_bones(true); | ||
} | ||
if (p_options.has(SNAME("extract_path"))) { | ||
state->set_extract_path(p_options["extract_path"]); | ||
} | ||
state->set_bake_fps(p_options["animation/fps"]); | ||
Error err = gltf->append_from_file(p_path, state, p_flags); | ||
if (err != OK) { | ||
if (r_err) { | ||
*r_err = err; | ||
} | ||
return nullptr; | ||
} | ||
if (p_options.has("animation/import")) { | ||
state->set_create_animations(bool(p_options["animation/import"])); | ||
} | ||
|
||
return gltf->generate_scene(state, state->get_bake_fps(), (bool)p_options["animation/trimming"], false); | ||
} | ||
|
||
#endif // TOOLS_ENABLED |
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,53 @@ | ||
/**************************************************************************/ | ||
/* editor_scene_importer_qbo.h */ | ||
/**************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* https://godotengine.org */ | ||
/**************************************************************************/ | ||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | ||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ | ||
/* */ | ||
/* 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 EDITOR_SCENE_IMPORTER_QBO_H | ||
#define EDITOR_SCENE_IMPORTER_QBO_H | ||
|
||
#ifdef TOOLS_ENABLED | ||
|
||
#include "editor/import/3d/resource_importer_scene.h" | ||
|
||
class Animation; | ||
class Node; | ||
|
||
class EditorSceneFormatImporterQBO : public EditorSceneFormatImporter { | ||
GDCLASS(EditorSceneFormatImporterQBO, EditorSceneFormatImporter); | ||
|
||
public: | ||
virtual void get_extensions(List<String> *r_extensions) const override; | ||
virtual Node *import_scene(const String &p_path, uint32_t p_flags, | ||
const HashMap<StringName, Variant> &p_options, | ||
List<String> *r_missing_deps, Error *r_err = nullptr) override; | ||
}; | ||
|
||
#endif // TOOLS_ENABLED | ||
|
||
#endif // EDITOR_SCENE_IMPORTER_QBO_H |
Oops, something went wrong.