From 15bce7f75f0dfab9863db5d4c7a51f5fc96fdb89 Mon Sep 17 00:00:00 2001 From: Karroffel Date: Thu, 11 May 2017 21:15:35 +0200 Subject: removed multiscript removes MultiScript which was re-added in #8502 (aka 4c14700). This feature didn't turn out to be as useful as most expected. It causes more troubles than it does good. --- modules/multiscript/multiscript.cpp | 750 ------------------------------------ 1 file changed, 750 deletions(-) delete mode 100644 modules/multiscript/multiscript.cpp (limited to 'modules/multiscript/multiscript.cpp') diff --git a/modules/multiscript/multiscript.cpp b/modules/multiscript/multiscript.cpp deleted file mode 100644 index b2633b7207..0000000000 --- a/modules/multiscript/multiscript.cpp +++ /dev/null @@ -1,750 +0,0 @@ -/*************************************************************************/ -/* multiscript.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "multiscript.h" - -bool MultiScriptInstance::set(const StringName &p_name, const Variant &p_value) { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - bool found = sarr[i]->set(p_name, p_value); - if (found) - return true; - } - - if (String(p_name).begins_with("script_")) { - bool valid; - owner->set(p_name, p_value, &valid); - return valid; - } - return false; -} - -bool MultiScriptInstance::get(const StringName &p_name, Variant &r_ret) const { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - bool found = sarr[i]->get(p_name, r_ret); - if (found) - return true; - } - if (String(p_name).begins_with("script_")) { - bool valid; - r_ret = owner->get(p_name, &valid); - return valid; - } - return false; -} -void MultiScriptInstance::get_property_list(List *p_properties) const { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - Set existing; - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - List pl; - sarr[i]->get_property_list(&pl); - - for (List::Element *E = pl.front(); E; E = E->next()) { - - if (existing.has(E->get().name)) - continue; - - p_properties->push_back(E->get()); - existing.insert(E->get().name); - } - } - - p_properties->push_back(PropertyInfo(Variant::NIL, "Scripts", PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_CATEGORY)); - - for (int i = 0; i < owner->scripts.size(); i++) { - - p_properties->push_back(PropertyInfo(Variant::OBJECT, "script_" + String::chr('a' + i), PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_EDITOR)); - } - - if (owner->scripts.size() < 25) { - - p_properties->push_back(PropertyInfo(Variant::OBJECT, "script_" + String::chr('a' + (owner->scripts.size())), PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_EDITOR)); - } -} - -void MultiScriptInstance::get_method_list(List *p_list) const { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - Set existing; - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - List ml; - sarr[i]->get_method_list(&ml); - - for (List::Element *E = ml.front(); E; E = E->next()) { - - if (existing.has(E->get().name)) - continue; - - p_list->push_back(E->get()); - existing.insert(E->get().name); - } - } -} -bool MultiScriptInstance::has_method(const StringName &p_method) const { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - if (sarr[i]->has_method(p_method)) - return true; - } - - return false; -} - -Variant MultiScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - Variant r = sarr[i]->call(p_method, p_args, p_argcount, r_error); - if (r_error.error == Variant::CallError::CALL_OK) - return r; - else if (r_error.error != Variant::CallError::CALL_ERROR_INVALID_METHOD) - return r; - } - - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; - return Variant(); -} - -void MultiScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - for (int i = 0; i < sc; i++) { - - if (!sarr[i]) - continue; - - sarr[i]->call_multilevel(p_method, p_args, p_argcount); - } -} -void MultiScriptInstance::notification(int p_notification) { - - // ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - for (int i = 0; i < sc; i++) { - - ScriptInstance *instance = instances[i]; - - if (!instance) - continue; - - instance->notification(p_notification); - } -} - -Ref