Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus committed Jul 30, 2024
1 parent 6d7966f commit ea6215c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Source/EffectBox/Private/EffectBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ UEffectBox::UEffectBox()

TSharedRef<SWidget> UEffectBox::RebuildWidget()
{
auto Content = SNullWidget::NullWidget;
if (const auto* ContentSlot = GetContentSlot())
{
if (ContentSlot->Content)
{
Content = ContentSlot->Content->TakeWidget();
}
}

MyEffectBox = SNew(SEffectBox)
.IsDesignTime(IsDesignTime())
.AllowFastUpdate(bAllowFastUpdate)
[GetContentSlot() && GetContentSlot()->Content
? GetContentSlot()->Content->TakeWidget()
: SNullWidget::NullWidget];
[Content];

return MyEffectBox.ToSharedRef();
}
Expand Down Expand Up @@ -56,6 +62,7 @@ void UEffectBox::SynchronizeProperties()
return;
}

MyEffectBox->SetAllowFastUpdate(bAllowFastUpdate);
MyEffectBox->SetEffectMaterial(EffectMaterial, TextureParameter);
}

Expand Down
8 changes: 8 additions & 0 deletions Source/EffectBox/Private/SEffectBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ UMaterialInstanceDynamic* SEffectBox::GetEffectMaterial() const
return DynamicEffect.Get();
}

void SEffectBox::SetAllowFastUpdate(bool bAllowFastUpdate)
{
if (VirtualWindow)
{
VirtualWindow->SetAllowFastUpdate(bAllowFastUpdate);
}
}

int32 SEffectBox::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
SCOPE_CYCLE_SWIDGET(this);
Expand Down
2 changes: 2 additions & 0 deletions Source/EffectBox/Public/SEffectBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ class EFFECTBOX_API SEffectBox final : public SCompoundWidget
void SetEffectMaterial(UMaterialInterface* EffectMaterial, const FName& TextureParameter);

UMaterialInstanceDynamic* GetEffectMaterial() const;

void SetAllowFastUpdate(bool bAllowFastUpdate);
};

0 comments on commit ea6215c

Please sign in to comment.