diff options
-rw-r--r-- | editor/editor_node.cpp | 10 | ||||
-rw-r--r-- | modules/gdnative/gdnative.cpp | 40 | ||||
-rw-r--r-- | modules/gdnative/gdnative.h | 4 | ||||
-rw-r--r-- | scene/2d/camera_2d.cpp | 6 | ||||
-rw-r--r-- | scene/2d/parallax_background.cpp | 10 | ||||
-rw-r--r-- | scene/2d/parallax_background.h | 3 | ||||
-rw-r--r-- | scene/2d/parallax_layer.cpp | 20 | ||||
-rw-r--r-- | scene/2d/parallax_layer.h | 4 |
8 files changed, 39 insertions, 58 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6559048172..817e6affbd 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -401,7 +401,15 @@ void EditorNode::_fs_changed() { // ensures export_project does not loop infinitely, because notifications may // come during the export export_defer.preset = ""; - platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); + if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { + if (export_defer.path.ends_with(".zip")) { + platform->save_zip(preset, export_defer.path); + } else if (export_defer.path.ends_with(".pck")) { + platform->save_pack(preset, export_defer.path); + } + } else { + platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); + } } } diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 7949ca182f..f98a16a5d7 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -64,7 +64,6 @@ void GDNativeLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path); ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies); - ClassDB::bind_method(D_METHOD("is_current_library_statically_linked"), &GDNativeLibrary::is_current_library_statically_linked); ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once); ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton); @@ -119,7 +118,7 @@ bool GDNative::initialize() { } String lib_path = library->get_current_library_path(); - if (lib_path.empty() && !library->is_current_library_statically_linked()) { + if (lib_path.empty()) { ERR_PRINT("No library set for this platform"); return false; } @@ -140,7 +139,7 @@ bool GDNative::initialize() { } Error err = OS::get_singleton()->open_dynamic_library(path, native_handle); - if (err != OK && !library->is_current_library_statically_linked()) { + if (err != OK) { return false; } @@ -154,8 +153,7 @@ bool GDNative::initialize() { initialized = false; if (err || !library_init) { - if (!library->is_current_library_statically_linked()) - OS::get_singleton()->close_dynamic_library(native_handle); + OS::get_singleton()->close_dynamic_library(native_handle); native_handle = NULL; ERR_PRINT("Failed to obtain godot_gdnative_init symbol"); return false; @@ -374,40 +372,8 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or } } - bool is_statically_linked = false; - { - - List<String> static_linking_keys; - config->get_section_keys("static_linking", &static_linking_keys); - - for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) { - String key = E->get(); - - Vector<String> tags = key.split("."); - - bool skip = false; - - for (int i = 0; i < tags.size(); i++) { - bool has_feature = OS::get_singleton()->has_feature(tags[i]); - - if (!has_feature) { - skip = true; - break; - } - } - - if (skip) { - continue; - } - - is_statically_linked = config->get_value("static_linking", key); - break; - } - } - lib->current_library_path = entry_lib_path; lib->current_dependencies = dependency_paths; - lib->current_library_statically_linked = is_statically_linked; return lib; } diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index e024ec0a7d..052ce1fef1 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -55,7 +55,6 @@ class GDNativeLibrary : public Resource { String current_library_path; Vector<String> current_dependencies; - bool current_library_statically_linked; bool singleton; bool load_once; @@ -75,9 +74,6 @@ public: _FORCE_INLINE_ Vector<String> get_current_dependencies() const { return current_dependencies; } - _FORCE_INLINE_ bool is_current_library_statically_linked() const { - return current_library_statically_linked; - } // things that are a property of the library itself, not platform specific _FORCE_INLINE_ bool should_load_once() const { diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index d65a3bfe80..3164344d15 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -52,7 +52,11 @@ void Camera2D::_update_scroll() { if (viewport) { viewport->set_canvas_transform(xform); } - get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_camera_moved", xform); + + Size2 screen_size = viewport->get_visible_rect().size; + Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5) : Point2()); + + get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_camera_moved", xform, screen_offset); }; } diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index a13ce6278e..b9012e37b2 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -47,10 +47,12 @@ void ParallaxBackground::_notification(int p_what) { } } -void ParallaxBackground::_camera_moved(const Transform2D &p_transform) { +void ParallaxBackground::_camera_moved(const Transform2D &p_transform, const Point2 &p_screen_offset) { + + screen_offset = p_screen_offset; set_scroll_scale(p_transform.get_scale().dot(Vector2(0.5, 0.5))); - set_scroll_offset(p_transform.get_origin() / p_transform.get_scale()); + set_scroll_offset(p_transform.get_origin()); } void ParallaxBackground::set_scroll_scale(float p_scale) { @@ -106,9 +108,9 @@ void ParallaxBackground::_update_scroll() { continue; if (ignore_camera_zoom) - l->set_base_offset_and_scale(ofs, 1.0); + l->set_base_offset_and_scale(ofs, 1.0, screen_offset); else - l->set_base_offset_and_scale(ofs, scale); + l->set_base_offset_and_scale(ofs, scale, screen_offset); } } diff --git a/scene/2d/parallax_background.h b/scene/2d/parallax_background.h index 0dad1daeab..e37ec0db99 100644 --- a/scene/2d/parallax_background.h +++ b/scene/2d/parallax_background.h @@ -42,6 +42,7 @@ class ParallaxBackground : public CanvasLayer { float scale; Point2 base_offset; Point2 base_scale; + Point2 screen_offset; String group_name; Point2 limit_begin; Point2 limit_end; @@ -51,7 +52,7 @@ class ParallaxBackground : public CanvasLayer { void _update_scroll(); protected: - void _camera_moved(const Transform2D &p_transform); + void _camera_moved(const Transform2D &p_transform, const Point2 &p_screen_offset); void _notification(int p_what); static void _bind_methods(); diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 8fe651cb5f..4a69841975 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -40,7 +40,7 @@ void ParallaxLayer::set_motion_scale(const Size2 &p_scale) { if (pb && is_inside_tree()) { Vector2 ofs = pb->get_final_offset(); float scale = pb->get_scroll_scale(); - set_base_offset_and_scale(ofs, scale); + set_base_offset_and_scale(ofs, scale, screen_offset); } } @@ -57,7 +57,7 @@ void ParallaxLayer::set_motion_offset(const Size2 &p_offset) { if (pb && is_inside_tree()) { Vector2 ofs = pb->get_final_offset(); float scale = pb->get_scroll_scale(); - set_base_offset_and_scale(ofs, scale); + set_base_offset_and_scale(ofs, scale, screen_offset); } } @@ -106,26 +106,28 @@ void ParallaxLayer::_notification(int p_what) { } } -void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_scale) { +void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_scale, const Point2 &p_screen_offset) { + screen_offset = p_screen_offset; if (!is_inside_tree()) return; if (Engine::get_singleton()->is_editor_hint()) return; - Point2 new_ofs = ((orig_offset + p_offset) * motion_scale) * p_scale + motion_offset; + + Point2 new_ofs = (screen_offset + (p_offset - screen_offset) * motion_scale) + motion_offset * p_scale + orig_offset * p_scale; + + Vector2 mirror = Vector2(1, 1); if (mirroring.x) { - double den = mirroring.x * p_scale; - new_ofs.x -= den * ceil(new_ofs.x / den); + mirror.x = -1; } if (mirroring.y) { - double den = mirroring.y * p_scale; - new_ofs.y -= den * ceil(new_ofs.y / den); + mirror.y = -1; } set_position(new_ofs); - set_scale(Vector2(1, 1) * p_scale); + set_scale(mirror * p_scale * orig_scale); } String ParallaxLayer::get_configuration_warning() const { diff --git a/scene/2d/parallax_layer.h b/scene/2d/parallax_layer.h index 95ca27c41a..6feb1fad67 100644 --- a/scene/2d/parallax_layer.h +++ b/scene/2d/parallax_layer.h @@ -43,6 +43,8 @@ class ParallaxLayer : public Node2D { Vector2 mirroring; void _update_mirroring(); + Point2 screen_offset; + protected: void _notification(int p_what); static void _bind_methods(); @@ -57,7 +59,7 @@ public: void set_mirroring(const Size2 &p_mirroring); Size2 get_mirroring() const; - void set_base_offset_and_scale(const Point2 &p_offset, float p_scale); + void set_base_offset_and_scale(const Point2 &p_offset, float p_scale, const Point2 &p_screen_offset); virtual String get_configuration_warning() const; ParallaxLayer(); |