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

Godot 4.0 adaption (Windows + MacOS) #123

Merged
merged 93 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
c0c87ea
:construction: initial setup, includes and gdscript not adjusted yet
bitbrain Jul 27, 2022
bf5db0f
adjust includes
bitbrain Jul 27, 2022
8f21002
more header fixes
bitbrain Jul 27, 2022
094e8f6
fix up godot_fmod.cpp
bitbrain Jul 27, 2022
f06097c
:bug: copy-paste mistake in header file
bitbrain Jul 27, 2022
1b79601
:bug: more fixes
bitbrain Jul 27, 2022
63e4bae
Update README.md (WIP)
bitbrain Jul 27, 2022
2857401
:bug: more compilation fixes
bitbrain Jul 28, 2022
c8ea76c
:bug: some more progress
bitbrain Jul 28, 2022
f25a709
:bug: fix alloc_c_string and map access
bitbrain Jul 29, 2022
e2c62b8
:bug: more fixes
bitbrain Jul 29, 2022
916d82d
:recycle: improve code style and fix instance check
bitbrain Jul 29, 2022
cd380e1
:recycle: migrate most of gdscript over to Godot 4
bitbrain Jul 30, 2022
fdcda25
Update GUT to Godot 4
bitbrain Jul 30, 2022
4af00de
Merge branch 'godot-4.x' into godot-4.0-adaption
bitbrain Jul 31, 2022
d9cb241
:bug: fix PackedByteArray issue
bitbrain Jul 31, 2022
866c3ee
:bug: temporarily get rid of String cast issue
bitbrain Jul 31, 2022
adcacdc
:boom: delete gdscript Fmod type. Not longer required with GDExtension
bitbrain Jul 31, 2022
b4ce89e
add method descriptions
bitbrain Aug 1, 2022
b50a112
Merge branch 'godot-4.0-adaption' of github.com:utopia-rise/fmod-gdna…
bitbrain Aug 1, 2022
c9a21be
:recycle: change constant binding
bitbrain Aug 1, 2022
afe2697
:bug: fix SConstruct compilation errors on Windows
bitbrain Aug 10, 2022
6aa9257
:bug: fix file callback import and type conversion
bitbrain Aug 10, 2022
aca811b
:boom: migrate to new SConstruct format
bitbrain Aug 11, 2022
f7ff7dc
Update docs
bitbrain Aug 11, 2022
bac6d28
:bug: additional fixes for Gut
bitbrain Aug 11, 2022
bf34b44
Fix SConstruct build
bitbrain Aug 11, 2022
6bcd880
attempt to fix project (does not work)
bitbrain Aug 11, 2022
3855d16
adjust gdextension
bitbrain Aug 11, 2022
570d13e
:bug: fix gdextension file
bitbrain Aug 12, 2022
6be8657
fix remaining issues with Windows
bitbrain Aug 12, 2022
2894958
:sparkles: introduce Fmod singleton
bitbrain Aug 12, 2022
703e124
:bug: solve remaining loading issues for GDExtension
bitbrain Aug 13, 2022
8904b7c
Port Github Actions to gd-extension for Windows, Linux & MacOS
2shady4u Aug 14, 2022
d6e44a0
:bug: fix remaining gdscript errors
bitbrain Aug 14, 2022
f592423
Add Android & iOS compilation to Github Actions
2shady4u Aug 14, 2022
92bf656
temporarily disable filerunner join
bitbrain Aug 14, 2022
07c8530
Add 'godot-4.x'-branch to trigger workflow on push
2shady4u Aug 14, 2022
04e0202
Merge pull request #127 from utopia-rise/godot-4.0-adaption-actions-2
2shady4u Aug 14, 2022
daad9f3
fix further gdscript issues
bitbrain Aug 14, 2022
6bd7326
Merge branch 'godot-4.0-adaption' of github.com:utopia-rise/fmod-gdna…
bitbrain Aug 14, 2022
da1e436
:sparkles: introduce FmodEventEmitter2D
bitbrain Aug 14, 2022
fcfe1b2
expose properties on FmodEventEmitter2D
bitbrain Aug 14, 2022
ff2953a
Pause/Unpause node
bitbrain Aug 15, 2022
8a3ad1a
add FMOD icon
bitbrain Aug 15, 2022
27e6d09
Still broken...
bitbrain Aug 16, 2022
bc97741
fix gdextension loading error
bitbrain Aug 25, 2022
69e73af
fix name of getter
bitbrain Aug 25, 2022
687752b
:bookmark: upgrade Gut
bitbrain Aug 28, 2022
ddcde48
Update GUT again
bitbrain Sep 3, 2022
7ad86d1
Upgrade GUT
bitbrain Sep 10, 2022
110e542
additional fixes (still crashes with Godot 4
bitbrain Sep 10, 2022
c118020
:bug: Godot 4.0 beta1 compatibility fixes
bitbrain Sep 23, 2022
bdadd68
:recycle: add icon and prevent FMOD loading on startup
bitbrain Sep 24, 2022
93197dc
:bug: ensure we only run the FileRunner within the game
bitbrain Sep 24, 2022
965758c
update Gut
bitbrain Oct 8, 2022
d020659
upgrade SConstruct to latest Beta 2
bitbrain Oct 8, 2022
18bd472
attempt to fix Github workflow
bitbrain Oct 8, 2022
221b446
fix gdextension to use editor
bitbrain Oct 8, 2022
d8e452c
manually call _init to fix issues
bitbrain Oct 8, 2022
a8175d0
additional fixes
bitbrain Oct 8, 2022
9a3e331
dirty hack to make autoload work
bitbrain Oct 8, 2022
0862bae
simplify autoload logic
bitbrain Oct 8, 2022
1b5015e
upgrade to latest Godot
bitbrain Oct 14, 2022
1175bf9
Change registered constant names
CedNaru Oct 14, 2022
033b842
Format with new clang format
CedNaru Oct 14, 2022
4cbcbd9
Improve header imports
CedNaru Oct 14, 2022
872f9d7
generate bindings in github actions
CedNaru Oct 14, 2022
5386fec
fix added source directory in Sconstruct
CedNaru Oct 15, 2022
4c8d44f
Try more recent macos version for ios build
CedNaru Oct 15, 2022
5dc5fa5
:bookmark: bump Gut
bitbrain Oct 15, 2022
5f3fc58
update to latest Godot
bitbrain Nov 14, 2022
8ace992
Update Fmod to 2.02.10 to see if it fixes IOS symbol issues
CedNaru Dec 1, 2022
948fc57
Update scons script
CedNaru Dec 1, 2022
68de599
Remove Cocoa
CedNaru Dec 1, 2022
0353ab8
upgrade to latest Gut
bitbrain Dec 5, 2022
1ac8294
Merge branch 'godot-4.0-adaption' of github.com:utopia-rise/fmod-gdna…
bitbrain Dec 5, 2022
9296ea5
:bug: upgrade to latest godot-cpp
bitbrain Dec 30, 2022
587897d
additional fixes
bitbrain Dec 30, 2022
95c886b
Fix Macos build
CedNaru Dec 30, 2022
29b8fe6
Fix Macos build
CedNaru Dec 30, 2022
05f56a8
Fix Macos build
CedNaru Dec 30, 2022
82aadf2
Update fmod.gdextension
bitbrain Jan 2, 2023
f2a23cc
:bug: fix Windows build (32bit)
bitbrain Jan 2, 2023
2239ad6
update fmod.gdextension
bitbrain Jan 3, 2023
af1f674
ignore .exp and .lib
bitbrain Jan 3, 2023
ad96868
:bug: add missing constants
bitbrain Jan 3, 2023
4a0e0b0
:recycle: make naming consistent
bitbrain Jan 3, 2023
904db6a
FmodEventEmitter2D: stop events when exiting tree
bitbrain Jan 3, 2023
e769f22
:bug: use correct filename for MacOS
bitbrain Jan 15, 2023
d1bbfd3
:bookmark: update to latest Godot 4 Beta 14
bitbrain Jan 21, 2023
2b51f80
fix inverted is_dead method
piiertho Jan 31, 2023
61c1c8e
upgrade Godot
bitbrain Feb 1, 2023
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
20 changes: 11 additions & 9 deletions src/godot_fmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "godot_fmod.h"
#include <core/class_db.hpp>
#include <variant/utility_functions.hpp>
#include <variant/transform3d.hpp>
#include <classes/node3d.hpp>

using namespace godot;

Expand Down Expand Up @@ -302,7 +304,7 @@ void Fmod::_set_listener_attributes() {
continue;
}

if (auto *s {Node::cast_to<Spatial>(node)}) {
if (auto *s {Node::cast_to<Node3D>(node)}) {
auto attr = _get_3d_attributes_from_transform(s->get_global_transform());
ERROR_CHECK(system->setListenerAttributes(i, &attr));
continue;
Expand All @@ -329,7 +331,7 @@ FMOD_3D_ATTRIBUTES Fmod::_get_3d_attributes(const FMOD_VECTOR& pos, const FMOD_V
return f3d;
}

FMOD_3D_ATTRIBUTES Fmod::_get_3d_attributes_from_transform(const Transform& transform) const {
FMOD_3D_ATTRIBUTES Fmod::_get_3d_attributes_from_transform(const Transform3D& transform) const {
Vector3 pos = transform.get_origin() / distanceScale;
Vector3 up = transform.get_basis().elements[1];
Vector3 forward = transform.get_basis().elements[2];
Expand All @@ -349,7 +351,7 @@ FMOD_3D_ATTRIBUTES Fmod::_get_3d_attributes_from_transform_2d(const Transform2D&

Dictionary Fmod::_get_transform_info_from_3d_attribut(FMOD_3D_ATTRIBUTES& attr) const {
Dictionary _3Dattr;
Transform transform;
Transform3D transform;
transform.origin = Vector3(attr.position.x, attr.position.y, attr.position.z) * distanceScale;
const Vector3& upVector = Vector3(attr.up.x, attr.up.y, attr.up.z);
transform.basis.elements[1] = upVector;
Expand Down Expand Up @@ -384,9 +386,9 @@ bool Fmod::_is_dead(Node* node) {

bool Fmod::_is_fmod_valid(Node* node) {
if (node) {
bool ret = Node::cast_to<Spatial>(node) || Node::cast_to<CanvasItem>(node);
bool ret = Node::cast_to<Node3D>(node) || Node::cast_to<CanvasItem>(node);
if(!ret) {
GODOT_LOG(2, "Invalid Object. A listener has to be either a Spatial or CanvasItem.")
GODOT_LOG(2, "Invalid Object. A listener has to be either a Node3D or CanvasItem.")
}
return ret;
}
Expand All @@ -402,7 +404,7 @@ void Fmod::_update_instance_3d_attributes(FMOD::Studio::EventInstance* instance,
ERROR_CHECK(instance->set3DAttributes(&attr));
return;
}
if (auto *s {Node::cast_to<Spatial>(node)}) {
if (auto *s {Node::cast_to<Node3D>(node)}) {
auto attr = _get_3d_attributes_from_transform(s->get_global_transform());
ERROR_CHECK(instance->set3DAttributes(&attr));
return;
Expand Down Expand Up @@ -518,7 +520,7 @@ Dictionary Fmod::get_system_listener_2d_attributes(int index) {
return _2Dattr;
}

void Fmod::set_system_listener_3d_attributes(int index, const Transform& transform) {
void Fmod::set_system_listener_3d_attributes(int index, const Transform3D& transform) {
if (index >= 0 && index < systemListenerNumber) {
FMOD_3D_ATTRIBUTES
attr = _get_3d_attributes_from_transform(transform);
Expand Down Expand Up @@ -815,7 +817,7 @@ Dictionary Fmod::get_event_2d_attributes(uint64_t instanceId) {
return _2Dattr;
}

void Fmod::set_event_3d_attributes(uint64_t instanceId, const Transform& transform) {
void Fmod::set_event_3d_attributes(uint64_t instanceId, const Transform3D& transform) {
FIND_AND_CHECK(instanceId, events)
auto attr = _get_3d_attributes_from_transform(transform);
ERROR_CHECK(instance->set3DAttributes(&attr));
Expand Down Expand Up @@ -1294,7 +1296,7 @@ void Fmod::play_one_shot_attached_with_params(const String& eventName, Node* gam

void Fmod::attach_instance_to_node(uint64_t instanceId, Node* gameObj) {
if (!_is_fmod_valid(gameObj)) {
GODOT_LOG(1, "Trying to attach event instance to null game object or object is not Spatial or CanvasItem")
GODOT_LOG(1, "Trying to attach event instance to null game object or object is not Node3D or CanvasItem")
return;
}
FIND_AND_CHECK(instanceId, events)
Expand Down
10 changes: 5 additions & 5 deletions src/godot_fmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ namespace godot {
UtilityFunctions::print(message);\
break;\
case 1:\
UtilityFunctions::print(message, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__);\
UtilityFunctions::push_warning(message, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__);\
break;\
case 2:\
UtilityFunctions::printerr(message, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__);\
UtilityFunctions::push_error(message, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__);\
break;\
}\

Expand Down Expand Up @@ -137,7 +137,7 @@ namespace godot {
static FMOD_VECTOR _to_fmod_vector(Vector3& vec);
static FMOD_3D_ATTRIBUTES _get_3d_attributes(const FMOD_VECTOR& pos, const FMOD_VECTOR& up, const FMOD_VECTOR& forward,
const FMOD_VECTOR& vel);
FMOD_3D_ATTRIBUTES _get_3d_attributes_from_transform(const Transform& transform) const;
FMOD_3D_ATTRIBUTES _get_3d_attributes_from_transform(const Transform3D& transform) const;
FMOD_3D_ATTRIBUTES _get_3d_attributes_from_transform_2d(const Transform2D& transform) const;
Dictionary _get_transform_info_from_3d_attribut(FMOD_3D_ATTRIBUTES& attribut) const;
Dictionary _get_transform_2d_info_from_3d_attribut(FMOD_3D_ATTRIBUTES& attribut) const;
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace godot {
void set_system_listener_weight(int index, float weight);
Dictionary get_system_listener_3d_attributes(int index);
Dictionary get_system_listener_2d_attributes(int index);
void set_system_listener_3d_attributes(int index, const Transform& transform);
void set_system_listener_3d_attributes(int index, const Transform3D& transform);
void set_system_listener_2d_attributes(int index, const Transform2D& transform);
void set_listener_lock(int index, bool isLocked);
bool get_listener_lock(int index);
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace godot {
bool is_event_virtual(uint64_t instanceId);
void set_event_listener_mask(uint64_t instanceId, unsigned int mask);
uint32_t get_event_listener_mask(uint64_t instanceId);
void set_event_3d_attributes(uint64_t instanceId, const Transform& transform);
void set_event_3d_attributes(uint64_t instanceId, const Transform3D& transform);
Dictionary get_event_3d_attributes(uint64_t instanceId);
Dictionary get_event_2d_attributes(uint64_t instanceId);
void set_event_2d_attributes(uint64_t instanceId, Transform2D position);
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define GODOTFMOD_CONSTANTS_H

#include <fmod_common.h>
#include <godot_cpp/core/class_db.hpp>

#define DECLARE_CONSTANT(name)\
int _##name = name;\
Expand All @@ -18,7 +19,7 @@
}\

#define REGISTER_CONSTANT(name)\
register_property<Fmod, int>(#name,&Fmod::set_##name, &Fmod::get_##name, name);\
BIND_CONSTANT(name)\
bitbrain marked this conversation as resolved.
Show resolved Hide resolved

#define DECLARE_ALL_CONSTANTS\
DECLARE_CONSTANT(FMOD_INIT_3D_RIGHTHANDED)\
Expand Down