diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/collision_polygon_3d.cpp | 14 | ||||
-rw-r--r-- | scene/3d/collision_shape_3d.cpp | 19 | ||||
-rw-r--r-- | scene/3d/cpu_particles_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 9 | ||||
-rw-r--r-- | scene/3d/gpu_particles_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/light_3d.cpp | 7 | ||||
-rw-r--r-- | scene/3d/navigation_agent_3d.cpp | 9 | ||||
-rw-r--r-- | scene/3d/navigation_obstacle_3d.cpp | 9 | ||||
-rw-r--r-- | scene/3d/navigation_region_3d.cpp | 17 | ||||
-rw-r--r-- | scene/3d/path_3d.cpp | 14 | ||||
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/remote_transform_3d.cpp | 9 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 9 | ||||
-rw-r--r-- | scene/3d/vehicle_body_3d.cpp | 9 | ||||
-rw-r--r-- | scene/3d/world_environment.cpp | 16 | ||||
-rw-r--r-- | scene/3d/xr_nodes.cpp | 46 |
16 files changed, 145 insertions, 48 deletions
diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp index e2d11c740a..b8a4ab74ee 100644 --- a/scene/3d/collision_polygon_3d.cpp +++ b/scene/3d/collision_polygon_3d.cpp @@ -156,15 +156,23 @@ bool CollisionPolygon3D::is_disabled() const { } String CollisionPolygon3D::get_configuration_warning() const { + String warning = Node3D::get_configuration_warning(); + if (!Object::cast_to<CollisionObject3D>(get_parent())) { - return TTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape."); } if (polygon.empty()) { - return TTR("An empty CollisionPolygon3D has no effect on collision."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("An empty CollisionPolygon3D has no effect on collision."); } - return String(); + return warning; } bool CollisionPolygon3D::_is_editable_3d_polygon() const { diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index e7f3f53ca9..6ff0ce6032 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -124,23 +124,34 @@ void CollisionShape3D::resource_changed(RES res) { } String CollisionShape3D::get_configuration_warning() const { + String warning = Node3D::get_configuration_warning(); + if (!Object::cast_to<CollisionObject3D>(get_parent())) { - return TTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape."); } if (!shape.is_valid()) { - return TTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it."); } if (Object::cast_to<RigidBody3D>(get_parent())) { if (Object::cast_to<ConcavePolygonShape3D>(*shape)) { if (Object::cast_to<RigidBody3D>(get_parent())->get_mode() != RigidBody3D::MODE_STATIC) { - return TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."); } } } - return String(); + return warning; } void CollisionShape3D::_bind_methods() { diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index ded83b75ac..c977e0d4aa 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -189,7 +189,7 @@ bool CPUParticles3D::get_fractional_delta() const { } String CPUParticles3D::get_configuration_warning() const { - String warnings; + String warnings = GeometryInstance3D::get_configuration_warning(); bool mesh_found = false; bool anim_material_found = false; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 1b6f9b45b9..ab30d2fec5 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -514,10 +514,15 @@ Vector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { } String GIProbe::get_configuration_warning() const { + String warning = VisualInstance3D::get_configuration_warning(); + if (RenderingServer::get_singleton()->is_low_end()) { - return TTR("GIProbes are not supported by the GLES2 video driver.\nUse a BakedLightmap instead."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("GIProbes are not supported by the GLES2 video driver.\nUse a BakedLightmap instead."); } - return String(); + return warning; } void GIProbe::_bind_methods() { diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 6fa0fc6ecb..da5c99a873 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -232,7 +232,7 @@ String GPUParticles3D::get_configuration_warning() const { return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose."); } - String warnings; + String warnings = GeometryInstance3D::get_configuration_warning(); bool meshes_found = false; bool anim_material_found = false; diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index 2eb12d10fa..46c3f18c38 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -448,7 +448,7 @@ String OmniLight3D::get_configuration_warning() const { String warning = Light3D::get_configuration_warning(); if (!has_shadow() && get_projector().is_valid()) { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } warning += TTR("Projector texture only works with shadows active."); @@ -482,15 +482,14 @@ String SpotLight3D::get_configuration_warning() const { String warning = Light3D::get_configuration_warning(); if (has_shadow() && get_param(PARAM_SPOT_ANGLE) >= 90.0) { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } - warning += TTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows."); } if (!has_shadow() && get_projector().is_valid()) { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } warning += TTR("Projector texture only works with shadows active."); diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index e179261002..422b566867 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -287,11 +287,16 @@ void NavigationAgent3D::_avoidance_done(Vector3 p_new_velocity) { } String NavigationAgent3D::get_configuration_warning() const { + String warning = Node::get_configuration_warning(); + if (!Object::cast_to<Node3D>(get_parent())) { - return TTR("The NavigationAgent3D can be used only under a spatial node."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("The NavigationAgent3D can be used only under a spatial node."); } - return String(); + return warning; } void NavigationAgent3D::update_navigation() { diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp index 69fd5b02fc..adbff06ed6 100644 --- a/scene/3d/navigation_obstacle_3d.cpp +++ b/scene/3d/navigation_obstacle_3d.cpp @@ -113,11 +113,16 @@ Node *NavigationObstacle3D::get_navigation_node() const { } String NavigationObstacle3D::get_configuration_warning() const { + String warning = Node::get_configuration_warning(); + if (!Object::cast_to<Node3D>(get_parent())) { - return TTR("The NavigationObstacle3D only serves to provide collision avoidance to a spatial object."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("The NavigationObstacle3D only serves to provide collision avoidance to a spatial object."); } - return String(); + return warning; } void NavigationObstacle3D::update_agent_shape() { diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 15ed448a65..71bc74f433 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -189,19 +189,26 @@ String NavigationRegion3D::get_configuration_warning() const { return String(); } + String warning = Node3D::get_configuration_warning(); + if (!navmesh.is_valid()) { - return TTR("A NavigationMesh resource must be set or created for this node to work."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("A NavigationMesh resource must be set or created for this node to work."); } const Node3D *c = this; while (c) { - if (Object::cast_to<Navigation3D>(c)) { - return String(); - } + if (Object::cast_to<Navigation3D>(c)) + return warning; c = Object::cast_to<Node3D>(c->get_parent()); } - return TTR("NavigationRegion3D must be a child or grandchild to a Navigation3D node. It only provides navigation data."); + if (!warning.empty()) { + warning += "\n\n"; + } + return warning + TTR("NavigationRegion3D must be a child or grandchild to a Navigation3D node. It only provides navigation data."); } void NavigationRegion3D::_bind_methods() { diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp index bf69a8598d..d0d2d6f9f4 100644 --- a/scene/3d/path_3d.cpp +++ b/scene/3d/path_3d.cpp @@ -250,16 +250,24 @@ String PathFollow3D::get_configuration_warning() const { return String(); } + String warning = Node3D::get_configuration_warning(); + if (!Object::cast_to<Path3D>(get_parent())) { - return TTR("PathFollow3D only works when set as a child of a Path3D node."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("PathFollow3D only works when set as a child of a Path3D node."); } else { Path3D *path = Object::cast_to<Path3D>(get_parent()); if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) { - return TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource."); } } - return String(); + return warning; } void PathFollow3D::_bind_methods() { diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index fc021e5532..9a127c5425 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -737,7 +737,7 @@ String RigidBody3D::get_configuration_warning() const { String warning = CollisionObject3D::get_configuration_warning(); if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(2).length() - 1.0) > 0.05)) { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } warning += TTR("Size changes to RigidBody3D (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."); diff --git a/scene/3d/remote_transform_3d.cpp b/scene/3d/remote_transform_3d.cpp index 95fce6b802..358f9346f8 100644 --- a/scene/3d/remote_transform_3d.cpp +++ b/scene/3d/remote_transform_3d.cpp @@ -180,11 +180,16 @@ void RemoteTransform3D::force_update_cache() { } String RemoteTransform3D::get_configuration_warning() const { + String warning = Node3D::get_configuration_warning(); + if (!has_node(remote_node) || !Object::cast_to<Node3D>(get_node(remote_node))) { - return TTR("The \"Remote Path\" property must point to a valid Node3D or Node3D-derived node to work."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("The \"Remote Path\" property must point to a valid Node3D or Node3D-derived node to work."); } - return String(); + return warning; } void RemoteTransform3D::_bind_methods() { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 6e38196ba6..9f4d64cb32 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1074,11 +1074,16 @@ StringName AnimatedSprite3D::get_animation() const { } String AnimatedSprite3D::get_configuration_warning() const { + String warning = SpriteBase3D::get_configuration_warning(); + if (frames.is_null()) { - return TTR("A SpriteFrames resource must be created or set in the \"Frames\" property in order for AnimatedSprite3D to display frames."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("A SpriteFrames resource must be created or set in the \"Frames\" property in order for AnimatedSprite3D to display frames."); } - return String(); + return warning; } void AnimatedSprite3D::_bind_methods() { diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp index 4c71ab470b..b58f313c16 100644 --- a/scene/3d/vehicle_body_3d.cpp +++ b/scene/3d/vehicle_body_3d.cpp @@ -103,11 +103,16 @@ void VehicleWheel3D::_notification(int p_what) { } String VehicleWheel3D::get_configuration_warning() const { + String warning = Node3D::get_configuration_warning(); + if (!Object::cast_to<VehicleBody3D>(get_parent())) { - return TTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D."); } - return String(); + return warning; } void VehicleWheel3D::_update(PhysicsDirectBodyState3D *s) { diff --git a/scene/3d/world_environment.cpp b/scene/3d/world_environment.cpp index 5e73e460ed..3c12d4991e 100644 --- a/scene/3d/world_environment.cpp +++ b/scene/3d/world_environment.cpp @@ -110,22 +110,30 @@ Ref<CameraEffects> WorldEnvironment::get_camera_effects() const { } String WorldEnvironment::get_configuration_warning() const { + String warning = Node::get_configuration_warning(); + if (!environment.is_valid()) { - return TTR("WorldEnvironment requires its \"Environment\" property to contain an Environment to have a visible effect."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("WorldEnvironment requires its \"Environment\" property to contain an Environment to have a visible effect."); } if (!is_inside_tree()) { - return String(); + return warning; } List<Node *> nodes; get_tree()->get_nodes_in_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()), &nodes); if (nodes.size() > 1) { - return TTR("Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."); } - return String(); + return warning; } void WorldEnvironment::_bind_methods() { diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index f4a514cdd6..c0015aa338 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -60,13 +60,18 @@ String XRCamera3D::get_configuration_warning() const { return String(); } + String warning = Camera3D::get_configuration_warning(); + // must be child node of XROrigin3D! XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent()); if (origin == nullptr) { - return TTR("XRCamera3D must have an XROrigin3D node as its parent."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("XRCamera3D must have an XROrigin3D node as its parent."); }; - return String(); + return warning; }; Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const { @@ -362,17 +367,25 @@ String XRController3D::get_configuration_warning() const { return String(); } + String warning = Node3D::get_configuration_warning(); + // must be child node of XROrigin! XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent()); if (origin == nullptr) { - return TTR("XRController3D must have an XROrigin3D node as its parent."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("XRController3D must have an XROrigin3D node as its parent."); }; if (controller_id == 0) { - return TTR("The controller ID must not be 0 or this controller won't be bound to an actual controller."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("The controller ID must not be 0 or this controller won't be bound to an actual controller."); }; - return String(); + return warning; }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -479,17 +492,25 @@ String XRAnchor3D::get_configuration_warning() const { return String(); } + String warning = Node3D::get_configuration_warning(); + // must be child node of XROrigin3D! XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent()); if (origin == nullptr) { - return TTR("XRAnchor3D must have an XROrigin3D node as its parent."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("XRAnchor3D must have an XROrigin3D node as its parent."); }; if (anchor_id == 0) { - return TTR("The anchor ID must not be 0 or this anchor won't be bound to an actual anchor."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("The anchor ID must not be 0 or this anchor won't be bound to an actual anchor."); }; - return String(); + return warning; }; Plane XRAnchor3D::get_plane() const { @@ -512,11 +533,16 @@ String XROrigin3D::get_configuration_warning() const { return String(); } + String warning = Node3D::get_configuration_warning(); + if (tracked_camera == nullptr) { - return TTR("XROrigin3D requires an XRCamera3D child node."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("XROrigin3D requires an XRCamera3D child node."); } - return String(); + return warning; }; void XROrigin3D::_bind_methods() { |