summaryrefslogtreecommitdiff
path: root/editor/node_3d_editor_gizmos.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-04-21 23:04:04 +0200
committerGitHub <noreply@github.com>2020-04-21 23:04:04 +0200
commit9a283f7e71ed5ab92fce5bb1f1ef9dbebe0f0140 (patch)
treedb614bebe6df7d536f4bc57cbf4fd8ba59d01f2c /editor/node_3d_editor_gizmos.cpp
parent0912bf110ff4424fdc8606410350dc17491b08b3 (diff)
parent3e77b6d49d47e837dbdf50664d2d71e451b7b615 (diff)
Merge pull request #37202 from JFonS/update_joint_gizmos
Update Joint gizmos automatically
Diffstat (limited to 'editor/node_3d_editor_gizmos.cpp')
-rw-r--r--editor/node_3d_editor_gizmos.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp
index 724782ac44..31a8320209 100644
--- a/editor/node_3d_editor_gizmos.cpp
+++ b/editor/node_3d_editor_gizmos.cpp
@@ -4219,6 +4219,21 @@ Joint3DGizmoPlugin::Joint3DGizmoPlugin() {
create_material("joint_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1)));
create_material("joint_body_a_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint_body_a", Color(0.6, 0.8, 1)));
create_material("joint_body_b_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint_body_b", Color(0.6, 0.9, 1)));
+
+ update_timer = memnew(Timer);
+ update_timer->set_name("JointGizmoUpdateTimer");
+ update_timer->set_wait_time(1.0 / 120.0);
+ update_timer->connect("timeout", callable_mp(this, &Joint3DGizmoPlugin::incremental_update_gizmos));
+ update_timer->set_autostart(true);
+ EditorNode::get_singleton()->call_deferred("add_child", update_timer);
+}
+
+void Joint3DGizmoPlugin::incremental_update_gizmos() {
+ if (!current_gizmos.empty()) {
+ update_idx++;
+ update_idx = update_idx % current_gizmos.size();
+ redraw(current_gizmos[update_idx]);
+ }
}
bool Joint3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {