diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-03-13 22:57:24 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-03-13 22:57:24 -0300 |
commit | 31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b (patch) | |
tree | b6d3a290333c72940b49ed4c930ff6858a59515e /modules/multiscript | |
parent | a65edb4caabec21654c56552e11aacf0fd9291de (diff) |
-fix bug in cache for atlas import/export
-fix some menus
-fixed bug in out transition curves
-detect and remove file:/// in collada
-remove multiscript for now
-remove dependencies on mouse in OS, moved to Input
-avoid fscache from screwing up (fix might make it slower, but it works)
-funcref was missing, it's there now
Diffstat (limited to 'modules/multiscript')
-rw-r--r-- | modules/multiscript/SCsub | 7 | ||||
-rw-r--r-- | modules/multiscript/config.py | 11 | ||||
-rw-r--r-- | modules/multiscript/multi_script.cpp | 498 | ||||
-rw-r--r-- | modules/multiscript/multi_script.h | 158 | ||||
-rw-r--r-- | modules/multiscript/register_types.cpp | 32 | ||||
-rw-r--r-- | modules/multiscript/register_types.h | 30 |
6 files changed, 0 insertions, 736 deletions
diff --git a/modules/multiscript/SCsub b/modules/multiscript/SCsub deleted file mode 100644 index d20da72b72..0000000000 --- a/modules/multiscript/SCsub +++ /dev/null @@ -1,7 +0,0 @@ -Import('env') - -env.add_source_files(env.modules_sources,"*.cpp") - -Export('env') - - diff --git a/modules/multiscript/config.py b/modules/multiscript/config.py deleted file mode 100644 index f9bd7da08d..0000000000 --- a/modules/multiscript/config.py +++ /dev/null @@ -1,11 +0,0 @@ - - -def can_build(platform): - return True - - -def configure(env): - pass - - - diff --git a/modules/multiscript/multi_script.cpp b/modules/multiscript/multi_script.cpp deleted file mode 100644 index 1924cf2a6e..0000000000 --- a/modules/multiscript/multi_script.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/*************************************************************************/ -/* multi_script.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "multi_script.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<PropertyInfo> *p_properties) const{ - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - - Set<String> existing; - - for(int i=0;i<sc;i++) { - - if (!sarr[i]) - continue; - - List<PropertyInfo> pl; - sarr[i]->get_property_list(&pl); - - for(List<PropertyInfo>::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<MethodInfo> *p_list) const{ - - ScriptInstance **sarr = instances.ptr(); - int sc = instances.size(); - - - Set<StringName> existing; - - for(int i=0;i<sc;i++) { - - if (!sarr[i]) - continue; - - List<MethodInfo> ml; - sarr[i]->get_method_list(&ml); - - for(List<MethodInfo>::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++) { - - if (!sarr[i]) - continue; - - sarr[i]->notification(p_notification); - } - -} - - -Ref<Script> MultiScriptInstance::get_script() const { - - return owner; -} - -ScriptLanguage *MultiScriptInstance::get_language() { - - return MultiScriptLanguage::get_singleton(); -} - -MultiScriptInstance::~MultiScriptInstance() { - - owner->remove_instance(object); -} - - -/////////////////// - - -bool MultiScript::is_tool() const { - - for(int i=0;i<scripts.size();i++) { - - if (scripts[i]->is_tool()) - return true; - } - - return false; -} - -bool MultiScript::_set(const StringName& p_name, const Variant& p_value) { - - _THREAD_SAFE_METHOD_ - - String s = String(p_name); - if (s.begins_with("script_")) { - - int idx = s[7]; - if (idx==0) - return false; - idx-='a'; - - ERR_FAIL_COND_V(idx<0,false); - - Ref<Script> s = p_value; - - if (idx<scripts.size()) { - - - if (s.is_null()) - remove_script(idx); - else - set_script(idx,s); - } else if (idx==scripts.size()) { - if (s.is_null()) - return false; - add_script(s); - } else - return false; - - return true; - } - - return false; -} - -bool MultiScript::_get(const StringName& p_name,Variant &r_ret) const{ - - _THREAD_SAFE_METHOD_ - - String s = String(p_name); - if (s.begins_with("script_")) { - - int idx = s[7]; - if (idx==0) - return false; - idx-='a'; - - ERR_FAIL_COND_V(idx<0,false); - - if (idx<scripts.size()) { - - r_ret=get_script(idx); - return true; - } else if (idx==scripts.size()) { - r_ret=Ref<Script>(); - return true; - } - } - - return false; -} -void MultiScript::_get_property_list( List<PropertyInfo> *p_list) const{ - - _THREAD_SAFE_METHOD_ - - for(int i=0;i<scripts.size();i++) { - - p_list->push_back( PropertyInfo(Variant::OBJECT,"script_"+String::chr('a'+i),PROPERTY_HINT_RESOURCE_TYPE,"Script") ); - - } - - if (scripts.size()<25) { - - p_list->push_back( PropertyInfo(Variant::OBJECT,"script_"+String::chr('a'+(scripts.size())),PROPERTY_HINT_RESOURCE_TYPE,"Script") ); - } -} - -void MultiScript::set_script(int p_idx,const Ref<Script>& p_script ) { - - _THREAD_SAFE_METHOD_ - - ERR_FAIL_INDEX(p_idx,scripts.size()); - ERR_FAIL_COND( p_script.is_null() ); - - scripts[p_idx]=p_script; - Ref<Script> s=p_script; - - for (Map<Object*,MultiScriptInstance*>::Element *E=instances.front();E;E=E->next()) { - - - MultiScriptInstance*msi=E->get(); - ScriptInstance *si = msi->instances[p_idx]; - if (si) { - msi->instances[p_idx]=NULL; - memdelete(si); - } - - if (p_script->can_instance()) - msi->instances[p_idx]=s->instance_create(msi->object); - - } - - -} - - -Ref<Script> MultiScript::get_script(int p_idx) const{ - - _THREAD_SAFE_METHOD_ - - ERR_FAIL_INDEX_V(p_idx,scripts.size(),Ref<Script>()); - - return scripts[p_idx]; - -} -void MultiScript::add_script(const Ref<Script>& p_script){ - - _THREAD_SAFE_METHOD_ - ERR_FAIL_COND( p_script.is_null() ); - scripts.push_back(p_script); - Ref<Script> s=p_script; - - for (Map<Object*,MultiScriptInstance*>::Element *E=instances.front();E;E=E->next()) { - - - MultiScriptInstance*msi=E->get(); - - if (p_script->can_instance()) - msi->instances.push_back( s->instance_create(msi->object) ); - else - msi->instances.push_back(NULL); - - msi->object->_change_notify(); - - } - - - _change_notify(); -} - - -void MultiScript::remove_script(int p_idx) { - - _THREAD_SAFE_METHOD_ - - ERR_FAIL_INDEX(p_idx,scripts.size()); - - scripts.remove(p_idx); - - for (Map<Object*,MultiScriptInstance*>::Element *E=instances.front();E;E=E->next()) { - - - MultiScriptInstance*msi=E->get(); - ScriptInstance *si = msi->instances[p_idx]; - msi->instances.remove(p_idx); - if (si) { - memdelete(si); - } - - msi->object->_change_notify(); - } - - -} - - -void MultiScript::remove_instance(Object *p_object) { - - _THREAD_SAFE_METHOD_ - instances.erase(p_object); -} - -bool MultiScript::can_instance() const { - - return true; -} - -StringName MultiScript::get_instance_base_type() const { - - return StringName(); -} -ScriptInstance* MultiScript::instance_create(Object *p_this) { - - _THREAD_SAFE_METHOD_ - MultiScriptInstance *msi = memnew( MultiScriptInstance ); - msi->object=p_this; - msi->owner=this; - for(int i=0;i<scripts.size();i++) { - - ScriptInstance *si; - - if (scripts[i]->can_instance()) - si = scripts[i]->instance_create(p_this); - else - si=NULL; - - msi->instances.push_back(si); - } - - instances[p_this]=msi; - p_this->_change_notify(); - return msi; -} -bool MultiScript::instance_has(const Object *p_this) const { - - _THREAD_SAFE_METHOD_ - return instances.has((Object*)p_this); -} - -bool MultiScript::has_source_code() const { - - return false; -} -String MultiScript::get_source_code() const { - - return ""; -} -void MultiScript::set_source_code(const String& p_code) { - - -} -Error MultiScript::reload() { - - for(int i=0;i<scripts.size();i++) - scripts[i]->reload(); - - return OK; -} - -String MultiScript::get_node_type() const { - - return ""; -} - -void MultiScript::_bind_methods() { - - -} - -ScriptLanguage *MultiScript::get_language() const { - - return MultiScriptLanguage::get_singleton(); -} - - -/////////////// - -MultiScript::MultiScript() { -} - - -MultiScriptLanguage *MultiScriptLanguage::singleton=NULL; diff --git a/modules/multiscript/multi_script.h b/modules/multiscript/multi_script.h deleted file mode 100644 index 87d4b4e4c8..0000000000 --- a/modules/multiscript/multi_script.h +++ /dev/null @@ -1,158 +0,0 @@ -/*************************************************************************/ -/* multi_script.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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. */ -/*************************************************************************/ -#ifndef MULTI_SCRIPT_H -#define MULTI_SCRIPT_H - -#include "script_language.h" -#include "os/thread_safe.h" - -class MultiScript; - -class MultiScriptInstance : public ScriptInstance { -friend class MultiScript; - mutable Vector<ScriptInstance*> instances; - Object *object; - mutable MultiScript *owner; - -public: - virtual bool set(const StringName& p_name, const Variant& p_value); - virtual bool get(const StringName& p_name, Variant &r_ret) const; - virtual void get_property_list(List<PropertyInfo> *p_properties) const; - - virtual void get_method_list(List<MethodInfo> *p_list) const; - virtual bool has_method(const StringName& p_method) const; - virtual Variant call(const StringName& p_method,const Variant** p_args,int p_argcount,Variant::CallError &r_error); - virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount); - virtual void notification(int p_notification); - - - virtual Ref<Script> get_script() const; - - virtual ScriptLanguage *get_language(); - virtual ~MultiScriptInstance(); -}; - - -class MultiScript : public Script { - - _THREAD_SAFE_CLASS_ -friend class MultiScriptInstance; - OBJ_TYPE( MultiScript,Script); - - Vector<Ref<Script> > scripts; - - Map<Object*,MultiScriptInstance*> instances; -protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; - void _get_property_list( List<PropertyInfo> *p_list) const; - - static void _bind_methods(); - -public: - - void remove_instance(Object *p_object); - virtual bool can_instance() const; - - virtual StringName get_instance_base_type() const; - virtual ScriptInstance* instance_create(Object *p_this); - virtual bool instance_has(const Object *p_this) const; - - virtual bool has_source_code() const; - virtual String get_source_code() const; - virtual void set_source_code(const String& p_code); - virtual Error reload(); - - virtual bool is_tool() const; - - virtual String get_node_type() const; - - - void set_script(int p_idx,const Ref<Script>& p_script ); - Ref<Script> get_script(int p_idx) const; - void remove_script(int p_idx); - void add_script(const Ref<Script>& p_script); - - virtual ScriptLanguage *get_language() const; - - MultiScript(); -}; - - -class MultiScriptLanguage : public ScriptLanguage { - - static MultiScriptLanguage *singleton; -public: - - static _FORCE_INLINE_ MultiScriptLanguage *get_singleton() { return singleton; } - virtual String get_name() const { return "MultiScript"; } - - /* LANGUAGE FUNCTIONS */ - virtual void init() {} - virtual String get_type() const { return "MultiScript"; } - virtual String get_extension() const { return ""; } - virtual Error execute_file(const String& p_path) { return OK; } - virtual void finish() {} - - /* EDITOR FUNCTIONS */ - virtual void get_reserved_words(List<String> *p_words) const {} - virtual void get_comment_delimiters(List<String> *p_delimiters) const {} - virtual void get_string_delimiters(List<String> *p_delimiters) const {} - virtual String get_template(const String& p_class_name, const String& p_base_class_name) const { return ""; } - virtual bool validate(const String& p_script, int &r_line_error,int &r_col_error,String& r_test_error,const String& p_path="",List<String>* r_fn=NULL) const { return true; } - virtual Script *create_script() const { return memnew( MultiScript ); } - virtual bool has_named_classes() const { return false; } - virtual int find_function(const String& p_function,const String& p_code) const { return -1; } - virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const { return ""; } - - /* DEBUGGER FUNCTIONS */ - - virtual String debug_get_error() const { return ""; } - virtual int debug_get_stack_level_count() const { return 0; } - virtual int debug_get_stack_level_line(int p_level) const { return 0; } - virtual String debug_get_stack_level_function(int p_level) const { return ""; } - virtual String debug_get_stack_level_source(int p_level) const { return ""; } - virtual void debug_get_stack_level_locals(int p_level,List<String> *p_locals, List<Variant> *p_values, int p_max_subitems=-1,int p_max_depth=-1) {} - virtual void debug_get_stack_level_members(int p_level,List<String> *p_members, List<Variant> *p_values, int p_max_subitems=-1,int p_max_depth=-1) {} - virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems=-1,int p_max_depth=-1) {} - virtual String debug_parse_stack_level_expression(int p_level,const String& p_expression,int p_max_subitems=-1,int p_max_depth=-1) { return ""; } - - /* LOADER FUNCTIONS */ - - virtual void get_recognized_extensions(List<String> *p_extensions) const {} - virtual void get_public_functions(List<MethodInfo> *p_functions) const {} - virtual void get_public_constants(List<Pair<String,Variant> > *p_constants) const {} - - MultiScriptLanguage() { singleton=this; } - virtual ~MultiScriptLanguage() {}; -}; - - -#endif // MULTI_SCRIPT_H diff --git a/modules/multiscript/register_types.cpp b/modules/multiscript/register_types.cpp deleted file mode 100644 index 4b25656723..0000000000 --- a/modules/multiscript/register_types.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************/ -/* register_script_types.cpp */ -/*************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/*************************************************/ -/* Source code within this file is: */ -/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */ -/* All Rights Reserved. */ -/*************************************************/ - -#include "register_types.h" - -#include "multi_script.h" -#include "io/resource_loader.h" - -static MultiScriptLanguage *script_multi_script=NULL; - -void register_multiscript_types() { - - - script_multi_script = memnew( MultiScriptLanguage ); - ScriptServer::register_language(script_multi_script); - ObjectTypeDB::register_type<MultiScript>(); - - -} -void unregister_multiscript_types() { - - if (script_multi_script); - memdelete(script_multi_script); -} diff --git a/modules/multiscript/register_types.h b/modules/multiscript/register_types.h deleted file mode 100644 index d137b1c63f..0000000000 --- a/modules/multiscript/register_types.h +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************/ -/* register_types.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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. */ -/*************************************************************************/ -void register_multiscript_types(); -void unregister_multiscript_types(); |