diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/node_3d_editor_gizmos.cpp | 15 | ||||
-rw-r--r-- | editor/node_3d_editor_gizmos.h | 5 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 3 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 11 |
4 files changed, 27 insertions, 7 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) { diff --git a/editor/node_3d_editor_gizmos.h b/editor/node_3d_editor_gizmos.h index 8bc52b6ba9..6432feeecb 100644 --- a/editor/node_3d_editor_gizmos.h +++ b/editor/node_3d_editor_gizmos.h @@ -409,6 +409,11 @@ class Joint3DGizmoPlugin : public EditorNode3DGizmoPlugin { GDCLASS(Joint3DGizmoPlugin, EditorNode3DGizmoPlugin); + Timer *update_timer; + uint64_t update_idx = 0; + + void incremental_update_gizmos(); + public: bool has_gizmo(Node3D *p_spatial); String get_name() const; diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 1a998a45f0..71da14ae1a 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -856,12 +856,11 @@ public: static const int HIDDEN = 1; static const int ON_TOP = 2; -private: +protected: int current_state; List<EditorNode3DGizmo *> current_gizmos; HashMap<String, Vector<Ref<StandardMaterial3D>>> materials; -protected: static void _bind_methods(); virtual bool has_gizmo(Node3D *p_spatial); virtual Ref<EditorNode3DGizmo> create_gizmo(Node3D *p_spatial); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index ce421ac0a5..9e88cd8889 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -57,17 +57,18 @@ void TileMapEditor::_notification(int p_what) { } break; + case NOTIFICATION_ENTER_TREE: { + + get_tree()->connect("node_removed", callable_mp(this, &TileMapEditor::_node_removed)); + [[fallthrough]]; + } + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (is_visible_in_tree()) { _update_palette(); } - [[fallthrough]]; - } - case NOTIFICATION_ENTER_TREE: { - - get_tree()->connect("node_removed", callable_mp(this, &TileMapEditor::_node_removed)); paint_button->set_icon(get_theme_icon("Edit", "EditorIcons")); bucket_fill_button->set_icon(get_theme_icon("Bucket", "EditorIcons")); picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons")); |