From 8bb305356e708b5caa5590aff30baa99e835cecf Mon Sep 17 00:00:00 2001 From: Micky Date: Sat, 13 Aug 2022 19:09:58 +0200 Subject: Rename Position* nodes to Marker* - Position2D -> Marker2D - Position3D -> Marker3D Also changes their respective file names. --- doc/classes/Marker2D.xml | 16 +++++ doc/classes/Marker3D.xml | 11 +++ doc/classes/Position2D.xml | 16 ----- doc/classes/Position3D.xml | 11 --- editor/icons/Marker2D.svg | 1 + editor/icons/Marker3D.svg | 1 + editor/icons/Position2D.svg | 1 - editor/icons/Position3D.svg | 1 - 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/marker_2d.cpp | 120 +++++++++++++++++++++++++++++++ scene/2d/marker_2d.h | 59 +++++++++++++++ scene/2d/position_2d.cpp | 120 ------------------------------- scene/2d/position_2d.h | 59 --------------- scene/3d/marker_3d.cpp | 34 +++++++++ scene/3d/marker_3d.h | 43 +++++++++++ scene/3d/position_3d.cpp | 34 --------- scene/3d/position_3d.h | 43 ----------- scene/register_scene_types.cpp | 10 +-- 21 files changed, 306 insertions(+), 302 deletions(-) create mode 100644 doc/classes/Marker2D.xml create mode 100644 doc/classes/Marker3D.xml delete mode 100644 doc/classes/Position2D.xml delete mode 100644 doc/classes/Position3D.xml create mode 100644 editor/icons/Marker2D.svg create mode 100644 editor/icons/Marker3D.svg delete mode 100644 editor/icons/Position2D.svg delete mode 100644 editor/icons/Position3D.svg create mode 100644 scene/2d/marker_2d.cpp create mode 100644 scene/2d/marker_2d.h delete mode 100644 scene/2d/position_2d.cpp delete mode 100644 scene/2d/position_2d.h create mode 100644 scene/3d/marker_3d.cpp create mode 100644 scene/3d/marker_3d.h delete mode 100644 scene/3d/position_3d.cpp delete mode 100644 scene/3d/position_3d.h diff --git a/doc/classes/Marker2D.xml b/doc/classes/Marker2D.xml new file mode 100644 index 0000000000..bf90438bf0 --- /dev/null +++ b/doc/classes/Marker2D.xml @@ -0,0 +1,16 @@ + + + + Generic 2D position hint for editing. + + + Generic 2D position hint for editing. It's just like a plain [Node2D], but it displays as a cross in the 2D editor at all times. You can set cross' visual size by using the gizmo in the 2D editor while the node is selected. + + + + + + Size of the gizmo cross that appears in the editor. + + + diff --git a/doc/classes/Marker3D.xml b/doc/classes/Marker3D.xml new file mode 100644 index 0000000000..5ad1cdf513 --- /dev/null +++ b/doc/classes/Marker3D.xml @@ -0,0 +1,11 @@ + + + + Generic 3D position hint for editing. + + + Generic 3D position hint for editing. It's just like a plain [Node3D], but it displays as a cross in the 3D editor at all times. + + + + diff --git a/doc/classes/Position2D.xml b/doc/classes/Position2D.xml deleted file mode 100644 index 754fd1fdf1..0000000000 --- a/doc/classes/Position2D.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - Generic 2D position hint for editing. - - - Generic 2D position hint for editing. It's just like a plain [Node2D], but it displays as a cross in the 2D editor at all times. You can set cross' visual size by using the gizmo in the 2D editor while the node is selected. - - - - - - Size of the gizmo cross that appears in the editor. - - - diff --git a/doc/classes/Position3D.xml b/doc/classes/Position3D.xml deleted file mode 100644 index d91e0fbfdf..0000000000 --- a/doc/classes/Position3D.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Generic 3D position hint for editing. - - - Generic 3D position hint for editing. It's just like a plain [Node3D], but it displays as a cross in the 3D editor at all times. - - - - diff --git a/editor/icons/Marker2D.svg b/editor/icons/Marker2D.svg new file mode 100644 index 0000000000..191f0b2a03 --- /dev/null +++ b/editor/icons/Marker2D.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/Marker3D.svg b/editor/icons/Marker3D.svg new file mode 100644 index 0000000000..894b195589 --- /dev/null +++ b/editor/icons/Marker3D.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/Position2D.svg b/editor/icons/Position2D.svg deleted file mode 100644 index 191f0b2a03..0000000000 --- a/editor/icons/Position2D.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/editor/icons/Position3D.svg b/editor/icons/Position3D.svg deleted file mode 100644 index 894b195589..0000000000 --- a/editor/icons/Position3D.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index e8f143a637..cc2f01b285 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 739bf1b929..7dac1bd360 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 6afc6798d0..2db31090f3 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 6c544e4437..17fb61ad10 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/marker_2d.cpp b/scene/2d/marker_2d.cpp new file mode 100644 index 0000000000..ba1d2ffbfd --- /dev/null +++ b/scene/2d/marker_2d.cpp @@ -0,0 +1,120 @@ +/*************************************************************************/ +/* marker_2d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "marker_2d.h" + +void Marker2D::_draw_cross() { + const real_t extents = get_gizmo_extents(); + + // Add more points to create a "hard stop" in the color gradient. + PackedVector2Array points_x = { + Point2(+extents, 0), + Point2(), + Point2(), + Point2(-extents, 0) + }; + + PackedVector2Array points_y = { + Point2(0, +extents), + Point2(), + Point2(), + Point2(0, -extents) + }; + + // 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 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); + PackedColorArray colors_x = { + color_x, + color_x, + color_x.lerp(Color(0, 0, 0), 0.5), + color_x.lerp(Color(0, 0, 0), 0.5) + }; + draw_multiline_colors(points_x, colors_x); + + const Color color_y = Color(0.53, 0.84, 0.01); + PackedColorArray colors_y = { + color_y, + color_y, + color_y.lerp(Color(0, 0, 0), 0.5), + color_y.lerp(Color(0, 0, 0), 0.5) + }; + draw_multiline_colors(points_y, colors_y); +} + +#ifdef TOOLS_ENABLED +Rect2 Marker2D::_edit_get_rect() const { + real_t extents = get_gizmo_extents(); + return Rect2(Point2(-extents, -extents), Size2(extents * 2, extents * 2)); +} + +bool Marker2D::_edit_use_rect() const { + return false; +} +#endif + +void Marker2D::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + update(); + } break; + + case NOTIFICATION_DRAW: { + if (!is_inside_tree()) { + break; + } + if (Engine::get_singleton()->is_editor_hint()) { + _draw_cross(); + } + } break; + } +} + +void Marker2D::set_gizmo_extents(real_t p_extents) { + gizmo_extents = p_extents; + update(); +} + +real_t Marker2D::get_gizmo_extents() const { + return 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"); +} + +Marker2D::Marker2D() { +} diff --git a/scene/2d/marker_2d.h b/scene/2d/marker_2d.h new file mode 100644 index 0000000000..e287018dfc --- /dev/null +++ b/scene/2d/marker_2d.h @@ -0,0 +1,59 @@ +/*************************************************************************/ +/* marker_2d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef MARKER_2D_H +#define MARKER_2D_H + +#include "scene/2d/node_2d.h" + +class Marker2D : public Node2D { + GDCLASS(Marker2D, Node2D); + + real_t gizmo_extents = 10.0; + + void _draw_cross(); + +protected: + void _notification(int p_what); + static void _bind_methods(); + +public: +#ifdef TOOLS_ENABLED + virtual Rect2 _edit_get_rect() const override; + virtual bool _edit_use_rect() const override; +#endif + + void set_gizmo_extents(real_t p_extents); + real_t get_gizmo_extents() const; + + Marker2D(); +}; + +#endif // MARKER_2D_H diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp deleted file mode 100644 index cfa4d0401e..0000000000 --- a/scene/2d/position_2d.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************/ -/* position_2d.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "position_2d.h" - -void Position2D::_draw_cross() { - const real_t extents = get_gizmo_extents(); - - // Add more points to create a "hard stop" in the color gradient. - PackedVector2Array points_x = { - Point2(+extents, 0), - Point2(), - Point2(), - Point2(-extents, 0) - }; - - PackedVector2Array points_y = { - Point2(0, +extents), - Point2(), - Point2(), - Point2(0, -extents) - }; - - // 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 - // (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); - PackedColorArray colors_x = { - color_x, - color_x, - color_x.lerp(Color(0, 0, 0), 0.5), - color_x.lerp(Color(0, 0, 0), 0.5) - }; - draw_multiline_colors(points_x, colors_x); - - const Color color_y = Color(0.53, 0.84, 0.01); - PackedColorArray colors_y = { - color_y, - color_y, - color_y.lerp(Color(0, 0, 0), 0.5), - color_y.lerp(Color(0, 0, 0), 0.5) - }; - draw_multiline_colors(points_y, colors_y); -} - -#ifdef TOOLS_ENABLED -Rect2 Position2D::_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 { - return false; -} -#endif - -void Position2D::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - update(); - } break; - - case NOTIFICATION_DRAW: { - if (!is_inside_tree()) { - break; - } - if (Engine::get_singleton()->is_editor_hint()) { - _draw_cross(); - } - } break; - } -} - -void Position2D::set_gizmo_extents(real_t p_extents) { - gizmo_extents = p_extents; - update(); -} - -real_t Position2D::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); - - 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() { -} diff --git a/scene/2d/position_2d.h b/scene/2d/position_2d.h deleted file mode 100644 index 99b0266130..0000000000 --- a/scene/2d/position_2d.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************/ -/* position_2d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef POSITION_2D_H -#define POSITION_2D_H - -#include "scene/2d/node_2d.h" - -class Position2D : public Node2D { - GDCLASS(Position2D, Node2D); - - real_t gizmo_extents = 10.0; - - void _draw_cross(); - -protected: - void _notification(int p_what); - static void _bind_methods(); - -public: -#ifdef TOOLS_ENABLED - virtual Rect2 _edit_get_rect() const override; - virtual bool _edit_use_rect() const override; -#endif - - void set_gizmo_extents(real_t p_extents); - real_t get_gizmo_extents() const; - - Position2D(); -}; - -#endif // POSITION_2D_H diff --git a/scene/3d/marker_3d.cpp b/scene/3d/marker_3d.cpp new file mode 100644 index 0000000000..3987172561 --- /dev/null +++ b/scene/3d/marker_3d.cpp @@ -0,0 +1,34 @@ +/*************************************************************************/ +/* marker_3d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "marker_3d.h" + +Marker3D::Marker3D() { +} diff --git a/scene/3d/marker_3d.h b/scene/3d/marker_3d.h new file mode 100644 index 0000000000..95caa101c5 --- /dev/null +++ b/scene/3d/marker_3d.h @@ -0,0 +1,43 @@ +/*************************************************************************/ +/* marker_3d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef MARKER_3D_H +#define MARKER_3D_H + +#include "scene/3d/node_3d.h" + +class Marker3D : public Node3D { + GDCLASS(Marker3D, Node3D); + +public: + Marker3D(); +}; + +#endif // MARKER_3D_H diff --git a/scene/3d/position_3d.cpp b/scene/3d/position_3d.cpp deleted file mode 100644 index 7dc1b1ace0..0000000000 --- a/scene/3d/position_3d.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************/ -/* position_3d.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "position_3d.h" - -Position3D::Position3D() { -} diff --git a/scene/3d/position_3d.h b/scene/3d/position_3d.h deleted file mode 100644 index 5514399e6e..0000000000 --- a/scene/3d/position_3d.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* position_3d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef POSITION_3D_H -#define POSITION_3D_H - -#include "scene/3d/node_3d.h" - -class Position3D : public Node3D { - GDCLASS(Position3D, Node3D); - -public: - Position3D(); -}; - -#endif // POSITION_3D_H diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index a5842106fb..24a79e25b5 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"); -- cgit v1.2.3