Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Add BaseLine3D and mark it as abstract

Qbieshaya11896e6bb09
diff --git a/doc/classes/Line3D.xml b/doc/classes/LineBase3D.xml
similarity index 81%
rename from doc/classes/Line3D.xml
rename to doc/classes/LineBase3D.xml
index 054b9c60f10..1cc91dd5cb3 100644
--- a/doc/classes/Line3D.xml
+++ b/doc/classes/LineBase3D.xml
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Line3D" inherits="GeometryInstance3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+<class name="LineBase3D" inherits="GeometryInstance3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- A node to draw 3D lines in space.
- [b]Note:[/b] This class currently has no functionality and only serves as a base class for [Trail3D].
+ A base class to draw a 3D line in space.
</brief_description>
<description>
</description>
@@ -13,7 +12,7 @@
Align the line normal to the local Y axis of the line node.
</constant>
<constant name="MESH_ALIGNMENT_BILLBOARD" value="1" enum="MeshAlignment">
- Align the normal of each section of the Line3D to face the camera.
+ Align the normal of each section of the LineBase3D to face the camera.
See also [member SpriteBase3D.billboard] and [enum BaseMaterial3D.BillboardMode]
</constant>
<constant name="MESH_ALIGNMENT_MAX" value="2" enum="MeshAlignment">
diff --git a/doc/classes/Trail3D.xml b/doc/classes/Trail3D.xml
index 524951af3cc..ff48f277263 100644
--- a/doc/classes/Trail3D.xml
+++ b/doc/classes/Trail3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Trail3D" inherits="Line3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+<class name="Trail3D" inherits="LineBase3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A node to draw lines behind moving objects.
</brief_description>
@@ -45,7 +45,7 @@
Whether to limit the trail by lifetime or length.
</member>
<member name="material" type="ShaderMaterial" setter="set_material" getter="get_material">
- The material to assign to the trail mesh when [member material_mode] is [constant Line3D.MATERIAL_MODE_CUSTOM].
+ The material to assign to the trail mesh when [member material_mode] is [constant LineBase3D.MATERIAL_MODE_CUSTOM].
[b]Tip:[/b] To preserve billboarding, use the following shader as a base:
[codeblock]
shader_type spatial;
@@ -74,14 +74,14 @@
}
[/codeblock]
</member>
- <member name="material_mode" type="int" setter="set_material_mode" getter="get_material_mode" enum="Line3D.MaterialMode" default="0">
+ <member name="material_mode" type="int" setter="set_material_mode" getter="get_material_mode" enum="LineBase3D.MaterialMode" default="0">
The material mode for the trail.
</member>
<member name="max_length" type="float" setter="set_max_length" getter="get_max_length">
The maximum length of the trail when [member limit_mode] is [constant LIMIT_MODE_MAX_LENGTH].
</member>
- <member name="mesh_alignment" type="int" setter="set_mesh_alignment" getter="get_mesh_alignment" enum="Line3D.MeshAlignment" default="1">
- Alignment of the trail. Possible options are [constant Line3D.MESH_ALIGNMENT_LOCAL] for a 3D line, and [constant Line3D.MESH_ALIGNMENT_BILLBOARD] for a billboarded line.
+ <member name="mesh_alignment" type="int" setter="set_mesh_alignment" getter="get_mesh_alignment" enum="LineBase3D.MeshAlignment" default="1">
+ Alignment of the trail. Possible options are [constant LineBase3D.MESH_ALIGNMENT_LOCAL] for a 3D line, and [constant LineBase3D.MESH_ALIGNMENT_BILLBOARD] for a billboarded line.
</member>
<member name="min_section_length" type="float" setter="set_min_section_length" getter="get_min_section_length" default="0.2">
Minimum required distance before adding a new section.
@@ -89,7 +89,7 @@
<member name="pin_uv" type="bool" setter="set_pin_uv" getter="get_pin_uv" default="false">
If [code]true[/code], pins the UVs to their positions in space.
</member>
- <member name="tiling_mode" type="int" setter="set_tiling_mode" getter="get_tiling_mode" enum="Line3D.TilingMode" default="1">
+ <member name="tiling_mode" type="int" setter="set_tiling_mode" getter="get_tiling_mode" enum="LineBase3D.TilingMode" default="1">
How to tile the UVs across the length of the trail.
</member>
<member name="tiling_multiplier" type="float" setter="set_tiling_multiplier" getter="get_tiling_multiplier" default="1.0">
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index e97359afb51..47b5bc5b095 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -154,9 +154,9 @@ const Vector<String> prop_allowed_inherited_member_hiding = {
// and the need for the 'new' keyword. It can also be used to avoid breaking compat
// later if a new member is added with the same name as the enum.
const Vector<String> enums_with_forced_suffix = {
- "Line3D.MaterialMode",
- "Line3D.MeshAlignment",
- "Line3D.TilingMode",
+ "LineBase3D.MaterialMode",
+ "LineBase3D.MeshAlignment",
+ "LineBase3D.TilingMode",
};
void BindingsGenerator::TypeInterface::postsetup_enum_type(BindingsGenerator::TypeInterface &r_enum_itype) {
diff --git a/scene/3d/line_3d.cpp b/scene/3d/line_base_3d.cpp
similarity index 93%
rename from scene/3d/line_3d.cpp
rename to scene/3d/line_base_3d.cpp
index 6fe7b505a7d..fbb43edc3d3 100644
--- a/scene/3d/line_3d.cpp
+++ b/scene/3d/line_base_3d.cpp
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* line_3d.cpp */
+/* line_base_3d.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,17 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#include "line_3d.h"
+#include "line_base_3d.h"
#include "core/object/class_db.h"
-PackedStringArray Line3D::get_configuration_warnings() const {
+PackedStringArray LineBase3D::get_configuration_warnings() const {
PackedStringArray warnings = VisualInstance3D::get_configuration_warnings();
EXPERIMENTAL_NODE_WARNING;
return warnings;
}
-void Line3D::_bind_methods() {
+void LineBase3D::_bind_methods() {
BIND_ENUM_CONSTANT(MESH_ALIGNMENT_LOCAL);
BIND_ENUM_CONSTANT(MESH_ALIGNMENT_BILLBOARD);
BIND_ENUM_CONSTANT(MESH_ALIGNMENT_MAX);
diff --git a/scene/3d/line_3d.h b/scene/3d/line_base_3d.h
similarity index 90%
rename from scene/3d/line_3d.h
rename to scene/3d/line_base_3d.h
index e271c3339ac..47f34307f71 100644
--- a/scene/3d/line_3d.h
+++ b/scene/3d/line_base_3d.h
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* line_3d.h */
+/* line_base_3d.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -32,8 +32,8 @@
#include "scene/3d/visual_instance_3d.h"
-class Line3D : public GeometryInstance3D {
- GDCLASS(Line3D, GeometryInstance3D);
+class LineBase3D : public GeometryInstance3D {
+ GDCLASS(LineBase3D, GeometryInstance3D);
protected:
static void _bind_methods();
@@ -61,6 +61,6 @@ public:
PackedStringArray get_configuration_warnings() const override;
};
-VARIANT_ENUM_CAST(Line3D::TilingMode)
-VARIANT_ENUM_CAST(Line3D::MeshAlignment)
-VARIANT_ENUM_CAST(Line3D::MaterialMode)
+VARIANT_ENUM_CAST(LineBase3D::TilingMode)
+VARIANT_ENUM_CAST(LineBase3D::MeshAlignment)
+VARIANT_ENUM_CAST(LineBase3D::MaterialMode)
diff --git a/scene/3d/trail_3d.cpp b/scene/3d/trail_3d.cpp
index 6c17cb709c2..53c87495341 100644
--- a/scene/3d/trail_3d.cpp
+++ b/scene/3d/trail_3d.cpp
@@ -884,7 +884,7 @@ void Trail3D::_ensure_material() {
}
PackedStringArray Trail3D::get_configuration_warnings() const {
- PackedStringArray warnings = Line3D::get_configuration_warnings();
+ PackedStringArray warnings = LineBase3D::get_configuration_warnings();
return warnings;
}
diff --git a/scene/3d/trail_3d.h b/scene/3d/trail_3d.h
index 5415c0168c3..e41471136c1 100644
--- a/scene/3d/trail_3d.h
+++ b/scene/3d/trail_3d.h
@@ -30,13 +30,13 @@
#pragma once
-#include "scene/3d/line_3d.h"
+#include "scene/3d/line_base_3d.h"
#include "scene/resources/curve.h"
#include "scene/resources/gradient.h"
#include "scene/resources/mesh.h"
-class Trail3D : public Line3D {
- GDCLASS(Trail3D, Line3D);
+class Trail3D : public LineBase3D {
+ GDCLASS(Trail3D, LineBase3D);
// Lots of code for this node is inspired/ported from
// https://codeberg.org/MajorMcDoom/cozy-cube-godot-addons/src/branch/main
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index a53910c36ec..4aae975ea3d 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -253,7 +253,7 @@
#include "scene/3d/lightmap_gi.h"
#include "scene/3d/lightmap_probe.h"
#include "scene/3d/limit_angular_velocity_modifier_3d.h"
-#include "scene/3d/line_3d.h"
+#include "scene/3d/line_base_3d.h"
#include "scene/3d/look_at_modifier_3d.h"
#include "scene/3d/marker_3d.h"
#include "scene/3d/mesh_instance_3d.h"
@@ -678,7 +678,7 @@ void register_scene_types() {
GDREGISTER_CLASS(LightmapProbe);
GDREGISTER_ABSTRACT_CLASS(Lightmapper);
- GDREGISTER_CLASS(Line3D);
+ GDREGISTER_ABSTRACT_CLASS(LineBase3D);
GDREGISTER_CLASS(Trail3D);
GDREGISTER_CLASS(GPUParticles3D);