Config for building for Quest

This commit is contained in:
2024-05-29 11:53:41 +03:00
parent 15cbcf8752
commit 0db31c34d1
353 changed files with 74095 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
#pragma once
#include "Modules/ModuleManager.h"
//-------------------------------------------------------------------------------------------------
// IOculusXRProjectSetupToolModule
//-------------------------------------------------------------------------------------------------
/**
* The public interface to this module.
*/
class IOculusXRProjectSetupToolModule : public IModuleInterface
{
public:
/**
* Singleton-like access to this module's interface. This is just for convenience!
* Beware of calling this during the shutdown phase, though. Your module might have been unloaded already.
*
* @return Returns singleton instance, loading the module on demand if needed
*/
static inline IOculusXRProjectSetupToolModule& Get()
{
return FModuleManager::LoadModuleChecked<IOculusXRProjectSetupToolModule>("OculusXRProjectSetupTool");
}
/** Show the project setup tool window */
virtual void ShowProjectSetupTool(const FString& Origin) = 0;
};

View File

@@ -0,0 +1,52 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
#pragma once
#include "CoreMinimal.h"
#include "OculusXRSetupRule.h"
#include "OculusXRPSTSettings.generated.h"
/**
* Meta XR Project Setup tool Settings
*/
UCLASS(config = EditorPerProjectUserSettings)
class OCULUSXRPROJECTSETUPTOOL_API UOculusXRPSTSettings : public UObject
{
GENERATED_BODY()
public:
/**
* @brief Ignored rules by developer
*/
UPROPERTY(config)
TSet<FName> IgnoredRules = {};
/**
* @brief Selected platform for development
*/
UPROPERTY(config)
uint32 CurrentPlatform = static_cast<uint32>(MetaQuest_All);
/**
* @brief If tools should periodically check if list of rules and rules' status
*/
UPROPERTY(config, EditAnywhere, Category = MetaXR)
bool bBackGroundChecks = true;
/**
* @brief If build should fail if critical rule is not applied
*/
UPROPERTY(config, EditAnywhere, Category = MetaXR)
bool bStopBuildOnUnAppliedCriticalItems = false;
/**
* @brief If guided tutorial has been completed/skipped
*/
UPROPERTY(config, EditAnywhere, Category = MetaXR)
bool bGuidedTutorialComplete = false;
/**
* @brief If guided tutorial showed
*/
UPROPERTY(config, EditAnywhere, Category = MetaXR)
bool bShowGuidedTutorial = true;
};

View File

@@ -0,0 +1,100 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
#pragma once
#include "CoreMinimal.h"
#include "OculusXRSetupRule.h"
#include "Developer/LauncherServices/Public/ILauncher.h"
#include "Subsystems/EngineSubsystem.h"
#include "OculusXRRuleProcessorSubsystem.generated.h"
/**
* The rule processor handles registration and querying of rules
*/
UCLASS()
class OCULUSXRPROJECTSETUPTOOL_API UOculusXRRuleProcessorSubsystem final : public UEngineSubsystem
{
GENERATED_BODY()
public:
struct RuleStatus
{
unsigned PendingRequiredRulesCount = 0;
unsigned PendingRecommendedRulesCount = 0;
};
/**
* Initialize the subsystem. USubsystem override
*/
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
/**
* De-initializes the subsystem. USubsystem override
*/
virtual void Deinitialize() override;
/**
* Register a rule
*
* @return true if successfully registered
*/
bool RegisterRule(const SetupRulePtr& Rule);
/**
* Unregister a rule
*
* @return true if successfully unregistered
*/
bool UnregisterRule(const SetupRulePtr& Rule);
/**
* Unregister all rules
*/
void UnregisterAllRules();
/**
* Fetch all rules
*/
const TSet<SetupRulePtr, FSetupRuleKeyFunc>& GetRules() const;
/**
* Fetch rule with given `Id`
*/
SetupRulePtr GetRule(const FName& Id) const;
/**
* Returns if there are dynamic lights in project
*/
bool DynamicLightsExistInProject() const;
void SendSummaryEvent();
void SendSummaryEvent(ESetupRulePlatform Platform) const;
/**
* Refresh state
*/
void Refresh();
/**
* Returns number of not applied critical and recommended rules
*/
RuleStatus UnAppliedRulesStatus(ESetupRulePlatform Platform) const;
private:
void PopulateDynamicLights();
void RegisterRules(const TArray<SetupRulePtr>& Rules);
//** A set containing all the registered rules
TSet<SetupRulePtr, FSetupRuleKeyFunc> Rules = {};
// Dynamic lights in project
TMap<FString, TWeakObjectPtr<ULightComponentBase>> DynamicLights;
// Launcher handles
FDelegateHandle LauncherCallbackHandle;
void OnLauncherCreated(ILauncherRef Launcher);
void OnLauncherWorkerStarted(ILauncherWorkerPtr LauncherWorker, ILauncherProfileRef Profile);
void OnPIEEnded(bool bIsSimulating);
TArray<SetupRulePtr> UnAppliedRulesForPlatform(ESetupRulePlatform Platform, const TSet<ESetupRuleSeverity>& Severities) const;
};

