diff --git a/modules/multiplayer/multiplayer_spawner.cpp b/modules/multiplayer/multiplayer_spawner.cpp index 682d20022ff8..a4f6a7727c0e 100644 --- a/modules/multiplayer/multiplayer_spawner.cpp +++ b/modules/multiplayer/multiplayer_spawner.cpp @@ -86,14 +86,18 @@ void MultiplayerSpawner::_get_property_list(List *p_list) const { } #endif -PackedStringArray MultiplayerSpawner::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector MultiplayerSpawner::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (spawn_path.is_empty() || !has_node(spawn_path)) { - warnings.push_back(RTR("A valid NodePath must be set in the \"Spawn Path\" property in order for MultiplayerSpawner to be able to spawn Nodes.")); + CONFIG_WARNING_P( + RTR("A valid NodePath must be set in order for MultiplayerSpawner to be able to spawn Nodes."), + "spawn_path"); } - return warnings; + return infos; } +#endif void MultiplayerSpawner::add_spawnable_scene(const String &p_path) { SpawnableScene sc; @@ -250,7 +254,7 @@ NodePath MultiplayerSpawner::get_spawn_path() const { void MultiplayerSpawner::set_spawn_path(const NodePath &p_path) { spawn_path = p_path; _update_spawn_node(); - update_configuration_warnings(); + update_configuration_info(); } void MultiplayerSpawner::_track(Node *p_node, const Variant &p_argument, int p_scene_id) { diff --git a/modules/multiplayer/multiplayer_spawner.h b/modules/multiplayer/multiplayer_spawner.h index 0e94b781eaae..888fcf20aa2e 100644 --- a/modules/multiplayer/multiplayer_spawner.h +++ b/modules/multiplayer/multiplayer_spawner.h @@ -91,7 +91,9 @@ class MultiplayerSpawner : public Node { void _get_property_list(List *p_list) const; #endif public: - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif Node *get_spawn_node() const { return spawn_node.is_valid() ? Object::cast_to(ObjectDB::get_instance(spawn_node)) : nullptr; diff --git a/modules/multiplayer/multiplayer_synchronizer.cpp b/modules/multiplayer/multiplayer_synchronizer.cpp index 852975b8eb8e..c6d6a29d6daf 100644 --- a/modules/multiplayer/multiplayer_synchronizer.cpp +++ b/modules/multiplayer/multiplayer_synchronizer.cpp @@ -143,15 +143,19 @@ bool MultiplayerSynchronizer::update_inbound_sync_time(uint16_t p_network_time) return true; } -PackedStringArray MultiplayerSynchronizer::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector MultiplayerSynchronizer::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (root_path.is_empty() || !has_node(root_path)) { - warnings.push_back(RTR("A valid NodePath must be set in the \"Root Path\" property in order for MultiplayerSynchronizer to be able to synchronize properties.")); + CONFIG_WARNING_P( + RTR("A valid NodePath must be set in order for MultiplayerSynchronizer to be able to synchronize properties."), + "root_path"); } - return warnings; + return infos; } +#endif Error MultiplayerSynchronizer::get_state(const List &p_properties, Object *p_obj, Vector &r_variant, Vector &r_variant_ptrs) { ERR_FAIL_NULL_V(p_obj, ERR_INVALID_PARAMETER); @@ -354,7 +358,7 @@ void MultiplayerSynchronizer::set_root_path(const NodePath &p_path) { _stop(); root_path = p_path; _start(); - update_configuration_warnings(); + update_configuration_info(); } NodePath MultiplayerSynchronizer::get_root_path() const { diff --git a/modules/multiplayer/multiplayer_synchronizer.h b/modules/multiplayer/multiplayer_synchronizer.h index 192d7a5920e1..2748cfc6662c 100644 --- a/modules/multiplayer/multiplayer_synchronizer.h +++ b/modules/multiplayer/multiplayer_synchronizer.h @@ -91,7 +91,9 @@ class MultiplayerSynchronizer : public Node { bool update_outbound_sync_time(uint64_t p_usec); bool update_inbound_sync_time(uint16_t p_network_time); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_replication_interval(double p_interval); double get_replication_interval() const; diff --git a/modules/openxr/scene/openxr_composition_layer.cpp b/modules/openxr/scene/openxr_composition_layer.cpp index 697369d51644..56676d94e3ed 100644 --- a/modules/openxr/scene/openxr_composition_layer.cpp +++ b/modules/openxr/scene/openxr_composition_layer.cpp @@ -298,7 +298,7 @@ void OpenXRCompositionLayer::set_enable_hole_punch(bool p_enable) { _remove_fallback_node(); } - update_configuration_warnings(); + update_configuration_info(); } bool OpenXRCompositionLayer::get_enable_hole_punch() const { @@ -307,7 +307,7 @@ bool OpenXRCompositionLayer::get_enable_hole_punch() const { void OpenXRCompositionLayer::set_sort_order(int p_order) { openxr_layer_provider->set_sort_order(p_order); - update_configuration_warnings(); + update_configuration_info(); } int OpenXRCompositionLayer::get_sort_order() const { @@ -412,10 +412,10 @@ void OpenXRCompositionLayer::_notification(int p_what) { _clear_composition_layer_provider(); } } - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_ENTER_TREE: { if (layer_viewport && is_viewport_in_use(layer_viewport)) { @@ -479,23 +479,25 @@ void OpenXRCompositionLayer::_validate_property(PropertyInfo &p_property) const } } -PackedStringArray OpenXRCompositionLayer::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector OpenXRCompositionLayer::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (is_visible() && is_inside_tree()) { XROrigin3D *origin = Object::cast_to(get_parent()); if (origin == nullptr) { - warnings.push_back(RTR("OpenXR composition layers must have an XROrigin3D node as their parent.")); + CONFIG_WARNING(RTR("OpenXR composition layers must have an XROrigin3D node as their parent.")); } } if (!get_transform().basis.is_orthonormal()) { - warnings.push_back(RTR("OpenXR composition layers must have orthonormalized transforms (ie. no scale or shearing).")); + CONFIG_WARNING(RTR("OpenXR composition layers must have orthonormalized transforms (ie. no scale or shearing).")); } if (enable_hole_punch && get_sort_order() >= 0) { - warnings.push_back(RTR("Hole punching won't work as expected unless the sort order is less than zero.")); + CONFIG_WARNING(RTR("Hole punching won't work as expected unless the sort order is less than zero.")); } - return warnings; + return infos; } +#endif diff --git a/modules/openxr/scene/openxr_composition_layer.h b/modules/openxr/scene/openxr_composition_layer.h index 26b40236d2a8..9adb077a5bbd 100644 --- a/modules/openxr/scene/openxr_composition_layer.h +++ b/modules/openxr/scene/openxr_composition_layer.h @@ -115,7 +115,9 @@ class OpenXRCompositionLayer : public Node3D { Ref get_android_surface(); bool is_natively_supported() const; - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif virtual Vector2 intersects_ray(const Vector3 &p_origin, const Vector3 &p_direction) const; diff --git a/modules/openxr/scene/openxr_visibility_mask.cpp b/modules/openxr/scene/openxr_visibility_mask.cpp index 7214fac3272a..7eca7d3cb0f6 100644 --- a/modules/openxr/scene/openxr_visibility_mask.cpp +++ b/modules/openxr/scene/openxr_visibility_mask.cpp @@ -64,18 +64,20 @@ void OpenXRVisibilityMask::_on_openxr_session_stopping() { set_base(RID()); } -PackedStringArray OpenXRVisibilityMask::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector OpenXRVisibilityMask::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); if (is_visible() && is_inside_tree()) { XRCamera3D *camera = Object::cast_to(get_parent()); if (camera == nullptr) { - warnings.push_back(RTR("OpenXR visibility mask must have an XRCamera3D node as their parent.")); + CONFIG_WARNING(RTR("OpenXR visibility mask must have an XRCamera3D node as their parent.")); } } - return warnings; + return infos; } +#endif AABB OpenXRVisibilityMask::get_aabb() const { AABB ret; diff --git a/modules/openxr/scene/openxr_visibility_mask.h b/modules/openxr/scene/openxr_visibility_mask.h index 0acb30fc0a1e..ce4bc1778f29 100644 --- a/modules/openxr/scene/openxr_visibility_mask.h +++ b/modules/openxr/scene/openxr_visibility_mask.h @@ -45,7 +45,9 @@ class OpenXRVisibilityMask : public VisualInstance3D { void _on_openxr_session_stopping(); public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif virtual AABB get_aabb() const override; diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 1cab29f38359..05caffa8ef4f 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -314,7 +314,7 @@ void AnimatedSprite2D::set_sprite_frames(const Ref &p_frames) { notify_property_list_changed(); queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); emit_signal("sprite_frames_changed"); } @@ -571,13 +571,17 @@ StringName AnimatedSprite2D::get_animation() const { return animation; } -PackedStringArray AnimatedSprite2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector AnimatedSprite2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (frames.is_null()) { - warnings.push_back(RTR("A SpriteFrames resource must be created or set in the \"Sprite Frames\" property in order for AnimatedSprite2D to display frames.")); + CONFIG_WARNING_P( + RTR("A SpriteFrames resource must be created or set in order for AnimatedSprite2D to display frames."), + "sprite_frames"); } - return warnings; + return infos; } +#endif #ifdef TOOLS_ENABLED void AnimatedSprite2D::get_argument_options(const StringName &p_function, int p_idx, List *r_options) const { diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h index 914dc405ab46..54f1b3577229 100644 --- a/scene/2d/animated_sprite_2d.h +++ b/scene/2d/animated_sprite_2d.h @@ -125,7 +125,9 @@ class AnimatedSprite2D : public Node2D { void set_flip_v(bool p_flip); bool is_flipped_v() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif #ifdef TOOLS_ENABLED virtual void get_argument_options(const StringName &p_function, int p_idx, List *r_options) const override; diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp index dc83775c71fa..d0c893286ca8 100644 --- a/scene/2d/canvas_modulate.cpp +++ b/scene/2d/canvas_modulate.cpp @@ -57,7 +57,7 @@ void CanvasModulate::_on_in_canvas_visibility_changed(bool p_new_visibility) { } } - update_configuration_warnings(); + update_configuration_info(); } void CanvasModulate::_notification(int p_what) { @@ -113,20 +113,22 @@ Color CanvasModulate::get_color() const { return color; } -PackedStringArray CanvasModulate::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CanvasModulate::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (is_in_canvas && is_visible_in_tree()) { List nodes; get_tree()->get_nodes_in_group("_canvas_modulate_" + itos(get_canvas().get_id()), &nodes); if (nodes.size() > 1) { - warnings.push_back(RTR("Only one visible CanvasModulate is allowed per canvas.\nWhen there are more than one, only one of them will be active. Which one is undefined.")); + CONFIG_WARNING(RTR("Only one visible CanvasModulate is allowed per canvas.\nWhen there are more than one, only one of them will be active. Which one is undefined.")); } } - return warnings; + return infos; } +#endif CanvasModulate::CanvasModulate() { } diff --git a/scene/2d/canvas_modulate.h b/scene/2d/canvas_modulate.h index 08ded52e2339..aa457656f755 100644 --- a/scene/2d/canvas_modulate.h +++ b/scene/2d/canvas_modulate.h @@ -54,7 +54,9 @@ class CanvasModulate : public Node2D { void set_color(const Color &p_color); Color get_color() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif CanvasModulate(); ~CanvasModulate(); diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 754afb05274a..686476c6aa4c 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -245,20 +245,22 @@ bool CPUParticles2D::get_fractional_delta() const { return fractional_delta; } -PackedStringArray CPUParticles2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CPUParticles2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); CanvasItemMaterial *mat = Object::cast_to(get_material().ptr()); if (get_material().is_null() || (mat && !mat->get_particles_animation())) { if (get_param_max(PARAM_ANIM_SPEED) != 0.0 || get_param_max(PARAM_ANIM_OFFSET) != 0.0 || get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid()) { - warnings.push_back(RTR("CPUParticles2D animation requires the usage of a CanvasItemMaterial with \"Particles Animation\" enabled.")); + CONFIG_WARNING(RTR("CPUParticles2D animation requires the usage of a CanvasItemMaterial with \"Particles Animation\" enabled.")); } } - return warnings; + return infos; } +#endif void CPUParticles2D::restart() { time = 0; @@ -317,7 +319,7 @@ void CPUParticles2D::set_param_max(Parameter p_param, real_t p_value) { set_param_min(p_param, p_value); } - update_configuration_warnings(); + update_configuration_info(); } real_t CPUParticles2D::get_param_max(Parameter p_param) const { @@ -379,7 +381,7 @@ void CPUParticles2D::set_param_curve(Parameter p_param, const Ref &p_curv } } - update_configuration_warnings(); + update_configuration_info(); } Ref CPUParticles2D::get_param_curve(Parameter p_param) const { diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index 3f858c327763..29507d0a0c61 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -282,7 +282,9 @@ class CPUParticles2D : public Node2D { void set_gravity(const Vector2 &p_gravity); Vector2 get_gravity() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void restart(); diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index cfdcbee86a79..56b8e724e336 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -156,14 +156,14 @@ void GPUParticles2D::set_process_material(const Ref &p_material) { } RS::get_singleton()->particles_set_process_material(particles, material_rid); - update_configuration_warnings(); + update_configuration_info(); } void GPUParticles2D::set_trail_enabled(bool p_enabled) { trail_enabled = p_enabled; RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_lifetime); queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); RS::get_singleton()->particles_set_transform_align(particles, p_enabled ? RS::PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY : RS::PARTICLES_TRANSFORM_ALIGN_DISABLED); } @@ -326,11 +326,12 @@ float GPUParticles2D::get_interp_to_end() const { return interp_to_end_factor; } -PackedStringArray GPUParticles2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector GPUParticles2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (process_material.is_null()) { - warnings.push_back(RTR("A material to process the particles is not assigned, so no behavior is imprinted.")); + CONFIG_WARNING(RTR("A material to process the particles is not assigned, so no behavior is imprinted.")); } else { CanvasItemMaterial *mat = Object::cast_to(get_material().ptr()); @@ -339,21 +340,22 @@ PackedStringArray GPUParticles2D::get_configuration_warnings() const { if (process && (process->get_param_max(ParticleProcessMaterial::PARAM_ANIM_SPEED) != 0.0 || process->get_param_max(ParticleProcessMaterial::PARAM_ANIM_OFFSET) != 0.0 || process->get_param_texture(ParticleProcessMaterial::PARAM_ANIM_SPEED).is_valid() || process->get_param_texture(ParticleProcessMaterial::PARAM_ANIM_OFFSET).is_valid())) { - warnings.push_back(RTR("Particles2D animation requires the usage of a CanvasItemMaterial with \"Particles Animation\" enabled.")); + CONFIG_WARNING(RTR("Particles2D animation requires the usage of a CanvasItemMaterial with \"Particles Animation\" enabled.")); } } } if (trail_enabled && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Particle trails are only available when using the Forward+ or Mobile rendering backends.")); + CONFIG_WARNING(RTR("Particle trails are only available when using the Forward+ or Mobile rendering backends.")); } if (sub_emitter != NodePath() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Particle sub-emitters are not available when using the GL Compatibility rendering backend.")); + CONFIG_WARNING(RTR("Particle sub-emitters are not available when using the GL Compatibility rendering backend.")); } - return warnings; + return infos; } +#endif Rect2 GPUParticles2D::capture_rect() const { AABB aabb = RS::get_singleton()->particles_get_current_aabb(particles); @@ -424,7 +426,7 @@ void GPUParticles2D::set_sub_emitter(const NodePath &p_path) { if (is_inside_tree() && sub_emitter != NodePath()) { _attach_sub_emitter(); } - update_configuration_warnings(); + update_configuration_info(); } NodePath GPUParticles2D::get_sub_emitter() const { diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h index 58996b0327b6..7e3c4a14d149 100644 --- a/scene/2d/gpu_particles_2d.h +++ b/scene/2d/gpu_particles_2d.h @@ -161,7 +161,9 @@ class GPUParticles2D : public Node2D { void set_amount_ratio(float p_ratio); float get_amount_ratio() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_sub_emitter(const NodePath &p_path); NodePath get_sub_emitter() const; diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 50c5873781e7..6850ff96e55f 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -399,7 +399,7 @@ void PointLight2D::set_texture(const Ref &p_texture) { RS::get_singleton()->canvas_light_set_texture(_get_light(), RID()); } - update_configuration_warnings(); + update_configuration_info(); } Ref PointLight2D::get_texture() const { @@ -416,15 +416,19 @@ Vector2 PointLight2D::get_texture_offset() const { return texture_offset; } -PackedStringArray PointLight2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector PointLight2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!texture.is_valid()) { - warnings.push_back(RTR("A texture with the shape of the light must be supplied to the \"Texture\" property.")); + CONFIG_WARNING_P( + RTR("A texture with the shape of the light must be supplied."), + "texture"); } - return warnings; + return infos; } +#endif void PointLight2D::set_texture_scale(real_t p_scale) { _scale = p_scale; diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index 8a0c2a2a926b..b97192e10a8a 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -175,7 +175,9 @@ class PointLight2D : public Light2D { void set_texture_scale(real_t p_scale); real_t get_texture_scale() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif PointLight2D(); }; diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 7c3fb61d04d9..446afafbaddc 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -262,19 +262,21 @@ int LightOccluder2D::get_occluder_light_mask() const { return mask; } -PackedStringArray LightOccluder2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector LightOccluder2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!occluder_polygon.is_valid()) { - warnings.push_back(RTR("An occluder polygon must be set (or drawn) for this occluder to take effect.")); + CONFIG_WARNING(RTR("An occluder polygon must be set (or drawn) for this occluder to take effect.")); } if (occluder_polygon.is_valid() && occluder_polygon->get_polygon().size() == 0) { - warnings.push_back(RTR("The occluder polygon for this occluder is empty. Please draw a polygon.")); + CONFIG_WARNING(RTR("The occluder polygon for this occluder is empty. Please draw a polygon.")); } - return warnings; + return infos; } +#endif void LightOccluder2D::set_as_sdf_collision(bool p_enable) { sdf_collision = p_enable; diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h index 4c499d0465cf..b996aa791e98 100644 --- a/scene/2d/light_occluder_2d.h +++ b/scene/2d/light_occluder_2d.h @@ -107,7 +107,9 @@ class LightOccluder2D : public Node2D { void set_as_sdf_collision(bool p_enable); bool is_set_as_sdf_collision() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif LightOccluder2D(); ~LightOccluder2D(); diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index d0fae611d88a..3a6b268cb457 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -650,15 +650,17 @@ void NavigationAgent2D::_avoidance_done(Vector3 p_new_velocity) { emit_signal(SNAME("velocity_computed"), safe_velocity); } -PackedStringArray NavigationAgent2D::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector NavigationAgent2D::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("The NavigationAgent2D can be used only under a Node2D inheriting parent node.")); + CONFIG_WARNING(RTR("The NavigationAgent2D can be used only under a Node2D inheriting parent node.")); } - return warnings; + return infos; } +#endif void NavigationAgent2D::_update_navigation() { if (agent_parent == nullptr) { diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h index 8741f578d034..02146c1e736a 100644 --- a/scene/2d/navigation_agent_2d.h +++ b/scene/2d/navigation_agent_2d.h @@ -206,7 +206,9 @@ class NavigationAgent2D : public Node { void _avoidance_done(Vector3 p_new_velocity); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_avoidance_layers(uint32_t p_layers); uint32_t get_avoidance_layers() const; diff --git a/scene/2d/navigation_link_2d.cpp b/scene/2d/navigation_link_2d.cpp index 4961e18dc910..48eab9c67f6f 100644 --- a/scene/2d/navigation_link_2d.cpp +++ b/scene/2d/navigation_link_2d.cpp @@ -246,7 +246,7 @@ void NavigationLink2D::set_start_position(Vector2 p_position) { NavigationServer2D::get_singleton()->link_set_start_position(link, current_global_transform.xform(start_position)); - update_configuration_warnings(); + update_configuration_info(); #ifdef DEBUG_ENABLED queue_redraw(); @@ -266,7 +266,7 @@ void NavigationLink2D::set_end_position(Vector2 p_position) { NavigationServer2D::get_singleton()->link_set_end_position(link, current_global_transform.xform(end_position)); - update_configuration_warnings(); + update_configuration_info(); #ifdef DEBUG_ENABLED queue_redraw(); @@ -327,15 +327,17 @@ void NavigationLink2D::set_travel_cost(real_t p_travel_cost) { NavigationServer2D::get_singleton()->link_set_travel_cost(link, travel_cost); } -PackedStringArray NavigationLink2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector NavigationLink2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (start_position.is_equal_approx(end_position)) { - warnings.push_back(RTR("NavigationLink2D start position should be different than the end position to be useful.")); + CONFIG_WARNING(RTR("NavigationLink2D start position should be different than the end position to be useful.")); } - return warnings; + return infos; } +#endif void NavigationLink2D::_link_enter_navigation_map() { if (!is_inside_tree()) { diff --git a/scene/2d/navigation_link_2d.h b/scene/2d/navigation_link_2d.h index c724096607d9..1826c9e66da4 100644 --- a/scene/2d/navigation_link_2d.h +++ b/scene/2d/navigation_link_2d.h @@ -101,7 +101,9 @@ class NavigationLink2D : public Node2D { void set_travel_cost(real_t p_travel_cost); real_t get_travel_cost() const { return travel_cost; } - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif NavigationLink2D(); ~NavigationLink2D(); diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index f65a3c0eccab..7d24429ef25e 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -210,7 +210,7 @@ void NavigationRegion2D::set_navigation_polygon(const Ref &p_ } _navigation_polygon_changed(); - update_configuration_warnings(); + update_configuration_info(); } Ref NavigationRegion2D::get_navigation_polygon() const { @@ -291,17 +291,21 @@ void NavigationRegion2D::_navigation_debug_changed() { } #endif // DEBUG_ENABLED -PackedStringArray NavigationRegion2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector NavigationRegion2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (is_visible_in_tree() && is_inside_tree()) { if (!navigation_polygon.is_valid()) { - warnings.push_back(RTR("A NavigationMesh resource must be set or created for this node to work. Please set a property or draw a polygon.")); + CONFIG_WARNING_P( + RTR("A NavigationMesh resource must be set or created for this node to work. Please set a property or draw a polygon."), + "navigation_polygon"); } } - return warnings; + return infos; } +#endif void NavigationRegion2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &NavigationRegion2D::get_rid); diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index 52101cb93e0a..168b7db3f092 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -107,7 +107,9 @@ class NavigationRegion2D : public Node2D { void set_navigation_polygon(const Ref &p_navigation_polygon); Ref get_navigation_polygon() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void bake_navigation_polygon(bool p_on_thread); void _bake_finished(Ref p_navigation_polygon); diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 24f261deb6bc..c393310ad4e7 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -132,15 +132,17 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, real_t p_s _update_mirroring(); } -PackedStringArray ParallaxLayer::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector ParallaxLayer::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("ParallaxLayer node only works when set as child of a ParallaxBackground node.")); + CONFIG_WARNING(RTR("ParallaxLayer node only works when set as child of a ParallaxBackground node.")); } - return warnings; + return infos; } +#endif void ParallaxLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_motion_scale", "scale"), &ParallaxLayer::set_motion_scale); diff --git a/scene/2d/parallax_layer.h b/scene/2d/parallax_layer.h index 22fa0dd51c1e..28fb8b3de372 100644 --- a/scene/2d/parallax_layer.h +++ b/scene/2d/parallax_layer.h @@ -59,7 +59,9 @@ class ParallaxLayer : public Node2D { void set_base_offset_and_scale(const Point2 &p_offset, real_t p_scale); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif ParallaxLayer(); }; diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 5813ab02e3ab..b48c42a85019 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -287,17 +287,19 @@ void PathFollow2D::_validate_property(PropertyInfo &p_property) const { } } -PackedStringArray PathFollow2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector PathFollow2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (is_visible_in_tree() && is_inside_tree()) { if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("PathFollow2D only works when set as a child of a Path2D node.")); + CONFIG_WARNING(RTR("PathFollow2D only works when set as a child of a Path2D node.")); } } - return warnings; + return infos; } +#endif void PathFollow2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_progress", "progress"), &PathFollow2D::set_progress); diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h index bfd5cde5e9cb..b3c9f1849b22 100644 --- a/scene/2d/path_2d.h +++ b/scene/2d/path_2d.h @@ -106,7 +106,9 @@ class PathFollow2D : public Node2D { void set_cubic_interpolation_enabled(bool p_enabled); bool is_cubic_interpolation_enabled() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif PathFollow2D() {} }; diff --git a/scene/2d/physics/collision_object_2d.cpp b/scene/2d/physics/collision_object_2d.cpp index 27ee6b883c51..18f161840c01 100644 --- a/scene/2d/physics/collision_object_2d.cpp +++ b/scene/2d/physics/collision_object_2d.cpp @@ -581,15 +581,17 @@ void CollisionObject2D::_update_pickable() { } } -PackedStringArray CollisionObject2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CollisionObject2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (shapes.is_empty()) { - warnings.push_back(RTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape2D or CollisionPolygon2D as a child to define its shape.")); + CONFIG_WARNING(RTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape2D or CollisionPolygon2D as a child to define its shape.")); } - return warnings; + return infos; } +#endif void CollisionObject2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject2D::get_rid); diff --git a/scene/2d/physics/collision_object_2d.h b/scene/2d/physics/collision_object_2d.h index 2c8534665ca3..68ddf5d06e1e 100644 --- a/scene/2d/physics/collision_object_2d.h +++ b/scene/2d/physics/collision_object_2d.h @@ -166,7 +166,9 @@ class CollisionObject2D : public Node2D { void set_pickable(bool p_enabled); bool is_pickable() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif _FORCE_INLINE_ RID get_rid() const { return rid; } diff --git a/scene/2d/physics/collision_polygon_2d.cpp b/scene/2d/physics/collision_polygon_2d.cpp index b49badac1f2b..f0fbf849b93b 100644 --- a/scene/2d/physics/collision_polygon_2d.cpp +++ b/scene/2d/physics/collision_polygon_2d.cpp @@ -195,7 +195,7 @@ void CollisionPolygon2D::set_polygon(const Vector &p_polygon) { _update_in_shape_owner(); } queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); } Vector CollisionPolygon2D::get_polygon() const { @@ -210,7 +210,7 @@ void CollisionPolygon2D::set_build_mode(BuildMode p_mode) { _update_in_shape_owner(); } queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); } CollisionPolygon2D::BuildMode CollisionPolygon2D::get_build_mode() const { @@ -231,32 +231,36 @@ bool CollisionPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, doubl } #endif -PackedStringArray CollisionPolygon2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CollisionPolygon2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("CollisionPolygon2D only serves to provide a collision shape to a CollisionObject2D derived node. Please only use it as a child of Area2D, StaticBody2D, RigidBody2D, CharacterBody2D, etc. to give them a shape.")); + CONFIG_WARNING(RTR("CollisionPolygon2D only serves to provide a collision shape to a CollisionObject2D derived node. Please only use it as a child of Area2D, StaticBody2D, RigidBody2D, CharacterBody2D, etc. to give them a shape.")); } int polygon_count = polygon.size(); if (polygon_count == 0) { - warnings.push_back(RTR("An empty CollisionPolygon2D has no effect on collision.")); + CONFIG_WARNING(RTR("An empty CollisionPolygon2D has no effect on collision.")); } else { bool solids = build_mode == BUILD_SOLIDS; if (solids) { if (polygon_count < 3) { - warnings.push_back(RTR("Invalid polygon. At least 3 points are needed in 'Solids' build mode.")); + CONFIG_WARNING(RTR("Invalid polygon. At least 3 points are needed in 'Solids' build mode.")); } } else if (polygon_count < 2) { - warnings.push_back(RTR("Invalid polygon. At least 2 points are needed in 'Segments' build mode.")); + CONFIG_WARNING(RTR("Invalid polygon. At least 2 points are needed in 'Segments' build mode.")); } } if (one_way_collision && Object::cast_to(get_parent())) { - warnings.push_back(RTR("The One Way Collision property will be ignored when the collision object is an Area2D.")); + CONFIG_WARNING_P( + RTR("One Way Collision will be ignored when the collision object is an Area2D."), + "one_way_collision"); } - return warnings; + return infos; } +#endif void CollisionPolygon2D::set_disabled(bool p_disabled) { disabled = p_disabled; @@ -276,7 +280,7 @@ void CollisionPolygon2D::set_one_way_collision(bool p_enable) { if (collision_object) { collision_object->shape_owner_set_one_way_collision(owner_id, p_enable); } - update_configuration_warnings(); + update_configuration_info(); } bool CollisionPolygon2D::is_one_way_collision_enabled() const { diff --git a/scene/2d/physics/collision_polygon_2d.h b/scene/2d/physics/collision_polygon_2d.h index f1ee30babeb6..f6777c43534c 100644 --- a/scene/2d/physics/collision_polygon_2d.h +++ b/scene/2d/physics/collision_polygon_2d.h @@ -77,7 +77,9 @@ class CollisionPolygon2D : public Node2D { void set_polygon(const Vector &p_polygon); Vector get_polygon() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_disabled(bool p_disabled); bool is_disabled() const; diff --git a/scene/2d/physics/collision_shape_2d.cpp b/scene/2d/physics/collision_shape_2d.cpp index bdd0d06b5e2a..710f0cbac671 100644 --- a/scene/2d/physics/collision_shape_2d.cpp +++ b/scene/2d/physics/collision_shape_2d.cpp @@ -158,7 +158,7 @@ void CollisionShape2D::set_shape(const Ref &p_shape) { shape->connect_changed(callable_mp(this, &CollisionShape2D::_shape_changed)); } - update_configuration_warnings(); + update_configuration_info(); } Ref CollisionShape2D::get_shape() const { @@ -173,28 +173,32 @@ bool CollisionShape2D::_edit_is_selected_on_click(const Point2 &p_point, double return shape->_edit_is_selected_on_click(p_point, p_tolerance); } -PackedStringArray CollisionShape2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CollisionShape2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); CollisionObject2D *col_object = Object::cast_to(get_parent()); if (col_object == nullptr) { - warnings.push_back(RTR("CollisionShape2D only serves to provide a collision shape to a CollisionObject2D derived node.\nPlease only use it as a child of Area2D, StaticBody2D, RigidBody2D, CharacterBody2D, etc. to give them a shape.")); + CONFIG_WARNING(RTR("CollisionShape2D only serves to provide a collision shape to a CollisionObject2D derived node.\nPlease only use it as a child of Area2D, StaticBody2D, RigidBody2D, CharacterBody2D, etc. to give them a shape.")); } if (!shape.is_valid()) { - warnings.push_back(RTR("A shape must be provided for CollisionShape2D to function. Please create a shape resource for it!")); + CONFIG_WARNING(RTR("A shape must be provided for CollisionShape2D to function. Please create a shape resource for it!")); } if (one_way_collision && Object::cast_to(col_object)) { - warnings.push_back(RTR("The One Way Collision property will be ignored when the collision object is an Area2D.")); + CONFIG_WARNING_P( + RTR("One Way Collision will be ignored when the collision object is an Area2D."), + "one_way_collision"); } Ref convex = shape; Ref concave = shape; if (convex.is_valid() || concave.is_valid()) { - warnings.push_back(RTR("Polygon-based shapes are not meant be used nor edited directly through the CollisionShape2D node. Please use the CollisionPolygon2D node instead.")); + CONFIG_WARNING(RTR("Polygon-based shapes are not meant be used nor edited directly through the CollisionShape2D node. Please use the CollisionPolygon2D node instead.")); } - return warnings; + return infos; } +#endif void CollisionShape2D::set_disabled(bool p_disabled) { disabled = p_disabled; @@ -214,7 +218,7 @@ void CollisionShape2D::set_one_way_collision(bool p_enable) { if (collision_object) { collision_object->shape_owner_set_one_way_collision(owner_id, p_enable); } - update_configuration_warnings(); + update_configuration_info(); } bool CollisionShape2D::is_one_way_collision_enabled() const { diff --git a/scene/2d/physics/collision_shape_2d.h b/scene/2d/physics/collision_shape_2d.h index 65436f1539eb..5dbab1394e15 100644 --- a/scene/2d/physics/collision_shape_2d.h +++ b/scene/2d/physics/collision_shape_2d.h @@ -80,7 +80,9 @@ class CollisionShape2D : public Node2D { void set_debug_color(const Color &p_color); Color get_debug_color() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif CollisionShape2D(); }; diff --git a/scene/2d/physics/joints/joint_2d.cpp b/scene/2d/physics/joints/joint_2d.cpp index a32bcbae7883..4204e81d1606 100644 --- a/scene/2d/physics/joints/joint_2d.cpp +++ b/scene/2d/physics/joints/joint_2d.cpp @@ -49,7 +49,7 @@ void Joint2D::_disconnect_signals() { void Joint2D::_body_exit_tree() { _disconnect_signals(); _update_joint(true); - update_configuration_warnings(); + update_configuration_info(); } void Joint2D::_update_joint(bool p_only_free) { @@ -90,7 +90,7 @@ void Joint2D::_update_joint(bool p_only_free) { valid = true; } - update_configuration_warnings(); + update_configuration_info(); if (!valid) { PhysicsServer2D::get_singleton()->joint_clear(joint); @@ -215,15 +215,17 @@ bool Joint2D::get_exclude_nodes_from_collision() const { return exclude_from_collision; } -PackedStringArray Joint2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Joint2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!warning.is_empty()) { - warnings.push_back(warning); + CONFIG_WARNING(warning); } - return warnings; + return infos; } +#endif void Joint2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_node_a", "node"), &Joint2D::set_node_a); diff --git a/scene/2d/physics/joints/joint_2d.h b/scene/2d/physics/joints/joint_2d.h index bdd2730bfaf3..52ca26e85ab1 100644 --- a/scene/2d/physics/joints/joint_2d.h +++ b/scene/2d/physics/joints/joint_2d.h @@ -62,7 +62,9 @@ class Joint2D : public Node2D { _FORCE_INLINE_ bool is_configured() const { return configured; } public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif void set_node_a(const NodePath &p_node_a); NodePath get_node_a() const; diff --git a/scene/2d/physics/physical_bone_2d.cpp b/scene/2d/physics/physical_bone_2d.cpp index 19274c808435..508fc64b3a22 100644 --- a/scene/2d/physics/physical_bone_2d.cpp +++ b/scene/2d/physics/physical_bone_2d.cpp @@ -106,24 +106,26 @@ void PhysicalBone2D::_find_joint_child() { } } -PackedStringArray PhysicalBone2D::get_configuration_warnings() const { - PackedStringArray warnings = RigidBody2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector PhysicalBone2D::get_configuration_info() const { + Vector infos = RigidBody2D::get_configuration_info(); if (!parent_skeleton) { - warnings.push_back(RTR("A PhysicalBone2D only works with a Skeleton2D or another PhysicalBone2D as a parent node!")); + CONFIG_WARNING(RTR("A PhysicalBone2D only works with a Skeleton2D or another PhysicalBone2D as a parent node!")); } if (parent_skeleton && bone2d_index <= -1) { - warnings.push_back(RTR("A PhysicalBone2D needs to be assigned to a Bone2D node in order to function! Please set a Bone2D node in the inspector.")); + CONFIG_WARNING(RTR("A PhysicalBone2D needs to be assigned to a Bone2D node in order to function! Please set a Bone2D node in the inspector.")); } if (!child_joint) { PhysicalBone2D *parent_bone = Object::cast_to(get_parent()); if (parent_bone) { - warnings.push_back(RTR("A PhysicalBone2D node should have a Joint2D-based child node to keep bones connected! Please add a Joint2D-based node as a child to this node!")); + CONFIG_WARNING(RTR("A PhysicalBone2D node should have a Joint2D-based child node to keep bones connected! Please add a Joint2D-based node as a child to this node!")); } } - return warnings; + return infos; } +#endif void PhysicalBone2D::_auto_configure_joint() { if (!auto_configure_joint) { diff --git a/scene/2d/physics/physical_bone_2d.h b/scene/2d/physics/physical_bone_2d.h index 0547469b5e6b..603e2f8e6b85 100644 --- a/scene/2d/physics/physical_bone_2d.h +++ b/scene/2d/physics/physical_bone_2d.h @@ -79,7 +79,9 @@ class PhysicalBone2D : public RigidBody2D { void set_follow_bone_when_simulating(bool p_follow); bool get_follow_bone_when_simulating() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif PhysicalBone2D(); ~PhysicalBone2D(); diff --git a/scene/2d/physics/rigid_body_2d.cpp b/scene/2d/physics/rigid_body_2d.cpp index 402e5c8b9570..880baaadb302 100644 --- a/scene/2d/physics/rigid_body_2d.cpp +++ b/scene/2d/physics/rigid_body_2d.cpp @@ -632,23 +632,25 @@ void RigidBody2D::_notification(int p_what) { } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - update_configuration_warnings(); + update_configuration_info(); } break; } #endif } -PackedStringArray RigidBody2D::get_configuration_warnings() const { +#ifdef TOOLS_ENABLED +Vector RigidBody2D::get_configuration_info() const { Transform2D t = get_transform(); - PackedStringArray warnings = CollisionObject2D::get_configuration_warnings(); + Vector infos = PhysicsBody2D::get_configuration_info(); if (ABS(t.columns[0].length() - 1.0) > 0.05 || ABS(t.columns[1].length() - 1.0) > 0.05) { - warnings.push_back(RTR("Size changes to RigidBody2D will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.")); + CONFIG_WARNING(RTR("Size changes to RigidBody2D will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.")); } - return warnings; + return infos; } +#endif void RigidBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mass", "mass"), &RigidBody2D::set_mass); diff --git a/scene/2d/physics/rigid_body_2d.h b/scene/2d/physics/rigid_body_2d.h index 40af66f28d6b..bc678b77054e 100644 --- a/scene/2d/physics/rigid_body_2d.h +++ b/scene/2d/physics/rigid_body_2d.h @@ -232,7 +232,9 @@ class RigidBody2D : public PhysicsBody2D { TypedArray get_colliding_bodies() const; //function for script - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif RigidBody2D(); ~RigidBody2D(); diff --git a/scene/2d/physics/shape_cast_2d.cpp b/scene/2d/physics/shape_cast_2d.cpp index dd9d58916570..1b38aca5df16 100644 --- a/scene/2d/physics/shape_cast_2d.cpp +++ b/scene/2d/physics/shape_cast_2d.cpp @@ -162,7 +162,7 @@ void ShapeCast2D::set_shape(const Ref &p_shape) { shape_rid = shape->get_rid(); } - update_configuration_warnings(); + update_configuration_info(); queue_redraw(); } @@ -402,14 +402,16 @@ Array ShapeCast2D::get_collision_result() const { return ret; } -PackedStringArray ShapeCast2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector ShapeCast2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (shape.is_null()) { - warnings.push_back(RTR("This node cannot interact with other objects unless a Shape2D is assigned.")); + CONFIG_WARNING(RTR("This node cannot interact with other objects unless a Shape2D is assigned.")); } - return warnings; + return infos; } +#endif void ShapeCast2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &ShapeCast2D::set_enabled); diff --git a/scene/2d/physics/shape_cast_2d.h b/scene/2d/physics/shape_cast_2d.h index d866dd4edb85..2cab9341c64d 100644 --- a/scene/2d/physics/shape_cast_2d.h +++ b/scene/2d/physics/shape_cast_2d.h @@ -118,7 +118,9 @@ class ShapeCast2D : public Node2D { void remove_exception(const CollisionObject2D *p_node); void clear_exceptions(); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif ShapeCast2D(); }; diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index 1816a3409bff..a817935c963f 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -148,7 +148,7 @@ void RemoteTransform2D::set_remote_node(const NodePath &p_remote_node) { _update_remote(); } - update_configuration_warnings(); + update_configuration_info(); } NodePath RemoteTransform2D::get_remote_node() const { @@ -210,15 +210,19 @@ void RemoteTransform2D::force_update_cache() { _update_cache(); } -PackedStringArray RemoteTransform2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector RemoteTransform2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!has_node(remote_node) || !Object::cast_to(get_node(remote_node))) { - warnings.push_back(RTR("Path property must point to a valid Node2D node to work.")); + CONFIG_WARNING_P( + RTR("Path must point to a valid Node2D node to work."), + "remote_path"); } - return warnings; + return infos; } +#endif void RemoteTransform2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_remote_node", "path"), &RemoteTransform2D::set_remote_node); diff --git a/scene/2d/remote_transform_2d.h b/scene/2d/remote_transform_2d.h index 997fd8fc6942..17503b5cb9c7 100644 --- a/scene/2d/remote_transform_2d.h +++ b/scene/2d/remote_transform_2d.h @@ -70,7 +70,9 @@ class RemoteTransform2D : public Node2D { void force_update_cache(); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif RemoteTransform2D(); }; diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 90bfb4c84c87..763179439d44 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -386,7 +386,7 @@ void Bone2D::set_rest(const Transform2D &p_rest) { skeleton->_make_bone_setup_dirty(); } - update_configuration_warnings(); + update_configuration_info(); } Transform2D Bone2D::get_rest() const { @@ -411,22 +411,24 @@ int Bone2D::get_index_in_skeleton() const { return skeleton_index; } -PackedStringArray Bone2D::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Bone2D::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); if (!skeleton) { if (parent_bone) { - warnings.push_back(RTR("This Bone2D chain should end at a Skeleton2D node.")); + CONFIG_WARNING(RTR("This Bone2D chain should end at a Skeleton2D node.")); } else { - warnings.push_back(RTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node.")); + CONFIG_WARNING(RTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node.")); } } if (rest == Transform2D(0, 0, 0, 0, 0, 0)) { - warnings.push_back(RTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one.")); + CONFIG_WARNING(RTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one.")); } - return warnings; + return infos; } +#endif void Bone2D::calculate_length_and_rotation() { // If there is at least a single child Bone2D node, we can calculate diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h index 033bdff41d6a..ed0d123dc2ed 100644 --- a/scene/2d/skeleton_2d.h +++ b/scene/2d/skeleton_2d.h @@ -78,7 +78,9 @@ class Bone2D : public Node2D { void apply_rest(); Transform2D get_skeleton_rest() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_autocalculate_length_and_angle(bool p_autocalculate); bool get_autocalculate_length_and_angle() const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 45cfb8cf33f8..d8e694cf8483 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -49,7 +49,7 @@ return layers[layer]->function(__VA_ARGS__); void TileMap::_tile_set_changed() { - update_configuration_warnings(); + update_configuration_info(); } void TileMap::_emit_changed() { @@ -280,7 +280,7 @@ void TileMap::add_layer(int p_to_pos) { _emit_changed(); - update_configuration_warnings(); + update_configuration_info(); } void TileMap::move_layer(int p_layer, int p_to_pos) { @@ -299,7 +299,7 @@ void TileMap::move_layer(int p_layer, int p_to_pos) { _emit_changed(); - update_configuration_warnings(); + update_configuration_info(); } void TileMap::remove_layer(int p_layer) { @@ -318,7 +318,7 @@ void TileMap::remove_layer(int p_layer) { _emit_changed(); - update_configuration_warnings(); + update_configuration_info(); } void TileMap::set_layer_name(int p_layer, String p_name) { @@ -347,7 +347,7 @@ Color TileMap::get_layer_modulate(int p_layer) const { void TileMap::set_layer_y_sort_enabled(int p_layer, bool p_y_sort_enabled) { TILEMAP_CALL_FOR_LAYER(p_layer, set_y_sort_enabled, p_y_sort_enabled); - update_configuration_warnings(); + update_configuration_info(); } bool TileMap::is_layer_y_sort_enabled(int p_layer) const { @@ -356,7 +356,7 @@ bool TileMap::is_layer_y_sort_enabled(int p_layer) const { void TileMap::set_layer_y_sort_origin(int p_layer, int p_y_sort_origin) { TILEMAP_CALL_FOR_LAYER(p_layer, set_y_sort_origin, p_y_sort_origin); - update_configuration_warnings(); + update_configuration_info(); } int TileMap::get_layer_y_sort_origin(int p_layer) const { @@ -439,7 +439,7 @@ void TileMap::set_y_sort_enabled(bool p_enable) { } Node2D::set_y_sort_enabled(p_enable); _emit_changed(); - update_configuration_warnings(); + update_configuration_info(); } void TileMap::set_cell(int p_layer, const Vector2i &p_coords, int p_source_id, const Vector2i p_atlas_coords, int p_alternative_tile) { @@ -700,7 +700,7 @@ bool TileMap::_set(const StringName &p_name, const Variant &p_value) { notify_property_list_changed(); _emit_changed(); - update_configuration_warnings(); + update_configuration_info(); } if (property_helper.property_set_value(sname, p_value)) { @@ -826,10 +826,11 @@ TypedArray TileMap::get_surrounding_cells(const Vector2i &p_coords) { return tile_set->get_surrounding_cells(p_coords); } -PackedStringArray TileMap::get_configuration_warnings() const { - PackedStringArray warnings = Node2D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector TileMap::get_configuration_info() const { + Vector infos = Node2D::get_configuration_info(); - warnings.push_back(RTR("The TileMap node is deprecated as it is superseded by the use of multiple TileMapLayer nodes.\nTo convert a TileMap to a set of TileMapLayer nodes, open the TileMap bottom panel with this node selected, click the toolbox icon in the top-right corner and choose \"Extract TileMap layers as individual TileMapLayer nodes\".")); + CONFIG_WARNING(RTR("The TileMap node is deprecated as it is superseded by the use of multiple TileMapLayer nodes.\nTo convert a TileMap to a set of TileMapLayer nodes, open the TileMap bottom panel with this node selected, click the toolbox icon in the top-right corner and choose \"Extract TileMap layers as individual TileMapLayer nodes\".")); // Retrieve the set of Z index values with a Y-sorted layer. RBSet y_sorted_z_index; @@ -842,7 +843,7 @@ PackedStringArray TileMap::get_configuration_warnings() const { // Check if we have a non-sorted layer in a Z-index with a Y-sorted layer. for (const TileMapLayer *layer : layers) { if (!layer->is_y_sort_enabled() && y_sorted_z_index.has(layer->get_z_index())) { - warnings.push_back(RTR("A Y-sorted layer has the same Z-index value as a not Y-sorted layer.\nThis may lead to unwanted behaviors, as a layer that is not Y-sorted will be Y-sorted as a whole with tiles from Y-sorted layers.")); + CONFIG_WARNING(RTR("A Y-sorted layer has the same Z-index value as a not Y-sorted layer.\nThis may lead to unwanted behaviors, as a layer that is not Y-sorted will be Y-sorted as a whole with tiles from Y-sorted layers.")); break; } } @@ -851,7 +852,7 @@ PackedStringArray TileMap::get_configuration_warnings() const { // Check if Y-sort is enabled on a layer but not on the node. for (const TileMapLayer *layer : layers) { if (layer->is_y_sort_enabled()) { - warnings.push_back(RTR("A TileMap layer is set as Y-sorted, but Y-sort is not enabled on the TileMap node itself.")); + CONFIG_WARNING(RTR("A TileMap layer is set as Y-sorted, but Y-sort is not enabled on the TileMap node itself.")); break; } } @@ -865,7 +866,7 @@ PackedStringArray TileMap::get_configuration_warnings() const { } } if (need_warning) { - warnings.push_back(RTR("The TileMap node is set as Y-sorted, but Y-sort is not enabled on any of the TileMap's layers.\nThis may lead to unwanted behaviors, as a layer that is not Y-sorted will be Y-sorted as a whole.")); + CONFIG_WARNING(RTR("The TileMap node is set as Y-sorted, but Y-sort is not enabled on any of the TileMap's layers.\nThis may lead to unwanted behaviors, as a layer that is not Y-sorted will be Y-sorted as a whole.")); } } @@ -882,12 +883,13 @@ PackedStringArray TileMap::get_configuration_warnings() const { } if (warn) { - warnings.push_back(RTR("Isometric TileSet will likely not look as intended without Y-sort enabled for the TileMap and all of its layers.")); + CONFIG_WARNING(RTR("Isometric TileSet will likely not look as intended without Y-sort enabled for the TileMap and all of its layers.")); } } - return warnings; + return infos; } +#endif void TileMap::_bind_methods() { #ifndef DISABLE_DEPRECATED diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 142dc1193f8a..eb56e22fbcb6 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -236,7 +236,9 @@ class TileMap : public Node2D { GDVIRTUAL3(_tile_data_runtime_update, int, Vector2i, TileData *); // Configuration warnings. - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif TileMap(); }; diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp index 7fe1b7079a84..15d8044cf67f 100644 --- a/scene/3d/bone_attachment_3d.cpp +++ b/scene/3d/bone_attachment_3d.cpp @@ -80,26 +80,28 @@ void BoneAttachment3D::_get_property_list(List *p_list) const { } } -PackedStringArray BoneAttachment3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector BoneAttachment3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (use_external_skeleton) { if (external_skeleton_node_cache.is_null()) { - warnings.push_back(RTR("External Skeleton3D node not set! Please set a path to an external Skeleton3D node.")); + CONFIG_WARNING(RTR("External Skeleton3D node not set! Please set a path to an external Skeleton3D node.")); } } else { Skeleton3D *parent = Object::cast_to(get_parent()); if (!parent) { - warnings.push_back(RTR("Parent node is not a Skeleton3D node! Please use an external Skeleton3D if you intend to use the BoneAttachment3D without it being a child of a Skeleton3D node.")); + CONFIG_WARNING(RTR("Parent node is not a Skeleton3D node! Please use an external Skeleton3D if you intend to use the BoneAttachment3D without it being a child of a Skeleton3D node.")); } } if (bone_idx == -1) { - warnings.push_back(RTR("BoneAttachment3D node is not bound to any bones! Please select a bone to attach this node.")); + CONFIG_WARNING(RTR("BoneAttachment3D node is not bound to any bones! Please select a bone to attach this node.")); } - return warnings; + return infos; } +#endif void BoneAttachment3D::_update_external_skeleton_cache() { external_skeleton_node_cache = ObjectID(); diff --git a/scene/3d/bone_attachment_3d.h b/scene/3d/bone_attachment_3d.h index 5435c4ad0cdb..e377b07d4e19 100644 --- a/scene/3d/bone_attachment_3d.h +++ b/scene/3d/bone_attachment_3d.h @@ -76,7 +76,9 @@ class BoneAttachment3D : public Node3D { virtual void notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, Dictionary p_rename_map); #endif // TOOLS_ENABLED - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif Skeleton3D *get_skeleton(); diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index acbc443a93b7..23081083bc67 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -179,7 +179,7 @@ void CPUParticles3D::set_mesh(const Ref &p_mesh) { RS::get_singleton()->multimesh_set_mesh(multimesh, RID()); } - update_configuration_warnings(); + update_configuration_info(); } Ref CPUParticles3D::get_mesh() const { @@ -202,8 +202,9 @@ bool CPUParticles3D::get_fractional_delta() const { return fractional_delta; } -PackedStringArray CPUParticles3D::get_configuration_warnings() const { - PackedStringArray warnings = GeometryInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CPUParticles3D::get_configuration_info() const { + Vector infos = GeometryInstance3D::get_configuration_info(); bool mesh_found = false; bool anim_material_found = false; @@ -222,15 +223,16 @@ PackedStringArray CPUParticles3D::get_configuration_warnings() const { anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES); if (!mesh_found) { - warnings.push_back(RTR("Nothing is visible because no mesh has been assigned.")); + CONFIG_WARNING(RTR("Nothing is visible because no mesh has been assigned.")); } if (!anim_material_found && (get_param_max(PARAM_ANIM_SPEED) != 0.0 || get_param_max(PARAM_ANIM_OFFSET) != 0.0 || get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) { - warnings.push_back(RTR("CPUParticles3D animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".")); + CONFIG_WARNING(RTR("CPUParticles3D animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".")); } - return warnings; + return infos; } +#endif void CPUParticles3D::restart() { time = 0; @@ -282,7 +284,7 @@ void CPUParticles3D::set_param_min(Parameter p_param, real_t p_value) { set_param_max(p_param, p_value); } - update_configuration_warnings(); + update_configuration_info(); } real_t CPUParticles3D::get_param_min(Parameter p_param) const { @@ -299,7 +301,7 @@ void CPUParticles3D::set_param_max(Parameter p_param, real_t p_value) { set_param_min(p_param, p_value); } - update_configuration_warnings(); + update_configuration_info(); } real_t CPUParticles3D::get_param_max(Parameter p_param) const { @@ -361,7 +363,7 @@ void CPUParticles3D::set_param_curve(Parameter p_param, const Ref &p_curv } } - update_configuration_warnings(); + update_configuration_info(); } Ref CPUParticles3D::get_param_curve(Parameter p_param) const { diff --git a/scene/3d/cpu_particles_3d.h b/scene/3d/cpu_particles_3d.h index 978bb64e710d..7d3963fd6855 100644 --- a/scene/3d/cpu_particles_3d.h +++ b/scene/3d/cpu_particles_3d.h @@ -308,7 +308,9 @@ class CPUParticles3D : public GeometryInstance3D { void set_gravity(const Vector3 &p_gravity); Vector3 get_gravity() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void restart(); diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp index 8702b1d3da0d..3acb2fa2b4e7 100644 --- a/scene/3d/decal.cpp +++ b/scene/3d/decal.cpp @@ -45,7 +45,7 @@ void Decal::set_texture(DecalTexture p_type, const Ref &p_texture) { textures[p_type] = p_texture; RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID(); RS::get_singleton()->decal_set_texture(decal, RS::DecalTexture(p_type), texture_rid); - update_configuration_warnings(); + update_configuration_info(); } Ref Decal::get_texture(DecalTexture p_type) const { @@ -138,7 +138,7 @@ real_t Decal::get_distance_fade_length() const { void Decal::set_cull_mask(uint32_t p_layers) { cull_mask = p_layers; RS::get_singleton()->decal_set_cull_mask(decal, cull_mask); - update_configuration_warnings(); + update_configuration_info(); } uint32_t Decal::get_cull_mask() const { @@ -162,28 +162,32 @@ void Decal::_validate_property(PropertyInfo &p_property) const { } } -PackedStringArray Decal::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Decal::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Decals are only available when using the Forward+ or Mobile rendering backends.")); - return warnings; + CONFIG_WARNING(RTR("Decals are only available when using the Forward+ or Mobile rendering backends.")); + return infos; } if (textures[TEXTURE_ALBEDO].is_null() && textures[TEXTURE_NORMAL].is_null() && textures[TEXTURE_ORM].is_null() && textures[TEXTURE_EMISSION].is_null()) { - warnings.push_back(RTR("The decal has no textures loaded into any of its texture properties, and will therefore not be visible.")); + CONFIG_WARNING(RTR("The decal has no textures loaded into any of its texture properties, and will therefore not be visible.")); } if ((textures[TEXTURE_NORMAL].is_valid() || textures[TEXTURE_ORM].is_valid()) && textures[TEXTURE_ALBEDO].is_null()) { - warnings.push_back(RTR("The decal has a Normal and/or ORM texture, but no Albedo texture is set.\nAn Albedo texture with an alpha channel is required to blend the normal/ORM maps onto the underlying surface.\nIf you don't want the Albedo texture to be visible, set Albedo Mix to 0.")); + CONFIG_WARNING(RTR("The decal has a Normal and/or ORM texture, but no Albedo texture is set.\nAn Albedo texture with an alpha channel is required to blend the normal/ORM maps onto the underlying surface.\nIf you don't want the Albedo texture to be visible, set Albedo Mix to 0.")); } if (cull_mask == 0) { - warnings.push_back(RTR("The decal's Cull Mask has no bits enabled, which means the decal will not paint objects on any layer.\nTo resolve this, enable at least one bit in the Cull Mask property.")); + CONFIG_WARNING_P( + RTR("The decal's Cull Mask has no bits enabled, which means the decal will not paint objects on any layer.\nTo resolve this, enable at least one bit in the Cull Mask."), + "cull_mask"); } - return warnings; + return infos; } +#endif void Decal::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size", "size"), &Decal::set_size); diff --git a/scene/3d/decal.h b/scene/3d/decal.h index 171b52815ad3..e67f2e068e76 100644 --- a/scene/3d/decal.h +++ b/scene/3d/decal.h @@ -69,7 +69,9 @@ class Decal : public VisualInstance3D { #endif // DISABLE_DEPRECATED public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif void set_size(const Vector3 &p_size); Vector3 get_size() const; diff --git a/scene/3d/fog_volume.cpp b/scene/3d/fog_volume.cpp index 195074ba2f7b..669e6bfca00b 100644 --- a/scene/3d/fog_volume.cpp +++ b/scene/3d/fog_volume.cpp @@ -115,22 +115,24 @@ AABB FogVolume::get_aabb() const { return AABB(); } -PackedStringArray FogVolume::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector FogVolume::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); Ref environment = get_viewport()->find_world_3d()->get_environment(); if (OS::get_singleton()->get_current_rendering_method() != "forward_plus") { - warnings.push_back(RTR("Fog Volumes are only visible when using the Forward+ backend.")); - return warnings; + CONFIG_WARNING(RTR("Fog Volumes are only visible when using the Forward+ backend.")); + return infos; } if (environment.is_valid() && !environment->is_volumetric_fog_enabled()) { - warnings.push_back(RTR("Fog Volumes need volumetric fog to be enabled in the scene's Environment in order to be visible.")); + CONFIG_WARNING(RTR("Fog Volumes need volumetric fog to be enabled in the scene's Environment in order to be visible.")); } - return warnings; + return infos; } +#endif FogVolume::FogVolume() { volume = RS::get_singleton()->fog_volume_create(); diff --git a/scene/3d/fog_volume.h b/scene/3d/fog_volume.h index f7e861e3d053..1bfab9427b72 100644 --- a/scene/3d/fog_volume.h +++ b/scene/3d/fog_volume.h @@ -66,7 +66,9 @@ class FogVolume : public VisualInstance3D { Ref get_material() const; virtual AABB get_aabb() const override; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif FogVolume(); ~FogVolume(); diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 2cef607d2968..12f43dfc5ddf 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -130,7 +130,7 @@ void GPUParticles3D::set_process_material(const Ref &p_material) { } RS::get_singleton()->particles_set_process_material(particles, material_rid); - update_configuration_warnings(); + update_configuration_info(); } void GPUParticles3D::set_speed_scale(double p_scale) { @@ -203,7 +203,7 @@ void GPUParticles3D::set_draw_order(DrawOrder p_order) { void GPUParticles3D::set_trail_enabled(bool p_enabled) { trail_enabled = p_enabled; RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_lifetime); - update_configuration_warnings(); + update_configuration_info(); } void GPUParticles3D::set_trail_lifetime(double p_seconds) { @@ -241,15 +241,19 @@ int GPUParticles3D::get_draw_passes() const { void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref &p_mesh) { ERR_FAIL_INDEX(p_pass, draw_passes.size()); +#ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && draw_passes.write[p_pass].is_valid()) { - draw_passes.write[p_pass]->disconnect_changed(callable_mp((Node *)this, &Node::update_configuration_warnings)); + draw_passes.write[p_pass]->disconnect_changed(callable_mp((Node *)this, &Node::update_configuration_info)); } +#endif draw_passes.write[p_pass] = p_mesh; +#ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && draw_passes.write[p_pass].is_valid()) { - draw_passes.write[p_pass]->connect_changed(callable_mp((Node *)this, &Node::update_configuration_warnings), CONNECT_DEFERRED); + draw_passes.write[p_pass]->connect_changed(callable_mp((Node *)this, &Node::update_configuration_info), CONNECT_DEFERRED); } +#endif RID mesh_rid; if (p_mesh.is_valid()) { @@ -259,7 +263,7 @@ void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref &p_mesh) { RS::get_singleton()->particles_set_draw_pass_mesh(particles, p_pass, mesh_rid); _skinning_changed(); - update_configuration_warnings(); + update_configuration_info(); } Ref GPUParticles3D::get_draw_pass_mesh(int p_pass) const { @@ -295,8 +299,9 @@ bool GPUParticles3D::get_interpolate() const { return interpolate; } -PackedStringArray GPUParticles3D::get_configuration_warnings() const { - PackedStringArray warnings = GeometryInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector GPUParticles3D::get_configuration_info() const { + Vector infos = GeometryInstance3D::get_configuration_info(); bool meshes_found = false; bool anim_material_found = false; @@ -322,17 +327,17 @@ PackedStringArray GPUParticles3D::get_configuration_warnings() const { } if (!meshes_found) { - warnings.push_back(RTR("Nothing is visible because meshes have not been assigned to draw passes.")); + CONFIG_WARNING(RTR("Nothing is visible because meshes have not been assigned to draw passes.")); } if (process_material.is_null()) { - warnings.push_back(RTR("A material to process the particles is not assigned, so no behavior is imprinted.")); + CONFIG_WARNING(RTR("A material to process the particles is not assigned, so no behavior is imprinted.")); } else { const ParticleProcessMaterial *process = Object::cast_to(process_material.ptr()); if (!anim_material_found && process && (process->get_param_max(ParticleProcessMaterial::PARAM_ANIM_SPEED) != 0.0 || process->get_param_max(ParticleProcessMaterial::PARAM_ANIM_OFFSET) != 0.0 || process->get_param_texture(ParticleProcessMaterial::PARAM_ANIM_SPEED).is_valid() || process->get_param_texture(ParticleProcessMaterial::PARAM_ANIM_OFFSET).is_valid())) { - warnings.push_back(RTR("Particles animation requires the usage of a BaseMaterial3D whose Billboard Mode is set to \"Particle Billboard\".")); + CONFIG_WARNING(RTR("Particles animation requires the usage of a BaseMaterial3D whose Billboard Mode is set to \"Particle Billboard\".")); } } @@ -374,27 +379,28 @@ PackedStringArray GPUParticles3D::get_configuration_warnings() const { } if (dp_count && skin.is_valid()) { - warnings.push_back(RTR("Using Trail meshes with a skin causes Skin to override Trail poses. Suggest removing the Skin.")); + CONFIG_WARNING(RTR("Using Trail meshes with a skin causes Skin to override Trail poses. Suggest removing the Skin.")); } else if (dp_count == 0 && skin.is_null()) { - warnings.push_back(RTR("Trails active, but neither Trail meshes or a Skin were found.")); + CONFIG_WARNING(RTR("Trails active, but neither Trail meshes or a Skin were found.")); } else if (dp_count > 1) { - warnings.push_back(RTR("Only one Trail mesh is supported. If you want to use more than a single mesh, a Skin is needed (see documentation).")); + CONFIG_WARNING(RTR("Only one Trail mesh is supported. If you want to use more than a single mesh, a Skin is needed (see documentation).")); } if ((dp_count || !skin.is_null()) && (missing_trails || no_materials)) { - warnings.push_back(RTR("Trails enabled, but one or more mesh materials are either missing or not set for trails rendering.")); + CONFIG_WARNING(RTR("Trails enabled, but one or more mesh materials are either missing or not set for trails rendering.")); } if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Particle trails are only available when using the Forward+ or Mobile rendering backends.")); + CONFIG_WARNING(RTR("Particle trails are only available when using the Forward+ or Mobile rendering backends.")); } } if (sub_emitter != NodePath() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Particle sub-emitters are only available when using the Forward+ or Mobile rendering backends.")); + CONFIG_WARNING(RTR("Particle sub-emitters are only available when using the Forward+ or Mobile rendering backends.")); } - return warnings; + return infos; } +#endif void GPUParticles3D::restart() { RenderingServer::get_singleton()->particles_restart(particles); @@ -447,7 +453,7 @@ void GPUParticles3D::set_sub_emitter(const NodePath &p_path) { if (is_inside_tree() && sub_emitter != NodePath()) { _attach_sub_emitter(); } - update_configuration_warnings(); + update_configuration_info(); } NodePath GPUParticles3D::get_sub_emitter() const { @@ -552,7 +558,7 @@ void GPUParticles3D::_skinning_changed() { } RS::get_singleton()->particles_set_trail_bind_poses(particles, xforms); - update_configuration_warnings(); + update_configuration_info(); } void GPUParticles3D::set_skin(const Ref &p_skin) { diff --git a/scene/3d/gpu_particles_3d.h b/scene/3d/gpu_particles_3d.h index b5aee6fe3477..3ed37431b0f0 100644 --- a/scene/3d/gpu_particles_3d.h +++ b/scene/3d/gpu_particles_3d.h @@ -164,7 +164,9 @@ class GPUParticles3D : public GeometryInstance3D { void set_draw_pass_mesh(int p_pass, const Ref &p_mesh); Ref get_draw_pass_mesh(int p_pass) const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_sub_emitter(const NodePath &p_path); NodePath get_sub_emitter() const; diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp index 9791f23bc357..8f39b5b05685 100644 --- a/scene/3d/gpu_particles_collision_3d.cpp +++ b/scene/3d/gpu_particles_collision_3d.cpp @@ -523,15 +523,19 @@ Ref GPUParticlesCollisionSDF3D::bake() { return ret; } -PackedStringArray GPUParticlesCollisionSDF3D::get_configuration_warnings() const { - PackedStringArray warnings = GPUParticlesCollision3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector GPUParticlesCollisionSDF3D::get_configuration_info() const { + Vector infos = GPUParticlesCollision3D::get_configuration_info(); if (bake_mask == 0) { - warnings.push_back(RTR("The Bake Mask has no bits enabled, which means baking will not produce any collision for this GPUParticlesCollisionSDF3D.\nTo resolve this, enable at least one bit in the Bake Mask property.")); + CONFIG_WARNING_P( + RTR("The Bake Mask has no bits enabled, which means baking will not produce any collision for this GPUParticlesCollisionSDF3D.\nTo resolve this, enable at least one bit in the Bake Mask."), + "bake_mask"); } - return warnings; + return infos; } +#endif void GPUParticlesCollisionSDF3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size", "size"), &GPUParticlesCollisionSDF3D::set_size); @@ -613,7 +617,7 @@ GPUParticlesCollisionSDF3D::Resolution GPUParticlesCollisionSDF3D::get_resolutio void GPUParticlesCollisionSDF3D::set_bake_mask(uint32_t p_mask) { bake_mask = p_mask; - update_configuration_warnings(); + update_configuration_info(); } uint32_t GPUParticlesCollisionSDF3D::get_bake_mask() const { diff --git a/scene/3d/gpu_particles_collision_3d.h b/scene/3d/gpu_particles_collision_3d.h index 16493200691f..f14c40676b96 100644 --- a/scene/3d/gpu_particles_collision_3d.h +++ b/scene/3d/gpu_particles_collision_3d.h @@ -170,7 +170,9 @@ class GPUParticlesCollisionSDF3D : public GPUParticlesCollision3D { #endif // DISABLE_DEPRECATED public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif void set_thickness(float p_thickness); float get_thickness() const; diff --git a/scene/3d/importer_mesh_instance_3d.cpp b/scene/3d/importer_mesh_instance_3d.cpp index ad44c9e56a8a..8bd1822f4348 100644 --- a/scene/3d/importer_mesh_instance_3d.cpp +++ b/scene/3d/importer_mesh_instance_3d.cpp @@ -87,7 +87,7 @@ GeometryInstance3D::ShadowCastingSetting ImporterMeshInstance3D::get_cast_shadow void ImporterMeshInstance3D::set_visibility_range_begin(float p_dist) { visibility_range_begin = p_dist; - update_configuration_warnings(); + update_configuration_info(); } float ImporterMeshInstance3D::get_visibility_range_begin() const { @@ -96,7 +96,7 @@ float ImporterMeshInstance3D::get_visibility_range_begin() const { void ImporterMeshInstance3D::set_visibility_range_end(float p_dist) { visibility_range_end = p_dist; - update_configuration_warnings(); + update_configuration_info(); } float ImporterMeshInstance3D::get_visibility_range_end() const { @@ -105,7 +105,7 @@ float ImporterMeshInstance3D::get_visibility_range_end() const { void ImporterMeshInstance3D::set_visibility_range_begin_margin(float p_dist) { visibility_range_begin_margin = p_dist; - update_configuration_warnings(); + update_configuration_info(); } float ImporterMeshInstance3D::get_visibility_range_begin_margin() const { @@ -114,7 +114,7 @@ float ImporterMeshInstance3D::get_visibility_range_begin_margin() const { void ImporterMeshInstance3D::set_visibility_range_end_margin(float p_dist) { visibility_range_end_margin = p_dist; - update_configuration_warnings(); + update_configuration_info(); } float ImporterMeshInstance3D::get_visibility_range_end_margin() const { @@ -123,7 +123,7 @@ float ImporterMeshInstance3D::get_visibility_range_end_margin() const { void ImporterMeshInstance3D::set_visibility_range_fade_mode(GeometryInstance3D::VisibilityRangeFadeMode p_mode) { visibility_range_fade_mode = p_mode; - update_configuration_warnings(); + update_configuration_info(); } GeometryInstance3D::VisibilityRangeFadeMode ImporterMeshInstance3D::get_visibility_range_fade_mode() const { diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index 7b70986adce9..7b731665a459 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -42,7 +42,7 @@ void Light3D::set_param(Param p_param, real_t p_value) { update_gizmos(); if (p_param == PARAM_SPOT_ANGLE) { - update_configuration_warnings(); + update_configuration_info(); } } } @@ -57,7 +57,7 @@ void Light3D::set_shadow(bool p_enable) { RS::get_singleton()->light_set_shadow(light, p_enable); notify_property_list_changed(); - update_configuration_warnings(); + update_configuration_info(); } bool Light3D::has_shadow() const { @@ -169,15 +169,17 @@ AABB Light3D::get_aabb() const { return AABB(); } -PackedStringArray Light3D::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Light3D::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); if (!get_scale().is_equal_approx(Vector3(1, 1, 1))) { - warnings.push_back(RTR("A light's scale does not affect the visual size of the light.")); + CONFIG_WARNING(RTR("A light's scale does not affect the visual size of the light.")); } - return warnings; + return infos; } +#endif void Light3D::set_bake_mode(BakeMode p_mode) { bake_mode = p_mode; @@ -192,7 +194,7 @@ void Light3D::set_projector(const Ref &p_texture) { projector = p_texture; RID tex_id = projector.is_valid() ? projector->get_rid() : RID(); RS::get_singleton()->light_set_projector(light, tex_id); - update_configuration_warnings(); + update_configuration_info(); } Ref Light3D::get_projector() const { @@ -281,7 +283,7 @@ void Light3D::_update_visibility() { void Light3D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_TRANSFORM_CHANGED: { - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_VISIBILITY_CHANGED: case NOTIFICATION_ENTER_TREE: { @@ -596,19 +598,21 @@ OmniLight3D::ShadowMode OmniLight3D::get_shadow_mode() const { return shadow_mode; } -PackedStringArray OmniLight3D::get_configuration_warnings() const { - PackedStringArray warnings = Light3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector OmniLight3D::get_configuration_info() const { + Vector infos = Light3D::get_configuration_info(); if (!has_shadow() && get_projector().is_valid()) { - warnings.push_back(RTR("Projector texture only works with shadows active.")); + CONFIG_WARNING(RTR("Projector texture only works with shadows active.")); } if (get_projector().is_valid() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + CONFIG_WARNING(RTR("Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); } - return warnings; + return infos; } +#endif void OmniLight3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_shadow_mode", "mode"), &OmniLight3D::set_shadow_mode); @@ -628,23 +632,25 @@ OmniLight3D::OmniLight3D() : set_shadow_mode(SHADOW_CUBE); } -PackedStringArray SpotLight3D::get_configuration_warnings() const { - PackedStringArray warnings = Light3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector SpotLight3D::get_configuration_info() const { + Vector infos = Light3D::get_configuration_info(); if (has_shadow() && get_param(PARAM_SPOT_ANGLE) >= 90.0) { - warnings.push_back(RTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows.")); + CONFIG_WARNING(RTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows.")); } if (!has_shadow() && get_projector().is_valid()) { - warnings.push_back(RTR("Projector texture only works with shadows active.")); + CONFIG_WARNING(RTR("Projector texture only works with shadows active.")); } if (get_projector().is_valid() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + CONFIG_WARNING(RTR("Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); } - return warnings; + return infos; } +#endif void SpotLight3D::_bind_methods() { ADD_GROUP("Spot", "spot_"); diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h index d6eca8d8b6e4..8614fa1d23bb 100644 --- a/scene/3d/light_3d.h +++ b/scene/3d/light_3d.h @@ -147,7 +147,9 @@ class Light3D : public VisualInstance3D { Color get_correlated_color() const; virtual AABB get_aabb() const override; - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif Light3D(); ~Light3D(); @@ -217,7 +219,9 @@ class OmniLight3D : public Light3D { void set_shadow_mode(ShadowMode p_mode); ShadowMode get_shadow_mode() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif OmniLight3D(); }; @@ -231,7 +235,9 @@ class SpotLight3D : public Light3D { static void _bind_methods(); public: - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif SpotLight3D(); }; diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index a1f32fccbe1d..6285b33c9103 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -1599,25 +1599,27 @@ Ref LightmapGI::get_camera_attributes() const { return camera_attributes; } -PackedStringArray LightmapGI::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector LightmapGI::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); #ifndef MODULE_LIGHTMAPPER_RD_ENABLED #if defined(ANDROID_ENABLED) || defined(IOS_ENABLED) - warnings.push_back(vformat(RTR("Lightmaps cannot be baked on %s. Rendering existing baked lightmaps will still work."), OS::get_singleton()->get_name())); + CONFIG_WARNING(vformat(RTR("Lightmaps cannot be baked on %s. Rendering existing baked lightmaps will still work."), OS::get_singleton()->get_name())); #else - warnings.push_back(RTR("Lightmaps cannot be baked, as the `lightmapper_rd` module was disabled at compile-time. Rendering existing baked lightmaps will still work.")); + CONFIG_WARNING(RTR("Lightmaps cannot be baked, as the `lightmapper_rd` module was disabled at compile-time. Rendering existing baked lightmaps will still work.")); #endif - return warnings; + return infos; #endif if (!DisplayServer::get_singleton()->can_create_rendering_device()) { - warnings.push_back(vformat(RTR("Lightmaps can only be baked from a GPU that supports the RenderingDevice backends.\nYour GPU (%s) does not support RenderingDevice, as it does not support Vulkan, Direct3D 12, or Metal.\nLightmap baking will not be available on this device, although rendering existing baked lightmaps will work."), RenderingServer::get_singleton()->get_video_adapter_name())); - return warnings; + CONFIG_WARNING(vformat(RTR("Lightmaps can only be baked from a GPU that supports the RenderingDevice backends.\nYour GPU (%s) does not support RenderingDevice, as it does not support Vulkan, Direct3D 12, or Metal.\nLightmap baking will not be available on this device, although rendering existing baked lightmaps will work."), RenderingServer::get_singleton()->get_video_adapter_name())); + return infos; } - return warnings; + return infos; } +#endif void LightmapGI::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "environment_custom_sky" && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { diff --git a/scene/3d/lightmap_gi.h b/scene/3d/lightmap_gi.h index 6377c420d167..8c1b3dc3ef60 100644 --- a/scene/3d/lightmap_gi.h +++ b/scene/3d/lightmap_gi.h @@ -312,7 +312,9 @@ class LightmapGI : public VisualInstance3D { BakeError bake(Node *p_from_node, String p_image_data_path = "", Lightmapper::BakeStepFunc p_bake_step = nullptr, void *p_bake_userdata = nullptr); - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif LightmapGI(); }; diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index 5bbb724e2fa0..d3e59ddcace5 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -716,15 +716,17 @@ void NavigationAgent3D::_avoidance_done(Vector3 p_new_velocity) { emit_signal(SNAME("velocity_computed"), safe_velocity); } -PackedStringArray NavigationAgent3D::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector NavigationAgent3D::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("The NavigationAgent3D can be used only under a Node3D inheriting parent node.")); + CONFIG_WARNING(RTR("The NavigationAgent3D can be used only under a Node3D inheriting parent node.")); } - return warnings; + return infos; } +#endif void NavigationAgent3D::_update_navigation() { if (agent_parent == nullptr) { diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h index d5721a56c848..eec9a47bed05 100644 --- a/scene/3d/navigation_agent_3d.h +++ b/scene/3d/navigation_agent_3d.h @@ -227,7 +227,9 @@ class NavigationAgent3D : public Node { void _avoidance_done(Vector3 p_new_velocity); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_avoidance_layers(uint32_t p_layers); uint32_t get_avoidance_layers() const; diff --git a/scene/3d/navigation_link_3d.cpp b/scene/3d/navigation_link_3d.cpp index 0cce21b9d0f0..c5c7649d2b9f 100644 --- a/scene/3d/navigation_link_3d.cpp +++ b/scene/3d/navigation_link_3d.cpp @@ -374,7 +374,7 @@ void NavigationLink3D::set_start_position(Vector3 p_position) { #endif // DEBUG_ENABLED update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); } void NavigationLink3D::set_end_position(Vector3 p_position) { @@ -395,7 +395,7 @@ void NavigationLink3D::set_end_position(Vector3 p_position) { #endif // DEBUG_ENABLED update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); } void NavigationLink3D::set_global_start_position(Vector3 p_position) { @@ -452,15 +452,17 @@ void NavigationLink3D::set_travel_cost(real_t p_travel_cost) { NavigationServer3D::get_singleton()->link_set_travel_cost(link, travel_cost); } -PackedStringArray NavigationLink3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector NavigationLink3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (start_position.is_equal_approx(end_position)) { - warnings.push_back(RTR("NavigationLink3D start position should be different than the end position to be useful.")); + CONFIG_WARNING(RTR("NavigationLink3D start position should be different than the end position to be useful.")); } - return warnings; + return infos; } +#endif void NavigationLink3D::_link_enter_navigation_map() { if (!is_inside_tree()) { diff --git a/scene/3d/navigation_link_3d.h b/scene/3d/navigation_link_3d.h index e894761f400b..f2cfa4db5dc2 100644 --- a/scene/3d/navigation_link_3d.h +++ b/scene/3d/navigation_link_3d.h @@ -103,7 +103,9 @@ class NavigationLink3D : public Node3D { void set_travel_cost(real_t p_travel_cost); real_t get_travel_cost() const { return travel_cost; } - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif private: void _link_enter_navigation_map(); diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index c0c254e7ed59..a3d2ef0006d5 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -214,7 +214,7 @@ void NavigationRegion3D::set_navigation_mesh(const Ref &p_naviga emit_signal(SNAME("navigation_mesh_changed")); update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); } Ref NavigationRegion3D::get_navigation_mesh() const { @@ -270,17 +270,19 @@ bool NavigationRegion3D::is_baking() const { return NavigationServer3D::get_singleton()->is_baking_navigation_mesh(navigation_mesh); } -PackedStringArray NavigationRegion3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector NavigationRegion3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (is_visible_in_tree() && is_inside_tree()) { if (!navigation_mesh.is_valid()) { - warnings.push_back(RTR("A NavigationMesh resource must be set or created for this node to work.")); + CONFIG_WARNING(RTR("A NavigationMesh resource must be set or created for this node to work.")); } } - return warnings; + return infos; } +#endif void NavigationRegion3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &NavigationRegion3D::get_rid); @@ -346,7 +348,7 @@ bool NavigationRegion3D::_get(const StringName &p_name, Variant &r_ret) const { void NavigationRegion3D::_navigation_mesh_changed() { update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); #ifdef DEBUG_ENABLED _update_debug_edge_connections_mesh(); diff --git a/scene/3d/navigation_region_3d.h b/scene/3d/navigation_region_3d.h index 82468627deb0..b1e7c465f503 100644 --- a/scene/3d/navigation_region_3d.h +++ b/scene/3d/navigation_region_3d.h @@ -108,7 +108,9 @@ class NavigationRegion3D : public Node3D { void _bake_finished(Ref p_navigation_mesh); bool is_baking() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif NavigationRegion3D(); ~NavigationRegion3D(); diff --git a/scene/3d/occluder_instance_3d.cpp b/scene/3d/occluder_instance_3d.cpp index 6d88323c76d2..fac8d9391839 100644 --- a/scene/3d/occluder_instance_3d.cpp +++ b/scene/3d/occluder_instance_3d.cpp @@ -450,7 +450,7 @@ void OccluderInstance3D::set_occluder(const Ref &p_occluder) { } update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); #ifdef TOOLS_ENABLED // PolygonOccluder3D is edited via an editor plugin, this ensures the plugin is shown/hidden when necessary @@ -462,7 +462,7 @@ void OccluderInstance3D::set_occluder(const Ref &p_occluder) { void OccluderInstance3D::_occluder_changed() { update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); } Ref OccluderInstance3D::get_occluder() const { @@ -471,7 +471,7 @@ Ref OccluderInstance3D::get_occluder() const { void OccluderInstance3D::set_bake_mask(uint32_t p_mask) { bake_mask = p_mask; - update_configuration_warnings(); + update_configuration_info(); } uint32_t OccluderInstance3D::get_bake_mask() const { @@ -690,34 +690,40 @@ OccluderInstance3D::BakeError OccluderInstance3D::bake_scene(Node *p_from_node, return BAKE_ERROR_OK; } -PackedStringArray OccluderInstance3D::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector OccluderInstance3D::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); if (!bool(GLOBAL_GET("rendering/occlusion_culling/use_occlusion_culling"))) { - warnings.push_back(RTR("Occlusion culling is disabled in the Project Settings, which means occlusion culling won't be performed in the root viewport.\nTo resolve this, open the Project Settings and enable Rendering > Occlusion Culling > Use Occlusion Culling.")); + CONFIG_WARNING(RTR("Occlusion culling is disabled in the Project Settings, which means occlusion culling won't be performed in the root viewport.\nTo resolve this, open the Project Settings and enable Rendering > Occlusion Culling > Use Occlusion Culling.")); } if (bake_mask == 0) { - warnings.push_back(RTR("The Bake Mask has no bits enabled, which means baking will not produce any occluder meshes for this OccluderInstance3D.\nTo resolve this, enable at least one bit in the Bake Mask property.")); + CONFIG_WARNING_P( + RTR("The Bake Mask has no bits enabled, which means baking will not produce any occluder meshes for this OccluderInstance3D.\nTo resolve this, enable at least one bit in the Bake Mask."), + "bake_mask"); } if (occluder.is_null()) { - warnings.push_back(RTR("No occluder mesh is defined in the Occluder property, so no occlusion culling will be performed using this OccluderInstance3D.\nTo resolve this, set the Occluder property to one of the primitive occluder types or bake the scene meshes by selecting the OccluderInstance3D and pressing the Bake Occluders button at the top of the 3D editor viewport.")); + CONFIG_WARNING_P( + RTR("No occluder mesh is defined in the Occluder property, so no occlusion culling will be performed using this OccluderInstance3D.\nTo resolve this, set the Occluder to one of the primitive occluder types or bake the scene meshes by selecting the OccluderInstance3D and pressing the Bake Occluders button at the top of the 3D editor viewport."), + "occluder"); } else { Ref arr_occluder = occluder; if (arr_occluder.is_valid() && arr_occluder->get_indices().size() < 3) { // Setting a new ArrayOccluder3D from the inspector will create an empty occluder, // so warn the user about this. - warnings.push_back(RTR("The occluder mesh has less than 3 vertices, so no occlusion culling will be performed using this OccluderInstance3D.\nTo generate a proper occluder mesh, select the OccluderInstance3D then use the Bake Occluders button at the top of the 3D editor viewport.")); + CONFIG_WARNING(RTR("The occluder mesh has less than 3 vertices, so no occlusion culling will be performed using this OccluderInstance3D.\nTo generate a proper occluder mesh, select the OccluderInstance3D then use the Bake Occluders button at the top of the 3D editor viewport.")); } Ref poly_occluder = occluder; if (poly_occluder.is_valid() && poly_occluder->get_polygon().size() < 3) { - warnings.push_back(RTR("The polygon occluder has less than 3 vertices, so no occlusion culling will be performed using this OccluderInstance3D.\nVertices can be added in the inspector or using the polygon editing tools at the top of the 3D editor viewport.")); + CONFIG_WARNING(RTR("The polygon occluder has less than 3 vertices, so no occlusion culling will be performed using this OccluderInstance3D.\nVertices can be added in the inspector or using the polygon editing tools at the top of the 3D editor viewport.")); } } - return warnings; + return infos; } +#endif bool OccluderInstance3D::_is_editable_3d_polygon() const { return Ref(occluder).is_valid(); diff --git a/scene/3d/occluder_instance_3d.h b/scene/3d/occluder_instance_3d.h index 62e9478527c9..7d91d1047bcd 100644 --- a/scene/3d/occluder_instance_3d.h +++ b/scene/3d/occluder_instance_3d.h @@ -180,7 +180,9 @@ class OccluderInstance3D : public VisualInstance3D { static void _bind_methods(); public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif enum BakeError { BAKE_ERROR_OK, diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp index 64259a24b00c..68fb07660ba9 100644 --- a/scene/3d/path_3d.cpp +++ b/scene/3d/path_3d.cpp @@ -179,7 +179,9 @@ void Path3D::_curve_changed() { for (int i = 0; i < get_child_count(); i++) { PathFollow3D *child = Object::cast_to(get_child(i)); if (child) { - child->update_configuration_warnings(); +#ifdef TOOLS_ENABLED + child->update_configuration_info(); +#endif child->update_transform(); } } @@ -298,22 +300,24 @@ void PathFollow3D::_validate_property(PropertyInfo &p_property) const { } } -PackedStringArray PathFollow3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector PathFollow3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (is_visible_in_tree() && is_inside_tree()) { if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("PathFollow3D only works when set as a child of a Path3D node.")); + CONFIG_WARNING(RTR("PathFollow3D only works when set as a child of a Path3D node.")); } else { Path3D *p = Object::cast_to(get_parent()); if (p->get_curve().is_valid() && !p->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) { - warnings.push_back(RTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource.")); + CONFIG_WARNING(RTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource.")); } } } - return warnings; + return infos; } +#endif Transform3D PathFollow3D::correct_posture(Transform3D p_transform, PathFollow3D::RotationMode p_rotation_mode) { Transform3D t = p_transform; @@ -467,7 +471,7 @@ void PathFollow3D::set_rotation_mode(RotationMode p_rotation_mode) { } rotation_mode = p_rotation_mode; - update_configuration_warnings(); + update_configuration_info(); update_transform(); } diff --git a/scene/3d/path_3d.h b/scene/3d/path_3d.h index fb4f301375b8..14f69c92df8d 100644 --- a/scene/3d/path_3d.h +++ b/scene/3d/path_3d.h @@ -121,7 +121,9 @@ class PathFollow3D : public Node3D { void set_cubic_interpolation_enabled(bool p_enabled); bool is_cubic_interpolation_enabled() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void update_transform(); diff --git a/scene/3d/physics/collision_object_3d.cpp b/scene/3d/physics/collision_object_3d.cpp index f0a5013ca288..d6ecc32638e3 100644 --- a/scene/3d/physics/collision_object_3d.cpp +++ b/scene/3d/physics/collision_object_3d.cpp @@ -84,7 +84,7 @@ void CollisionObject3D::_notification(int p_what) { } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_TRANSFORM_CHANGED: { @@ -730,20 +730,22 @@ bool CollisionObject3D::get_capture_input_on_drag() const { return capture_input_on_drag; } -PackedStringArray CollisionObject3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CollisionObject3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (shapes.is_empty()) { - warnings.push_back(RTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape.")); + CONFIG_WARNING(RTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape.")); } Vector3 scale = get_transform().get_basis().get_scale(); if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) { - warnings.push_back(RTR("With a non-uniform scale this node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size in children collision shapes instead.")); + CONFIG_WARNING(RTR("With a non-uniform scale this node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size in children collision shapes instead.")); } - return warnings; + return infos; } +#endif CollisionObject3D::CollisionObject3D() { set_notify_transform(true); diff --git a/scene/3d/physics/collision_object_3d.h b/scene/3d/physics/collision_object_3d.h index b51423f0215a..0a4c6c799a0c 100644 --- a/scene/3d/physics/collision_object_3d.h +++ b/scene/3d/physics/collision_object_3d.h @@ -173,7 +173,9 @@ class CollisionObject3D : public Node3D { _FORCE_INLINE_ RID get_rid() const { return rid; } - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif CollisionObject3D(); ~CollisionObject3D(); diff --git a/scene/3d/physics/collision_polygon_3d.cpp b/scene/3d/physics/collision_polygon_3d.cpp index bf8dec7b5463..51424144919a 100644 --- a/scene/3d/physics/collision_polygon_3d.cpp +++ b/scene/3d/physics/collision_polygon_3d.cpp @@ -104,7 +104,7 @@ void CollisionPolygon3D::_notification(int p_what) { if (collision_object) { _update_in_shape_owner(true); } - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_UNPARENTED: { @@ -122,7 +122,7 @@ void CollisionPolygon3D::set_polygon(const Vector &p_polygon) { if (collision_object) { _build_polygon(); } - update_configuration_warnings(); + update_configuration_info(); update_gizmos(); } @@ -168,24 +168,26 @@ void CollisionPolygon3D::set_margin(real_t p_margin) { } } -PackedStringArray CollisionPolygon3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CollisionPolygon3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node.\nPlease only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape.")); + CONFIG_WARNING(RTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node.\nPlease only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape.")); } if (polygon.is_empty()) { - warnings.push_back(RTR("An empty CollisionPolygon3D has no effect on collision.")); + CONFIG_WARNING(RTR("An empty CollisionPolygon3D has no effect on collision.")); } Vector3 scale = get_transform().get_basis().get_scale(); if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) { - warnings.push_back(RTR("A non-uniformly scaled CollisionPolygon3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change its polygon's vertices instead.")); + CONFIG_WARNING(RTR("A non-uniformly scaled CollisionPolygon3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change its polygon's vertices instead.")); } - return warnings; + return infos; } +#endif bool CollisionPolygon3D::_is_editable_3d_polygon() const { return true; diff --git a/scene/3d/physics/collision_polygon_3d.h b/scene/3d/physics/collision_polygon_3d.h index fe4cf40ee310..0e0af5e0d010 100644 --- a/scene/3d/physics/collision_polygon_3d.h +++ b/scene/3d/physics/collision_polygon_3d.h @@ -74,7 +74,9 @@ class CollisionPolygon3D : public Node3D { real_t get_margin() const; void set_margin(real_t p_margin); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif CollisionPolygon3D(); }; diff --git a/scene/3d/physics/collision_shape_3d.cpp b/scene/3d/physics/collision_shape_3d.cpp index 304fa74b06a5..c2fb0d6cef52 100644 --- a/scene/3d/physics/collision_shape_3d.cpp +++ b/scene/3d/physics/collision_shape_3d.cpp @@ -101,7 +101,7 @@ void CollisionShape3D::_notification(int p_what) { if (collision_object) { _update_in_shape_owner(true); } - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_UNPARENTED: { @@ -119,16 +119,17 @@ void CollisionShape3D::resource_changed(Ref res) { } #endif -PackedStringArray CollisionShape3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector CollisionShape3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); CollisionObject3D *col_object = Object::cast_to(get_parent()); if (col_object == nullptr) { - warnings.push_back(RTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node.\nPlease only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape.")); + CONFIG_WARNING(RTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node.\nPlease only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape.")); } if (!shape.is_valid()) { - warnings.push_back(RTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it.")); + CONFIG_WARNING(RTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it.")); } if (shape.is_valid() && Object::cast_to(col_object)) { @@ -138,25 +139,26 @@ PackedStringArray CollisionShape3D::get_configuration_warnings() const { } if (Object::cast_to(*shape)) { - warnings.push_back(vformat(RTR("When used for collision, ConcavePolygonShape3D is intended to work with static CollisionObject3D nodes like StaticBody3D.\nIt will likely not behave well for %ss (except when frozen and freeze_mode set to FREEZE_MODE_STATIC)."), body_type)); + CONFIG_WARNING(vformat(RTR("When used for collision, ConcavePolygonShape3D is intended to work with static CollisionObject3D nodes like StaticBody3D.\nIt will likely not behave well for %ss (except when frozen and freeze_mode set to FREEZE_MODE_STATIC)."), body_type)); } else if (Object::cast_to(*shape)) { - warnings.push_back(RTR("WorldBoundaryShape3D doesn't support RigidBody3D in another mode than static.")); + CONFIG_WARNING(RTR("WorldBoundaryShape3D doesn't support RigidBody3D in another mode than static.")); } } if (shape.is_valid() && Object::cast_to(col_object)) { if (Object::cast_to(*shape)) { - warnings.push_back(RTR("When used for collision, ConcavePolygonShape3D is intended to work with static CollisionObject3D nodes like StaticBody3D.\nIt will likely not behave well for CharacterBody3Ds.")); + CONFIG_WARNING(RTR("When used for collision, ConcavePolygonShape3D is intended to work with static CollisionObject3D nodes like StaticBody3D.\nIt will likely not behave well for CharacterBody3Ds.")); } } Vector3 scale = get_transform().get_basis().get_scale(); if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) { - warnings.push_back(RTR("A non-uniformly scaled CollisionShape3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size of its shape resource instead.")); + CONFIG_WARNING(RTR("A non-uniformly scaled CollisionShape3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size of its shape resource instead.")); } - return warnings; + return infos; } +#endif void CollisionShape3D::_bind_methods() { #ifndef DISABLE_DEPRECATED @@ -196,7 +198,7 @@ void CollisionShape3D::set_shape(const Ref &p_shape) { // If this is a heightfield shape our center may have changed _update_in_shape_owner(true); } - update_configuration_warnings(); + update_configuration_info(); } Ref CollisionShape3D::get_shape() const { diff --git a/scene/3d/physics/collision_shape_3d.h b/scene/3d/physics/collision_shape_3d.h index 15f6ef73cbf1..57636ff1f170 100644 --- a/scene/3d/physics/collision_shape_3d.h +++ b/scene/3d/physics/collision_shape_3d.h @@ -64,7 +64,9 @@ class CollisionShape3D : public Node3D { void set_disabled(bool p_disabled); bool is_disabled() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif CollisionShape3D(); ~CollisionShape3D(); diff --git a/scene/3d/physics/joints/joint_3d.cpp b/scene/3d/physics/joints/joint_3d.cpp index 47c89f37e29b..6d6378f68652 100644 --- a/scene/3d/physics/joints/joint_3d.cpp +++ b/scene/3d/physics/joints/joint_3d.cpp @@ -47,7 +47,7 @@ void Joint3D::_disconnect_signals() { void Joint3D::_body_exit_tree() { _disconnect_signals(); _update_joint(true); - update_configuration_warnings(); + update_configuration_info(); } void Joint3D::_update_joint(bool p_only_free) { @@ -87,7 +87,7 @@ void Joint3D::_update_joint(bool p_only_free) { warning = String(); } - update_configuration_warnings(); + update_configuration_info(); if (!warning.is_empty()) { PhysicsServer3D::get_singleton()->joint_clear(joint); @@ -200,15 +200,17 @@ bool Joint3D::get_exclude_nodes_from_collision() const { return exclude_from_collision; } -PackedStringArray Joint3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Joint3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (!warning.is_empty()) { - warnings.push_back(warning); + CONFIG_WARNING(warning); } - return warnings; + return infos; } +#endif void Joint3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_node_a", "node"), &Joint3D::set_node_a); diff --git a/scene/3d/physics/joints/joint_3d.h b/scene/3d/physics/joints/joint_3d.h index ed502ab2459e..31244fdfb43b 100644 --- a/scene/3d/physics/joints/joint_3d.h +++ b/scene/3d/physics/joints/joint_3d.h @@ -63,7 +63,9 @@ class Joint3D : public Node3D { _FORCE_INLINE_ bool is_configured() const { return configured; } public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif void set_node_a(const NodePath &p_node_a); NodePath get_node_a() const; diff --git a/scene/3d/physics/rigid_body_3d.cpp b/scene/3d/physics/rigid_body_3d.cpp index 275e8cd7a920..d97d34f88710 100644 --- a/scene/3d/physics/rigid_body_3d.cpp +++ b/scene/3d/physics/rigid_body_3d.cpp @@ -268,7 +268,7 @@ void RigidBody3D::_notification(int p_what) { } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { - update_configuration_warnings(); + update_configuration_info(); } break; } #endif @@ -658,16 +658,18 @@ void RigidBody3D::_reload_physics_characteristics() { } } -PackedStringArray RigidBody3D::get_configuration_warnings() const { - PackedStringArray warnings = CollisionObject3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector RigidBody3D::get_configuration_info() const { + Vector infos = PhysicsBody3D::get_configuration_info(); Vector3 scale = get_transform().get_basis().get_scale(); if (ABS(scale.x - 1.0) > 0.05 || ABS(scale.y - 1.0) > 0.05 || ABS(scale.z - 1.0) > 0.05) { - warnings.push_back(RTR("Scale changes to RigidBody3D will be overridden by the physics engine when running.\nPlease change the size in children collision shapes instead.")); + CONFIG_WARNING(RTR("Scale changes to RigidBody3D will be overridden by the physics engine when running.\nPlease change the size in children collision shapes instead.")); } - return warnings; + return infos; } +#endif void RigidBody3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mass", "mass"), &RigidBody3D::set_mass); diff --git a/scene/3d/physics/rigid_body_3d.h b/scene/3d/physics/rigid_body_3d.h index ec051e5e0fb5..a18c18621467 100644 --- a/scene/3d/physics/rigid_body_3d.h +++ b/scene/3d/physics/rigid_body_3d.h @@ -232,7 +232,9 @@ class RigidBody3D : public PhysicsBody3D { void set_constant_torque(const Vector3 &p_torque); Vector3 get_constant_torque() const; - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif RigidBody3D(); ~RigidBody3D(); diff --git a/scene/3d/physics/shape_cast_3d.cpp b/scene/3d/physics/shape_cast_3d.cpp index 8ad651fdf561..7f3fcc10b218 100644 --- a/scene/3d/physics/shape_cast_3d.cpp +++ b/scene/3d/physics/shape_cast_3d.cpp @@ -179,17 +179,19 @@ void ShapeCast3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_shape_custom_color"), "set_debug_shape_custom_color", "get_debug_shape_custom_color"); } -PackedStringArray ShapeCast3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector ShapeCast3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (shape.is_null()) { - warnings.push_back(RTR("This node cannot interact with other objects unless a Shape3D is assigned.")); + CONFIG_WARNING(RTR("This node cannot interact with other objects unless a Shape3D is assigned.")); } if (shape.is_valid() && Object::cast_to(*shape)) { - warnings.push_back(RTR("ShapeCast3D does not support ConcavePolygonShape3Ds. Collisions will not be reported.")); + CONFIG_WARNING(RTR("ShapeCast3D does not support ConcavePolygonShape3Ds. Collisions will not be reported.")); } - return warnings; + return infos; } +#endif void ShapeCast3D::set_enabled(bool p_enabled) { enabled = p_enabled; @@ -353,7 +355,7 @@ void ShapeCast3D::set_shape(const Ref &p_shape) { _update_debug_shape(); } update_gizmos(); - update_configuration_warnings(); + update_configuration_info(); } Ref ShapeCast3D::get_shape() const { diff --git a/scene/3d/physics/shape_cast_3d.h b/scene/3d/physics/shape_cast_3d.h index 9fc5e7167000..b1d031dfe71d 100644 --- a/scene/3d/physics/shape_cast_3d.h +++ b/scene/3d/physics/shape_cast_3d.h @@ -141,7 +141,9 @@ class ShapeCast3D : public Node3D { void remove_exception(const CollisionObject3D *p_node); void clear_exceptions(); - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif }; #endif // SHAPE_CAST_3D_H diff --git a/scene/3d/physics/vehicle_body_3d.cpp b/scene/3d/physics/vehicle_body_3d.cpp index 981e872af229..b10a464575a4 100644 --- a/scene/3d/physics/vehicle_body_3d.cpp +++ b/scene/3d/physics/vehicle_body_3d.cpp @@ -105,15 +105,17 @@ void VehicleWheel3D::_notification(int p_what) { } } -PackedStringArray VehicleWheel3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector VehicleWheel3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (!Object::cast_to(get_parent())) { - warnings.push_back(RTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D.")); + CONFIG_WARNING(RTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D.")); } - return warnings; + return infos; } +#endif void VehicleWheel3D::_update(PhysicsDirectBodyState3D *s) { if (m_raycastInfo.m_isInContact) { diff --git a/scene/3d/physics/vehicle_body_3d.h b/scene/3d/physics/vehicle_body_3d.h index 24f120ed26b0..42b5488c6283 100644 --- a/scene/3d/physics/vehicle_body_3d.h +++ b/scene/3d/physics/vehicle_body_3d.h @@ -152,7 +152,9 @@ class VehicleWheel3D : public Node3D { void set_steering(real_t p_steering); real_t get_steering() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif VehicleWheel3D(); }; diff --git a/scene/3d/remote_transform_3d.cpp b/scene/3d/remote_transform_3d.cpp index f970879aa46d..93acdfb7f1f1 100644 --- a/scene/3d/remote_transform_3d.cpp +++ b/scene/3d/remote_transform_3d.cpp @@ -147,7 +147,7 @@ void RemoteTransform3D::set_remote_node(const NodePath &p_remote_node) { _update_remote(); } - update_configuration_warnings(); + update_configuration_info(); } NodePath RemoteTransform3D::get_remote_node() const { @@ -210,15 +210,19 @@ void RemoteTransform3D::force_update_cache() { _update_cache(); } -PackedStringArray RemoteTransform3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector RemoteTransform3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (!has_node(remote_node) || !Object::cast_to(get_node(remote_node))) { - warnings.push_back(RTR("The \"Remote Path\" property must point to a valid Node3D or Node3D-derived node to work.")); + CONFIG_WARNING_P( + RTR("Path must point to a valid Node3D or Node3D-derived node to work."), + "remote_path"); } - return warnings; + return infos; } +#endif void RemoteTransform3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_remote_node", "path"), &RemoteTransform3D::set_remote_node); diff --git a/scene/3d/remote_transform_3d.h b/scene/3d/remote_transform_3d.h index 3841821daed2..765bc1860afc 100644 --- a/scene/3d/remote_transform_3d.h +++ b/scene/3d/remote_transform_3d.h @@ -70,7 +70,9 @@ class RemoteTransform3D : public Node3D { void force_update_cache(); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif RemoteTransform3D(); }; diff --git a/scene/3d/skeleton_modifier_3d.cpp b/scene/3d/skeleton_modifier_3d.cpp index d5c603112ea0..2f3c44e3aa14 100644 --- a/scene/3d/skeleton_modifier_3d.cpp +++ b/scene/3d/skeleton_modifier_3d.cpp @@ -34,13 +34,15 @@ void SkeletonModifier3D::_validate_property(PropertyInfo &p_property) const { // } -PackedStringArray SkeletonModifier3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector SkeletonModifier3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (skeleton_id.is_null()) { - warnings.push_back(RTR("Skeleton3D node not set! SkeletonModifier3D must be child of Skeleton3D.")); + CONFIG_WARNING(RTR("Skeleton3D node not set! SkeletonModifier3D must be child of Skeleton3D.")); } - return warnings; + return infos; } +#endif /* Skeleton3D */ @@ -68,7 +70,7 @@ void SkeletonModifier3D::_update_skeleton() { if (old_sk != new_sk) { _skeleton_changed(old_sk, new_sk); } - update_configuration_warnings(); + update_configuration_info(); } void SkeletonModifier3D::_skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new) { diff --git a/scene/3d/skeleton_modifier_3d.h b/scene/3d/skeleton_modifier_3d.h index d00a1e94a99a..d2f658775698 100644 --- a/scene/3d/skeleton_modifier_3d.h +++ b/scene/3d/skeleton_modifier_3d.h @@ -63,7 +63,9 @@ class SkeletonModifier3D : public Node3D { GDVIRTUAL0(_process_modification); public: - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif virtual bool has_process() const { return false; } // Return true if modifier needs to modify bone pose without external animation such as physics, jiggle and etc. void set_active(bool p_active); diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index b0fc94d75f8a..9baf9030a9e0 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -389,15 +389,17 @@ void SoftBody3D::_bind_methods() { BIND_ENUM_CONSTANT(DISABLE_MODE_KEEP_ACTIVE); } -PackedStringArray SoftBody3D::get_configuration_warnings() const { - PackedStringArray warnings = MeshInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector SoftBody3D::get_configuration_info() const { + Vector infos = MeshInstance3D::get_configuration_info(); if (mesh.is_null()) { - warnings.push_back(RTR("This body will be ignored until you set a mesh.")); + CONFIG_WARNING(RTR("This body will be ignored until you set a mesh.")); } - return warnings; + return infos; } +#endif void SoftBody3D::_update_physics_server() { if (!simulation_started) { diff --git a/scene/3d/soft_body_3d.h b/scene/3d/soft_body_3d.h index b01d462d9f1c..5ce995673410 100644 --- a/scene/3d/soft_body_3d.h +++ b/scene/3d/soft_body_3d.h @@ -131,7 +131,9 @@ class SoftBody3D : public MeshInstance3D { static void _bind_compatibility_methods(); #endif - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif public: RID get_physics_rid() const { return physics_rid; } diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 42460eec4cf7..612da3a04393 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1200,7 +1200,7 @@ void AnimatedSprite3D::set_sprite_frames(const Ref &p_frames) { notify_property_list_changed(); _queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); emit_signal("sprite_frames_changed"); } @@ -1432,13 +1432,17 @@ StringName AnimatedSprite3D::get_animation() const { return animation; } -PackedStringArray AnimatedSprite3D::get_configuration_warnings() const { - PackedStringArray warnings = SpriteBase3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector AnimatedSprite3D::get_configuration_info() const { + Vector infos = SpriteBase3D::get_configuration_info(); if (frames.is_null()) { - warnings.push_back(RTR("A SpriteFrames resource must be created or set in the \"Sprite Frames\" property in order for AnimatedSprite3D to display frames.")); + CONFIG_WARNING_P( + RTR("A SpriteFrames resource must be created or set in order for AnimatedSprite3D to display frames."), + "sprite_frames"); } - return warnings; + return infos; } +#endif #ifdef TOOLS_ENABLED void AnimatedSprite3D::get_argument_options(const StringName &p_function, int p_idx, List *r_options) const { diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 8f50a528ccfe..f5c5b25f4054 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -285,7 +285,9 @@ class AnimatedSprite3D : public SpriteBase3D { virtual Rect2 get_item_rect() const override; - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif #ifdef TOOLS_ENABLED virtual void get_argument_options(const StringName &p_function, int p_idx, List *r_options) const override; diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp index a59754c8cc4e..9aed5cee117b 100644 --- a/scene/3d/visual_instance_3d.cpp +++ b/scene/3d/visual_instance_3d.cpp @@ -263,7 +263,7 @@ Ref GeometryInstance3D::get_material_overlay() const { void GeometryInstance3D::set_transparency(float p_transparency) { transparency = CLAMP(p_transparency, 0.0f, 1.0f); RS::get_singleton()->instance_geometry_set_transparency(get_instance(), transparency); - update_configuration_warnings(); + update_configuration_info(); } float GeometryInstance3D::get_transparency() const { @@ -273,7 +273,7 @@ float GeometryInstance3D::get_transparency() const { void GeometryInstance3D::set_visibility_range_begin(float p_dist) { visibility_range_begin = p_dist; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin, (RS::VisibilityRangeFadeMode)visibility_range_fade_mode); - update_configuration_warnings(); + update_configuration_info(); } float GeometryInstance3D::get_visibility_range_begin() const { @@ -283,7 +283,7 @@ float GeometryInstance3D::get_visibility_range_begin() const { void GeometryInstance3D::set_visibility_range_end(float p_dist) { visibility_range_end = p_dist; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin, (RS::VisibilityRangeFadeMode)visibility_range_fade_mode); - update_configuration_warnings(); + update_configuration_info(); } float GeometryInstance3D::get_visibility_range_end() const { @@ -293,7 +293,7 @@ float GeometryInstance3D::get_visibility_range_end() const { void GeometryInstance3D::set_visibility_range_begin_margin(float p_dist) { visibility_range_begin_margin = p_dist; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin, (RS::VisibilityRangeFadeMode)visibility_range_fade_mode); - update_configuration_warnings(); + update_configuration_info(); } float GeometryInstance3D::get_visibility_range_begin_margin() const { @@ -303,7 +303,7 @@ float GeometryInstance3D::get_visibility_range_begin_margin() const { void GeometryInstance3D::set_visibility_range_end_margin(float p_dist) { visibility_range_end_margin = p_dist; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin, (RS::VisibilityRangeFadeMode)visibility_range_fade_mode); - update_configuration_warnings(); + update_configuration_info(); } float GeometryInstance3D::get_visibility_range_end_margin() const { @@ -313,7 +313,7 @@ float GeometryInstance3D::get_visibility_range_end_margin() const { void GeometryInstance3D::set_visibility_range_fade_mode(VisibilityRangeFadeMode p_mode) { visibility_range_fade_mode = p_mode; RS::get_singleton()->instance_geometry_set_visibility_range(get_instance(), visibility_range_begin, visibility_range_end, visibility_range_begin_margin, visibility_range_end_margin, (RS::VisibilityRangeFadeMode)visibility_range_fade_mode); - update_configuration_warnings(); + update_configuration_info(); } GeometryInstance3D::VisibilityRangeFadeMode GeometryInstance3D::get_visibility_range_fade_mode() const { @@ -496,31 +496,33 @@ bool GeometryInstance3D::is_ignoring_occlusion_culling() { return ignore_occlusion_culling; } -PackedStringArray GeometryInstance3D::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector GeometryInstance3D::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); if (!Math::is_zero_approx(visibility_range_end) && visibility_range_end <= visibility_range_begin) { - warnings.push_back(RTR("The GeometryInstance3D visibility range's End distance is set to a non-zero value, but is lower than the Begin distance.\nThis means the GeometryInstance3D will never be visible.\nTo resolve this, set the End distance to 0 or to a value greater than the Begin distance.")); + CONFIG_WARNING(RTR("The GeometryInstance3D visibility range's End distance is set to a non-zero value, but is lower than the Begin distance.\nThis means the GeometryInstance3D will never be visible.\nTo resolve this, set the End distance to 0 or to a value greater than the Begin distance.")); } if ((visibility_range_fade_mode == VISIBILITY_RANGE_FADE_SELF || visibility_range_fade_mode == VISIBILITY_RANGE_FADE_DEPENDENCIES) && !Math::is_zero_approx(visibility_range_begin) && Math::is_zero_approx(visibility_range_begin_margin)) { - warnings.push_back(RTR("The GeometryInstance3D is configured to fade in smoothly over distance, but the fade transition distance is set to 0.\nTo resolve this, increase Visibility Range Begin Margin above 0.")); + CONFIG_WARNING(RTR("The GeometryInstance3D is configured to fade in smoothly over distance, but the fade transition distance is set to 0.\nTo resolve this, increase Visibility Range Begin Margin above 0.")); } if ((visibility_range_fade_mode == VISIBILITY_RANGE_FADE_SELF || visibility_range_fade_mode == VISIBILITY_RANGE_FADE_DEPENDENCIES) && !Math::is_zero_approx(visibility_range_end) && Math::is_zero_approx(visibility_range_end_margin)) { - warnings.push_back(RTR("The GeometryInstance3D is configured to fade out smoothly over distance, but the fade transition distance is set to 0.\nTo resolve this, increase Visibility Range End Margin above 0.")); + CONFIG_WARNING(RTR("The GeometryInstance3D is configured to fade out smoothly over distance, but the fade transition distance is set to 0.\nTo resolve this, increase Visibility Range End Margin above 0.")); } if (!Math::is_zero_approx(transparency) && OS::get_singleton()->get_current_rendering_method() != "forward_plus") { - warnings.push_back(RTR("GeometryInstance3D transparency is only available when using the Forward+ rendering method.")); + CONFIG_WARNING(RTR("GeometryInstance3D transparency is only available when using the Forward+ rendering method.")); } if ((visibility_range_fade_mode == VISIBILITY_RANGE_FADE_SELF || visibility_range_fade_mode == VISIBILITY_RANGE_FADE_DEPENDENCIES) && OS::get_singleton()->get_current_rendering_method() != "forward_plus") { - warnings.push_back(RTR("GeometryInstance3D visibility range transparency fade is only available when using the Forward+ rendering method.")); + CONFIG_WARNING_P(RTR("GeometryInstance3D visibility range transparency fade is only available when using the Forward+ rendering method."), "visibility_range_fade_mode"); } - return warnings; + return infos; } +#endif void GeometryInstance3D::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "sorting_offset" || p_property.name == "sorting_use_aabb_center") { diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h index 9b02c928b7ac..c063f3d10fcb 100644 --- a/scene/3d/visual_instance_3d.h +++ b/scene/3d/visual_instance_3d.h @@ -197,7 +197,9 @@ class GeometryInstance3D : public VisualInstance3D { void set_ignore_occlusion_culling(bool p_enabled); bool is_ignoring_occlusion_culling(); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif GeometryInstance3D(); virtual ~GeometryInstance3D(); }; diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp index 80ff176a98d0..a1059bf0cde0 100644 --- a/scene/3d/voxel_gi.cpp +++ b/scene/3d/voxel_gi.cpp @@ -517,16 +517,18 @@ AABB VoxelGI::get_aabb() const { return AABB(-size / 2, size); } -PackedStringArray VoxelGI::get_configuration_warnings() const { - PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector VoxelGI::get_configuration_info() const { + Vector infos = VisualInstance3D::get_configuration_info(); if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { - warnings.push_back(RTR("VoxelGI nodes are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + CONFIG_WARNING(RTR("VoxelGI nodes are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); } else if (probe_data.is_null()) { - warnings.push_back(RTR("No VoxelGI data set, so this node is disabled. Bake static objects to enable GI.")); + CONFIG_WARNING(RTR("No VoxelGI data set, so this node is disabled. Bake static objects to enable GI.")); } - return warnings; + return infos; } +#endif void VoxelGI::_bind_methods() { ClassDB::bind_method(D_METHOD("set_probe_data", "data"), &VoxelGI::set_probe_data); diff --git a/scene/3d/voxel_gi.h b/scene/3d/voxel_gi.h index 7d7787f72129..a975b7da29cc 100644 --- a/scene/3d/voxel_gi.h +++ b/scene/3d/voxel_gi.h @@ -163,7 +163,9 @@ class VoxelGI : public VisualInstance3D { virtual AABB get_aabb() const override; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif VoxelGI(); ~VoxelGI(); diff --git a/scene/3d/world_environment.cpp b/scene/3d/world_environment.cpp index 82b7c160a4cc..1efc7a292a23 100644 --- a/scene/3d/world_environment.cpp +++ b/scene/3d/world_environment.cpp @@ -81,7 +81,7 @@ void WorldEnvironment::_update_current_environment() { } else { get_viewport()->find_world_3d()->set_environment(Ref()); } - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), "update_configuration_warnings"); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), "update_configuration_info"); } void WorldEnvironment::_update_current_camera_attributes() { @@ -92,7 +92,7 @@ void WorldEnvironment::_update_current_camera_attributes() { get_viewport()->find_world_3d()->set_camera_attributes(Ref()); } - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_world_camera_attributes_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), "update_configuration_warnings"); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_world_camera_attributes_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), "update_configuration_info"); } void WorldEnvironment::_update_current_compositor() { @@ -103,7 +103,7 @@ void WorldEnvironment::_update_current_compositor() { get_viewport()->find_world_3d()->set_compositor(Ref()); } - get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_world_compositor_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), "update_configuration_warnings"); + get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_world_compositor_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), "update_configuration_info"); } void WorldEnvironment::set_environment(const Ref &p_environment) { @@ -123,7 +123,7 @@ void WorldEnvironment::set_environment(const Ref &p_environment) { if (is_inside_tree()) { _update_current_environment(); } else { - update_configuration_warnings(); + update_configuration_info(); } } @@ -148,7 +148,7 @@ void WorldEnvironment::set_camera_attributes(const Ref &p_came if (is_inside_tree()) { _update_current_camera_attributes(); } else { - update_configuration_warnings(); + update_configuration_info(); } } @@ -173,7 +173,7 @@ void WorldEnvironment::set_compositor(const Ref &p_compositor) { if (is_inside_tree()) { _update_current_compositor(); } else { - update_configuration_warnings(); + update_configuration_info(); } } @@ -181,31 +181,33 @@ Ref WorldEnvironment::get_compositor() const { return compositor; } -PackedStringArray WorldEnvironment::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector WorldEnvironment::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (!environment.is_valid() && !camera_attributes.is_valid()) { - warnings.push_back(RTR("To have any visible effect, WorldEnvironment requires its \"Environment\" property to contain an Environment, its \"Camera Attributes\" property to contain a CameraAttributes resource, or both.")); + CONFIG_WARNING(RTR("To have any visible effect, WorldEnvironment requires its \"Environment\" property to contain an Environment, its \"Camera Attributes\" property to contain a CameraAttributes resource, or both.")); } if (!is_inside_tree()) { - return warnings; + return infos; } if (environment.is_valid() && get_viewport()->find_world_3d()->get_environment() != environment) { - warnings.push_back(("Only the first Environment has an effect in a scene (or set of instantiated scenes).")); + CONFIG_WARNING(RTR("Only the first Environment has an effect in a scene (or set of instantiated scenes).")); } if (camera_attributes.is_valid() && get_viewport()->find_world_3d()->get_camera_attributes() != camera_attributes) { - warnings.push_back(RTR("Only one WorldEnvironment is allowed per scene (or set of instantiated scenes).")); + CONFIG_WARNING(RTR("Only one WorldEnvironment is allowed per scene (or set of instantiated scenes).")); } if (compositor.is_valid() && get_viewport()->find_world_3d()->get_compositor() != compositor) { - warnings.push_back(("Only the first Compositor has an effect in a scene (or set of instantiated scenes).")); + CONFIG_WARNING(RTR("Only the first Compositor has an effect in a scene (or set of instantiated scenes).")); } - return warnings; + return infos; } +#endif void WorldEnvironment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_environment", "env"), &WorldEnvironment::set_environment); diff --git a/scene/3d/world_environment.h b/scene/3d/world_environment.h index 53a695d7de4f..3e34389b2073 100644 --- a/scene/3d/world_environment.h +++ b/scene/3d/world_environment.h @@ -61,7 +61,9 @@ class WorldEnvironment : public Node { void set_compositor(const Ref &p_compositor); Ref get_compositor() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif WorldEnvironment(); }; diff --git a/scene/3d/xr_hand_modifier_3d.cpp b/scene/3d/xr_hand_modifier_3d.cpp index 3b533da701f6..09116e90ec59 100644 --- a/scene/3d/xr_hand_modifier_3d.cpp +++ b/scene/3d/xr_hand_modifier_3d.cpp @@ -284,16 +284,18 @@ void XRHandModifier3D::_skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new) { _get_joint_data(); } -PackedStringArray XRHandModifier3D::get_configuration_warnings() const { - PackedStringArray warnings = SkeletonModifier3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector XRHandModifier3D::get_configuration_info() const { + Vector infos = SkeletonModifier3D::get_configuration_info(); // Detect OpenXR without the Hand Tracking extension. if (GLOBAL_GET("xr/openxr/enabled") && !GLOBAL_GET("xr/openxr/extensions/hand_tracking")) { - warnings.push_back("XRHandModifier3D requires the OpenXR Hand Tracking extension to be enabled."); + CONFIG_WARNING("XRHandModifier3D requires the OpenXR Hand Tracking extension to be enabled."); } - return warnings; + return infos; } +#endif void XRHandModifier3D::_notification(int p_what) { switch (p_what) { diff --git a/scene/3d/xr_hand_modifier_3d.h b/scene/3d/xr_hand_modifier_3d.h index d58ccd0adfe2..87a61250a4b3 100644 --- a/scene/3d/xr_hand_modifier_3d.h +++ b/scene/3d/xr_hand_modifier_3d.h @@ -55,7 +55,9 @@ class XRHandModifier3D : public SkeletonModifier3D { void set_bone_update(BoneUpdate p_bone_update); BoneUpdate get_bone_update() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void _notification(int p_what); diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index 214c1f77ca7f..02f2e639ed91 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -76,20 +76,22 @@ void XRCamera3D::_pose_changed(const Ref &p_pose) { } } -PackedStringArray XRCamera3D::get_configuration_warnings() const { - PackedStringArray warnings = Camera3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector XRCamera3D::get_configuration_info() const { + Vector infos = Camera3D::get_configuration_info(); if (is_visible() && is_inside_tree()) { // Warn if the node has a parent which isn't an XROrigin3D! Node *parent = get_parent(); XROrigin3D *origin = Object::cast_to(parent); if (parent && origin == nullptr) { - warnings.push_back(RTR("XRCamera3D may not function as expected without an XROrigin3D node as its parent.")); + CONFIG_WARNING(RTR("XRCamera3D may not function as expected without an XROrigin3D node as its parent.")); }; } - return warnings; -}; + return infos; +} +#endif Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const { // get our XRServer @@ -279,7 +281,7 @@ void XRNode3D::set_tracker(const StringName &p_tracker_name) { // see if it's already available _bind_tracker(); - update_configuration_warnings(); + update_configuration_info(); notify_property_list_changed(); } @@ -460,28 +462,30 @@ XRNode3D::~XRNode3D() { xr_server->disconnect("tracker_removed", callable_mp(this, &XRNode3D::_removed_tracker)); } -PackedStringArray XRNode3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector XRNode3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (is_visible() && is_inside_tree()) { // Warn if the node has a parent which isn't an XROrigin3D! Node *parent = get_parent(); XROrigin3D *origin = Object::cast_to(parent); if (parent && origin == nullptr) { - warnings.push_back(RTR("XRNode3D may not function as expected without an XROrigin3D node as its parent.")); + CONFIG_WARNING(RTR("XRNode3D may not function as expected without an XROrigin3D node as its parent.")); }; if (tracker_name == "") { - warnings.push_back(RTR("No tracker name is set.")); + CONFIG_WARNING(RTR("No tracker name is set.")); } if (pose_name == "") { - warnings.push_back(RTR("No pose is set.")); + CONFIG_WARNING(RTR("No pose is set.")); } } - return warnings; + return infos; } +#endif //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -643,8 +647,9 @@ Plane XRAnchor3D::get_plane() const { Vector XROrigin3D::origin_nodes; -PackedStringArray XROrigin3D::get_configuration_warnings() const { - PackedStringArray warnings = Node3D::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector XROrigin3D::get_configuration_info() const { + Vector infos = Node3D::get_configuration_info(); if (is_visible() && is_inside_tree()) { bool has_camera = false; @@ -657,17 +662,18 @@ PackedStringArray XROrigin3D::get_configuration_warnings() const { } if (!has_camera) { - warnings.push_back(RTR("XROrigin3D requires an XRCamera3D child node.")); + CONFIG_WARNING(RTR("XROrigin3D requires an XRCamera3D child node.")); } } bool xr_enabled = GLOBAL_GET("xr/shaders/enabled"); if (!xr_enabled) { - warnings.push_back(RTR("XR shaders are not enabled in project settings. Stereoscopic output is not supported unless they are enabled. Please enable `xr/shaders/enabled` to use stereoscopic output.")); + CONFIG_WARNING(RTR("XR shaders are not enabled in project settings. Stereoscopic output is not supported unless they are enabled. Please enable `xr/shaders/enabled` to use stereoscopic output.")); } - return warnings; + return infos; } +#endif void XROrigin3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_world_scale", "world_scale"), &XROrigin3D::set_world_scale); diff --git a/scene/3d/xr_nodes.h b/scene/3d/xr_nodes.h index 94c3923433fe..4c2e8cf26698 100644 --- a/scene/3d/xr_nodes.h +++ b/scene/3d/xr_nodes.h @@ -55,7 +55,9 @@ class XRCamera3D : public Camera3D { void _pose_changed(const Ref &p_pose); public: - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const override; virtual Point2 unproject_position(const Vector3 &p_pos) const override; @@ -115,7 +117,9 @@ class XRNode3D : public Node3D { Ref get_pose(); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif XRNode3D(); ~XRNode3D(); @@ -200,7 +204,9 @@ class XROrigin3D : public Node3D { static void _bind_methods(); public: - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif real_t get_world_scale() const; void set_world_scale(real_t p_world_scale); diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 19080e61dec5..4088282bb8ad 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -596,7 +596,7 @@ void AnimationTree::set_root_animation_node(const Ref &p_anim properties_dirty = true; - update_configuration_warnings(); + update_configuration_info(); } Ref AnimationTree::get_root_animation_node() const { @@ -680,13 +680,15 @@ uint64_t AnimationTree::get_last_process_pass() const { return process_pass; } -PackedStringArray AnimationTree::get_configuration_warnings() const { - PackedStringArray warnings = AnimationMixer::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector AnimationTree::get_configuration_info() const { + Vector infos = AnimationMixer::get_configuration_info(); if (!root_animation_node.is_valid()) { - warnings.push_back(RTR("No root AnimationNode for the graph is set.")); + CONFIG_WARNING(RTR("No root AnimationNode for the graph is set.")); } - return warnings; + return infos; } +#endif void AnimationTree::_tree_changed() { if (properties_dirty) { diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index d4b7bf31c9db..47faef0d1dd4 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -307,7 +307,9 @@ class AnimationTree : public AnimationMixer { void set_advance_expression_base_node(const NodePath &p_path); NodePath get_advance_expression_base_node() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif bool is_state_invalid() const; String get_invalid_state_reason() const; diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 34f50954932e..4d16c25ab048 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -294,7 +294,7 @@ void BaseButton::set_toggle_mode(bool p_on) { } toggle_mode = p_on; - update_configuration_warnings(); + update_configuration_info(); } bool BaseButton::is_toggle_mode() const { @@ -430,7 +430,7 @@ void BaseButton::set_button_group(const Ref &p_group) { } queue_redraw(); //checkbox changes to radio if set a buttongroup - update_configuration_warnings(); + update_configuration_info(); } Ref BaseButton::get_button_group() const { @@ -441,15 +441,17 @@ bool BaseButton::_was_pressed_by_mouse() const { return was_mouse_pressed; } -PackedStringArray BaseButton::get_configuration_warnings() const { - PackedStringArray warnings = Control::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector BaseButton::get_configuration_info() const { + Vector infos = Control::get_configuration_info(); if (get_button_group().is_valid() && !is_toggle_mode()) { - warnings.push_back(RTR("ButtonGroup is intended to be used only with buttons that have toggle_mode set to true.")); + CONFIG_WARNING(RTR("ButtonGroup is intended to be used only with buttons that have toggle_mode set to true.")); } - return warnings; + return infos; } +#endif void BaseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed); diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 8405acb21db8..e099ab8c2a74 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -139,7 +139,9 @@ class BaseButton : public Control { void set_button_group(const Ref &p_group); Ref get_button_group() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif BaseButton(); ~BaseButton(); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index e867fceaf269..6bd2d6814013 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -198,15 +198,17 @@ void Container::_notification(int p_what) { } } -PackedStringArray Container::get_configuration_warnings() const { - PackedStringArray warnings = Control::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Container::get_configuration_info() const { + Vector infos = Control::get_configuration_info(); if (get_class() == "Container" && get_script().is_null()) { - warnings.push_back(RTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, use a plain Control node instead.")); + CONFIG_WARNING(RTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, use a plain Control node instead.")); } - return warnings; + return infos; } +#endif void Container::_bind_methods() { ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort); diff --git a/scene/gui/container.h b/scene/gui/container.h index 0561d0d219cf..cc09b338d617 100644 --- a/scene/gui/container.h +++ b/scene/gui/container.h @@ -71,7 +71,9 @@ class Container : public Control { virtual Vector get_allowed_size_flags_horizontal() const; virtual Vector get_allowed_size_flags_vertical() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif Container(); }; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index c1d197ea9b25..377ab0d7c95a 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -241,16 +241,20 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List } #endif -PackedStringArray Control::get_configuration_warnings() const { - ERR_READ_THREAD_GUARD_V(PackedStringArray()); - PackedStringArray warnings = CanvasItem::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Control::get_configuration_info() const { + ERR_READ_THREAD_GUARD_V(Vector()); + Vector infos = CanvasItem::get_configuration_info(); if (data.mouse_filter == MOUSE_FILTER_IGNORE && !data.tooltip.is_empty()) { - warnings.push_back(RTR("The Hint Tooltip won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\".")); + CONFIG_WARNING_P( + RTR("The Tooltip Text won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\"."), + "tooltip_text"); } - return warnings; + return infos; } +#endif bool Control::is_text_field() const { ERR_READ_THREAD_GUARD_V(false); @@ -1662,7 +1666,7 @@ void Control::set_custom_minimum_size(const Size2 &p_custom) { data.custom_minimum_size = p_custom; update_minimum_size(); - update_configuration_warnings(); + update_configuration_info(); } Size2 Control::get_custom_minimum_size() const { @@ -1852,7 +1856,7 @@ void Control::set_mouse_filter(MouseFilter p_filter) { data.mouse_filter = p_filter; notify_property_list_changed(); - update_configuration_warnings(); + update_configuration_info(); if (get_viewport()) { get_viewport()->_gui_update_mouse_over(); @@ -3172,7 +3176,7 @@ Node::AutoTranslateMode Control::get_tooltip_auto_translate_mode() const { void Control::set_tooltip_text(const String &p_hint) { ERR_MAIN_THREAD_GUARD; data.tooltip = p_hint; - update_configuration_warnings(); + update_configuration_info(); } String Control::get_tooltip_text() const { diff --git a/scene/gui/control.h b/scene/gui/control.h index 6e1621ce580b..8e4dc2ace885 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -410,7 +410,9 @@ class Control : public CanvasItem { static void set_root_layout_direction(int p_root_dir); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif #ifdef TOOLS_ENABLED virtual void get_argument_options(const StringName &p_function, int p_idx, List *r_options) const override; #endif diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 646757008a18..524546033d44 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -251,13 +251,15 @@ Control::CursorShape GraphEdit::get_cursor_shape(const Point2 &p_pos) const { return Control::get_cursor_shape(p_pos); } -PackedStringArray GraphEdit::get_configuration_warnings() const { - PackedStringArray warnings = Control::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector GraphEdit::get_configuration_info() const { + Vector infos = Control::get_configuration_info(); - warnings.push_back(RTR("Please be aware that GraphEdit and GraphNode will undergo extensive refactoring in a future 4.x version involving compatibility-breaking API changes.")); + CONFIG_WARNING(RTR("Please be aware that GraphEdit and GraphNode will undergo extensive refactoring in a future 4.x version involving compatibility-breaking API changes.")); - return warnings; + return infos; } +#endif Error GraphEdit::connect_node(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port) { ERR_FAIL_NULL_V_MSG(connections_layer, FAILED, "connections_layer is missing."); diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 20c98c462c49..15ccf18f28dc 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -390,7 +390,9 @@ class GraphEdit : public Control { virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const override; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif // This method has to be public (for undo redo). // TODO: Find a better way to do this. diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 42b4e56b484b..2fe522c0c458 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -45,7 +45,7 @@ void Label::set_autowrap_mode(TextServer::AutowrapMode p_mode) { autowrap_mode = p_mode; lines_dirty = true; queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); if (clip || overrun_behavior != TextServer::OVERRUN_NO_TRIMMING) { update_minimum_size(); @@ -335,8 +335,9 @@ inline void draw_glyph_outline(const Glyph &p_gl, const RID &p_canvas, const Col } } -PackedStringArray Label::get_configuration_warnings() const { - PackedStringArray warnings = Control::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Label::get_configuration_info() const { + Vector infos = Control::get_configuration_info(); // FIXME: This is not ideal and the sizing model should be fixed, // but for now we have to warn about this impossible to resolve combination. @@ -347,7 +348,9 @@ PackedStringArray Label::get_configuration_warnings() const { // and it can be a container, but that makes no difference to the user. Container *parent_container = Object::cast_to(get_parent_control()); if (parent_container && autowrap_mode != TextServer::AUTOWRAP_OFF && get_custom_minimum_size() == Size2()) { - warnings.push_back(RTR("Labels with autowrapping enabled must have a custom minimum size configured to work correctly inside a container.")); + CONFIG_WARNING_P( + RTR("Labels with autowrapping enabled must have a custom minimum size configured to work correctly inside a container."), + "autowrap_mode"); } } @@ -369,14 +372,17 @@ PackedStringArray Label::get_configuration_warnings() const { int64_t glyph_count = TS->shaped_text_get_glyph_count(text_rid); for (int64_t i = 0; i < glyph_count; i++) { if (glyph[i].font_rid == RID()) { - warnings.push_back(RTR("The current font does not support rendering one or more characters used in this Label's text.")); + CONFIG_WARNING_P( + RTR("The current font does not support rendering one or more characters used in this Label's text."), + "text"); break; } } } - return warnings; + return infos; } +#endif void Label::_notification(int p_what) { switch (p_what) { @@ -392,7 +398,7 @@ void Label::_notification(int p_what) { dirty = true; queue_redraw(); - update_configuration_warnings(); + update_configuration_info(); } break; case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { @@ -874,7 +880,7 @@ void Label::set_text(const String &p_string) { } queue_redraw(); update_minimum_size(); - update_configuration_warnings(); + update_configuration_info(); } void Label::_invalidate() { diff --git a/scene/gui/label.h b/scene/gui/label.h index e0ebca944ab3..21e6c0aea53d 100644 --- a/scene/gui/label.h +++ b/scene/gui/label.h @@ -104,7 +104,9 @@ class Label : public Control { public: virtual Size2 get_minimum_size() const override; - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif void set_horizontal_alignment(HorizontalAlignment p_alignment); HorizontalAlignment get_horizontal_alignment() const; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 99678051346a..57b8ef790298 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2529,14 +2529,6 @@ void LineEdit::_emit_text_change() { text_changed_dirty = false; } -PackedStringArray LineEdit::get_configuration_warnings() const { - PackedStringArray warnings = Control::get_configuration_warnings(); - if (secret_character.length() > 1) { - warnings.push_back("Secret Character property supports only one character. Extra characters will be ignored."); - } - return warnings; -} - void LineEdit::_shape() { const Ref &font = theme_cache.font; int font_size = theme_cache.font_size; diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 9253dd871197..b086aa7a9d2d 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -398,8 +398,6 @@ class LineEdit : public Control { virtual bool is_text_field() const override; - PackedStringArray get_configuration_warnings() const override; - void show_virtual_keyboard(); LineEdit(const String &p_placeholder = String()); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index d7b1a4933d02..8bd2914fc236 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -30,15 +30,17 @@ #include "range.h" -PackedStringArray Range::get_configuration_warnings() const { - PackedStringArray warnings = Control::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Range::get_configuration_info() const { + Vector infos = Control::get_configuration_info(); if (shared->exp_ratio && shared->min <= 0) { - warnings.push_back(RTR("If \"Exp Edit\" is enabled, \"Min Value\" must be greater than 0.")); + CONFIG_WARNING(RTR("If \"Exp Edit\" is enabled, \"Min Value\" must be greater than 0.")); } - return warnings; + return infos; } +#endif void Range::_value_changed(double p_value) { GDVIRTUAL_CALL(_value_changed, p_value); @@ -142,7 +144,7 @@ void Range::set_min(double p_min) { shared->emit_changed("min"); - update_configuration_warnings(); + update_configuration_info(); } void Range::set_max(double p_max) { @@ -350,7 +352,7 @@ void Range::set_exp_ratio(bool p_enable) { shared->exp_ratio = p_enable; - update_configuration_warnings(); + update_configuration_info(); } bool Range::is_ratio_exp() const { diff --git a/scene/gui/range.h b/scene/gui/range.h index b1c2446deda3..2e0905f66566 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -103,7 +103,9 @@ class Range : public Control { void share(Range *p_range); void unshare(); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif Range(); ~Range(); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 1ac0e8b59fa1..fea37cf41970 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -541,8 +541,9 @@ void ScrollContainer::set_follow_focus(bool p_follow) { follow_focus = p_follow; } -PackedStringArray ScrollContainer::get_configuration_warnings() const { - PackedStringArray warnings = Container::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector ScrollContainer::get_configuration_info() const { + Vector infos = Container::get_configuration_info(); int found = 0; @@ -559,11 +560,12 @@ PackedStringArray ScrollContainer::get_configuration_warnings() const { } if (found != 1) { - warnings.push_back(RTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually.")); + CONFIG_WARNING(RTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually.")); } - return warnings; + return infos; } +#endif HScrollBar *ScrollContainer::get_h_scroll_bar() { return h_scroll; diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h index afd3c8bd57a7..47ee684bebe4 100644 --- a/scene/gui/scroll_container.h +++ b/scene/gui/scroll_container.h @@ -123,7 +123,9 @@ class ScrollContainer : public Container { VScrollBar *get_v_scroll_bar(); void ensure_control_visible(Control *p_control); - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif ScrollContainer(); }; diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp index a443ae9abfa6..ea50705e0393 100644 --- a/scene/gui/subviewport_container.cpp +++ b/scene/gui/subviewport_container.cpp @@ -258,8 +258,9 @@ void SubViewportContainer::remove_child_notify(Node *p_child) { } } -PackedStringArray SubViewportContainer::get_configuration_warnings() const { - PackedStringArray warnings = Container::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector SubViewportContainer::get_configuration_info() const { + Vector infos = Container::get_configuration_info(); bool has_viewport = false; for (int i = 0; i < get_child_count(); i++) { @@ -269,15 +270,16 @@ PackedStringArray SubViewportContainer::get_configuration_warnings() const { } } if (!has_viewport) { - warnings.push_back(RTR("This node doesn't have a SubViewport as child, so it can't display its intended content.\nConsider adding a SubViewport as a child to provide something displayable.")); + CONFIG_WARNING(RTR("This node doesn't have a SubViewport as child, so it can't display its intended content.\nConsider adding a SubViewport as a child to provide something displayable.")); } if (get_default_cursor_shape() != Control::CURSOR_ARROW) { - warnings.push_back(RTR("The default mouse cursor shape of SubViewportContainer has no effect.\nConsider leaving it at its initial value `CURSOR_ARROW`.")); + CONFIG_WARNING(RTR("The default mouse cursor shape of SubViewportContainer has no effect.\nConsider leaving it at its initial value `CURSOR_ARROW`.")); } - return warnings; + return infos; } +#endif void SubViewportContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_stretch", "enable"), &SubViewportContainer::set_stretch); diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h index 06420de7303b..e1440947065a 100644 --- a/scene/gui/subviewport_container.h +++ b/scene/gui/subviewport_container.h @@ -68,7 +68,9 @@ class SubViewportContainer : public Container { virtual Vector get_allowed_size_flags_horizontal() const override; virtual Vector get_allowed_size_flags_vertical() const override; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif SubViewportContainer(); }; diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index c0386b056f76..90cc62229a6d 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -564,7 +564,6 @@ void CanvasItem::set_z_index(int p_z) { ERR_FAIL_COND(p_z > RS::CANVAS_ITEM_Z_MAX); z_index = p_z; RS::get_singleton()->canvas_item_set_z_index(canvas_item, z_index); - update_configuration_warnings(); } void CanvasItem::set_z_as_relative(bool p_enabled) { diff --git a/scene/main/missing_node.cpp b/scene/main/missing_node.cpp index 83672ae5e01e..8ad0c7b24187 100644 --- a/scene/main/missing_node.cpp +++ b/scene/main/missing_node.cpp @@ -82,20 +82,21 @@ bool MissingNode::is_recording_properties() const { return recording_properties; } -PackedStringArray MissingNode::get_configuration_warnings() const { - // The mere existence of this node is warning. - PackedStringArray ret; +#ifdef TOOLS_ENABLED +Vector MissingNode::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (!original_scene.is_empty()) { - ret.push_back(vformat(RTR("This node was an instance of scene '%s', which was no longer available when this scene was loaded."), original_scene)); - ret.push_back(vformat(RTR("Saving current scene will discard instance and all its properties, including editable children edits (if existing)."))); + CONFIG_WARNING(vformat(RTR("This node was an instance of scene '%s', which was no longer available when this scene was loaded."), original_scene)); + CONFIG_WARNING(vformat(RTR("Saving current scene will discard instance and all its properties, including editable children edits (if existing)."))); } else if (!original_class.is_empty()) { - ret.push_back(vformat(RTR("This node was saved as class type '%s', which was no longer available when this scene was loaded."), original_class)); - ret.push_back(RTR("Data from the original node is kept as a placeholder until this type of node is available again. It can hence be safely re-saved without risk of data loss.")); + CONFIG_WARNING(vformat(RTR("This node was saved as class type '%s', which was no longer available when this scene was loaded."), original_class)); + CONFIG_WARNING(RTR("Data from the original node is kept as a placeholder until this type of node is available again. It can hence be safely re-saved without risk of data loss.")); } else { - ret.push_back(RTR("Unrecognized missing node. Check scene dependency errors for details.")); + CONFIG_WARNING(RTR("Unrecognized missing node. Check scene dependency errors for details.")); } - return ret; + return infos; } +#endif void MissingNode::_bind_methods() { ClassDB::bind_method(D_METHOD("set_original_class", "name"), &MissingNode::set_original_class); diff --git a/scene/main/missing_node.h b/scene/main/missing_node.h index fb1c957988b5..153e918dce9d 100644 --- a/scene/main/missing_node.h +++ b/scene/main/missing_node.h @@ -59,7 +59,9 @@ class MissingNode : public Node { void set_recording_properties(bool p_enable); bool is_recording_properties() const; - virtual PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + virtual Vector get_configuration_info() const override; +#endif MissingNode(); }; diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp index 41e0aa739ee2..7f09fe1194b0 100644 --- a/scene/main/shader_globals_override.cpp +++ b/scene/main/shader_globals_override.cpp @@ -239,7 +239,7 @@ void ShaderGlobalsOverride::_activate() { } } - update_configuration_warnings(); //may have activated + update_configuration_info(); } } } @@ -270,15 +270,17 @@ void ShaderGlobalsOverride::_notification(int p_what) { } } -PackedStringArray ShaderGlobalsOverride::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector ShaderGlobalsOverride::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (!active) { - warnings.push_back(RTR("ShaderGlobalsOverride is not active because another node of the same type is in the scene.")); + CONFIG_WARNING(RTR("ShaderGlobalsOverride is not active because another node of the same type is in the scene.")); } - return warnings; + return infos; } +#endif void ShaderGlobalsOverride::_bind_methods() { ClassDB::bind_method(D_METHOD("_activate"), &ShaderGlobalsOverride::_activate); diff --git a/scene/main/shader_globals_override.h b/scene/main/shader_globals_override.h index d8557ecf6a1e..86398bf5c0d2 100644 --- a/scene/main/shader_globals_override.h +++ b/scene/main/shader_globals_override.h @@ -58,7 +58,9 @@ class ShaderGlobalsOverride : public Node { static void _bind_methods(); public: - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif ShaderGlobalsOverride(); }; diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index 0f4f18b495ea..6182f11a1eac 100644 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -82,7 +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(); + update_configuration_info(); } double Timer::get_wait_time() const { @@ -180,15 +180,19 @@ void Timer::_set_process(bool p_process, bool p_force) { processing = p_process; } -PackedStringArray Timer::get_configuration_warnings() const { - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Timer::get_configuration_info() const { + Vector infos = Node::get_configuration_info(); if (wait_time < 0.05 - CMP_EPSILON) { - warnings.push_back(RTR("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.")); + CONFIG_WARNING_P( + RTR("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."), + "wait_time"); } - return warnings; + return infos; } +#endif void Timer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_wait_time", "time_sec"), &Timer::set_wait_time); diff --git a/scene/main/timer.h b/scene/main/timer.h index d16e49793ddd..590b6e7186e2 100644 --- a/scene/main/timer.h +++ b/scene/main/timer.h @@ -73,7 +73,9 @@ class Timer : public Node { double get_time_left() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_timer_process_callback(TimerProcessCallback p_callback); TimerProcessCallback get_timer_process_callback() const; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 169a5dcb0149..ead0db848fd2 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1019,7 +1019,7 @@ bool Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override, #endif _update_global_transform(); - update_configuration_warnings(); + update_configuration_info(); update_canvas_items(); @@ -3316,15 +3316,17 @@ Variant Viewport::gui_get_drag_data() const { return get_section_root_viewport()->gui.drag_data; } -PackedStringArray Viewport::get_configuration_warnings() const { - ERR_MAIN_THREAD_GUARD_V(PackedStringArray()); - PackedStringArray warnings = Node::get_configuration_warnings(); +#ifdef TOOLS_ENABLED +Vector Viewport::get_configuration_info() const { + ERR_MAIN_THREAD_GUARD_V(Vector()); + Vector infos = Node::get_configuration_info(); if (size.x <= 1 || size.y <= 1) { - warnings.push_back(RTR("The Viewport size must be greater than or equal to 2 pixels on both dimensions to render anything.")); + CONFIG_WARNING_P(RTR("The Viewport size must be greater than or equal to 2 pixels on both dimensions to render anything."), "size"); } - return warnings; + return infos; } +#endif void Viewport::gui_reset_canvas_sort_index() { ERR_MAIN_THREAD_GUARD; diff --git a/scene/main/viewport.h b/scene/main/viewport.h index a18dc1f6f0f3..bebd3c4dccf8 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -600,7 +600,9 @@ class Viewport : public Node { Control *gui_get_focus_owner() const; Control *gui_get_hovered_control() const; - PackedStringArray get_configuration_warnings() const override; +#ifdef TOOLS_ENABLED + Vector get_configuration_info() const override; +#endif void set_debug_draw(DebugDraw p_debug_draw); DebugDraw get_debug_draw() const;