Skip to content

Commit

Permalink
Merge pull request #4 from Rustmilian/master
Browse files Browse the repository at this point in the history
pull
  • Loading branch information
Rustmilian committed Sep 27, 2023
2 parents 0de296c + 8d274b1 commit ec1cbe7
Show file tree
Hide file tree
Showing 652 changed files with 80,576 additions and 26,734 deletions.
15 changes: 15 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ Copyright: 2001, Robert Penner
2007-2014, Juan Linietsky, Ariel Manzur
License: Expat

Files: ./servers/physics_2d/godot_joints_2d.cpp
Comment: Chipmunk2D Joint Constraints
Copyright: 2007, Scott Lembcke
License: Expat

Files: ./servers/physics_3d/collision_solver_3d_sat.cpp
Comment: Open Dynamics Engine
Copyright: 2001-2003, Russell L. Smith, Alen Ladavac, Nguyen Binh
Expand Down Expand Up @@ -141,6 +146,11 @@ Comment: AMD FidelityFX Super Resolution
Copyright: 2021, Advanced Micro Devices, Inc.
License: Expat

Files: ./thirdparty/amd-fsr2/
Comment: AMD FidelityFX Super Resolution 2
Copyright: 2022-2023, Advanced Micro Devices, Inc.
License: Expat

Files: ./thirdparty/angle/
Comment: ANGLE
Copyright: 2018, The ANGLE Project Authors.
Expand All @@ -166,6 +176,11 @@ Comment: CA certificates
Copyright: Mozilla Contributors
License: MPL-2.0

Files: ./thirdparty/clipper2/
Comment: Clipper2
Copyright: 2010-2013, Angus Johnson
License: BSL-1.0

Files: ./thirdparty/cvtt/
Comment: Convection Texture Tools Stand-Alone Kernels
Copyright: 2018, Eric Lasota
Expand Down
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ opts.Add("scu_limit", "Max includes per SCU file when using scu_build (determine
# Thirdparty libraries
opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True))
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
opts.Add(BoolVariable("builtin_clipper2", "Use the built-in Clipper2 library", True))
opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True))
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
Expand Down
18 changes: 18 additions & 0 deletions core/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@ if env["brotli"] and env["builtin_brotli"]:

env_thirdparty.add_source_files(thirdparty_obj, thirdparty_brotli_sources)

# Clipper2 Thirdparty source files used for polygon and polyline boolean operations.
if env["builtin_clipper2"]:
thirdparty_clipper_dir = "#thirdparty/clipper2/"
thirdparty_clipper_sources = [
"src/clipper.engine.cpp",
"src/clipper.offset.cpp",
"src/clipper.rectclip.cpp",
]
thirdparty_clipper_sources = [thirdparty_clipper_dir + file for file in thirdparty_clipper_sources]

env_thirdparty.Prepend(CPPPATH=[thirdparty_clipper_dir + "include"])
env.Prepend(CPPPATH=[thirdparty_clipper_dir + "include"])

env_thirdparty.Append(CPPDEFINES=["CLIPPER2_ENABLED"])
env.Append(CPPDEFINES=["CLIPPER2_ENABLED"])

env_thirdparty.add_source_files(thirdparty_obj, thirdparty_clipper_sources)

# Zlib library, can be unbundled
if env["builtin_zlib"]:
thirdparty_zlib_dir = "#thirdparty/zlib/"
Expand Down
30 changes: 28 additions & 2 deletions core/config/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,21 @@ bool Engine::is_printing_error_messages() const {
}

void Engine::add_singleton(const Singleton &p_singleton) {
ERR_FAIL_COND_MSG(singleton_ptrs.has(p_singleton.name), "Can't register singleton that already exists: " + String(p_singleton.name));
ERR_FAIL_COND_MSG(singleton_ptrs.has(p_singleton.name), vformat("Can't register singleton '%s' because it already exists.", p_singleton.name));
singletons.push_back(p_singleton);
singleton_ptrs[p_singleton.name] = p_singleton.ptr;
}

