Skip to content

Commit

Permalink
unused arguments have been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriySalnikov committed Jul 25, 2024
1 parent 72e3b52 commit ed72373
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion addons/debug_draw_3d/debug_draw_3d.gdextension
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[configuration]

entry_symbol = "debug_draw_3d_library_init"
compatibility_minimum = "4.1.3"
compatibility_minimum = "4.1.4"
reloadable = false

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions examples_dd3d/Roboto-Bold.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Bold.ttf-3674de3d9ad3ee757cd4b4a89f1e1
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
33 changes: 15 additions & 18 deletions src/2d/debug_draw_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void DebugDraw2D::process(double delta) {
data_graphs->auto_update_graphs(delta);

// Update overlay
_finish_frame_and_update(false);
_finish_frame_and_update();
#endif
}

Expand All @@ -150,10 +150,10 @@ void DebugDraw2D::physics_process_end(double delta) {
}

#ifndef DISABLE_DEBUG_RENDERING
void DebugDraw2D::_finish_frame_and_update(bool avoid_casts) {
void DebugDraw2D::_finish_frame_and_update() {
ZoneScoped;
if (_canvas_need_update) {
if (Control *custom_canvas = Object::cast_to<Control>(ObjectDB::get_instance(custom_control_id)); !avoid_casts && custom_canvas) {
if (Control *custom_canvas = Object::cast_to<Control>(ObjectDB::get_instance(custom_control_id)); custom_canvas) {
custom_canvas->queue_redraw();
} else if (Control *default_control = Object::cast_to<Control>(ObjectDB::get_instance(default_control_id)); default_control) {
default_control->queue_redraw();
Expand All @@ -180,18 +180,18 @@ void DebugDraw2D::_finish_frame_and_update(bool avoid_casts) {
}
}

void DebugDraw2D::_clear_all_internal(bool avoid_casts) {
void DebugDraw2D::_clear_all_internal() {
if (grouped_text)
grouped_text->clear_groups();
if (data_graphs)
data_graphs->clear_graphs();
mark_canvas_dirty();
_finish_frame_and_update(avoid_casts);
_finish_frame_and_update();

_set_custom_canvas_internal(nullptr, avoid_casts);
_set_custom_canvas_internal(nullptr);
}

void DebugDraw2D::_set_custom_canvas_internal(Control *_canvas, bool avoid_casts) {
void DebugDraw2D::_set_custom_canvas_internal(Control *_canvas) {
static std::function<Callable()> create_default = [this]() {
return Callable(this, NAMEOF(_on_canvas_item_draw)).bindv(Array::make(ObjectDB::get_instance(default_control_id)));
};
Expand All @@ -204,24 +204,21 @@ void DebugDraw2D::_set_custom_canvas_internal(Control *_canvas, bool avoid_casts

if (!_canvas) {
Utils::connect_safe(default_control, "draw", call_canvas_item_draw_cache, 0, nullptr, create_default);
if (!avoid_casts) {
if (Utils::disconnect_safe(old_custom_canvas, "draw", call_canvas_item_draw_cache)) {
old_custom_canvas->queue_redraw();
}
if (Utils::disconnect_safe(old_custom_canvas, "draw", call_canvas_item_draw_cache)) {
old_custom_canvas->queue_redraw();
}
custom_control_id = 0;
} else {
if (Utils::disconnect_safe(default_control, "draw", call_canvas_item_draw_cache)) {
default_control->queue_redraw();
}
custom_control_id = _canvas->get_instance_id();
if (!avoid_casts) {
if (old_custom_canvas != _canvas && Utils::disconnect_safe(old_custom_canvas, "draw", call_canvas_item_draw_cache)) {
old_custom_canvas->queue_redraw();
}

Utils::connect_safe(_canvas, "draw", call_canvas_item_draw_cache, 0, nullptr, create_custom);
if (old_custom_canvas != _canvas && Utils::disconnect_safe(old_custom_canvas, "draw", call_canvas_item_draw_cache)) {
old_custom_canvas->queue_redraw();
}

Utils::connect_safe(_canvas, "draw", call_canvas_item_draw_cache, 0, nullptr, create_custom);
}
}
#endif
Expand Down Expand Up @@ -314,7 +311,7 @@ Ref<DebugDraw2DConfig> DebugDraw2D::get_config() const {
void DebugDraw2D::set_custom_canvas(Control *_canvas) {
ZoneScoped;
#ifndef DISABLE_DEBUG_RENDERING
_set_custom_canvas_internal(_canvas, false);
_set_custom_canvas_internal(_canvas);
#else
custom_control_id = _canvas->get_instance_id();
#endif
Expand Down Expand Up @@ -345,7 +342,7 @@ Ref<DebugDraw2DStats> DebugDraw2D::get_render_stats() {
void DebugDraw2D::clear_all() {
ZoneScoped;
#ifndef DISABLE_DEBUG_RENDERING
_clear_all_internal(false);
_clear_all_internal();
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions src/2d/debug_draw_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class DebugDraw2D : public Object {
#endif

#ifndef DISABLE_DEBUG_RENDERING
void _finish_frame_and_update(bool avoid_casts);
void _clear_all_internal(bool avoid_casts);
void _set_custom_canvas_internal(Control *_canvas, bool avoid_casts);
void _finish_frame_and_update();
void _clear_all_internal();
void _set_custom_canvas_internal(Control *_canvas);
#endif

void _on_canvas_item_draw(Control *ci);
Expand Down
4 changes: 1 addition & 3 deletions src/debug_draw_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ void DebugDrawManager::_on_scene_changed(bool p_is_scene_null) {
if (!is_current_scene_is_null || is_current_scene_is_null != p_is_scene_null) {
DEV_PRINT("Scene changed! clear_all()");
debug_draw_3d_singleton->clear_all();

// call this version of `clear_all` to avoid casts on nullptr
debug_draw_2d_singleton->_clear_all_internal(true);
debug_draw_2d_singleton->_clear_all_internal();
}

is_current_scene_is_null = p_is_scene_null;
Expand Down
7 changes: 6 additions & 1 deletion src/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ class Utils {
#pragma endregion
};

#if false
#ifndef DISABLE_DEBUG_RENDERING
#ifndef WEB_ENABLED
#include <chrono>

class GodotScopedStopwatch {
Expand Down Expand Up @@ -373,3 +374,7 @@ class GodotScopedStopwatch {
#define _GODOT_STOPWATCH_CONCAT(name1, name2) _GODOT_STOPWATCH_CONCAT_IMPL(name1, name2)
#define GODOT_STOPWATCH(time_val) GodotScopedStopwatch _GODOT_STOPWATCH_CONCAT(godot_stopwatch_, __LINE__)(time_val, false)
#define GODOT_STOPWATCH_ADD(time_val) GodotScopedStopwatch _GODOT_STOPWATCH_CONCAT(godot_stopwatch_, __LINE__)(time_val, true)
#else
#define GODOT_STOPWATCH(time_val)
#define GODOT_STOPWATCH_ADD(time_val)
#endif
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define DD3D_MAJOR 1
#define DD3D_MINOR 4
#define DD3D_PATCH 3
#define DD3D_PATCH 4
#define DD3D_VERSION ((DD3D_MAJOR << (8 * 3)) + (DD3D_MINOR << (8 * 2)) + (DD3D_PATCH << (8 * 1)))

#define _DD3D_VERSION_STR_TEXT(text) #text
Expand Down

0 comments on commit ed72373

Please sign in to comment.