Merge remote-tracking branch 'upstream/master'

This commit is contained in:
marcelofg55 2016-06-02 18:56:28 -03:00
commit 4e0f2389c3
58 changed files with 39205 additions and 32208 deletions

2
.gitignore vendored
View file

@ -21,7 +21,6 @@ tools/editor/certs_compressed.h
tools/editor/editor_icons.cpp
tools/editor/translations.h
tools/editor/builtin_fonts.h
-fpic
.fscache
make.bat
log.txt
@ -33,6 +32,7 @@ doc/_build/
*.bc
# Android specific
platform/android/java/build.gradle
platform/android/java/.gradle
platform/android/java/.gradletasknamecache
platform/android/java/local.properties

View file

@ -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);

View file

@ -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;
}

View file

@ -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();
};

View file

@ -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));
}

View file

@ -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();

View file

@ -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) {

View file

@ -10,7 +10,7 @@ var speed_y = 0.0
var destroyed = false
func _process(delta):
func _fixed_process(delta):
translate(Vector2(SPEED, speed_y)*delta)
@ -23,7 +23,7 @@ func destroy():
return
destroyed = true
get_node("anim").play("explode")
set_process(false)
set_fixed_process(false)
get_node("sfx").play("sound_explode")
# Accumulate points
get_node("/root/game_state").points += 1
@ -34,7 +34,7 @@ func is_enemy():
func _on_visibility_enter_screen():
set_process(true)
set_fixed_process(true)
# Make it spin!
get_node("anim").play("spin")

View file

@ -7,7 +7,7 @@ const SPEED = -200
var destroyed=false
func _process(delta):
func _fixed_process(delta):
get_parent().translate(Vector2(SPEED*delta, 0))
@ -20,14 +20,14 @@ func destroy():
return
destroyed = true
get_node("anim").play("explode")
set_process(false)
set_fixed_process(false)
get_node("sfx").play("sound_explode")
# Accumulate points
get_node("/root/game_state").points += 5
func _on_visibility_enter_screen():
set_process(true)
set_fixed_process(true)
get_node("anim").play("zigzag")
get_node("anim").seek(randf()*2.0) # Make it start from any pos

View file

@ -9,7 +9,7 @@ var shoot_timeout = 0
var destroyed=false
func _process(delta):
func _fixed_process(delta):
translate(Vector2(SPEED*delta, 0))
shoot_timeout -= delta
@ -33,18 +33,14 @@ func destroy():
return
destroyed = true
get_node("anim").play("explode")
set_process(false)
set_fixed_process(false)
get_node("sfx").play("sound_explode")
# Accumulate points
get_node("/root/game_state").points += 10
func _ready():
set_fixed_process(true)
func _on_visibility_enter_screen():
set_process(true)
set_fixed_process(true)
func _on_visibility_exit_screen():

View file

@ -7,13 +7,13 @@ var offset = 0
func stop():
set_process(false)
set_fixed_process(false)
func _process(delta):
func _fixed_process(delta):
offset += delta*SPEED
set_pos(Vector2(offset, 0))
func _ready():
set_process(true)
set_fixed_process(true)

View file

@ -9,7 +9,7 @@ var prev_shooting = false
var killed = false
func _process(delta):
func _fixed_process(delta):
var motion = Vector2()
if Input.is_action_pressed("move_up"):
motion += Vector2(0, -1)
@ -53,7 +53,7 @@ func _process(delta):
func _ready():
screen_size = get_viewport().get_rect().size
set_process(true)
set_fixed_process(true)
func _hit_something():

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_26 Your_png_h_is_not_version_1_5_26;
typedef png_libpng_version_1_5_27 Your_png_h_is_not_version_1_5_27;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@ -655,15 +655,15 @@ png_get_copyright(png_const_structp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.5.26 - December 17, 2015" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson" \
"libpng version 1.5.27 - May 26, 2016" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.5.26 - December 17, 2015\
Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson\
return "libpng version 1.5.27 - May 26, 2016\
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
# endif

View file

@ -1,9 +1,9 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.26, December 17, 2015
* libpng version 1.5.27, May 26, 2016
*
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@ -12,7 +12,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.26, December 17, 2015:
* libpng versions 0.97, January 1998, through 1.5.27, May 26, 2016:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@ -25,8 +25,8 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.0.7, July 1, 2000, through 1.5.26, December 17, 2015, are
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
* libpng versions 1.0.7, July 1, 2000, through 1.5.27, May 26, 2016, are
* Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
* derived from libpng-1.0.6, and are distributed according to the same
* disclaimer and license as libpng-1.0.6 with the following individuals
* added to the list of Contributing Authors:
@ -108,6 +108,29 @@
* appreciated.
*
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
*
* TRADEMARK:
*
* The name "libpng" has not been registered by the Copyright owner
* as a trademark in any jurisdiction. However, because libpng has
* been distributed and maintained world-wide, continually since 1995,
* the Copyright owner claims "common-law trademark protection" in any
* jurisdiction where common-law trademark is recognized.
*
* OSI CERTIFICATION:
*
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
* a certification mark of the Open Source Initiative. OSI has not addressed
* the additional disclaimers inserted at version 1.0.7.
*
* EXPORT CONTROL:
*
* The Copyright owner believes that the Export Control Classification
* Number (ECCN) for libpng is EAR99, which means not subject to export
* controls or International Traffic in Arms Regulations (ITAR) because
* it is open source, publicly available software, that does not contain
* any encryption software. See the EAR, paragraphs 734.3(b)(3) and
* 734.7(b).
*/
/*
@ -120,12 +143,6 @@
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
*/
/*
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
* a certification mark of the Open Source Initiative. OSI has not addressed
* the additional disclaimers inserted at version 1.0.7.
*/
/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
@ -181,9 +198,9 @@
* ...
* 1.0.19 10 10019 10.so.0.19[.0]
* ...
* 1.2.53 13 10253 12.so.0.53[.0]
* 1.2.56 13 10256 12.so.0.56[.0]
* ...
* 1.5.25 15 10525 15.so.15.25[.0]
* 1.5.27 15 10527 15.so.15.27[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -211,13 +228,13 @@
* Y2K compliance in libpng:
* =========================
*
* December 17, 2015
* May 26, 2016
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.5.26 are Y2K compliant. It is my belief that
* upward through 1.5.27 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@ -278,9 +295,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.26"
#define PNG_LIBPNG_VER_STRING "1.5.27"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.26 - December 17, 2015\n"
" libpng version 1.5.27 - May 26, 2016\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@ -288,7 +305,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 5
#define PNG_LIBPNG_VER_RELEASE 26
#define PNG_LIBPNG_VER_RELEASE 27
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@ -319,7 +336,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
#define PNG_LIBPNG_VER 10526 /* 1.5.26 */
#define PNG_LIBPNG_VER 10527 /* 1.5.27 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@ -441,7 +458,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_5_26;
typedef char* png_libpng_version_1_5_27;
/* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to
@ -705,22 +722,22 @@ typedef png_info FAR * FAR * png_infopp;
* data in the info_struct to be written into the output file. The values
* of the PNG_INFO_<chunk> defines should NOT be changed.
*/
#define PNG_INFO_gAMA 0x0001
#define PNG_INFO_sBIT 0x0002
#define PNG_INFO_cHRM 0x0004
#define PNG_INFO_PLTE 0x0008
#define PNG_INFO_tRNS 0x0010
#define PNG_INFO_bKGD 0x0020
#define PNG_INFO_hIST 0x0040
#define PNG_INFO_pHYs 0x0080
#define PNG_INFO_oFFs 0x0100
#define PNG_INFO_tIME 0x0200
#define PNG_INFO_pCAL 0x0400
#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
#define PNG_INFO_gAMA 0x0001U
#define PNG_INFO_sBIT 0x0002U
#define PNG_INFO_cHRM 0x0004U
#define PNG_INFO_PLTE 0x0008U
#define PNG_INFO_tRNS 0x0010U
#define PNG_INFO_bKGD 0x0020U
#define PNG_INFO_hIST 0x0040U
#define PNG_INFO_pHYs 0x0080U
#define PNG_INFO_oFFs 0x0100U
#define PNG_INFO_tIME 0x0200U
#define PNG_INFO_pCAL 0x0400U
#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */
#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@ -1365,7 +1382,7 @@ PNG_EXPORT(229, void, png_set_scale_16, (png_structp png_ptr));
#endif
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
/* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
#endif
@ -1517,8 +1534,8 @@ PNG_EXPORT(67, void, png_set_filter,
#define PNG_FILTER_UP 0x20
#define PNG_FILTER_AVG 0x40
#define PNG_FILTER_PAETH 0x80
#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
PNG_FILTER_AVG | PNG_FILTER_PAETH)
#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
* These defines should NOT be changed.

View file

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.26, December 17, 2015
* libpng version 1.5.27, May 26, 2016
*
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View file

@ -1,9 +1,9 @@
/* 1.5.26 STANDARD API DEFINITION */
/* 1.5.27 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* libpng version 1.5.26 - December 17, 2015 */
/* libpng version 1.5.27 - May 26, 2016 */
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
/* Copyright (c) 2011-2015 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */

View file

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.5.25 [December 17, 2015]
* Last changed in libpng 1.5.25 [December 3, 2015]
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View file

@ -1414,8 +1414,13 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDParser::ClassNode *p_class) {
Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDParser::ClassNode *p_class, bool p_keep_state) {
Map<StringName,Ref<GDScript> > old_subclasses;
if (p_keep_state) {
old_subclasses=p_script->subclasses;
}
p_script->native=Ref<GDNativeClass>();
p_script->base=Ref<GDScript>();
@ -1429,6 +1434,7 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
p_script->member_indices.clear();
p_script->member_info.clear();
p_script->initializer=NULL;
p_script->subclasses.clear();
p_script->_owner=p_owner;
p_script->tool=p_class->tool;
@ -1662,9 +1668,15 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
for(int i=0;i<p_class->subclasses.size();i++) {
StringName name = p_class->subclasses[i]->name;
Ref<GDScript> subclass = memnew( GDScript );
Ref<GDScript> subclass;
Error err = _parse_class(subclass.ptr(),p_script,p_class->subclasses[i]);
if (old_subclasses.has(name)) {
subclass=old_subclasses[name];
} else {
subclass.instance();
}
Error err = _parse_class(subclass.ptr(),p_script,p_class->subclasses[i],p_keep_state);
if (err)
return err;
@ -1755,13 +1767,67 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
}
}
//validate instances if keeping state
if (p_keep_state) {
print_line("RELOAD KEEP "+p_script->path);
for (Set<Object*>::Element *E=p_script->instances.front();E;) {
Set<Object*>::Element *N = E->next();
ScriptInstance *si = E->get()->get_script_instance();
if (si->is_placeholder()) {
#ifdef TOOLS_ENABLED
PlaceHolderScriptInstance *psi = static_cast<PlaceHolderScriptInstance*>(si);
if (p_script->is_tool()) {
//re-create as an instance
p_script->placeholders.erase(psi); //remove placeholder
GDInstance* instance = memnew( GDInstance );
instance->base_ref=E->get()->cast_to<Reference>();
instance->members.resize(p_script->member_indices.size());
instance->script=Ref<GDScript>(p_script);
instance->owner=E->get();
//needed for hot reloading
for(Map<StringName,GDScript::MemberInfo>::Element *E=p_script->member_indices.front();E;E=E->next()) {
instance->member_indices_cache[E->key()]=E->get().index;
}
instance->owner->set_script_instance(instance);
/* STEP 2, INITIALIZE AND CONSRTUCT */
Variant::CallError ce;
p_script->initializer->call(instance,NULL,0,ce);
if (ce.error!=Variant::CallError::CALL_OK) {
//well, tough luck, not goinna do anything here
}
}
#endif
} else {
GDInstance *gi = static_cast<GDInstance*>(si);
gi->reload_members();
}
E=N;
}
}
#endif
p_script->valid=true;
return OK;
}
Error GDCompiler::compile(const GDParser *p_parser,GDScript *p_script) {
Error GDCompiler::compile(const GDParser *p_parser,GDScript *p_script,bool p_keep_state) {
err_line=-1;
err_column=-1;
@ -1772,9 +1838,7 @@ Error GDCompiler::compile(const GDParser *p_parser,GDScript *p_script) {
source=p_script->get_path();
Error err = _parse_class(p_script,NULL,static_cast<const GDParser::ClassNode*>(root));
Error err = _parse_class(p_script,NULL,static_cast<const GDParser::ClassNode*>(root),p_keep_state);
if (err)
return err;

View file

@ -144,7 +144,7 @@ class GDCompiler {
int _parse_expression(CodeGen& codegen,const GDParser::Node *p_expression, int p_stack_level,bool p_root=false,bool p_initializer=false);
Error _parse_block(CodeGen& codegen,const GDParser::BlockNode *p_block,int p_stack_level=0,int p_break_addr=-1,int p_continue_addr=-1);
Error _parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func,bool p_for_ready=false);
Error _parse_class(GDScript *p_script,GDScript *p_owner,const GDParser::ClassNode *p_class);
Error _parse_class(GDScript *p_script,GDScript *p_owner,const GDParser::ClassNode *p_class,bool p_keep_state);
int err_line;
int err_column;
StringName source;
@ -152,7 +152,7 @@ class GDCompiler {
public:
Error compile(const GDParser *p_parser,GDScript *p_script);
Error compile(const GDParser *p_parser, GDScript *p_script, bool p_keep_state=false);
String get_error() const;
int get_error_line() const;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,207 @@
#ifndef GD_FUNCTION_H
#define GD_FUNCTION_H
#include "self_list.h"
#include "os/thread.h"
#include "pair.h"
#include "variant.h"
#include "string_db.h"
#include "reference.h"
class GDInstance;
class GDScript;
class GDFunction {
public:
enum Opcode {
OPCODE_OPERATOR,
OPCODE_EXTENDS_TEST,
OPCODE_SET,
OPCODE_GET,
OPCODE_SET_NAMED,
OPCODE_GET_NAMED,
OPCODE_ASSIGN,
OPCODE_ASSIGN_TRUE,
OPCODE_ASSIGN_FALSE,
OPCODE_CONSTRUCT, //only for basic types!!
OPCODE_CONSTRUCT_ARRAY,
OPCODE_CONSTRUCT_DICTIONARY,
OPCODE_CALL,
OPCODE_CALL_RETURN,
OPCODE_CALL_BUILT_IN,
OPCODE_CALL_SELF,
OPCODE_CALL_SELF_BASE,
OPCODE_YIELD,
OPCODE_YIELD_SIGNAL,
OPCODE_YIELD_RESUME,
OPCODE_JUMP,
OPCODE_JUMP_IF,
OPCODE_JUMP_IF_NOT,
OPCODE_JUMP_TO_DEF_ARGUMENT,
OPCODE_RETURN,
OPCODE_ITERATE_BEGIN,
OPCODE_ITERATE,
OPCODE_ASSERT,
OPCODE_BREAKPOINT,
OPCODE_LINE,
OPCODE_END
};
enum Address {
ADDR_BITS=24,
ADDR_MASK=((1<<ADDR_BITS)-1),
ADDR_TYPE_MASK=~ADDR_MASK,
ADDR_TYPE_SELF=0,
ADDR_TYPE_CLASS=1,
ADDR_TYPE_MEMBER=2,
ADDR_TYPE_CLASS_CONSTANT=3,
ADDR_TYPE_LOCAL_CONSTANT=4,
ADDR_TYPE_STACK=5,
ADDR_TYPE_STACK_VARIABLE=6,
ADDR_TYPE_GLOBAL=7,
ADDR_TYPE_NIL=8
};
struct StackDebug {
int line;
int pos;
bool added;
StringName identifier;
};
private:
friend class GDCompiler;
StringName source;
mutable Variant nil;
mutable Variant *_constants_ptr;
int _constant_count;
const StringName *_global_names_ptr;
int _global_names_count;
const int *_default_arg_ptr;
int _default_arg_count;
const int *_code_ptr;
int _code_size;
int _argument_count;
int _stack_size;
int _call_size;
int _initial_line;
bool _static;
GDScript *_script;
StringName name;
Vector<Variant> constants;
Vector<StringName> global_names;
Vector<int> default_arguments;
Vector<int> code;
#ifdef TOOLS_ENABLED
Vector<StringName> arg_names;
#endif
List<StackDebug> stack_debug;
_FORCE_INLINE_ Variant *_get_variant(int p_address,GDInstance *p_instance,GDScript *p_script,Variant &self,Variant *p_stack,String& r_error) const;
_FORCE_INLINE_ String _get_call_error(const Variant::CallError& p_err, const String& p_where,const Variant**argptrs) const;
friend class GDScriptLanguage;
SelfList<GDFunction> function_list;
#ifdef DEBUG_ENABLED
CharString func_cname;
const char*_func_cname;
struct Profile {
StringName signature;
uint64_t call_count;
uint64_t self_time;
uint64_t total_time;
uint64_t frame_call_count;
uint64_t frame_self_time;
uint64_t frame_total_time;
uint64_t last_frame_call_count;
uint64_t last_frame_self_time;
uint64_t last_frame_total_time;
} profile;
#endif
public:
struct CallState {
GDInstance *instance;
Vector<uint8_t> stack;
int stack_size;
Variant self;
uint32_t alloca_size;
GDScript *_class;
int ip;
int line;
int defarg;
Variant result;
};
_FORCE_INLINE_ bool is_static() const { return _static; }
const int* get_code() const; //used for debug
int get_code_size() const;
Variant get_constant(int p_idx) const;
StringName get_global_name(int p_idx) const;
StringName get_name() const;
int get_max_stack_size() const;
int get_default_argument_count() const;
int get_default_argument_addr(int p_idx) const;
GDScript *get_script() const { return _script; }
void debug_get_stack_member_state(int p_line,List<Pair<StringName,int> > *r_stackvars) const;
_FORCE_INLINE_ bool is_empty() const { return _code_size==0; }
int get_argument_count() const { return _argument_count; }
StringName get_argument_name(int p_idx) const {
#ifdef TOOLS_ENABLED
ERR_FAIL_INDEX_V(p_idx,arg_names.size(),StringName());
return arg_names[p_idx];
#endif
return StringName();
}
Variant get_default_argument(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx,default_arguments.size(),Variant());
return default_arguments[p_idx];
}
Variant call(GDInstance *p_instance,const Variant **p_args, int p_argcount,Variant::CallError& r_err,CallState *p_state=NULL);
GDFunction();
~GDFunction();
};
class GDFunctionState : public Reference {
OBJ_TYPE(GDFunctionState,Reference);
friend class GDFunction;
GDFunction *function;
GDFunction::CallState state;
Variant _signal_callback(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
protected:
static void _bind_methods();
public:
bool is_valid() const;
Variant resume(const Variant& p_arg=Variant());
GDFunctionState();
~GDFunctionState();
};
#endif // GD_FUNCTION_H

File diff suppressed because it is too large Load diff

View file

@ -32,207 +32,7 @@
#include "script_language.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/thread.h"
#include "pair.h"
#include "self_list.h"
class GDInstance;
class GDScript;
class GDFunction {
public:
enum Opcode {
OPCODE_OPERATOR,
OPCODE_EXTENDS_TEST,
OPCODE_SET,
OPCODE_GET,
OPCODE_SET_NAMED,
OPCODE_GET_NAMED,
OPCODE_ASSIGN,
OPCODE_ASSIGN_TRUE,
OPCODE_ASSIGN_FALSE,
OPCODE_CONSTRUCT, //only for basic types!!
OPCODE_CONSTRUCT_ARRAY,
OPCODE_CONSTRUCT_DICTIONARY,
OPCODE_CALL,
OPCODE_CALL_RETURN,
OPCODE_CALL_BUILT_IN,
OPCODE_CALL_SELF,
OPCODE_CALL_SELF_BASE,
OPCODE_YIELD,
OPCODE_YIELD_SIGNAL,
OPCODE_YIELD_RESUME,
OPCODE_JUMP,
OPCODE_JUMP_IF,
OPCODE_JUMP_IF_NOT,
OPCODE_JUMP_TO_DEF_ARGUMENT,
OPCODE_RETURN,
OPCODE_ITERATE_BEGIN,
OPCODE_ITERATE,
OPCODE_ASSERT,
OPCODE_BREAKPOINT,
OPCODE_LINE,
OPCODE_END
};
enum Address {
ADDR_BITS=24,
ADDR_MASK=((1<<ADDR_BITS)-1),
ADDR_TYPE_MASK=~ADDR_MASK,
ADDR_TYPE_SELF=0,
ADDR_TYPE_CLASS=1,
ADDR_TYPE_MEMBER=2,
ADDR_TYPE_CLASS_CONSTANT=3,
ADDR_TYPE_LOCAL_CONSTANT=4,
ADDR_TYPE_STACK=5,
ADDR_TYPE_STACK_VARIABLE=6,
ADDR_TYPE_GLOBAL=7,
ADDR_TYPE_NIL=8
};
struct StackDebug {
int line;
int pos;
bool added;
StringName identifier;
};
private:
friend class GDCompiler;
StringName source;
mutable Variant nil;
mutable Variant *_constants_ptr;
int _constant_count;
const StringName *_global_names_ptr;
int _global_names_count;
const int *_default_arg_ptr;
int _default_arg_count;
const int *_code_ptr;
int _code_size;
int _argument_count;
int _stack_size;
int _call_size;
int _initial_line;
bool _static;
GDScript *_script;
StringName name;
Vector<Variant> constants;
Vector<StringName> global_names;
Vector<int> default_arguments;
Vector<int> code;
#ifdef TOOLS_ENABLED
Vector<StringName> arg_names;
#endif
List<StackDebug> stack_debug;
_FORCE_INLINE_ Variant *_get_variant(int p_address,GDInstance *p_instance,GDScript *p_script,Variant &self,Variant *p_stack,String& r_error) const;
_FORCE_INLINE_ String _get_call_error(const Variant::CallError& p_err, const String& p_where,const Variant**argptrs) const;
friend class GDScriptLanguage;
SelfList<GDFunction> function_list;
#ifdef DEBUG_ENABLED
CharString func_cname;
const char*_func_cname;
struct Profile {
StringName signature;
uint64_t call_count;
uint64_t self_time;
uint64_t total_time;
uint64_t frame_call_count;
uint64_t frame_self_time;
uint64_t frame_total_time;
uint64_t last_frame_call_count;
uint64_t last_frame_self_time;
uint64_t last_frame_total_time;
} profile;
#endif
public:
struct CallState {
GDInstance *instance;
Vector<uint8_t> stack;
int stack_size;
Variant self;
uint32_t alloca_size;
GDScript *_class;
int ip;
int line;
int defarg;
Variant result;
};
_FORCE_INLINE_ bool is_static() const { return _static; }
const int* get_code() const; //used for debug
int get_code_size() const;
Variant get_constant(int p_idx) const;
StringName get_global_name(int p_idx) const;
StringName get_name() const;
int get_max_stack_size() const;
int get_default_argument_count() const;
int get_default_argument_addr(int p_idx) const;
GDScript *get_script() const { return _script; }
void debug_get_stack_member_state(int p_line,List<Pair<StringName,int> > *r_stackvars) const;
_FORCE_INLINE_ bool is_empty() const { return _code_size==0; }
int get_argument_count() const { return _argument_count; }
StringName get_argument_name(int p_idx) const {
#ifdef TOOLS_ENABLED
ERR_FAIL_INDEX_V(p_idx,arg_names.size(),StringName());
return arg_names[p_idx];
#endif
return StringName();
}
Variant get_default_argument(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx,default_arguments.size(),Variant());
return default_arguments[p_idx];
}
Variant call(GDInstance *p_instance,const Variant **p_args, int p_argcount,Variant::CallError& r_err,CallState *p_state=NULL);
GDFunction();
~GDFunction();
};
class GDFunctionState : public Reference {
OBJ_TYPE(GDFunctionState,Reference);
friend class GDFunction;
GDFunction *function;
GDFunction::CallState state;
Variant _signal_callback(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
protected:
static void _bind_methods();
public:
bool is_valid() const;
Variant resume(const Variant& p_arg=Variant());
GDFunctionState();
~GDFunctionState();
};
#include "gd_function.h"
class GDNativeClass : public Reference {
OBJ_TYPE(GDNativeClass,Reference);
@ -307,6 +107,7 @@ friend class GDScriptLanguage;
String source;
String path;
String name;
SelfList<GDScript> script_list;
GDInstance* _create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref,Variant::CallError &r_error);
@ -365,7 +166,7 @@ public:
virtual void set_source_code(const String& p_code);
virtual void update_exports();
virtual Error reload();
virtual Error reload(bool p_keep_state=false);
virtual String get_node_type() const;
void set_script_path(const String& p_path) { path=p_path; } //because subclasses need a path too...
@ -386,9 +187,13 @@ class GDInstance : public ScriptInstance {
friend class GDScript;
friend class GDFunction;
friend class GDFunctions;
friend class GDCompiler;
Object *owner;
Ref<GDScript> script;
#ifdef DEBUG_ENABLED
Map<StringName,int> member_indices_cache; //used only for hot script reloading
#endif
Vector<Variant> members;
bool base_ref;
@ -409,7 +214,7 @@ public:
virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount);
Variant debug_get_member_by_index(int p_idx) const { return members[p_idx]; }
Variant debug_get_member_by_index(int p_idx) const { return members[p_idx]; }
virtual void notification(int p_notification);
@ -419,6 +224,7 @@ public:
void set_path(const String& p_path);
void reload_members();
GDInstance();
~GDInstance();
@ -456,6 +262,10 @@ class GDScriptLanguage : public ScriptLanguage {
Mutex *lock;
friend class GDScript;
SelfList<GDScript>::List script_list;
friend class GDFunction;
SelfList<GDFunction>::List function_list;
@ -578,6 +388,8 @@ public:
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);
virtual void reload_all_scripts();
virtual void frame();
virtual void get_public_functions(List<MethodInfo> *p_functions) const;

View file

@ -168,11 +168,11 @@ def configure(env):
env['neon_enabled']=False
if env['android_arch']=='x86':
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
elif env["android_arch"]=="armv6":
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
elif env["android_arch"]=="armv7":
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
if env['android_neon']=='yes':
env['neon_enabled']=True
env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__'])

View file

@ -291,16 +291,52 @@ static int button_mask=0;
self = [super init];
trackingArea = nil;
[self updateTrackingAreas];
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
return self;
}
-(void)dealloc
{
[trackingArea release];
[super dealloc];
}
- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender {
return NSDragOperationCopy;
}
- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender {
return NSDragOperationCopy;
}
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
NSPasteboard *pboard = [sender draggingPasteboard];
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
Vector<String> files;
for(int i=0;i<filenames.count;i++) {
NSString *ns = [filenames objectAtIndex:i];
char *utfs = strdup([ns UTF8String]);
String ret;
ret.parse_utf8(utfs);
free(utfs);
files.push_back(ret);
}
if (files.size()) {
OS_OSX::singleton->main_loop->drop_files(files,0);
OS_OSX::singleton->move_window_to_foreground();
}
return NO;
}
- (BOOL)isOpaque
{
return YES;
@ -861,6 +897,7 @@ static int translateKey(unsigned int key)
@implementation GodotWindow
- (BOOL)canBecomeKeyWindow
{
// Required for NSBorderlessWindowMask windows

View file

@ -243,7 +243,7 @@ def configure(env):
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
env.Append(CCFLAGS=['/DGLEW_ENABLED'])
LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shcore','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])

View file

@ -57,13 +57,6 @@
#include <regstr.h>
#include <process.h>
#if (_MSC_VER >= 1700)
#define HIDPI_SUPPORT
#endif
#ifdef HIDPI_SUPPORT
#include <ShellScalingAPI.h>
#endif
static const WORD MAX_CONSOLE_LINES = 1500;
extern "C" {
@ -781,6 +774,8 @@ LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
void OS_Windows::process_key_events() {
for(int i=0;i<key_event_pos;i++) {
@ -852,6 +847,75 @@ void OS_Windows::process_key_events() {
key_event_pos=0;
}
enum _MonitorDpiType
{
MDT_Effective_DPI = 0,
MDT_Angular_DPI = 1,
MDT_Raw_DPI = 2,
MDT_Default = MDT_Effective_DPI
};
static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType= MDT_Default)
{
int dpiX = 96, dpiY = 96;
static HMODULE Shcore = NULL;
typedef HRESULT (WINAPI* GetDPIForMonitor_t)(HMONITOR hmonitor, _MonitorDpiType dpiType, UINT *dpiX, UINT *dpiY);
static GetDPIForMonitor_t getDPIForMonitor = NULL;
if (Shcore == NULL)
{
Shcore = LoadLibraryW(L"Shcore.dll");
getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : NULL;
if ((Shcore == NULL) || (getDPIForMonitor == NULL))
{
if (Shcore)
FreeLibrary(Shcore);
Shcore = (HMODULE)INVALID_HANDLE_VALUE;
}
}
UINT x = 0, y = 0;
HRESULT hr = E_FAIL;
bool bSet = false;
if (hmon && (Shcore != (HMODULE)INVALID_HANDLE_VALUE))
{
hr = getDPIForMonitor(hmon, dpiType/*MDT_Effective_DPI*/, &x, &y);
if (SUCCEEDED(hr) && (x > 0) && (y > 0))
{
dpiX = (int)x;
dpiY = (int)y;
}
}
else
{
static int overallX = 0, overallY = 0;
if (overallX <= 0 || overallY <= 0)
{
HDC hdc = GetDC(NULL);
if (hdc)
{
overallX = GetDeviceCaps(hdc, LOGPIXELSX);
overallY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
}
}
if (overallX > 0 && overallY > 0)
{
dpiX = overallX; dpiY = overallY;
}
}
return (dpiX+dpiY)/2;
}
BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
OS_Windows *self=(OS_Windows*)OS::get_singleton();
MonitorInfo minfo;
@ -861,13 +925,9 @@ BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPR
minfo.rect.pos.y=lprcMonitor->top;
minfo.rect.size.x=lprcMonitor->right - lprcMonitor->left;
minfo.rect.size.y=lprcMonitor->bottom - lprcMonitor->top;
#ifdef HIDPI_SUPPORT
UINT dpix,dpiy;
GetDpiForMonitor(hMonitor,MDT_EFFECTIVE_DPI,&dpix,&dpiy);
minfo.dpi=(dpix + dpiy)/2;
#else
minfo.dpi=72;
#endif
minfo.dpi = QueryDpiForMonitor(hMonitor);
self->monitor_info.push_back(minfo);
return TRUE;

View file

@ -1810,6 +1810,7 @@ void Control::_propagate_theme_changed(Control *p_owner) {
void Control::set_theme(const Ref<Theme>& p_theme) {
data.theme=p_theme;
if (!p_theme.is_null()) {

View file

@ -700,15 +700,6 @@ void TextEdit::_notification(int p_what) {
if (highlighted_text.length() != 0 && highlighted_text != search_text)
highlighted_text_col = _get_column_pos_of_word(highlighted_text, str, SEARCH_MATCH_CASE|SEARCH_WHOLE_WORDS, 0);
if (cache.line_number_w) {
String fc = String::num(line+1);
while (fc.length() < line_number_char_count) {
fc="0"+fc;
}
cache.font->draw(ci,Point2(cache.style_normal->get_margin(MARGIN_LEFT)+cache.breakpoint_gutter_width,ofs_y+cache.font->get_ascent()),fc,cache.line_number_color);
}
const Map<int,Text::ColorRegionInfo>& cri_map=text.get_color_region_info(line);
@ -720,8 +711,14 @@ void TextEdit::_notification(int p_what) {
if (text.is_breakpoint(line)) {
VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(xmargin_beg, ofs_y,xmargin_end-xmargin_beg,get_row_height()),cache.breakpoint_color);
}
// draw breakpoint marker
if (line==cursor.line) {
VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(0, ofs_y,xmargin_end,get_row_height()),cache.current_line_color);
}
// draw breakpoint marker
if (text.is_breakpoint(line)) {
if (draw_breakpoint_gutter) {
int vertical_gap = cache.breakpoint_gutter_width / 2;
int marker_size = cache.breakpoint_gutter_width - vertical_gap;
@ -731,10 +728,13 @@ void TextEdit::_notification(int p_what) {
}
if (line==cursor.line) {
VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(xmargin_beg, ofs_y,xmargin_end-xmargin_beg,get_row_height()),cache.current_line_color);
if (cache.line_number_w) {
String fc = String::num(line+1);
while (fc.length() < line_number_char_count) {
fc="0"+fc;
}
cache.font->draw(ci,Point2(cache.style_normal->get_margin(MARGIN_LEFT)+cache.breakpoint_gutter_width,ofs_y+cache.font->get_ascent()),fc,cache.line_number_color);
}
for (int j=0;j<str.length();j++) {

View file

@ -574,8 +574,10 @@ void DynamicFont::set_font_data(const Ref<DynamicFontData>& p_data) {
data=p_data;
data_at_size=data->_get_dynamic_font_at_size(size);
emit_changed();
}
Ref<DynamicFontData> DynamicFont::get_font_data() const{
return data;
@ -594,6 +596,8 @@ void DynamicFont::set_size(int p_size){
fallback_data_at_size[i]=fallbacks[i]->_get_dynamic_font_at_size(size);
}
emit_changed();
_change_notify();
}
int DynamicFont::get_size() const{
@ -663,6 +667,9 @@ void DynamicFont::add_fallback(const Ref<DynamicFontData>& p_data) {
fallback_data_at_size.push_back(fallbacks[fallbacks.size()-1]->_get_dynamic_font_at_size(size)); //const..
_change_notify();
emit_changed();
_change_notify();
}
int DynamicFont::get_fallback_count() const {
@ -679,6 +686,7 @@ void DynamicFont::remove_fallback(int p_idx) {
ERR_FAIL_INDEX(p_idx,fallbacks.size());
fallbacks.remove(p_idx);
fallback_data_at_size.remove(p_idx);
emit_changed();
_change_notify();
}

View file

@ -384,8 +384,8 @@ void DynamicFont::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_size","data"),&DynamicFont::set_size);
ObjectTypeDB::bind_method(_MD("get_size"),&DynamicFont::get_size);
ADD_PROPERTY(PropertyInfo(Variant::INT,"size"),_SCS("set_size"),_SCS("get_size"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"font",PROPERTY_HINT_RESOURCE_TYPE,"DynamicFontData"),_SCS("set_font_data"),_SCS("get_font_data"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"font/size"),_SCS("set_size"),_SCS("get_size"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"font/font",PROPERTY_HINT_RESOURCE_TYPE,"DynamicFontData"),_SCS("set_font_data"),_SCS("get_font_data"));
}

View file

@ -21,17 +21,20 @@ def make_translations_header(target,source,env):
g.write("#ifndef _EDITOR_TRANSLATIONS_H\n")
g.write("#define _EDITOR_TRANSLATIONS_H\n")
import zlib
import os.path
paths = [node.srcnode().abspath for node in source]
sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0])
xl_names=[]
for i in range(len(source)):
print("Appending translation: "+source[i].srcnode().abspath)
f = open(source[i].srcnode().abspath,"rb")
for i in range(len(sorted_paths)):
print("Appending translation: "+sorted_paths[i])
f = open(sorted_paths[i],"rb")
buf = f.read()
decomp_size = len(buf)
import zlib
import os.path
buf = zlib.compress(buf)
name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")

View file

@ -36,6 +36,7 @@
#if 1
#include "os/keyboard.h"
#include "editor_help.h"
void CreateDialog::popup(bool p_dontclear) {
@ -107,6 +108,9 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty
}
const String& description = EditorHelp::get_doc_data()->class_list[p_type].brief_description;
item->set_tooltip(0,description);
if (has_icon(p_type,"EditorIcons")) {

View file

@ -161,7 +161,7 @@ int EditorFileSystemDirectory::get_source_count(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx,files.size(),0);
if (!files[p_idx]->meta.enabled)
return 0;
return files[p_idx]->meta.sources.size();
}
String EditorFileSystemDirectory::get_source_file(int p_idx,int p_source) const {

View file

@ -66,19 +66,19 @@ static Ref<BitmapFont> make_font(int p_height,int p_ascent, int p_valign, int p_
return font;
}
#define MAKE_DROID_SANS(m_name,m_size) \
Ref<DynamicFont> m_name;\
m_name.instance();\
m_name->set_size(m_size);\
m_name->set_font_data(DroidSans);\
#define MAKE_FALLBACKS(m_name)\
m_name->add_fallback(DroidSansFallback);\
m_name->add_fallback(DroidSansJapanese);\
m_name->add_fallback(DroidSansArabic);\
m_name->add_fallback(DroidSansHebrew);\
m_name->add_fallback(DroidSansThai);
#define MAKE_DROID_SANS(m_name,m_size) \
Ref<DynamicFont> m_name;\
m_name.instance();\
m_name->set_size(m_size);\
m_name->set_font_data(DroidSans);\
MAKE_FALLBACKS(m_name);
void editor_register_fonts(Ref<Theme> p_theme) {
@ -144,6 +144,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
df_code.instance();
df_code->set_size(int(EditorSettings::get_singleton()->get("global/source_font_size"))*EDSCALE);
df_code->set_font_data(dfmono);
MAKE_FALLBACKS(df_code);
p_theme->set_font("source","EditorFonts",df_code);
@ -151,6 +152,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
df_doc_code.instance();
df_doc_code->set_size(int(EDITOR_DEF("help/help_source_font_size",14))*EDSCALE);
df_doc_code->set_font_data(dfmono);
MAKE_FALLBACKS(df_doc_code);
p_theme->set_font("doc_source","EditorFonts",df_doc_code);

View file

@ -889,7 +889,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
Ref<EditorTextureImportPlugin> plugin = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_atlas");
Ref<EditorTextureImportPlugin> plugin = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture");
Error err = plugin->import2(dst_file,imd,get_image_compression(),true);
if (err) {

View file

@ -192,6 +192,18 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) {
case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
//case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break;
case KEY_F8: _menu_option_confirm(RUN_STOP,true); break;
case KEY_F11: {
if (p_event.key.mod.shift) {
if (p_event.key.mod.control) {
set_distraction_free_mode(!get_distraction_free_mode());
} else if (distraction_free_mode) {
distraction_free_mode = false;
_update_top_menu_visibility();
} else {
set_docks_visible(!get_docks_visible());
}
}
} break;
}
}
@ -2795,6 +2807,10 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
run_native->set_debug_navigation(!ischecked);
editor_run.set_debug_navigation(!ischecked);
} break;
case RUN_RELOAD_SCRIPTS: {
ScriptEditor::get_singleton()->get_debugger()->reload_scripts();
} break;
case SETTINGS_UPDATE_ALWAYS: {
update_menu->get_popup()->set_item_checked(0,true);
@ -4518,32 +4534,59 @@ void EditorNode::_update_dock_slots_visibility() {
right_hsplit,
};
for(int i=0;i<DOCK_SLOT_MAX;i++) {
if (!docks_visible) {
if (dock_slot[i]->get_tab_count())
dock_slot[i]->show();
else
for(int i=0;i<DOCK_SLOT_MAX;i++) {
dock_slot[i]->hide();
}
for(int i=0;i<DOCK_SLOT_MAX/2;i++) {
bool in_use = dock_slot[i*2+0]->get_tab_count() || dock_slot[i*2+1]->get_tab_count();
if (in_use)
splits[i]->show();
else
splits[i]->hide();
}
for(int i=0;i<DOCK_SLOT_MAX;i++) {
if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) {
dock_slot[i]->set_current_tab(0);
}
for(int i=0;i<DOCK_SLOT_MAX/2;i++) {
splits[i]->hide();
}
right_hsplit->hide();
bottom_panel->hide();
} else {
for(int i=0;i<DOCK_SLOT_MAX;i++) {
if (dock_slot[i]->get_tab_count())
dock_slot[i]->show();
else
dock_slot[i]->hide();
}
for(int i=0;i<DOCK_SLOT_MAX/2;i++) {
bool in_use = dock_slot[i*2+0]->get_tab_count() || dock_slot[i*2+1]->get_tab_count();
if (in_use)
splits[i]->show();
else
splits[i]->hide();
}
for(int i=0;i<DOCK_SLOT_MAX;i++) {
if (!dock_slot[i]->is_hidden() && dock_slot[i]->get_tab_count()) {
dock_slot[i]->set_current_tab(0);
}
}
bottom_panel->show();
right_hsplit->show();
}
}
void EditorNode::_update_top_menu_visibility() {
if (distraction_free_mode) {
play_cc->hide();
menu_hb->hide();
scene_tabs->hide();
} else {
play_cc->show();
menu_hb->show();
scene_tabs->show();
}
}
void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section) {
@ -4909,6 +4952,31 @@ void EditorNode::_bottom_panel_switch(bool p_enable,int p_idx) {
}
}
void EditorNode::set_docks_visible(bool p_show) {
docks_visible = p_show;
_update_dock_slots_visibility();
}
bool EditorNode::get_docks_visible() const {
return docks_visible;
}
void EditorNode::set_distraction_free_mode(bool p_enter) {
distraction_free_mode = p_enter;
if (p_enter) {
if (docks_visible) {
set_docks_visible(false);
}
} else {
set_docks_visible(true);
}
_update_top_menu_visibility();
}
bool EditorNode::get_distraction_free_mode() const {
return distraction_free_mode;
}
void EditorNode::add_control_to_dock(DockSlot p_slot,Control* p_control) {
ERR_FAIL_INDEX(p_slot,DOCK_SLOT_MAX);
@ -5163,6 +5231,8 @@ EditorNode::EditorNode() {
last_checked_version=0;
changing_scene=false;
_initializing_addons=false;
docks_visible = true;
distraction_free_mode=false;
FileAccess::set_backup_save(true);
@ -5628,7 +5698,7 @@ EditorNode::EditorNode() {
//s1->set_size(Point2(10,15));
CenterContainer *play_cc = memnew( CenterContainer );
play_cc = memnew( CenterContainer );
play_cc->set_ignore_mouse(true);
gui_base->add_child( play_cc );
play_cc->set_area_as_parent_rect();
@ -5717,6 +5787,8 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_check_item(TTR("Visible Collision Shapes"),RUN_DEBUG_COLLISONS);
p->add_check_item(TTR("Visible Navigation"),RUN_DEBUG_NAVIGATION);
p->add_separator();
p->add_item(TTR("Reload Scripts"),RUN_RELOAD_SCRIPTS);
p->connect("item_pressed",this,"_menu_option");
/*

View file

@ -174,6 +174,7 @@ private:
RUN_DEBUG_COLLISONS,
RUN_DEBUG_NAVIGATION,
RUN_DEPLOY_REMOTE_DEBUG,
RUN_RELOAD_SCRIPTS,
SETTINGS_UPDATE_ALWAYS,
SETTINGS_UPDATE_CHANGES,
SETTINGS_IMPORT,
@ -237,6 +238,7 @@ private:
//HSplitContainer *editor_hsplit;
//VSplitContainer *editor_vsplit;
CenterContainer *play_cc;
HBoxContainer *menu_hb;
Control *viewport;
MenuButton *file_menu;
@ -350,6 +352,8 @@ private:
ToolButton *dock_tab_move_right;
int dock_popup_selected;
Timer *dock_drag_timer;
bool docks_visible;
bool distraction_free_mode;
String _tmp_import_path;
@ -556,7 +560,7 @@ private:
void _save_docks_to_config(Ref<ConfigFile> p_layout, const String& p_section);
void _load_docks_from_config(Ref<ConfigFile> p_layout, const String& p_section);
void _update_dock_slots_visibility();
void _update_top_menu_visibility();
void _update_layouts_menu();
void _layout_menu_option(int p_idx);
@ -593,6 +597,11 @@ public:
void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE,false); }
void set_docks_visible(bool p_show);
bool get_docks_visible() const;
void set_distraction_free_mode(bool p_enter);
bool get_distraction_free_mode() const;
void add_control_to_dock(DockSlot p_slot,Control* p_control);
void remove_control_from_dock(Control* p_control);

View file

@ -131,7 +131,6 @@ void EditorResourcePreview::_thread() {
//print_line("pop from queue "+item.path);
uint64_t modtime = FileAccess::get_modified_time(item.path);
int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");
thumbnail_size*=EDSCALE;
@ -168,6 +167,7 @@ void EditorResourcePreview::_thread() {
texture=_generate_preview(item,cache_base);
} else {
uint64_t modtime = FileAccess::get_modified_time(item.path);
int tsize = f->get_line().to_int64();
uint64_t last_modtime = f->get_line().to_int64();

View file

@ -1834,7 +1834,7 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor) {
} else if (EditorImportExport::get_singleton()->image_get_export_group(p_path)) {
Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture");
if (pl.is_valid()) {
Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
if (ce.size()) {
@ -1848,7 +1848,7 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor) {
String xt = p_path.extension().to_lower();
if (EditorImportExport::get_singleton()->get_image_formats().has(xt)) { //should check for more I guess?
Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture");
if (pl.is_valid()) {
Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
if (ce.size()) {

View file

@ -3441,7 +3441,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
animation_hb->add_child(key_insert_button);
animation_menu = memnew( MenuButton );
animation_menu->set_text("Animation");
animation_menu->set_text(TTR("Animation"));
animation_hb->add_child(animation_menu);
animation_menu->get_popup()->connect("item_pressed", this,"_popup_callback");

View file

@ -222,7 +222,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
options = memnew( MenuButton );
SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text("Mesh");
options->set_text(TTR("Mesh"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshInstance","EditorIcons"));
options->get_popup()->add_item(TTR("Create Trimesh Static Body"),MENU_OPTION_CREATE_STATIC_TRIMESH_BODY);

View file

@ -3945,7 +3945,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true);
button_binds[0]=MENU_TOOL_LIST_SELECT;
tool_button[TOOL_MODE_LIST_SELECT]->connect("pressed", this,"_menu_item_pressed",button_binds);
tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip("Show a list of all objects at the position clicked\n(same as Alt+RMB in selet mode).");
tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode)."));
vs = memnew( VSeparator );
hbc_menu->add_child(vs);

View file

@ -1057,7 +1057,7 @@ void ProjectExportDialog::_group_atlas_preview() {
imd->set_option("atlas",true);
imd->set_option("crop",true);
Ref<EditorTextureImportPlugin> plugin = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_atlas");
Ref<EditorTextureImportPlugin> plugin = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture");
Error err = plugin->import2(dst_file,imd,EditorExportPlatform::IMAGE_COMPRESSION_NONE,true);
if (err) {

View file

@ -1573,6 +1573,16 @@ void ScriptEditorDebugger::set_breakpoint(const String& p_path,int p_line,bool p
}
void ScriptEditorDebugger::reload_scripts() {
if (connection.is_valid()) {
Array msg;
msg.push_back("reload_scripts");
ppeer->put_var(msg);
}
}
void ScriptEditorDebugger::_error_selected(int p_idx) {
error_stack->clear();

View file

@ -217,6 +217,8 @@ public:
void set_tool_button(Button *p_tb) { debugger_button=p_tb; }
void reload_scripts();
virtual Size2 get_minimum_size() const;
ScriptEditorDebugger(EditorNode *p_editor=NULL);
~ScriptEditorDebugger();

View file

@ -7,7 +7,7 @@ LANGS = $(POFILES:%.po=%)
all: update merge
update:
@cd ../..; python tools/translations/extract.py
@cd ../..; python2 tools/translations/extract.py
merge:
@for po in $(POFILES); do \

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,7 @@ for root, dirnames, filenames in os.walk('.'):
if (filename.find("collada") != -1):
continue
matches.append(os.path.join(root, filename))
matches.sort()
unique_str = []

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

5909
tools/translations/ko.po Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff