diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/audio_stream_player_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/navigation2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 2 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 2 | ||||
-rw-r--r-- | scene/3d/navigation.cpp | 2 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 87 | ||||
-rw-r--r-- | scene/animation/animation_player.h | 26 | ||||
-rw-r--r-- | scene/audio/audio_player.cpp | 2 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 30 | ||||
-rw-r--r-- | scene/gui/file_dialog.h | 3 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 27 | ||||
-rw-r--r-- | scene/gui/item_list.h | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 38 | ||||
-rw-r--r-- | scene/gui/video_player.cpp | 3 | ||||
-rw-r--r-- | scene/main/node.cpp | 14 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 18 | ||||
-rw-r--r-- | scene/main/scene_tree.h | 3 | ||||
-rw-r--r-- | scene/resources/bit_mask.cpp | 6 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 6 | ||||
-rw-r--r-- | scene/resources/dynamic_font.cpp | 2 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 2 | ||||
-rw-r--r-- | scene/resources/world.cpp | 4 |
23 files changed, 228 insertions, 57 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 7d5044d97a..937a026e34 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -21,7 +21,7 @@ void AudioStreamPlayer2D::_mix_audio() { } //get data - AudioFrame *buffer = mix_buffer.ptr(); + AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); //mix diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index 74d835dfb2..9eff107827 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -150,7 +150,7 @@ void Navigation2D::_navpoly_unlink(int p_id) { Polygon &p = E->get(); int ec = p.edges.size(); - Polygon::Edge *edges = p.edges.ptr(); + Polygon::Edge *edges = p.edges.ptrw(); for (int i = 0; i < ec; i++) { int next = (i + 1) % ec; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index f8bc27ccf6..2329ce8644 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1500,7 +1500,7 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &TileMap::set_occluder_light_mask); ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &TileMap::get_occluder_light_mask); - ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose", "autotile_coord"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false), DEFVAL(Vector2())); ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &TileMap::get_cell); ClassDB::bind_method(D_METHOD("get_cellv", "position"), &TileMap::get_cellv); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 30b7f36352..6c102e4027 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -21,7 +21,7 @@ void AudioStreamPlayer3D::_mix_audio() { } //get data - AudioFrame *buffer = mix_buffer.ptr(); + AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); //mix diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 8c7d0c23c3..abc4a03498 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -649,7 +649,7 @@ Camera::Camera() { current = false; force_change = false; mode = PROJECTION_PERSPECTIVE; - set_perspective(65.0, 0.1, 100.0); + set_perspective(70.0, 0.05, 100.0); keep_aspect = KEEP_HEIGHT; layers = 0xfffff; v_offset = 0; diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index b226cca02b..b6507aedb3 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -147,7 +147,7 @@ void Navigation::_navmesh_unlink(int p_id) { Polygon &p = E->get(); int ec = p.edges.size(); - Polygon::Edge *edges = p.edges.ptr(); + Polygon::Edge *edges = p.edges.ptrw(); for (int i = 0; i < ec; i++) { int next = (i + 1) % ec; diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 010f5a586f..206f3ccca2 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -33,6 +33,17 @@ #include "message_queue.h" #include "scene/scene_string_names.h" +#ifdef TOOLS_ENABLED +void AnimatedValuesBackup::update_skeletons() { + + for (int i = 0; i < entries.size(); i++) { + if (entries[i].bone_idx != -1) { + Object::cast_to<Skeleton>(entries[i].object)->notification(Skeleton::NOTIFICATION_UPDATE_SKELETON); + } + } +} +#endif + bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; @@ -228,7 +239,11 @@ void AnimationPlayer::_notification(int p_what) { } } -void AnimationPlayer::_generate_node_caches(AnimationData *p_anim) { +void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { + + // Already cached? + if (p_anim->node_cache.size() == p_anim->animation->get_track_count()) + return; Node *parent = get_node(root); @@ -336,11 +351,7 @@ void AnimationPlayer::_generate_node_caches(AnimationData *p_anim) { void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_allow_discrete) { - if (p_anim->node_cache.size() != p_anim->animation->get_track_count()) { - // animation hasn't been "node-cached" - _generate_node_caches(p_anim); - } - + _ensure_node_caches(p_anim); ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count()); Animation *a = p_anim->animation.operator->(); @@ -1205,6 +1216,70 @@ void AnimationPlayer::get_argument_options(const StringName &p_function, int p_i Node::get_argument_options(p_function, p_idx, r_options); } +#ifdef TOOLS_ENABLED +AnimatedValuesBackup AnimationPlayer::backup_animated_values() { + + if (!playback.current.from) + return AnimatedValuesBackup(); + + _ensure_node_caches(playback.current.from); + + AnimatedValuesBackup backup; + + for (int i = 0; i < playback.current.from->node_cache.size(); i++) { + TrackNodeCache *nc = playback.current.from->node_cache[i]; + if (!nc) + continue; + + if (nc->skeleton) { + if (nc->bone_idx == -1) + continue; + + AnimatedValuesBackup::Entry entry; + entry.object = nc->skeleton; + entry.bone_idx = nc->bone_idx; + entry.value = nc->skeleton->get_bone_pose(nc->bone_idx); + backup.entries.push_back(entry); + } else { + if (nc->spatial) { + AnimatedValuesBackup::Entry entry; + entry.object = nc->spatial; + entry.subpath.push_back("transform"); + entry.value = nc->spatial->get_transform(); + entry.bone_idx = -1; + backup.entries.push_back(entry); + } else { + for (Map<StringName, TrackNodeCache::PropertyAnim>::Element *E = nc->property_anim.front(); E; E = E->next()) { + AnimatedValuesBackup::Entry entry; + entry.object = E->value().object; + entry.subpath = E->value().subpath; + bool valid; + entry.value = E->value().object->get_indexed(E->value().subpath, &valid); + entry.bone_idx = -1; + if (valid) + backup.entries.push_back(entry); + } + } + } + } + + return backup; +} + +void AnimationPlayer::restore_animated_values(const AnimatedValuesBackup &p_backup) { + + for (int i = 0; i < p_backup.entries.size(); i++) { + + const AnimatedValuesBackup::Entry *entry = &p_backup.entries[i]; + if (entry->bone_idx == -1) { + entry->object->set_indexed(entry->subpath, entry->value); + } else { + Object::cast_to<Skeleton>(entry->object)->set_bone_pose(entry->bone_idx, entry->value); + } + } +} +#endif + void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationPlayer::_node_removed); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index e4e021c7fe..e39afcf199 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -38,6 +38,24 @@ @author Juan Linietsky <reduzio@gmail.com> */ +#ifdef TOOLS_ENABLED +// To save/restore animated values +class AnimatedValuesBackup { + struct Entry { + Object *object; + Vector<StringName> subpath; // Unused if bone + int bone_idx; // -1 if not a bone + Variant value; + }; + Vector<Entry> entries; + + friend class AnimationPlayer; + +public: + void update_skeletons(); +}; +#endif + class AnimationPlayer : public Node { GDCLASS(AnimationPlayer, Node); OBJ_CATEGORY("Animation Nodes"); @@ -198,7 +216,7 @@ private: void _animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_allow_discrete = true); - void _generate_node_caches(AnimationData *p_anim); + void _ensure_node_caches(AnimationData *p_anim); void _animation_process_data(PlaybackData &cd, float p_delta, float p_blend); void _animation_process2(float p_delta); void _animation_update_transforms(); @@ -291,6 +309,12 @@ public: void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const; +#ifdef TOOLS_ENABLED + // These may be interesting for games, but are too dangerous for general use + AnimatedValuesBackup backup_animated_values(); + void restore_animated_values(const AnimatedValuesBackup &p_backup); +#endif + AnimationPlayer(); ~AnimationPlayer(); }; diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index 08b01c6a4c..81962901d9 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -36,7 +36,7 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) { int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus); //get data - AudioFrame *buffer = mix_buffer.ptr(); + AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); if (p_fadeout) { diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 6aba535572..663a2b390e 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -85,6 +85,10 @@ void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { invalidate(); } break; + case KEY_BACKSPACE: { + + _dir_entered(".."); + } break; default: { handled = false; } } @@ -189,7 +193,7 @@ void FileDialog::_action_pressed() { TreeItem *item = tree->get_selected(); if (item) { Dictionary d = item->get_metadata(0); - if (d["dir"]) { + if (d["dir"] && d["name"] != "..") { path = path.plus_file(d["name"]); } } @@ -272,6 +276,26 @@ void FileDialog::_cancel_pressed() { hide(); } +bool FileDialog::_is_open_should_be_disabled() { + + if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE) + return false; + + TreeItem *ti = tree->get_selected(); + // We have something that we can't select? + if (!ti) + return true; + + Dictionary d = ti->get_metadata(0); + + // Opening a file, but selected a folder? Forbidden. + if (((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || // Flipped case, also forbidden. + (mode == MODE_OPEN_DIR && !d["dir"])) + return true; + + return false; +} + void FileDialog::_tree_selected() { TreeItem *ti = tree->get_selected(); @@ -283,6 +307,8 @@ void FileDialog::_tree_selected() { file->set_text(d["name"]); } + + get_ok()->set_disabled(_is_open_should_be_disabled()); } void FileDialog::_tree_dc_selected() { @@ -563,7 +589,7 @@ void FileDialog::set_mode(Mode p_mode) { makedir->hide(); break; case MODE_OPEN_DIR: - get_ok()->set_text(RTR("Open")); + get_ok()->set_text(RTR("Select Current Folder")); set_title(RTR("Open a Directory")); makedir->show(); break; diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 34cecfe4d0..6281e88731 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -33,7 +33,6 @@ #include "box_container.h" #include "os/dir_access.h" #include "scene/gui/dialogs.h" -#include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" #include "scene/gui/tool_button.h" @@ -117,6 +116,8 @@ private: void _unhandled_input(const Ref<InputEvent> &p_event); + bool _is_open_should_be_disabled(); + virtual void _post_popup(); protected: diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 51ab49e643..197e474fd6 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -257,6 +257,20 @@ void ItemList::unselect(int p_idx) { } update(); } + +void ItemList::unselect_all() { + + if (items.size() < 1) + return; + + for (int i = 0; i < items.size(); i++) { + + items[i].selected = false; + } + + update(); +} + bool ItemList::is_selected(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), false); @@ -530,6 +544,9 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { return; } + + // Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting. + emit_signal("nothing_selected"); } if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) { @@ -1249,6 +1266,15 @@ Vector<int> ItemList::get_selected_items() { return selected; } +bool ItemList::is_anything_selected() { + for (int i = 0; i < items.size(); i++) { + if (items[i].selected) + return true; + } + + return false; +} + void ItemList::_set_items(const Array &p_items) { ERR_FAIL_COND(p_items.size() % 3); @@ -1409,6 +1435,7 @@ void ItemList::_bind_methods() { ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "selected"))); ADD_SIGNAL(MethodInfo("item_activated", PropertyInfo(Variant::INT, "index"))); ADD_SIGNAL(MethodInfo("rmb_clicked", PropertyInfo(Variant::VECTOR2, "at_position"))); + ADD_SIGNAL(MethodInfo("nothing_selected")); GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec", 2000); } diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index ccdd705325..b1e1e5eeb0 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -156,8 +156,10 @@ public: void select(int p_idx, bool p_single = true); void unselect(int p_idx); + void unselect_all(); bool is_selected(int p_idx) const; Vector<int> get_selected_items(); + bool is_anything_selected(); void set_current(int p_current); int get_current() const; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index b5e809fd03..166b55d6f3 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1712,12 +1712,12 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co rows -= cache.style_normal->get_margin(MARGIN_TOP); rows /= get_row_height(); int lsp = get_line_scroll_pos(true); - int row = cursor.line_ofs + (rows + (v_scroll->get_value() - lsp)); + int row = cursor.line_ofs + (rows + (round(v_scroll->get_value()) - lsp)); if (is_hiding_enabled()) { // row will be offset by the hidden rows int f_ofs = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(rows + 1, text.size() - cursor.line_ofs)) - 1; - row = cursor.line_ofs + (f_ofs + (v_scroll->get_value() - lsp)); + row = cursor.line_ofs + (f_ofs + (round(v_scroll->get_value()) - lsp)); row = CLAMP(row, 0, text.size() - num_lines_from(text.size() - 1, -1)); } @@ -3475,11 +3475,13 @@ void TextEdit::adjust_viewport_to_cursor() { int num_rows = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(visible_rows, text.size() - 1 - cursor.line_ofs)); // make sure the cursor is on the screen + // above the caret if (cursor.line > (cursor.line_ofs + MAX(num_rows, visible_rows))) { cursor.line_ofs = cursor.line - num_lines_from(cursor.line, -visible_rows) + 1; } - if (cursor.line < cursor.line_ofs) { - cursor.line_ofs = cursor.line; + // below the caret + if (cursor.line_ofs == cursor.line) { + cursor.line_ofs = cursor.line - 2; } int line_ofs_max = text.size() - 1; if (!scroll_past_end_of_file_enabled) { @@ -3499,17 +3501,17 @@ void TextEdit::adjust_viewport_to_cursor() { if (cursor_x < cursor.x_ofs) cursor.x_ofs = cursor_x; + updating_scrolls = true; h_scroll->set_value(cursor.x_ofs); update_line_scroll_pos(); - v_scroll->set_value(get_line_scroll_pos()); + double new_v_scroll = get_line_scroll_pos(); + // keep offset if smooth scroll is enabled + if (smooth_scroll_enabled) { + new_v_scroll += fmod(v_scroll->get_value(), 1.0); + } + v_scroll->set_value(new_v_scroll); + updating_scrolls = false; update(); - /* - get_range()->set_max(text.size()); - - get_range()->set_page(get_visible_rows()); - - get_range()->set((int)cursor.line_ofs); -*/ } void TextEdit::center_viewport_to_cursor() { @@ -3540,10 +3542,16 @@ void TextEdit::center_viewport_to_cursor() { if (cursor_x < cursor.x_ofs) cursor.x_ofs = cursor_x; + updating_scrolls = true; h_scroll->set_value(cursor.x_ofs); update_line_scroll_pos(); - v_scroll->set_value(get_line_scroll_pos()); - + double new_v_scroll = get_line_scroll_pos(); + // keep offset if smooth scroll is enabled + if (smooth_scroll_enabled) { + new_v_scroll += fmod(v_scroll->get_value(), 1.0); + } + v_scroll->set_value(new_v_scroll); + updating_scrolls = false; update(); } @@ -3666,7 +3674,7 @@ void TextEdit::_scroll_moved(double p_to_val) { cursor.x_ofs = h_scroll->get_value(); if (v_scroll->is_visible_in_tree()) { double val = v_scroll->get_value(); - cursor.line_ofs = num_lines_from(0, (int)floor(val)) - 1; + cursor.line_ofs = num_lines_from(0, (int)floor(val)); line_scroll_pos = (int)floor(val); } update(); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 1b6bd30b58..8f567f9796 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -84,7 +84,7 @@ void VideoPlayer::_mix_audio() { return; } - AudioFrame *buffer = mix_buffer.ptr(); + AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); // Resample @@ -490,6 +490,7 @@ VideoPlayer::VideoPlayer() { expand = true; audio_track = 0; + bus_index = 0; buffering_ms = 500; server_mix_rate = 44100; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 31d423c808..d8baa7834d 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1198,7 +1198,7 @@ void Node::_validate_child_name(Node *p_child, bool p_force_human_readable) { unique = false; } else { //check if exists - Node **childs = data.children.ptr(); + Node **childs = data.children.ptrw(); int cc = data.children.size(); for (int i = 0; i < cc; i++) { @@ -2114,8 +2114,16 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const node_tree.push_front(this); if (instanced) { + // Since nodes in the instanced hierarchy won't be duplicated explicitly, we need to make an inventory + // of all the nodes in the tree of the instanced scene in order to transfer the values of the properties + for (List<const Node *>::Element *N = node_tree.front(); N; N = N->next()) { for (int i = 0; i < N->get()->get_child_count(); ++i) { + + // Skip nodes not really belonging to the instanced hierarchy; they'll be processed normally later + if (get_child(i)->data.owner != this) + continue; + node_tree.push_back(N->get()->get_child(i)); } } @@ -2124,6 +2132,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const for (List<const Node *>::Element *N = node_tree.front(); N; N = N->next()) { Node *current_node = node->get_node(get_path_to(N->get())); + ERR_CONTINUE(!current_node); if (p_flags & DUPLICATE_SCRIPTS) { bool is_valid = false; @@ -2136,9 +2145,6 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const List<PropertyInfo> plist; N->get()->get_property_list(&plist); - if (!current_node) - continue; - for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) { if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index d4be683a2b..f74bf161f0 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -127,7 +127,7 @@ void SceneTree::remove_from_group(const StringName &p_group, Node *p_node) { group_map.erase(E); } -void SceneTree::_flush_transform_notifications() { +void SceneTree::flush_transform_notifications() { SelfList<Node> *n = xform_change_list.first(); while (n) { @@ -448,7 +448,7 @@ bool SceneTree::iteration(float p_time) { current_frame++; - _flush_transform_notifications(); + flush_transform_notifications(); MainLoop::iteration(p_time); physics_process_time = p_time; @@ -459,7 +459,7 @@ bool SceneTree::iteration(float p_time) { _notify_group_pause("physics_process", Node::NOTIFICATION_PHYSICS_PROCESS); _flush_ugc(); MessageQueue::get_singleton()->flush(); //small little hack - _flush_transform_notifications(); + flush_transform_notifications(); call_group_flags(GROUP_CALL_REALTIME, "_viewports", "update_worlds"); root_lock--; @@ -487,7 +487,7 @@ bool SceneTree::idle(float p_time) { MessageQueue::get_singleton()->flush(); //small little hack - _flush_transform_notifications(); + flush_transform_notifications(); _notify_group_pause("idle_process_internal", Node::NOTIFICATION_INTERNAL_PROCESS); _notify_group_pause("idle_process", Node::NOTIFICATION_PROCESS); @@ -503,7 +503,7 @@ bool SceneTree::idle(float p_time) { _flush_ugc(); MessageQueue::get_singleton()->flush(); //small little hack - _flush_transform_notifications(); //transforms after world update, to avoid unnecessary enter/exit notifications + flush_transform_notifications(); //transforms after world update, to avoid unnecessary enter/exit notifications call_group_flags(GROUP_CALL_REALTIME, "_viewports", "update_worlds"); root_lock--; @@ -1001,7 +1001,7 @@ Array SceneTree::_get_nodes_in_group(const StringName &p_group) { ret.resize(nc); - Node **ptr = E->get().nodes.ptr(); + Node **ptr = E->get().nodes.ptrw(); for (int i = 0; i < nc; i++) { ret[i] = ptr[i]; @@ -1024,7 +1024,7 @@ void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_li int nc = E->get().nodes.size(); if (nc == 0) return; - Node **ptr = E->get().nodes.ptr(); + Node **ptr = E->get().nodes.ptrw(); for (int i = 0; i < nc; i++) { p_list->push_back(ptr[i]); @@ -1997,9 +1997,9 @@ void SceneTree::_network_process_packet(int p_from, const uint8_t *p_packet, int Variant::CallError ce; - node->call(name, argp.ptr(), argc, ce); + node->call(name, (const Variant **)argp.ptr(), argc, ce); if (ce.error != Variant::CallError::CALL_OK) { - String error = Variant::get_call_error_text(node, name, argp.ptr(), argc, ce); + String error = Variant::get_call_error_text(node, name, (const Variant **)argp.ptr(), argc, ce); error = "RPC - " + error; ERR_PRINTS(error); } diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index bc3efdc42f..7898dc065a 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -157,7 +157,6 @@ private: Map<UGCall, Vector<Variant> > unique_group_calls; bool ugc_locked; void _flush_ugc(); - void _flush_transform_notifications(); _FORCE_INLINE_ void _update_group_order(Group &g); void _update_listener(); @@ -344,6 +343,8 @@ public: void notify_group(const StringName &p_group, int p_notification); void set_group(const StringName &p_group, const String &p_name, const Variant &p_value); + void flush_transform_notifications(); + virtual void input_text(const String &p_text); virtual void input_event(const Ref<InputEvent> &p_event); virtual void init(); diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index 029a9ef0e8..eebc872dfb 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -38,7 +38,7 @@ void BitMap::create(const Size2 &p_size) { width = p_size.width; height = p_size.height; bitmask.resize(((width * height) / 8) + 1); - zeromem(bitmask.ptr(), bitmask.size()); + zeromem(bitmask.ptrw(), bitmask.size()); } void BitMap::create_from_image_alpha(const Ref<Image> &p_image) { @@ -51,7 +51,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image) { create(Size2(img->get_width(), img->get_height())); PoolVector<uint8_t>::Read r = img->get_data().read(); - uint8_t *w = bitmask.ptr(); + uint8_t *w = bitmask.ptrw(); for (int i = 0; i < width * height; i++) { @@ -65,7 +65,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image) { void BitMap::set_bit_rect(const Rect2 &p_rect, bool p_value) { Rect2i current = Rect2i(0, 0, width, height).clip(p_rect); - uint8_t *data = bitmask.ptr(); + uint8_t *data = bitmask.ptrw(); for (int i = current.position.x; i < current.position.x + current.size.x; i++) { diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index cd28c9d203..36988e0c4c 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -310,7 +310,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("pressed", "OptionButton", sb_optbutton_pressed); theme->set_stylebox("hover", "OptionButton", sb_optbutton_hover); theme->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled); - theme->set_stylebox("focus", "OptionButton", sb_button_focus); + theme->set_stylebox("focus", "OptionButton", sb_optbutton_focus); theme->set_icon("arrow", "OptionButton", make_icon(option_arrow_png)); @@ -328,8 +328,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_stylebox("normal", "MenuButton", sb_button_normal); theme->set_stylebox("pressed", "MenuButton", sb_button_pressed); - theme->set_stylebox("hover", "MenuButton", sb_button_pressed); - theme->set_stylebox("disabled", "MenuButton", make_empty_stylebox(0, 0, 0, 0)); + theme->set_stylebox("hover", "MenuButton", sb_button_hover); + theme->set_stylebox("disabled", "MenuButton", sb_button_disabled); theme->set_stylebox("focus", "MenuButton", sb_button_focus); theme->set_font("font", "MenuButton", default_font); diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 48c6add586..a40417f24d 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -125,7 +125,7 @@ Error DynamicFontAtSize::_load() { _fontdata[font->font_path] = Vector<uint8_t>(); Vector<uint8_t> &fontdata = _fontdata[font->font_path]; fontdata.resize(len); - f->get_buffer(fontdata.ptr(), len); + f->get_buffer(fontdata.ptrw(), len); font->set_font_ptr(fontdata.ptr(), len); f->close(); } diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 657d5f6c80..6fab597d2b 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -913,7 +913,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform); ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way); ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way); - ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way"), &TileSet::tile_add_shape, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &TileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2())); ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count); ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes); ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes); diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index 86b32a5cdd..c63ba24cbd 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -159,9 +159,9 @@ struct SpatialIndexer { Vector<Plane> planes = c->get_frustum(); - int culled = octree.cull_convex(planes, cull.ptr(), cull.size()); + int culled = octree.cull_convex(planes, cull.ptrw(), cull.size()); - VisibilityNotifier **ptr = cull.ptr(); + VisibilityNotifier **ptr = cull.ptrw(); List<VisibilityNotifier *> added; List<VisibilityNotifier *> removed; |