Add static assert for bed number related values (#11035)

This commit is contained in:
Noisyfox
2025-10-14 08:56:18 +08:00
committed by GitHub
parent ac75c69ddf
commit cbc41501b4
3 changed files with 7 additions and 4 deletions

View File

@@ -197,8 +197,8 @@ private:
int picking_id_component(int idx) const; int picking_id_component(int idx) const;
public: public:
static const unsigned int PLATE_NAME_HOVER_ID = 6; static constexpr unsigned int PLATE_NAME_HOVER_ID = 6;
static const unsigned int GRABBER_COUNT = 8; static constexpr unsigned int GRABBER_COUNT = 8;
static ColorRGBA SELECT_COLOR; static ColorRGBA SELECT_COLOR;
static ColorRGBA UNSELECT_COLOR; static ColorRGBA UNSELECT_COLOR;
@@ -630,7 +630,7 @@ public:
void reset(); void reset();
}; };
static const unsigned int MAX_PLATES_COUNT = MAX_PLATE_COUNT; static constexpr unsigned int MAX_PLATES_COUNT = MAX_PLATE_COUNT;
static GLTexture bed_textures[(unsigned int)btCount]; static GLTexture bed_textures[(unsigned int)btCount];
static bool is_load_bedtype_textures; static bool is_load_bedtype_textures;
static bool is_load_cali_texture; static bool is_load_cali_texture;

View File

@@ -9,6 +9,9 @@
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
// EIdBase::Volume must be greater than PartPlateList::MAX_PLATES_COUNT * PartPlate::GRABBER_COUNT
static_assert((int) SceneRaycaster::EIdBase::Volume > PartPlateList::MAX_PLATES_COUNT * PartPlate::GRABBER_COUNT, "EIdBase::Volume too small");
SceneRaycaster::SceneRaycaster() { SceneRaycaster::SceneRaycaster() {
#if ENABLE_RAYCAST_PICKING_DEBUG #if ENABLE_RAYCAST_PICKING_DEBUG
// hit point // hit point

View File

@@ -52,7 +52,7 @@ public:
enum class EIdBase enum class EIdBase
{ {
Bed = 0, Bed = 0,
Volume = 1000, // Must be smaller than PartPlateList::MAX_PLATES_COUNT * PartPlate::GRABBER_COUNT Volume = 1000, // Must be greater than PartPlateList::MAX_PLATES_COUNT * PartPlate::GRABBER_COUNT
Gizmo = 1000000, Gizmo = 1000000,
FallbackGizmo = 2000000 FallbackGizmo = 2000000
}; };