summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/audio_stream_player_2d.cpp2
-rw-r--r--scene/2d/joint_2d.cpp5
-rw-r--r--scene/2d/parallax_layer.cpp4
-rw-r--r--scene/2d/tile_map.cpp42
-rw-r--r--scene/2d/tile_map.h3
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/camera_3d.cpp19
-rw-r--r--scene/3d/camera_3d.h8
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp2
-rw-r--r--scene/3d/node_3d.cpp13
-rw-r--r--scene/3d/node_3d.h4
-rw-r--r--scene/3d/proximity_group_3d.cpp10
-rw-r--r--scene/3d/skeleton_3d.cpp83
-rw-r--r--scene/3d/skeleton_3d.h8
-rw-r--r--scene/3d/soft_dynamic_body_3d.cpp5
-rw-r--r--scene/3d/soft_dynamic_body_3d.h2
-rw-r--r--scene/3d/voxel_gi.cpp2
-rw-r--r--scene/3d/voxelizer.cpp3
-rw-r--r--scene/audio/audio_stream_player.cpp2
-rw-r--r--scene/gui/button.cpp20
-rw-r--r--scene/gui/button.h6
-rw-r--r--scene/gui/code_edit.cpp7
-rw-r--r--scene/gui/code_edit.h1
-rw-r--r--scene/gui/color_picker.cpp4
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/gui/line_edit.cpp4
-rw-r--r--scene/gui/spin_box.cpp18
-rw-r--r--scene/gui/spin_box.h4
-rw-r--r--scene/gui/tabs.cpp4
-rw-r--r--scene/gui/text_edit.cpp64
-rw-r--r--scene/gui/text_edit.h18
-rw-r--r--scene/main/http_request.cpp2
-rw-r--r--scene/main/node.cpp6
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/scene_tree.cpp6
-rw-r--r--scene/main/timer.cpp11
-rw-r--r--scene/main/timer.h2
-rw-r--r--scene/main/viewport.cpp50
-rw-r--r--scene/main/viewport.h15
-rw-r--r--scene/resources/environment.cpp19
-rw-r--r--scene/resources/environment.h3
-rw-r--r--scene/resources/font.cpp6
-rw-r--r--scene/resources/importer_mesh.cpp45
-rw-r--r--scene/resources/importer_mesh.h1
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/skeleton_modification_stack_2d.cpp2
-rw-r--r--scene/resources/skeleton_modification_stack_3d.cpp2
-rw-r--r--scene/resources/sky_material.cpp14
-rw-r--r--scene/resources/tile_set.cpp11
-rw-r--r--scene/resources/tile_set.h1
-rw-r--r--scene/scene_string_names.cpp3
-rw-r--r--scene/scene_string_names.h3
52 files changed, 340 insertions, 237 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index bddc342c1a..18a50ae098 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -68,7 +68,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
active.set();
Ref<AudioStreamPlayback> new_playback = stream->instance_playback();
ERR_FAIL_COND_MSG(new_playback.is_null(), "Failed to instantiate playback.");
- AudioServer::get_singleton()->start_playback_stream(new_playback, _get_actual_bus(), volume_vector, setplay.get());
+ AudioServer::get_singleton()->start_playback_stream(new_playback, _get_actual_bus(), volume_vector, setplay.get(), pitch_scale);
stream_playbacks.push_back(new_playback);
setplay.set(-1);
}
diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp
index 3b371d4a07..8a528151cf 100644
--- a/scene/2d/joint_2d.cpp
+++ b/scene/2d/joint_2d.cpp
@@ -74,6 +74,8 @@ void Joint2D::_update_joint(bool p_only_free) {
PhysicsBody2D *body_a = Object::cast_to<PhysicsBody2D>(node_a);
PhysicsBody2D *body_b = Object::cast_to<PhysicsBody2D>(node_b);
+ bool valid = false;
+
if (node_a && !body_a && node_b && !body_b) {
warning = TTR("Node A and Node B must be PhysicsBody2Ds");
} else if (node_a && !body_a) {
@@ -86,11 +88,12 @@ void Joint2D::_update_joint(bool p_only_free) {
warning = TTR("Node A and Node B must be different PhysicsBody2Ds");
} else {
warning = String();
+ valid = true;
}
update_configuration_warnings();
- if (!warning.is_empty()) {
+ if (!valid) {
PhysicsServer2D::get_singleton()->joint_clear(joint);
return;
}
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index 67e35cc7a3..797e2e59cb 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -123,12 +123,12 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, real_t p_s
Point2 new_ofs = (screen_offset + (p_offset - screen_offset) * motion_scale) + motion_offset * p_scale + orig_offset * p_scale;
if (mirroring.x) {
- double den = mirroring.x * p_scale;
+ real_t den = mirroring.x * p_scale;
new_ofs.x -= den * ceil(new_ofs.x / den);
}
if (mirroring.y) {
- double den = mirroring.y * p_scale;
+ real_t den = mirroring.y * p_scale;
new_ofs.y -= den * ceil(new_ofs.y / den);
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 222ec986b0..a791d99c39 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -409,6 +409,19 @@ bool TileMap::is_layer_enabled(int p_layer) const {
return layers[p_layer].enabled;
}
+void TileMap::set_layer_modulate(int p_layer, Color p_modulate) {
+ ERR_FAIL_INDEX(p_layer, (int)layers.size());
+ layers[p_layer].modulate = p_modulate;
+ _clear_internals();
+ _recreate_internals();
+ emit_signal(SNAME("changed"));
+}
+
+Color TileMap::get_layer_modulate(int p_layer) const {
+ ERR_FAIL_INDEX_V(p_layer, (int)layers.size(), Color());
+ return layers[p_layer].modulate;
+}
+
void TileMap::set_layer_y_sort_enabled(int p_layer, bool p_y_sort_enabled) {
ERR_FAIL_INDEX(p_layer, (int)layers.size());
layers[p_layer].y_sort_enabled = p_y_sort_enabled;
@@ -832,6 +845,17 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
int prev_z_index = 0;
RID prev_canvas_item;
+ Color modulate = get_self_modulate();
+ modulate *= get_layer_modulate(q.layer);
+ if (selected_layer >= 0) {
+ if (q.layer < selected_layer) {
+ modulate = modulate.darkened(0.5);
+ } else if (q.layer > selected_layer) {
+ modulate = modulate.darkened(0.5);
+ modulate.a *= 0.3;
+ }
+ }
+
// Iterate over the cells of the quadrant.
for (const KeyValue<Vector2i, Vector2i> &E_cell : q.world_to_map) {
TileMapCell c = get_cell(q.layer, E_cell.value, true);
@@ -894,15 +918,6 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
}
// Drawing the tile in the canvas item.
- Color modulate = get_self_modulate();
- if (selected_layer >= 0) {
- if (q.layer < selected_layer) {
- modulate = modulate.darkened(0.5);
- } else if (q.layer > selected_layer) {
- modulate = modulate.darkened(0.5);
- modulate.a *= 0.3;
- }
- }
draw_tile(canvas_item, E_cell.key - position, tile_set, c.source_id, c.get_atlas_coords(), c.alternative_tile, -1, modulate);
// --- Occluders ---
@@ -2083,6 +2098,9 @@ bool TileMap::_set(const StringName &p_name, const Variant &p_value) {
} else if (components[1] == "enabled") {
set_layer_enabled(index, p_value);
return true;
+ } else if (components[1] == "modulate") {
+ set_layer_modulate(index, p_value);
+ return true;
} else if (components[1] == "y_sort_enabled") {
set_layer_y_sort_enabled(index, p_value);
return true;
@@ -2119,6 +2137,9 @@ bool TileMap::_get(const StringName &p_name, Variant &r_ret) const {
} else if (components[1] == "enabled") {
r_ret = is_layer_enabled(index);
return true;
+ } else if (components[1] == "modulate") {
+ r_ret = get_layer_modulate(index);
+ return true;
} else if (components[1] == "y_sort_enabled") {
r_ret = is_layer_y_sort_enabled(index);
return true;
@@ -2144,6 +2165,7 @@ void TileMap::_get_property_list(List<PropertyInfo> *p_list) const {
for (unsigned int i = 0; i < layers.size(); i++) {
p_list->push_back(PropertyInfo(Variant::STRING, vformat("layer_%d/name", i), PROPERTY_HINT_NONE));
p_list->push_back(PropertyInfo(Variant::BOOL, vformat("layer_%d/enabled", i), PROPERTY_HINT_NONE));
+ p_list->push_back(PropertyInfo(Variant::COLOR, vformat("layer_%d/modulate", i), PROPERTY_HINT_NONE));
p_list->push_back(PropertyInfo(Variant::BOOL, vformat("layer_%d/y_sort_enabled", i), PROPERTY_HINT_NONE));
p_list->push_back(PropertyInfo(Variant::INT, vformat("layer_%d/y_sort_origin", i), PROPERTY_HINT_NONE));
p_list->push_back(PropertyInfo(Variant::INT, vformat("layer_%d/z_index", i), PROPERTY_HINT_NONE));
@@ -3027,6 +3049,8 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_layer_name", "layer"), &TileMap::get_layer_name);
ClassDB::bind_method(D_METHOD("set_layer_enabled", "layer", "enabled"), &TileMap::set_layer_enabled);
ClassDB::bind_method(D_METHOD("is_layer_enabled", "layer"), &TileMap::is_layer_enabled);
+ ClassDB::bind_method(D_METHOD("set_layer_modulate", "layer", "enabled"), &TileMap::set_layer_modulate);
+ ClassDB::bind_method(D_METHOD("get_layer_modulate", "layer"), &TileMap::get_layer_modulate);
ClassDB::bind_method(D_METHOD("set_layer_y_sort_enabled", "layer", "y_sort_enabled"), &TileMap::set_layer_y_sort_enabled);
ClassDB::bind_method(D_METHOD("is_layer_y_sort_enabled", "layer"), &TileMap::is_layer_y_sort_enabled);
ClassDB::bind_method(D_METHOD("set_layer_y_sort_origin", "layer", "y_sort_origin"), &TileMap::set_layer_y_sort_origin);
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 2faede2445..b1fbdfdf8a 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -219,6 +219,7 @@ private:
struct TileMapLayer {
String name;
bool enabled = true;
+ Color modulate = Color(1, 1, 1, 1);
bool y_sort_enabled = false;
int y_sort_origin = 0;
int z_index = 0;
@@ -321,6 +322,8 @@ public:
String get_layer_name(int p_layer) const;
void set_layer_enabled(int p_layer, bool p_visible);
bool is_layer_enabled(int p_layer) const;
+ void set_layer_modulate(int p_layer, Color p_modulate);
+ Color get_layer_modulate(int p_layer) const;
void set_layer_y_sort_enabled(int p_layer, bool p_enabled);
bool is_layer_y_sort_enabled(int p_layer) const;
void set_layer_y_sort_origin(int p_layer, int p_y_sort_origin);
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index a54b10ba70..c422070480 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -282,7 +282,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
ERR_FAIL_COND_MSG(new_playback.is_null(), "Failed to instantiate playback.");
Map<StringName, Vector<AudioFrame>> bus_map;
bus_map[_get_actual_bus()] = volume_vector;
- AudioServer::get_singleton()->start_playback_stream(new_playback, bus_map, setplay.get(), linear_attenuation, attenuation_filter_cutoff_hz, actual_pitch_scale);
+ AudioServer::get_singleton()->start_playback_stream(new_playback, bus_map, setplay.get(), actual_pitch_scale, linear_attenuation, attenuation_filter_cutoff_hz);
stream_playbacks.push_back(new_playback);
setplay.set(-1);
}
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 61d73ff1e2..588d2b5018 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -238,8 +238,8 @@ void Camera3D::clear_current(bool p_enable_next) {
}
}
-void Camera3D::set_current(bool p_current) {
- if (p_current) {
+void Camera3D::set_current(bool p_enabled) {
+ if (p_enabled) {
make_current();
} else {
clear_current();
@@ -460,7 +460,7 @@ void Camera3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_frustum", "size", "offset", "z_near", "z_far"), &Camera3D::set_frustum);
ClassDB::bind_method(D_METHOD("make_current"), &Camera3D::make_current);
ClassDB::bind_method(D_METHOD("clear_current", "enable_next"), &Camera3D::clear_current, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("set_current"), &Camera3D::set_current);
+ ClassDB::bind_method(D_METHOD("set_current", "enabled"), &Camera3D::set_current);
ClassDB::bind_method(D_METHOD("is_current"), &Camera3D::is_current);
ClassDB::bind_method(D_METHOD("get_camera_transform"), &Camera3D::get_camera_transform);
ClassDB::bind_method(D_METHOD("get_fov"), &Camera3D::get_fov);
@@ -468,13 +468,13 @@ void Camera3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_size"), &Camera3D::get_size);
ClassDB::bind_method(D_METHOD("get_far"), &Camera3D::get_far);
ClassDB::bind_method(D_METHOD("get_near"), &Camera3D::get_near);
- ClassDB::bind_method(D_METHOD("set_fov"), &Camera3D::set_fov);
- ClassDB::bind_method(D_METHOD("set_frustum_offset"), &Camera3D::set_frustum_offset);
- ClassDB::bind_method(D_METHOD("set_size"), &Camera3D::set_size);
- ClassDB::bind_method(D_METHOD("set_far"), &Camera3D::set_far);
- ClassDB::bind_method(D_METHOD("set_near"), &Camera3D::set_near);
+ ClassDB::bind_method(D_METHOD("set_fov", "fov"), &Camera3D::set_fov);
+ ClassDB::bind_method(D_METHOD("set_frustum_offset", "offset"), &Camera3D::set_frustum_offset);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &Camera3D::set_size);
+ ClassDB::bind_method(D_METHOD("set_far", "far"), &Camera3D::set_far);
+ ClassDB::bind_method(D_METHOD("set_near", "near"), &Camera3D::set_near);
ClassDB::bind_method(D_METHOD("get_projection"), &Camera3D::get_projection);
- ClassDB::bind_method(D_METHOD("set_projection"), &Camera3D::set_projection);
+ ClassDB::bind_method(D_METHOD("set_projection", "mode"), &Camera3D::set_projection);
ClassDB::bind_method(D_METHOD("set_h_offset", "ofs"), &Camera3D::set_h_offset);
ClassDB::bind_method(D_METHOD("get_h_offset"), &Camera3D::get_h_offset);
ClassDB::bind_method(D_METHOD("set_v_offset", "ofs"), &Camera3D::set_v_offset);
@@ -656,6 +656,7 @@ Vector3 Camera3D::get_doppler_tracked_velocity() const {
}
RID Camera3D::get_pyramid_shape_rid() {
+ ERR_FAIL_COND_V_MSG(!is_inside_tree(), RID(), "Camera is not inside scene.");
if (pyramid_shape == RID()) {
pyramid_shape_points = get_near_plane_points();
pyramid_shape = PhysicsServer3D::get_singleton()->convex_polygon_shape_create();
diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h
index 6006a2ea3f..73126611d5 100644
--- a/scene/3d/camera_3d.h
+++ b/scene/3d/camera_3d.h
@@ -44,8 +44,10 @@ public:
PROJECTION_FRUSTUM
};
- enum KeepAspect { KEEP_WIDTH,
- KEEP_HEIGHT };
+ enum KeepAspect {
+ KEEP_WIDTH,
+ KEEP_HEIGHT
+ };
enum DopplerTracking {
DOPPLER_TRACKING_DISABLED,
@@ -112,7 +114,7 @@ public:
void make_current();
void clear_current(bool p_enable_next = true);
- void set_current(bool p_current);
+ void set_current(bool p_enabled);
bool is_current() const;
RID get_camera() const;
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index 4fa34615bf..9127168c58 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -475,7 +475,7 @@ Ref<Image> GPUParticlesCollisionSDF::bake() {
_create_bvh(bvh, face_pos.ptr(), face_pos.size(), faces.ptr(), th);
Vector<uint8_t> data;
- data.resize(sdf_size.z * sdf_size.y * sdf_size.x * sizeof(float));
+ data.resize(sdf_size.z * sdf_size.y * sdf_size.x * (int)sizeof(float));
if (bake_step_function) {
bake_step_function(0, "Baking SDF");
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index 12470939f5..272a06bce4 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -376,6 +376,18 @@ void Node3D::update_gizmos() {
#endif
}
+void Node3D::set_subgizmo_selection(Ref<Node3DGizmo> p_gizmo, int p_id, Transform3D p_transform) {
+#ifdef TOOLS_ENABLED
+ if (!is_inside_world()) {
+ return;
+ }
+
+ if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) {
+ get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_set_subgizmo_selection, this, p_gizmo, p_id, p_transform);
+ }
+#endif
+}
+
void Node3D::clear_subgizmo_selection() {
#ifdef TOOLS_ENABLED
if (!is_inside_world()) {
@@ -792,6 +804,7 @@ void Node3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_gizmo", "gizmo"), &Node3D::add_gizmo);
ClassDB::bind_method(D_METHOD("get_gizmos"), &Node3D::get_gizmos_bind);
ClassDB::bind_method(D_METHOD("clear_gizmos"), &Node3D::clear_gizmos);
+ ClassDB::bind_method(D_METHOD("set_subgizmo_selection", "gizmo", "id", "transform"), &Node3D::set_subgizmo_selection);
ClassDB::bind_method(D_METHOD("clear_subgizmo_selection"), &Node3D::clear_subgizmo_selection);
ClassDB::bind_method(D_METHOD("set_visible", "visible"), &Node3D::set_visible);
diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h
index 0fd0c4e205..d6dcdd96fe 100644
--- a/scene/3d/node_3d.h
+++ b/scene/3d/node_3d.h
@@ -92,6 +92,7 @@ class Node3D : public Node {
Vector<Ref<Node3DGizmo>> gizmos;
bool gizmos_disabled = false;
bool gizmos_dirty = false;
+ bool transform_gizmo_visible = true;
#endif
} data;
@@ -145,6 +146,8 @@ public:
#ifdef TOOLS_ENABLED
virtual Transform3D get_global_gizmo_transform() const;
virtual Transform3D get_local_gizmo_transform() const;
+ virtual void set_transform_gizmo_visible(bool p_enabled) { data.transform_gizmo_visible = p_enabled; };
+ virtual bool is_transform_gizmo_visible() const { return data.transform_gizmo_visible; };
#endif
void set_as_top_level(bool p_enabled);
@@ -155,6 +158,7 @@ public:
void set_disable_gizmos(bool p_enabled);
void update_gizmos();
+ void set_subgizmo_selection(Ref<Node3DGizmo> p_gizmo, int p_id, Transform3D p_transform = Transform3D());
void clear_subgizmo_selection();
Vector<Ref<Node3DGizmo>> get_gizmos() const;
Array get_gizmos_bind() const;
diff --git a/scene/3d/proximity_group_3d.cpp b/scene/3d/proximity_group_3d.cpp
index c8c61a9f00..23df00c1f6 100644
--- a/scene/3d/proximity_group_3d.cpp
+++ b/scene/3d/proximity_group_3d.cpp
@@ -34,9 +34,9 @@
void ProximityGroup3D::_clear_groups() {
Map<StringName, uint32_t>::Element *E;
+ const int size = 16;
- {
- const int size = 16;
+ do {
StringName remove_list[size];
E = groups.front();
int num = 0;
@@ -50,11 +50,7 @@ void ProximityGroup3D::_clear_groups() {
for (int i = 0; i < num; i++) {
groups.erase(remove_list[i]);
}
- }
-
- if (E) {
- _clear_groups(); // call until we go through the whole list
- }
+ } while (E);
}
void ProximityGroup3D::_update_groups() {
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index b7a79a2645..2b52f034b2 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -32,6 +32,7 @@
#include "core/object/message_queue.h"
#include "core/variant/type_info.h"
+#include "editor/plugins/skeleton_3d_editor_plugin.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/resources/skeleton_modification_3d.h"
#include "scene/resources/surface_tool.h"
@@ -178,7 +179,7 @@ void Skeleton3D::_update_process_order() {
for (int i = 0; i < len; i++) {
if (bonesptr[i].parent >= len) {
- //validate this just in case
+ // Validate this just in case.
ERR_PRINT("Bone " + itos(i) + " has invalid parent: " + itos(bonesptr[i].parent));
bonesptr[i].parent = -1;
}
@@ -186,9 +187,9 @@ void Skeleton3D::_update_process_order() {
if (bonesptr[i].parent != -1) {
int parent_bone_idx = bonesptr[i].parent;
- // Check to see if this node is already added to the parent:
+ // Check to see if this node is already added to the parent.
if (bonesptr[parent_bone_idx].child_bones.find(i) < 0) {
- // Add the child node
+ // Add the child node.
bonesptr[parent_bone_idx].child_bones.push_back(i);
} else {
ERR_PRINT("Skeleton3D parenthood graph is cyclic");
@@ -210,10 +211,10 @@ void Skeleton3D::_notification(int p_what) {
int len = bones.size();
dirty = false;
- // Update bone transforms
+ // Update bone transforms.
force_update_all_bone_transforms();
- //update skins
+ // Update skins.
for (Set<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
const Skin *skin = E->get()->skin.operator->();
RID skeleton = E->get()->skeleton;
@@ -231,7 +232,7 @@ void Skeleton3D::_notification(int p_what) {
StringName bind_name = skin->get_bind_name(i);
if (bind_name != StringName()) {
- //bind name used, use this
+ // Bind name used, use this.
bool found = false;
for (int j = 0; j < len; j++) {
if (bonesptr[j].name == bind_name) {
@@ -453,7 +454,8 @@ int Skeleton3D::get_bone_axis_forward_enum(int p_bone) {
return bones[p_bone].rest_bone_forward_axis;
}
-// skeleton creation api
+// Skeleton creation api
+
void Skeleton3D::add_bone(const String &p_name) {
ERR_FAIL_COND(p_name == "" || p_name.find(":") != -1 || p_name.find("/") != -1);
@@ -626,6 +628,7 @@ void Skeleton3D::set_bone_enabled(int p_bone, bool p_enabled) {
ERR_FAIL_INDEX(p_bone, bone_size);
bones.write[p_bone].enabled = p_enabled;
+ emit_signal(SceneStringNames::get_singleton()->bone_enabled_changed, p_bone);
_make_dirty();
}
@@ -635,6 +638,16 @@ bool Skeleton3D::is_bone_enabled(int p_bone) const {
return bones[p_bone].enabled;
}
+void Skeleton3D::set_show_rest_only(bool p_enabled) {
+ show_rest_only = p_enabled;
+ emit_signal(SceneStringNames::get_singleton()->show_rest_only_changed);
+ _make_dirty();
+}
+
+bool Skeleton3D::is_show_rest_only() const {
+ return show_rest_only;
+}
+
void Skeleton3D::clear_bones() {
bones.clear();
process_order_dirty = true;
@@ -642,7 +655,7 @@ void Skeleton3D::clear_bones() {
_make_dirty();
}
-// posing api
+// Posing api
void Skeleton3D::set_bone_pose(int p_bone, const Transform3D &p_pose) {
const int bone_size = bones.size();
@@ -697,7 +710,7 @@ void Skeleton3D::localize_rests() {
set_bone_rest(current_bone_idx, bones[bones[current_bone_idx].parent].rest.affine_inverse() * bones[current_bone_idx].rest);
}
- // Add the bone's children to the list of bones to be processed
+ // Add the bone's children to the list of bones to be processed.
int child_bone_size = bones[current_bone_idx].child_bones.size();
for (int i = 0; i < child_bone_size; i++) {
bones_to_process.push_back(bones[current_bone_idx].child_bones[i]);
@@ -705,8 +718,8 @@ void Skeleton3D::localize_rests() {
}
}
-void Skeleton3D::set_animate_physical_bones(bool p_animate) {
- animate_physical_bones = p_animate;
+void Skeleton3D::set_animate_physical_bones(bool p_enabled) {
+ animate_physical_bones = p_enabled;
if (Engine::get_singleton()->is_editor_hint() == false) {
bool sim = false;
@@ -718,7 +731,7 @@ void Skeleton3D::set_animate_physical_bones(bool p_animate) {
}
}
}
- set_physics_process_internal(sim == false && p_animate);
+ set_physics_process_internal(sim == false && p_enabled);
}
}
@@ -831,7 +844,7 @@ void Skeleton3D::physical_bones_start_simulation_on(const TypedArray<StringName>
Vector<int> sim_bones;
if (p_bones.size() <= 0) {
- sim_bones.push_back(0); // if no bones is specified, activate ragdoll on full body
+ sim_bones.push_back(0); // If no bones is specified, activate ragdoll on full body.
} else {
sim_bones.resize(p_bones.size());
int c = 0;
@@ -884,19 +897,19 @@ Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
Ref<Skin> skin = p_skin;
if (skin.is_null()) {
- //need to create one from existing code, this is for compatibility only
- //when skeletons did not support skins. It is also used by gizmo
- //to display the skeleton.
+ // Need to create one from existing code, this is for compatibility only
+ // when skeletons did not support skins. It is also used by gizmo
+ // to display the skeleton.
skin.instantiate();
skin->set_bind_count(bones.size());
- _update_process_order(); //just in case
+ _update_process_order(); // Just in case.
- // pose changed, rebuild cache of inverses
+ // Pose changed, rebuild cache of inverses.
const Bone *bonesptr = bones.ptr();
int len = bones.size();
- // calculate global rests and invert them
+ // Calculate global rests and invert them.
LocalVector<int> bones_to_process;
bones_to_process = get_parentless_bones();
while (bones_to_process.size() > 0) {
@@ -919,7 +932,7 @@ Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
}
for (int i = 0; i < len; i++) {
- //the inverse is what is actually required
+ // The inverse is what is actually required.
skin->set_bind_bone(i, i);
skin->set_bind_pose(i, skin->get_bind_pose(i).affine_inverse());
}
@@ -940,11 +953,17 @@ Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
skin->connect("changed", Callable(skin_ref.operator->(), "_skin_changed"));
- _make_dirty(); //skin needs to be updated, so update skeleton
+ _make_dirty(); // Skin needs to be updated, so update skeleton.
return skin_ref;
}
+void Skeleton3D::force_update_all_dirty_bones() {
+ if (dirty) {
+ const_cast<Skeleton3D *>(this)->notification(NOTIFICATION_UPDATE_SKELETON);
+ }
+}
+
void Skeleton3D::force_update_all_bone_transforms() {
_update_process_order();
@@ -966,9 +985,10 @@ void Skeleton3D::force_update_bone_children_transforms(int p_bone_idx) {
bones_to_process.erase(current_bone_idx);
Bone &b = bonesptr[current_bone_idx];
+ bool bone_enabled = b.enabled && !show_rest_only;
if (b.disable_rest) {
- if (b.enabled) {
+ if (bone_enabled) {
Transform3D pose = b.pose;
if (b.custom_pose_enable) {
pose = b.custom_pose * pose;
@@ -991,7 +1011,7 @@ void Skeleton3D::force_update_bone_children_transforms(int p_bone_idx) {
}
} else {
- if (b.enabled) {
+ if (bone_enabled) {
Transform3D pose = b.pose;
if (b.custom_pose_enable) {
pose = b.custom_pose * pose;
@@ -1035,7 +1055,7 @@ void Skeleton3D::force_update_bone_children_transforms(int p_bone_idx) {
b.global_pose_override_amount = 0.0;
}
- // Add the bone's children to the list of bones to be processed
+ // Add the bone's children to the list of bones to be processed.
int child_bone_size = b.child_bones.size();
for (int i = 0; i < child_bone_size; i++) {
bones_to_process.push_back(b.child_bones[i]);
@@ -1045,7 +1065,7 @@ void Skeleton3D::force_update_bone_children_transforms(int p_bone_idx) {
}
}
-// helper functions
+// Helper functions
Transform3D Skeleton3D::global_pose_to_world_transform(Transform3D p_global_pose) {
return get_global_transform() * p_global_pose;
@@ -1175,6 +1195,9 @@ void Skeleton3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bone_pose", "bone_idx"), &Skeleton3D::get_bone_pose);
ClassDB::bind_method(D_METHOD("set_bone_pose", "bone_idx", "pose"), &Skeleton3D::set_bone_pose);
+ ClassDB::bind_method(D_METHOD("is_bone_enabled", "bone_idx"), &Skeleton3D::is_bone_enabled);
+ ClassDB::bind_method(D_METHOD("set_bone_enabled", "bone_idx", "enabled"), &Skeleton3D::set_bone_enabled, DEFVAL(true));
+
ClassDB::bind_method(D_METHOD("clear_bones_global_pose_override"), &Skeleton3D::clear_bones_global_pose_override);
ClassDB::bind_method(D_METHOD("set_bone_global_pose_override", "bone_idx", "pose", "amount", "persistent"), &Skeleton3D::set_bone_global_pose_override, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_bone_global_pose_override", "bone_idx"), &Skeleton3D::get_bone_global_pose_override);
@@ -1198,7 +1221,10 @@ void Skeleton3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("local_pose_to_global_pose", "bone_idx", "local_pose"), &Skeleton3D::local_pose_to_global_pose);
ClassDB::bind_method(D_METHOD("global_pose_z_forward_to_bone_forward", "bone_idx", "basis"), &Skeleton3D::global_pose_z_forward_to_bone_forward);
- ClassDB::bind_method(D_METHOD("set_animate_physical_bones"), &Skeleton3D::set_animate_physical_bones);
+ ClassDB::bind_method(D_METHOD("set_show_rest_only", "enabled"), &Skeleton3D::set_show_rest_only);
+ ClassDB::bind_method(D_METHOD("is_show_rest_only"), &Skeleton3D::is_show_rest_only);
+
+ ClassDB::bind_method(D_METHOD("set_animate_physical_bones", "enabled"), &Skeleton3D::set_animate_physical_bones);
ClassDB::bind_method(D_METHOD("get_animate_physical_bones"), &Skeleton3D::get_animate_physical_bones);
ClassDB::bind_method(D_METHOD("physical_bones_stop_simulation"), &Skeleton3D::physical_bones_stop_simulation);
@@ -1212,6 +1238,7 @@ void Skeleton3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("execute_modifications", "delta", "execution_mode"), &Skeleton3D::execute_modifications);
#ifndef _3D_DISABLED
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_rest_only"), "set_show_rest_only", "is_show_rest_only");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "animate_physical_bones"), "set_animate_physical_bones", "get_animate_physical_bones");
#endif // _3D_DISABLED
@@ -1220,6 +1247,8 @@ void Skeleton3D::_bind_methods() {
#endif // TOOLS_ENABLED
ADD_SIGNAL(MethodInfo("bone_pose_changed", PropertyInfo(Variant::INT, "bone_idx")));
+ ADD_SIGNAL(MethodInfo("bone_enabled_changed", PropertyInfo(Variant::INT, "bone_idx")));
+ ADD_SIGNAL(MethodInfo("show_rest_only_changed"));
BIND_CONSTANT(NOTIFICATION_UPDATE_SKELETON);
}
@@ -1228,7 +1257,7 @@ Skeleton3D::Skeleton3D() {
}
Skeleton3D::~Skeleton3D() {
- //some skins may remain bound
+ // Some skins may remain bound.
for (Set<SkinReference *>::Element *E = skin_bindings.front(); E; E = E->next()) {
E->get()->skeleton_node = nullptr;
}
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index c8a19db813..9aa4fc823f 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -137,6 +137,8 @@ private:
void _make_dirty();
bool dirty = false;
+ bool show_rest_only = false;
+
uint64_t version = 1;
void _update_process_order();
@@ -197,6 +199,9 @@ public:
void set_bone_enabled(int p_bone, bool p_enabled);
bool is_bone_enabled(int p_bone) const;
+
+ void set_show_rest_only(bool p_enabled);
+ bool is_show_rest_only() const;
void clear_bones();
// posing api
@@ -219,6 +224,7 @@ public:
Ref<SkinReference> register_skin(const Ref<Skin> &p_skin);
+ void force_update_all_dirty_bones();
void force_update_all_bone_transforms();
void force_update_bone_children_transforms(int bone_idx);
@@ -244,7 +250,7 @@ public:
// Physical bone API
- void set_animate_physical_bones(bool p_animate);
+ void set_animate_physical_bones(bool p_enabled);
bool get_animate_physical_bones() const;
void bind_physical_bone_to_bone(int p_bone, PhysicalBone3D *p_physical_bone);
diff --git a/scene/3d/soft_dynamic_body_3d.cpp b/scene/3d/soft_dynamic_body_3d.cpp
index 21f9b0a35d..9fceb21790 100644
--- a/scene/3d/soft_dynamic_body_3d.cpp
+++ b/scene/3d/soft_dynamic_body_3d.cpp
@@ -411,8 +411,9 @@ void SoftDynamicBody3D::_draw_soft_mesh() {
return;
}
- if (!rendering_server_handler.is_ready()) {
- rendering_server_handler.prepare(get_mesh()->get_rid(), 0);
+ const RID mesh_rid = get_mesh()->get_rid();
+ if (!rendering_server_handler.is_ready(mesh_rid)) {
+ rendering_server_handler.prepare(mesh_rid, 0);
/// Necessary in order to render the mesh correctly (Soft body nodes are in global space)
simulation_started = true;
diff --git a/scene/3d/soft_dynamic_body_3d.h b/scene/3d/soft_dynamic_body_3d.h
index 0b4b3021cd..5e7fbfe29e 100644
--- a/scene/3d/soft_dynamic_body_3d.h
+++ b/scene/3d/soft_dynamic_body_3d.h
@@ -50,7 +50,7 @@ class SoftDynamicBodyRenderingServerHandler : public RenderingServerHandler {
private:
SoftDynamicBodyRenderingServerHandler();
- bool is_ready() { return mesh.is_valid(); }
+ bool is_ready(RID p_mesh_rid) const { return mesh.is_valid() && mesh == p_mesh_rid; }
void prepare(RID p_mesh_rid, int p_surface);
void clear();
void open();
diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp
index d3d12d94e9..377abd5b38 100644
--- a/scene/3d/voxel_gi.cpp
+++ b/scene/3d/voxel_gi.cpp
@@ -398,7 +398,7 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) {
baker.end_bake();
- //create the data for visual server
+ //create the data for rendering server
if (p_create_visual_debug) {
MultiMeshInstance3D *mmi = memnew(MultiMeshInstance3D);
diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp
index 04f371f4b2..aa1236521d 100644
--- a/scene/3d/voxelizer.cpp
+++ b/scene/3d/voxelizer.cpp
@@ -618,7 +618,6 @@ void Voxelizer::begin_bake(int p_subdiv, const AABB &p_bounds) {
bake_cells.resize(1);
material_cache.clear();
- print_line("subdiv: " + itos(p_subdiv));
//find out the actual real bounds, power of 2, which gets the highest subdivision
po2_bounds = p_bounds;
int longest_axis = po2_bounds.get_longest_axis_index();
@@ -661,7 +660,7 @@ void Voxelizer::end_bake() {
_fixup_plot(0, 0);
}
-//create the data for visual server
+//create the data for rendering server
int Voxelizer::get_voxel_gi_octree_depth() const {
return cell_subdiv;
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 0334ba667b..d2fd65d3d9 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -135,7 +135,7 @@ void AudioStreamPlayer::play(float p_from_pos) {
Ref<AudioStreamPlayback> stream_playback = stream->instance_playback();
ERR_FAIL_COND_MSG(stream_playback.is_null(), "Failed to instantiate playback.");
- AudioServer::get_singleton()->start_playback_stream(stream_playback, bus, _get_volume_vector(), p_from_pos);
+ AudioServer::get_singleton()->start_playback_stream(stream_playback, bus, _get_volume_vector(), p_from_pos, pitch_scale);
stream_playbacks.push_back(stream_playback);
active.set();
set_process_internal(true);
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 9cdf3bf210..e253a27e66 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -427,9 +427,9 @@ Ref<Texture2D> Button::get_icon() const {
return icon;
}
-void Button::set_expand_icon(bool p_expand_icon) {
- if (expand_icon != p_expand_icon) {
- expand_icon = p_expand_icon;
+void Button::set_expand_icon(bool p_enabled) {
+ if (expand_icon != p_enabled) {
+ expand_icon = p_enabled;
update();
minimum_size_changed();
}
@@ -439,9 +439,9 @@ bool Button::is_expand_icon() const {
return expand_icon;
}
-void Button::set_flat(bool p_flat) {
- if (flat != p_flat) {
- flat = p_flat;
+void Button::set_flat(bool p_enabled) {
+ if (flat != p_enabled) {
+ flat = p_enabled;
update();
}
}
@@ -450,9 +450,9 @@ bool Button::is_flat() const {
return flat;
}
-void Button::set_clip_text(bool p_clip_text) {
- if (clip_text != p_clip_text) {
- clip_text = p_clip_text;
+void Button::set_clip_text(bool p_enabled) {
+ if (clip_text != p_enabled) {
+ clip_text = p_enabled;
update();
minimum_size_changed();
}
@@ -553,7 +553,7 @@ void Button::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_text_align"), &Button::get_text_align);
ClassDB::bind_method(D_METHOD("set_icon_align", "icon_align"), &Button::set_icon_align);
ClassDB::bind_method(D_METHOD("get_icon_align"), &Button::get_icon_align);
- ClassDB::bind_method(D_METHOD("set_expand_icon"), &Button::set_expand_icon);
+ ClassDB::bind_method(D_METHOD("set_expand_icon", "enabled"), &Button::set_expand_icon);
ClassDB::bind_method(D_METHOD("is_expand_icon"), &Button::is_expand_icon);
BIND_ENUM_CONSTANT(ALIGN_LEFT);
diff --git a/scene/gui/button.h b/scene/gui/button.h
index 253d079680..fd36cb77af 100644
--- a/scene/gui/button.h
+++ b/scene/gui/button.h
@@ -91,13 +91,13 @@ public:
void set_icon(const Ref<Texture2D> &p_icon);
Ref<Texture2D> get_icon() const;
- void set_expand_icon(bool p_expand_icon);
+ void set_expand_icon(bool p_enabled);
bool is_expand_icon() const;
- void set_flat(bool p_flat);
+ void set_flat(bool p_enabled);
bool is_flat() const;
- void set_clip_text(bool p_clip_text);
+ void set_clip_text(bool p_enabled);
bool get_clip_text() const;
void set_text_align(TextAlign p_align);
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 46ec7b4d3d..da54903871 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -2937,6 +2937,7 @@ void CodeEdit::_lines_edited_from(int p_from_line, int p_to_line) {
return;
}
+ lines_edited_changed += p_to_line - p_from_line;
lines_edited_from = (lines_edited_from == -1) ? MIN(p_from_line, p_to_line) : MIN(lines_edited_from, MIN(p_from_line, p_to_line));
lines_edited_to = (lines_edited_to == -1) ? MAX(p_from_line, p_to_line) : MAX(lines_edited_from, MAX(p_from_line, p_to_line));
}
@@ -2963,7 +2964,6 @@ void CodeEdit::_text_changed() {
}
lc = get_line_count();
- int line_change_size = (lines_edited_to - lines_edited_from);
List<int> breakpoints;
breakpointed_lines.get_key_list(&breakpoints);
for (const int &line : breakpoints) {
@@ -2974,8 +2974,8 @@ void CodeEdit::_text_changed() {
breakpointed_lines.erase(line);
emit_signal(SNAME("breakpoint_toggled"), line);
- int next_line = line + line_change_size;
- if (next_line < lc && is_line_breakpointed(next_line)) {
+ int next_line = line + lines_edited_changed;
+ if (next_line > -1 && next_line < lc && is_line_breakpointed(next_line)) {
emit_signal(SNAME("breakpoint_toggled"), next_line);
breakpointed_lines[next_line] = true;
continue;
@@ -2984,6 +2984,7 @@ void CodeEdit::_text_changed() {
lines_edited_from = -1;
lines_edited_to = -1;
+ lines_edited_changed = 0;
}
CodeEdit::CodeEdit() {
diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h
index d8eccb7d32..f0d971dd35 100644
--- a/scene/gui/code_edit.h
+++ b/scene/gui/code_edit.h
@@ -240,6 +240,7 @@ private:
int line_spacing = 1;
/* Callbacks */
+ int lines_edited_changed = 0;
int lines_edited_from = -1;
int lines_edited_to = -1;
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 54548e1941..894175d559 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -1106,9 +1106,9 @@ bool ColorPicker::are_presets_visible() const {
void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPicker::set_pick_color);
ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPicker::get_pick_color);
- ClassDB::bind_method(D_METHOD("set_hsv_mode"), &ColorPicker::set_hsv_mode);
+ ClassDB::bind_method(D_METHOD("set_hsv_mode", "enabled"), &ColorPicker::set_hsv_mode);
ClassDB::bind_method(D_METHOD("is_hsv_mode"), &ColorPicker::is_hsv_mode);
- ClassDB::bind_method(D_METHOD("set_raw_mode"), &ColorPicker::set_raw_mode);
+ ClassDB::bind_method(D_METHOD("set_raw_mode", "enabled"), &ColorPicker::set_raw_mode);
ClassDB::bind_method(D_METHOD("is_raw_mode"), &ColorPicker::is_raw_mode);
ClassDB::bind_method(D_METHOD("set_deferred_mode", "mode"), &ColorPicker::set_deferred_mode);
ClassDB::bind_method(D_METHOD("is_deferred_mode"), &ColorPicker::is_deferred_mode);
diff --git a/scene/gui/control.h b/scene/gui/control.h
index bdc06319ea..be692b6a0c 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -408,7 +408,7 @@ public:
Rect2 get_rect() const;
Rect2 get_global_rect() const;
Rect2 get_screen_rect() const;
- Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the visual server
+ Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the rendering server
Rect2 get_anchorable_rect() const override;
void set_rect(const Rect2 &p_rect); // Reset anchors to begin and set rect, for faster container children sorting.
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 653885aa08..54e7d8f960 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -241,7 +241,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
_reset_caret_blink_timer();
if (b->is_pressed()) {
- accept_event(); //don't pass event further when clicked on text field
+ accept_event(); // don't pass event further when clicked on text field
if (!text.is_empty() && is_editable() && _is_over_clear_button(b->get_position())) {
clear_button_status.press_attempt = true;
clear_button_status.pressing_inside = true;
@@ -1931,7 +1931,7 @@ void LineEdit::_shape() {
TS->shaped_text_clear(text_rid);
String t;
- if (text.length() == 0) {
+ if (text.length() == 0 && ime_text.length() == 0) {
t = placeholder_translated;
} else if (pass) {
t = secret_character.repeat(text.length() + ime_text.length());
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 0aec017649..0446e1b402 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -253,14 +253,14 @@ String SpinBox::get_prefix() const {
return prefix;
}
-void SpinBox::set_update_on_text_changed(bool p_update) {
- if (update_on_text_changed == p_update) {
+void SpinBox::set_update_on_text_changed(bool p_enabled) {
+ if (update_on_text_changed == p_enabled) {
return;
}
- update_on_text_changed = p_update;
+ update_on_text_changed = p_enabled;
- if (p_update) {
+ if (p_enabled) {
line_edit->connect("text_changed", callable_mp(this, &SpinBox::_text_changed), Vector<Variant>(), CONNECT_DEFERRED);
} else {
line_edit->disconnect("text_changed", callable_mp(this, &SpinBox::_text_changed));
@@ -271,8 +271,8 @@ bool SpinBox::get_update_on_text_changed() const {
return update_on_text_changed;
}
-void SpinBox::set_editable(bool p_editable) {
- line_edit->set_editable(p_editable);
+void SpinBox::set_editable(bool p_enabled) {
+ line_edit->set_editable(p_enabled);
}
bool SpinBox::is_editable() const {
@@ -284,17 +284,15 @@ void SpinBox::apply() {
}
void SpinBox::_bind_methods() {
- //ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed);
-
ClassDB::bind_method(D_METHOD("set_align", "align"), &SpinBox::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &SpinBox::get_align);
ClassDB::bind_method(D_METHOD("set_suffix", "suffix"), &SpinBox::set_suffix);
ClassDB::bind_method(D_METHOD("get_suffix"), &SpinBox::get_suffix);
ClassDB::bind_method(D_METHOD("set_prefix", "prefix"), &SpinBox::set_prefix);
ClassDB::bind_method(D_METHOD("get_prefix"), &SpinBox::get_prefix);
- ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable);
+ ClassDB::bind_method(D_METHOD("set_editable", "enabled"), &SpinBox::set_editable);
ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable);
- ClassDB::bind_method(D_METHOD("set_update_on_text_changed"), &SpinBox::set_update_on_text_changed);
+ ClassDB::bind_method(D_METHOD("set_update_on_text_changed", "enabled"), &SpinBox::set_update_on_text_changed);
ClassDB::bind_method(D_METHOD("get_update_on_text_changed"), &SpinBox::get_update_on_text_changed);
ClassDB::bind_method(D_METHOD("apply"), &SpinBox::apply);
ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit);
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index 9828b894da..f2299ce1c2 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -82,7 +82,7 @@ public:
void set_align(LineEdit::Align p_align);
LineEdit::Align get_align() const;
- void set_editable(bool p_editable);
+ void set_editable(bool p_enabled);
bool is_editable() const;
void set_suffix(const String &p_suffix);
@@ -91,7 +91,7 @@ public:
void set_prefix(const String &p_prefix);
String get_prefix() const;
- void set_update_on_text_changed(bool p_update);
+ void set_update_on_text_changed(bool p_enabled);
bool get_update_on_text_changed() const;
void apply();
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index f305bf7013..0755a79eee 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -223,7 +223,7 @@ void Tabs::gui_input(const Ref<InputEvent> &p_event) {
}
int found = -1;
- for (int i = offset; i < tabs.size(); i++) {
+ for (int i = offset; i <= max_drawn_tab; i++) {
if (tabs[i].rb_rect.has_point(pos)) {
rb_pressing = true;
update();
@@ -914,7 +914,7 @@ void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
int Tabs::get_tab_idx_at_point(const Point2 &p_point) const {
int hover_now = -1;
- for (int i = offset; i < tabs.size(); i++) {
+ for (int i = offset; i <= max_drawn_tab; i++) {
Rect2 rect = get_tab_rect(i);
if (rect.has_point(p_point)) {
hover_now = i;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 6370ea9c95..dc9a3f337e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -103,11 +103,11 @@ void TextEdit::Text::set_direction_and_language(TextServer::Direction p_directio
is_dirty = true;
}
-void TextEdit::Text::set_draw_control_chars(bool p_draw_control_chars) {
- if (draw_control_chars == p_draw_control_chars) {
+void TextEdit::Text::set_draw_control_chars(bool p_enabled) {
+ if (draw_control_chars == p_enabled) {
return;
}
- draw_control_chars = p_draw_control_chars;
+ draw_control_chars = p_enabled;
is_dirty = true;
}
@@ -2572,8 +2572,8 @@ bool TextEdit::is_overtype_mode_enabled() const {
return overtype_mode;
}
-void TextEdit::set_context_menu_enabled(bool p_enable) {
- context_menu_enabled = p_enable;
+void TextEdit::set_context_menu_enabled(bool p_enabled) {
+ context_menu_enabled = p_enabled;
}
bool TextEdit::is_context_menu_enabled() const {
@@ -2588,8 +2588,8 @@ bool TextEdit::is_shortcut_keys_enabled() const {
return shortcut_keys_enabled;
}
-void TextEdit::set_virtual_keyboard_enabled(bool p_enable) {
- virtual_keyboard_enabled = p_enable;
+void TextEdit::set_virtual_keyboard_enabled(bool p_enabled) {
+ virtual_keyboard_enabled = p_enabled;
}
bool TextEdit::is_virtual_keyboard_enabled() const {
@@ -3504,8 +3504,8 @@ void TextEdit::set_caret_blink_speed(const float p_speed) {
caret_blink_timer->set_wait_time(p_speed);
}
-void TextEdit::set_move_caret_on_right_click_enabled(const bool p_enable) {
- move_caret_on_right_click = p_enable;
+void TextEdit::set_move_caret_on_right_click_enabled(const bool p_enabled) {
+ move_caret_on_right_click = p_enabled;
}
bool TextEdit::is_move_caret_on_right_click_enabled() const {
@@ -3913,9 +3913,9 @@ Vector<String> TextEdit::get_line_wrapped_text(int p_line) const {
/* Viewport */
// Scrolling.
-void TextEdit::set_smooth_scroll_enabled(const bool p_enable) {
- v_scroll->set_smooth_scroll_enabled(p_enable);
- smooth_scroll_enabled = p_enable;
+void TextEdit::set_smooth_scroll_enabled(const bool p_enabled) {
+ v_scroll->set_smooth_scroll_enabled(p_enabled);
+ smooth_scroll_enabled = p_enabled;
}
bool TextEdit::is_smooth_scroll_enabled() const {
@@ -4174,9 +4174,9 @@ void TextEdit::center_viewport_to_caret() {
}
/* Minimap */
-void TextEdit::set_draw_minimap(bool p_draw) {
- if (draw_minimap != p_draw) {
- draw_minimap = p_draw;
+void TextEdit::set_draw_minimap(bool p_enabled) {
+ if (draw_minimap != p_enabled) {
+ draw_minimap = p_enabled;
_update_wrap_at_column();
}
update();
@@ -4457,9 +4457,9 @@ bool TextEdit::is_highlight_all_occurrences_enabled() const {
return highlight_all_occurrences;
}
-void TextEdit::set_draw_control_chars(bool p_draw_control_chars) {
- if (draw_control_chars != p_draw_control_chars) {
- draw_control_chars = p_draw_control_chars;
+void TextEdit::set_draw_control_chars(bool p_enabled) {
+ if (draw_control_chars != p_enabled) {
+ draw_control_chars = p_enabled;
if (menu) {
menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars);
}
@@ -4473,8 +4473,8 @@ bool TextEdit::get_draw_control_chars() const {
return draw_control_chars;
}
-void TextEdit::set_draw_tabs(bool p_draw) {
- draw_tabs = p_draw;
+void TextEdit::set_draw_tabs(bool p_enabled) {
+ draw_tabs = p_enabled;
update();
}
@@ -4482,8 +4482,8 @@ bool TextEdit::is_drawing_tabs() const {
return draw_tabs;
}
-void TextEdit::set_draw_spaces(bool p_draw) {
- draw_spaces = p_draw;
+void TextEdit::set_draw_spaces(bool p_enabled) {
+ draw_spaces = p_enabled;
update();
}
@@ -4500,7 +4500,7 @@ void TextEdit::_bind_methods() {
// Text properties
ClassDB::bind_method(D_METHOD("has_ime_text"), &TextEdit::has_ime_text);
- ClassDB::bind_method(D_METHOD("set_editable", "enable"), &TextEdit::set_editable);
+ ClassDB::bind_method(D_METHOD("set_editable", "enabled"), &TextEdit::set_editable);
ClassDB::bind_method(D_METHOD("is_editable"), &TextEdit::is_editable);
ClassDB::bind_method(D_METHOD("set_text_direction", "direction"), &TextEdit::set_text_direction);
@@ -4525,13 +4525,13 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_overtype_mode_enabled", "enabled"), &TextEdit::set_overtype_mode_enabled);
ClassDB::bind_method(D_METHOD("is_overtype_mode_enabled"), &TextEdit::is_overtype_mode_enabled);
- ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &TextEdit::set_context_menu_enabled);
+ ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enabled"), &TextEdit::set_context_menu_enabled);
ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &TextEdit::is_context_menu_enabled);
- ClassDB::bind_method(D_METHOD("set_shortcut_keys_enabled", "enable"), &TextEdit::set_shortcut_keys_enabled);
+ ClassDB::bind_method(D_METHOD("set_shortcut_keys_enabled", "enabled"), &TextEdit::set_shortcut_keys_enabled);
ClassDB::bind_method(D_METHOD("is_shortcut_keys_enabled"), &TextEdit::is_shortcut_keys_enabled);
- ClassDB::bind_method(D_METHOD("set_virtual_keyboard_enabled", "enable"), &TextEdit::set_virtual_keyboard_enabled);
+ ClassDB::bind_method(D_METHOD("set_virtual_keyboard_enabled", "enabled"), &TextEdit::set_virtual_keyboard_enabled);
ClassDB::bind_method(D_METHOD("is_virtual_keyboard_enabled"), &TextEdit::is_virtual_keyboard_enabled);
// Text manipulation
@@ -4766,7 +4766,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("center_viewport_to_caret"), &TextEdit::center_viewport_to_caret);
// Minimap
- ClassDB::bind_method(D_METHOD("draw_minimap", "draw"), &TextEdit::set_draw_minimap);
+ ClassDB::bind_method(D_METHOD("set_draw_minimap", "enabled"), &TextEdit::set_draw_minimap);
ClassDB::bind_method(D_METHOD("is_drawing_minimap"), &TextEdit::is_drawing_minimap);
ClassDB::bind_method(D_METHOD("set_minimap_width", "width"), &TextEdit::set_minimap_width);
@@ -4822,16 +4822,16 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_highlight_current_line", "enabled"), &TextEdit::set_highlight_current_line);
ClassDB::bind_method(D_METHOD("is_highlight_current_line_enabled"), &TextEdit::is_highlight_current_line_enabled);
- ClassDB::bind_method(D_METHOD("set_highlight_all_occurrences", "enable"), &TextEdit::set_highlight_all_occurrences);
+ ClassDB::bind_method(D_METHOD("set_highlight_all_occurrences", "enabled"), &TextEdit::set_highlight_all_occurrences);
ClassDB::bind_method(D_METHOD("is_highlight_all_occurrences_enabled"), &TextEdit::is_highlight_all_occurrences_enabled);
ClassDB::bind_method(D_METHOD("get_draw_control_chars"), &TextEdit::get_draw_control_chars);
- ClassDB::bind_method(D_METHOD("set_draw_control_chars", "enable"), &TextEdit::set_draw_control_chars);
+ ClassDB::bind_method(D_METHOD("set_draw_control_chars", "enabled"), &TextEdit::set_draw_control_chars);
- ClassDB::bind_method(D_METHOD("set_draw_tabs"), &TextEdit::set_draw_tabs);
+ ClassDB::bind_method(D_METHOD("set_draw_tabs", "enabled"), &TextEdit::set_draw_tabs);
ClassDB::bind_method(D_METHOD("is_drawing_tabs"), &TextEdit::is_drawing_tabs);
- ClassDB::bind_method(D_METHOD("set_draw_spaces"), &TextEdit::set_draw_spaces);
+ ClassDB::bind_method(D_METHOD("set_draw_spaces", "enabled"), &TextEdit::set_draw_spaces);
ClassDB::bind_method(D_METHOD("is_drawing_spaces"), &TextEdit::is_drawing_spaces);
ClassDB::bind_method(D_METHOD("get_menu"), &TextEdit::get_menu);
@@ -4868,7 +4868,7 @@ void TextEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "scroll_horizontal"), "set_h_scroll", "get_h_scroll");
ADD_GROUP("Minimap", "minimap_");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "minimap_draw"), "draw_minimap", "is_drawing_minimap");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "minimap_draw"), "set_draw_minimap", "is_drawing_minimap");
ADD_PROPERTY(PropertyInfo(Variant::INT, "minimap_width"), "set_minimap_width", "get_minimap_width");
ADD_GROUP("Caret", "caret_");
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 3230de776f..16c1ee9ff9 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -182,7 +182,7 @@ private:
void set_font_size(int p_font_size);
void set_font_features(const Dictionary &p_features);
void set_direction_and_language(TextServer::Direction p_direction, const String &p_language);
- void set_draw_control_chars(bool p_draw_control_chars);
+ void set_draw_control_chars(bool p_enabled);
int get_line_height() const;
int get_line_width(int p_line, int p_wrap_index = -1) const;
@@ -631,13 +631,13 @@ public:
void set_overtype_mode_enabled(const bool p_enabled);
bool is_overtype_mode_enabled() const;
- void set_context_menu_enabled(bool p_enable);
+ void set_context_menu_enabled(bool p_enabled);
bool is_context_menu_enabled() const;
void set_shortcut_keys_enabled(bool p_enabled);
bool is_shortcut_keys_enabled() const;
- void set_virtual_keyboard_enabled(bool p_enable);
+ void set_virtual_keyboard_enabled(bool p_enabled);
bool is_virtual_keyboard_enabled() const;
// Text manipulation
@@ -723,7 +723,7 @@ public:
void set_caret_blink_speed(const float p_speed);
float get_caret_blink_speed() const;
- void set_move_caret_on_right_click_enabled(const bool p_enable);
+ void set_move_caret_on_right_click_enabled(const bool p_enabled);
bool is_move_caret_on_right_click_enabled() const;
void set_caret_mid_grapheme_enabled(const bool p_enabled);
@@ -783,7 +783,7 @@ public:
/* Viewport. */
// Scrolling.
- void set_smooth_scroll_enabled(const bool p_enable);
+ void set_smooth_scroll_enabled(const bool p_enabled);
bool is_smooth_scroll_enabled() const;
void set_scroll_past_end_of_file_enabled(const bool p_enabled);
@@ -818,7 +818,7 @@ public:
void center_viewport_to_caret();
// Minimap
- void set_draw_minimap(bool p_draw);
+ void set_draw_minimap(bool p_enabled);
bool is_drawing_minimap() const;
void set_minimap_width(int p_minimap_width);
@@ -885,13 +885,13 @@ public:
void set_highlight_all_occurrences(const bool p_enabled);
bool is_highlight_all_occurrences_enabled() const;
- void set_draw_control_chars(bool p_draw_control_chars);
+ void set_draw_control_chars(bool p_enabled);
bool get_draw_control_chars() const;
- void set_draw_tabs(bool p_draw);
+ void set_draw_tabs(bool p_enabled);
bool is_drawing_tabs() const;
- void set_draw_spaces(bool p_draw);
+ void set_draw_spaces(bool p_enabled);
bool is_drawing_spaces() const;
TextEdit();
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 14fd14dd18..a4fcc04e20 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -599,7 +599,7 @@ void HTTPRequest::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_timeout", "timeout"), &HTTPRequest::set_timeout);
ClassDB::bind_method(D_METHOD("get_timeout"), &HTTPRequest::get_timeout);
- ClassDB::bind_method(D_METHOD("set_download_chunk_size"), &HTTPRequest::set_download_chunk_size);
+ ClassDB::bind_method(D_METHOD("set_download_chunk_size", "chunk_size"), &HTTPRequest::set_download_chunk_size);
ClassDB::bind_method(D_METHOD("get_download_chunk_size"), &HTTPRequest::get_download_chunk_size);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file");
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0876c30dd1..189aebb47d 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -536,12 +536,13 @@ bool Node::is_multiplayer_authority() const {
/***** RPC CONFIG ********/
-uint16_t Node::rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc_mode, Multiplayer::TransferMode p_transfer_mode, int p_channel) {
+uint16_t Node::rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc_mode, bool p_call_local, Multiplayer::TransferMode p_transfer_mode, int p_channel) {
for (int i = 0; i < data.rpc_methods.size(); i++) {
if (data.rpc_methods[i].name == p_method) {
Multiplayer::RPCConfig &nd = data.rpc_methods.write[i];
nd.rpc_mode = p_rpc_mode;
nd.transfer_mode = p_transfer_mode;
+ nd.call_local = p_call_local;
nd.channel = p_channel;
return i | (1 << 15);
}
@@ -552,6 +553,7 @@ uint16_t Node::rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc
nd.rpc_mode = p_rpc_mode;
nd.transfer_mode = p_transfer_mode;
nd.channel = p_channel;
+ nd.call_local = p_call_local;
data.rpc_methods.push_back(nd);
return ((uint16_t)data.rpc_methods.size() - 1) | (1 << 15);
}
@@ -2740,7 +2742,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_multiplayer"), &Node::get_multiplayer);
ClassDB::bind_method(D_METHOD("get_custom_multiplayer"), &Node::get_custom_multiplayer);
ClassDB::bind_method(D_METHOD("set_custom_multiplayer", "api"), &Node::set_custom_multiplayer);
- ClassDB::bind_method(D_METHOD("rpc_config", "method", "rpc_mode", "transfer_mode", "channel"), &Node::rpc_config, DEFVAL(Multiplayer::TRANSFER_MODE_RELIABLE), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("rpc_config", "method", "rpc_mode", "call_local", "transfer_mode", "channel"), &Node::rpc_config, DEFVAL(false), DEFVAL(Multiplayer::TRANSFER_MODE_RELIABLE), DEFVAL(0));
ClassDB::bind_method(D_METHOD("set_editor_description", "editor_description"), &Node::set_editor_description);
ClassDB::bind_method(D_METHOD("get_editor_description"), &Node::get_editor_description);
diff --git a/scene/main/node.h b/scene/main/node.h
index 7d4c79cfba..e59a7a390a 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -466,7 +466,7 @@ public:
int get_multiplayer_authority() const;
bool is_multiplayer_authority() const;
- uint16_t rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc_mode, Multiplayer::TransferMode p_transfer_mode, int p_channel = 0); // config a local method for RPC
+ uint16_t rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc_mode, bool p_call_local = false, Multiplayer::TransferMode p_transfer_mode = Multiplayer::TRANSFER_MODE_RELIABLE, int p_channel = 0); // config a local method for RPC
Vector<Multiplayer::RPCConfig> get_node_rpc_methods() const;
void rpc(const StringName &p_method, VARIANT_ARG_LIST); // RPC, honors RPCMode, TransferMode, channel
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3d07e4473d..a122241cd0 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -570,7 +570,11 @@ void SceneTree::finalize() {
root = nullptr;
}
- // cleanup timers
+ // In case deletion of some objects was queued when destructing the `root`.
+ // E.g. if `queue_free()` was called for some node outside the tree when handling NOTIFICATION_PREDELETE for some node in the tree.
+ _flush_delete_queue();
+
+ // Cleanup timers.
for (Ref<SceneTreeTimer> &timer : timers) {
timer->release_connections();
}
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 9e462eb1c8..154e4cf683 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -82,6 +82,7 @@ void Timer::_notification(int p_what) {
void Timer::set_wait_time(double p_time) {
ERR_FAIL_COND_MSG(p_time <= 0, "Time should be greater than zero.");
wait_time = p_time;
+ update_configuration_warnings();
}
double Timer::get_wait_time() const {
@@ -179,6 +180,16 @@ void Timer::_set_process(bool p_process, bool p_force) {
processing = p_process;
}
+TypedArray<String> Timer::get_configuration_warnings() const {
+ TypedArray<String> warnings = Node::get_configuration_warnings();
+
+ if (wait_time < 0.05 - CMP_EPSILON) {
+ warnings.push_back(TTR("Very low timer wait times (< 0.05 seconds) may behave in significantly different ways depending on the rendered or physics frame rate.\nConsider using a script's process loop instead of relying on a Timer for very low wait times."));
+ }
+
+ return warnings;
+}
+
void Timer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_wait_time", "time_sec"), &Timer::set_wait_time);
ClassDB::bind_method(D_METHOD("get_wait_time"), &Timer::get_wait_time);
diff --git a/scene/main/timer.h b/scene/main/timer.h
index 2b9faddcb9..e2f34042dd 100644
--- a/scene/main/timer.h
+++ b/scene/main/timer.h
@@ -73,6 +73,8 @@ public:
double get_time_left() const;
+ TypedArray<String> get_configuration_warnings() const override;
+
void set_timer_process_callback(TimerProcessCallback p_callback);
TimerProcessCallback get_timer_process_callback() const;
Timer();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e88bb3b952..0e62e6e30a 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1079,8 +1079,11 @@ Transform2D Viewport::_get_input_pre_xform() const {
}
Ref<InputEvent> Viewport::_make_input_local(const Ref<InputEvent> &ev) {
- Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
+ if (ev.is_null()) {
+ return ev; // No transformation defined for null event
+ }
+ Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
return ev->xformed_by(ai);
}
@@ -2878,9 +2881,8 @@ bool Viewport::gui_is_dragging() const {
void Viewport::set_input_as_handled() {
_drop_physics_mouseover();
- if (handle_input_locally) {
- local_input_handled = true;
- } else {
+
+ if (!handle_input_locally) {
ERR_FAIL_COND(!is_inside_tree());
Viewport *vp = this;
while (true) {
@@ -2892,16 +2894,19 @@ void Viewport::set_input_as_handled() {
}
vp = vp->get_parent()->get_viewport();
}
- vp->set_input_as_handled();
+ if (vp != this) {
+ vp->set_input_as_handled();
+ return;
+ }
}
+
+ local_input_handled = true;
}
bool Viewport::is_input_handled() const {
- if (handle_input_locally) {
- return local_input_handled;
- } else {
- const Viewport *vp = this;
+ if (!handle_input_locally) {
ERR_FAIL_COND_V(!is_inside_tree(), false);
+ const Viewport *vp = this;
while (true) {
if (Object::cast_to<Window>(vp)) {
break;
@@ -2911,8 +2916,11 @@ bool Viewport::is_input_handled() const {
}
vp = vp->get_parent()->get_viewport();
}
- return vp->is_input_handled();
+ if (vp != this) {
+ return vp->is_input_handled();
+ }
}
+ return local_input_handled;
}
void Viewport::set_handle_input_locally(bool p_enable) {
@@ -3443,13 +3451,16 @@ bool Viewport::is_using_xr() {
return use_xr;
}
-void Viewport::set_scale_3d(const Scale3D p_scale_3d) {
- scale_3d = p_scale_3d;
+void Viewport::set_scale_3d(float p_scale_3d) {
+ // Clamp to reasonable values that are actually useful.
+ // Values above 2.0 don't serve a practical purpose since the viewport
+ // isn't displayed with mipmaps.
+ scale_3d = CLAMP(p_scale_3d, 0.1, 2.0);
- RS::get_singleton()->viewport_set_scale_3d(viewport, RS::ViewportScale3D(scale_3d));
+ RS::get_singleton()->viewport_set_scale_3d(viewport, scale_3d);
}
-Viewport::Scale3D Viewport::get_scale_3d() const {
+float Viewport::get_scale_3d() const {
return scale_3d;
}
@@ -3582,7 +3593,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_xr"), "set_use_xr", "is_using_xr");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "scale_3d", PROPERTY_HINT_ENUM, String::utf8("Disabled,75%,50%,33%,25%")), "set_scale_3d", "get_scale_3d");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "scale_3d", PROPERTY_HINT_RANGE, "0.25,2.0,0.01"), "set_scale_3d", "get_scale_3d");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_3d"), "set_as_audio_listener_3d", "is_audio_listener_3d");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world_3d"), "set_use_own_world_3d", "is_using_own_world_3d");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_3d", PROPERTY_HINT_RESOURCE_TYPE, "World3D"), "set_world_3d", "get_world_3d");
@@ -3626,12 +3637,6 @@ void Viewport::_bind_methods() {
ADD_SIGNAL(MethodInfo("size_changed"));
ADD_SIGNAL(MethodInfo("gui_focus_changed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
- BIND_ENUM_CONSTANT(SCALE_3D_DISABLED);
- BIND_ENUM_CONSTANT(SCALE_3D_75_PERCENT);
- BIND_ENUM_CONSTANT(SCALE_3D_50_PERCENT);
- BIND_ENUM_CONSTANT(SCALE_3D_33_PERCENT);
- BIND_ENUM_CONSTANT(SCALE_3D_25_PERCENT);
-
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED);
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1);
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_4);
@@ -3744,8 +3749,7 @@ Viewport::Viewport() {
ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers
#ifndef _3D_DISABLED
- int scale = GLOBAL_GET("rendering/3d/viewport/scale");
- set_scale_3d((Scale3D)scale);
+ set_scale_3d(GLOBAL_GET("rendering/3d/viewport/scale"));
#endif // _3D_DISABLED
set_sdf_oversize(sdf_oversize); // Set to server.
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 3732f9cfd1..1f19ff04c9 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -89,14 +89,6 @@ class Viewport : public Node {
GDCLASS(Viewport, Node);
public:
- enum Scale3D {
- SCALE_3D_DISABLED,
- SCALE_3D_75_PERCENT,
- SCALE_3D_50_PERCENT,
- SCALE_3D_33_PERCENT,
- SCALE_3D_25_PERCENT
- };
-
enum ShadowAtlasQuadrantSubdiv {
SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED,
SHADOW_ATLAS_QUADRANT_SUBDIV_1,
@@ -592,7 +584,7 @@ public:
#ifndef _3D_DISABLED
bool use_xr = false;
- Scale3D scale_3d = SCALE_3D_DISABLED;
+ float scale_3d = 1.0;
friend class AudioListener3D;
AudioListener3D *audio_listener_3d = nullptr;
Set<AudioListener3D *> audio_listener_3d_set;
@@ -664,8 +656,8 @@ public:
void set_use_xr(bool p_use_xr);
bool is_using_xr();
- void set_scale_3d(const Scale3D p_scale_3d);
- Scale3D get_scale_3d() const;
+ void set_scale_3d(float p_scale_3d);
+ float get_scale_3d() const;
#endif // _3D_DISABLED
Viewport();
@@ -724,7 +716,6 @@ VARIANT_ENUM_CAST(SubViewport::UpdateMode);
VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
VARIANT_ENUM_CAST(Viewport::MSAA);
VARIANT_ENUM_CAST(Viewport::ScreenSpaceAA);
-VARIANT_ENUM_CAST(Viewport::Scale3D);
VARIANT_ENUM_CAST(Viewport::DebugDraw);
VARIANT_ENUM_CAST(Viewport::SDFScale);
VARIANT_ENUM_CAST(Viewport::SDFOversize);
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index cab6c0378a..9a3f081a8b 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -173,23 +173,13 @@ Environment::ReflectionSource Environment::get_reflection_source() const {
return reflection_source;
}
-void Environment::set_ao_color(const Color &p_color) {
- ao_color = p_color;
- _update_ambient_light();
-}
-
-Color Environment::get_ao_color() const {
- return ao_color;
-}
-
void Environment::_update_ambient_light() {
RS::get_singleton()->environment_set_ambient_light(
environment,
ambient_color,
RS::EnvironmentAmbientSource(ambient_source),
ambient_energy,
- ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source),
- ao_color);
+ ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source));
}
// Tonemap
@@ -302,7 +292,7 @@ int Environment::get_ssr_max_steps() const {
}
void Environment::set_ssr_fade_in(float p_fade_in) {
- ssr_fade_in = p_fade_in;
+ ssr_fade_in = MAX(p_fade_in, 0.0f);
_update_ssr();
}
@@ -311,7 +301,7 @@ float Environment::get_ssr_fade_in() const {
}
void Environment::set_ssr_fade_out(float p_fade_out) {
- ssr_fade_out = p_fade_out;
+ ssr_fade_out = MAX(p_fade_out, 0.0f);
_update_ssr();
}
@@ -1092,15 +1082,12 @@ void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_ambient_light_sky_contribution"), &Environment::get_ambient_light_sky_contribution);
ClassDB::bind_method(D_METHOD("set_reflection_source", "source"), &Environment::set_reflection_source);
ClassDB::bind_method(D_METHOD("get_reflection_source"), &Environment::get_reflection_source);
- ClassDB::bind_method(D_METHOD("set_ao_color", "color"), &Environment::set_ao_color);
- ClassDB::bind_method(D_METHOD("get_ao_color"), &Environment::get_ao_color);
ADD_GROUP("Ambient Light", "ambient_light_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ambient_light_source", PROPERTY_HINT_ENUM, "Background,Disabled,Color,Sky"), "set_ambient_source", "get_ambient_source");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ambient_light_color"), "set_ambient_light_color", "get_ambient_light_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ambient_light_sky_contribution", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ambient_light_sky_contribution", "get_ambient_light_sky_contribution");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ambient_light_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_ambient_light_energy", "get_ambient_light_energy");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ambient_light_occlusion_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ao_color", "get_ao_color");
ADD_GROUP("Reflected Light", "reflected_light_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "reflected_light_source", PROPERTY_HINT_ENUM, "Background,Disabled,Sky"), "set_reflection_source", "get_reflection_source");
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 0df2c3cc27..46842754f4 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -116,7 +116,6 @@ private:
float ambient_energy = 1.0;
float ambient_sky_contribution = 1.0;
ReflectionSource reflection_source = REFLECTION_SOURCE_BG;
- Color ao_color;
void _update_ambient_light();
// Tonemap
@@ -250,8 +249,6 @@ public:
float get_ambient_light_sky_contribution() const;
void set_reflection_source(ReflectionSource p_source);
ReflectionSource get_reflection_source() const;
- void set_ao_color(const Color &p_color);
- Color get_ao_color() const;
// Tonemap
void set_tonemapper(ToneMapper p_tone_mapper);
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index c1d42dff09..04e2b0dc70 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -116,8 +116,8 @@ void FontData::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_scale", "cache_index", "size", "scale"), &FontData::set_scale);
ClassDB::bind_method(D_METHOD("get_scale", "cache_index", "size"), &FontData::get_scale);
- ClassDB::bind_method(D_METHOD("set_spacing", "cache_index", "size", "spacing"), &FontData::set_spacing);
- ClassDB::bind_method(D_METHOD("get_spacing", "cache_index", "size"), &FontData::get_spacing);
+ ClassDB::bind_method(D_METHOD("set_spacing", "cache_index", "size", "spacing_type", "value"), &FontData::set_spacing);
+ ClassDB::bind_method(D_METHOD("get_spacing", "cache_index", "size", "spacing_type"), &FontData::get_spacing);
ClassDB::bind_method(D_METHOD("get_texture_count", "cache_index", "size"), &FontData::get_texture_count);
ClassDB::bind_method(D_METHOD("clear_textures", "cache_index", "size"), &FontData::clear_textures);
@@ -175,7 +175,7 @@ void FontData::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_char", "char"), &FontData::has_char);
ClassDB::bind_method(D_METHOD("get_supported_chars"), &FontData::get_supported_chars);
- ClassDB::bind_method(D_METHOD("get_glyph_index", "char", "variation_selector"), &FontData::get_glyph_index);
+ ClassDB::bind_method(D_METHOD("get_glyph_index", "size", "char", "variation_selector"), &FontData::get_glyph_index);
ClassDB::bind_method(D_METHOD("get_supported_feature_list"), &FontData::get_supported_feature_list);
ClassDB::bind_method(D_METHOD("get_supported_variation_list"), &FontData::get_supported_variation_list);
diff --git a/scene/resources/importer_mesh.cpp b/scene/resources/importer_mesh.cpp
index af69b799cc..2572c5de33 100644
--- a/scene/resources/importer_mesh.cpp
+++ b/scene/resources/importer_mesh.cpp
@@ -37,26 +37,34 @@
#include <cstdint>
void ImporterMesh::Surface::split_normals(const LocalVector<int> &p_indices, const LocalVector<Vector3> &p_normals) {
- ERR_FAIL_COND(arrays.size() != RS::ARRAY_MAX);
+ _split_normals(arrays, p_indices, p_normals);
- const PackedVector3Array &vertices = arrays[RS::ARRAY_VERTEX];
+ for (BlendShape &blend_shape : blend_shape_data) {
+ _split_normals(blend_shape.arrays, p_indices, p_normals);
+ }
+}
+
+void ImporterMesh::Surface::_split_normals(Array &r_arrays, const LocalVector<int> &p_indices, const LocalVector<Vector3> &p_normals) {
+ ERR_FAIL_COND(r_arrays.size() != RS::ARRAY_MAX);
+
+ const PackedVector3Array &vertices = r_arrays[RS::ARRAY_VERTEX];
int current_vertex_count = vertices.size();
int new_vertex_count = p_indices.size();
int final_vertex_count = current_vertex_count + new_vertex_count;
const int *indices_ptr = p_indices.ptr();
- for (int i = 0; i < arrays.size(); i++) {
+ for (int i = 0; i < r_arrays.size(); i++) {
if (i == RS::ARRAY_INDEX) {
continue;
}
- if (arrays[i].get_type() == Variant::NIL) {
+ if (r_arrays[i].get_type() == Variant::NIL) {
continue;
}
- switch (arrays[i].get_type()) {
+ switch (r_arrays[i].get_type()) {
case Variant::PACKED_VECTOR3_ARRAY: {
- PackedVector3Array data = arrays[i];
+ PackedVector3Array data = r_arrays[i];
data.resize(final_vertex_count);
Vector3 *data_ptr = data.ptrw();
if (i == RS::ARRAY_NORMAL) {
@@ -67,55 +75,55 @@ void ImporterMesh::Surface::split_normals(const LocalVector<int> &p_indices, con
data_ptr[current_vertex_count + j] = data_ptr[indices_ptr[j]];
}
}
- arrays[i] = data;
+ r_arrays[i] = data;
} break;
case Variant::PACKED_VECTOR2_ARRAY: {
- PackedVector2Array data = arrays[i];
+ PackedVector2Array data = r_arrays[i];
data.resize(final_vertex_count);
Vector2 *data_ptr = data.ptrw();
for (int j = 0; j < new_vertex_count; j++) {
data_ptr[current_vertex_count + j] = data_ptr[indices_ptr[j]];
}
- arrays[i] = data;
+ r_arrays[i] = data;
} break;
case Variant::PACKED_FLOAT32_ARRAY: {
- PackedFloat32Array data = arrays[i];
+ PackedFloat32Array data = r_arrays[i];
int elements = data.size() / current_vertex_count;
data.resize(final_vertex_count * elements);
float *data_ptr = data.ptrw();
for (int j = 0; j < new_vertex_count; j++) {
memcpy(&data_ptr[(current_vertex_count + j) * elements], &data_ptr[indices_ptr[j] * elements], sizeof(float) * elements);
}
- arrays[i] = data;
+ r_arrays[i] = data;
} break;
case Variant::PACKED_INT32_ARRAY: {
- PackedInt32Array data = arrays[i];
+ PackedInt32Array data = r_arrays[i];
int elements = data.size() / current_vertex_count;
data.resize(final_vertex_count * elements);
int32_t *data_ptr = data.ptrw();
for (int j = 0; j < new_vertex_count; j++) {
memcpy(&data_ptr[(current_vertex_count + j) * elements], &data_ptr[indices_ptr[j] * elements], sizeof(int32_t) * elements);
}
- arrays[i] = data;
+ r_arrays[i] = data;
} break;
case Variant::PACKED_BYTE_ARRAY: {
- PackedByteArray data = arrays[i];
+ PackedByteArray data = r_arrays[i];
int elements = data.size() / current_vertex_count;
data.resize(final_vertex_count * elements);
uint8_t *data_ptr = data.ptrw();
for (int j = 0; j < new_vertex_count; j++) {
memcpy(&data_ptr[(current_vertex_count + j) * elements], &data_ptr[indices_ptr[j] * elements], sizeof(uint8_t) * elements);
}
- arrays[i] = data;
+ r_arrays[i] = data;
} break;
case Variant::PACKED_COLOR_ARRAY: {
- PackedColorArray data = arrays[i];
+ PackedColorArray data = r_arrays[i];
data.resize(final_vertex_count);
Color *data_ptr = data.ptrw();
for (int j = 0; j < new_vertex_count; j++) {
data_ptr[current_vertex_count + j] = data_ptr[indices_ptr[j]];
}
- arrays[i] = data;
+ r_arrays[i] = data;
} break;
default: {
ERR_FAIL_MSG("Unhandled array type.");
@@ -261,9 +269,6 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
if (surfaces[i].primitive != Mesh::PRIMITIVE_TRIANGLES) {
continue;
}
- if (get_blend_shape_count()) {
- continue;
- }
surfaces.write[i].lods.clear();
Vector<Vector3> vertices = surfaces[i].arrays[RS::ARRAY_VERTEX];
diff --git a/scene/resources/importer_mesh.h b/scene/resources/importer_mesh.h
index 89909f17f0..8576312a8a 100644
--- a/scene/resources/importer_mesh.h
+++ b/scene/resources/importer_mesh.h
@@ -70,6 +70,7 @@ class ImporterMesh : public Resource {
};
void split_normals(const LocalVector<int> &p_indices, const LocalVector<Vector3> &p_normals);
+ static void _split_normals(Array &r_arrays, const LocalVector<int> &p_indices, const LocalVector<Vector3> &p_normals);
};
Vector<Surface> surfaces;
Vector<String> blend_shapes;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 18e6a51118..7ffe0b03e1 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1577,7 +1577,7 @@ void ArrayMesh::regen_normal_maps() {
}
//dirty hack
-bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, int p_index_count, const uint8_t *p_cache_data, bool *r_use_cache, uint8_t **r_mesh_cache, int *r_mesh_cache_size, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = NULL;
+bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, int p_index_count, const uint8_t *p_cache_data, bool *r_use_cache, uint8_t **r_mesh_cache, int *r_mesh_cache_size, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = nullptr;
struct ArrayMeshLightmapSurface {
Ref<Material> material;
diff --git a/scene/resources/skeleton_modification_stack_2d.cpp b/scene/resources/skeleton_modification_stack_2d.cpp
index 72c1c330ef..db9fe62b4d 100644
--- a/scene/resources/skeleton_modification_stack_2d.cpp
+++ b/scene/resources/skeleton_modification_stack_2d.cpp
@@ -247,7 +247,7 @@ void SkeletonModificationStack2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("delete_modification", "mod_idx"), &SkeletonModificationStack2D::delete_modification);
ClassDB::bind_method(D_METHOD("set_modification", "mod_idx", "modification"), &SkeletonModificationStack2D::set_modification);
- ClassDB::bind_method(D_METHOD("set_modification_count"), &SkeletonModificationStack2D::set_modification_count);
+ ClassDB::bind_method(D_METHOD("set_modification_count", "count"), &SkeletonModificationStack2D::set_modification_count);
ClassDB::bind_method(D_METHOD("get_modification_count"), &SkeletonModificationStack2D::get_modification_count);
ClassDB::bind_method(D_METHOD("get_is_setup"), &SkeletonModificationStack2D::get_is_setup);
diff --git a/scene/resources/skeleton_modification_stack_3d.cpp b/scene/resources/skeleton_modification_stack_3d.cpp
index 3fce0e5dbd..a724b732b9 100644
--- a/scene/resources/skeleton_modification_stack_3d.cpp
+++ b/scene/resources/skeleton_modification_stack_3d.cpp
@@ -200,7 +200,7 @@ void SkeletonModificationStack3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("delete_modification", "mod_idx"), &SkeletonModificationStack3D::delete_modification);
ClassDB::bind_method(D_METHOD("set_modification", "mod_idx", "modification"), &SkeletonModificationStack3D::set_modification);
- ClassDB::bind_method(D_METHOD("set_modification_count"), &SkeletonModificationStack3D::set_modification_count);
+ ClassDB::bind_method(D_METHOD("set_modification_count", "count"), &SkeletonModificationStack3D::set_modification_count);
ClassDB::bind_method(D_METHOD("get_modification_count"), &SkeletonModificationStack3D::get_modification_count);
ClassDB::bind_method(D_METHOD("get_is_setup"), &SkeletonModificationStack3D::get_is_setup);
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index b6d3c96cb7..de94c92cac 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -175,14 +175,14 @@ void ProceduralSkyMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_sun_curve"), &ProceduralSkyMaterial::get_sun_curve);
ADD_GROUP("Sky", "sky_");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_top_color"), "set_sky_top_color", "get_sky_top_color");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_horizon_color"), "set_sky_horizon_color", "get_sky_horizon_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_top_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_sky_top_color", "get_sky_top_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_horizon_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_sky_horizon_color", "get_sky_horizon_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sky_curve", PROPERTY_HINT_EXP_EASING), "set_sky_curve", "get_sky_curve");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sky_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_sky_energy", "get_sky_energy");
ADD_GROUP("Ground", "ground_");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_bottom_color"), "set_ground_bottom_color", "get_ground_bottom_color");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_horizon_color"), "set_ground_horizon_color", "get_ground_horizon_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_bottom_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ground_bottom_color", "get_ground_bottom_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_horizon_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ground_horizon_color", "get_ground_horizon_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ground_curve", PROPERTY_HINT_EXP_EASING), "set_ground_curve", "get_ground_curve");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ground_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_ground_energy", "get_ground_energy");
@@ -531,16 +531,16 @@ void PhysicalSkyMaterial::_bind_methods() {
ADD_GROUP("Rayleigh", "rayleigh_");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rayleigh_coefficient", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_rayleigh_coefficient", "get_rayleigh_coefficient");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "rayleigh_color"), "set_rayleigh_color", "get_rayleigh_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "rayleigh_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_rayleigh_color", "get_rayleigh_color");
ADD_GROUP("Mie", "mie_");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mie_coefficient", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_mie_coefficient", "get_mie_coefficient");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mie_eccentricity", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_mie_eccentricity", "get_mie_eccentricity");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "mie_color"), "set_mie_color", "get_mie_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "mie_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_mie_color", "get_mie_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "turbidity", PROPERTY_HINT_RANGE, "0,1000,0.01"), "set_turbidity", "get_turbidity");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_disk_scale", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_disk_scale", "get_sun_disk_scale");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_color"), "set_ground_color", "get_ground_color");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ground_color", "get_ground_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "exposure", PROPERTY_HINT_RANGE, "0,128,0.01"), "set_exposure", "get_exposure");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dither_strength", PROPERTY_HINT_RANGE, "0,10,0.01"), "set_dither_strength", "get_dither_strength");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "night_sky", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_night_sky", "get_night_sky");
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 40eedb63c1..f5e52b70e6 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -72,6 +72,7 @@ void TileSet::set_tile_shape(TileSet::TileShape p_shape) {
terrain_bits_meshes_dirty = true;
tile_meshes_dirty = true;
+ notify_property_list_changed();
emit_changed();
}
TileSet::TileShape TileSet::get_tile_shape() const {
@@ -170,6 +171,8 @@ void TileSet::set_source_id(int p_source_id, int p_new_source_id) {
source_ids.append(p_new_source_id);
source_ids.sort();
+ _compute_next_source_id();
+
emit_changed();
}
@@ -2685,6 +2688,14 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::ARRAY, "tile_proxies/alternative_level", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
+void TileSet::_validate_property(PropertyInfo &property) const {
+ if (property.name == "tile_layout" && tile_shape == TILE_SHAPE_SQUARE) {
+ property.usage ^= PROPERTY_USAGE_READ_ONLY;
+ } else if (property.name == "tile_offset_axis" && tile_shape == TILE_SHAPE_SQUARE) {
+ property.usage ^= PROPERTY_USAGE_READ_ONLY;
+ }
+}
+
void TileSet::_bind_methods() {
// Sources management.
ClassDB::bind_method(D_METHOD("get_next_source_id"), &TileSet::get_next_source_id);
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 2b4929b3df..716b66405f 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -180,6 +180,7 @@ protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
+ virtual void _validate_property(PropertyInfo &property) const override;
private:
// --- TileSet data ---
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index 29e5dd6056..186764e69e 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -64,6 +64,8 @@ SceneStringNames::SceneStringNames() {
pose_updated = StaticCString::create("pose_updated");
bone_pose_changed = StaticCString::create("bone_pose_changed");
+ bone_enabled_changed = StaticCString::create("bone_enabled_changed");
+ show_rest_only_changed = StaticCString::create("show_rest_only_changed");
mouse_entered = StaticCString::create("mouse_entered");
mouse_exited = StaticCString::create("mouse_exited");
@@ -135,6 +137,7 @@ SceneStringNames::SceneStringNames() {
_spatial_editor_group = StaticCString::create("_spatial_editor_group");
_request_gizmo = StaticCString::create("_request_gizmo");
+ _set_subgizmo_selection = StaticCString::create("_set_subgizmo_selection");
_clear_subgizmo_selection = StaticCString::create("_clear_subgizmo_selection");
offset = StaticCString::create("offset");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 5e3195952e..67007c85e0 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -100,6 +100,8 @@ public:
StringName pose_updated;
StringName bone_pose_changed;
+ StringName bone_enabled_changed;
+ StringName show_rest_only_changed;
StringName body_shape_entered;
StringName body_entered;
@@ -155,6 +157,7 @@ public:
StringName _spatial_editor_group;
StringName _request_gizmo;
+ StringName _set_subgizmo_selection;
StringName _clear_subgizmo_selection;
StringName offset;