Skip to content

Commit 22fbb7d

Browse files
committed
Added LintRule for LightingNeedsToBeRebuilt
1 parent 5cd2216 commit 22fbb7d

4 files changed

Lines changed: 53 additions & 0 deletions

File tree

604 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) 2021-2025, Forschungszentrum Jülich GmbH. All rights reserved.
2+
3+
4+
#include "LintRules/LintRule_Level_LightingNeedsToRebuilt.h"
5+
#include "EngineModule.h"
6+
7+
ULintRule_Level_LightingNeedsToRebuilt::ULintRule_Level_LightingNeedsToRebuilt(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {
8+
bRequiresGameThread = true;
9+
}
10+
11+
bool ULintRule_Level_LightingNeedsToRebuilt::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray<FLintRuleViolation>& OutRuleViolations) const {
12+
if (!Cast<UWorld>(ObjectToLint)) {
13+
return true;
14+
}
15+
16+
return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations);
17+
}
18+
19+
bool ULintRule_Level_LightingNeedsToRebuilt::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray<FLintRuleViolation>& OutRuleViolations) const {
20+
UWorld* World = CastChecked<UWorld>(ObjectToLint);
21+
22+
GetRendererModule().UpdateMapNeedsLightingFullyRebuiltState(World);
23+
if (World->NumLightingUnbuiltObjects > 0 || World->NumUnbuiltReflectionCaptures > 0) {
24+
const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_Level_LightingNeedsToRebuilt", "Rebuild the Lighting of {0}");
25+
OutRuleViolations.Push(
26+
FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, FText::FromString(World->GetMapName())))
27+
);
28+
return false;
29+
}
30+
31+
return true;
32+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2021-2025, Forschungszentrum Jülich GmbH. All rights reserved.
2+
3+
#pragma once
4+
5+
#include "CoreMinimal.h"
6+
#include "LintRule.h"
7+
#include "LintRule_Level_LightingNeedsToRebuilt.generated.h"
8+
9+
10+
UCLASS(BlueprintType, Blueprintable)
11+
class LINTER_API ULintRule_Level_LightingNeedsToRebuilt : public ULintRule {
12+
GENERATED_BODY()
13+
14+
public:
15+
ULintRule_Level_LightingNeedsToRebuilt(const FObjectInitializer& ObjectInitializer);
16+
17+
virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray<FLintRuleViolation>& OutRuleViolations) const override;
18+
19+
protected:
20+
virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray<FLintRuleViolation>& OutRuleViolations) const override;
21+
};

0 commit comments

Comments
 (0)