summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-10-31 15:19:48 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-10-31 15:19:48 +0800
commit3ded27c62dcb9624fd037b0825a436b302c64fb5 (patch)
tree64de4c3b18ec6973de6200215dbd390b3300d38e /scene/3d
parent256c0079b0b209669e90a40ebc4cb89453875c5c (diff)
Make Marker3D gizmo resizable
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/marker_3d.cpp19
-rw-r--r--scene/3d/marker_3d.h8
2 files changed, 27 insertions, 0 deletions
diff --git a/scene/3d/marker_3d.cpp b/scene/3d/marker_3d.cpp
index 3987172561..8e5998d14f 100644
--- a/scene/3d/marker_3d.cpp
+++ b/scene/3d/marker_3d.cpp
@@ -30,5 +30,24 @@
#include "marker_3d.h"
+void Marker3D::set_gizmo_extents(real_t p_extents) {
+ if (Math::is_equal_approx(gizmo_extents, p_extents)) {
+ return;
+ }
+ gizmo_extents = p_extents;
+ update_gizmos();
+}
+
+real_t Marker3D::get_gizmo_extents() const {
+ return gizmo_extents;
+}
+
+void Marker3D::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_gizmo_extents", "extents"), &Marker3D::set_gizmo_extents);
+ ClassDB::bind_method(D_METHOD("get_gizmo_extents"), &Marker3D::get_gizmo_extents);
+
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gizmo_extents", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater,suffix:m"), "set_gizmo_extents", "get_gizmo_extents");
+}
+
Marker3D::Marker3D() {
}
diff --git a/scene/3d/marker_3d.h b/scene/3d/marker_3d.h
index 95caa101c5..a9bd993476 100644
--- a/scene/3d/marker_3d.h
+++ b/scene/3d/marker_3d.h
@@ -36,7 +36,15 @@
class Marker3D : public Node3D {
GDCLASS(Marker3D, Node3D);
+ real_t gizmo_extents = 0.25;
+
+protected:
+ static void _bind_methods();
+
public:
+ void set_gizmo_extents(real_t p_extents);
+ real_t get_gizmo_extents() const;
+
Marker3D();
};