Skip to content

Commit

Permalink
Fix function not available in Godot 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Dec 11, 2024
1 parent 700fd27 commit da99751
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion terrain/fixed_lod/voxel_terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ void VoxelTerrain::apply_mesh_update(const VoxelEngine::BlockMeshOutput &ob) {
#if DEBUG_ENABLED
if (collision_shape.is_valid()) {
const Color debug_color = scene_tree->get_debug_collisions_color();
collision_shape->set_debug_color(debug_color);
zylann::godot::set_shape_3d_debug_color(**collision_shape, debug_color);
}
#endif
debug_collisions = scene_tree->is_debugging_collisions_hint();
Expand Down
2 changes: 1 addition & 1 deletion terrain/variable_lod/voxel_lod_terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ inline void set_block_collision_shape(
#if DEBUG_ENABLED
if (shape.is_valid()) {
const Color debug_color = scene_tree->get_debug_collisions_color();
shape->set_debug_color(debug_color);
zylann::godot::set_shape_3d_debug_color(**shape, debug_color);
}
#endif
debug_collisions = scene_tree->is_debugging_collisions_hint();
Expand Down
15 changes: 13 additions & 2 deletions util/godot/classes/shape_3d.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#ifndef ZN_GODOT_SHAPE_3D_H
#define ZN_GODOT_SHAPE_3D_H

#include "../core/version.h"

#if defined(ZN_GODOT)
#include <core/version.h>

#if VERSION_MAJOR == 4 && VERSION_MINOR <= 2
#if GODOT_VERSION_MAJOR == 4 && GODOT_VERSION_MINOR <= 2
#include <scene/resources/shape_3d.h>
#else
#include <scene/resources/3d/shape_3d.h>
Expand All @@ -15,4 +16,14 @@
using namespace godot;
#endif

namespace zylann::godot {

inline void set_shape_3d_debug_color(Shape3D &shape, const Color color) {
#if GODOT_VERSION_MAJOR == 4 && GODOT_VERSION_MINOR >= 4
shape.set_debug_color(color);
#endif
}

} // namespace zylann::godot

#endif // ZN_GODOT_SHAPE_3D_H

0 comments on commit da99751

Please sign in to comment.