diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml index 38f56deab6..64ed5eab6d 100644 --- a/doc/classes/VisibilityEnabler2D.xml +++ b/doc/classes/VisibilityEnabler2D.xml @@ -47,9 +47,6 @@ If [code]true[/code], the parent's [method Node._process] will be stopped. - - If [code]true[/code] and the parent is a [CanvasItem], the parent will be hidden. - @@ -70,9 +67,7 @@ This enabler will stop [AnimatedSprite] nodes animations. - - - + Represents the size of the [enum Enabler] enum. diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 9da68c490f..b400539d9c 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -59,6 +59,7 @@ #include "mono_gd/gd_mono_utils.h" #include "signal_awaiter_utils.h" #include "utils/macros.h" +#include "utils/path_utils.h" #include "utils/string_utils.h" #include "utils/thread_local.h" @@ -721,16 +722,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() { GDMonoAssembly *proj_assembly = gdmono->get_project_assembly(); - String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String assembly_name = ProjectSettings::get_singleton()->get_setting("mono/project/assembly_name"); - - if (assembly_name.empty()) { - String appname_safe = OS::get_singleton()->get_safe_dir_name(appname); - if (appname_safe.empty()) { - appname_safe = "UnnamedProject"; - } - assembly_name = appname_safe; - } + String assembly_name = path::get_csharp_project_name(); assembly_name += ".dll"; diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs index 60a4f297c9..2c35b184a6 100644 --- a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs +++ b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs @@ -77,6 +77,12 @@ namespace GodotTools.Core foreach (string invalidChar in invalidChars) safeDirName = safeDirName.Replace(invalidChar, "-"); + // Avoid reserved names that conflict with Godot assemblies + if (safeDirName == "GodotSharp" || safeDirName == "GodotSharpEditor") + { + safeDirName += "_"; + } + return safeDirName; } } diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index 2fa42a1007..e57a0c7257 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -44,6 +44,7 @@ #endif #include "mono_gd/gd_mono.h" +#include "utils/path_utils.h" namespace GodotSharpDirs { @@ -149,15 +150,9 @@ private: GLOBAL_DEF_RST("mono/project/solution_directory", ""); GLOBAL_DEF_RST("mono/project/c#_project_directory", ""); - String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String appname_safe = OS::get_singleton()->get_safe_dir_name(appname); - if (appname_safe.empty()) { - appname_safe = "UnnamedProject"; - } - project_assembly_name = ProjectSettings::get_singleton()->get("mono/project/assembly_name"); if (project_assembly_name.empty()) { - project_assembly_name = appname_safe; + project_assembly_name = path::get_csharp_project_name(); ProjectSettings::get_singleton()->set("mono/project/assembly_name", project_assembly_name); } diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 0b6ace7def..4f85c3b94d 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -987,13 +987,7 @@ bool GDMono::_load_project_assembly() { if (project_assembly) return true; - String assembly_name = ProjectSettings::get_singleton()->get("mono/project/assembly_name"); - - if (assembly_name.empty()) { - String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String appname_safe = OS::get_singleton()->get_safe_dir_name(appname); - assembly_name = appname_safe; - } + String assembly_name = path::get_csharp_project_name(); bool success = load_assembly(assembly_name, &project_assembly); diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp index 69ace65d92..77820a53f2 100644 --- a/modules/mono/utils/path_utils.cpp +++ b/modules/mono/utils/path_utils.cpp @@ -208,4 +208,23 @@ String relative_to(const String &p_path, const String &p_relative_to) { return relative_to_impl(path_abs_norm, relative_to_abs_norm); } +String get_csharp_project_name() { + String name = GLOBAL_GET("mono/project/assembly_name"); + if (name.empty()) { + name = GLOBAL_GET("application/config/name"); + name = OS::get_singleton()->get_safe_dir_name(name); + } + + if (name.empty()) { + name = "UnnamedProject"; + } + + // Avoid reserved names that conflict with Godot assemblies. + if (name == "GodotSharp" || name == "GodotSharpEditor") { + name += "_"; + } + + return name; +} + } // namespace path diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h index e318311cf0..69ddfee88f 100644 --- a/modules/mono/utils/path_utils.h +++ b/modules/mono/utils/path_utils.h @@ -59,6 +59,8 @@ String realpath(const String &p_path); String relative_to(const String &p_path, const String &p_relative_to); +String get_csharp_project_name(); + } // namespace path #endif // MONO_PATH_UTILS_H diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 53d91132e1..a6800843aa 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -168,13 +168,6 @@ void VisibilityEnabler2D::_screen_enter() { if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) { get_parent()->set_process(true); } - if (enabler[ENABLER_PARENT_VISIBILITY] && get_parent()) { - CanvasItem *ci = Object::cast_to(get_parent()); - - if (ci) { - ci->set_visible(true); - } - } visible = true; } @@ -190,13 +183,6 @@ void VisibilityEnabler2D::_screen_exit() { if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) { get_parent()->set_process(false); } - if (enabler[ENABLER_PARENT_VISIBILITY] && get_parent()) { - CanvasItem *ci = Object::cast_to(get_parent()); - - if (ci) { - ci->set_visible(false); - } - } visible = false; } @@ -279,14 +265,6 @@ void VisibilityEnabler2D::_notification(int p_what) { get_parent()->connect(SceneStringNames::get_singleton()->ready, get_parent(), "set_process", varray(false), CONNECT_REFERENCE_COUNTED); } - if (enabler[ENABLER_PARENT_VISIBILITY] && get_parent()) { - CanvasItem *ci = Object::cast_to(get_parent()); - - if (ci) { - ci->connect(SceneStringNames::get_singleton()->ready, - ci, "set_visible", varray(false), CONNECT_REFERENCE_COUNTED); - } - } } if (p_what == NOTIFICATION_EXIT_TREE) { @@ -377,7 +355,6 @@ void VisibilityEnabler2D::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animated_sprites"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATED_SPRITES); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PROCESS); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "physics_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PHYSICS_PROCESS); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "visibility_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_VISIBILITY); BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS); BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES); @@ -385,7 +362,6 @@ void VisibilityEnabler2D::_bind_methods() { BIND_ENUM_CONSTANT(ENABLER_PARENT_PROCESS); BIND_ENUM_CONSTANT(ENABLER_PARENT_PHYSICS_PROCESS); BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES); - BIND_ENUM_CONSTANT(ENABLER_PARENT_VISIBILITY); BIND_ENUM_CONSTANT(ENABLER_MAX); } diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h index ba6cbebc1a..6ca67bfb3f 100644 --- a/scene/2d/visibility_notifier_2d.h +++ b/scene/2d/visibility_notifier_2d.h @@ -78,7 +78,6 @@ public: ENABLER_PARENT_PROCESS, ENABLER_PARENT_PHYSICS_PROCESS, ENABLER_PAUSE_ANIMATED_SPRITES, - ENABLER_PARENT_VISIBILITY, ENABLER_MAX };