diff options
-rw-r--r-- | doc/classes/Camera.xml | 4 | ||||
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 2 | ||||
-rw-r--r-- | editor/editor_data.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 25 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 1 | ||||
-rw-r--r-- | editor/multi_node_edit.cpp | 16 | ||||
-rw-r--r-- | editor/multi_node_edit.h | 3 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 8 | ||||
-rw-r--r-- | modules/etc/texture_loader_pkm.cpp | 2 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 2 | ||||
-rw-r--r-- | modules/webm/video_stream_webm.cpp | 2 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.h | 2 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 2 | ||||
-rw-r--r-- | scene/3d/camera.h | 2 | ||||
-rw-r--r-- | scene/gui/range.cpp | 1 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 1 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 9 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 45 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_record.cpp | 1 |
20 files changed, 102 insertions, 29 deletions
diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml index d410800141..3b4313b204 100644 --- a/doc/classes/Camera.xml +++ b/doc/classes/Camera.xml @@ -77,10 +77,10 @@ </return> <argument index="0" name="screen_point" type="Vector2"> </argument> - <argument index="1" name="z_depth" type="float" default="0"> + <argument index="1" name="z_depth" type="float"> </argument> <description> - Returns the 3D point in worldspace that maps to the given 2D coordinate in the [Viewport] rectangle on a plane that is the given distance into the scene away from the camera. + Returns the 3D point in worldspace that maps to the given 2D coordinate in the [Viewport] rectangle on a plane that is the given [code]z_depth[/code] distance into the scene away from the camera. </description> </method> <method name="project_ray_normal" qualifiers="const"> diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index fb21c0c5a1..4dc1b74310 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -96,7 +96,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { if (p_mode_flags == READ) { WIN32_FIND_DATAW d; HANDLE f = FindFirstFileW(path.c_str(), &d); - if (f) { + if (f != INVALID_HANDLE_VALUE) { String fname = d.cFileName; if (fname != String()) { diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 4855d3f69d..1cafd1d1f4 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -820,7 +820,7 @@ void EditorData::save_edited_scene_state(EditorSelection *p_selection, EditorHis ERR_FAIL_INDEX(current_edited_scene, edited_scene.size()); EditedScene &es = edited_scene.write[current_edited_scene]; - es.selection = p_selection->get_selected_node_list(); + es.selection = p_selection->get_full_selected_node_list(); es.history_current = p_history->current; es.history_stored = p_history->history; es.editor_states = get_editor_states(); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 178871ccfa..0e373a5deb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -71,6 +71,7 @@ #include "editor/import/resource_importer_texture.h" #include "editor/import/resource_importer_texture_atlas.h" #include "editor/import/resource_importer_wav.h" +#include "editor/multi_node_edit.h" #include "editor/plugins/animation_blend_space_1d_editor.h" #include "editor/plugins/animation_blend_space_2d_editor.h" #include "editor/plugins/animation_blend_tree_editor_plugin.h" @@ -1742,15 +1743,37 @@ void EditorNode::_edit_current() { } else { + Node *selected_node = NULL; + if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) { editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); capitalize = false; disable_folding = true; + } else if (current_obj->is_class("MultiNodeEdit")) { + Node *scene = get_edited_scene(); + if (scene) { + MultiNodeEdit *multi_node_edit = Object::cast_to<MultiNodeEdit>(current_obj); + int node_count = multi_node_edit->get_node_count(); + if (node_count > 0) { + List<Node *> multi_nodes; + for (int node_index = 0; node_index < node_count; ++node_index) { + Node *node = scene->get_node(multi_node_edit->get_node(node_index)); + if (node) { + multi_nodes.push_back(node); + } + } + if (!multi_nodes.empty()) { + // Pick the top-most node + multi_nodes.sort_custom<Node::Comparator>(); + selected_node = multi_nodes.front()->get(); + } + } + } } get_inspector()->edit(current_obj); node_dock->set_node(NULL); - scene_tree_dock->set_selected(NULL); + scene_tree_dock->set_selected(selected_node); inspector_dock->update(NULL); } diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 55f9347045..e383dadfb0 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -207,6 +207,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< f->store_line(itos(has_small_texture)); f->store_line(itos(FileAccess::get_modified_time(p_item.path))); f->store_line(FileAccess::get_md5(p_item.path)); + f->close(); memdelete(f); } } diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp index 85e47594a8..0792d5c95f 100644 --- a/editor/multi_node_edit.cpp +++ b/editor/multi_node_edit.cpp @@ -34,12 +34,10 @@ #include "editor_node.h" bool MultiNodeEdit::_set(const StringName &p_name, const Variant &p_value) { - return _set_impl(p_name, p_value, ""); } bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, const String &p_field) { - Node *es = EditorNode::get_singleton()->get_edited_scene(); if (!es) return false; @@ -88,7 +86,6 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, } bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const { - Node *es = EditorNode::get_singleton()->get_edited_scene(); if (!es) return false; @@ -117,7 +114,6 @@ bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const { } void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { - HashMap<String, PLData> usage; Node *es = EditorNode::get_singleton()->get_edited_scene(); @@ -171,17 +167,23 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { } void MultiNodeEdit::clear_nodes() { - nodes.clear(); } void MultiNodeEdit::add_node(const NodePath &p_node) { - nodes.push_back(p_node); } -void MultiNodeEdit::set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field) { +int MultiNodeEdit::get_node_count() const { + return nodes.size(); +} +NodePath MultiNodeEdit::get_node(int p_index) const { + ERR_FAIL_INDEX_V(p_index, nodes.size(), NodePath()); + return nodes[p_index]; +} + +void MultiNodeEdit::set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field) { _set_impl(p_property, p_value, p_field); } diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index b9192b206a..33df4a2ca5 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -54,6 +54,9 @@ public: void clear_nodes(); void add_node(const NodePath &p_node); + int get_node_count() const; + NodePath get_node(int p_index) const; + void set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field); MultiNodeEdit(); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c9dde5d54d..1b263fa4f6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5247,6 +5247,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { snap_other_nodes = true; snap_guides = true; snap_rotation = false; + snap_scale = false; snap_relative = false; snap_pixel = false; snap_target[0] = SNAP_TARGET_NONE; diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 8acc41a2c7..007ce58bd7 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -103,9 +103,11 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 img = ltex->to_image(); } else { Ref<Texture> tex = p_from; - img = tex->get_data(); - if (img.is_valid()) { - img = img->duplicate(); + if (tex.is_valid()) { + img = tex->get_data(); + if (img.is_valid()) { + img = img->duplicate(); + } } } diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp index 4d8af6883f..da6da74025 100644 --- a/modules/etc/texture_loader_pkm.cpp +++ b/modules/etc/texture_loader_pkm.cpp @@ -91,6 +91,8 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, if (r_error) *r_error = OK; + f->close(); + memdelete(f); return texture; } diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index ed1a7f682b..12f07aa773 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -741,6 +741,8 @@ RES ResourceFormatLoaderTheora::load(const String &p_path, const String &p_origi *r_error = OK; } + f->close(); + memdelete(f); return ogv_stream; } diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 4ce0db3746..54b284f939 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -484,6 +484,8 @@ RES ResourceFormatLoaderWebm::load(const String &p_path, const String &p_origina *r_error = OK; } + f->close(); + memdelete(f); return webm_stream; } diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index 8e735f7110..b647df70aa 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -55,7 +55,7 @@ public: virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const; virtual Point2 unproject_position(const Vector3 &p_pos) const; - virtual Vector3 project_position(const Point2 &p_point, float p_z_depth = 0) const; + virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const; virtual Vector<Plane> get_frustum() const; ARVRCamera(); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 9797b5f3ab..4d9bb69778 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -486,7 +486,7 @@ void Camera::_bind_methods() { ClassDB::bind_method(D_METHOD("project_ray_origin", "screen_point"), &Camera::project_ray_origin); ClassDB::bind_method(D_METHOD("unproject_position", "world_point"), &Camera::unproject_position); ClassDB::bind_method(D_METHOD("is_position_behind", "world_point"), &Camera::is_position_behind); - ClassDB::bind_method(D_METHOD("project_position", "screen_point", "z_depth"), &Camera::project_position, DEFVAL(0)); + ClassDB::bind_method(D_METHOD("project_position", "screen_point", "z_depth"), &Camera::project_position); ClassDB::bind_method(D_METHOD("set_perspective", "fov", "z_near", "z_far"), &Camera::set_perspective); ClassDB::bind_method(D_METHOD("set_orthogonal", "size", "z_near", "z_far"), &Camera::set_orthogonal); ClassDB::bind_method(D_METHOD("set_frustum", "size", "offset", "z_near", "z_far"), &Camera::set_frustum); diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 22223880c1..d81e097fc5 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -142,7 +142,7 @@ public: virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const; virtual Point2 unproject_position(const Vector3 &p_pos) const; bool is_position_behind(const Vector3 &p_pos) const; - virtual Vector3 project_position(const Point2 &p_point, float p_z_depth = 0) const; + virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const; Vector<Vector3> get_near_plane_points() const; diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index ed5dd77f53..9c016b5a50 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -213,6 +213,7 @@ void Range::unshare() { nshared->val = shared->val; nshared->step = shared->step; nshared->page = shared->page; + nshared->exp_ratio = shared->exp_ratio; nshared->allow_greater = shared->allow_greater; nshared->allow_lesser = shared->allow_lesser; _unref_shared(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 2c38676c83..a44b42a467 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -4049,6 +4049,7 @@ Tree::Tree() { drop_mode_section = 0; single_select_defer = NULL; + scrolling = false; allow_rmb_select = false; force_edit_checkbox_only_on_checkbox = false; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index c2e2f85723..593c399f62 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2369,16 +2369,20 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String if (header[0] == 'G' && header[1] == 'D' && header[2] == '3' && header[3] == 'T') { if (tex3d.is_null()) { + f->close(); memdelete(f); ERR_FAIL_COND_V(tex3d.is_null(), RES()) } } else if (header[0] == 'G' && header[1] == 'D' && header[2] == 'A' && header[3] == 'T') { if (texarr.is_null()) { + f->close(); memdelete(f); ERR_FAIL_COND_V(texarr.is_null(), RES()) } } else { + f->close(); + memdelete(f); ERR_FAIL_V_MSG(RES(), "Unrecognized layered texture file format '" + String((const char *)header) + "'."); } @@ -2418,6 +2422,7 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String if (r_error) { *r_error = ERR_FILE_CORRUPT; } + f->close(); memdelete(f); ERR_FAIL_V(RES()); } @@ -2453,6 +2458,7 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String if (r_error) { *r_error = ERR_FILE_CORRUPT; } + f->close(); memdelete(f); ERR_FAIL_V(RES()); } @@ -2473,8 +2479,9 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String if (bytes != total_size) { if (r_error) { *r_error = ERR_FILE_CORRUPT; - memdelete(f); } + f->close(); + memdelete(f); ERR_FAIL_V(RES()); } } diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 24122a8d99..16a95e65a8 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -148,20 +148,45 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { } } } else if (what == "shape") - for (int i = 0; i < tile_get_shape_count(id); i++) - tile_set_shape(id, i, p_value); + if (tile_get_shape_count(id) > 0) { + for (int i = 0; i < tile_get_shape_count(id); i++) { + tile_set_shape(id, i, p_value); + } + } else { + tile_set_shape(id, 0, p_value); + } else if (what == "shape_offset") - for (int i = 0; i < tile_get_shape_count(id); i++) - tile_set_shape_offset(id, i, p_value); + if (tile_get_shape_count(id) > 0) { + for (int i = 0; i < tile_get_shape_count(id); i++) { + tile_set_shape_offset(id, i, p_value); + } + } else { + tile_set_shape_offset(id, 0, p_value); + } else if (what == "shape_transform") - for (int i = 0; i < tile_get_shape_count(id); i++) - tile_set_shape_transform(id, i, p_value); + if (tile_get_shape_count(id) > 0) { + for (int i = 0; i < tile_get_shape_count(id); i++) { + tile_set_shape_transform(id, i, p_value); + } + } else { + tile_set_shape_transform(id, 0, p_value); + } else if (what == "shape_one_way") - for (int i = 0; i < tile_get_shape_count(id); i++) - tile_set_shape_one_way(id, i, p_value); + if (tile_get_shape_count(id) > 0) { + for (int i = 0; i < tile_get_shape_count(id); i++) { + tile_set_shape_one_way(id, i, p_value); + } + } else { + tile_set_shape_one_way(id, 0, p_value); + } else if (what == "shape_one_way_margin") - for (int i = 0; i < tile_get_shape_count(id); i++) - tile_set_shape_one_way_margin(id, i, p_value); + if (tile_get_shape_count(id) > 0) { + for (int i = 0; i < tile_get_shape_count(id); i++) { + tile_set_shape_one_way_margin(id, i, p_value); + } + } else { + tile_set_shape_one_way_margin(id, 0, p_value); + } else if (what == "shapes") _tile_set_shapes(id, p_value); else if (what == "occluder") diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index 1390ab55c4..83d78daff4 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -297,4 +297,5 @@ void AudioEffectRecord::_bind_methods() { AudioEffectRecord::AudioEffectRecord() { format = AudioStreamSample::FORMAT_16_BITS; + recording_active = false; } |