Skip to content

Commit 0163698

Browse files
blakdragan7blakdragan7
andcommitted
fix(unreal): several fixes needed for polish (#11210) 8544f4a98c
* serveral fixes * not needed file Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
1 parent ce0b93f commit 0163698

File tree

6 files changed

+20
-178
lines changed

6 files changed

+20
-178
lines changed

.rive_head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f38d54d8e466ed5cb2ba1246bc79510ceaa5e6cf
1+
8544f4a98cdd7a99b0ab6af23bde7154b10c6cc2

Source/Rive/Private/Slate/SRiveLeafWidget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ int32 SRiveLeafWidget::OnPaint(const FPaintArgs& Args,
278278
if (!bParentEnabled)
279279
return LayerId;
280280

281+
// Don't try to draw if we don't have an artboard.
282+
if (!Artboard.IsValid())
283+
return LayerId;
284+
281285
RiveRendererDrawElement->SetRenderingBounds(
282286
AllottedGeometry.GetRenderBoundingRect());
283287
RiveRendererDrawElement->SetClipRect(MyCullingRect);

Source/RiveEditor/Private/Factories/RiveActorFactory.cpp

Lines changed: 0 additions & 65 deletions
This file was deleted.

Source/RiveEditor/Private/Factories/RiveActorFactory.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

Source/RiveEditor/Private/Factories/RiveRenderTargetFactory.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ URiveRenderTarget2D* FRiveRenderTargetFactory::CreateRenderTarget()
4040

4141
RiveRenderTarget2D->RiveDescriptor.RiveFile = RiveFile;
4242

43-
RiveRenderTarget2D->InitAutoFormat(256, 256);
43+
RiveRenderTarget2D->bSupportsUAV = true;
44+
RiveRenderTarget2D->InitCustomFormat(256, 256, PF_R8G8B8A8, false);
4445
RiveRenderTarget2D->InitRiveRenderTarget2D();
4546

4647
return RiveRenderTarget2D;

Source/RiveEditor/Private/Factories/RiveWidgetFactory.cpp

Lines changed: 13 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,21 @@ bool FRiveWidgetFactory::CreateWidgetStructure(
9999

100100
if (URiveWidget* RiveWidget = Cast<URiveWidget>(Widget))
101101
{
102+
FString StateMachineName = "";
103+
FString ArtboardName = "";
104+
105+
if (RiveFile->ArtboardDefinitions.Num())
106+
{
107+
ArtboardName = RiveFile->ArtboardDefinitions[0].Name;
108+
if (RiveFile->ArtboardDefinitions[0].StateMachineNames.Num())
109+
StateMachineName =
110+
RiveFile->ArtboardDefinitions[0].StateMachineNames[0];
111+
}
112+
102113
RiveWidget->RiveDescriptor =
103114
FRiveDescriptor{RiveFile,
104-
"",
105-
"",
115+
ArtboardName,
116+
StateMachineName,
106117
false,
107118
ERiveFitType::Contain,
108119
ERiveAlignment::Center};
@@ -215,75 +226,4 @@ bool FRiveWidgetFactory::Create()
215226
return true;
216227
}
217228

218-
namespace
219-
{
220-
static void SpawnRiveWidgetActor(const FToolMenuContext& MenuContext)
221-
{
222-
if (const UContentBrowserAssetContextMenuContext* Context =
223-
UContentBrowserAssetContextMenuContext::FindContextWithAssets(
224-
MenuContext))
225-
{
226-
TArray<URiveFile*> RiveFiles =
227-
Context->LoadSelectedObjects<URiveFile>();
228-
for (URiveFile* RiveFile : RiveFiles)
229-
{
230-
if (UWorld* World = GEditor->GetEditorWorldContext().World())
231-
{
232-
ARiveWidgetActor* NewActor =
233-
Cast<ARiveWidgetActor>(World->SpawnActor<ARiveWidgetActor>(
234-
FVector::ZeroVector,
235-
FRotator::ZeroRotator,
236-
FActorSpawnParameters()));
237-
238-
if (NewActor)
239-
{
240-
NewActor->SetWidgetClass(URiveWidget::StaticClass());
241-
}
242-
}
243-
}
244-
}
245-
}
246-
247-
static FDelayedAutoRegisterHelper DelayedAutoRegister(
248-
EDelayedRegisterRunPhase::EndOfEngineInit,
249-
[] {
250-
UToolMenus::RegisterStartupCallback(
251-
FSimpleMulticastDelegate::FDelegate::CreateLambda([]() {
252-
FToolMenuOwnerScoped OwnerScoped(UE_MODULE_NAME);
253-
UToolMenu* Menu =
254-
UE::ContentBrowser::ExtendToolMenu_AssetContextMenu(
255-
URiveFile::StaticClass());
256-
257-
FToolMenuSection& Section =
258-
Menu->FindOrAddSection("GetAssetActions");
259-
Section.AddDynamicEntry(
260-
TEXT("Rive"),
261-
FNewToolMenuSectionDelegate::CreateLambda(
262-
[](FToolMenuSection& InSection) {
263-
{
264-
const TAttribute<FText> Label =
265-
LOCTEXT("RiveFile_SpawnRiveWidget",
266-
"Spawn Rive Widget Actor");
267-
const TAttribute<FText> ToolTip =
268-
LOCTEXT("RiveFile_SpawnRiveWidgetTooltip",
269-
"Spawn Rive Widget Actors.");
270-
const FSlateIcon Icon =
271-
FSlateIcon(FAppStyle::GetAppStyleSetName(),
272-
"ClassIcon.Texture2D");
273-
const FToolMenuExecuteAction UIAction =
274-
FToolMenuExecuteAction::CreateStatic(
275-
&SpawnRiveWidgetActor);
276-
277-
InSection.AddMenuEntry(
278-
"RiveFile_SpawnRiveWidget",
279-
Label,
280-
ToolTip,
281-
Icon,
282-
UIAction);
283-
}
284-
}));
285-
}));
286-
});
287-
} // namespace
288-
289229
#undef LOCTEXT_NAMESPACE

0 commit comments

Comments
 (0)