diff --git a/src/2d/debug_draw_2d.cpp b/src/2d/debug_draw_2d.cpp index c766ce92..1192270f 100644 --- a/src/2d/debug_draw_2d.cpp +++ b/src/2d/debug_draw_2d.cpp @@ -38,6 +38,7 @@ void DebugDraw2D::_bind_methods() { ClassDB::bind_method(D_METHOD(NAMEOF(begin_text_group), "group_title", "group_priority", "group_color", "show_title", "title_size", "text_size"), &DebugDraw2D::begin_text_group, 0, Colors::empty_color, true, -1, -1); ClassDB::bind_method(D_METHOD(NAMEOF(end_text_group)), &DebugDraw2D::end_text_group); ClassDB::bind_method(D_METHOD(NAMEOF(set_text), "key", "value", "priority", "color_of_value", "duration"), &DebugDraw2D::set_text, Variant(), 0, Colors::empty_color, -1.0); + ClassDB::bind_method(D_METHOD(NAMEOF(clear_texts)), &DebugDraw2D::clear_texts); ClassDB::bind_method(D_METHOD(NAMEOF(create_graph), "title"), &DebugDraw2D::create_graph); ClassDB::bind_method(D_METHOD(NAMEOF(create_fps_graph), "title"), &DebugDraw2D::create_fps_graph); @@ -141,7 +142,8 @@ void DebugDraw2D::_finish_frame_and_update() { // reset some values _canvas_need_update = false; - grouped_text->end_text_group(); + if (grouped_text) + grouped_text->end_text_group(); } else { #ifdef TRACY_ENABLE if (DebugDraw2D_frame_mark_2d_started) { @@ -283,9 +285,10 @@ Ref DebugDraw2D::get_render_stats() { void DebugDraw2D::clear_all() { ZoneScoped; #ifndef DISABLE_DEBUG_RENDERING - if (!grouped_text || !data_graphs) return; - grouped_text->clear_text(); - data_graphs->clear_graphs(); + if (grouped_text) + grouped_text->clear_groups(); + if (data_graphs) + data_graphs->clear_graphs(); mark_canvas_dirty(); _finish_frame_and_update(); #else @@ -334,6 +337,11 @@ void DebugDraw2D::set_text(String key, Variant value, int priority, Color color_ CALL_TO_2D(grouped_text, set_text, key, value, priority, color_of_value, duration); } +void DebugDraw2D::clear_texts() { + ZoneScoped; + FORCE_CALL_TO_2D(grouped_text, clear_groups); +} + #pragma endregion // Text #pragma region Graphs diff --git a/src/2d/debug_draw_2d.h b/src/2d/debug_draw_2d.h index b0352742..5aabbd7d 100644 --- a/src/2d/debug_draw_2d.h +++ b/src/2d/debug_draw_2d.h @@ -127,6 +127,9 @@ class DebugDraw2D : public Object { /// duration: Expiration time void set_text(String key, Variant value = Variant(), int priority = 0, Color color_of_value = Colors::empty_color, real_t duration = -1); + /// Clear all text + void clear_texts(); + #pragma endregion // Text #pragma region Graphs diff --git a/src/2d/grouped_text.cpp b/src/2d/grouped_text.cpp index acb2dd99..d6460438 100644 --- a/src/2d/grouped_text.cpp +++ b/src/2d/grouped_text.cpp @@ -132,7 +132,7 @@ void GroupedText::init_group(DebugDraw2D *p_owner) { item_for_title_of_groups->is_group_title = true; } -void GroupedText::clear_text() { +void GroupedText::clear_groups() { LOCK_GUARD(datalock); _text_groups.clear(); } diff --git a/src/2d/grouped_text.h b/src/2d/grouped_text.h index e5ebfaff..9464434b 100644 --- a/src/2d/grouped_text.h +++ b/src/2d/grouped_text.h @@ -112,7 +112,7 @@ class GroupedText { public: void init_group(class DebugDraw2D *p_owner); - void clear_text(); + void clear_groups(); void cleanup_text(const double &_delta); void begin_text_group(const String &_group_title, const int &_group_priority, const Color &_group_color, const bool &_show_title, const int &_title_size, const int &_text_size); void end_text_group(); diff --git a/src/3d/geometry_generators.h b/src/3d/geometry_generators.h index 1640f6e3..957db2cd 100644 --- a/src/3d/geometry_generators.h +++ b/src/3d/geometry_generators.h @@ -23,11 +23,14 @@ class GeometryGenerator { const static std::array CubeVertices; const static std::array CubeIndices; const static std::array CubeWithDiagonalsIndices; + const static std::array ArrowheadVertices; const static std::array ArrowheadIndices; const static std::array ArrowheadIndicesSimplified; + const static std::array CenteredSquareVertices; const static std::array SquareIndices; + const static std::array PositionVertices; const static std::array PositionIndices;