diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/collision_object_2d.cpp | 10 | ||||
-rw-r--r-- | scene/2d/collision_object_2d.h | 1 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 4 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 4 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 2 | ||||
-rw-r--r-- | scene/gui/gradient_edit.cpp | 5 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 7 | ||||
-rw-r--r-- | scene/gui/range.cpp | 2 | ||||
-rw-r--r-- | scene/gui/tree.h | 2 | ||||
-rw-r--r-- | scene/main/node.cpp | 24 | ||||
-rw-r--r-- | scene/main/node.h | 1 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 2 | ||||
-rw-r--r-- | scene/resources/audio_stream_sample.cpp | 5 | ||||
-rw-r--r-- | scene/resources/material.cpp | 2 | ||||
-rw-r--r-- | scene/resources/material.h | 4 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 6 |
17 files changed, 53 insertions, 30 deletions
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 228b67990c..9f79691405 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -46,8 +46,6 @@ void CollisionObject2D::_notification(int p_what) { else Physics2DServer::get_singleton()->body_set_state(rid, Physics2DServer::BODY_STATE_TRANSFORM, global_transform); - last_transform = global_transform; - RID space = get_world_2d()->get_space(); if (area) { Physics2DServer::get_singleton()->area_set_space(rid, space); @@ -73,19 +71,17 @@ void CollisionObject2D::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - Transform2D global_transform = get_global_transform(); - - if (only_update_transform_changes && global_transform == last_transform) { + if (only_update_transform_changes) { return; } + Transform2D global_transform = get_global_transform(); + if (area) Physics2DServer::get_singleton()->area_set_transform(rid, global_transform); else Physics2DServer::get_singleton()->body_set_state(rid, Physics2DServer::BODY_STATE_TRANSFORM, global_transform); - last_transform = global_transform; - } break; case NOTIFICATION_EXIT_TREE: { diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h index 4e7d01c8e6..0a9d33b8a6 100644 --- a/scene/2d/collision_object_2d.h +++ b/scene/2d/collision_object_2d.h @@ -67,7 +67,6 @@ class CollisionObject2D : public Node2D { int total_subshapes; Map<uint32_t, ShapeData> shapes; - Transform2D last_transform; bool only_update_transform_changes; //this is used for sync physics in KinematicBody protected: diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 173214dfe4..d75d8cfc55 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1233,8 +1233,8 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) { } #endif - int16_t x = decode_uint16(&local[0]); - int16_t y = decode_uint16(&local[2]); + uint16_t x = decode_uint16(&local[0]); + uint16_t y = decode_uint16(&local[2]); uint32_t v = decode_uint32(&local[4]); bool flip_h = v & (1 << 29); bool flip_v = v & (1 << 30); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index ccc87b924c..ce7bb25665 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -386,11 +386,7 @@ void GIProbe::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) { } for (int i = 0; i < p_at_node->get_child_count(); i++) { - Node *child = p_at_node->get_child(i); - if (!child->get_owner()) - continue; //maybe a helper - _find_meshes(child, plot_meshes); } } diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index a7d936fcd3..ce3f2b3b1a 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -63,6 +63,8 @@ void Tween::_add_pending_command(StringName p_key, const Variant &p_arg1, const count = 2; else if (p_arg1.get_type() != Variant::NIL) count = 1; + else + count = 0; // Add the specified arguments to the command // TODO: Make this a switch statement? diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 09ef6f26bf..5958106419 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -277,12 +277,13 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { if (points[i].offset == newofs && i != grabbed) { valid = false; + break; } } - if (!valid) + if (!valid || grabbed == -1) { return; - + } points.write[grabbed].offset = newofs; points.sort(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 7827c66841..ed9fc0ce51 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -819,8 +819,11 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (gn && gn->is_selected()) { Vector2 pos = (gn->get_drag_from() * zoom + drag_accum) / zoom; - if (is_using_snap()) { - int snap = get_snap(); + + // Snapping can be toggled temporarily by holding down Ctrl. + // This is done here as to not toggle the grid when holding down Ctrl. + if (is_using_snap() ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + const int snap = get_snap(); pos = pos.snapped(Vector2(snap, snap)); } diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 9c016b5a50..362697b4ad 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -173,6 +173,8 @@ void Range::set_as_ratio(double p_value) { } double Range::get_as_ratio() const { + ERR_FAIL_COND_V_MSG(Math::is_equal_approx(get_max(), get_min()), 0.0, "Cannot get ratio when minimum and maximum value are equal."); + if (shared->exp_ratio && get_min() >= 0) { double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 361830173b..d5227f6e65 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -159,7 +159,7 @@ protected: //bind helpers Dictionary _get_range_config(int p_column) { Dictionary d; - double min, max, step; + double min = 0.0, max = 0.0, step = 0.0; get_range_config(p_column, min, max, step); d["min"] = min; d["max"] = max; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 217dacfbfe..616ccc00cb 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -835,19 +835,31 @@ bool Node::is_processing_internal() const { void Node::set_process_priority(int p_priority) { data.process_priority = p_priority; - ERR_FAIL_COND(!data.tree); + // Make sure we are in SceneTree. + if (data.tree == NULL) { + return; + } - if (is_processing()) + if (is_processing()) { data.tree->make_group_changed("idle_process"); + } - if (is_processing_internal()) + if (is_processing_internal()) { data.tree->make_group_changed("idle_process_internal"); + } - if (is_physics_processing()) + if (is_physics_processing()) { data.tree->make_group_changed("physics_process"); + } - if (is_physics_processing_internal()) + if (is_physics_processing_internal()) { data.tree->make_group_changed("physics_process_internal"); + } +} + +int Node::get_process_priority() const { + + return data.process_priority; } void Node::set_process_input(bool p_enable) { @@ -2754,6 +2766,7 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("get_process_delta_time"), &Node::get_process_delta_time); ClassDB::bind_method(D_METHOD("set_process", "enable"), &Node::set_process); ClassDB::bind_method(D_METHOD("set_process_priority", "priority"), &Node::set_process_priority); + ClassDB::bind_method(D_METHOD("get_process_priority"), &Node::get_process_priority); ClassDB::bind_method(D_METHOD("is_processing"), &Node::is_processing); ClassDB::bind_method(D_METHOD("set_process_input", "enable"), &Node::set_process_input); ClassDB::bind_method(D_METHOD("is_processing_input"), &Node::is_processing_input); @@ -2894,6 +2907,7 @@ void Node::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_owner", "get_owner"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "", "get_multiplayer"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "custom_multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_custom_multiplayer", "get_custom_multiplayer"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "process_priority"), "set_process_priority", "get_process_priority"); BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta"))); BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta"))); diff --git a/scene/main/node.h b/scene/main/node.h index a8bcd2f273..6d0ff7e5cf 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -350,6 +350,7 @@ public: bool is_processing_internal() const; void set_process_priority(int p_priority); + int get_process_priority() const; void set_process_input(bool p_enable); bool is_processing_input() const; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 78ceccfca2..3a6fff45c5 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -2066,7 +2066,7 @@ SceneTree::SceneTree() { int ref_atlas_subdiv = GLOBAL_DEF("rendering/quality/reflections/atlas_subdiv", 8); ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/reflections/atlas_subdiv", PropertyInfo(Variant::INT, "rendering/quality/reflections/atlas_subdiv", PROPERTY_HINT_RANGE, "0,32,or_greater")); //next_power_of_2 will return a 0 as min value int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0); - ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,External 2x,External 4x")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,AndroidVR 2x,AndroidVR 4x")); root->set_msaa(Viewport::MSAA(msaa_mode)); GLOBAL_DEF("rendering/quality/depth/hdr", true); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 563fcb9961..3ad44a4a2e 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -3187,7 +3187,7 @@ void Viewport::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent_bg"), "set_transparent_background", "has_transparent_background"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "handle_input_locally"), "set_handle_input_locally", "is_handling_input_locally"); ADD_GROUP("Rendering", ""); - ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,External 2x,External 4x"), "set_msaa", "get_msaa"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,AndroidVR 2x,AndroidVR 4x"), "set_msaa", "get_msaa"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hdr"), "set_hdr", "get_hdr"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_3d_linear"), "set_keep_3d_linear", "get_keep_3d_linear"); diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 5b61654c5d..286f9e37cd 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -95,8 +95,8 @@ void AudioStreamPlaybackSample::do_resample(const Depth *p_src, AudioFrame *p_ds // this function will be compiled branchless by any decent compiler int32_t final, final_r, next, next_r; - while (amount--) { - + while (amount) { + amount--; int64_t pos = offset >> MIX_FRAC_BITS; if (is_stereo && !is_ima_adpcm) pos <<= 1; @@ -444,6 +444,7 @@ int AudioStreamSample::get_loop_end() const { void AudioStreamSample::set_mix_rate(int p_hz) { + ERR_FAIL_COND(p_hz == 0); mix_rate = p_hz; } int AudioStreamSample::get_mix_rate() const { diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index fab0aace14..41bf7f4bf0 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1405,8 +1405,8 @@ void SpatialMaterial::set_texture(TextureParam p_param, const Ref<Texture> &p_te textures[p_param] = p_texture; RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID(); VS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid); - _queue_shader_change(); _change_notify(); + _queue_shader_change(); } Ref<Texture> SpatialMaterial::get_texture(TextureParam p_param) const { diff --git a/scene/resources/material.h b/scene/resources/material.h index 2423d6d48b..1c69a754b6 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -260,6 +260,8 @@ private: uint64_t proximity_fade : 1; uint64_t distance_fade : 2; uint64_t emission_op : 1; + uint64_t texture_metallic : 1; + uint64_t texture_roughness : 1; }; uint64_t key; @@ -305,6 +307,8 @@ private: mk.proximity_fade = proximity_fade_enabled; mk.distance_fade = distance_fade; mk.emission_op = emission_op; + mk.texture_metallic = textures[TEXTURE_METALLIC].is_valid() ? 1 : 0; + mk.texture_roughness = textures[TEXTURE_ROUGHNESS].is_valid() ? 1 : 0; return mk; } diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 9ee7c2936e..d56360f918 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -694,6 +694,11 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const { return; } + Rect2 style_rect = p_rect.grow_individual(expand_margin[MARGIN_LEFT], expand_margin[MARGIN_TOP], expand_margin[MARGIN_RIGHT], expand_margin[MARGIN_BOTTOM]); + if (Math::is_zero_approx(style_rect.size.width) || Math::is_zero_approx(style_rect.size.height)) { + return; + } + bool rounded_corners = (corner_radius[0] > 0) || (corner_radius[1] > 0) || (corner_radius[2] > 0) || (corner_radius[3] > 0); bool aa_on = rounded_corners && anti_aliased; @@ -701,7 +706,6 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const { bool blend_on = blend_border && draw_border; - Rect2 style_rect = p_rect.grow_individual(expand_margin[MARGIN_LEFT], expand_margin[MARGIN_TOP], expand_margin[MARGIN_RIGHT], expand_margin[MARGIN_BOTTOM]); Rect2 border_style_rect = style_rect; if (aa_on && !blend_on) { float aa_size_grow = 0.5 * ((aa_size + 1) / 2); |