From 8bb305356e708b5caa5590aff30baa99e835cecf Mon Sep 17 00:00:00 2001 From: Micky Date: Sat, 13 Aug 2022 19:09:58 +0200 Subject: [PATCH] Rename Position* nodes to Marker* - Position2D -> Marker2D - Position3D -> Marker3D Also changes their respective file names. --- doc/classes/{Position2D.xml => Marker2D.xml} | 2 +- doc/classes/{Position3D.xml => Marker3D.xml} | 2 +- editor/icons/{Position2D.svg => Marker2D.svg} | 0 editor/icons/{Position3D.svg => Marker3D.svg} | 0 editor/plugins/node_3d_editor_gizmos.cpp | 18 ++++++------- editor/plugins/node_3d_editor_gizmos.h | 6 ++--- editor/plugins/node_3d_editor_plugin.cpp | 2 +- editor/project_converter_3_to_4.cpp | 2 ++ scene/2d/{position_2d.cpp => marker_2d.cpp} | 26 +++++++++---------- scene/2d/{position_2d.h => marker_2d.h} | 14 +++++----- scene/3d/{position_3d.cpp => marker_3d.cpp} | 6 ++--- scene/3d/{position_3d.h => marker_3d.h} | 14 +++++----- scene/register_scene_types.cpp | 10 ++++--- 13 files changed, 53 insertions(+), 49 deletions(-) rename doc/classes/{Position2D.xml => Marker2D.xml} (79%) rename doc/classes/{Position3D.xml => Marker3D.xml} (67%) rename editor/icons/{Position2D.svg => Marker2D.svg} (100%) rename editor/icons/{Position3D.svg => Marker3D.svg} (100%) rename scene/2d/{position_2d.cpp => marker_2d.cpp} (86%) rename scene/2d/{position_2d.h => marker_2d.h} (92%) rename scene/3d/{position_3d.cpp => marker_3d.cpp} (94%) rename scene/3d/{position_3d.h => marker_3d.h} (91%) diff --git a/doc/classes/Position2D.xml b/doc/classes/Marker2D.xml similarity index 79% rename from doc/classes/Position2D.xml rename to doc/classes/Marker2D.xml index 754fd1fdf19..bf90438bf02 100644 --- a/doc/classes/Position2D.xml +++ b/doc/classes/Marker2D.xml @@ -1,5 +1,5 @@ - + Generic 2D position hint for editing. diff --git a/doc/classes/Position3D.xml b/doc/classes/Marker3D.xml similarity index 67% rename from doc/classes/Position3D.xml rename to doc/classes/Marker3D.xml index d91e0fbfdfa..5ad1cdf5137 100644 --- a/doc/classes/Position3D.xml +++ b/doc/classes/Marker3D.xml @@ -1,5 +1,5 @@ - + Generic 3D position hint for editing. diff --git a/editor/icons/Position2D.svg b/editor/icons/Marker2D.svg similarity index 100% rename from editor/icons/Position2D.svg rename to editor/icons/Marker2D.svg diff --git a/editor/icons/Position3D.svg b/editor/icons/Marker3D.svg similarity index 100% rename from editor/icons/Position3D.svg rename to editor/icons/Marker3D.svg diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index e8f143a6378..cc2f01b2854 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -51,10 +51,10 @@ #include "scene/3d/light_3d.h" #include "scene/3d/lightmap_gi.h" #include "scene/3d/lightmap_probe.h" +#include "scene/3d/marker_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/navigation_region_3d.h" #include "scene/3d/occluder_instance_3d.h" -#include "scene/3d/position_3d.h" #include "scene/3d/ray_cast_3d.h" #include "scene/3d/reflection_probe.h" #include "scene/3d/shape_cast_3d.h" @@ -2291,7 +2291,7 @@ void Label3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { /// -Position3DGizmoPlugin::Position3DGizmoPlugin() { +Marker3DGizmoPlugin::Marker3DGizmoPlugin() { pos3d_mesh = Ref(memnew(ArrayMesh)); cursor_points = Vector(); @@ -2315,7 +2315,7 @@ Position3DGizmoPlugin::Position3DGizmoPlugin() { // Use the axis color which is brighter for the positive axis. // Use a darkened axis color for the negative axis. - // This makes it possible to see in which direction the Position3D node is rotated + // This makes it possible to see in which direction the Marker3D node is rotated // (which can be important depending on how it's used). const Color color_x = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("axis_x_color"), SNAME("Editor")); cursor_colors.push_back(color_x); @@ -2351,19 +2351,19 @@ Position3DGizmoPlugin::Position3DGizmoPlugin() { pos3d_mesh->surface_set_material(0, mat); } -bool Position3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { - return Object::cast_to(p_spatial) != nullptr; +bool Marker3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to(p_spatial) != nullptr; } -String Position3DGizmoPlugin::get_gizmo_name() const { - return "Position3D"; +String Marker3DGizmoPlugin::get_gizmo_name() const { + return "Marker3D"; } -int Position3DGizmoPlugin::get_priority() const { +int Marker3DGizmoPlugin::get_priority() const { return -1; } -void Position3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void Marker3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->clear(); p_gizmo->add_mesh(pos3d_mesh); p_gizmo->add_collision_segments(cursor_points); diff --git a/editor/plugins/node_3d_editor_gizmos.h b/editor/plugins/node_3d_editor_gizmos.h index 739bf1b9299..7dac1bd360b 100644 --- a/editor/plugins/node_3d_editor_gizmos.h +++ b/editor/plugins/node_3d_editor_gizmos.h @@ -334,8 +334,8 @@ public: Label3DGizmoPlugin(); }; -class Position3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(Position3DGizmoPlugin, EditorNode3DGizmoPlugin); +class Marker3DGizmoPlugin : public EditorNode3DGizmoPlugin { + GDCLASS(Marker3DGizmoPlugin, EditorNode3DGizmoPlugin); Ref pos3d_mesh; Vector cursor_points; @@ -346,7 +346,7 @@ public: int get_priority() const override; void redraw(EditorNode3DGizmo *p_gizmo) override; - Position3DGizmoPlugin(); + Marker3DGizmoPlugin(); }; class PhysicalBone3DGizmoPlugin : public EditorNode3DGizmoPlugin { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 6afc6798d0d..2db31090f3e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -7487,7 +7487,7 @@ void Node3DEditor::_register_all_gizmos() { add_gizmo_plugin(Ref(memnew(SoftDynamicBody3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(Sprite3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(Label3DGizmoPlugin))); - add_gizmo_plugin(Ref(memnew(Position3DGizmoPlugin))); + add_gizmo_plugin(Ref(memnew(Marker3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(RayCast3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(ShapeCast3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(SpringArm3DGizmoPlugin))); diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 6c544e4437b..17fb61ad10e 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -1361,6 +1361,8 @@ static const char *class_renames[][2] = { { "PinJoint", "PinJoint3D" }, { "PlaneShape", "WorldBoundaryShape3D" }, { "PopupDialog", "Popup" }, + { "Position2D", "Marker2D" }, + { "Position3D", "Marker3D" }, { "ProceduralSky", "Sky" }, { "RayCast", "RayCast3D" }, { "RayShape", "SeparationRayShape3D" }, diff --git a/scene/2d/position_2d.cpp b/scene/2d/marker_2d.cpp similarity index 86% rename from scene/2d/position_2d.cpp rename to scene/2d/marker_2d.cpp index cfa4d0401ec..ba1d2ffbfdd 100644 --- a/scene/2d/position_2d.cpp +++ b/scene/2d/marker_2d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* position_2d.cpp */ +/* marker_2d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "position_2d.h" +#include "marker_2d.h" -void Position2D::_draw_cross() { +void Marker2D::_draw_cross() { const real_t extents = get_gizmo_extents(); // Add more points to create a "hard stop" in the color gradient. @@ -50,7 +50,7 @@ void Position2D::_draw_cross() { // Use the axis color which is brighter for the positive axis. // Use a darkened axis color for the negative axis. - // This makes it possible to see in which direction the Position3D node is rotated + // This makes it possible to see in which direction the Marker3D node is rotated // (which can be important depending on how it's used). // Axis colors are taken from `axis_x_color` and `axis_y_color` (defined in `editor/editor_themes.cpp`). const Color color_x = Color(0.96, 0.20, 0.32); @@ -73,17 +73,17 @@ void Position2D::_draw_cross() { } #ifdef TOOLS_ENABLED -Rect2 Position2D::_edit_get_rect() const { +Rect2 Marker2D::_edit_get_rect() const { real_t extents = get_gizmo_extents(); return Rect2(Point2(-extents, -extents), Size2(extents * 2, extents * 2)); } -bool Position2D::_edit_use_rect() const { +bool Marker2D::_edit_use_rect() const { return false; } #endif -void Position2D::_notification(int p_what) { +void Marker2D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { update(); @@ -100,21 +100,21 @@ void Position2D::_notification(int p_what) { } } -void Position2D::set_gizmo_extents(real_t p_extents) { +void Marker2D::set_gizmo_extents(real_t p_extents) { gizmo_extents = p_extents; update(); } -real_t Position2D::get_gizmo_extents() const { +real_t Marker2D::get_gizmo_extents() const { return gizmo_extents; } -void Position2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_gizmo_extents", "extents"), &Position2D::set_gizmo_extents); - ClassDB::bind_method(D_METHOD("get_gizmo_extents"), &Position2D::get_gizmo_extents); +void Marker2D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_gizmo_extents", "extents"), &Marker2D::set_gizmo_extents); + ClassDB::bind_method(D_METHOD("get_gizmo_extents"), &Marker2D::get_gizmo_extents); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gizmo_extents", PROPERTY_HINT_RANGE, "0,1000,0.1,or_greater,suffix:px"), "set_gizmo_extents", "get_gizmo_extents"); } -Position2D::Position2D() { +Marker2D::Marker2D() { } diff --git a/scene/2d/position_2d.h b/scene/2d/marker_2d.h similarity index 92% rename from scene/2d/position_2d.h rename to scene/2d/marker_2d.h index 99b02661300..e287018dfc5 100644 --- a/scene/2d/position_2d.h +++ b/scene/2d/marker_2d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* position_2d.h */ +/* marker_2d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef POSITION_2D_H -#define POSITION_2D_H +#ifndef MARKER_2D_H +#define MARKER_2D_H #include "scene/2d/node_2d.h" -class Position2D : public Node2D { - GDCLASS(Position2D, Node2D); +class Marker2D : public Node2D { + GDCLASS(Marker2D, Node2D); real_t gizmo_extents = 10.0; @@ -53,7 +53,7 @@ public: void set_gizmo_extents(real_t p_extents); real_t get_gizmo_extents() const; - Position2D(); + Marker2D(); }; -#endif // POSITION_2D_H +#endif // MARKER_2D_H diff --git a/scene/3d/position_3d.cpp b/scene/3d/marker_3d.cpp similarity index 94% rename from scene/3d/position_3d.cpp rename to scene/3d/marker_3d.cpp index 7dc1b1ace0d..39871725615 100644 --- a/scene/3d/position_3d.cpp +++ b/scene/3d/marker_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* position_3d.cpp */ +/* marker_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "position_3d.h" +#include "marker_3d.h" -Position3D::Position3D() { +Marker3D::Marker3D() { } diff --git a/scene/3d/position_3d.h b/scene/3d/marker_3d.h similarity index 91% rename from scene/3d/position_3d.h rename to scene/3d/marker_3d.h index 5514399e6e6..95caa101c54 100644 --- a/scene/3d/position_3d.h +++ b/scene/3d/marker_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* position_3d.h */ +/* marker_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,16 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef POSITION_3D_H -#define POSITION_3D_H +#ifndef MARKER_3D_H +#define MARKER_3D_H #include "scene/3d/node_3d.h" -class Position3D : public Node3D { - GDCLASS(Position3D, Node3D); +class Marker3D : public Node3D { + GDCLASS(Marker3D, Node3D); public: - Position3D(); + Marker3D(); }; -#endif // POSITION_3D_H +#endif // MARKER_3D_H diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index a5842106fbd..24a79e25b55 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -50,6 +50,7 @@ #include "scene/2d/light_2d.h" #include "scene/2d/light_occluder_2d.h" #include "scene/2d/line_2d.h" +#include "scene/2d/marker_2d.h" #include "scene/2d/mesh_instance_2d.h" #include "scene/2d/multimesh_instance_2d.h" #include "scene/2d/navigation_agent_2d.h" @@ -60,7 +61,6 @@ #include "scene/2d/physical_bone_2d.h" #include "scene/2d/physics_body_2d.h" #include "scene/2d/polygon_2d.h" -#include "scene/2d/position_2d.h" #include "scene/2d/ray_cast_2d.h" #include "scene/2d/remote_transform_2d.h" #include "scene/2d/shape_cast_2d.h" @@ -231,6 +231,7 @@ #include "scene/3d/light_3d.h" #include "scene/3d/lightmap_gi.h" #include "scene/3d/lightmap_probe.h" +#include "scene/3d/marker_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/multimesh_instance_3d.h" #include "scene/3d/navigation_agent_3d.h" @@ -240,7 +241,6 @@ #include "scene/3d/occluder_instance_3d.h" #include "scene/3d/path_3d.h" #include "scene/3d/physics_body_3d.h" -#include "scene/3d/position_3d.h" #include "scene/3d/ray_cast_3d.h" #include "scene/3d/reflection_probe.h" #include "scene/3d/remote_transform_3d.h" @@ -522,7 +522,7 @@ void register_scene_types() { GDREGISTER_CLASS(GPUParticlesAttractorSphere3D); GDREGISTER_CLASS(GPUParticlesAttractorVectorField3D); GDREGISTER_CLASS(CPUParticles3D); - GDREGISTER_CLASS(Position3D); + GDREGISTER_CLASS(Marker3D); GDREGISTER_CLASS(RootMotionView); OS::get_singleton()->yield(); // may take time to init @@ -694,7 +694,7 @@ void register_scene_types() { GDREGISTER_CLASS(Sprite2D); GDREGISTER_CLASS(SpriteFrames); GDREGISTER_CLASS(AnimatedSprite2D); - GDREGISTER_CLASS(Position2D); + GDREGISTER_CLASS(Marker2D); GDREGISTER_CLASS(Line2D); GDREGISTER_CLASS(MeshInstance2D); GDREGISTER_CLASS(MultiMeshInstance2D); @@ -1036,6 +1036,8 @@ void register_scene_types() { ClassDB::add_compatibility_class("PhysicsShapeQueryParameters", "PhysicsShapeQueryParameters3D"); ClassDB::add_compatibility_class("PinJoint", "PinJoint3D"); ClassDB::add_compatibility_class("PlaneShape", "WorldBoundaryShape3D"); + ClassDB::add_compatibility_class("Position2D", "Marker2D"); + ClassDB::add_compatibility_class("Position3D", "Marker3D"); ClassDB::add_compatibility_class("ProceduralSky", "Sky"); ClassDB::add_compatibility_class("RayCast", "RayCast3D"); ClassDB::add_compatibility_class("RayShape", "SeparationRayShape3D");