summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/array.cpp31
-rw-r--r--core/array.h2
-rw-r--r--core/bind/core_bind.cpp11
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/command_queue_mt.h126
-rw-r--r--core/dictionary.cpp14
-rw-r--r--core/dictionary.h1
-rw-r--r--core/global_constants.cpp14
-rw-r--r--core/input_map.cpp92
-rw-r--r--core/input_map.h3
-rw-r--r--core/io/LICENSE-InfoZip.txt60
-rw-r--r--core/io/LICENSE-MiniZip.txt32
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/http_client.h2
-rw-r--r--core/io/ioapi.c2
-rw-r--r--core/io/ioapi.h2
-rw-r--r--core/io/unzip.c2
-rw-r--r--core/io/unzip.h2
-rw-r--r--core/io/zip.c2
-rw-r--r--core/io/zip.h2
-rw-r--r--core/object.cpp25
-rw-r--r--core/object.h2
-rw-r--r--core/os/os.cpp18
-rw-r--r--core/os/os.h6
-rw-r--r--core/resource.cpp1
-rw-r--r--core/script_debugger_remote.cpp14
-rw-r--r--core/script_debugger_remote.h2
-rw-r--r--core/script_language.cpp2
-rw-r--r--core/script_language.h7
-rw-r--r--core/variant_call.cpp12
-rw-r--r--core/variant_op.cpp10
-rw-r--r--core/variant_parser.cpp39
32 files changed, 522 insertions, 21 deletions
diff --git a/core/array.cpp b/core/array.cpp
index fef0fcbb40..1d283a14aa 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -155,6 +155,37 @@ int Array::find(const Variant& p_value) const {
return _p->array.find(p_value);
}
+int Array::find_last(const Variant& p_value) const {
+
+ if(_p->array.size() == 0)
+ return -1;
+
+ for (int i=_p->array.size()-1; i>=0; i--) {
+
+ if(_p->array[i] == p_value){
+ return i;
+ };
+ };
+
+ return -1;
+}
+
+int Array::count(const Variant& p_value) const {
+
+ if(_p->array.size() == 0)
+ return 0;
+
+ int amount=0;
+ for (int i=0; i<_p->array.size(); i++) {
+
+ if(_p->array[i] == p_value){
+ amount++;
+ };
+ };
+
+ return amount;
+}
+
void Array::remove(int p_pos) {
_p->array.remove(p_pos);
diff --git a/core/array.h b/core/array.h
index ecb91b69dc..9472a6dd21 100644
--- a/core/array.h
+++ b/core/array.h
@@ -72,6 +72,8 @@ public:
void invert();
int find(const Variant& p_value) const;
+ int find_last(const Variant& p_value) const;
+ int count(const Variant& p_value) const;
void erase(const Variant& p_value);
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index addc26525e..31c0c0e208 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -436,6 +436,15 @@ Error _OS::set_thread_name(const String& p_name) {
return Thread::set_name(p_name);
};
+void _OS::set_use_vsync(bool p_enable) {
+ OS::get_singleton()->set_use_vsync(p_enable);
+}
+
+bool _OS::is_vsnc_enabled() const {
+
+ return OS::get_singleton()->is_vsnc_enabled();
+}
+
/*
enum Weekday {
@@ -1110,6 +1119,8 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name);
+ ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync);
+ ObjectTypeDB::bind_method(_MD("is_vsnc_enabled"),&_OS::is_vsnc_enabled);
BIND_CONSTANT( DAY_SUNDAY );
BIND_CONSTANT( DAY_MONDAY );
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index af89536c45..441927940d 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -282,6 +282,9 @@ public:
Error set_thread_name(const String& p_name);
+ void set_use_vsync(bool p_enable);
+ bool is_vsnc_enabled() const;
+
static _OS *get_singleton() { return singleton; }
_OS();
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index b1e0066c35..409543bf25 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -152,6 +152,23 @@ class CommandQueueMT {
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); }
};
+ template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8>
+ struct Command8 : public CommandBase {
+
+ T*instance;
+ M method;
+ typename GetSimpleTypeT<P1>::type_t p1;
+ typename GetSimpleTypeT<P2>::type_t p2;
+ typename GetSimpleTypeT<P3>::type_t p3;
+ typename GetSimpleTypeT<P4>::type_t p4;
+ typename GetSimpleTypeT<P5>::type_t p5;
+ typename GetSimpleTypeT<P6>::type_t p6;
+ typename GetSimpleTypeT<P7>::type_t p7;
+ typename GetSimpleTypeT<P8>::type_t p8;
+
+ virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); }
+ };
+
/* comands that return */
template<class T,class M,class R>
@@ -270,6 +287,25 @@ class CommandQueueMT {
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
};
+ template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8,class R>
+ struct CommandRet8 : public CommandBase {
+
+ T*instance;
+ M method;
+ typename GetSimpleTypeT<P1>::type_t p1;
+ typename GetSimpleTypeT<P2>::type_t p2;
+ typename GetSimpleTypeT<P3>::type_t p3;
+ typename GetSimpleTypeT<P4>::type_t p4;
+ typename GetSimpleTypeT<P5>::type_t p5;
+ typename GetSimpleTypeT<P6>::type_t p6;
+ typename GetSimpleTypeT<P7>::type_t p7;
+ typename GetSimpleTypeT<P8>::type_t p8;
+ R* ret;
+ SyncSemaphore *sync;
+
+ virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; ; }
+ };
+
/** commands that don't return but sync */
/* comands that return */
@@ -390,6 +426,25 @@ class CommandQueueMT {
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
};
+ template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8>
+ struct CommandSync8 : public CommandBase {
+
+ T*instance;
+ M method;
+ typename GetSimpleTypeT<P1>::type_t p1;
+ typename GetSimpleTypeT<P2>::type_t p2;
+ typename GetSimpleTypeT<P3>::type_t p3;
+ typename GetSimpleTypeT<P4>::type_t p4;
+ typename GetSimpleTypeT<P5>::type_t p5;
+ typename GetSimpleTypeT<P6>::type_t p6;
+ typename GetSimpleTypeT<P7>::type_t p7;
+ typename GetSimpleTypeT<P8>::type_t p8;
+
+ SyncSemaphore *sync;
+
+ virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; ; }
+ };
+
/***** BASE *******/
enum {
@@ -639,6 +694,27 @@ public:
if (sync) sync->post();
}
+
+ template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7,class P8>
+ void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8 ) {
+
+ Command8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> * cmd = allocate_and_lock< Command8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> >();
+
+ cmd->instance=p_instance;
+ cmd->method=p_method;
+ cmd->p1=p1;
+ cmd->p2=p2;
+ cmd->p3=p3;
+ cmd->p4=p4;
+ cmd->p5=p5;
+ cmd->p6=p6;
+ cmd->p7=p7;
+ cmd->p8=p8;
+
+ unlock();
+
+ if (sync) sync->post();
+ }
/*** PUSH AND RET COMMANDS ***/
@@ -806,6 +882,31 @@ public:
ss->sem->wait();
}
+ template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class P7,class P8,class R>
+ void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,P7 p7,P8 p8, R* r_ret ) {
+
+ CommandRet8<T,M,P1,P2,P3,P4,P5,P6,P7,P8,R> * cmd = allocate_and_lock< CommandRet8<T,M,P1,P2,P3,P4,P5,P6,P7,P8,R> >();
+
+ cmd->instance=p_instance;
+ cmd->method=p_method;
+ cmd->p1=p1;
+ cmd->p2=p2;
+ cmd->p3=p3;
+ cmd->p4=p4;
+ cmd->p5=p5;
+ cmd->p6=p6;
+ cmd->p7=p7;
+ cmd->p8=p8;
+ cmd->ret=r_ret;
+ SyncSemaphore *ss=_alloc_sync_sem();
+ cmd->sync=ss;
+
+ unlock();
+
+ if (sync) sync->post();
+ ss->sem->wait();
+ }
+
template<class T, class M>
void push_and_sync( T * p_instance, M p_method) {
@@ -971,6 +1072,31 @@ public:
ss->sem->wait();
}
+ template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class P7,class P8>
+ void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,P7 p7,P8 p8) {
+
+ CommandSync8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> * cmd = allocate_and_lock< CommandSync8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> >();
+
+ cmd->instance=p_instance;
+ cmd->method=p_method;
+ cmd->p1=p1;
+ cmd->p2=p2;
+ cmd->p3=p3;
+ cmd->p4=p4;
+ cmd->p5=p5;
+ cmd->p6=p6;
+ cmd->p7=p7;
+ cmd->p8=p8;
+
+ SyncSemaphore *ss=_alloc_sync_sem();
+ cmd->sync=ss;
+
+ unlock();
+
+ if (sync) sync->post();
+ ss->sem->wait();
+ }
+
void wait_and_flush_one() {
ERR_FAIL_COND(!sync);
sync->wait();
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index 75c8531251..6204a87054 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -199,6 +199,18 @@ Array Dictionary::keys() const {
}
+Array Dictionary::values() const {
+
+ Array varr;
+ varr.resize(size());
+ const Variant *key=NULL;
+ int i=0;
+ while((key=next(key))){
+ varr[i++] = _p->variant_map[*key];
+ }
+ return varr;
+}
+
const Variant* Dictionary::next(const Variant* p_key) const {
return _p->variant_map.next(p_key);
@@ -250,5 +262,3 @@ Dictionary::~Dictionary() {
_unref();
}
-
-
diff --git a/core/dictionary.h b/core/dictionary.h
index c854e95ee6..ae79fab9c3 100644
--- a/core/dictionary.h
+++ b/core/dictionary.h
@@ -81,6 +81,7 @@ public:
const Variant* next(const Variant* p_key=NULL) const;
Array keys() const;
+ Array values() const;
Dictionary(const Dictionary& p_from);
Dictionary(bool p_shared=false);
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 3cf4ff8f83..63764383ff 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -478,7 +478,21 @@ static _GlobalConstant _global_constants[]={
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_STORAGE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_EDITOR ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NETWORK ),
+
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_EDITOR_HELPER ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_CHECKABLE ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_CHECKED ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_INTERNATIONALIZED ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_BUNDLE ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_CATEGORY ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_STORE_IF_NONZERO ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_STORE_IF_NONONE ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NO_INSTANCE_STATE ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_RESTART_IF_CHANGED ),
+
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT_INTL ),
+ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NOEDITOR ),
BIND_GLOBAL_CONSTANT( METHOD_FLAG_NORMAL ),
BIND_GLOBAL_CONSTANT( METHOD_FLAG_EDITOR ),
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 17e98902a1..08ee8138a3 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "input_map.h"
#include "globals.h"
+#include "os/keyboard.h"
InputMap *InputMap::singleton=NULL;
@@ -36,6 +37,7 @@ void InputMap::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has_action","action"),&InputMap::has_action);
ObjectTypeDB::bind_method(_MD("get_action_id","action"),&InputMap::get_action_id);
ObjectTypeDB::bind_method(_MD("get_action_from_id","id"),&InputMap::get_action_from_id);
+ ObjectTypeDB::bind_method(_MD("get_actions"),&InputMap::_get_actions);
ObjectTypeDB::bind_method(_MD("add_action","action"),&InputMap::add_action);
ObjectTypeDB::bind_method(_MD("erase_action","action"),&InputMap::erase_action);
@@ -75,6 +77,35 @@ StringName InputMap::get_action_from_id(int p_id) const {
return input_id_map[p_id];
}
+Array InputMap::_get_actions() {
+
+ Array ret;
+ List<StringName> actions = get_actions();
+ if(actions.empty())
+ return ret;
+
+ for(const List<StringName>::Element *E=actions.front();E;E=E->next()) {
+
+ ret.push_back(E->get());
+ }
+
+ return ret;
+}
+
+List<StringName> InputMap::get_actions() const {
+
+ List<StringName> actions = List<StringName>();
+ if(input_map.empty()){
+ return actions;
+ }
+
+ for (Map<StringName, Action>::Element *E=input_map.front();E;E=E->next()) {
+ actions.push_back(E->key());
+ }
+
+ return actions;
+}
+
List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const {
for (List<InputEvent>::Element *E=p_list.front();E;E=E->next()) {
@@ -291,6 +322,67 @@ void InputMap::load_from_globals() {
}
+void InputMap::load_default() {
+
+ InputEvent key;
+ key.type=InputEvent::KEY;
+
+ add_action("ui_accept");
+ key.key.scancode=KEY_RETURN;
+ action_add_event("ui_accept",key);
+ key.key.scancode=KEY_ENTER;
+ action_add_event("ui_accept",key);
+ key.key.scancode=KEY_SPACE;
+ action_add_event("ui_accept",key);
+
+ add_action("ui_select");
+ key.key.scancode=KEY_SPACE;
+ action_add_event("ui_select",key);
+
+ add_action("ui_cancel");
+ key.key.scancode=KEY_ESCAPE;
+ action_add_event("ui_cancel",key);
+
+ add_action("ui_focus_next");
+ key.key.scancode=KEY_TAB;
+ action_add_event("ui_focus_next",key);
+
+ add_action("ui_focus_prev");
+ key.key.scancode=KEY_TAB;
+ key.key.mod.shift=true;
+ action_add_event("ui_focus_prev",key);
+ key.key.mod.shift=false;
+
+ add_action("ui_left");
+ key.key.scancode=KEY_LEFT;
+ action_add_event("ui_left",key);
+
+ add_action("ui_right");
+ key.key.scancode=KEY_RIGHT;
+ action_add_event("ui_right",key);
+
+ add_action("ui_up");
+ key.key.scancode=KEY_UP;
+ action_add_event("ui_up",key);
+
+ add_action("ui_down");
+ key.key.scancode=KEY_DOWN;
+ action_add_event("ui_down",key);
+
+
+ add_action("ui_page_up");
+ key.key.scancode=KEY_PAGEUP;
+ action_add_event("ui_page_up",key);
+
+ add_action("ui_page_down");
+ key.key.scancode=KEY_PAGEDOWN;
+ action_add_event("ui_page_down",key);
+
+// set("display/orientation", "landscape");
+
+
+}
+
InputMap::InputMap() {
ERR_FAIL_COND(singleton);
diff --git a/core/input_map.h b/core/input_map.h
index 5cd1e41922..dc5a911963 100644
--- a/core/input_map.h
+++ b/core/input_map.h
@@ -47,6 +47,7 @@ class InputMap : public Object {
List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const;
Array _get_action_list(const StringName& p_action);
+ Array _get_actions();
protected:
@@ -59,6 +60,7 @@ public:
bool has_action(const StringName& p_action) const;
int get_action_id(const StringName& p_action) const;
StringName get_action_from_id(int p_id) const;
+ List<StringName> get_actions() const;
void add_action(const StringName& p_action);
void erase_action(const StringName& p_action);
@@ -72,6 +74,7 @@ public:
void load_from_globals();
+ void load_default();
InputMap();
};
diff --git a/core/io/LICENSE-InfoZip.txt b/core/io/LICENSE-InfoZip.txt
new file mode 100644
index 0000000000..bcfe47e978
--- /dev/null
+++ b/core/io/LICENSE-InfoZip.txt
@@ -0,0 +1,60 @@
+This is version 2007-Mar-4 of the Info-ZIP license.
+The definitive version of this document should be available at
+ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and
+a copy at http://www.info-zip.org/pub/infozip/license.html.
+
+
+Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
+
+For the purposes of this copyright and license, "Info-ZIP" is defined as
+the following set of individuals:
+
+ Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
+ Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
+ Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
+ David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
+ Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
+ Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
+ Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
+ Rich Wales, Mike White.
+
+This software is provided "as is," without warranty of any kind, express
+or implied. In no event shall Info-ZIP or its contributors be held liable
+for any direct, indirect, incidental, special or consequential damages
+arising out of the use of or inability to use this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the above disclaimer and the following restrictions:
+
+ 1. Redistributions of source code (in whole or in part) must retain
+ the above copyright notice, definition, disclaimer, and this list
+ of conditions.
+
+ 2. Redistributions in binary form (compiled executables and libraries)
+ must reproduce the above copyright notice, definition, disclaimer,
+ and this list of conditions in documentation and/or other materials
+ provided with the distribution. The sole exception to this condition
+ is redistribution of a standard UnZipSFX binary (including SFXWiz) as
+ part of a self-extracting archive; that is permitted without inclusion
+ of this license, as long as the normal SFX banner has not been removed
+ from the binary or disabled.
+
+ 3. Altered versions--including, but not limited to, ports to new operating
+ systems, existing ports with new graphical interfaces, versions with
+ modified or added functionality, and dynamic, shared, or static library
+ versions not from Info-ZIP--must be plainly marked as such and must not
+ be misrepresented as being the original source or, if binaries,
+ compiled from the original source. Such altered versions also must not
+ be misrepresented as being Info-ZIP releases--including, but not
+ limited to, labeling of the altered versions with the names "Info-ZIP"
+ (or any variation thereof, including, but not limited to, different
+ capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the
+ explicit permission of Info-ZIP. Such altered versions are further
+ prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP
+ e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP
+ will provide support for the altered versions.
+
+ 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip,"
+ "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its
+ own source and binary releases.
diff --git a/core/io/LICENSE-MiniZip.txt b/core/io/LICENSE-MiniZip.txt
new file mode 100644
index 0000000000..0e8950f86f
--- /dev/null
+++ b/core/io/LICENSE-MiniZip.txt
@@ -0,0 +1,32 @@
+Credits
+
+ Gilles Vollant - Original MiniZip author
+ Even Rouault - ZIP64 unzip Support
+ Daniel Borca - BZip Compression method support in unzip
+ Mathias Svensson - ZIP64 zip support
+ Mathias Svensson - BZip Compression method support in zip
+
+ This version has been modified for Godot Engine
+
+
+License
+----------------------------------------------------------------------------
+ Condition of use and distribution are the same than zlib :
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+----------------------------------------------------------------------------
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 11f9536243..3520680118 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -639,7 +639,7 @@ void HTTPClient::_bind_methods() {
ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true));
ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection);
ObjectTypeDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection);
- ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw,DEFVAL(String()));
+ ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw);
ObjectTypeDB::bind_method(_MD("request","method","url","headers","body"),&HTTPClient::request,DEFVAL(String()));
ObjectTypeDB::bind_method(_MD("send_body_text","body"),&HTTPClient::send_body_text);
ObjectTypeDB::bind_method(_MD("send_body_data","body"),&HTTPClient::send_body_data);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index a9cfb1ed73..ceb0273a7d 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -40,7 +40,7 @@ class HTTPClient : public Reference {
OBJ_TYPE(HTTPClient,Reference);
public:
- enum RespondeCode {
+ enum ResponseCode {
// 1xx informational
RESPONSE_CONTINUE = 100,
diff --git a/core/io/ioapi.c b/core/io/ioapi.c
index 8818199f0b..d6063a5fe6 100644
--- a/core/io/ioapi.c
+++ b/core/io/ioapi.c
@@ -6,7 +6,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
*/
diff --git a/core/io/ioapi.h b/core/io/ioapi.h
index 24bf612617..cb6cb7e766 100644
--- a/core/io/ioapi.h
+++ b/core/io/ioapi.h
@@ -5,7 +5,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
Changes
diff --git a/core/io/unzip.c b/core/io/unzip.c
index b438021ad7..78672677f9 100644
--- a/core/io/unzip.c
+++ b/core/io/unzip.c
@@ -10,7 +10,7 @@
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
------------------------------------------------------------------------------------
diff --git a/core/io/unzip.h b/core/io/unzip.h
index cb3d239eac..f67c3b2fa8 100644
--- a/core/io/unzip.h
+++ b/core/io/unzip.h
@@ -10,7 +10,7 @@
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
---------------------------------------------------------------------------------
diff --git a/core/io/zip.c b/core/io/zip.c
index c4ab93ab81..44c79195d9 100644
--- a/core/io/zip.c
+++ b/core/io/zip.c
@@ -7,7 +7,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
Changes
Oct-2009 - Mathias Svensson - Remove old C style function prototypes
diff --git a/core/io/zip.h b/core/io/zip.h
index 85f93568c9..37478b34c0 100644
--- a/core/io/zip.h
+++ b/core/io/zip.h
@@ -6,7 +6,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read MiniZip_info.txt
+ For more info read LICENSE-MiniZip.txt
---------------------------------------------------------------------------
diff --git a/core/object.cpp b/core/object.cpp
index d7878fd623..cbe24a49f3 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1383,6 +1383,31 @@ void Object::get_signal_connection_list(const StringName& p_signal,List<Connecti
}
+bool Object::has_persistent_signal_connections() const {
+
+ const StringName *S=NULL;
+
+ while((S=signal_map.next(S))) {
+
+ const Signal *s=&signal_map[*S];
+
+ for(int i=0;i<s->slot_map.size();i++) {
+
+ if (s->slot_map.getv(i).conn.flags&CONNECT_PERSIST)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void Object::get_signals_connected_to_this(List<Connection> *p_connections) const {
+
+ for (const List<Connection>::Element *E=connections.front();E;E=E->next()) {
+ p_connections->push_back(E->get());
+ }
+}
+
Error Object::connect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method,const Vector<Variant>& p_binds,uint32_t p_flags) {
diff --git a/core/object.h b/core/object.h
index f4a2472e88..ce545a58e8 100644
--- a/core/object.h
+++ b/core/object.h
@@ -604,6 +604,8 @@ public:
void get_signal_list(List<MethodInfo> *p_signals ) const;
void get_signal_connection_list(const StringName& p_signal,List<Connection> *p_connections) const;
void get_all_signal_connections(List<Connection> *p_connections) const;
+ bool has_persistent_signal_connections() const;
+ void get_signals_connected_to_this(List<Connection> *p_connections) const;
Error connect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method,const Vector<Variant>& p_binds=Vector<Variant>(),uint32_t p_flags=0);
void disconnect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method);
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 1aee6d9aa2..e501bc2eb5 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -306,6 +306,15 @@ String OS::get_system_dir(SystemDir p_dir) const {
return ".";
}
+String OS::get_safe_application_name() const {
+ String an = Globals::get_singleton()->get("application/name");
+ Vector<String> invalid_char = String("\\ / : * ? \" < > |").split(" ");
+ for (int i=0;i<invalid_char.size();i++) {
+ an = an.replace(invalid_char[i],"-");
+ }
+ return an;
+}
+
String OS::get_data_dir() const {
return ".";
@@ -530,6 +539,14 @@ String OS::get_joy_guid(int p_device) const {
void OS::set_context(int p_context) {
}
+void OS::set_use_vsync(bool p_enable) {
+
+}
+
+bool OS::is_vsnc_enabled() const{
+
+ return true;
+}
OS::OS() {
last_error=NULL;
@@ -548,6 +565,7 @@ OS::OS() {
_render_thread_mode=RENDER_THREAD_SAFE;
_time_scale=1.0;
_pixel_snap=false;
+ _allow_hidpi=true;
Math::seed(1234567);
}
diff --git a/core/os/os.h b/core/os/os.h
index 5fd2bd6c25..c291d09250 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -60,6 +60,7 @@ class OS {
int _target_fps;
float _time_scale;
bool _pixel_snap;
+ bool _allow_hidpi;
char *last_error;
@@ -325,6 +326,7 @@ public:
virtual String get_locale() const;
+ String get_safe_application_name() const;
virtual String get_data_dir() const;
virtual String get_resource_dir() const;
@@ -418,6 +420,10 @@ public:
virtual void set_context(int p_context);
+ virtual void set_use_vsync(bool p_enable);
+ virtual bool is_vsnc_enabled() const;
+
+ bool is_hidpi_allowed() const { return _allow_hidpi; }
OS();
virtual ~OS();
diff --git a/core/resource.cpp b/core/resource.cpp
index b7a5bad4b8..97dee3e1d7 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -133,6 +133,7 @@ void ResourceImportMetadata::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, "");
ObjectTypeDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path);
ObjectTypeDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5);
+ ObjectTypeDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5);
ObjectTypeDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source);
ObjectTypeDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count);
ObjectTypeDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option);
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 011b1f78a0..99d1e22c07 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -291,6 +291,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) {
_set_object_property(cmd[1],cmd[2],cmd[3]);
+ } else if (command=="reload_scripts") {
+ reload_all_scripts=true;
} else if (command=="breakpoint") {
bool set = cmd[3];
@@ -698,7 +700,8 @@ void ScriptDebuggerRemote::_poll_events() {
profiling=false;
_send_profiling_data(false);
print_line("PROFILING END!");
-
+ } else if (command=="reload_scripts") {
+ reload_all_scripts=true;
} else if (command=="breakpoint") {
bool set = cmd[3];
@@ -863,6 +866,14 @@ void ScriptDebuggerRemote::idle_poll() {
}
}
+ if (reload_all_scripts) {
+
+ for(int i=0;i<ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->reload_all_scripts();
+ }
+ reload_all_scripts=false;
+ }
+
_poll_events();
}
@@ -1012,6 +1023,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() {
profile_info_ptrs.resize(profile_info.size());
profiling=false;
max_frame_functions=16;
+ reload_all_scripts=false;
}
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index 8fdab47013..c6a00e189f 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -60,6 +60,7 @@ class ScriptDebuggerRemote : public ScriptDebugger {
bool profiling;
int max_frame_functions;
bool skip_profile_frame;
+ bool reload_all_scripts;
Ref<StreamPeerTCP> tcp_client;
@@ -168,6 +169,7 @@ public:
virtual void profiling_end();
virtual void profiling_set_frame_times(float p_frame_time,float p_idle_time,float p_fixed_time,float p_fixed_frame_time);
+
ScriptDebuggerRemote();
~ScriptDebuggerRemote();
};
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 1503418269..b3116a0297 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -51,7 +51,7 @@ void Script::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has_source_code"),&Script::has_source_code);
ObjectTypeDB::bind_method(_MD("get_source_code"),&Script::get_source_code);
ObjectTypeDB::bind_method(_MD("set_source_code","source"),&Script::set_source_code);
- ObjectTypeDB::bind_method(_MD("reload"),&Script::reload);
+ ObjectTypeDB::bind_method(_MD("reload","keep_state"),&Script::reload,DEFVAL(false));
}
diff --git a/core/script_language.h b/core/script_language.h
index bd76107acf..d8b4c61b6c 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -87,7 +87,7 @@ public:
virtual bool has_source_code() const=0;
virtual String get_source_code() const=0;
virtual void set_source_code(const String& p_code)=0;
- virtual Error reload()=0;
+ virtual Error reload(bool p_keep_state=false)=0;
virtual bool is_tool() const=0;
@@ -127,6 +127,8 @@ public:
virtual Ref<Script> get_script() const=0;
+ virtual bool is_placeholder() const { return false; }
+
virtual ScriptLanguage *get_language()=0;
virtual ~ScriptInstance();
};
@@ -189,6 +191,7 @@ public:
virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); }
+ virtual void reload_all_scripts()=0;
/* LOADER FUNCTIONS */
virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
@@ -248,6 +251,8 @@ public:
void update(const List<PropertyInfo> &p_properties,const Map<StringName,Variant>& p_values); //likely changed in editor
+ virtual bool is_placeholder() const { return true; }
+
PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script,Object *p_owner);
~PlaceHolderScriptInstance();
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 4be763a511..eb3ab65f40 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -262,7 +262,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(String,basename);
VCALL_LOCALMEM1R(String,plus_file);
VCALL_LOCALMEM1R(String,ord_at);
- //VCALL_LOCALMEM2R(String,erase);
+ VCALL_LOCALMEM2(String,erase);
VCALL_LOCALMEM0R(String,hash);
VCALL_LOCALMEM0R(String,md5_text);
VCALL_LOCALMEM0R(String,md5_buffer);
@@ -339,6 +339,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM1R(Vector2,reflect);
VCALL_LOCALMEM0R(Vector2,angle);
// VCALL_LOCALMEM1R(Vector2,cross);
+ VCALL_LOCALMEM0R(Vector2,abs);
VCALL_LOCALMEM0R(Rect2,get_area);
VCALL_LOCALMEM1R(Rect2,intersects);
@@ -445,6 +446,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM1(Dictionary,erase);
VCALL_LOCALMEM0R(Dictionary,hash);
VCALL_LOCALMEM0R(Dictionary,keys);
+ VCALL_LOCALMEM0R(Dictionary,values);
VCALL_LOCALMEM1R(Dictionary,parse_json);
VCALL_LOCALMEM0R(Dictionary,to_json);
@@ -463,6 +465,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM2(Array,insert);
VCALL_LOCALMEM1(Array,remove);
VCALL_LOCALMEM1R(Array,find);
+ VCALL_LOCALMEM1R(Array,find_last);
+ VCALL_LOCALMEM1R(Array,count);
VCALL_LOCALMEM1(Array,erase);
VCALL_LOCALMEM0(Array,sort);
VCALL_LOCALMEM2(Array,sort_custom);
@@ -1282,7 +1286,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(STRING,STRING,String,basename,varray());
ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray());
ADDFUNC1(STRING,STRING,String,ord_at,INT,"at",varray());
-// ADDFUNC2(STRING,String,erase,INT,INT,varray());
+ ADDFUNC2(STRING,NIL,String,erase,INT,"pos",INT,"chars", varray());
ADDFUNC0(STRING,INT,String,hash,varray());
ADDFUNC0(STRING,STRING,String,md5_text,varray());
ADDFUNC0(STRING,RAW_ARRAY,String,md5_buffer,varray());
@@ -1333,6 +1337,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC1(VECTOR2,VECTOR2,Vector2,slide,VECTOR2,"vec",varray());
ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray());
//ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
+ ADDFUNC0(VECTOR2,VECTOR2,Vector2,abs,varray());
ADDFUNC0(RECT2,REAL,Rect2,get_area,varray());
ADDFUNC1(RECT2,BOOL,Rect2,intersects,RECT2,"b",varray());
@@ -1432,6 +1437,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC1(DICTIONARY,NIL,Dictionary,erase,NIL,"value",varray());
ADDFUNC0(DICTIONARY,INT,Dictionary,hash,varray());
ADDFUNC0(DICTIONARY,ARRAY,Dictionary,keys,varray());
+ ADDFUNC0(DICTIONARY,ARRAY,Dictionary,values,varray());
ADDFUNC1(DICTIONARY,INT,Dictionary,parse_json,STRING,"json",varray());
ADDFUNC0(DICTIONARY,STRING,Dictionary,to_json,varray());
@@ -1448,6 +1454,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC1(ARRAY,NIL,Array,remove,INT,"pos",varray());
ADDFUNC1(ARRAY,NIL,Array,erase,NIL,"value",varray());
ADDFUNC1(ARRAY,INT,Array,find,NIL,"value",varray());
+ ADDFUNC1(ARRAY,INT,Array,find_last,NIL,"value",varray());
+ ADDFUNC1(ARRAY,INT,Array,count,NIL,"value",varray());
ADDFUNC0(ARRAY,NIL,Array,pop_back,varray());
ADDFUNC0(ARRAY,NIL,Array,pop_front,varray());
ADDFUNC0(ARRAY,NIL,Array,sort,varray());
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index a9cc37168d..6065094da7 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1354,7 +1354,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
return;
} else if (*str=="r8" ) {
valid=true;
- v->g=float(p_value)/255.0;
+ v->r=float(p_value)/255.0;
return;
} else if (*str=="g8" ) {
valid=true;
@@ -2213,16 +2213,16 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
return v->get_v();
} else if (*str=="r8") {
valid=true;
- return v->r*255.0;
+ return (int)Math::round(v->r*255.0);
} else if (*str=="g8" ) {
valid=true;
- return v->g*255.0;
+ return (int)Math::round(v->g*255.0);
} else if (*str=="b8" ) {
valid=true;
- return v->b*255.0;
+ return (int)Math::round(v->b*255.0);
} else if (*str=="a8" ) {
valid=true;
- return v->a*255.0;
+ return (int)Math::round(v->a*255.0);
}
} else if (p_index.get_type()==Variant::INT) {
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 8bd1fddfad..e2786b8099 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -2011,7 +2011,44 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
} break;
case Variant::INPUT_EVENT: {
- p_store_string_func(p_store_string_ud,"InputEvent()"); //will be added later
+ String str="InputEvent(";
+
+ InputEvent ev=p_variant;
+ switch(ev.type) {
+ case InputEvent::KEY: {
+
+ str+="KEY,"+itos(ev.key.scancode);
+ String mod;
+ if (ev.key.mod.alt)
+ mod+="A";
+ if (ev.key.mod.shift)
+ mod+="S";
+ if (ev.key.mod.control)
+ mod+="C";
+ if (ev.key.mod.meta)
+ mod+="M";
+
+ if (mod!=String())
+ str+=","+mod;
+ } break;
+ case InputEvent::MOUSE_BUTTON: {
+
+ str+="MBUTTON,"+itos(ev.mouse_button.button_index);
+ } break;
+ case InputEvent::JOYSTICK_BUTTON: {
+ str+="JBUTTON,"+itos(ev.joy_button.button_index);
+
+ } break;
+ case InputEvent::JOYSTICK_MOTION: {
+ str+="JAXIS,"+itos(ev.joy_motion.axis)+","+itos(ev.joy_motion.axis_value);
+ } break;
+ default: {}
+ }
+
+ str+=")";
+
+ p_store_string_func(p_store_string_ud,str); //will be added later
+
} break;
case Variant::DICTIONARY: {