Skip to content

Instantly share code, notes, and snippets.

@rtm223
rtm223 / RTMHUDBase.cpp
Created June 12, 2024 18:42
Base Class Unreal HUD that can hide all widgets via the ShowHUD console command and when you enter simulate
#include "UI/HUD/RTMHUDBase.h"
#include "Engine/LocalPlayer.h"
#include "GameFramework/PlayerController.h"
#include "Widgets/SViewport.h"
namespace RTMHUDBaseStatics
{
SWidget* FindWidgetByTypeRecursive(SWidget* root, FName widgetType)
{
SWidget* ret = nullptr;
@rtm223
rtm223 / RTMCursorReceiverWidget.cpp
Created October 10, 2022 15:13
Cursor Receiver Widget
// Copyright (c) Richard Meredith AB. All Rights Reserved
#include "UI/UMG/RTMCursorReceiverWidget.h"
#include "UI/Slate/SRTMCursorReceiver.h"
#define LOCTEXT_NAMESPACE "RTM"
TSharedRef<SWidget> URTMCursorReceiverWidget::RebuildWidget()
{
Receiver = SNew(SRTMCursorReceiver)
@rtm223
rtm223 / RTMNavBoundaryComponent.cpp
Last active November 9, 2022 03:19
UE4/5 navmesh helper to detect Navmesh boundaries
#include "RTMNavBoundaryComponent.h"
#include "NavigationSystem.h"
#include "NavMesh/RecastHelpers.h"
#include "NavMesh/RecastNavMesh.h"
#include "Navmesh/Public/Detour/DetourNavMesh.h"
const FRTMNavBoundary FRTMNavBoundary::EMPTY = {{}};
DECLARE_LOG_CATEGORY_CLASS(LogRTMNavBoundaryComponent, Log, All)
@rtm223
rtm223 / RTMEnumOperators.h
Last active September 1, 2022 22:47
cpp Enum Operators (for class enums)
// Copyright (c) Richard Meredith AB. All Rights Reserved
// ReSharper disable once CppMissingIncludeGuard
//
// Adds all(?) overloads for Scoped Enumerations (Enum Classes).
// Multiple inclusions allowed. #define TEnum (and any options) for each
//
// Usage:
// namespace MyNameSpace // namespace optional
// {
// enum class EMyEnum : uint8
@rtm223
rtm223 / RTMBlueprintCompiler_MustImplementFunction.cpp
Last active July 20, 2023 19:22
UFUNCTION(meta=(MustImplementInBlueprint))
#include "RTMBlueprintCompiler_MustImplementFunction.h"
#define LOCTEXT_NAMESPACE "RTMValidator_MustImplementFunction"
bool URTMBlueprintCompiler_MustImplementFunction::CanValidateBlueprint(const UBlueprint* blueprint) const
{
switch(blueprint->BlueprintType)
{
case BPTYPE_Normal:
case BPTYPE_Const: