summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/reflection_probe.cpp13
-rw-r--r--scene/3d/reflection_probe.h4
-rw-r--r--scene/3d/skeleton_3d.cpp13
-rw-r--r--scene/animation/animation_player.cpp23
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/gui/button.cpp15
-rw-r--r--scene/gui/popup_menu.cpp24
-rw-r--r--scene/gui/popup_menu.h1
-rw-r--r--scene/gui/tree.cpp55
-rw-r--r--scene/gui/tree.h7
-rw-r--r--scene/main/node.cpp5
-rw-r--r--scene/main/node.h1
-rw-r--r--scene/main/viewport.cpp10
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/visual_shader.cpp14
-rw-r--r--scene/resources/visual_shader.h1
-rw-r--r--scene/theme/theme_db.cpp4
17 files changed, 168 insertions, 26 deletions
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 2e34f6aad0..b4dd6d09be 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -165,6 +165,15 @@ uint32_t ReflectionProbe::get_cull_mask() const {
return cull_mask;
}
+void ReflectionProbe::set_reflection_mask(uint32_t p_layers) {
+ reflection_mask = p_layers;
+ RS::get_singleton()->reflection_probe_set_reflection_mask(probe, p_layers);
+}
+
+uint32_t ReflectionProbe::get_reflection_mask() const {
+ return reflection_mask;
+}
+
void ReflectionProbe::set_update_mode(UpdateMode p_mode) {
update_mode = p_mode;
RS::get_singleton()->reflection_probe_set_update_mode(probe, RS::ReflectionProbeUpdateMode(p_mode));
@@ -237,6 +246,9 @@ void ReflectionProbe::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_cull_mask", "layers"), &ReflectionProbe::set_cull_mask);
ClassDB::bind_method(D_METHOD("get_cull_mask"), &ReflectionProbe::get_cull_mask);
+ ClassDB::bind_method(D_METHOD("set_reflection_mask", "layers"), &ReflectionProbe::set_reflection_mask);
+ ClassDB::bind_method(D_METHOD("get_reflection_mask"), &ReflectionProbe::get_reflection_mask);
+
ClassDB::bind_method(D_METHOD("set_update_mode", "mode"), &ReflectionProbe::set_update_mode);
ClassDB::bind_method(D_METHOD("get_update_mode"), &ReflectionProbe::get_update_mode);
@@ -249,6 +261,7 @@ void ReflectionProbe::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_as_interior", "is_set_as_interior");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enable_shadows"), "set_enable_shadows", "are_shadows_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_cull_mask", "get_cull_mask");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "reflection_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_reflection_mask", "get_reflection_mask");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mesh_lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_mesh_lod_threshold", "get_mesh_lod_threshold");
ADD_GROUP("Ambient", "ambient_");
diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h
index 5438219d5e..425fbb5bc2 100644
--- a/scene/3d/reflection_probe.h
+++ b/scene/3d/reflection_probe.h
@@ -63,6 +63,7 @@ private:
float mesh_lod_threshold = 1.0;
uint32_t cull_mask = (1 << 20) - 1;
+ uint32_t reflection_mask = (1 << 20) - 1;
UpdateMode update_mode = UPDATE_ONCE;
protected:
@@ -113,6 +114,9 @@ public:
void set_cull_mask(uint32_t p_layers);
uint32_t get_cull_mask() const;
+ void set_reflection_mask(uint32_t p_layers);
+ uint32_t get_reflection_mask() const;
+
void set_update_mode(UpdateMode p_mode);
UpdateMode get_update_mode() const;
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index ec5f8187a9..ee30f60c72 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -94,6 +94,19 @@ bool Skeleton3D::_set(const StringName &p_path, const Variant &p_value) {
set_bone_pose_rotation(which, p_value);
} else if (what == "scale") {
set_bone_pose_scale(which, p_value);
+#ifndef DISABLE_DEPRECATED
+ } else if (what == "pose") {
+ // Kept for compatibility from 3.x to 4.x.
+ WARN_DEPRECATED_MSG("Skeleton uses old pose format, which is deprecated (and loads slower). Consider re-importing or re-saving the scene." +
+ (is_inside_tree() ? vformat(" Path: \"%s\"", get_path()) : String()));
+ // Old Skeleton poses were relative to rest, new ones are absolute, so we need to recompute the pose.
+ // Skeleton3D nodes were always written with rest before pose, so this *SHOULD* work...
+ Transform3D rest = get_bone_rest(which);
+ Transform3D pose = rest * (Transform3D)p_value;
+ set_bone_pose_position(which, pose.origin);
+ set_bone_pose_rotation(which, pose.basis.get_rotation_quaternion());
+ set_bone_pose_scale(which, pose.basis.get_scale());
+#endif
} else {
return false;
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index b7bed59c00..36f1cd01f4 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -241,6 +241,16 @@ void AnimationPlayer::_process_playback_data(PlaybackData &cd, double p_delta, f
make_animation_instance(cd.from->name, pi);
}
+float AnimationPlayer::get_current_blend_amount() {
+ Playback &c = playback;
+ float blend = 1.0;
+ for (List<Blend>::Element *E = c.blend.front(); E; E = E->next()) {
+ Blend &b = E->get();
+ blend = blend - b.blend_left;
+ }
+ return MAX(0, blend);
+}
+
void AnimationPlayer::_blend_playback_data(double p_delta, bool p_started) {
Playback &c = playback;
@@ -250,16 +260,8 @@ void AnimationPlayer::_blend_playback_data(double p_delta, bool p_started) {
c.seeked = false;
}
- // First, calc all blends weight.
- float blend = 1.0;
- for (List<Blend>::Element *E = c.blend.front(); E; E = E->next()) {
- Blend &b = E->get();
- blend = MAX(0, blend - b.blend_left);
- b.blend_left = MAX(0, b.blend_left - Math::absf(speed_scale * p_delta) / b.blend_time);
- }
-
// Second, process current animation to check if the animation end reached.
- _process_playback_data(c.current, p_delta, blend, seeked, p_started, true);
+ _process_playback_data(c.current, p_delta, get_current_blend_amount(), seeked, p_started, true);
// Finally, if not end the animation, do blending.
if (end_reached) {
@@ -269,6 +271,7 @@ void AnimationPlayer::_blend_playback_data(double p_delta, bool p_started) {
List<List<Blend>::Element *> to_erase;
for (List<Blend>::Element *E = c.blend.front(); E; E = E->next()) {
Blend &b = E->get();
+ b.blend_left = MAX(0, b.blend_left - Math::absf(speed_scale * p_delta) / b.blend_time);
if (b.blend_left <= 0) {
to_erase.push_back(E);
b.blend_left = CMP_EPSILON; // May want to play last frame.
@@ -405,7 +408,7 @@ void AnimationPlayer::play(const StringName &p_name, double p_custom_blend, floa
if (blend_time > 0) {
Blend b;
b.data = c.current;
- b.blend_left = 1.0;
+ b.blend_left = get_current_blend_amount();
b.blend_time = blend_time;
c.blend.push_back(b);
} else {
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 74f9323e2b..16bca45d4b 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -113,6 +113,8 @@ private:
void _stop_internal(bool p_reset, bool p_keep_state);
void _check_immediately_after_start();
+ float get_current_blend_amount();
+
bool playing = false;
protected:
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 222cdd15e4..a4eddb832d 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -167,20 +167,21 @@ void Button::_notification(int p_what) {
const int h_separation = MAX(0, theme_cache.h_separation);
+ float left_internal_margin_with_h_separation = _internal_margin[SIDE_LEFT];
+ float right_internal_margin_with_h_separation = _internal_margin[SIDE_RIGHT];
{ // The width reserved for internal element in derived classes (and h_separation if need).
- float internal_margin = _internal_margin[SIDE_LEFT] + _internal_margin[SIDE_RIGHT];
if (!xl_text.is_empty() || h_separation_is_valid_when_no_text) {
if (_internal_margin[SIDE_LEFT] > 0.0f) {
- internal_margin += h_separation;
+ left_internal_margin_with_h_separation += h_separation;
}
if (_internal_margin[SIDE_RIGHT] > 0.0f) {
- internal_margin += h_separation;
+ right_internal_margin_with_h_separation += h_separation;
}
}
- drawable_size_remained.width -= internal_margin; // The size after the internal element is stripped.
+ drawable_size_remained.width -= left_internal_margin_with_h_separation + right_internal_margin_with_h_separation; // The size after the internal element is stripped.
}
HorizontalAlignment icon_align_rtl_checked = horizontal_icon_alignment;
@@ -308,12 +309,12 @@ void Button::_notification(int p_what) {
case HORIZONTAL_ALIGNMENT_FILL:
case HORIZONTAL_ALIGNMENT_LEFT: {
icon_ofs.x += style_margin_left;
- icon_ofs.x += _internal_margin[SIDE_LEFT];
+ icon_ofs.x += left_internal_margin_with_h_separation;
} break;
case HORIZONTAL_ALIGNMENT_RIGHT: {
icon_ofs.x = size.x - style_margin_right;
- icon_ofs.x -= _internal_margin[SIDE_RIGHT];
+ icon_ofs.x -= right_internal_margin_with_h_separation;
icon_ofs.x -= icon_size.width;
} break;
}
@@ -368,7 +369,7 @@ void Button::_notification(int p_what) {
case HORIZONTAL_ALIGNMENT_LEFT:
case HORIZONTAL_ALIGNMENT_RIGHT: {
text_ofs.x += style_margin_left;
- text_ofs.x += _internal_margin[SIDE_LEFT];
+ text_ofs.x += left_internal_margin_with_h_separation;
if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_LEFT) {
// Offset by the space's width that occupied by icon and h_separation together.
text_ofs.x += custom_element_size.width - drawable_size_remained.width;
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 2414278e52..dc586e86c9 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -2086,6 +2086,26 @@ void PopupMenu::set_item_indent(int p_idx, int p_indent) {
_menu_changed();
}
+void PopupMenu::set_item_max_states(int p_idx, int p_max_states) {
+ if (p_idx < 0) {
+ p_idx += get_item_count();
+ }
+ ERR_FAIL_INDEX(p_idx, items.size());
+
+ if (items[p_idx].max_states == p_max_states) {
+ return;
+ }
+
+ items.write[p_idx].max_states = p_max_states;
+
+ if (!global_menu_name.is_empty()) {
+ DisplayServer::get_singleton()->global_menu_set_item_max_states(global_menu_name, p_idx, p_max_states);
+ }
+
+ control->queue_redraw();
+ _menu_changed();
+}
+
void PopupMenu::set_item_multistate(int p_idx, int p_state) {
if (p_idx < 0) {
p_idx += get_item_count();
@@ -2724,6 +2744,7 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_item_shortcut", "index", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_item_indent", "index", "indent"), &PopupMenu::set_item_indent);
ClassDB::bind_method(D_METHOD("set_item_multistate", "index", "state"), &PopupMenu::set_item_multistate);
+ ClassDB::bind_method(D_METHOD("set_item_multistate_max", "index", "max_states"), &PopupMenu::set_item_max_states);
ClassDB::bind_method(D_METHOD("set_item_shortcut_disabled", "index", "disabled"), &PopupMenu::set_item_shortcut_disabled);
ClassDB::bind_method(D_METHOD("toggle_item_checked", "index"), &PopupMenu::toggle_item_checked);
@@ -2750,6 +2771,9 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item_shortcut", "index"), &PopupMenu::get_item_shortcut);
ClassDB::bind_method(D_METHOD("get_item_indent", "index"), &PopupMenu::get_item_indent);
+ ClassDB::bind_method(D_METHOD("get_item_multistate_max", "index"), &PopupMenu::get_item_max_states);
+ ClassDB::bind_method(D_METHOD("get_item_multistate", "index"), &PopupMenu::get_item_state);
+
ClassDB::bind_method(D_METHOD("set_focused_item", "index"), &PopupMenu::set_focused_item);
ClassDB::bind_method(D_METHOD("get_focused_item"), &PopupMenu::get_focused_item);
ClassDB::bind_method(D_METHOD("set_item_count", "count"), &PopupMenu::set_item_count);
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 9783f9d57b..35ababd913 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -264,6 +264,7 @@ public:
void set_item_tooltip(int p_idx, const String &p_tooltip);
void set_item_shortcut(int p_idx, const Ref<Shortcut> &p_shortcut, bool p_global = false);
void set_item_indent(int p_idx, int p_indent);
+ void set_item_max_states(int p_idx, int p_max_states);
void set_item_multistate(int p_idx, int p_state);
void toggle_item_multistate(int p_idx);
void set_item_shortcut_disabled(int p_idx, bool p_disabled);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index c67c3cd98d..4ecbc173b7 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -584,12 +584,30 @@ Variant TreeItem::get_metadata(int p_column) const {
return cells[p_column].meta;
}
+#ifndef DISABLE_DEPRECATED
void TreeItem::set_custom_draw(int p_column, Object *p_object, const StringName &p_callback) {
+ WARN_DEPRECATED_MSG(R"*(The "set_custom_draw()" method is deprecated, use "set_custom_draw_callback()" instead.)*");
ERR_FAIL_INDEX(p_column, cells.size());
ERR_FAIL_NULL(p_object);
- cells.write[p_column].custom_draw_obj = p_object->get_instance_id();
+ cells.write[p_column].custom_draw_callback = Callable(p_object, p_callback);
+
+ _changed_notify(p_column);
+}
+#endif // DISABLE_DEPRECATED
+
+void TreeItem::set_custom_draw_callback(int p_column, const Callable &p_callback) {
+ ERR_FAIL_INDEX(p_column, cells.size());
+
cells.write[p_column].custom_draw_callback = p_callback;
+
+ _changed_notify(p_column);
+}
+
+Callable TreeItem::get_custom_draw_callback(int p_column) const {
+ ERR_FAIL_INDEX_V(p_column, cells.size(), Callable());
+
+ return cells[p_column].custom_draw_callback;
}
void TreeItem::set_collapsed(bool p_collapsed) {
@@ -1306,8 +1324,14 @@ void TreeItem::clear_custom_color(int p_column) {
void TreeItem::set_custom_font(int p_column, const Ref<Font> &p_font) {
ERR_FAIL_INDEX(p_column, cells.size());
+ if (cells[p_column].custom_font == p_font) {
+ return;
+ }
+
cells.write[p_column].custom_font = p_font;
cells.write[p_column].cached_minimum_size_dirty = true;
+
+ _changed_notify(p_column);
}
Ref<Font> TreeItem::get_custom_font(int p_column) const {
@@ -1318,8 +1342,14 @@ Ref<Font> TreeItem::get_custom_font(int p_column) const {
void TreeItem::set_custom_font_size(int p_column, int p_font_size) {
ERR_FAIL_INDEX(p_column, cells.size());
+ if (cells[p_column].custom_font_size == p_font_size) {
+ return;
+ }
+
cells.write[p_column].custom_font_size = p_font_size;
cells.write[p_column].cached_minimum_size_dirty = true;
+
+ _changed_notify(p_column);
}
int TreeItem::get_custom_font_size(int p_column) const {
@@ -1368,8 +1398,14 @@ Color TreeItem::get_custom_bg_color(int p_column) const {
void TreeItem::set_custom_as_button(int p_column, bool p_button) {
ERR_FAIL_INDEX(p_column, cells.size());
+ if (cells[p_column].custom_button == p_button) {
+ return;
+ }
+
cells.write[p_column].custom_button = p_button;
cells.write[p_column].cached_minimum_size_dirty = true;
+
+ _changed_notify(p_column);
}
bool TreeItem::is_custom_set_as_button(int p_column) const {
@@ -1574,7 +1610,11 @@ void TreeItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_metadata", "column", "meta"), &TreeItem::set_metadata);
ClassDB::bind_method(D_METHOD("get_metadata", "column"), &TreeItem::get_metadata);
+#ifndef DISABLE_DEPRECATED
ClassDB::bind_method(D_METHOD("set_custom_draw", "column", "object", "callback"), &TreeItem::set_custom_draw);
+#endif // DISABLE_DEPRECATED
+ ClassDB::bind_method(D_METHOD("set_custom_draw_callback", "column", "callback"), &TreeItem::set_custom_draw_callback);
+ ClassDB::bind_method(D_METHOD("get_custom_draw_callback", "column"), &TreeItem::get_custom_draw_callback);
ClassDB::bind_method(D_METHOD("set_collapsed", "enable"), &TreeItem::set_collapsed);
ClassDB::bind_method(D_METHOD("is_collapsed"), &TreeItem::is_collapsed);
@@ -2297,10 +2337,15 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
} break;
case TreeItem::CELL_MODE_CUSTOM: {
- if (p_item->cells[i].custom_draw_obj.is_valid()) {
- Object *cdo = ObjectDB::get_instance(p_item->cells[i].custom_draw_obj);
- if (cdo) {
- cdo->call(p_item->cells[i].custom_draw_callback, p_item, Rect2(item_rect));
+ if (p_item->cells[i].custom_draw_callback.is_valid()) {
+ Variant args[] = { p_item, Rect2(item_rect) };
+ const Variant *argptrs[] = { &args[0], &args[1] };
+
+ Callable::CallError ce;
+ Variant ret;
+ p_item->cells[i].custom_draw_callback.callp(argptrs, 2, ret, ce);
+ if (ce.error != Callable::CallError::CALL_OK) {
+ ERR_PRINT("Error calling custom draw method: " + Variant::get_callable_error_text(p_item->cells[i].custom_draw_callback, argptrs, 2, ce) + ".");
}
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 2dda408dd7..8ec003be9c 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -99,8 +99,7 @@ private:
Variant meta;
String tooltip;
- ObjectID custom_draw_obj;
- StringName custom_draw_callback;
+ Callable custom_draw_callback;
struct Button {
int id = 0;
@@ -285,7 +284,11 @@ public:
void set_metadata(int p_column, const Variant &p_meta);
Variant get_metadata(int p_column) const;
+#ifndef DISABLE_DEPRECATED
void set_custom_draw(int p_column, Object *p_object, const StringName &p_callback);
+#endif // DISABLE_DEPRECATED
+ void set_custom_draw_callback(int p_column, const Callable &p_callback);
+ Callable get_custom_draw_callback(int p_column) const;
void set_collapsed(bool p_collapsed);
bool is_collapsed();
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index f7d695bf31..704ff3e978 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1214,6 +1214,11 @@ String Node::validate_child_name(Node *p_child) {
_generate_serial_child_name(p_child, name);
return name;
}
+
+String Node::prevalidate_child_name(Node *p_child, StringName p_name) {
+ _generate_serial_child_name(p_child, p_name);
+ return p_name;
+}
#endif
String Node::adjust_name_casing(const String &p_name) {
diff --git a/scene/main/node.h b/scene/main/node.h
index 8130c61a34..c82300e6a0 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -614,6 +614,7 @@ public:
#ifdef TOOLS_ENABLED
String validate_child_name(Node *p_child);
+ String prevalidate_child_name(Node *p_child, StringName p_name);
#endif
static String adjust_name_casing(const String &p_name);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index fe02d97586..f92ab76753 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -3316,6 +3316,16 @@ void Viewport::push_input(const Ref<InputEvent> &p_event, bool p_local_coords) {
}
local_input_handled = false;
+ if (!handle_input_locally) {
+ Viewport *vp = this;
+ while (true) {
+ if (Object::cast_to<Window>(vp) || !vp->get_parent()) {
+ break;
+ }
+ vp = vp->get_parent()->get_viewport();
+ }
+ vp->local_input_handled = false;
+ }
Ref<InputEvent> ev;
if (!p_local_coords) {
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 6f12539a6d..0abf878659 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1558,6 +1558,7 @@ void ArrayMesh::_create_if_empty() const {
mesh = RS::get_singleton()->mesh_create();
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
RS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size());
+ RS::get_singleton()->mesh_set_path(mesh, get_path());
}
}
@@ -1666,6 +1667,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
// we can create it with a single call, which is a lot more efficient and thread friendly
mesh = RS::get_singleton()->mesh_create_from_surfaces(surface_data, blend_shapes.size());
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
+ RS::get_singleton()->mesh_set_path(mesh, get_path());
}
surfaces.clear();
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 8ff5b54fbe..41660767ab 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -246,6 +246,20 @@ void VisualShaderNode::set_input_port_connected(int p_port, bool p_connected) {
connected_input_ports[p_port] = p_connected;
}
+bool VisualShaderNode::is_any_port_connected() const {
+ for (const KeyValue<int, bool> &E : connected_input_ports) {
+ if (E.value) {
+ return true;
+ }
+ }
+ for (const KeyValue<int, int> &E : connected_output_ports) {
+ if (E.value > 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool VisualShaderNode::is_generate_input_var(int p_port) const {
return true;
}
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 501a538c86..7faebb86ab 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -314,6 +314,7 @@ public:
void set_output_port_connected(int p_port, bool p_connected);
bool is_input_port_connected(int p_port) const;
void set_input_port_connected(int p_port, bool p_connected);
+ bool is_any_port_connected() const;
virtual bool is_generate_input_var(int p_port) const;
virtual bool has_output_port_preview(int p_port) const;
diff --git a/scene/theme/theme_db.cpp b/scene/theme/theme_db.cpp
index 8dc9d288e2..6841a9e1d4 100644
--- a/scene/theme/theme_db.cpp
+++ b/scene/theme/theme_db.cpp
@@ -49,8 +49,8 @@ void ThemeDB::initialize_theme() {
// Allow creating the default theme at a different scale to suit higher/lower base resolutions.
float default_theme_scale = GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/theme/default_theme_scale", PROPERTY_HINT_RANGE, "0.5,8,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), 1.0);
- String project_theme_path = GLOBAL_DEF_RST(PropertyInfo(Variant::STRING, "gui/theme/custom", PROPERTY_HINT_FILE, "*.tres,*.res,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), "");
- String project_font_path = GLOBAL_DEF_RST(PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.otf,*.ttf,*.woff,*.woff2,*.fnt,*.font,*.pfb,*.pfm", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), "");
+ String project_theme_path = GLOBAL_DEF_RST_BASIC(PropertyInfo(Variant::STRING, "gui/theme/custom", PROPERTY_HINT_FILE, "*.tres,*.res,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), "");
+ String project_font_path = GLOBAL_DEF_RST_BASIC(PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.otf,*.ttf,*.woff,*.woff2,*.fnt,*.font,*.pfb,*.pfm", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), "");
TextServer::FontAntialiasing font_antialiasing = (TextServer::FontAntialiasing)(int)GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "gui/theme/default_font_antialiasing", PROPERTY_HINT_ENUM, "None,Grayscale,LCD Subpixel", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), 1);
TextServer::Hinting font_hinting = (TextServer::Hinting)(int)GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "gui/theme/default_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED), TextServer::HINTING_LIGHT);