From 048fdc8aeabbd80ba9cc8914ec7f7baa00ad0c3d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 22 Sep 2014 00:50:48 -0300 Subject: -variables with export in script are now IMMEDIATELY AND ALWAYS visible in properties (#718) -WorldEnvironment cleanup issues fixed (#563) -Text Editor improvement to shift-mouse selection (#648) -(Hopefully) fixed rare (but horrible) indexing bug in GDScript compiler (#652) -Some changes to PhysicsBody API, renamed property "active" to "sleeping", which makes more sense -Added add_collision_exception() API in PhysicsBody (more accessible) -ability to select and copy in the output messages panel --- modules/gdscript/gd_compiler.cpp | 21 ++++++++++++++---- modules/gdscript/gd_script.cpp | 47 +++++++++++++++++++++++++++++++++++++++- modules/gdscript/gd_script.h | 2 ++ 3 files changed, 65 insertions(+), 5 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index e6dd9d9ae1..45eac23450 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -724,6 +724,8 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre return prev_pos; int retval=prev_pos; + //print_line("retval: "+itos(retval)); + if (retval&GDFunction::ADDR_TYPE_STACK< setchain; + int prev_key_idx=-1; + for(List::Element *E=chain.back();E;E=E->prev()) { @@ -743,16 +747,23 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre if (named) { - key_idx = codegen.get_name_map_pos(static_cast(E->get()->arguments[1])->name); + key_idx = codegen.get_name_map_pos(static_cast(E->get()->arguments[1])->name); + //printf("named key %x\n",key_idx); + } else { - GDParser::Node *key = E->get()->arguments[1]; - key_idx = _parse_expression(codegen,key,slevel); - if (retval&GDFunction::ADDR_TYPE_STACK<get()->arguments[1]; + key_idx = _parse_expression(codegen,key,slevel); + //printf("expr key %x\n",key_idx); + + + //stack was raised here if retval was stack but.. + } if (key_idx<0) @@ -764,6 +775,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre slevel++; codegen.alloc_stack(slevel); int dst_pos = (GDFunction::ADDR_TYPE_STACK<type!=GDParser::Node::TYPE_CLASS); + + const GDParser::ClassNode *c = static_cast(root); + + List plist; + + Map default_values; + + for(int i=0;ivariables.size();i++) { + if (c->variables[i]._export.type==Variant::NIL) + continue; + + plist.push_back(c->variables[i]._export); + default_values[c->variables[i].identifier]=c->variables[i].default_value; + } + + + for (Set::Element *E=placeholders.front();E;E=E->next()) { + + E->get()->update(plist,default_values); + } + +#endif } void GDScript::_set_subclass_path(Ref& p_sc,const String& p_path) { diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 62787cf6f8..2088606271 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -299,6 +299,8 @@ public: virtual bool has_source_code() const; virtual String get_source_code() const; virtual void set_source_code(const String& p_code); + virtual void update_exports(); + virtual Error reload(); virtual String get_node_type() const; -- cgit v1.2.3