Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove last editor code dependencies in template build #59644

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/godot-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ runs:
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: |
echo "Building with flags:" ${{ env.SCONSFLAGS }}
if ! ${{ inputs.tools }}; then rm -rf editor; fi # Ensure we don't include editor code.
scons p=${{ inputs.platform }} target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} --jobs=2 ${{ env.SCONSFLAGS }}
ls -l bin/
6 changes: 4 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ _helper_module("methods", "methods.py")
_helper_module("platform_methods", "platform_methods.py")
_helper_module("version", "version.py")
_helper_module("core.core_builders", "core/core_builders.py")
_helper_module("editor.editor_builders", "editor/editor_builders.py")
_helper_module("editor.template_builders", "editor/template_builders.py")
_helper_module("main.main_builders", "main/main_builders.py")
_helper_module("modules.modules_builders", "modules/modules_builders.py")

Expand All @@ -58,6 +56,10 @@ import methods
import glsl_builders
import gles3_builders

if methods.get_cmdline_bool("tools", True):
_helper_module("editor.editor_builders", "editor/editor_builders.py")
_helper_module("editor.template_builders", "editor/template_builders.py")

# Scan possible build platforms

platform_list = [] # list of platforms
Expand Down
16 changes: 9 additions & 7 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
#include "core/variant/variant.h"
#include "core/version.h"
#include "drivers/png/png_driver_common.h"
#include "editor/import/resource_importer_scene.h"
#include "scene/2d/node_2d.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/mesh_instance_3d.h"
Expand All @@ -79,6 +78,9 @@
#include "modules/gridmap/grid_map.h"
#endif // MODULE_GRIDMAP_ENABLED

// FIXME: Hardcoded to avoid editor dependency.
#define GLTF_IMPORT_USE_NAMED_SKIN_BINDS 16
Comment on lines +81 to +82
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs further work from @godotengine/import. Either the enum can be replicated, or it should be moved to a non-editor file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous attempt #48914 Can ask @reduz if he approves?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's one way to solve it yeah :)


#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
Expand Down Expand Up @@ -5748,7 +5750,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> state, Node *scen
}

template <class T>
struct EditorSceneFormatImporterGLTFInterpolate {
struct SceneFormatImporterGLTFInterpolate {
T lerp(const T &a, const T &b, float c) const {
return a + (b - a) * c;
}
Expand All @@ -5774,7 +5776,7 @@ struct EditorSceneFormatImporterGLTFInterpolate {

// thank you for existing, partial specialization
template <>
struct EditorSceneFormatImporterGLTFInterpolate<Quaternion> {
struct SceneFormatImporterGLTFInterpolate<Quaternion> {
Quaternion lerp(const Quaternion &a, const Quaternion &b, const float c) const {
ERR_FAIL_COND_V_MSG(!a.is_normalized(), Quaternion(), "The quaternion \"a\" must be normalized.");
ERR_FAIL_COND_V_MSG(!b.is_normalized(), Quaternion(), "The quaternion \"b\" must be normalized.");
Expand Down Expand Up @@ -5813,7 +5815,7 @@ T GLTFDocument::_interpolate_track(const Vector<real_t> &p_times, const Vector<T
idx++;
}

EditorSceneFormatImporterGLTFInterpolate<T> interp;
SceneFormatImporterGLTFInterpolate<T> interp;

switch (p_interp) {
case GLTFAnimation::INTERP_LINEAR: {
Expand Down Expand Up @@ -6906,7 +6908,7 @@ Node *GLTFDocument::generate_scene(Ref<GLTFState> state, int32_t p_bake_fps) {
Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> state, uint32_t p_flags, int32_t p_bake_fps) {
ERR_FAIL_COND_V(state.is_null(), FAILED);
state->use_named_skin_binds =
p_flags & EditorSceneFormatImporter::IMPORT_USE_NAMED_SKIN_BINDS;
p_flags & GLTF_IMPORT_USE_NAMED_SKIN_BINDS;

_convert_scene_node(state, p_node, -1, -1);
if (!state->buffers.size()) {
Expand All @@ -6926,7 +6928,7 @@ Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_pa
// TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire
Error err = FAILED;
state->use_named_skin_binds =
p_flags & EditorSceneFormatImporter::IMPORT_USE_NAMED_SKIN_BINDS;
p_flags & GLTF_IMPORT_USE_NAMED_SKIN_BINDS;
FileAccessMemory *file_access = memnew(FileAccessMemory);
file_access->open_custom(p_bytes.ptr(), p_bytes.size());
err = _parse(state, p_base_path.get_base_dir(), file_access, p_bake_fps);
Expand Down Expand Up @@ -7029,7 +7031,7 @@ Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> r_state, uint
}
r_state->filename = p_path.get_file().get_basename();
r_state->use_named_skin_binds =
p_flags & EditorSceneFormatImporter::IMPORT_USE_NAMED_SKIN_BINDS;
p_flags & GLTF_IMPORT_USE_NAMED_SKIN_BINDS;
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
Expand Down
1 change: 0 additions & 1 deletion modules/gltf/gltf_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#define GLTF_MESH_H

#include "core/io/resource.h"
#include "editor/import/resource_importer_scene.h"
#include "scene/3d/importer_mesh_instance_3d.h"
#include "scene/resources/importer_mesh.h"
#include "scene/resources/mesh.h"
Expand Down
1 change: 0 additions & 1 deletion scene/3d/skeleton_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include "core/object/message_queue.h"
#include "core/variant/type_info.h"
#include "editor/plugins/skeleton_3d_editor_plugin.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/resources/skeleton_modification_3d.h"
#include "scene/resources/surface_tool.h"
Expand Down
1 change: 0 additions & 1 deletion scene/resources/packed_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "core/config/project_settings.h"
#include "core/core_string_names.h"
#include "core/io/resource_loader.h"
#include "editor/editor_inspector.h"
#include "scene/2d/node_2d.h"
#include "scene/3d/node_3d.h"
#include "scene/gui/control.h"
Expand Down
9 changes: 9 additions & 0 deletions servers/audio/effects/audio_effect_record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

#include "audio_effect_record.h"

#ifdef TOOLS_ENABLED
// FIXME: This file shouldn't depend on editor stuff.
#include "editor/import/resource_importer_wav.h"
#endif

void AudioEffectRecordInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
if (!is_recording) {
for (int i = 0; i < p_frame_count; i++) {
Expand Down Expand Up @@ -250,8 +255,12 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
Vector<uint8_t> bleft;
Vector<uint8_t> bright;

#ifdef TOOLS_ENABLED
ResourceImporterWAV::_compress_ima_adpcm(left, bleft);
ResourceImporterWAV::_compress_ima_adpcm(right, bright);
#else
ERR_PRINT("AudioEffectRecord cannot do IMA ADPCM compression at runtime.");
#endif
Comment on lines +258 to +263
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be reworked @godotengine/audio.

Either ResourceImporterWAV::_compress_ima_adpcm should be moved to core or servers, or this should be changed to ensure this is editor only code (and thus moved to an import plugin?).


int dl = bleft.size();
dst_data.resize(dl * 2);
Expand Down
1 change: 0 additions & 1 deletion servers/audio/effects/audio_effect_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "core/io/marshalls.h"
#include "core/os/os.h"
#include "core/os/thread.h"
#include "editor/import/resource_importer_wav.h"
#include "scene/resources/audio_stream_sample.h"
#include "servers/audio/audio_effect.h"
#include "servers/audio_server.h"
Expand Down