diff options
-rw-r--r-- | SConstruct | 4 | ||||
-rw-r--r-- | doc/base/classes.xml | 8 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 3 | ||||
-rw-r--r-- | methods.py | 5 | ||||
-rw-r--r-- | platform/android/SCsub | 15 | ||||
-rw-r--r-- | platform/android/build.gradle.template | 3 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/detect.py | 29 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | scene/main/node.cpp | 18 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 47 | ||||
-rw-r--r-- | scene/resources/packed_scene.h | 2 |
12 files changed, 89 insertions, 49 deletions
diff --git a/SConstruct b/SConstruct index 2e7683d17a..e9a6bc44b6 100644 --- a/SConstruct +++ b/SConstruct @@ -73,6 +73,8 @@ env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.global_defaults = global_defaults env_base.android_maven_repos = [] env_base.android_dependencies = [] +env_base.android_gradle_plugins = [] +env_base.android_gradle_classpath = [] env_base.android_java_dirs = [] env_base.android_res_dirs = [] env_base.android_aidl_dirs = [] @@ -96,6 +98,8 @@ env_base.__class__.android_add_default_config = methods.android_add_default_conf env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes +env_base.__class__.android_add_gradle_plugin = methods.android_add_gradle_plugin +env_base.__class__.android_add_gradle_classpath = methods.android_add_gradle_classpath env_base.__class__.disable_module = methods.disable_module env_base.__class__.add_source_files = methods.add_source_files diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 71594887fc..0b6e2d99ea 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -9810,6 +9810,14 @@ <description> </description> </method> + <method name="has_point" qualifiers="virtual"> + <return type="bool"> + </return> + <argument index="0" name="point" type="Vector2"> + </argument> + <description> + </description> + </method> <method name="has_stylebox" qualifiers="const"> <return type="bool"> </return> diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 52eb8299d9..b081936b99 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6280,8 +6280,7 @@ void RasterizerStorageGLES3::initialize() { shaders.cubemap_filter.init(); shaders.particles.init(); -#ifndef GLES_OVER_GL - +#ifdef GLES_OVER_GL glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); #endif diff --git a/methods.py b/methods.py index 7177dcb804..a86fa1937d 100644 --- a/methods.py +++ b/methods.py @@ -1381,6 +1381,11 @@ def android_add_jni_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath self.android_jni_dirs.append(base_path) +def android_add_gradle_plugin(self, plugin): + self.android_gradle_plugins.append(plugin) + +def android_add_gradle_classpath(self, classpath): + self.android_gradle_classpath.append(classpath) def android_add_default_config(self, config): self.android_default_config.append(config) diff --git a/platform/android/SCsub b/platform/android/SCsub index 86f8c40f83..e8536953a3 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -49,10 +49,11 @@ gradle_text = gradle_basein.read() gradle_maven_repos_text = "" if len(env.android_maven_repos) > 0: - gradle_maven_repos_text += "maven {\n" + gradle_maven_repos_text += "" for x in env.android_maven_repos: + gradle_maven_repos_text += "\tmaven {\n" gradle_maven_repos_text += "\t\t" + x + "\n" - gradle_maven_repos_text += "\t}\n" + gradle_maven_repos_text += "\t}\n" gradle_maven_dependencies_text = "" @@ -64,7 +65,14 @@ gradle_java_dirs_text = "" for x in env.android_java_dirs: gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'" +gradle_plugins = "" +for x in env.android_gradle_plugins: + gradle_plugins += "apply plugin: \"" + x + "\"\n" +gradle_classpath = "" +for x in env.android_gradle_classpath: + gradle_classpath += "\t\tclasspath \"" + x + "\"\n" + gradle_res_dirs_text = "" for x in env.android_res_dirs: @@ -95,7 +103,8 @@ gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_tex gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text) - +gradle_text = gradle_text.replace("$$GRADLE_PLUGINS$$", gradle_plugins) +gradle_text = gradle_text.replace("$$GRADLE_CLASSPATH$$", gradle_classpath) gradle_baseout.write(gradle_text) gradle_baseout.close() diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index c46a15bd12..24aab8e01f 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -4,6 +4,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' + $$GRADLE_CLASSPATH$$ } } @@ -83,3 +84,5 @@ android { variant.outputs.get(0).setOutputFile(new File("${projectDir}/../../../bin", "android_${variant.name}.apk")) } } + +$$GRADLE_PLUGINS$$ diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 60719f6d42..705f0df46e 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -421,6 +421,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev.mouse_button.y = touch[0].pos.y; ev.mouse_button.global_x = touch[0].pos.x; ev.mouse_button.global_y = touch[0].pos.y; + input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y)); last_mouse = touch[0].pos; input->parse_input_event(ev); } @@ -503,6 +504,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev.mouse_button.y = touch[0].pos.y; ev.mouse_button.global_x = touch[0].pos.x; ev.mouse_button.global_y = touch[0].pos.y; + input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y)); input->parse_input_event(ev); for (int i = 0; i < touch.size(); i++) { diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index d4d54b1ce8..f82eae9ff2 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -28,7 +28,6 @@ def get_flags(): return [ ('tools', 'no'), ('module_etc1_enabled', 'no'), - ('module_mpc_enabled', 'no'), ('module_theora_enabled', 'no'), ] @@ -70,14 +69,16 @@ def configure(env): env['LIBSUFFIX'] = '.bc' if (env["target"] == "release"): - env.Append(CCFLAGS=['-O2']) + env.Append(CCFLAGS=['-O3']) + env.Append(LINKFLAGS=['-O3']) elif (env["target"] == "release_debug"): env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) - elif (env["target"] == "debug"): - #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED']) - env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g3', '-DDEBUG_ENABLED']) - env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) + env.Append(LINKFLAGS=['-O2']) + # retain function names at the cost of file size, for backtraces and profiling env.Append(LINKFLAGS=['--profiling-funcs']) + elif (env["target"] == "debug"): + env.Append(CCFLAGS=['-O1', '-D_DEBUG', '-Wall', '-g', '-DDEBUG_ENABLED']) + env.Append(LINKFLAGS=['-O1', '-g']) # TODO: Move that to opus module's config if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): @@ -85,16 +86,15 @@ def configure(env): # These flags help keep the file size down env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti']) - env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS']) + env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DTYPED_METHOD_BIND', '-DNO_THREADS']) env.Append(CPPFLAGS=['-DGLES3_ENABLED']) + env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1']) - if env['wasm'] == 'yes': + if (env['wasm'] == 'yes'): env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) - # Maximum memory size is baked into the WebAssembly binary during - # compilation, so we need to enable memory growth to allow setting - # TOTAL_MEMORY at runtime. The value set at runtime must be higher than - # what is set during compilation, check TOTAL_MEMORY in Emscripten's - # src/settings.js for the default. + # In contrast to asm.js, enabling memory growth on WebAssembly has no + # major performance impact, and causes only a negligible increase in + # memory size. env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1']) env.extra_suffix = '.webassembly' + env.extra_suffix else: @@ -104,8 +104,5 @@ def configure(env): if env['javascript_eval'] == 'yes': env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED']) - env.Append(LINKFLAGS=['-O2']) - env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1']) - # env.Append(LINKFLAGS=['-g4']) import methods diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 2f40f0acec..a8e364a4cd 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2514,6 +2514,8 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("size_flags_changed")); ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("modal_closed")); + + BIND_VMETHOD(MethodInfo("has_point", PropertyInfo(Variant::VECTOR2, "point"))); } Control::Control() { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 0245944154..c13ed232a7 100644..100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1719,6 +1719,9 @@ void Node::get_owned_by(Node *p_by, List<Node *> *p_owned) { void Node::_set_owner_nocheck(Node *p_owner) { + if (data.owner == p_owner) + return; + ERR_FAIL_COND(data.owner); data.owner = p_owner; data.owner->data.owned.push_back(this); @@ -2020,12 +2023,13 @@ void Node::remove_and_skip() { bool clear = true; for (int i = 0; i < data.children.size(); i++) { - if (!data.children[i]->get_owner()) + Node *c_node = data.children[i]; + if (!c_node->get_owner()) continue; - remove_child(data.children[i]); - data.children[i]->_propagate_replace_owner(this, NULL); - children.push_back(data.children[i]); + remove_child(c_node); + c_node->_propagate_replace_owner(this, NULL); + children.push_back(c_node); clear = false; break; } @@ -2036,9 +2040,9 @@ void Node::remove_and_skip() { while (!children.empty()) { - Node *c = children.front()->get(); - data.parent->add_child(c); - c->_propagate_replace_owner(NULL, new_owner); + Node *c_node = children.front()->get(); + data.parent->add_child(c_node); + c_node->_propagate_replace_owner(NULL, new_owner); children.pop_front(); } diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index e46d9db7bc..76c6543a2f 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1516,34 +1516,41 @@ Array SceneState::get_connection_binds(int p_idx) const { return binds; } -bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) const { +bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) { - for (int i = 0; i < connections.size(); i++) { - const ConnectionData &c = connections[i]; + // this method cannot be const because of this + Ref<SceneState> ss = this; - NodePath np_from; + do { + for (int i = 0; i < ss->connections.size(); i++) { + const ConnectionData &c = ss->connections[i]; - if (c.from & FLAG_ID_IS_PATH) { - np_from = node_paths[c.from & FLAG_MASK]; - } else { - np_from = get_node_path(c.from); - } + NodePath np_from; - NodePath np_to; + if (c.from & FLAG_ID_IS_PATH) { + np_from = ss->node_paths[c.from & FLAG_MASK]; + } else { + np_from = ss->get_node_path(c.from); + } - if (c.to & FLAG_ID_IS_PATH) { - np_to = node_paths[c.to & FLAG_MASK]; - } else { - np_to = get_node_path(c.to); - } + NodePath np_to; - StringName sn_signal = names[c.signal]; - StringName sn_method = names[c.method]; + if (c.to & FLAG_ID_IS_PATH) { + np_to = ss->node_paths[c.to & FLAG_MASK]; + } else { + np_to = ss->get_node_path(c.to); + } - if (np_from == p_node_from && sn_signal == p_signal && np_to == p_node_to && sn_method == p_method) { - return true; + StringName sn_signal = ss->names[c.signal]; + StringName sn_method = ss->names[c.method]; + + if (np_from == p_node_from && sn_signal == p_signal && np_to == p_node_to && sn_method == p_method) { + return true; + } } - } + + ss = ss->_get_base_scene_state(); + } while (ss.is_valid()); return false; } diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index b0e89205cb..fe451884f5 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -163,7 +163,7 @@ public: int get_connection_flags(int p_idx) const; Array get_connection_binds(int p_idx) const; - bool has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) const; + bool has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method); Vector<NodePath> get_editable_instances() const; |