mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Clean-up: Added a header file for backward compatibility symbols. Keeping rules in one place should help with tracking, help to maintain consistency and reduce clutter in implementation files.
This commit is contained in:
parent
9ab12850fb
commit
20a7675787
@ -23,10 +23,10 @@ namespace
|
|||||||
{
|
{
|
||||||
FString GetSaveDirectory()
|
FString GetSaveDirectory()
|
||||||
{
|
{
|
||||||
#if (ENGINE_MAJOR_VERSION > 4 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 18))
|
#if ENGINE_COMPATIBILITY_LEGACY_SAVED_DIR
|
||||||
const FString SavedDir = FPaths::ProjectSavedDir();
|
|
||||||
#else
|
|
||||||
const FString SavedDir = FPaths::GameSavedDir();
|
const FString SavedDir = FPaths::GameSavedDir();
|
||||||
|
#else
|
||||||
|
const FString SavedDir = FPaths::ProjectSavedDir();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FString Directory = FPaths::Combine(*SavedDir, TEXT("ImGui"));
|
FString Directory = FPaths::Combine(*SavedDir, TEXT("ImGui"));
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
#include "ImGuiDrawData.h"
|
#include "ImGuiDrawData.h"
|
||||||
|
|
||||||
|
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
void FImGuiDrawList::CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const FTransform2D& Transform, const FSlateRotatedRect& VertexClippingRect) const
|
void FImGuiDrawList::CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const FTransform2D& Transform, const FSlateRotatedRect& VertexClippingRect) const
|
||||||
#else
|
#else
|
||||||
void FImGuiDrawList::CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const FTransform2D& Transform) const
|
void FImGuiDrawList::CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const FTransform2D& Transform) const
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
{
|
{
|
||||||
// Reset and reserve space in destination buffer.
|
// Reset and reserve space in destination buffer.
|
||||||
OutVertexBuffer.SetNumUninitialized(ImGuiVertexBuffer.Size, false);
|
OutVertexBuffer.SetNumUninitialized(ImGuiVertexBuffer.Size, false);
|
||||||
@ -25,14 +25,14 @@ void FImGuiDrawList::CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const
|
|||||||
SlateVertex.TexCoords[1] = ImGuiVertex.uv.y;
|
SlateVertex.TexCoords[1] = ImGuiVertex.uv.y;
|
||||||
SlateVertex.TexCoords[2] = SlateVertex.TexCoords[3] = 1.f;
|
SlateVertex.TexCoords[2] = SlateVertex.TexCoords[3] = 1.f;
|
||||||
|
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
const FVector2D VertexPosition = Transform.TransformPoint(ImGuiInterops::ToVector2D(ImGuiVertex.pos));
|
const FVector2D VertexPosition = Transform.TransformPoint(ImGuiInterops::ToVector2D(ImGuiVertex.pos));
|
||||||
SlateVertex.Position[0] = VertexPosition.X;
|
SlateVertex.Position[0] = VertexPosition.X;
|
||||||
SlateVertex.Position[1] = VertexPosition.Y;
|
SlateVertex.Position[1] = VertexPosition.Y;
|
||||||
SlateVertex.ClipRect = VertexClippingRect;
|
SlateVertex.ClipRect = VertexClippingRect;
|
||||||
#else
|
#else
|
||||||
SlateVertex.Position = Transform.TransformPoint(ImGuiInterops::ToVector2D(ImGuiVertex.pos));
|
SlateVertex.Position = Transform.TransformPoint(ImGuiInterops::ToVector2D(ImGuiVertex.pos));
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
// Unpack ImU32 color.
|
// Unpack ImU32 color.
|
||||||
SlateVertex.Color = ImGuiInterops::UnpackImU32Color(ImGuiVertex.col);
|
SlateVertex.Color = ImGuiInterops::UnpackImU32Color(ImGuiVertex.col);
|
||||||
|
@ -10,10 +10,6 @@
|
|||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
|
|
||||||
// Starting from version 4.17 Slate doesn't have per-vertex clipping rectangle and GSlateScissorRect. Use this to
|
|
||||||
// support older engine versions.
|
|
||||||
#define WITH_OBSOLETE_CLIPPING_API (ENGINE_MAJOR_VERSION < 4 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 17))
|
|
||||||
|
|
||||||
// ImGui draw command data transformed for Slate.
|
// ImGui draw command data transformed for Slate.
|
||||||
struct FImGuiDrawCommand
|
struct FImGuiDrawCommand
|
||||||
{
|
{
|
||||||
@ -41,7 +37,7 @@ public:
|
|||||||
ImGuiInterops::ToTextureIndex(ImGuiCommand.TextureId) };
|
ImGuiInterops::ToTextureIndex(ImGuiCommand.TextureId) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
// Transform and copy vertex data to target buffer (old data in the target buffer are replaced).
|
// Transform and copy vertex data to target buffer (old data in the target buffer are replaced).
|
||||||
// @param OutVertexBuffer - Destination buffer
|
// @param OutVertexBuffer - Destination buffer
|
||||||
// @param Transform - Transform to apply to all vertices
|
// @param Transform - Transform to apply to all vertices
|
||||||
@ -52,7 +48,7 @@ public:
|
|||||||
// @param OutVertexBuffer - Destination buffer
|
// @param OutVertexBuffer - Destination buffer
|
||||||
// @param Transform - Transform to apply to all vertices
|
// @param Transform - Transform to apply to all vertices
|
||||||
void CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const FTransform2D& Transform) const;
|
void CopyVertexData(TArray<FSlateVertex>& OutVertexBuffer, const FTransform2D& Transform) const;
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
// Transform and copy index data to target buffer (old data in the target buffer are replaced).
|
// Transform and copy index data to target buffer (old data in the target buffer are replaced).
|
||||||
// Internal index buffer contains enough data to match the sum of NumElements from all draw commands.
|
// Internal index buffer contains enough data to match the sum of NumElements from all draw commands.
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
#include <Commands/InputBindingManager.h>
|
#include <Commands/InputBindingManager.h>
|
||||||
#include <Commands/InputChord.h>
|
#include <Commands/InputChord.h>
|
||||||
#include <DebuggerCommands.h>
|
#include <DebuggerCommands.h>
|
||||||
|
|
||||||
// Version 4.18 added support for dual key bindings.
|
|
||||||
#include <Runtime/Launch/Resources/Version.h>
|
|
||||||
#define WITH_SINGLE_KEY_BINDING (ENGINE_MAJOR_VERSION < 4 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 18))
|
|
||||||
#endif // WITH_EDITOR
|
#endif // WITH_EDITOR
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +60,7 @@ bool UImGuiInputHandler::IsStopPlaySessionEvent(const FKeyEvent& KeyEvent) const
|
|||||||
if (StopPlaySessionCommandInfo.IsValid())
|
if (StopPlaySessionCommandInfo.IsValid())
|
||||||
{
|
{
|
||||||
const FInputChord InputChord(KeyEvent.GetKey(), KeyEvent.IsShiftDown(), KeyEvent.IsControlDown(), KeyEvent.IsAltDown(), KeyEvent.IsCommandDown());
|
const FInputChord InputChord(KeyEvent.GetKey(), KeyEvent.IsShiftDown(), KeyEvent.IsControlDown(), KeyEvent.IsAltDown(), KeyEvent.IsCommandDown());
|
||||||
#if WITH_SINGLE_KEY_BINDING
|
#if ENGINE_COMPATIBILITY_SINGLE_KEY_BINDING
|
||||||
const bool bHasActiveChord = (InputChord == StopPlaySessionCommandInfo->GetActiveChord().Get());
|
const bool bHasActiveChord = (InputChord == StopPlaySessionCommandInfo->GetActiveChord().Get());
|
||||||
#else
|
#else
|
||||||
const bool bHasActiveChord = StopPlaySessionCommandInfo->HasActiveChord(InputChord);
|
const bool bHasActiveChord = StopPlaySessionCommandInfo->HasActiveChord(InputChord);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// Module
|
// Module
|
||||||
#include "ImGuiModule.h"
|
#include "ImGuiModule.h"
|
||||||
|
#include "VersionCompatibility.h"
|
||||||
|
|
||||||
// Engine
|
// Engine
|
||||||
#include <Core.h>
|
#include <Core.h>
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
#include <Delegates/Delegate.h>
|
#include <Delegates/Delegate.h>
|
||||||
#include <UObject/Object.h>
|
#include <UObject/Object.h>
|
||||||
|
|
||||||
// Select right soft class reference header to avoid warning (new header contains FSoftClassPath to FStringClassReference
|
// Select right soft class reference header to avoid warning.
|
||||||
// typedef, so we will use that as a common denominator).
|
#if ENGINE_COMPATIBILITY_LEGACY_STRING_CLASS_REF
|
||||||
#include <Runtime/Launch/Resources/Version.h>
|
|
||||||
#if (ENGINE_MAJOR_VERSION < 4 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION < 18))
|
|
||||||
#include <StringClassReference.h>
|
#include <StringClassReference.h>
|
||||||
#else
|
#else
|
||||||
#include <UObject/SoftObjectPath.h>
|
#include <UObject/SoftObjectPath.h>
|
||||||
|
@ -836,7 +836,7 @@ namespace
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
void AddQuad(TArray<FSlateVertex>& OutVertexBuffer, TArray<SlateIndex>& OutIndexBuffer, const FVector2D& Position, const FVector2D& Size,
|
void AddQuad(TArray<FSlateVertex>& OutVertexBuffer, TArray<SlateIndex>& OutIndexBuffer, const FVector2D& Position, const FVector2D& Size,
|
||||||
const FVector2D& UVMin, const FVector2D& UVMax, const FColor& Color, const FSlateRotatedClipRectType& InClipRect)
|
const FVector2D& UVMin, const FVector2D& UVMax, const FColor& Color, const FSlateRotatedClipRectType& InClipRect)
|
||||||
{
|
{
|
||||||
@ -871,7 +871,7 @@ namespace
|
|||||||
|
|
||||||
OutIndexBuffer.Append({ IndexOffset + 0U, IndexOffset + 1U, IndexOffset + 2U, IndexOffset + 0U, IndexOffset + 2U, IndexOffset + 3U });
|
OutIndexBuffer.Append({ IndexOffset + 0U, IndexOffset + 1U, IndexOffset + 2U, IndexOffset + 0U, IndexOffset + 2U, IndexOffset + 3U });
|
||||||
}
|
}
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect,
|
int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect,
|
||||||
@ -889,14 +889,14 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
// Calculate transform between ImGui canvas ans screen space (scale and then offset in Screen Space).
|
// Calculate transform between ImGui canvas ans screen space (scale and then offset in Screen Space).
|
||||||
const FTransform2D Transform{ ImGuiFrameCanvasScale, RoundToFloat(CanvasScreenSpacePosition) };
|
const FTransform2D Transform{ ImGuiFrameCanvasScale, RoundToFloat(CanvasScreenSpacePosition) };
|
||||||
|
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
// Convert clipping rectangle to format required by Slate vertex.
|
// Convert clipping rectangle to format required by Slate vertex.
|
||||||
const FSlateRotatedRect VertexClippingRect{ MyClippingRect };
|
const FSlateRotatedRect VertexClippingRect{ MyClippingRect };
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
for (const auto& DrawList : ContextProxy->GetDrawData())
|
for (const auto& DrawList : ContextProxy->GetDrawData())
|
||||||
{
|
{
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
DrawList.CopyVertexData(VertexBuffer, Transform, VertexClippingRect);
|
DrawList.CopyVertexData(VertexBuffer, Transform, VertexClippingRect);
|
||||||
|
|
||||||
// Get access to the Slate scissor rectangle defined in Slate Core API, so we can customize elements drawing.
|
// Get access to the Slate scissor rectangle defined in Slate Core API, so we can customize elements drawing.
|
||||||
@ -904,7 +904,7 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
auto GSlateScissorRectSaver = ScopeGuards::MakeStateSaver(GSlateScissorRect);
|
auto GSlateScissorRectSaver = ScopeGuards::MakeStateSaver(GSlateScissorRect);
|
||||||
#else
|
#else
|
||||||
DrawList.CopyVertexData(VertexBuffer, Transform);
|
DrawList.CopyVertexData(VertexBuffer, Transform);
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
int IndexBufferOffset = 0;
|
int IndexBufferOffset = 0;
|
||||||
for (int CommandNb = 0; CommandNb < DrawList.NumCommands(); CommandNb++)
|
for (int CommandNb = 0; CommandNb < DrawList.NumCommands(); CommandNb++)
|
||||||
@ -922,18 +922,18 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
// Transform clipping rectangle to screen space and apply to elements that we draw.
|
// Transform clipping rectangle to screen space and apply to elements that we draw.
|
||||||
const FSlateRect ClippingRect = DrawCommand.ClippingRect.IntersectionWith(MyClippingRect);
|
const FSlateRect ClippingRect = DrawCommand.ClippingRect.IntersectionWith(MyClippingRect);
|
||||||
|
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
GSlateScissorRect = FShortRect{ ClippingRect };
|
GSlateScissorRect = FShortRect{ ClippingRect };
|
||||||
#else
|
#else
|
||||||
OutDrawElements.PushClip(FSlateClippingZone{ ClippingRect });
|
OutDrawElements.PushClip(FSlateClippingZone{ ClippingRect });
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
// Add elements to the list.
|
// Add elements to the list.
|
||||||
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, Handle, VertexBuffer, IndexBuffer, nullptr, 0, 0);
|
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, Handle, VertexBuffer, IndexBuffer, nullptr, 0, 0);
|
||||||
|
|
||||||
#if !WITH_OBSOLETE_CLIPPING_API
|
#if !ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
OutDrawElements.PopClip();
|
OutDrawElements.PopClip();
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,13 +970,13 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
{
|
{
|
||||||
IndexBuffer.SetNum(0, false);
|
IndexBuffer.SetNum(0, false);
|
||||||
VertexBuffer.SetNum(0, false);
|
VertexBuffer.SetNum(0, false);
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
AddQuad(VertexBuffer, IndexBuffer, DeadZoneScreenSpaceMin, MyClippingRect.GetBottomRight() - DeadZoneScreenSpaceMin,
|
AddQuad(VertexBuffer, IndexBuffer, DeadZoneScreenSpaceMin, MyClippingRect.GetBottomRight() - DeadZoneScreenSpaceMin,
|
||||||
FVector2D::ZeroVector, FVector2D::ZeroVector, CanvasFrameColor.WithAlpha(128), VertexClippingRect);
|
FVector2D::ZeroVector, FVector2D::ZeroVector, CanvasFrameColor.WithAlpha(128), VertexClippingRect);
|
||||||
#else
|
#else
|
||||||
AddQuad(VertexBuffer, IndexBuffer, DeadZoneScreenSpaceMin, MyClippingRect.GetBottomRight() - DeadZoneScreenSpaceMin,
|
AddQuad(VertexBuffer, IndexBuffer, DeadZoneScreenSpaceMin, MyClippingRect.GetBottomRight() - DeadZoneScreenSpaceMin,
|
||||||
FVector2D::ZeroVector, FVector2D::ZeroVector, CanvasFrameColor.WithAlpha(128));
|
FVector2D::ZeroVector, FVector2D::ZeroVector, CanvasFrameColor.WithAlpha(128));
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
const FSlateResourceHandle& Handle = ModuleManager->GetTextureManager().GetTextureHandle(PlainTextureIndex);
|
const FSlateResourceHandle& Handle = ModuleManager->GetTextureManager().GetTextureHandle(PlainTextureIndex);
|
||||||
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, Handle, VertexBuffer, IndexBuffer, nullptr, 0, 0);
|
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, Handle, VertexBuffer, IndexBuffer, nullptr, 0, 0);
|
||||||
@ -985,13 +985,13 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
|
|
||||||
// Draw a scaled canvas border.
|
// Draw a scaled canvas border.
|
||||||
AddLocalRectanglePoints(Points, AllottedGeometry, CanvasScreenSpacePosition, CanvasSizeScaled);
|
AddLocalRectanglePoints(Points, AllottedGeometry, CanvasScreenSpacePosition, CanvasSizeScaled);
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points, MyClippingRect,
|
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points, MyClippingRect,
|
||||||
ESlateDrawEffect::None, FLinearColor{ CanvasFrameColor }, false);
|
ESlateDrawEffect::None, FLinearColor{ CanvasFrameColor }, false);
|
||||||
#else
|
#else
|
||||||
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points,
|
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points,
|
||||||
ESlateDrawEffect::None, FLinearColor{ CanvasFrameColor }, false);
|
ESlateDrawEffect::None, FLinearColor{ CanvasFrameColor }, false);
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
|
|
||||||
// Draw a movement gizmo (using ImGui move cursor).
|
// Draw a movement gizmo (using ImGui move cursor).
|
||||||
FVector2D Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax;
|
FVector2D Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax;
|
||||||
@ -1002,13 +1002,13 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
{
|
{
|
||||||
IndexBuffer.SetNum(0, false);
|
IndexBuffer.SetNum(0, false);
|
||||||
VertexBuffer.SetNum(0, false);
|
VertexBuffer.SetNum(0, false);
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
AddQuad(VertexBuffer, IndexBuffer, ViewportScreenSpacePosition + ViewportSizeScaled * 0.5f - Size * 0.375f, Size * 0.75f,
|
AddQuad(VertexBuffer, IndexBuffer, ViewportScreenSpacePosition + ViewportSizeScaled * 0.5f - Size * 0.375f, Size * 0.75f,
|
||||||
UVMin, UVMax, FrameColor.WithAlpha(bCanvasDragging ? 32 : 128), VertexClippingRect);
|
UVMin, UVMax, FrameColor.WithAlpha(bCanvasDragging ? 32 : 128), VertexClippingRect);
|
||||||
#else
|
#else
|
||||||
AddQuad(VertexBuffer, IndexBuffer, ViewportScreenSpacePosition + ViewportSizeScaled * 0.5f - Size * 0.375f, Size * 0.75f,
|
AddQuad(VertexBuffer, IndexBuffer, ViewportScreenSpacePosition + ViewportSizeScaled * 0.5f - Size * 0.375f, Size * 0.75f,
|
||||||
UVMin, UVMax, FrameColor.WithAlpha(bCanvasDragging ? 32 : 128));
|
UVMin, UVMax, FrameColor.WithAlpha(bCanvasDragging ? 32 : 128));
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
const FSlateResourceHandle& Handle = ModuleManager->GetTextureManager().GetTextureHandle(FontAtlasIndex);
|
const FSlateResourceHandle& Handle = ModuleManager->GetTextureManager().GetTextureHandle(FontAtlasIndex);
|
||||||
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, Handle, VertexBuffer, IndexBuffer, nullptr, 0, 0);
|
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, Handle, VertexBuffer, IndexBuffer, nullptr, 0, 0);
|
||||||
}
|
}
|
||||||
@ -1018,13 +1018,13 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
// Draw frame representing area of the ImGui canvas that is visible when scale is 1.
|
// Draw frame representing area of the ImGui canvas that is visible when scale is 1.
|
||||||
Points.SetNum(0, false);
|
Points.SetNum(0, false);
|
||||||
AddLocalRectanglePoints(Points, AllottedGeometry, ViewportScreenSpacePosition, ViewportSizeScaled);
|
AddLocalRectanglePoints(Points, AllottedGeometry, ViewportScreenSpacePosition, ViewportSizeScaled);
|
||||||
#if WITH_OBSOLETE_CLIPPING_API
|
#if ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points, MyClippingRect,
|
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points, MyClippingRect,
|
||||||
ESlateDrawEffect::None, FLinearColor{ FrameColor }, false);
|
ESlateDrawEffect::None, FLinearColor{ FrameColor }, false);
|
||||||
#else
|
#else
|
||||||
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points,
|
FSlateDrawElement::MakeLines(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), Points,
|
||||||
ESlateDrawEffect::None, FLinearColor{ FrameColor }, false);
|
ESlateDrawEffect::None, FLinearColor{ FrameColor }, false);
|
||||||
#endif // WITH_OBSOLETE_CLIPPING_API
|
#endif // ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
Source/ImGui/Private/VersionCompatibility.h
Normal file
25
Source/ImGui/Private/VersionCompatibility.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Distributed under the MIT License (MIT) (see accompanying LICENSE file)
|
||||||
|
|
||||||
|
#include <Runtime/Launch/Resources/Version.h>
|
||||||
|
|
||||||
|
#define BELOW_ENGINE_VERSION(Major, Minor) (ENGINE_MAJOR_VERSION < (Major) || (ENGINE_MAJOR_VERSION == (Major) && ENGINE_MINOR_VERSION < (Minor)))
|
||||||
|
#define FROM_ENGINE_VERSION(Major, Minor) !BELOW_ENGINE_VERSION(Major, Minor)
|
||||||
|
|
||||||
|
|
||||||
|
// One place to define compatibility with older engine versions.
|
||||||
|
|
||||||
|
|
||||||
|
// Starting from version 4.17 Slate has an improved clipping API. Old version required to specify per-vertex clipping
|
||||||
|
// rectangle and unofficial GSlateScissorRect to correctly clip custom vertices made with FSlateDrawElement.
|
||||||
|
#define ENGINE_COMPATIBILITY_LEGACY_CLIPPING_API BELOW_ENGINE_VERSION(4, 17)
|
||||||
|
|
||||||
|
// Starting from version 4.18 FPaths::GameSavedDir() has been superseded by FPaths::ProjectSavedDir().
|
||||||
|
#define ENGINE_COMPATIBILITY_LEGACY_SAVED_DIR BELOW_ENGINE_VERSION(4, 18)
|
||||||
|
|
||||||
|
// Starting from version 4.18 we have support for dual key bindings.
|
||||||
|
#define ENGINE_COMPATIBILITY_SINGLE_KEY_BINDING BELOW_ENGINE_VERSION(4, 18)
|
||||||
|
|
||||||
|
// Starting from version 4.18 FStringClassReference is replaced by FSoftClassPath. The new header contains a typedef
|
||||||
|
// that renames FStringClassReference to FSoftClassPath, so it is still possible tu use the old type name in code.
|
||||||
|
// The old header forwards to the new one but if used it outputs a warning, so we want to avoid it.
|
||||||
|
#define ENGINE_COMPATIBILITY_LEGACY_STRING_CLASS_REF BELOW_ENGINE_VERSION(4, 18)
|
Loading…
Reference in New Issue
Block a user