You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Move singleton management from ProjectSettings to Engine
This commit is contained in:
@@ -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) + "'";
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
/*************************************************************************/
|
||||
#include "visual_script_nodes.h"
|
||||
|
||||
#include "engine.h"
|
||||
#include "global_constants.h"
|
||||
#include "os/input.h"
|
||||
#include "os/os.h"
|
||||
@@ -1976,13 +1977,13 @@ public:
|
||||
VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) {
|
||||
|
||||
VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton);
|
||||
instance->singleton = ProjectSettings::get_singleton()->get_singleton_object(singleton);
|
||||
instance->singleton = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
return instance;
|
||||
}
|
||||
|
||||
VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess *p_inputs, int p_output) const {
|
||||
|
||||
Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
|
||||
Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
TypeGuess tg;
|
||||
tg.type = Variant::OBJECT;
|
||||
if (obj) {
|
||||
@@ -2000,11 +2001,11 @@ void VisualScriptEngineSingleton::_bind_methods() {
|
||||
|
||||
String cc;
|
||||
|
||||
List<ProjectSettings::Singleton> singletons;
|
||||
List<Engine::Singleton> singletons;
|
||||
|
||||
ProjectSettings::get_singleton()->get_singletons(&singletons);
|
||||
Engine::get_singleton()->get_singletons(&singletons);
|
||||
|
||||
for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
|
||||
for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
|
||||
if (E->get().name == "VS" || E->get().name == "PS" || E->get().name == "PS2D" || E->get().name == "AS" || E->get().name == "TS" || E->get().name == "SS" || E->get().name == "SS2D")
|
||||
continue; //skip these, too simple named
|
||||
|
||||
|
||||
Reference in New Issue
Block a user