Skip to content

Commit

Permalink
fix: added rhi check for unsupported platforms
Browse files Browse the repository at this point in the history
On startup, the Rive plugin will now disable the RHI tech preview if on Mac platforms or UE5.3 on Windows.

Diffs=
479609dac1 fix: added rhi check for unsupported platforms (#9073)

Co-authored-by: Tod-Rive <[email protected]>
  • Loading branch information
Tod-Rive and Tod-Rive committed Feb 20, 2025
1 parent 9d9b473 commit 3f0b0d2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5153dac481f44db86b07528b35d31051b4118fff
479609dac10805641b9d66f8a98f3463ca30d033
31 changes: 30 additions & 1 deletion Source/RiveRenderer/Private/RiveRendererSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
// Fill out your copyright notice in the Description page of Project Settings.
// Copyright Rive, Inc. All rights reserved.

#include "RiveRendererSettings.h"

URiveRendererSettings::URiveRendererSettings() : bEnableRHITechPreview(false) {}

#if WITH_EDITOR
void URiveRendererSettings::PostInitProperties()
{
Super::PostInitProperties();

if (!bCanUseRHI)
{
bEnableRHITechPreview = false;
SaveConfig();
}
}

bool URiveRendererSettings::CanEditChange(const FProperty* InProperty) const
{
bool bParentValue = Super::CanEditChange(InProperty);

if (InProperty && InProperty->GetFName() ==
GET_MEMBER_NAME_CHECKED(URiveRendererSettings,
bEnableRHITechPreview))
{
// Only allow editing if running on Windows AND UE 5.4+
return bParentValue && bCanUseRHI;
}

return bParentValue;
}

#endif
22 changes: 15 additions & 7 deletions Source/RiveRenderer/Public/RiveRendererSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,35 @@
#include "Engine/DeveloperSettings.h"
#include "RiveRendererSettings.generated.h"

/**
*
*/
UCLASS(Config = Engine, DefaultConfig)
class RIVERENDERER_API URiveRendererSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
/**
*
*/
URiveRendererSettings();

UPROPERTY(EditAnywhere,
config,
Category = "Rive Experimental Settings",
DisplayName = "Enable RHI Technical Preview")
DisplayName = "Enable RHI Technical Preview",
META = (Tooltip = "Not available on Apple platforms or UE 5.3."))
bool bEnableRHITechPreview;

virtual FName GetCategoryName() const override
{
return FName(TEXT("Rive"));
}

#if WITH_EDITOR
virtual void PostInitProperties() override;
virtual bool CanEditChange(const FProperty* InProperty) const override;
#endif

private:
#if PLATFORM_APPLE || ENGINE_MAJOR_VERSION < 5 || \
(ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 4)
bool bCanUseRHI = false;
#else
bool bCanUseRHI = true;
#endif
};

0 comments on commit 3f0b0d2

Please sign in to comment.