Object *Engine::get_singleton_object(const StringName &p_name) const {
HashMap<StringName, Object *>::ConstIterator E = singleton_ptrs.find(p_name);
ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + String(p_name) + "'.");
ERR_FAIL_COND_V_MSG(!E, nullptr, vformat("Failed to retrieve non-existent singleton '%s'.", p_name));

#ifdef TOOLS_ENABLED
if (!is_editor_hint() && is_singleton_editor_only(p_name)) {
ERR_FAIL_V_MSG(nullptr, vformat("Can't retrieve singleton '%s' outside of editor.", p_name));
}
#endif

return E->value;
}

Expand All @@ -282,6 +289,19 @@ bool Engine::is_singleton_user_created(const StringName &p_name) const {

return false;
}

bool Engine::is_singleton_editor_only(const StringName &p_name) const {
ERR_FAIL_COND_V(!singleton_ptrs.has(p_name), false);

for (const Singleton &E : singletons) {
if (E.name == p_name && E.editor_only) {
return true;
}
}

return false;
}

void Engine::remove_singleton(const StringName &p_name) {
ERR_FAIL_COND(!singleton_ptrs.has(p_name));

Expand All @@ -300,6 +320,12 @@ bool Engine::has_singleton(const StringName &p_name) const {

void Engine::get_singletons(List<Singleton> *p_singletons) {
for (const Singleton &E : singletons) {
#ifdef TOOLS_ENABLED
if (!is_editor_hint() && E.editor_only) {
continue;
}
#endif

p_singletons->push_back(E);
}
}
Expand Down
13 changes: 12 additions & 1 deletion core/config/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ class Engine {
struct Singleton {
StringName name;
Object *ptr = nullptr;
StringName class_name; //used for binding generation hinting
StringName class_name; // Used for binding generation hinting.
// Singleton scope flags.
bool user_created = false;
bool editor_only = false;

Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr, const StringName &p_class_name = StringName());
};

Expand Down Expand Up @@ -79,6 +82,7 @@ class Engine {

bool editor_hint = false;
bool project_manager_hint = false;
bool extension_reloading = false;

static Engine *singleton;

Expand Down Expand Up @@ -129,19 +133,26 @@ class Engine {
Object *get_singleton_object(const StringName &p_name) const;
void remove_singleton(const StringName &p_name);
bool is_singleton_user_created(const StringName &p_name) const;
bool is_singleton_editor_only(const StringName &p_name) const;

#ifdef TOOLS_ENABLED
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) { editor_hint = p_enabled; }
_FORCE_INLINE_ bool is_editor_hint() const { return editor_hint; }

_FORCE_INLINE_ void set_project_manager_hint(bool p_enabled) { project_manager_hint = p_enabled; }
_FORCE_INLINE_ bool is_project_manager_hint() const { return project_manager_hint; }

_FORCE_INLINE_ void set_extension_reloading_enabled(bool p_enabled) { extension_reloading = p_enabled; }
_FORCE_INLINE_ bool is_extension_reloading_enabled() const { return extension_reloading; }
#else
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) {}
_FORCE_INLINE_ bool is_editor_hint() const { return false; }

_FORCE_INLINE_ void set_project_manager_hint(bool p_enabled) {}
_FORCE_INLINE_ bool is_project_manager_hint() const { return false; }

_FORCE_INLINE_ void set_extension_reloading_enabled(bool p_enabled) {}
_FORCE_INLINE_ bool is_extension_reloading_enabled() const { return false; }
#endif

Dictionary get_version_info() const;
Expand Down
1 change: 1 addition & 0 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par
#ifdef TOOLS_ENABLED
bool _csproj_exists(String p_root_dir) {
Ref<DirAccess> dir = DirAccess::open(p_root_dir);
ERR_FAIL_COND_V(dir.is_null(), false);

dir->list_dir_begin();
String file_name = dir->_get_next();
Expand Down
Loading

0 comments on commit ec1cbe7

Please sign in to comment.