From 95047562d743b1c1fdc007432c8a0c145a455c5d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 29 Jun 2015 00:29:49 -0300 Subject: Several performance improvements, mainly in loading and instancing scenes and resources. A general speedup should be apparent, with even more peformance increase when compiling optimized. WARNING: Tested and it seems to work, but if something breaks, please report. --- modules/gdscript/gd_script.cpp | 4 ++-- modules/gridmap/grid_map.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b6ad7aa716..63bb44784d 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -2556,9 +2556,9 @@ void GDScriptLanguage::init() { //populate native classes - List class_list; + List class_list; ObjectTypeDB::get_type_list(&class_list); - for(List::Element *E=class_list.front();E;E=E->next()) { + for(List::Element *E=class_list.front();E;E=E->next()) { StringName n = E->get(); String s = String(n); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 121b23001d..4f0daf329f 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -130,8 +130,8 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { } else if (name.begins_with("areas/")) { - int which = name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int which = name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="bounds") { ERR_FAIL_COND_V(area_map.has(which),false); create_area(which,p_value); @@ -215,8 +215,8 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const { r_ret= d; } else if (name.begins_with("areas/")) { - int which = name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int which = name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="bounds") r_ret= area_get_bounds(which); else if (what=="name") -- cgit v1.2.3 From 55b34e05b3d735a84e1af9833e19c0b816c18252 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 30 Jun 2015 11:28:43 -0300 Subject: -some changes by okam --- modules/gdscript/gd_script.cpp | 8 ++++++++ modules/gdscript/gd_script.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'modules') diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 63bb44784d..53ae0c8702 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1977,9 +1977,17 @@ void GDScript::_bind_methods() { ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"new",&GDScript::_new,MethodInfo("new")); + ObjectTypeDB::bind_method(_MD("get_as_byte_code"),&GDScript::get_as_byte_code); + } +Vector GDScript::get_as_byte_code() const { + + GDTokenizerBuffer tokenizer; + return tokenizer.parse_code_string(source); +}; + Error GDScript::load_byte_code(const String& p_path) { diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 4672f3b8be..1e1279d5f5 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -349,6 +349,8 @@ public: Error load_source_code(const String& p_path); Error load_byte_code(const String& p_path); + Vector get_as_byte_code() const; + virtual ScriptLanguage *get_language() const; GDScript(); -- cgit v1.2.3