From c79be979d47daae613d1b1bbc732a30a74f56543 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 7 Dec 2014 02:04:20 -0300 Subject: Batch of Bugfixes -=-=-=-=-=-=-=-=- -Fixed Export UV XForm (should work now). #923 -Fixed enforcement of limits in property editor. #919 -Fixed long-standing bug of export editings in script inheritance. #914, #859, #756 -Fixed horrible error reporting in shader language. #912 -Added kinematic collision with plane (please test well). #911 -Fixed double animation track insert when using 2D rigs. #904 -VKey updates offset parameter in sprite edition. #901 -Do not allow anymore a script to preload itself. (does not fix #899, but narrows it down) -Avoid connection editor from overriding selected text. #897 -Fixed timer autostart. #876 -Fixed collision layers in 3D physics. #872 -Improved operators in shader #857 -Fixed ambient lighting bug #834 -Avoid editor from processing gamepad input #813 -Added not keyword #752 Please test! --- modules/gdscript/gd_editor.cpp | 2 +- modules/gdscript/gd_parser.cpp | 16 +++- modules/gdscript/gd_parser.h | 5 +- modules/gdscript/gd_script.cpp | 164 ++++++++++++++++++++++++++++++++--------- modules/gdscript/gd_script.h | 13 +++- 5 files changed, 156 insertions(+), 44 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index b1db087fb3..95bae2d32a 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -66,7 +66,7 @@ bool GDScriptLanguage::validate(const String& p_script, int &r_line_error,int &r GDParser parser; - Error err = parser.parse(p_script,p_path.get_base_dir(),true); + Error err = parser.parse(p_script,p_path.get_base_dir(),true,p_path); if (err) { r_line_error=parser.get_error_line(); r_col_error=parser.get_error_column(); diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index de2b5219a9..904b6ba52f 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -225,7 +225,14 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ String path = tokenizer->get_token_constant(); if (!path.is_abs_path() && base_path!="") path=base_path+"/"+path; - path = path.replace("///","//"); + path = path.replace("///","//").simplify_path(); + if (path==self_path) { + + _set_error("Can't preload itself (use 'get_script()')."); + return NULL; + + } + Ref res; if (!validating) { @@ -2616,8 +2623,9 @@ Error GDParser::_parse(const String& p_base_path) { return OK; } -Error GDParser::parse_bytecode(const Vector &p_bytecode,const String& p_base_path) { +Error GDParser::parse_bytecode(const Vector &p_bytecode,const String& p_base_path, const String &p_self_path) { + self_path=p_self_path; GDTokenizerBuffer *tb = memnew( GDTokenizerBuffer ); tb->set_code_buffer(p_bytecode); tokenizer=tb; @@ -2628,9 +2636,9 @@ Error GDParser::parse_bytecode(const Vector &p_bytecode,const String& p } -Error GDParser::parse(const String& p_code,const String& p_base_path,bool p_just_validate) { - +Error GDParser::parse(const String& p_code, const String& p_base_path, bool p_just_validate, const String &p_self_path) { + self_path=p_self_path; GDTokenizerText *tt = memnew( GDTokenizerText ); tt->set_code(p_code); diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 5fac34396c..3f82cafc61 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -373,6 +373,7 @@ private: List tab_level; String base_path; + String self_path; PropertyInfo current_export; @@ -398,8 +399,8 @@ public: String get_error() const; int get_error_line() const; int get_error_column() const; - Error parse(const String& p_code, const String& p_base_path="", bool p_just_validate=false); - Error parse_bytecode(const Vector &p_bytecode,const String& p_base_path=""); + Error parse(const String& p_code, const String& p_base_path="", bool p_just_validate=false,const String& p_self_path=""); + Error parse_bytecode(const Vector &p_bytecode,const String& p_base_path="",const String& p_self_path=""); const Node *get_parse_tree() const; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 7085ae6a56..b19168f536 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1523,6 +1523,7 @@ void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { placeholders.erase(p_placeholder); } +/* void GDScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { @@ -1563,7 +1564,7 @@ void GDScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { p_placeholder->update(plist,default_values); -} +}*/ #endif ScriptInstance* GDScript::instance_create(Object *p_this) { @@ -1582,7 +1583,8 @@ ScriptInstance* GDScript::instance_create(Object *p_this) { }*/ PlaceHolderScriptInstance *si = memnew( PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(),Ref