summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-16 10:22:26 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-16 10:22:26 -0300
commit703004f830f39adcde9b9565f1aa49d1b10e8d27 (patch)
treeb8fd669af9dee07177ff658f0ebca83aff836598 /modules/gdscript
parent64e83bfd1404ea593f0c79b478d196a3fcde42a8 (diff)
More 3D Work
-=-=-=-=-=- -ESM Shadow Mapping for softer and less glitchy shadows -HDR Pipeline (convert to Linear on texture import, convert to SRGB at the end) -Fix to xml parse bug
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gd_compiler.cpp10
-rw-r--r--modules/gdscript/gd_functions.cpp13
-rw-r--r--modules/gdscript/gd_functions.h1
-rw-r--r--modules/gdscript/gd_script.cpp2
-rw-r--r--modules/gdscript/gd_script.h1
5 files changed, 26 insertions, 1 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index f1b7ad0096..9cbbaf2fcf 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1330,12 +1330,17 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
}
path=base.get_base_dir().plus_file(path);
}
-
script = ResourceLoader::load(path);
if (script.is_null()) {
_set_error("Could not load base class: "+path,p_class);
return ERR_FILE_NOT_FOUND;
}
+ if (!script->valid) {
+
+ _set_error("Script not fully loaded (cyclic preload?): "+path,p_class);
+ return ERR_BUSY;
+ }
+ //print_line("EXTENDS PATH: "+path+" script is "+itos(script.is_valid())+" indices is "+itos(script->member_indices.size())+" valid? "+itos(script->valid));
if (p_class->extends_class.size()) {
@@ -1438,6 +1443,9 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
}
+ print_line("Script: "+p_script->get_path()+" indices: "+itos(p_script->member_indices.size()));
+
+
for(int i=0;i<p_class->variables.size();i++) {
StringName name = p_class->variables[i].identifier;
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index f789493ae8..0d11734bbd 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -93,6 +93,7 @@ const char *GDFunctions::get_func_name(Function p_func) {
"load",
"inst2dict",
"dict2inst",
+ "hash",
"print_stack",
};
@@ -864,6 +865,12 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_ret = gdscr->_new(NULL,0,r_error);
} break;
+ case HASH: {
+
+ VALIDATE_ARG_COUNT(1);
+ r_ret=p_args[0]->hash();
+
+ } break;
case PRINT_STACK: {
@@ -1238,6 +1245,12 @@ MethodInfo GDFunctions::get_info(Function p_func) {
mi.return_val.type=Variant::OBJECT;
return mi;
} break;
+ case HASH: {
+
+ MethodInfo mi("hash",PropertyInfo(Variant::NIL,"var:var"));
+ mi.return_val.type=Variant::INT;
+ return mi;
+ } break;
case PRINT_STACK: {
MethodInfo mi("print_stack");
diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h
index 9255e5e2c5..340763fb8c 100644
--- a/modules/gdscript/gd_functions.h
+++ b/modules/gdscript/gd_functions.h
@@ -89,6 +89,7 @@ public:
RESOURCE_LOAD,
INST2DICT,
DICT2INST,
+ HASH,
PRINT_STACK,
FUNC_MAX
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 2885b754be..cc7aa70234 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1451,6 +1451,7 @@ Error GDScript::reload() {
+
valid=false;
GDParser parser;
Error err = parser.parse(source,basedir);
@@ -1721,6 +1722,7 @@ GDScript::GDScript() {
_base=NULL;
_owner=NULL;
tool=false;
+
}
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 56da0bb2e3..3300ee77c8 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -183,6 +183,7 @@ class GDScript : public Script {
bool valid;
+
friend class GDInstance;
friend class GDFunction;
friend class GDCompiler;