mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Move singleton management from ProjectSettings to Engine
This commit is contained in:
parent
3732b2318e
commit
9b7b46143d
25 changed files with 130 additions and 109 deletions
|
@ -29,9 +29,9 @@
|
|||
/*************************************************************************/
|
||||
#include "visual_script_func_nodes.h"
|
||||
|
||||
#include "engine.h"
|
||||
#include "io/resource_loader.h"
|
||||
#include "os/os.h"
|
||||
#include "project_settings.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "visual_script_nodes.h"
|
||||
|
@ -344,7 +344,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName &p_type) {
|
|||
return;
|
||||
|
||||
singleton = p_type;
|
||||
Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
|
||||
Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
if (obj) {
|
||||
base_type = obj->get_class();
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
|
|||
|
||||
} else if (call_mode == CALL_MODE_SINGLETON) {
|
||||
|
||||
Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
|
||||
Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
if (obj) {
|
||||
type = obj->get_class();
|
||||
script = obj->get_script();
|
||||
|
@ -565,11 +565,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
|
|||
if (call_mode != CALL_MODE_SINGLETON) {
|
||||
property.usage = 0;
|
||||
} else {
|
||||
List<ProjectSettings::Singleton> names;
|
||||
ProjectSettings::get_singleton()->get_singletons(&names);
|
||||
List<Engine::Singleton> names;
|
||||
Engine::get_singleton()->get_singletons(&names);
|
||||
property.hint = PROPERTY_HINT_ENUM;
|
||||
String sl;
|
||||
for (List<ProjectSettings::Singleton>::Element *E = names.front(); E; E = E->next()) {
|
||||
for (List<Engine::Singleton>::Element *E = names.front(); E; E = E->next()) {
|
||||
if (sl != String())
|
||||
sl += ",";
|
||||
sl += E->get().name;
|
||||
|
@ -603,7 +603,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
|
|||
property.hint_string = itos(get_visual_script()->get_instance_id());
|
||||
} else if (call_mode == CALL_MODE_SINGLETON) {
|
||||
|
||||
Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
|
||||
Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
if (obj) {
|
||||
property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE;
|
||||
property.hint_string = itos(obj->get_instance_id());
|
||||
|
@ -879,7 +879,7 @@ public:
|
|||
} break;
|
||||
case VisualScriptFunctionCall::CALL_MODE_SINGLETON: {
|
||||
|
||||
Object *object = ProjectSettings::get_singleton()->get_singleton_object(singleton);
|
||||
Object *object = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
if (!object) {
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
r_error_str = "Invalid singleton name: '" + String(singleton) + "'";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue