Add more const qualifiers to editor methods

This commit is contained in:
Corantin H 2024-02-09 20:39:12 +01:00
parent bd5149c48c
commit f9ba9d819b
2 changed files with 14 additions and 14 deletions

View file

@ -319,7 +319,7 @@ int CEditor::DoButton_DraggableEx(const void *pID, const char *pText, int Checke
return UI()->DoDraggableButtonLogic(pID, Checked, pRect, pClicked, pAbrupted); return UI()->DoDraggableButtonLogic(pID, Checked, pRect, pClicked, pAbrupted);
} }
void CEditor::RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) void CEditor::RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) const
{ {
Graphics()->TextureSet(Texture); Graphics()->TextureSet(Texture);
Graphics()->BlendNormal(); Graphics()->BlendNormal();
@ -1547,7 +1547,7 @@ void CEditor::DoPointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQu
pQuad->m_aPoints[PointIndex].y = m_QuadDragOriginalPoints[QuadIndex][PointIndex].y + OffsetY; pQuad->m_aPoints[PointIndex].y = m_QuadDragOriginalPoints[QuadIndex][PointIndex].y + OffsetY;
} }
CEditor::EAxis CEditor::GetDragAxis(int OffsetX, int OffsetY) CEditor::EAxis CEditor::GetDragAxis(int OffsetX, int OffsetY) const
{ {
if(Input()->ShiftIsPressed()) if(Input()->ShiftIsPressed())
if(absolute(OffsetX) < absolute(OffsetY)) if(absolute(OffsetX) < absolute(OffsetY))
@ -1558,7 +1558,7 @@ CEditor::EAxis CEditor::GetDragAxis(int OffsetX, int OffsetY)
return EAxis::AXIS_NONE; return EAxis::AXIS_NONE;
} }
void CEditor::DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) void CEditor::DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) const
{ {
if(Axis == EAxis::AXIS_NONE) if(Axis == EAxis::AXIS_NONE)
return; return;
@ -1892,7 +1892,7 @@ void CEditor::ComputeAABBAlignments(const std::shared_ptr<CLayerQuads> &pLayer,
vAlignments.insert(vAlignments.end(), vAlignmentsY.begin(), vAlignmentsY.end()); vAlignments.insert(vAlignments.end(), vAlignmentsY.begin(), vAlignmentsY.end());
} }
void CEditor::DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments, int OffsetX, int OffsetY) void CEditor::DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments, int OffsetX, int OffsetY) const
{ {
if(!g_Config.m_EdAlignQuads) if(!g_Config.m_EdAlignQuads)
return; return;
@ -1916,7 +1916,7 @@ void CEditor::DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments
} }
} }
void CEditor::DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY) void CEditor::DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY) const
{ {
// Drawing an AABB is simply converting the points from fixed to float // Drawing an AABB is simply converting the points from fixed to float
// Then making lines out of quads and drawing them // Then making lines out of quads and drawing them
@ -2006,7 +2006,7 @@ void CEditor::ApplyAlignments(const std::vector<SAlignmentInfo> &vAlignments, in
OffsetY += AdjustY; OffsetY += AdjustY;
} }
void CEditor::ApplyAxisAlignment(int &OffsetX, int &OffsetY) void CEditor::ApplyAxisAlignment(int &OffsetX, int &OffsetY) const
{ {
// This is used to preserve axis alignment when pressing `Shift` // This is used to preserve axis alignment when pressing `Shift`
// Should be called before any other computation // Should be called before any other computation
@ -8361,7 +8361,7 @@ void CEditor::Reset(bool CreateDefault)
m_MapSettingsCommandContext.Reset(); m_MapSettingsCommandContext.Reset();
} }
int CEditor::GetTextureUsageFlag() int CEditor::GetTextureUsageFlag() const
{ {
return Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE; return Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
} }

View file

@ -288,7 +288,7 @@ class CEditor : public IEditor
IGraphics::CTextureHandle m_SwitchTexture; IGraphics::CTextureHandle m_SwitchTexture;
IGraphics::CTextureHandle m_TuneTexture; IGraphics::CTextureHandle m_TuneTexture;
int GetTextureUsageFlag(); int GetTextureUsageFlag() const;
enum EPreviewState enum EPreviewState
{ {
@ -823,7 +823,7 @@ public:
template<typename T> template<typename T>
int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &fnMatchCallback); int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &fnMatchCallback);
void RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness); void RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) const;
SEditResult<int> UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree = false, bool IsHex = false, int corners = IGraphics::CORNER_ALL, const ColorRGBA *pColor = nullptr, bool ShowValue = true); SEditResult<int> UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree = false, bool IsHex = false, int corners = IGraphics::CORNER_ALL, const ColorRGBA *pColor = nullptr, bool ShowValue = true);
@ -919,9 +919,9 @@ public:
void DoQuad(int LayerIndex, const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int Index); void DoQuad(int LayerIndex, const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int Index);
void PreparePointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex); void PreparePointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex);
void DoPointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY); void DoPointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY);
EAxis GetDragAxis(int OffsetX, int OffsetY); EAxis GetDragAxis(int OffsetX, int OffsetY) const;
void DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point); void DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) const;
void DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX = 0, int OffsetY = 0); void DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX = 0, int OffsetY = 0) const;
ColorRGBA GetButtonColor(const void *pID, int Checked); ColorRGBA GetButtonColor(const void *pID, int Checked);
// Alignment methods // Alignment methods
@ -945,10 +945,10 @@ public:
void ComputePointAlignments(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments, bool Append = false) const; void ComputePointAlignments(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments, bool Append = false) const;
void ComputePointsAlignments(const std::shared_ptr<CLayerQuads> &pLayer, bool Pivot, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const; void ComputePointsAlignments(const std::shared_ptr<CLayerQuads> &pLayer, bool Pivot, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const;
void ComputeAABBAlignments(const std::shared_ptr<CLayerQuads> &pLayer, const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const; void ComputeAABBAlignments(const std::shared_ptr<CLayerQuads> &pLayer, const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const;
void DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments, int OffsetX, int OffsetY); void DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments, int OffsetX, int OffsetY) const;
void QuadSelectionAABB(const std::shared_ptr<CLayerQuads> &pLayer, SAxisAlignedBoundingBox &OutAABB); void QuadSelectionAABB(const std::shared_ptr<CLayerQuads> &pLayer, SAxisAlignedBoundingBox &OutAABB);
void ApplyAlignments(const std::vector<SAlignmentInfo> &vAlignments, int &OffsetX, int &OffsetY); void ApplyAlignments(const std::vector<SAlignmentInfo> &vAlignments, int &OffsetX, int &OffsetY);
void ApplyAxisAlignment(int &OffsetX, int &OffsetY); void ApplyAxisAlignment(int &OffsetX, int &OffsetY) const;
bool ReplaceImage(const char *pFilename, int StorageType, bool CheckDuplicate); bool ReplaceImage(const char *pFilename, int StorageType, bool CheckDuplicate);
static bool ReplaceImageCallback(const char *pFilename, int StorageType, void *pUser); static bool ReplaceImageCallback(const char *pFilename, int StorageType, void *pUser);