-All variables from script are visible through get_property_list(), not just those with export()

-Added PROPERTY_USAGE_SCRIPT_VARIABLE to identify what comes from script
-closes #5146
This commit is contained in:
Juan Linietsky 2016-06-11 18:31:22 -03:00
parent 3b2c96139b
commit 9ddc13a5cc
4 changed files with 9 additions and 0 deletions

View File

@ -489,6 +489,7 @@ static _GlobalConstant _global_constants[]={
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_SCRIPT_VARIABLE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT_INTL ),

View File

@ -86,6 +86,7 @@ enum PropertyUsageFlags {
PROPERTY_USAGE_STORE_IF_NONONE=1024, //only store if false
PROPERTY_USAGE_NO_INSTANCE_STATE=2048,
PROPERTY_USAGE_RESTART_IF_CHANGED=4096,
PROPERTY_USAGE_SCRIPT_VARIABLE=8192,
PROPERTY_USAGE_DEFAULT=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK,
PROPERTY_USAGE_DEFAULT_INTL=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK|PROPERTY_USAGE_INTERNATIONALIZED,

View File

@ -1611,6 +1611,9 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
p_script->member_default_values[name]=p_class->variables[i].default_value;
}
#endif
} else {
p_script->member_info[name]=PropertyInfo(Variant::NIL,name,PROPERTY_HINT_NONE,"",PROPERTY_USAGE_SCRIPT_VARIABLE);
}
//int new_idx = p_script->member_indices.size();

View File

@ -2408,6 +2408,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
}
current_export.type=type;
current_export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
// hint expected next!
@ -2782,6 +2783,8 @@ void GDParser::_parse_class(ClassNode *p_class) {
current_export.type=Variant::OBJECT;
current_export.hint=PROPERTY_HINT_RESOURCE_TYPE;
current_export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
current_export.hint_string=identifier;
tokenizer->advance();
@ -2901,6 +2904,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
}
member._export.type=cn->value.get_type();
member._export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
}
}
#ifdef TOOLS_ENABLED