View File

@@ -0,0 +1,145 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
#pragma once
#include "CoreMinimal.h"
/**
* Rule categories
*/
enum class ESetupRuleCategory : uint8
{
Compatibility = 0,
Rendering = 1,
Quality = 2,
Physics = 3,
Plugins = 4,
Features = 5,
Miscellaneous = 6
};
/**
* Rule severities
*/
enum class ESetupRuleSeverity : uint8
{
Warning = 0,
Performance = 1,
Critical = 2
};
/**
* Rule platforms
*/
UENUM()
enum class ESetupRulePlatform : uint32
{
//None
None = 0,
// Link
MetaLink = 0x1 UMETA(DisplayName = "Link"),
// Quest
MetaQuest_2 = 0x2 UMETA(DisplayName = "Quest 2"),
MetaQuest_3 = 0x4 UMETA(DisplayName = "Quest 3"),
MetaQuest_Pro = 0x8 UMETA(DisplayName = "Quest Pro")
};
ENUM_CLASS_FLAGS(ESetupRulePlatform)
static constexpr ESetupRulePlatform MetaQuest_All = ESetupRulePlatform::MetaQuest_2 | ESetupRulePlatform::MetaQuest_3 | ESetupRulePlatform::MetaQuest_Pro;
static constexpr ESetupRulePlatform All_Platforms = MetaQuest_All | ESetupRulePlatform::MetaLink;
class OCULUSXRPROJECTSETUPTOOL_API ISetupRule
{
public:
ISetupRule(
const FName& InId,
const FText& InDisplayName,
const FText& InDescription,
const ESetupRuleCategory InCategory,
const ESetupRuleSeverity InSeverity,
const ESetupRulePlatform InPlatform = All_Platforms);
virtual ~ISetupRule() = default;
virtual bool IsApplied() const = 0;
// Returns true if rule is valid. For example, Rule that checks if passthrough enabled is checked and can be applied only if PassthroughComponent is added.
virtual bool IsValid();
bool IsIgnored() const;
void SetIgnoreRule(bool bIgnore, bool bSendMetrics = true);
const FName& GetId() const;
FText GetDisplayName() const;
FText GetDescription() const;
ESetupRuleCategory GetCategory() const;
ESetupRuleSeverity GetSeverity() const;
ESetupRulePlatform GetPlatform() const;
void Apply(bool& OutShouldRestartEditor);
protected:
virtual void ApplyImpl(bool& OutShouldRestartEditor) = 0;
private:
/** Id for the rule */
FName Id;
/** Display name of the rule */
FText DisplayName;
/** Description of the rule */
FText Description;
/** Category of the rule */
ESetupRuleCategory Category;
/** Severity of the rule */
ESetupRuleSeverity Severity;
/** Platforms the rule applies to */
ESetupRulePlatform Platform;
/** Is rule ignored */
bool bIsIgnored = false;
};
typedef TSharedPtr<ISetupRule, ESPMode::ThreadSafe> SetupRulePtr;
/**
* Setup rule symbol database hash.
*/
struct FSetupRuleKeyFunc
{
enum
{
bAllowDuplicateKeys = 0
};
typedef TCallTraits<FName>::ParamType KeyInitType;
typedef TCallTraits<SetupRulePtr>::ParamType ElementInitType;
/**
* @return The key used to index the given element.
*/
static FORCEINLINE KeyInitType GetSetKey(ElementInitType Element)
{
return Element->GetId();
}
/**
* @return True if the keys match.
*/
static FORCEINLINE bool Matches(KeyInitType A, KeyInitType B)
{
return A == B;
}
/** Calculates a hash index for a key. */
static FORCEINLINE uint32 GetKeyHash(KeyInitType Key)
{
return GetTypeHash(Key);
}
};