Skip to content

Commit

Permalink
Fix packaging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MoxAlehin committed Oct 26, 2024
1 parent 61c5138 commit 71ea28a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 46 deletions.
80 changes: 41 additions & 39 deletions Source/ColorRamp/Private/MaterialExpressionColorRamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ UMaterialExpressionColorRamp::UMaterialExpressionColorRamp(const FObjectInitiali
MenuCategories.Add(LOCTEXT( "Gradient", "Gradient" ));
}

void UMaterialExpressionColorRamp::RebuildOutputs()
{
Outputs.Reset(1);
bShowOutputNameOnPin = false;
Outputs.Add(FExpressionOutput(TEXT("")));
}

#if WITH_EDITOR

int32 UMaterialExpressionColorRamp::Compile(FMaterialCompiler* Compiler, int32 OutputIndex)
{
int32 AlphaIndex = Alpha.Expression ? Alpha.Compile(Compiler) : Compiler->Constant(ConstAlpha);
Expand Down Expand Up @@ -92,41 +101,41 @@ TArrayView<FExpressionInput*> UMaterialExpressionColorRamp::GetInputsView()

switch (PinType)
{
case EPinType::ShowColorPinsDistributed:
case EPinType::ShowColorPins:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Color);
}
break;
case EPinType::ShowColorPinsDistributed:
case EPinType::ShowColorPins:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Color);
}
break;

case EPinType::ShowPositionPins:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Position);
}
break;
case EPinType::ShowPositionPins:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Position);
}
break;

case EPinType::ShowAllPinsGroup:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Color);
}
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Position);
}
break;
case EPinType::ShowAllPinsGroup:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Color);
}
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Position);
}
break;

case EPinType::ShowAllPinsAlternate:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Color);
CachedInputs.Add(&Point.Position);
}
break;
default:
break;
case EPinType::ShowAllPinsAlternate:
for (FColorRampPoint& Point : ColorPoints)
{
CachedInputs.Add(&Point.Color);
CachedInputs.Add(&Point.Position);
}
break;
default:
break;
}

return CachedInputs;
Expand Down Expand Up @@ -252,7 +261,6 @@ FName UMaterialExpressionColorRamp::GetInputName(int32 InputIndex) const
return NAME_None;
}

#if WITH_EDITOR
void UMaterialExpressionColorRamp::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
RebuildOutputs();
Expand Down Expand Up @@ -293,12 +301,6 @@ void UMaterialExpressionColorRamp::PostEditChangeProperty(FPropertyChangedEvent&
Super::PostEditChangeProperty(PropertyChangedEvent);
}

void UMaterialExpressionColorRamp::RebuildOutputs()
{
Outputs.Reset(1);
bShowOutputNameOnPin = false;
Outputs.Add(FExpressionOutput(TEXT("")));
}
#endif

#undef LOCTEXT_NAMESPACE
10 changes: 3 additions & 7 deletions Source/ColorRamp/Public/MaterialExpressionColorRamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class UMaterialExpressionColorRamp : public UMaterialExpression
{
GENERATED_UCLASS_BODY()

public:

UPROPERTY(meta = (RequiredInput = "false", ToolTip = "Defaults to 'ConstAlpha' if not specified"))
FExpressionInput Alpha;

Expand All @@ -72,18 +70,16 @@ class UMaterialExpressionColorRamp : public UMaterialExpression
UPROPERTY(EditAnywhere, Category = "MaterialExpressionColorRamp")
TArray<FColorRampPoint> ColorPoints;

void RebuildOutputs();

#if WITH_EDITOR
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
void RebuildOutputs();
#endif

virtual int32 Compile(class FMaterialCompiler* Compiler, int32 OutputIndex) override;
virtual void GetCaption(TArray<FString>& OutCaptions) const override;
virtual TArrayView<FExpressionInput*> GetInputsView() override;
virtual FExpressionInput* GetInput(int32 InputIndex) override;
virtual FName GetInputName(int32 InputIndex) const override;
virtual uint32 GetInputType(int32 InputIndex) override { return MCT_Float; }

private:
static int32 ApplyEaseInOutInterpolation(FMaterialCompiler* Compiler, int32 AlphaIndex, int32 PrevPositionIndex, int32 PositionIndex);
#endif
};

0 comments on commit 71ea28a

Please sign in to comment.