From 1db8237230d46c3e27f1087cc320ac7cc5376f78 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Mon, 1 Apr 2024 14:09:16 -0500 Subject: [PATCH 01/34] Add mouse events to artboard blueprints, passing data down to the state machine of the artboard --- Source/RiveCore/Private/RiveArtboard.cpp | 27 ++++++++++++++++++++++++ Source/RiveCore/Public/RiveArtboard.h | 8 +++++++ 2 files changed, 35 insertions(+) diff --git a/Source/RiveCore/Private/RiveArtboard.cpp b/Source/RiveCore/Private/RiveArtboard.cpp index f7fc146e..cf447a3c 100644 --- a/Source/RiveCore/Private/RiveArtboard.cpp +++ b/Source/RiveCore/Private/RiveArtboard.cpp @@ -263,6 +263,33 @@ bool URiveArtboard::TriggerNamedRiveEvent(const FString& EventName, float Report return false; } +void URiveArtboard::MouseButtonDown(const FVector2f& NewPosition) +{ + UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); + if (StateMachine) + { + StateMachine->OnMouseButtonDown(NewPosition); + } +} + +void URiveArtboard::MouseButtonUp(const FVector2f& NewPosition) +{ + UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); + if (StateMachine) + { + StateMachine->OnMouseButtonUp(NewPosition); + } +} + +void URiveArtboard::MouseMove(const FVector2f& NewPosition) +{ + UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); + if (StateMachine) + { + StateMachine->OnMouseMove(NewPosition); + } +} + FVector2f URiveArtboard::GetLocalCoordinate(const FVector2f& InPosition, const FIntPoint& InTextureSize, ERiveAlignment InAlignment, ERiveFitType InFit) const { FVector2f Alignment = FRiveAlignment::GetAlignment(InAlignment); diff --git a/Source/RiveCore/Public/RiveArtboard.h b/Source/RiveCore/Public/RiveArtboard.h index ac1868f3..396ec3d3 100644 --- a/Source/RiveCore/Public/RiveArtboard.h +++ b/Source/RiveCore/Public/RiveArtboard.h @@ -95,7 +95,15 @@ class RIVECORE_API URiveArtboard : public UObject UFUNCTION(BlueprintCallable, Category = Rive) bool TriggerNamedRiveEvent(const FString& EventName, float ReportedDelaySeconds); + UFUNCTION(BlueprintCallable, Category = Rive) + void MouseButtonDown(const FVector2f& NewPosition); + + UFUNCTION(BlueprintCallable, Category = Rive) + void MouseButtonUp(const FVector2f& NewPosition); + UFUNCTION(BlueprintCallable, Category = Rive) + void MouseMove(const FVector2f& NewPosition); + // Used to convert from a given point (InPosition) on a texture local position // to the position for this artboard, taking into account alignment, fit, and an offset (if custom translation has been used) UFUNCTION(BlueprintCallable, Category = Rive) From dbd1ec20388f8b4bc3770b1ee157b365cd412c6a Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 3 Apr 2024 20:11:54 -0500 Subject: [PATCH 02/34] add PointerExit support, rename all "MouseXYZ" functions to "PointerXYZ", expose PointerExit in blueprint --- Config/DefaultRive.ini | 4 +++ .../Rive/Private/Slate/RiveSceneViewport.cpp | 6 ++-- Source/RiveCore/Private/RiveArtboard.cpp | 21 ++++++++---- Source/RiveCore/Private/URStateMachine.cpp | 32 +++++++++++++++---- Source/RiveCore/Public/RiveArtboard.h | 9 ++++-- Source/RiveCore/Public/URStateMachine.h | 8 +++-- 6 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 Config/DefaultRive.ini diff --git a/Config/DefaultRive.ini b/Config/DefaultRive.ini new file mode 100644 index 00000000..bbe06015 --- /dev/null +++ b/Config/DefaultRive.ini @@ -0,0 +1,4 @@ +[CoreRedirects] ++FunctionRedirects=(OldName="/Script/RiveCore.RiveArtboard.MouseButtonDown",NewName="/Script/RiveCore.RiveArtboard.PointerDown") ++FunctionRedirects=(OldName="/Script/RiveCore.RiveArtboard.MouseButtonUp",NewName="/Script/RiveCore.RiveArtboard.PointerUp") ++FunctionRedirects=(OldName="/Script/RiveCore.RiveArtboard.MouseMove",NewName="/Script/RiveCore.RiveArtboard.PointerMove") \ No newline at end of file diff --git a/Source/Rive/Private/Slate/RiveSceneViewport.cpp b/Source/Rive/Private/Slate/RiveSceneViewport.cpp index 7fd1f88b..70c49642 100644 --- a/Source/Rive/Private/Slate/RiveSceneViewport.cpp +++ b/Source/Rive/Private/Slate/RiveSceneViewport.cpp @@ -43,7 +43,7 @@ FReply FRiveSceneViewport::OnMouseButtonDown(const FGeometry& MyGeometry, const { if (InStateMachine) { - InStateMachine->OnMouseButtonDown(InputCoordinates); + InStateMachine->PointerDown(InputCoordinates); } }); } @@ -59,7 +59,7 @@ FReply FRiveSceneViewport::OnMouseButtonUp(const FGeometry& MyGeometry, const FP { if (InStateMachine) { - InStateMachine->OnMouseButtonUp(InputCoordinates); + InStateMachine->PointerUp(InputCoordinates); } }); } @@ -70,7 +70,7 @@ FReply FRiveSceneViewport::OnMouseMove(const FGeometry& MyGeometry, const FPoint { if (InStateMachine) { - InStateMachine->OnMouseMove(InputCoordinates); + InStateMachine->PointerMove(InputCoordinates); } }); diff --git a/Source/RiveCore/Private/RiveArtboard.cpp b/Source/RiveCore/Private/RiveArtboard.cpp index cf447a3c..a745d1ab 100644 --- a/Source/RiveCore/Private/RiveArtboard.cpp +++ b/Source/RiveCore/Private/RiveArtboard.cpp @@ -263,30 +263,39 @@ bool URiveArtboard::TriggerNamedRiveEvent(const FString& EventName, float Report return false; } -void URiveArtboard::MouseButtonDown(const FVector2f& NewPosition) +void URiveArtboard::PointerDown(const FVector2f& NewPosition) { UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); if (StateMachine) { - StateMachine->OnMouseButtonDown(NewPosition); + StateMachine->PointerDown(NewPosition); } } -void URiveArtboard::MouseButtonUp(const FVector2f& NewPosition) +void URiveArtboard::PointerUp(const FVector2f& NewPosition) { UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); if (StateMachine) { - StateMachine->OnMouseButtonUp(NewPosition); + StateMachine->PointerUp(NewPosition); } } -void URiveArtboard::MouseMove(const FVector2f& NewPosition) +void URiveArtboard::PointerMove(const FVector2f& NewPosition) { UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); if (StateMachine) { - StateMachine->OnMouseMove(NewPosition); + StateMachine->PointerMove(NewPosition); + } +} + +void URiveArtboard::PointerExit(const FVector2f& NewPosition) +{ + UE::Rive::Core::FURStateMachine* StateMachine = GetStateMachine(); + if (StateMachine) + { + StateMachine->PointerExit(NewPosition); } } diff --git a/Source/RiveCore/Private/URStateMachine.cpp b/Source/RiveCore/Private/URStateMachine.cpp index 424bfd4c..adb5fff8 100644 --- a/Source/RiveCore/Private/URStateMachine.cpp +++ b/Source/RiveCore/Private/URStateMachine.cpp @@ -227,12 +227,12 @@ void UE::Rive::Core::FURStateMachine::SetNumberValue(const FString& InPropertyNa UE_LOG(LogRiveCore, Error, TEXT("Could not get the number property with given name '%s' as we could not find it."), *InPropertyName); } -bool UE::Rive::Core::FURStateMachine::OnMouseButtonDown(const FVector2f& NewPosition) +bool UE::Rive::Core::FURStateMachine::PointerDown(const FVector2f& NewPosition) { Renderer::IRiveRenderer* RiveRenderer = UE::Rive::Renderer::IRiveRendererModule::Get().GetRenderer(); if (!RiveRenderer) { - UE_LOG(LogRiveCore, Error, TEXT("Failed to call OnMouseButtonDown on the StateMachine as we do not have a valid renderer.")); + UE_LOG(LogRiveCore, Error, TEXT("Failed to call PointerDown on the StateMachine as we do not have a valid renderer.")); return false; } @@ -247,12 +247,12 @@ bool UE::Rive::Core::FURStateMachine::OnMouseButtonDown(const FVector2f& NewPosi return true; } -bool UE::Rive::Core::FURStateMachine::OnMouseMove(const FVector2f& NewPosition) +bool UE::Rive::Core::FURStateMachine::PointerMove(const FVector2f& NewPosition) { Renderer::IRiveRenderer* RiveRenderer = UE::Rive::Renderer::IRiveRendererModule::Get().GetRenderer(); if (!RiveRenderer) { - UE_LOG(LogRiveCore, Error, TEXT("Failed to call OnMouseMove on the StateMachine as we do not have a valid renderer.")); + UE_LOG(LogRiveCore, Error, TEXT("Failed to call PointerMove on the StateMachine as we do not have a valid renderer.")); return false; } @@ -267,12 +267,12 @@ bool UE::Rive::Core::FURStateMachine::OnMouseMove(const FVector2f& NewPosition) return true; } -bool UE::Rive::Core::FURStateMachine::OnMouseButtonUp(const FVector2f& NewPosition) +bool UE::Rive::Core::FURStateMachine::PointerUp(const FVector2f& NewPosition) { Renderer::IRiveRenderer* RiveRenderer = UE::Rive::Renderer::IRiveRendererModule::Get().GetRenderer(); if (!RiveRenderer) { - UE_LOG(LogRiveCore, Error, TEXT("Failed to call OnMouseButtonUp on the StateMachine as we do not have a valid renderer.")); + UE_LOG(LogRiveCore, Error, TEXT("Failed to call PointerUp on the StateMachine as we do not have a valid renderer.")); return false; } @@ -287,6 +287,26 @@ bool UE::Rive::Core::FURStateMachine::OnMouseButtonUp(const FVector2f& NewPositi return true; } +bool UE::Rive::Core::FURStateMachine::PointerExit(const FVector2f& NewPosition) +{ + Renderer::IRiveRenderer* RiveRenderer = UE::Rive::Renderer::IRiveRendererModule::Get().GetRenderer(); + if (!RiveRenderer) + { + UE_LOG(LogRiveCore, Error, TEXT("Failed to call PointerExit on the StateMachine as we do not have a valid renderer.")); + return false; + } + + FScopeLock Lock(&RiveRenderer->GetThreadDataCS()); + + if (!NativeStateMachinePtr) + { + return false; + } + + NativeStateMachinePtr->pointerExit({ NewPosition.X, NewPosition.Y }); + return true; +} + const rive::EventReport UE::Rive::Core::FURStateMachine::GetReportedEvent(int32 AtIndex) const { Renderer::IRiveRenderer* RiveRenderer = UE::Rive::Renderer::IRiveRendererModule::Get().GetRenderer(); diff --git a/Source/RiveCore/Public/RiveArtboard.h b/Source/RiveCore/Public/RiveArtboard.h index 396ec3d3..e61ddc57 100644 --- a/Source/RiveCore/Public/RiveArtboard.h +++ b/Source/RiveCore/Public/RiveArtboard.h @@ -96,13 +96,16 @@ class RIVECORE_API URiveArtboard : public UObject bool TriggerNamedRiveEvent(const FString& EventName, float ReportedDelaySeconds); UFUNCTION(BlueprintCallable, Category = Rive) - void MouseButtonDown(const FVector2f& NewPosition); + void PointerDown(const FVector2f& NewPosition); UFUNCTION(BlueprintCallable, Category = Rive) - void MouseButtonUp(const FVector2f& NewPosition); + void PointerUp(const FVector2f& NewPosition); UFUNCTION(BlueprintCallable, Category = Rive) - void MouseMove(const FVector2f& NewPosition); + void PointerMove(const FVector2f& NewPosition); + + UFUNCTION(BlueprintCallable, Category = Rive) + void PointerExit(const FVector2f& NewPosition); // Used to convert from a given point (InPosition) on a texture local position // to the position for this artboard, taking into account alignment, fit, and an offset (if custom translation has been used) diff --git a/Source/RiveCore/Public/URStateMachine.h b/Source/RiveCore/Public/URStateMachine.h index 7c05810c..8a32cd82 100644 --- a/Source/RiveCore/Public/URStateMachine.h +++ b/Source/RiveCore/Public/URStateMachine.h @@ -68,11 +68,13 @@ namespace UE::Rive::Core void SetNumberValue(const FString& InPropertyName, float NewValue); - bool OnMouseButtonDown(const FVector2f& NewPosition); + bool PointerDown(const FVector2f& NewPosition); - bool OnMouseMove(const FVector2f& NewPosition); + bool PointerMove(const FVector2f& NewPosition); - bool OnMouseButtonUp(const FVector2f& NewPosition); + bool PointerUp(const FVector2f& NewPosition); + + bool PointerExit(const FVector2f& NewPosition); const rive::EventReport GetReportedEvent(int32 AtIndex) const; From eabcbb6a5584389f008893079931d94411d03fd0 Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Thu, 4 Apr 2024 23:28:17 +1100 Subject: [PATCH 03/34] Initial fix to have OpenGL running in RHI Thread on Android --- .../Private/Logs/RiveRendererLog.h | 2 +- .../Platform/RiveRenderTargetOpenGL.cpp | 375 ++++++++++++++++-- .../Private/Platform/RiveRenderTargetOpenGL.h | 2 + .../Private/Platform/RiveRendererOpenGL.cpp | 10 +- .../RiveRenderer/Private/RiveRenderTarget.cpp | 2 +- .../RiveRenderer/Public/IRiveRendererModule.h | 2 +- 6 files changed, 348 insertions(+), 45 deletions(-) diff --git a/Source/RiveRenderer/Private/Logs/RiveRendererLog.h b/Source/RiveRenderer/Private/Logs/RiveRendererLog.h index f0035d86..ab415376 100644 --- a/Source/RiveRenderer/Private/Logs/RiveRendererLog.h +++ b/Source/RiveRenderer/Private/Logs/RiveRendererLog.h @@ -5,7 +5,7 @@ #include "CoreMinimal.h" #include "Logging/LogMacros.h" -DECLARE_LOG_CATEGORY_EXTERN(LogRiveRenderer, Display, All); +DECLARE_LOG_CATEGORY_EXTERN(LogRiveRenderer, Verbose, All); class FDebugLogger { diff --git a/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp b/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp index 4ca4e1dd..586b44bd 100644 --- a/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp +++ b/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp @@ -141,7 +141,7 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::EndFrame() const PLSRenderContextPtr->flush(FlushResources); //todo: android texture blink if we don't call glReadPixels? to investigate - TArray Points{ {0,0}, { 100,100 }, { 200,200 }, { 300,300 }}; + TArray Points{ {0,0}, { 100,100 }, { 200,200 }, { 300,300 }, { 400,400 }, { 500,500 }, { 600,600 }, { 700,700 } }; for (FIntVector2 Point : Points) { if (Point.X < GetWidth() && Point.Y < GetHeight()) @@ -154,45 +154,10 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::EndFrame() const // Reset RIVE_DEBUG_VERBOSE("PLSRenderContextPtr->unbindGLInternalResources() %p", PLSRenderContextPtr); - PLSRenderContextPtr->static_impl_cast()->unbindGLInternalResources(); + PLSRenderContextPtr->static_impl_cast()->unbindGLInternalResources(); //careful, need UE's internal state to match + // PLSRenderContextPtr->static_impl_cast()->invalidateGLState(); //careful, need UE's internal state to match - if (IsInRHIThread()) //todo: still not working, to be looked at - { - FOpenGLDynamicRHI* OpenGLDynamicRHI = static_cast(GetIOpenGLDynamicRHI()); - FOpenGLContextState& ContextState = OpenGLDynamicRHI->GetContextStateForCurrentContext(true); - - // UE_LOG(LogRiveRenderer, Display, TEXT("%s OpenGLDynamicRHI->RHIInvalidateCachedState()"), FDebugLogger::Ind(), PLSRenderContextPtr); - // OpenGLDynamicRHI->RHIInvalidateCachedState(); - - RIVE_DEBUG_VERBOSE("Pre RHIPostExternalCommandsReset"); - // Manual reset of GL commands to match the GL State before Rive Commands. Supposed to be handled by RHIPostExternalCommandsReset, TBC - FOpenGL::BindProgramPipeline(ContextState.Program); - glViewport(ContextState.Viewport.Min.X, ContextState.Viewport.Min.Y, ContextState.Viewport.Max.X - ContextState.Viewport.Min.X, ContextState.Viewport.Max.Y - ContextState.Viewport.Min.Y); - FOpenGL::DepthRange(ContextState.DepthMinZ, ContextState.DepthMaxZ); - ContextState.bScissorEnabled ? glEnable(GL_SCISSOR_TEST) : glDisable(GL_SCISSOR_TEST); - glScissor(ContextState.Scissor.Min.X, ContextState.Scissor.Min.Y, ContextState.Scissor.Max.X - ContextState.Scissor.Min.X, ContextState.Scissor.Max.Y - ContextState.Scissor.Min.Y); - glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); - - FOpenGL::PolygonMode(GL_FRONT_AND_BACK, ContextState.RasterizerState.FillMode); - glCullFace(ContextState.RasterizerState.CullMode); - glBindBuffer( GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); - glBindBuffer( GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); - glBindBuffer( GL_SHADER_STORAGE_BUFFER, ContextState.StorageBufferBound); - glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); - glBindBuffer( GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); - - for (int i = 0; i < ContextState.Textures.Num(); i++) - { - glActiveTexture(GL_TEXTURE0 + i); - glBindTexture(GL_TEXTURE_2D, ContextState.Textures[i].Resource); - } - glActiveTexture(ContextState.ActiveTexture); - glFrontFace(GL_CCW); - - OpenGLDynamicRHI->RHIPostExternalCommandsReset(); - - RIVE_DEBUG_VERBOSE("Post RHIPostExternalCommandsReset"); - } + ResetOpenGLState(); } void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::Render_RenderThread(FRHICommandListImmediate& RHICmdList, const TArray& RiveRenderCommands) @@ -202,6 +167,7 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::Render_RenderThread(F RHICmdList.EnqueueLambda([this, RiveRenderCommands = RiveRenderCommands](FRHICommandListImmediate& RHICmdList) { + // ResetOpenGLState(); Render_Internal(RiveRenderCommands); }); } @@ -280,9 +246,340 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::CacheTextureTarget_In RIVE_DEBUG_VERBOSE("PLSRenderContextGLImpl->setTargetTexture( %d )", OpenGLResourcePtr); CachedPLSRenderTargetOpenGL->setTargetTexture(OpenGLResourcePtr); RIVE_DEBUG_VERBOSE("CachedPLSRenderTargetOpenGL set to %p", CachedPLSRenderTargetOpenGL.get()); + + ResetOpenGLState(); #endif // WITH_RIVE } +void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::ResetOpenGLState() const +{ + if (IsInRHIThread()) //todo: still not working, to be looked at + { + FOpenGLDynamicRHI* OpenGLDynamicRHI = static_cast(GetIOpenGLDynamicRHI()); + // OpenGLDynamicRHI->RHIInvalidateCachedState(); // lose the 3D ground + + FOpenGLContextState& ContextState = OpenGLDynamicRHI->GetContextStateForCurrentContext(true); + + RIVE_DEBUG_VERBOSE("Pre RHIPostExternalCommandsReset"); + //// Manual reset of GL commands to match the GL State before Rive Commands. Supposed to be handled by RHIPostExternalCommandsReset, TBC + //// FOpenGL::BindProgramPipeline(ContextState.Program); + //// glViewport(ContextState.Viewport.Min.X, ContextState.Viewport.Min.Y, ContextState.Viewport.Max.X - ContextState.Viewport.Min.X, ContextState.Viewport.Max.Y - ContextState.Viewport.Min.Y); + //// FOpenGL::DepthRange(ContextState.DepthMinZ, ContextState.DepthMaxZ); + //// ContextState.bScissorEnabled ? glEnable(GL_SCISSOR_TEST) : glDisable(GL_SCISSOR_TEST); + //// glScissor(ContextState.Scissor.Min.X, ContextState.Scissor.Min.Y, ContextState.Scissor.Max.X - ContextState.Scissor.Min.X, ContextState.Scissor.Max.Y - ContextState.Scissor.Min.Y); + //glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); + //// glBindBuffer(GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); + //// glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); + + // from UpdateRasterizerStateInOpenGLContext + // { + // if (FOpenGL::SupportsPolygonMode()) + // { + // FOpenGL::PolygonMode(GL_FRONT_AND_BACK, ContextState.RasterizerState.FillMode); + // } + // if (ContextState.RasterizerState.CullMode != GL_NONE) + // { + // glEnable(GL_CULL_FACE); + // glCullFace(ContextState.RasterizerState.CullMode); + // } + // else + // { + // glDisable(GL_CULL_FACE); + // } + // if (FOpenGL::SupportsDepthClamp()) + // { + // if (ContextState.RasterizerState.DepthClipMode == ERasterizerDepthClipMode::DepthClamp) + // { + // glEnable(GL_DEPTH_CLAMP); + // } + // else + // { + // glDisable(GL_DEPTH_CLAMP); + // } + // } + // // Convert our platform independent depth bias into an OpenGL depth bias. + // const float BiasScale = float((1<<24)-1); // Warning: this assumes depth bits == 24, and won't be correct with 32. + // float DepthBias = ContextState.RasterizerState.DepthBias * BiasScale; + // + // if ((DepthBias == 0.0f) && (ContextState.RasterizerState.SlopeScaleDepthBias == 0.0f)) + // { + // // If we're here, both previous 2 'if' conditions are true, and this implies that cached state was not all zeroes, so we need to glDisable. + // glDisable(GL_POLYGON_OFFSET_FILL); + // if ( FOpenGL::SupportsPolygonMode() ) + // { + // glDisable(GL_POLYGON_OFFSET_LINE); + // glDisable(GL_POLYGON_OFFSET_POINT); + // } + // } + // else + // { + // if (ContextState.RasterizerState.DepthBias == 0.0f && ContextState.RasterizerState.SlopeScaleDepthBias == 0.0f) + // { + // glEnable(GL_POLYGON_OFFSET_FILL); + // if ( FOpenGL::SupportsPolygonMode() ) + // { + // glEnable(GL_POLYGON_OFFSET_LINE); + // glEnable(GL_POLYGON_OFFSET_POINT); + // } + // } + // glPolygonOffset(ContextState.RasterizerState.SlopeScaleDepthBias, DepthBias); + // } + // } // ~from UpdateRasterizerStateInOpenGLContext + // + // { // from UpdateDepthStencilStateInOpenGLContext + // if (ContextState.DepthStencilState.bZEnable) + // { + // glEnable(GL_DEPTH_TEST); + // } + // else + // { + // glDisable(GL_DEPTH_TEST); + // } + // glDepthMask(ContextState.DepthStencilState.bZWriteEnable); + // glDepthFunc(ContextState.DepthStencilState.ZFunc); + // if (ContextState.DepthStencilState.bStencilEnable) + // { + // glEnable(GL_STENCIL_TEST); + // } + // else + // { + // glDisable(GL_STENCIL_TEST); + // } + // { + // // Invalidate cache to enforce update of part of stencil state that needs to be set with different functions, when needed next + // // Values below are all invalid, but they'll never be used, only compared to new values to be set. + // ContextState.DepthStencilState.StencilFunc = 0xFFFF; + // ContextState.DepthStencilState.StencilFail = 0xFFFF; + // ContextState.DepthStencilState.StencilZFail = 0xFFFF; + // ContextState.DepthStencilState.StencilPass = 0xFFFF; + // ContextState.DepthStencilState.CCWStencilFunc = 0xFFFF; + // ContextState.DepthStencilState.CCWStencilFail = 0xFFFF; + // ContextState.DepthStencilState.CCWStencilZFail = 0xFFFF; + // ContextState.DepthStencilState.CCWStencilPass = 0xFFFF; + // ContextState.DepthStencilState.StencilReadMask = 0xFFFF; + // } + // if (ContextState.DepthStencilState.bStencilEnable) + // { + // if (ContextState.DepthStencilState.bTwoSidedStencilMode) + // { + // glStencilFuncSeparate(GL_BACK, ContextState.DepthStencilState.StencilFunc, ContextState.StencilRef, ContextState.DepthStencilState.StencilReadMask); + // glStencilOpSeparate(GL_BACK, ContextState.DepthStencilState.StencilFail, ContextState.DepthStencilState.StencilZFail, ContextState.DepthStencilState.StencilPass); + // glStencilFuncSeparate(GL_FRONT, ContextState.DepthStencilState.CCWStencilFunc, ContextState.StencilRef, ContextState.DepthStencilState.StencilReadMask); + // glStencilOpSeparate(GL_FRONT, ContextState.DepthStencilState.CCWStencilFail, ContextState.DepthStencilState.CCWStencilZFail, ContextState.DepthStencilState.CCWStencilPass); + // } + // else + // { + // glStencilFunc(ContextState.DepthStencilState.StencilFunc, ContextState.StencilRef, ContextState.DepthStencilState.StencilReadMask); + // glStencilOp(ContextState.DepthStencilState.StencilFail, ContextState.DepthStencilState.StencilZFail, ContextState.DepthStencilState.StencilPass); + // } + // glStencilMask(ContextState.DepthStencilState.StencilWriteMask); + // } + // } // ~from UpdateDepthStencilStateInOpenGLContext + + // glBindVertexArray(0); // m_state->bindVAO(0); + // //// glBindVertexBuffer(0); + // glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); // m_state->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + // glBindBuffer( GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); //m_state->bindBuffer(GL_ARRAY_BUFFER, 0); + // glBindBuffer( GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); //m_state->bindBuffer(GL_UNIFORM_BUFFER, 0); + // glBindBuffer( GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); //m_state->bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + // glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); + //// for (int i = 0; i <= CONTOUR_BUFFER_IDX; ++i) + //// { + //// glActiveTexture(GL_TEXTURE0 + kPLSTexIdxOffset + i); + //// glBindTexture(GL_TEXTURE_2D, 0); + //// } + // + // for (int i = 0; i < ContextState.Textures.Num(); i++) + // { + // glActiveTexture(GL_TEXTURE0 + i); + // glBindTexture(GL_TEXTURE_2D, ContextState.Textures[i].Resource); + // } + // glActiveTexture(ContextState.ActiveTexture); + + // { // from SetPendingBlendStateForActiveRenderTargets + // bool bABlendWasSet = false; + // bool bMSAAEnabled = false; + // + // // + // // Need to expand setting for glBlendFunction and glBlendEquation + // + // for (uint32 RenderTargetIndex = 0; RenderTargetIndex < MaxSimultaneousRenderTargets; ++RenderTargetIndex) + // { + // FOpenGLBlendStateData::FRenderTarget& RenderTargetBlendState = ContextState.BlendState.RenderTargets[RenderTargetIndex]; + // + // if (RenderTargetBlendState.bAlphaBlendEnable) + // { + // FOpenGL::EnableIndexed(GL_BLEND, RenderTargetIndex); + // } + // else + // { + // FOpenGL::DisableIndexed(GL_BLEND, RenderTargetIndex); + // } + // + // if (RenderTargetBlendState.bAlphaBlendEnable) + // { + // if (FOpenGL::SupportsSeparateAlphaBlend()) + // { + // // Set current blend per stage + // if (RenderTargetBlendState.bSeparateAlphaBlendEnable) + // { + // FOpenGL::BlendFuncSeparatei( + // RenderTargetIndex, + // RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor, + // RenderTargetBlendState.AlphaSourceBlendFactor, RenderTargetBlendState.AlphaDestBlendFactor + // ); + // + // FOpenGL::BlendEquationSeparatei( + // RenderTargetIndex, + // RenderTargetBlendState.ColorBlendOperation, + // RenderTargetBlendState.AlphaBlendOperation + // ); + // } + // else + // { + // FOpenGL::BlendFunci(RenderTargetIndex, RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor); + // FOpenGL::BlendEquationi(RenderTargetIndex, RenderTargetBlendState.ColorBlendOperation); + // } + // } + // else + // { + // if (bABlendWasSet) + // { + // // Detect the case of subsequent render target needing different blend setup than one already set in this call. + // } + // else + // { + // // Set current blend to all stages + // if (RenderTargetBlendState.bSeparateAlphaBlendEnable) + // { + // glBlendFuncSeparate( + // RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor, + // RenderTargetBlendState.AlphaSourceBlendFactor, RenderTargetBlendState.AlphaDestBlendFactor + // ); + // glBlendEquationSeparate( + // RenderTargetBlendState.ColorBlendOperation, + // RenderTargetBlendState.AlphaBlendOperation + // ); + // } + // else + // { + // glBlendFunc(RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor); + // glBlendEquation(RenderTargetBlendState.ColorBlendOperation); + // } + // bABlendWasSet = true; + // } + // } + // } + // FOpenGL::ColorMaskIndexed( + // RenderTargetIndex, + // RenderTargetBlendState.ColorWriteMaskR, + // RenderTargetBlendState.ColorWriteMaskG, + // RenderTargetBlendState.ColorWriteMaskB, + // RenderTargetBlendState.ColorWriteMaskA + // ); + // } + // + // if (ContextState.bAlphaToCoverageEnabled) + // { + // glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); + // } + // else + // { + // glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); + // } + // } // ~from SetPendingBlendStateForActiveRenderTargets + + //glBindBuffer( GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); + //// glBindBuffer( GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); + //glBindBuffer( GL_SHADER_STORAGE_BUFFER, ContextState.StorageBufferBound); + //// glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); + //// glBindBuffer( GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); + // + //glActiveTexture(ContextState.ActiveTexture); + ContextState.DepthMinZ = 0; + ContextState.DepthMaxZ = 1; + glDepthRangef(ContextState.DepthMinZ, ContextState.DepthMaxZ); + ContextState.DepthStencilState.bZEnable = true; + glEnable(GL_DEPTH_TEST); + ContextState.DepthStencilState.bZWriteEnable = true; + glDepthMask(ContextState.DepthStencilState.bZWriteEnable); + ContextState.DepthStencilState.ZFunc = GL_LESS; + glDepthFunc(ContextState.DepthStencilState.ZFunc); + ContextState.DepthStencilState.bStencilEnable = true; + glEnable(GL_STENCIL_TEST); + ContextState.DepthStencilState.StencilWriteMask = true; + glStencilMask(ContextState.DepthStencilState.StencilWriteMask); + glClearDepthf(1); + glClearStencil(0); + + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_DITHER); + + ContextState.DepthStencilState.bZEnable = false; + glDisable(GL_DEPTH_TEST); + ContextState.RasterizerState.DepthBias = 0; + ContextState.RasterizerState.SlopeScaleDepthBias = 0; + glDisable(GL_POLYGON_OFFSET_FILL); + glDisable(GL_POLYGON_OFFSET_LINE); + glDisable(GL_POLYGON_OFFSET_POINT); + + glDisable(GL_RASTERIZER_DISCARD); + ContextState.bAlphaToCoverageEnabled = false; + glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); + glDisable(GL_SAMPLE_COVERAGE); + ContextState.bScissorEnabled = false; + glDisable(GL_SCISSOR_TEST); + ContextState.DepthStencilState.bStencilEnable = false; + glDisable(GL_STENCIL_TEST); + // glDisable(GL_COLOR_LOGIC_OP); + // glDisable(GL_INDEX_LOGIC_OP); + // glDisable(GL_ALPHA_TEST); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_PACK_ROW_LENGTH, 0); + glPixelStorei(GL_PACK_SKIP_ROWS, 0); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + glPixelStorei(GL_PACK_ALIGNMENT, 4); + + glBindBuffer( GL_PIXEL_PACK_BUFFER, 0 ); + + // glBindVertexArray(0); //this call makes the screen black + glBindVertexArray(AndroidEGL::GetInstance()->GetRenderingContext()->DefaultVertexArrayObject); + ContextState.Framebuffer = 0; + glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); + ContextState.ElementArrayBufferBound = 0; + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); + ContextState.ArrayBufferBound = 0; + glBindBuffer(GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); + ContextState.UniformBufferBound = 0; + glBindBuffer(GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); + ContextState.PixelUnpackBufferBound = 0; + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); + + //const IOpenGLDynamicRHI* OpenGlRHI = GetIOpenGLDynamicRHI(); + //GLuint OpenGLResourcePtr = (GLuint)OpenGlRHI->RHIGetResource(CheckerboardTexture->GetResource()->TextureRHI); + + for (int i = 0; i <= 7; i++) + { + glActiveTexture(GL_TEXTURE0 + i); + glBindTexture(GL_TEXTURE_2D, 0); + ContextState.Textures[i].Resource = 0; + } + glActiveTexture(GL_TEXTURE0); + ContextState.ActiveTexture = 0; + glFrontFace(GL_CCW); + + // UE_LOG(LogRiveRenderer, Display, TEXT("%s OpenGLDynamicRHI->RHIInvalidateCachedState()"), FDebugLogger::Ind(), PLSRenderContextPtr); + // OpenGLDynamicRHI->RHIInvalidateCachedState(); // lose the 3D ground + OpenGLDynamicRHI->RHIPostExternalCommandsReset(); + // OpenGLDynamicRHI->RHIInvalidateCachedState(); // purely black ground + + RIVE_DEBUG_VERBOSE("Post RHIPostExternalCommandsReset"); + } +} + #endif // WITH_RIVE #endif diff --git a/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.h b/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.h index 057047d9..0717108f 100644 --- a/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.h +++ b/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.h @@ -53,6 +53,8 @@ namespace UE::Rive::Renderer::Private private: void CacheTextureTarget_Internal(const FTexture2DRHIRef& InRHIResource); + + void ResetOpenGLState() const; /** * Attribute(s) diff --git a/Source/RiveRenderer/Private/Platform/RiveRendererOpenGL.cpp b/Source/RiveRenderer/Private/Platform/RiveRendererOpenGL.cpp index ab779ad6..8061a12f 100644 --- a/Source/RiveRenderer/Private/Platform/RiveRendererOpenGL.cpp +++ b/Source/RiveRenderer/Private/Platform/RiveRendererOpenGL.cpp @@ -33,17 +33,21 @@ void UE::Rive::Renderer::Private::FRiveRendererOpenGL::Initialize() { FString glVersionStr = ANSI_TO_TCHAR((const ANSICHAR*) glGetString(GL_VERSION)); - RIVE_DEBUG_VERBOSE("GAMETHREAD: glVersionStr %s", *glVersionStr); + RIVE_DEBUG_VERBOSE("GAMETHREAD: GL_VERSION %s", *glVersionStr); ENQUEUE_RENDER_COMMAND(URiveFileInitialize_RenderThread)( [](FRHICommandListImmediate& RHICmdList) { FString glVersionStr = ANSI_TO_TCHAR((const ANSICHAR*) glGetString(GL_VERSION)); - RIVE_DEBUG_VERBOSE("RENDERTHREAD: glVersionStr %s", *glVersionStr); + RIVE_DEBUG_VERBOSE("RENDERTHREAD: GL_VERSION %s", *glVersionStr); RHICmdList.EnqueueLambda([](FRHICommandListImmediate&) { FString glVersionStr = ANSI_TO_TCHAR((const ANSICHAR*) glGetString(GL_VERSION)); - RIVE_DEBUG_VERBOSE("RHITHREAD: glVersionStr %s", *glVersionStr); + RIVE_DEBUG_VERBOSE("RHITHREAD: GL_VERSION %s", *glVersionStr); + FString glVendorStr = ANSI_TO_TCHAR((const ANSICHAR*) glGetString(GL_VENDOR)); + RIVE_DEBUG_VERBOSE("RHITHREAD: GL_VENDOR %s", *glVendorStr); + FString glRendererStr = ANSI_TO_TCHAR((const ANSICHAR*) glGetString(GL_RENDERER)); + RIVE_DEBUG_VERBOSE("RHITHREAD: GL_RENDERER %s", *glRendererStr); }); }); } diff --git a/Source/RiveRenderer/Private/RiveRenderTarget.cpp b/Source/RiveRenderer/Private/RiveRenderTarget.cpp index 327a9cd2..5bf23d92 100644 --- a/Source/RiveRenderer/Private/RiveRenderTarget.cpp +++ b/Source/RiveRenderer/Private/RiveRenderTarget.cpp @@ -250,7 +250,7 @@ void UE::Rive::Renderer::Private::FRiveRenderTarget::Render_Internal(const TArra PLSRenderer->transform(rive::Mat2D::fromScaleAndTranslation(1.f, -1.f, 0.f, GetHeight())); #endif - RIVE_DEBUG_VERBOSE("Executing queue with %d items for '%s'", RiveRenderCommands.Num(), *RiveName.ToString()); + // RIVE_DEBUG_VERBOSE("Executing queue with %d items for '%s'", RiveRenderCommands.Num(), *RiveName.ToString()); for (const FRiveRenderCommand& RenderCommand : RiveRenderCommands) { switch (RenderCommand.Type) diff --git a/Source/RiveRenderer/Public/IRiveRendererModule.h b/Source/RiveRenderer/Public/IRiveRendererModule.h index 84473946..26772375 100644 --- a/Source/RiveRenderer/Public/IRiveRendererModule.h +++ b/Source/RiveRenderer/Public/IRiveRendererModule.h @@ -49,7 +49,7 @@ namespace UE::Rive::Renderer static bool RunInGameThread() { #if PLATFORM_ANDROID - return true; + return false; #endif // PLATFORM_ANDROID return false; } From 40b2d7ca6724d2829891f637d93babc9fd4e9b5d Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Sat, 6 Apr 2024 10:40:02 +1100 Subject: [PATCH 04/34] Small log fix --- Source/RiveRenderer/Private/Logs/RiveRendererLog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RiveRenderer/Private/Logs/RiveRendererLog.h b/Source/RiveRenderer/Private/Logs/RiveRendererLog.h index f0035d86..e67f1722 100644 --- a/Source/RiveRenderer/Private/Logs/RiveRendererLog.h +++ b/Source/RiveRenderer/Private/Logs/RiveRendererLog.h @@ -30,7 +30,7 @@ class FDebugLogger void UnIndent() { --IndentLevel; - IndentStr.RemoveAt(IndentStr.Len() - SpacesPerIndent - 2, SpacesPerIndent + 1); + IndentStr.RemoveAt(0, SpacesPerIndent + 1); } static FDebugLogger& Get() { From 1654656f4a4380cdc521ae3484a871b3c057b56e Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Sun, 7 Apr 2024 22:13:35 +1000 Subject: [PATCH 05/34] Code clean for Android OpenGL --- .../Private/Logs/RiveRendererLog.h | 2 +- .../Platform/RiveRenderTargetOpenGL.cpp | 407 ++++-------------- .../RiveRenderer/Private/RiveRenderTarget.cpp | 1 - 3 files changed, 82 insertions(+), 328 deletions(-) diff --git a/Source/RiveRenderer/Private/Logs/RiveRendererLog.h b/Source/RiveRenderer/Private/Logs/RiveRendererLog.h index ab415376..f0035d86 100644 --- a/Source/RiveRenderer/Private/Logs/RiveRendererLog.h +++ b/Source/RiveRenderer/Private/Logs/RiveRendererLog.h @@ -5,7 +5,7 @@ #include "CoreMinimal.h" #include "Logging/LogMacros.h" -DECLARE_LOG_CATEGORY_EXTERN(LogRiveRenderer, Verbose, All); +DECLARE_LOG_CATEGORY_EXTERN(LogRiveRenderer, Display, All); class FDebugLogger { diff --git a/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp b/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp index 586b44bd..0d680af7 100644 --- a/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp +++ b/Source/RiveRenderer/Private/Platform/RiveRenderTargetOpenGL.cpp @@ -140,7 +140,7 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::EndFrame() const }; PLSRenderContextPtr->flush(FlushResources); - //todo: android texture blink if we don't call glReadPixels? to investigate + //todo: to remove once OpenGL fully fixed TArray Points{ {0,0}, { 100,100 }, { 200,200 }, { 300,300 }, { 400,400 }, { 500,500 }, { 600,600 }, { 700,700 } }; for (FIntVector2 Point : Points) { @@ -155,7 +155,6 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::EndFrame() const // Reset RIVE_DEBUG_VERBOSE("PLSRenderContextPtr->unbindGLInternalResources() %p", PLSRenderContextPtr); PLSRenderContextPtr->static_impl_cast()->unbindGLInternalResources(); //careful, need UE's internal state to match - // PLSRenderContextPtr->static_impl_cast()->invalidateGLState(); //careful, need UE's internal state to match ResetOpenGLState(); } @@ -167,7 +166,6 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::Render_RenderThread(F RHICmdList.EnqueueLambda([this, RiveRenderCommands = RiveRenderCommands](FRHICommandListImmediate& RHICmdList) { - // ResetOpenGLState(); Render_Internal(RiveRenderCommands); }); } @@ -253,331 +251,88 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::CacheTextureTarget_In void UE::Rive::Renderer::Private::FRiveRenderTargetOpenGL::ResetOpenGLState() const { - if (IsInRHIThread()) //todo: still not working, to be looked at + if (!IsInRHIThread()) { - FOpenGLDynamicRHI* OpenGLDynamicRHI = static_cast(GetIOpenGLDynamicRHI()); - // OpenGLDynamicRHI->RHIInvalidateCachedState(); // lose the 3D ground - - FOpenGLContextState& ContextState = OpenGLDynamicRHI->GetContextStateForCurrentContext(true); - - RIVE_DEBUG_VERBOSE("Pre RHIPostExternalCommandsReset"); - //// Manual reset of GL commands to match the GL State before Rive Commands. Supposed to be handled by RHIPostExternalCommandsReset, TBC - //// FOpenGL::BindProgramPipeline(ContextState.Program); - //// glViewport(ContextState.Viewport.Min.X, ContextState.Viewport.Min.Y, ContextState.Viewport.Max.X - ContextState.Viewport.Min.X, ContextState.Viewport.Max.Y - ContextState.Viewport.Min.Y); - //// FOpenGL::DepthRange(ContextState.DepthMinZ, ContextState.DepthMaxZ); - //// ContextState.bScissorEnabled ? glEnable(GL_SCISSOR_TEST) : glDisable(GL_SCISSOR_TEST); - //// glScissor(ContextState.Scissor.Min.X, ContextState.Scissor.Min.Y, ContextState.Scissor.Max.X - ContextState.Scissor.Min.X, ContextState.Scissor.Max.Y - ContextState.Scissor.Min.Y); - //glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); - //// glBindBuffer(GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); - //// glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); - - // from UpdateRasterizerStateInOpenGLContext - // { - // if (FOpenGL::SupportsPolygonMode()) - // { - // FOpenGL::PolygonMode(GL_FRONT_AND_BACK, ContextState.RasterizerState.FillMode); - // } - // if (ContextState.RasterizerState.CullMode != GL_NONE) - // { - // glEnable(GL_CULL_FACE); - // glCullFace(ContextState.RasterizerState.CullMode); - // } - // else - // { - // glDisable(GL_CULL_FACE); - // } - // if (FOpenGL::SupportsDepthClamp()) - // { - // if (ContextState.RasterizerState.DepthClipMode == ERasterizerDepthClipMode::DepthClamp) - // { - // glEnable(GL_DEPTH_CLAMP); - // } - // else - // { - // glDisable(GL_DEPTH_CLAMP); - // } - // } - // // Convert our platform independent depth bias into an OpenGL depth bias. - // const float BiasScale = float((1<<24)-1); // Warning: this assumes depth bits == 24, and won't be correct with 32. - // float DepthBias = ContextState.RasterizerState.DepthBias * BiasScale; - // - // if ((DepthBias == 0.0f) && (ContextState.RasterizerState.SlopeScaleDepthBias == 0.0f)) - // { - // // If we're here, both previous 2 'if' conditions are true, and this implies that cached state was not all zeroes, so we need to glDisable. - // glDisable(GL_POLYGON_OFFSET_FILL); - // if ( FOpenGL::SupportsPolygonMode() ) - // { - // glDisable(GL_POLYGON_OFFSET_LINE); - // glDisable(GL_POLYGON_OFFSET_POINT); - // } - // } - // else - // { - // if (ContextState.RasterizerState.DepthBias == 0.0f && ContextState.RasterizerState.SlopeScaleDepthBias == 0.0f) - // { - // glEnable(GL_POLYGON_OFFSET_FILL); - // if ( FOpenGL::SupportsPolygonMode() ) - // { - // glEnable(GL_POLYGON_OFFSET_LINE); - // glEnable(GL_POLYGON_OFFSET_POINT); - // } - // } - // glPolygonOffset(ContextState.RasterizerState.SlopeScaleDepthBias, DepthBias); - // } - // } // ~from UpdateRasterizerStateInOpenGLContext - // - // { // from UpdateDepthStencilStateInOpenGLContext - // if (ContextState.DepthStencilState.bZEnable) - // { - // glEnable(GL_DEPTH_TEST); - // } - // else - // { - // glDisable(GL_DEPTH_TEST); - // } - // glDepthMask(ContextState.DepthStencilState.bZWriteEnable); - // glDepthFunc(ContextState.DepthStencilState.ZFunc); - // if (ContextState.DepthStencilState.bStencilEnable) - // { - // glEnable(GL_STENCIL_TEST); - // } - // else - // { - // glDisable(GL_STENCIL_TEST); - // } - // { - // // Invalidate cache to enforce update of part of stencil state that needs to be set with different functions, when needed next - // // Values below are all invalid, but they'll never be used, only compared to new values to be set. - // ContextState.DepthStencilState.StencilFunc = 0xFFFF; - // ContextState.DepthStencilState.StencilFail = 0xFFFF; - // ContextState.DepthStencilState.StencilZFail = 0xFFFF; - // ContextState.DepthStencilState.StencilPass = 0xFFFF; - // ContextState.DepthStencilState.CCWStencilFunc = 0xFFFF; - // ContextState.DepthStencilState.CCWStencilFail = 0xFFFF; - // ContextState.DepthStencilState.CCWStencilZFail = 0xFFFF; - // ContextState.DepthStencilState.CCWStencilPass = 0xFFFF; - // ContextState.DepthStencilState.StencilReadMask = 0xFFFF; - // } - // if (ContextState.DepthStencilState.bStencilEnable) - // { - // if (ContextState.DepthStencilState.bTwoSidedStencilMode) - // { - // glStencilFuncSeparate(GL_BACK, ContextState.DepthStencilState.StencilFunc, ContextState.StencilRef, ContextState.DepthStencilState.StencilReadMask); - // glStencilOpSeparate(GL_BACK, ContextState.DepthStencilState.StencilFail, ContextState.DepthStencilState.StencilZFail, ContextState.DepthStencilState.StencilPass); - // glStencilFuncSeparate(GL_FRONT, ContextState.DepthStencilState.CCWStencilFunc, ContextState.StencilRef, ContextState.DepthStencilState.StencilReadMask); - // glStencilOpSeparate(GL_FRONT, ContextState.DepthStencilState.CCWStencilFail, ContextState.DepthStencilState.CCWStencilZFail, ContextState.DepthStencilState.CCWStencilPass); - // } - // else - // { - // glStencilFunc(ContextState.DepthStencilState.StencilFunc, ContextState.StencilRef, ContextState.DepthStencilState.StencilReadMask); - // glStencilOp(ContextState.DepthStencilState.StencilFail, ContextState.DepthStencilState.StencilZFail, ContextState.DepthStencilState.StencilPass); - // } - // glStencilMask(ContextState.DepthStencilState.StencilWriteMask); - // } - // } // ~from UpdateDepthStencilStateInOpenGLContext - - // glBindVertexArray(0); // m_state->bindVAO(0); - // //// glBindVertexBuffer(0); - // glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); // m_state->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - // glBindBuffer( GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); //m_state->bindBuffer(GL_ARRAY_BUFFER, 0); - // glBindBuffer( GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); //m_state->bindBuffer(GL_UNIFORM_BUFFER, 0); - // glBindBuffer( GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); //m_state->bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - // glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); - //// for (int i = 0; i <= CONTOUR_BUFFER_IDX; ++i) - //// { - //// glActiveTexture(GL_TEXTURE0 + kPLSTexIdxOffset + i); - //// glBindTexture(GL_TEXTURE_2D, 0); - //// } - // - // for (int i = 0; i < ContextState.Textures.Num(); i++) - // { - // glActiveTexture(GL_TEXTURE0 + i); - // glBindTexture(GL_TEXTURE_2D, ContextState.Textures[i].Resource); - // } - // glActiveTexture(ContextState.ActiveTexture); - - // { // from SetPendingBlendStateForActiveRenderTargets - // bool bABlendWasSet = false; - // bool bMSAAEnabled = false; - // - // // - // // Need to expand setting for glBlendFunction and glBlendEquation - // - // for (uint32 RenderTargetIndex = 0; RenderTargetIndex < MaxSimultaneousRenderTargets; ++RenderTargetIndex) - // { - // FOpenGLBlendStateData::FRenderTarget& RenderTargetBlendState = ContextState.BlendState.RenderTargets[RenderTargetIndex]; - // - // if (RenderTargetBlendState.bAlphaBlendEnable) - // { - // FOpenGL::EnableIndexed(GL_BLEND, RenderTargetIndex); - // } - // else - // { - // FOpenGL::DisableIndexed(GL_BLEND, RenderTargetIndex); - // } - // - // if (RenderTargetBlendState.bAlphaBlendEnable) - // { - // if (FOpenGL::SupportsSeparateAlphaBlend()) - // { - // // Set current blend per stage - // if (RenderTargetBlendState.bSeparateAlphaBlendEnable) - // { - // FOpenGL::BlendFuncSeparatei( - // RenderTargetIndex, - // RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor, - // RenderTargetBlendState.AlphaSourceBlendFactor, RenderTargetBlendState.AlphaDestBlendFactor - // ); - // - // FOpenGL::BlendEquationSeparatei( - // RenderTargetIndex, - // RenderTargetBlendState.ColorBlendOperation, - // RenderTargetBlendState.AlphaBlendOperation - // ); - // } - // else - // { - // FOpenGL::BlendFunci(RenderTargetIndex, RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor); - // FOpenGL::BlendEquationi(RenderTargetIndex, RenderTargetBlendState.ColorBlendOperation); - // } - // } - // else - // { - // if (bABlendWasSet) - // { - // // Detect the case of subsequent render target needing different blend setup than one already set in this call. - // } - // else - // { - // // Set current blend to all stages - // if (RenderTargetBlendState.bSeparateAlphaBlendEnable) - // { - // glBlendFuncSeparate( - // RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor, - // RenderTargetBlendState.AlphaSourceBlendFactor, RenderTargetBlendState.AlphaDestBlendFactor - // ); - // glBlendEquationSeparate( - // RenderTargetBlendState.ColorBlendOperation, - // RenderTargetBlendState.AlphaBlendOperation - // ); - // } - // else - // { - // glBlendFunc(RenderTargetBlendState.ColorSourceBlendFactor, RenderTargetBlendState.ColorDestBlendFactor); - // glBlendEquation(RenderTargetBlendState.ColorBlendOperation); - // } - // bABlendWasSet = true; - // } - // } - // } - // FOpenGL::ColorMaskIndexed( - // RenderTargetIndex, - // RenderTargetBlendState.ColorWriteMaskR, - // RenderTargetBlendState.ColorWriteMaskG, - // RenderTargetBlendState.ColorWriteMaskB, - // RenderTargetBlendState.ColorWriteMaskA - // ); - // } - // - // if (ContextState.bAlphaToCoverageEnabled) - // { - // glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); - // } - // else - // { - // glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - // } - // } // ~from SetPendingBlendStateForActiveRenderTargets - - //glBindBuffer( GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); - //// glBindBuffer( GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); - //glBindBuffer( GL_SHADER_STORAGE_BUFFER, ContextState.StorageBufferBound); - //// glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); - //// glBindBuffer( GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); - // - //glActiveTexture(ContextState.ActiveTexture); - ContextState.DepthMinZ = 0; - ContextState.DepthMaxZ = 1; - glDepthRangef(ContextState.DepthMinZ, ContextState.DepthMaxZ); - ContextState.DepthStencilState.bZEnable = true; - glEnable(GL_DEPTH_TEST); - ContextState.DepthStencilState.bZWriteEnable = true; - glDepthMask(ContextState.DepthStencilState.bZWriteEnable); - ContextState.DepthStencilState.ZFunc = GL_LESS; - glDepthFunc(ContextState.DepthStencilState.ZFunc); - ContextState.DepthStencilState.bStencilEnable = true; - glEnable(GL_STENCIL_TEST); - ContextState.DepthStencilState.StencilWriteMask = true; - glStencilMask(ContextState.DepthStencilState.StencilWriteMask); - glClearDepthf(1); - glClearStencil(0); - - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_DITHER); - - ContextState.DepthStencilState.bZEnable = false; - glDisable(GL_DEPTH_TEST); - ContextState.RasterizerState.DepthBias = 0; - ContextState.RasterizerState.SlopeScaleDepthBias = 0; - glDisable(GL_POLYGON_OFFSET_FILL); - glDisable(GL_POLYGON_OFFSET_LINE); - glDisable(GL_POLYGON_OFFSET_POINT); - - glDisable(GL_RASTERIZER_DISCARD); - ContextState.bAlphaToCoverageEnabled = false; - glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - glDisable(GL_SAMPLE_COVERAGE); - ContextState.bScissorEnabled = false; - glDisable(GL_SCISSOR_TEST); - ContextState.DepthStencilState.bStencilEnable = false; - glDisable(GL_STENCIL_TEST); - // glDisable(GL_COLOR_LOGIC_OP); - // glDisable(GL_INDEX_LOGIC_OP); - // glDisable(GL_ALPHA_TEST); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glPixelStorei(GL_PACK_SKIP_ROWS, 0); - glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - - glBindBuffer( GL_PIXEL_PACK_BUFFER, 0 ); - - // glBindVertexArray(0); //this call makes the screen black - glBindVertexArray(AndroidEGL::GetInstance()->GetRenderingContext()->DefaultVertexArrayObject); - ContextState.Framebuffer = 0; - glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); - ContextState.ElementArrayBufferBound = 0; - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); - ContextState.ArrayBufferBound = 0; - glBindBuffer(GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); - ContextState.UniformBufferBound = 0; - glBindBuffer(GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); - ContextState.PixelUnpackBufferBound = 0; - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); - - //const IOpenGLDynamicRHI* OpenGlRHI = GetIOpenGLDynamicRHI(); - //GLuint OpenGLResourcePtr = (GLuint)OpenGlRHI->RHIGetResource(CheckerboardTexture->GetResource()->TextureRHI); - - for (int i = 0; i <= 7; i++) - { - glActiveTexture(GL_TEXTURE0 + i); - glBindTexture(GL_TEXTURE_2D, 0); - ContextState.Textures[i].Resource = 0; - } - glActiveTexture(GL_TEXTURE0); - ContextState.ActiveTexture = 0; - glFrontFace(GL_CCW); - - // UE_LOG(LogRiveRenderer, Display, TEXT("%s OpenGLDynamicRHI->RHIInvalidateCachedState()"), FDebugLogger::Ind(), PLSRenderContextPtr); - // OpenGLDynamicRHI->RHIInvalidateCachedState(); // lose the 3D ground - OpenGLDynamicRHI->RHIPostExternalCommandsReset(); - // OpenGLDynamicRHI->RHIInvalidateCachedState(); // purely black ground - - RIVE_DEBUG_VERBOSE("Post RHIPostExternalCommandsReset"); + return; } + //todo: still not fully working, to be looked at + FOpenGLDynamicRHI* OpenGLDynamicRHI = static_cast(GetIOpenGLDynamicRHI()); + FOpenGLContextState& ContextState = OpenGLDynamicRHI->GetContextStateForCurrentContext(true); + + RIVE_DEBUG_VERBOSE("Pre RHIPostExternalCommandsReset"); + + // Here, we manually set the context values as per the changes that have been made by Rive. + // We call the GL function to be sure + ContextState.DepthMinZ = 0; + ContextState.DepthMaxZ = 1; + glDepthRangef(ContextState.DepthMinZ, ContextState.DepthMaxZ); + ContextState.DepthStencilState.bZEnable = true; + glEnable(GL_DEPTH_TEST); + ContextState.DepthStencilState.bZWriteEnable = true; + glDepthMask(ContextState.DepthStencilState.bZWriteEnable); + ContextState.DepthStencilState.ZFunc = GL_LESS; + glDepthFunc(ContextState.DepthStencilState.ZFunc); + ContextState.DepthStencilState.bStencilEnable = true; + glEnable(GL_STENCIL_TEST); + ContextState.DepthStencilState.StencilWriteMask = true; + glStencilMask(ContextState.DepthStencilState.StencilWriteMask); + glClearDepthf(1); + glClearStencil(0); + + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_DITHER); + + ContextState.DepthStencilState.bZEnable = false; + glDisable(GL_DEPTH_TEST); + ContextState.RasterizerState.DepthBias = 0; + ContextState.RasterizerState.SlopeScaleDepthBias = 0; + glDisable(GL_POLYGON_OFFSET_FILL); + glDisable(GL_POLYGON_OFFSET_LINE); + glDisable(GL_POLYGON_OFFSET_POINT); + + glDisable(GL_RASTERIZER_DISCARD); + ContextState.bAlphaToCoverageEnabled = false; + glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); + glDisable(GL_SAMPLE_COVERAGE); + ContextState.bScissorEnabled = false; + glDisable(GL_SCISSOR_TEST); + ContextState.DepthStencilState.bStencilEnable = false; + glDisable(GL_STENCIL_TEST); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_PACK_ROW_LENGTH, 0); + glPixelStorei(GL_PACK_SKIP_ROWS, 0); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + glPixelStorei(GL_PACK_ALIGNMENT, 4); + + glBindBuffer( GL_PIXEL_PACK_BUFFER, 0 ); + + glBindVertexArray(AndroidEGL::GetInstance()->GetRenderingContext()->DefaultVertexArrayObject); + ContextState.Framebuffer = 0; + glBindFramebuffer(GL_FRAMEBUFFER, ContextState.Framebuffer); + ContextState.ElementArrayBufferBound = 0; + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ContextState.ElementArrayBufferBound); + ContextState.ArrayBufferBound = 0; + glBindBuffer(GL_ARRAY_BUFFER, ContextState.ArrayBufferBound); + ContextState.UniformBufferBound = 0; + glBindBuffer(GL_UNIFORM_BUFFER, ContextState.UniformBufferBound); + ContextState.PixelUnpackBufferBound = 0; + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, ContextState.PixelUnpackBufferBound); + + for (int i = 0; i <= 7; i++) + { + glActiveTexture(GL_TEXTURE0 + i); + glBindTexture(GL_TEXTURE_2D, 0); + ContextState.Textures[i].Resource = 0; + } + glActiveTexture(GL_TEXTURE0); + ContextState.ActiveTexture = 0; + glFrontFace(GL_CCW); + + OpenGLDynamicRHI->RHIPostExternalCommandsReset(); + RIVE_DEBUG_VERBOSE("Post RHIPostExternalCommandsReset"); } #endif // WITH_RIVE diff --git a/Source/RiveRenderer/Private/RiveRenderTarget.cpp b/Source/RiveRenderer/Private/RiveRenderTarget.cpp index 5bf23d92..e6930c1a 100644 --- a/Source/RiveRenderer/Private/RiveRenderTarget.cpp +++ b/Source/RiveRenderer/Private/RiveRenderTarget.cpp @@ -250,7 +250,6 @@ void UE::Rive::Renderer::Private::FRiveRenderTarget::Render_Internal(const TArra PLSRenderer->transform(rive::Mat2D::fromScaleAndTranslation(1.f, -1.f, 0.f, GetHeight())); #endif - // RIVE_DEBUG_VERBOSE("Executing queue with %d items for '%s'", RiveRenderCommands.Num(), *RiveName.ToString()); for (const FRiveRenderCommand& RenderCommand : RiveRenderCommands) { switch (RenderCommand.Type) From 981972496eb20d40fe609d10a06f2a549aff7407 Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Sun, 7 Apr 2024 22:26:18 +1000 Subject: [PATCH 06/34] Stops the AssetImportData fix from modifying the RiveFile --- Source/Rive/Private/Rive/RiveFile.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/Rive/Private/Rive/RiveFile.cpp b/Source/Rive/Private/Rive/RiveFile.cpp index e1e21397..efe018d0 100644 --- a/Source/Rive/Private/Rive/RiveFile.cpp +++ b/Source/Rive/Private/Rive/RiveFile.cpp @@ -101,11 +101,6 @@ void URiveFile::PostLoad() UE_LOG(LogRive, Warning, TEXT("The path of RiveFile '%s' is not matching the AssetImportData, resetting to RiveFilePath. RiveFilePath: '%s' AssetImportData: '%s'"), *GetFullName(), *RiveFilePath, *FullPath) AssetImportData->UpdateFilenameOnly(RiveFilePath); - // We want to mark the UObject dirty but that is not possible on PostLoad, so we start an AsyncTask - AsyncTask(ENamedThreads::GameThread, [this]() - { - Modify(true); - }); } } AssetImportData->OnImportDataChanged.AddUObject(this, &URiveFile::OnImportDataChanged); From 93772d86a187539b0e58973b61f5814416869577 Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:28:49 +1000 Subject: [PATCH 07/34] Fix for Rive Texture resizing on undo --- Source/Rive/Private/Rive/RiveFile.cpp | 7 +++++++ Source/Rive/Private/Rive/RiveTexture.cpp | 22 +++++++++++++++------- Source/Rive/Public/Rive/RiveFile.h | 1 + Source/Rive/Public/Rive/RiveTexture.h | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Source/Rive/Private/Rive/RiveFile.cpp b/Source/Rive/Private/Rive/RiveFile.cpp index efe018d0..2149b57a 100644 --- a/Source/Rive/Private/Rive/RiveFile.cpp +++ b/Source/Rive/Private/Rive/RiveFile.cpp @@ -138,6 +138,13 @@ void URiveFile::PostLoad() #if WITH_EDITOR +void URiveFile::PostEditUndo() +{ + Super::PostEditUndo(); + // we resize the render target on undo, it will do nothing if the size has not changed + ResizeRenderTargets(Size); +} + void URiveFile::PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent) { Super::PostEditChangeProperty(PropertyChangedEvent); diff --git a/Source/Rive/Private/Rive/RiveTexture.cpp b/Source/Rive/Private/Rive/RiveTexture.cpp index 0df52c04..5b0f0ea1 100644 --- a/Source/Rive/Private/Rive/RiveTexture.cpp +++ b/Source/Rive/Private/Rive/RiveTexture.cpp @@ -52,20 +52,28 @@ void URiveTexture::PostLoad() } } -void URiveTexture::ResizeRenderTargets(const FIntPoint InNewSize) +void URiveTexture::ResizeRenderTargets(FIntPoint InNewSize) { - if (InNewSize.X == SizeX && InNewSize.Y == SizeY) + if (InNewSize.X < RIVE_MIN_TEX_RESOLUTION || InNewSize.Y < RIVE_MIN_TEX_RESOLUTION + || InNewSize.X > RIVE_MAX_TEX_RESOLUTION || InNewSize.Y > RIVE_MAX_TEX_RESOLUTION) { - return; + FIntPoint OldNewSize = InNewSize; + InNewSize = { + FMath::Clamp(InNewSize.X, RIVE_MIN_TEX_RESOLUTION, RIVE_MAX_TEX_RESOLUTION), + FMath::Clamp(InNewSize.Y, RIVE_MIN_TEX_RESOLUTION, RIVE_MAX_TEX_RESOLUTION)}; + UE_LOG(LogRive, Warning, TEXT("Wrong Rive Texture Size {X:%d, Y:%d} being changed to {X:%d, Y:%d}"), OldNewSize.X, OldNewSize.Y, InNewSize.X, InNewSize.Y); } - if (InNewSize.X <= RIVE_MIN_TEX_RESOLUTION || InNewSize.Y <= RIVE_MIN_TEX_RESOLUTION - || InNewSize.X >= RIVE_MAX_TEX_RESOLUTION || InNewSize.Y >= RIVE_MAX_TEX_RESOLUTION) + if (InNewSize.X == Size.X && InNewSize.Y == Size.Y) { - UE_LOG(LogRive, Warning, TEXT("Wrong Rive Texture Size X:%d, Y:%d"), InNewSize.X, InNewSize.Y); - + // Just making sure all internal data lines up + SizeX = Size.X; + SizeY = Size.Y; return; } + + // we need to make sure we are not drawing anything with the old size, so we ensure all the commands are sent before going further + FlushRenderingCommands(); SizeX = Size.X = InNewSize.X; SizeY = Size.Y = InNewSize.Y; diff --git a/Source/Rive/Public/Rive/RiveFile.h b/Source/Rive/Public/Rive/RiveFile.h index 03e17d27..7c45f417 100644 --- a/Source/Rive/Public/Rive/RiveFile.h +++ b/Source/Rive/Public/Rive/RiveFile.h @@ -76,6 +76,7 @@ class RIVE_API URiveFile : public URiveTexture, public FTickableGameObject #if WITH_EDITOR virtual void PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent) override; + virtual void PostEditUndo() override; #endif // WITH_EDITOR diff --git a/Source/Rive/Public/Rive/RiveTexture.h b/Source/Rive/Public/Rive/RiveTexture.h index f06f4a80..0d657581 100644 --- a/Source/Rive/Public/Rive/RiveTexture.h +++ b/Source/Rive/Public/Rive/RiveTexture.h @@ -44,7 +44,7 @@ class RIVE_API URiveTexture : public UTexture2DDynamic * Resize render resources */ UFUNCTION(BlueprintCallable, Category = Rive) - virtual void ResizeRenderTargets(const FIntPoint InNewSize); + virtual void ResizeRenderTargets(FIntPoint InNewSize); FVector2f GetLocalCoordinatesFromExtents(URiveArtboard* InArtboard, const FVector2f& InPosition, const FBox2f& InExtents) const; From 96d292eb55c4b9d366b20a878f8a046c07cc875a Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:29:54 +1000 Subject: [PATCH 08/34] Reverting Android OpenGL to GameThread It is still not fully working on RHI Thread. --- Source/RiveRenderer/Public/IRiveRendererModule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RiveRenderer/Public/IRiveRendererModule.h b/Source/RiveRenderer/Public/IRiveRendererModule.h index 26772375..84473946 100644 --- a/Source/RiveRenderer/Public/IRiveRendererModule.h +++ b/Source/RiveRenderer/Public/IRiveRendererModule.h @@ -49,7 +49,7 @@ namespace UE::Rive::Renderer static bool RunInGameThread() { #if PLATFORM_ANDROID - return false; + return true; #endif // PLATFORM_ANDROID return false; } From 4905c9e8df80fb7e7eec13b6a0b94198fcfd2eaa Mon Sep 17 00:00:00 2001 From: Elliot Colp Date: Wed, 17 Apr 2024 13:12:40 -0600 Subject: [PATCH 09/34] Fix dangling pointer used for texture debug name --- Source/Rive/Private/Rive/RiveTexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Rive/Private/Rive/RiveTexture.cpp b/Source/Rive/Private/Rive/RiveTexture.cpp index 5b0f0ea1..6b7b7f7e 100644 --- a/Source/Rive/Private/Rive/RiveTexture.cpp +++ b/Source/Rive/Private/Rive/RiveTexture.cpp @@ -176,9 +176,10 @@ void URiveTexture::InitializeResources() const FScopeLock Lock(&RiveRenderer->GetThreadDataCS()); FTextureRHIRef RenderableTexture; + const FString DebugName = GetName(); FRHITextureCreateDesc RenderTargetTextureDesc = - FRHITextureCreateDesc::Create2D(*GetName(), Size.X, Size.Y, Format) + FRHITextureCreateDesc::Create2D(*DebugName, Size.X, Size.Y, Format) .SetClearValue(FClearValueBinding(FLinearColor(0.0f, 0.0f, 0.0f))) .SetFlags(ETextureCreateFlags::Dynamic | ETextureCreateFlags::ShaderResource | ETextureCreateFlags::RenderTargetable); From 4eddcdacb3060679e1eb23b2e3df486cb3f38adf Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Thu, 18 Apr 2024 23:58:49 +1000 Subject: [PATCH 10/34] Removing UPROPERTY of FRiveEvent::Id This was creating errors in the log because a new GUID is created on construction, and UE expects two default initialized objects to have the same values, which was not the case and leading to the error log. --- Source/RiveCore/Public/RiveEvent.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/RiveCore/Public/RiveEvent.h b/Source/RiveCore/Public/RiveEvent.h index 216ec6ae..c909f9ef 100644 --- a/Source/RiveCore/Public/RiveEvent.h +++ b/Source/RiveCore/Public/RiveEvent.h @@ -132,8 +132,7 @@ struct RIVECORE_API FRiveEvent static constexpr int32 NumberProperty = 127; static constexpr int32 BooleanProperty = 129; static constexpr int32 StringProperty = 130; - - UPROPERTY() + FGuid Id = FGuid::NewGuid(); }; From 7641735ee2285749111f94a5364c4159dddea889 Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Fri, 19 Apr 2024 00:02:16 +1000 Subject: [PATCH 11/34] Log level adjustment --- Source/RiveRenderer/Private/Platform/RiveRenderTargetD3D11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RiveRenderer/Private/Platform/RiveRenderTargetD3D11.cpp b/Source/RiveRenderer/Private/Platform/RiveRenderTargetD3D11.cpp index b5612812..7700baae 100644 --- a/Source/RiveRenderer/Private/Platform/RiveRenderTargetD3D11.cpp +++ b/Source/RiveRenderer/Private/Platform/RiveRenderTargetD3D11.cpp @@ -54,7 +54,7 @@ void UE::Rive::Renderer::Private::FRiveRenderTargetD3D11::CacheTextureTarget_Ren ID3D11Texture2D* D3D11ResourcePtr = (ID3D11Texture2D*)D3D11RHI->RHIGetResource(InTexture); D3D11_TEXTURE2D_DESC Desc; D3D11ResourcePtr->GetDesc(&Desc); - UE_LOG(LogRiveRenderer, Warning, TEXT("D3D11ResourcePtr texture %dx%d"), Desc.Width, Desc.Height); + UE_LOG(LogRiveRenderer, Log, TEXT("D3D11ResourcePtr texture %dx%d"), Desc.Width, Desc.Height); #if WITH_RIVE if (CachedPLSRenderTargetD3D) From 843125b1a42b8be0d0d84333ccda66420e78212b Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Thu, 18 Apr 2024 11:50:23 -0500 Subject: [PATCH 12/34] rive audio engine --- Source/Rive/Private/Game/RiveActor.cpp | 8 +++ .../Rive/Private/Game/RiveActorComponent.cpp | 5 ++ Source/Rive/Private/Rive/RiveFile.cpp | 26 +++++++++ Source/Rive/Public/Game/RiveActor.h | 4 ++ Source/Rive/Public/Game/RiveActorComponent.h | 6 +- Source/Rive/Public/Rive/RiveFile.h | 8 ++- Source/RiveCore/Private/Assets/RiveAsset.cpp | 34 ++++++++++- .../Private/Assets/URAssetHelpers.cpp | 22 +++++++- .../Private/Assets/URAssetImporter.cpp | 2 +- .../Private/Assets/URFileAssetLoader.cpp | 18 +++--- Source/RiveCore/Private/RiveArtboard.cpp | 16 ++++++ Source/RiveCore/Private/RiveAudioEngine.cpp | 56 +++++++++++++++++++ Source/RiveCore/Public/Assets/RiveAsset.h | 10 ++-- .../RiveCore/Public/Assets/URAssetHelpers.h | 4 ++ Source/RiveCore/Public/RiveArtboard.h | 7 +++ Source/RiveCore/Public/RiveAudioEngine.h | 40 +++++++++++++ Source/RiveCore/RiveCore.Build.cs | 3 +- .../RiveLibrary/RiveLibrary.Build.cs | 7 ++- 18 files changed, 257 insertions(+), 19 deletions(-) create mode 100644 Source/RiveCore/Private/RiveAudioEngine.cpp create mode 100644 Source/RiveCore/Public/RiveAudioEngine.h diff --git a/Source/Rive/Private/Game/RiveActor.cpp b/Source/Rive/Private/Game/RiveActor.cpp index 8f0ad53b..3a7c6fee 100644 --- a/Source/Rive/Private/Game/RiveActor.cpp +++ b/Source/Rive/Private/Game/RiveActor.cpp @@ -30,6 +30,8 @@ ARiveActor::ARiveActor() #endif // WITH_EDITOR + AudioEngine = CreateDefaultSubobject(TEXT("RiveAudioEngine")); + RootComponent->SetMobility(EComponentMobility::Static); PrimaryActorTick.bCanEverTick = true; @@ -68,6 +70,11 @@ void ARiveActor::PostLoad() bEditorDisplayRequested = true; #endif //WITH_EDITOR + + if (RiveFile) + { + RiveFile->SetAudioEngine(AudioEngine); + } } void ARiveActor::PostActorCreated() @@ -100,6 +107,7 @@ void ARiveActor::BeginPlay() if (IsValid(RiveFile) && IsValid(ActorWorld) && (ActorWorld->WorldType == EWorldType::PIE)) { RiveFile->InstantiateArtboard(); + RiveFile->GetArtboard()->SetAudioEngine(AudioEngine); } Super::BeginPlay(); diff --git a/Source/Rive/Private/Game/RiveActorComponent.cpp b/Source/Rive/Private/Game/RiveActorComponent.cpp index ad62eb3d..0c777a35 100644 --- a/Source/Rive/Private/Game/RiveActorComponent.cpp +++ b/Source/Rive/Private/Game/RiveActorComponent.cpp @@ -121,6 +121,11 @@ URiveArtboard* URiveActorComponent::InstantiateArtboard(URiveFile* InRiveFile, c URiveArtboard* Artboard = NewObject(); Artboard->Initialize(InRiveFile->GetNativeFile(), RiveRenderTarget, InArtboardName, InStateMachineName); RenderObjects.Add(Artboard); + + if (RiveAudioEngine != nullptr) + { + Artboard->SetAudioEngine(RiveAudioEngine); + } return Artboard; } diff --git a/Source/Rive/Private/Rive/RiveFile.cpp b/Source/Rive/Private/Rive/RiveFile.cpp index efe018d0..ac58c89a 100644 --- a/Source/Rive/Private/Rive/RiveFile.cpp +++ b/Source/Rive/Private/Rive/RiveFile.cpp @@ -519,6 +519,32 @@ void URiveFile::InstantiateArtboard(bool bRaiseArtboardChangedEvent) Artboard->Initialize(GetNativeFile(), RiveRenderTarget, ArtboardName, StateMachineName); } + if (AudioEngine != nullptr) + { + if (AudioEngine->GetNativeAudioEngine() == nullptr) + { + if (AudioEngineLambdaHandle.IsValid()) + { + AudioEngine->OnRiveAudioReady.Remove(AudioEngineLambdaHandle); + AudioEngineLambdaHandle.Reset(); + } + + TFunction AudioLambda = [this]() + { + Artboard->SetAudioEngine(AudioEngine); + AudioEngine->OnRiveAudioReady.Remove(AudioEngineLambdaHandle); + }; + AudioEngineLambdaHandle = AudioEngine->OnRiveAudioReady.AddLambda(AudioLambda); + } else + { + Artboard->SetAudioEngine(AudioEngine); + } + } else + { + UE_LOG(LogRive, Warning, TEXT("RiveFile::InstantiateArtboard - AudioEngine is null")); + } + + Artboard->OnArtboardTick_Render.BindDynamic(this, &URiveFile::OnArtboardTickRender); Artboard->OnGetLocalCoordinate.BindDynamic(this, &URiveFile::GetLocalCoordinate); diff --git a/Source/Rive/Public/Game/RiveActor.h b/Source/Rive/Public/Game/RiveActor.h index 097442a0..933b8865 100644 --- a/Source/Rive/Public/Game/RiveActor.h +++ b/Source/Rive/Public/Game/RiveActor.h @@ -5,6 +5,7 @@ #include "GameFramework/Actor.h" #include "RiveActor.generated.h" +class URiveAudioEngine; class URiveFile; class URiveFullScreenUserWidget; @@ -80,6 +81,9 @@ class RIVE_API ARiveActor : public AActor UPROPERTY(VisibleAnywhere, Instanced, NoClear, Category = "User Interface", meta = (ShowOnlyInnerProperties)) TObjectPtr ScreenUserWidget; + UPROPERTY(VisibleAnywhere, Instanced, NoClear, Category = "Audio", meta = (ShowOnlyInnerProperties)) + TObjectPtr AudioEngine; + #if WITH_EDITORONLY_DATA /** Display requested and will be executed on the first frame because we can't call BP function in the loading phase */ diff --git a/Source/Rive/Public/Game/RiveActorComponent.h b/Source/Rive/Public/Game/RiveActorComponent.h index 99fa7cf9..0e4ddf91 100644 --- a/Source/Rive/Public/Game/RiveActorComponent.h +++ b/Source/Rive/Public/Game/RiveActorComponent.h @@ -7,11 +7,12 @@ #include "Components/ActorComponent.h" #include "RiveActorComponent.generated.h" +class URiveAudioEngine; class URiveTexture; class URiveArtboard; class URiveFile; -UCLASS(ClassGroup = (Custom), Meta = (BlueprintSpawnableComponent)) +UCLASS(ClassGroup = (Rive), Meta = (BlueprintSpawnableComponent)) class RIVE_API URiveActorComponent : public UActorComponent { DECLARE_DYNAMIC_MULTICAST_DELEGATE(FRiveReadyDelegate); @@ -69,6 +70,9 @@ class RIVE_API URiveActorComponent : public UActorComponent UPROPERTY(BlueprintReadWrite, Transient, Category = Rive) TObjectPtr RenderTarget; + UPROPERTY(BlueprintReadWrite, Transient, Category = Rive) + TObjectPtr RiveAudioEngine; + private: UE::Rive::Renderer::IRiveRenderTargetPtr RiveRenderTarget; }; diff --git a/Source/Rive/Public/Rive/RiveFile.h b/Source/Rive/Public/Rive/RiveFile.h index 03e17d27..6e4b0f23 100644 --- a/Source/Rive/Public/Rive/RiveFile.h +++ b/Source/Rive/Public/Rive/RiveFile.h @@ -195,6 +195,8 @@ class RIVE_API URiveFile : public URiveTexture, public FTickableGameObject return nullptr; } + void SetAudioEngine(URiveAudioEngine* InAudioEngine) { AudioEngine = InAudioEngine; } + UPROPERTY(VisibleAnywhere, Category=Rive) TObjectPtr ParentRiveFile; @@ -258,7 +260,11 @@ class RIVE_API URiveFile : public URiveTexture, public FTickableGameObject UPROPERTY(Transient, VisibleInstanceOnly, BlueprintReadOnly, Category=Rive, meta=(NoResetToDefault, AllowPrivateAccess, ShowInnerProperties)) URiveArtboard* Artboard = nullptr; - + + UPROPERTY(Transient, VisibleInstanceOnly, BlueprintReadOnly, Category=Rive, meta=(AllowPrivateAccess)) + URiveAudioEngine* AudioEngine = nullptr; + FDelegateHandle AudioEngineLambdaHandle; + rive::Span RiveNativeFileSpan; rive::Span& GetNativeFileSpan() diff --git a/Source/RiveCore/Private/Assets/RiveAsset.cpp b/Source/RiveCore/Private/Assets/RiveAsset.cpp index 85567985..3b7b687e 100644 --- a/Source/RiveCore/Private/Assets/RiveAsset.cpp +++ b/Source/RiveCore/Private/Assets/RiveAsset.cpp @@ -4,12 +4,28 @@ #include "Logs/RiveCoreLog.h" #include "Misc/FileHelper.h" #include "rive/factory.hpp" +#include "rive/assets/audio_asset.hpp" +#include "rive/audio/audio_source.hpp" void URiveAsset::PostLoad() { UObject::PostLoad(); - // NativeAsset.Bytes = &NativeAssetBytes; + // Older version of UE Rive used these values as enum values + // Newer version of UE Rive doesn't use these values as enum values because the type values are beyond uint8 space + // This ensures older rive assets will still work, by converting old values to new values + switch((int)Type) + { + case 103: + Type = ERiveAssetType::FileBase; + break; + case 105: + Type = ERiveAssetType::Image; + break; + case 141: + Type = ERiveAssetType::Font; + break; + } } void URiveAsset::LoadFromDisk() @@ -20,7 +36,7 @@ void URiveAsset::LoadFromDisk() } } -bool URiveAsset::DecodeNativeAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes) +bool URiveAsset::LoadNativeAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes) { switch(Type) { @@ -28,6 +44,8 @@ bool URiveAsset::DecodeNativeAsset(rive::FileAsset& InAsset, rive::Factory* InRi return DecodeFontAsset(InAsset, InRiveFactory, AssetBytes); case ERiveAssetType::Image: return DecodeImageAsset(InAsset, InRiveFactory, AssetBytes); + case ERiveAssetType::Audio: + return LoadAudioAsset(InAsset, InRiveFactory, AssetBytes); } return false; @@ -65,3 +83,15 @@ bool URiveAsset::DecodeFontAsset(rive::FileAsset& InAsset, rive::Factory* InRive NativeAsset = FontAsset; return true; } + +bool URiveAsset::LoadAudioAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes) +{ + rive::SimpleArray Data = rive::SimpleArray(AssetBytes.data(), AssetBytes.count()); + rive::AudioSource* AudioSource = new rive::AudioSource(Data); + rive::rcp RcpAudioSource = rive::rcp(AudioSource); + + rive::AudioAsset* AudioAsset = InAsset.as(); + AudioAsset->audioSource(RcpAudioSource); + NativeAsset = AudioAsset; + return true; +} \ No newline at end of file diff --git a/Source/RiveCore/Private/Assets/URAssetHelpers.cpp b/Source/RiveCore/Private/Assets/URAssetHelpers.cpp index 4206c11d..8b7d610c 100644 --- a/Source/RiveCore/Private/Assets/URAssetHelpers.cpp +++ b/Source/RiveCore/Private/Assets/URAssetHelpers.cpp @@ -44,6 +44,9 @@ bool URAssetHelpers::FindDiskAsset(const FString& InBasePath, URiveAsset* InRive case ERiveAssetType::Image: Extensions = &ImageExtensions; break; + case ERiveAssetType::Audio: + Extensions = &AudioExtensions; + break; default: assert(true); return false; // this means we don't support this asset type @@ -77,4 +80,21 @@ bool URAssetHelpers::FindDiskAsset(const FString& InBasePath, URiveAsset* InRive InRiveAsset->AssetPath = FilePath; return true; -} \ No newline at end of file +} + +ERiveAssetType URAssetHelpers::GetUnrealType(uint16_t RiveType) +{ + switch(RiveType) + { + case 103: + return ERiveAssetType::FileBase; + case 105: + return ERiveAssetType::Image; + case 141: + return ERiveAssetType::Font; + case 406: + return ERiveAssetType::Audio; + default: + return ERiveAssetType::None; + } +} diff --git a/Source/RiveCore/Private/Assets/URAssetImporter.cpp b/Source/RiveCore/Private/Assets/URAssetImporter.cpp index 01a5465f..01bf52f9 100644 --- a/Source/RiveCore/Private/Assets/URAssetImporter.cpp +++ b/Source/RiveCore/Private/Assets/URAssetImporter.cpp @@ -93,7 +93,7 @@ bool UE::Rive::Assets::FURAssetImporter::loadContents(rive::FileAsset& InAsset, RiveAsset->Id = InAsset.assetId(); RiveAsset->Name = FString(UTF8_TO_TCHAR(InAsset.name().c_str())); - RiveAsset->Type = static_cast(InAsset.coreType()); + RiveAsset->Type = URAssetHelpers::GetUnrealType(InAsset.coreType()); RiveAsset->bIsInBand = bIsInBand; RiveAsset->MarkPackageDirty(); diff --git a/Source/RiveCore/Private/Assets/URFileAssetLoader.cpp b/Source/RiveCore/Private/Assets/URFileAssetLoader.cpp index 416dbbad..c1134843 100644 --- a/Source/RiveCore/Private/Assets/URFileAssetLoader.cpp +++ b/Source/RiveCore/Private/Assets/URFileAssetLoader.cpp @@ -2,6 +2,7 @@ #include "Assets/URFileAssetLoader.h" #include "Assets/RiveAsset.h" +#include "Assets/URAssetHelpers.h" #include "Logs/RiveCoreLog.h" #include "rive/factory.hpp" @@ -40,7 +41,11 @@ bool UE::Rive::Assets::FURFileAssetLoader::loadContents(rive::FileAsset& InAsset URiveAsset* RiveAsset = nullptr; const TObjectPtr* RiveAssetPtr = Assets.Find(InAsset.assetId()); - if (RiveAssetPtr == nullptr) + if (RiveAssetPtr != nullptr && RiveAssetPtr->Get() != nullptr) + { + RiveAsset = RiveAssetPtr->Get(); + } + else { if (!bUseInBand) { @@ -54,12 +59,11 @@ bool UE::Rive::Assets::FURFileAssetLoader::loadContents(rive::FileAsset& InAsset RiveAsset->Id = InAsset.assetId(); RiveAsset->Name = FString(UTF8_TO_TCHAR(InAsset.name().c_str())); - RiveAsset->Type = static_cast(InAsset.coreType()); + RiveAsset->Type = URAssetHelpers::GetUnrealType(InAsset.coreType()); RiveAsset->bIsInBand = true; - } - else - { - RiveAsset = RiveAssetPtr->Get(); + + // We only add it to our assets here so that it shows up in the inspector, otherwise this doesn't have any functional effect on anything due to it being a transient, in-band asset + Assets.Add(InAsset.assetId(), RiveAsset); } rive::Span OutOfBandBytes; @@ -74,7 +78,7 @@ bool UE::Rive::Assets::FURFileAssetLoader::loadContents(rive::FileAsset& InAsset AssetBytes = &OutOfBandBytes; } - return RiveAsset->DecodeNativeAsset(InAsset, InFactory, *AssetBytes); + return RiveAsset->LoadNativeAsset(InAsset, InFactory, *AssetBytes); } #endif // WITH_RIVE diff --git a/Source/RiveCore/Private/RiveArtboard.cpp b/Source/RiveCore/Private/RiveArtboard.cpp index a745d1ab..9c5a8cfa 100644 --- a/Source/RiveCore/Private/RiveArtboard.cpp +++ b/Source/RiveCore/Private/RiveArtboard.cpp @@ -401,6 +401,22 @@ void URiveArtboard::Initialize(rive::File* InNativeFilePtr, UE::Rive::Renderer:: Initialize_Internal(NativeArtboard); } +void URiveArtboard::SetAudioEngine(URiveAudioEngine* AudioEngine) +{ + if (AudioEngine == nullptr) + { + rive::rcp NativeEngine = NativeArtboardPtr->audioEngine(); + + if (NativeEngine != nullptr) + { + NativeEngine->unref(); + } + NativeArtboardPtr->audioEngine(nullptr); + return; + } + NativeArtboardPtr->audioEngine(AudioEngine->GetNativeAudioEngine()); +} + void URiveArtboard::Tick_Render(float InDeltaSeconds) { if (OnArtboardTick_Render.IsBound()) diff --git a/Source/RiveCore/Private/RiveAudioEngine.cpp b/Source/RiveCore/Private/RiveAudioEngine.cpp new file mode 100644 index 00000000..9f2509da --- /dev/null +++ b/Source/RiveCore/Private/RiveAudioEngine.cpp @@ -0,0 +1,56 @@ +// Copyright Rive, Inc. All rights reserved. + +#include "RiveAudioEngine.h" +#include "AudioDevice.h" +#include "rive/artboard.hpp" + +void URiveAudioEngine::BeginPlay() +{ + if (FAudioDevice* AudioDevice = GetAudioDevice()) + { + // Make our Rive audio engine + if (NativeAudioEnginePtr.get() != nullptr) + { + NativeAudioEnginePtr->unref(); + NativeAudioEnginePtr = nullptr; + } + + NativeAudioEnginePtr = rive::rcp(rive::AudioEngine::Make(NumChannels, AudioDevice->SampleRate)); + + Start(); + } + + OnRiveAudioReady.Broadcast(); + Super::BeginPlay(); +} + +void URiveAudioEngine::BeginDestroy() +{ + if (NativeAudioEnginePtr != nullptr) { + NativeAudioEnginePtr->unref(); + NativeAudioEnginePtr = nullptr; + } + + Super::BeginDestroy(); + +} + +int32 URiveAudioEngine::OnGenerateAudio(float* OutAudio, int32 NumSamples) +{ + if (NativeAudioEnginePtr == nullptr) return 0; + + TArray AudioData; + AudioData.AddZeroed(NumSamples); + + if (NativeAudioEnginePtr->readAudioFrames(AudioData.GetData(), NumSamples / NumChannels, nullptr)) + { + FMemory::Memcpy(OutAudio, AudioData.GetData(), NumSamples * sizeof(float)); + return NumSamples; + } + return 0; +} + +void URiveAudioEngine::Make(int InChannels, int InSampleRate) +{ + +} diff --git a/Source/RiveCore/Public/Assets/RiveAsset.h b/Source/RiveCore/Public/Assets/RiveAsset.h index d6ddbe7c..2360bb9e 100644 --- a/Source/RiveCore/Public/Assets/RiveAsset.h +++ b/Source/RiveCore/Public/Assets/RiveAsset.h @@ -18,9 +18,10 @@ UENUM(BlueprintType) enum class ERiveAssetType : uint8 { None = 0, - FileBase = 103, - Image = 105, - Font = 141 + FileBase, + Image, + Font, + Audio }; /** @@ -62,8 +63,9 @@ class RIVECORE_API URiveAsset : public UObject #endif void LoadFromDisk(); - bool DecodeNativeAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes); + bool LoadNativeAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes); private: bool DecodeImageAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes); bool DecodeFontAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes); + bool LoadAudioAsset(rive::FileAsset& InAsset, rive::Factory* InRiveFactory, const rive::Span& AssetBytes); }; diff --git a/Source/RiveCore/Public/Assets/URAssetHelpers.h b/Source/RiveCore/Public/Assets/URAssetHelpers.h index 23a22764..03105473 100644 --- a/Source/RiveCore/Public/Assets/URAssetHelpers.h +++ b/Source/RiveCore/Public/Assets/URAssetHelpers.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" +enum class ERiveAssetType : uint8; class URiveAsset; struct FURAsset; @@ -16,6 +17,9 @@ class URAssetHelpers static bool FindDiskAsset(const FString& InBasePath, URiveAsset* InRiveAsset); //TArray& OutAssetBytes) + static ERiveAssetType GetUnrealType(uint16_t RiveType); + inline const static TArray FontExtensions = {"ttf", "otf"}; inline const static TArray ImageExtensions = {"png"}; + inline const static TArray AudioExtensions = {"wav", "mp3", "flac"}; }; diff --git a/Source/RiveCore/Public/RiveArtboard.h b/Source/RiveCore/Public/RiveArtboard.h index e61ddc57..45a9339f 100644 --- a/Source/RiveCore/Public/RiveArtboard.h +++ b/Source/RiveCore/Public/RiveArtboard.h @@ -2,6 +2,7 @@ #pragma once #include "IRiveRenderTarget.h" #include "MatrixTypes.h" +#include "RiveAudioEngine.h" #include "RiveEvent.h" #include "RiveTypes.h" #include "URStateMachine.h" @@ -118,6 +119,12 @@ class RIVECORE_API URiveArtboard : public UObject */ UFUNCTION(BlueprintCallable, Category = Rive) FVector2f GetLocalCoordinatesFromExtents(const FVector2f& InPosition, const FBox2f& InExtents, const FIntPoint& TextureSize, ERiveAlignment Alignment, ERiveFitType FitType) const; + + /* + * This requires that the audio engine has been initialized via BeginPlay before setting + */ + UFUNCTION(BlueprintCallable) + void SetAudioEngine(URiveAudioEngine* AudioEngine); #if WITH_RIVE diff --git a/Source/RiveCore/Public/RiveAudioEngine.h b/Source/RiveCore/Public/RiveAudioEngine.h new file mode 100644 index 00000000..2a57f6bd --- /dev/null +++ b/Source/RiveCore/Public/RiveAudioEngine.h @@ -0,0 +1,40 @@ +// Copyright Rive, Inc. All rights reserved. + +#pragma once + +#include "Components/SynthComponent.h" +#include "CoreMinimal.h" +#include "Sound/SoundWaveProcedural.h" +#include "rive/audio/audio_engine.hpp" +#include "RiveAudioEngine.generated.h" + +namespace rive +{ + class Artboard; +} + +UCLASS(ClassGroup = (Rive), Meta = (BlueprintSpawnableComponent)) +class RIVECORE_API URiveAudioEngine : public USynthComponent +{ + GENERATED_BODY() +public: + DECLARE_MULTICAST_DELEGATE(FOnRiveAudioEngineReadyEvent) + + virtual void BeginPlay() override; + virtual void BeginDestroy() override; + + // Event called after BeginPlay, and after NativeAudioEnginePtr has been made + // This can be used if you expect initialization of a user of this system to initialize before this is ready + FOnRiveAudioEngineReadyEvent OnRiveAudioReady; + + virtual int32 OnGenerateAudio(float* OutAudio, int32 NumSamples) override; + + void Make(int InChannels, int InSampleRate); + rive::rcp GetNativeAudioEngine() { return NativeAudioEnginePtr; } + + UPROPERTY(BlueprintReadOnly) + USoundWaveProcedural* SoundWaveProcedural; + +private: + rive::rcp NativeAudioEnginePtr = nullptr; +}; diff --git a/Source/RiveCore/RiveCore.Build.cs b/Source/RiveCore/RiveCore.Build.cs index a530adea..5c13fac7 100644 --- a/Source/RiveCore/RiveCore.Build.cs +++ b/Source/RiveCore/RiveCore.Build.cs @@ -32,7 +32,8 @@ public RiveCore(ReadOnlyTargetRules Target) : base(Target) "Core", "RHICore", "RHI", - "RenderCore" + "RenderCore", + "AudioMixer" } ); diff --git a/Source/ThirdParty/RiveLibrary/RiveLibrary.Build.cs b/Source/ThirdParty/RiveLibrary/RiveLibrary.Build.cs index 7e310640..b7931d73 100644 --- a/Source/ThirdParty/RiveLibrary/RiveLibrary.Build.cs +++ b/Source/ThirdParty/RiveLibrary/RiveLibrary.Build.cs @@ -149,6 +149,11 @@ public RiveLibrary(ReadOnlyTargetRules Target) : base(Target) bIsPlatformAdded = true; } - PublicDefinitions.Add("WITH_RIVE=" + (bIsPlatformAdded ? "1" : "0")); + if (bIsPlatformAdded) + { + PublicDefinitions.Add("WITH_RIVE=1"); + PublicDefinitions.Add("WITH_RIVE_AUDIO=1"); + PublicDefinitions.Add("EXTERNAL_RIVE_AUDIO_ENGINE=1"); + } } } From 08e8d1b4b2a78276c49f48e7d6cc12e605feb435 Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Wed, 24 Apr 2024 08:23:01 -0400 Subject: [PATCH 13/34] Updated Rive Win64 and Android Libraries Using the same rive-renderer commit 793402d9fd01358869ab1a5869be1dc08ca80968 --- Source/ThirdParty/RiveLibrary/Libraries/Android/liblibpng.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Android/librive.a | 4 ++-- .../RiveLibrary/Libraries/Android/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/Android/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/Android/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/Android/librive_sheenbidi.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Android/libzlib.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Win64/rive.lib | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/Win64/rive_decoders.lib | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/Win64/rive_harfbuzz.lib | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_libpng.lib | 4 ++-- .../RiveLibrary/Libraries/Win64/rive_pls_renderer.lib | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/Win64/rive_sheenbidi.lib | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/liblibpng.a index 1cc2d31d..6f8b813b 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db58a9581871258382c930b42dec311b290131db7ba4aeecb3ba7977e8b6ff2c -size 1349892 +oid sha256:aacfb56ead0ee0b5bcf29cf41ebcbe5e07ae034104b35958789c12dd3b98eee0 +size 1350628 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive.a index f8c0f811..7bf653dd 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8471a7d2eb7f10d1fde9ed9ad6fabebf371b65294dc1779079346063365c6d65 -size 64102342 +oid sha256:c2cb0b67d9a9a54f0e8b744830942d5cc198c8fa01c2bd90d621d05d0c9afcf1 +size 68593624 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_decoders.a index 5e597c05..75e41e90 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d8912a90ab0cff7205ede779f35babf7d71cd5399484d621e5827a54c360a56 -size 247270 +oid sha256:7095a3b762ad4bfdc2ba958f06d620458ab63d7c63079f16e19daba2fdc18980 +size 247350 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_harfbuzz.a index a171acb2..e19f101e 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc6fe8b7cf2f0d7f79b3d3c183f990368181dfc3c0ec5d303a963e595bd6847e -size 106819306 +oid sha256:4bcac8d8bb9f7bb1b5987bc18b4656cfee343f897d0141bdce3d84f1bc2c9e59 +size 106825590 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_pls_renderer.a index 3c5e2cd5..95a790a4 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37ef77fe5af457039f17ded67e214037d88f4335a0878d7f3f95e813b2b17b42 -size 8584812 +oid sha256:183f36a0c0f77dbec17ba8db2aa4db67f47ea4f1308249a7610732d312ec530e +size 8585692 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_sheenbidi.a index cd02321f..b1c4d78d 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e31bde71e46fe0b35a4fd4dfaf793dad71796910e77028b185e1492ed91524ee -size 341862 +oid sha256:272112bd818ec83dffd4ad65ecf5917a70f2478f405e21d1619a6725c5e3e453 +size 342614 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Android/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/Android/libzlib.a index 094b356a..26d41974 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Android/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Android/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bad98aa665898bc783acc0dc6267692346a75f0a7f44f7a781746f38d1fe95e -size 411462 +oid sha256:0302ff16796255ffc8a1fb1103abcf8f240212e19284b09f28ab0efc76a8ba16 +size 412086 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive.lib b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive.lib index 7a9a5f88..48a92cce 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive.lib +++ b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a45accc5f7e9d4acb6e0d8a186f1406fdeee43bcceafac54c900474cb4d3027 -size 43407752 +oid sha256:99e5673ac6b96e03deae42a50ed36da2a4e9e3532901480e4be22ea6387b3d0b +size 47346130 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_decoders.lib b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_decoders.lib index 6e53bbb9..136cf4c0 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_decoders.lib +++ b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_decoders.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97ef621a87a4dc8f35eb2113b6e3c1b56dee0d25c234faaf6d4d3f0990aacec2 -size 180622 +oid sha256:5ce40767f41c55f94f37d72455373e27c9d04846093d26d5a2699c428cf9b1ed +size 181366 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_harfbuzz.lib b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_harfbuzz.lib index 9620a6ea..4b1c44b3 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_harfbuzz.lib +++ b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_harfbuzz.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:211dcc38d7b2ea8f6a29f43ab9239dfc76d892a6626af0faba849d434164e142 -size 82204154 +oid sha256:8add19dd6408f1e7cc6176359dfc3e03307c4fa4521329e24bfe1818d904b307 +size 82339568 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_libpng.lib b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_libpng.lib index 2c144aea..c81fab59 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_libpng.lib +++ b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_libpng.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f618eb1d048a11f0a750fc5be936843ba13efee665a9f387c730d35ccf4a1f2d -size 1298286 +oid sha256:c11a98a42a9969dc3b95ebfff2083cfd822215e3c48f2573fbf30ebf12bff9a6 +size 1305818 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_pls_renderer.lib b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_pls_renderer.lib index a22dca13..ebfaaa92 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_pls_renderer.lib +++ b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_pls_renderer.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e2e6746806551cd5a41e199099cb377edf9906761b8932f847fd25449c61456 -size 7358782 +oid sha256:eb8a746338c6b42a61bd34179dbff3fc0f7f91bdbd11f04bcdbb3afedf831e8d +size 7379150 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_sheenbidi.lib b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_sheenbidi.lib index c6c18830..02771a91 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_sheenbidi.lib +++ b/Source/ThirdParty/RiveLibrary/Libraries/Win64/rive_sheenbidi.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f0030ca769fb9f4370d2856abbfac7c23e0ef4e827813e9d86763d08ec58ef9 -size 355358 +oid sha256:8e55036675ffc073c9e510024696fbca251c1cf0ed500663a5067c9e09bea49a +size 362678 From dbed123de5adedb0321110d92fac3609e0b4038f Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 24 Apr 2024 09:37:24 -0500 Subject: [PATCH 14/34] Build script (#83) * add a rive build script to ease building in new rive renderer updates * fix NDK_PATH/NDK_ROOT override * adjust windows and android build commands per Matthieu's settings and --force-md custom switch * clear old .sim.a files during ios sim build * adjust some exceptions --- Scripts/build-rive/build-rive.py | 291 ++++++++++++++++++++++++++++ Scripts/build-rive/requirements.txt | 3 + 2 files changed, 294 insertions(+) create mode 100644 Scripts/build-rive/build-rive.py create mode 100644 Scripts/build-rive/requirements.txt diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py new file mode 100644 index 00000000..c1975806 --- /dev/null +++ b/Scripts/build-rive/build-rive.py @@ -0,0 +1,291 @@ +import os +import shutil +import click +import subprocess +import sys + +# install requirements via pip install -r requirements.txt +# runnning: python3 build-rive.py + +script_directory = os.path.dirname(os.path.abspath(__file__)) + +targets = [ + 'rive', + 'rive_decoders', + 'rive_harfbuzz', + 'rive_pls_renderer', + 'rive_pls_shaders', + 'rive_sheenbidi', + 'libpng', + 'zlib' +] + +def get_base_command(rive_renderer_path): + return ( + f"premake5 --scripts={rive_renderer_path}/submodules/rive-cpp/build " + f"--release --with_rive_text --with_rive_audio=external" + ) + +@click.command() +@click.argument('rive_renderer_path') +def main(rive_renderer_path): + os.chdir(rive_renderer_path) + + if sys.platform.startswith('darwin'): + if not do_mac(rive_renderer_path): + return + + if not do_ios(rive_renderer_path): + return + elif sys.platform.startswith('win32'): + if not do_windows(rive_renderer_path): + return + + if not do_android(rive_renderer_path): + return + else: + print_red("Unsupported platform") + return + + copy_includes(rive_renderer_path) + + +def do_android(rive_renderer_path): + try: + if 'NDK_ROOT' in os.environ and 'NDK_PATH' not in os.environ: + os.environ['NDK_PATH'] = os.environ['NDK_ROOT'] + + command = f'{get_base_command(rive_renderer_path)} --os=android --arch=arm64 --out=out/android vs2022' + execute_command(command) + + os.chdir(os.path.join(rive_renderer_path, 'out', 'android')) + execute_command(f'make') + + print_green(f'Built in {os.getcwd()}') + + rive_libraries_path = os.path.join(script_directory, '..', '..', 'Source', 'ThirdParty', 'RiveLibrary', 'Libraries') + + print_green('Copying Android libs') + copy_files(os.getcwd(), os.path.join(rive_libraries_path, 'Android'), ".a") + except Exception as e: + print_red(f"Exiting due to errors... {e}") + return False + + return True + + + +def do_windows(rive_renderer_path): + try: + command = f'{get_base_command(rive_renderer_path)} --force-md --os=windows --out=out/windows vs2022' + execute_command(command) + + msbuild_path = '' + import vswhere + + msbuilds = vswhere.find('MSBuild') + if len(msbuilds) == 0: + raise Exception('Could not find msbuild') + + msbuild_path = os.path.join(msbuilds[-1:][0], 'Current', 'Bin', 'MSBuild.exe') + if not os.path.exists(msbuild_path): + raise Exception(f'Invalid MSBuild path {msbuild_path}') + + + os.chdir(os.path.join(rive_renderer_path, 'out', 'windows')) + execute_command(f'"{msbuild_path}" ./rive.sln /t:{";".join(targets)}') + + print_green(f'Built in {os.getcwd()}') + + rive_libraries_path = os.path.join(script_directory, '..', '..', 'Source', 'ThirdParty', 'RiveLibrary', 'Libraries') + + print_green('Copying Windows') + copy_files(os.getcwd(), os.path.join(rive_libraries_path, 'Win64'), ".lib") + except Exception as e: + print_red("Exiting due to errors...") + print_red(e) + return False + + return True + + +def do_ios(rive_renderer_path): + try: + command = f'{get_base_command(rive_renderer_path)} gmake2 --os=ios' + build_dirs = {} + + print_green('Building iOS') + os.chdir(rive_renderer_path) + execute_command(f'{command} --variant=system --out=out/ios') + os.chdir(os.path.join(rive_renderer_path, 'out', 'ios')) + build_dirs['ios'] = os.getcwd() + for target in targets: + execute_command(f'make {target}') + + print_green('Building iOS Simulator') + os.chdir(rive_renderer_path) + execute_command(f'{command} --variant=emulator --out=out/ios_sim') + os.chdir(os.path.join(rive_renderer_path, 'out', 'ios_sim')) + build_dirs['ios_sim'] = os.getcwd() + for target in targets: + execute_command(f'make {target}') + + # clear old .sim.a files + for root, dirs, files in os.walk(build_dirs['ios_sim']): + for file in files: + if file.endswith('.sim.a'): + os.unlink(os.path.join(root, file)) + + # we need to rename all ios simulator to .sim.a + for root, dirs, files in os.walk(build_dirs['ios_sim']): + for file in files: + if file.endswith('.a'): + old_file = os.path.join(root, file) + new_file = f'{file[:-2]}.sim.a' + new_file = os.path.join(root, new_file) + try: + os.unlink(new_file) # just in case an existing .sim.a exists + except: + pass + os.rename(old_file, new_file) + + os.chdir(rive_renderer_path) + print_green(f'Built in {build_dirs}') + + rive_libraries_path = os.path.join(script_directory, '..', '..', 'Source', 'ThirdParty', 'RiveLibrary', 'Libraries') + + print_green('Copying iOS and iOS simulator') + copy_files(build_dirs['ios'], os.path.join(rive_libraries_path, 'IOS'), ".a") + copy_files(build_dirs['ios_sim'], os.path.join(rive_libraries_path, 'IOS'), ".a") + except Exception as e: + print_red("Exiting due to errors...") + print_red(e) + return False + + return True + + +def do_mac(rive_renderer_path): + try: + command = f'{get_base_command(rive_renderer_path)} --os=macosx gmake2' + build_dirs = {} + + # we currently don't use fat libs, otherwise we could use this for macOS + # build_fat = False + # if build_fat: + # execute_command(f'{command} --arch=universal --out=out/universal') + # os.chdir(os.path.join(rive_renderer_path, 'out', 'universal')) + # build_dirs['universal'] = os.getcwd() + # execute_command('make') + # else: + + + print_green('Building macOS x64') + os.chdir(rive_renderer_path) + execute_command(f'{command} --arch=x64 --out=out/mac_x64') + os.chdir(os.path.join(rive_renderer_path, 'out', 'mac_x64')) + build_dirs['mac_x64'] = os.getcwd() + for target in targets: + execute_command(f'make {target}') + + print_green('Building macOS x64') + os.chdir(rive_renderer_path) + execute_command(f'{command} --arch=arm64 --out=out/mac_arm64') + os.chdir(os.path.join(rive_renderer_path, 'out', 'mac_arm64')) + build_dirs['mac_arm64'] = os.getcwd() + for target in targets: + execute_command(f'make {target}') + + os.chdir(rive_renderer_path) + print_green(f'Built in {build_dirs}') + + rive_libraries_path = os.path.join(script_directory, '..', '..', 'Source', 'ThirdParty', 'RiveLibrary', 'Libraries') + + print_green('Copying macOS x64') + copy_files(build_dirs['mac_x64'], os.path.join(rive_libraries_path, 'Mac', 'Intel'), ".a") + copy_files(build_dirs['mac_arm64'], os.path.join(rive_libraries_path, 'Mac', 'Mac'), ".a") + except Exception as e: + print_red("Exiting due to errors...") + print_red(e) + return False + + return True + + +def copy_files(src, dst, extension): + # Ensure the source directory exists + if not os.path.exists(src): + print_red(f"The source directory {src} does not exist.") + return + + os.makedirs(dst, exist_ok=True) + + for root, dirs, files in os.walk(src): + files_to_copy = [f for f in files if f.endswith(extension)] + for file in files_to_copy: + src_path = os.path.join(root, file) + relative_path = os.path.relpath(root, src) + dest_path = os.path.join(dst, relative_path, file) + os.makedirs(os.path.dirname(dest_path), exist_ok=True) + shutil.copy2(src_path, dest_path) + + +def copy_includes(rive_renderer_path): + print_green('Copying rive includes...') + rive_includes_path = os.path.join(rive_renderer_path, 'submodules', 'rive-cpp', 'include') + rive_pls_includes_path = os.path.join(rive_renderer_path, 'include') + target_path = os.path.join(script_directory, '..', '..', 'Source', 'ThirdParty', 'RiveLibrary', 'Includes') + if os.path.exists(target_path): + shutil.rmtree(target_path) + + shutil.copytree(rive_includes_path, target_path, dirs_exist_ok=True) + shutil.copytree(rive_pls_includes_path, target_path, dirs_exist_ok=True) + + +def execute_command(cmd): + had_errors = False + print_green(f'Executing {cmd}') + process = subprocess.Popen( + cmd, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + bufsize=1, + universal_newlines=True + ) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + if ' error' in output.lower() and 'Structured output' not in output: + print_red(f'{output.strip()}') + had_errors = True + else: + print(output.strip()) + + if sys.platform.startswith('darwin'): + stdout, stderr = process.communicate() + if stderr: + if not "pnglibconf.h: Permission denied" in stderr: + print_red(stderr.strip()) + had_errors = True + + process.wait() + + if had_errors: + raise Exception('execute_command had errors') + + +def print_green(text): + print(f'\033[32m{text}\033[0m') + + +def print_red(text): + print(f'\033[91m{text}\033[0m') + + +if __name__ == '__main__': + main() diff --git a/Scripts/build-rive/requirements.txt b/Scripts/build-rive/requirements.txt new file mode 100644 index 00000000..f32b5f24 --- /dev/null +++ b/Scripts/build-rive/requirements.txt @@ -0,0 +1,3 @@ +click +vswhere +ply \ No newline at end of file From 4cb66b15690cc1cd298aadc6623ba874826af659 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 24 Apr 2024 11:17:04 -0500 Subject: [PATCH 15/34] exclude 0 Error in windows builds --- Scripts/build-rive/build-rive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index c1975806..e652ac20 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -260,7 +260,7 @@ def execute_command(cmd): if output == '' and process.poll() is not None: break if output: - if ' error' in output.lower() and 'Structured output' not in output: + if ' error' in output.lower() and 'Structured output' not in output and '0 Error' not in output: print_red(f'{output.strip()}') had_errors = True else: From cc6a728db3c0444bc1afa5702453fc693f2b3013 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 24 Apr 2024 11:56:11 -0500 Subject: [PATCH 16/34] switch path at the beginning of each build platform --- Scripts/build-rive/build-rive.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index e652ac20..368a8156 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -29,8 +29,6 @@ def get_base_command(rive_renderer_path): @click.command() @click.argument('rive_renderer_path') def main(rive_renderer_path): - os.chdir(rive_renderer_path) - if sys.platform.startswith('darwin'): if not do_mac(rive_renderer_path): return @@ -52,6 +50,8 @@ def main(rive_renderer_path): def do_android(rive_renderer_path): try: + os.chdir(rive_renderer_path) + if 'NDK_ROOT' in os.environ and 'NDK_PATH' not in os.environ: os.environ['NDK_PATH'] = os.environ['NDK_ROOT'] @@ -74,9 +74,9 @@ def do_android(rive_renderer_path): return True - def do_windows(rive_renderer_path): try: + os.chdir(rive_renderer_path) command = f'{get_base_command(rive_renderer_path)} --force-md --os=windows --out=out/windows vs2022' execute_command(command) @@ -111,11 +111,11 @@ def do_windows(rive_renderer_path): def do_ios(rive_renderer_path): try: + os.chdir(rive_renderer_path) command = f'{get_base_command(rive_renderer_path)} gmake2 --os=ios' build_dirs = {} print_green('Building iOS') - os.chdir(rive_renderer_path) execute_command(f'{command} --variant=system --out=out/ios') os.chdir(os.path.join(rive_renderer_path, 'out', 'ios')) build_dirs['ios'] = os.getcwd() @@ -167,6 +167,7 @@ def do_ios(rive_renderer_path): def do_mac(rive_renderer_path): try: + os.chdir(rive_renderer_path) command = f'{get_base_command(rive_renderer_path)} --os=macosx gmake2' build_dirs = {} @@ -181,7 +182,6 @@ def do_mac(rive_renderer_path): print_green('Building macOS x64') - os.chdir(rive_renderer_path) execute_command(f'{command} --arch=x64 --out=out/mac_x64') os.chdir(os.path.join(rive_renderer_path, 'out', 'mac_x64')) build_dirs['mac_x64'] = os.getcwd() From a4d270272c05c10ac89d2dab445ab0989f3989e0 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 24 Apr 2024 11:59:10 -0500 Subject: [PATCH 17/34] use msbuild for both android and windows --- Scripts/build-rive/build-rive.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index 368a8156..50f995b4 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -47,6 +47,18 @@ def main(rive_renderer_path): copy_includes(rive_renderer_path) +def get_msbuild(): + msbuild_path = '' + import vswhere + + msbuilds = vswhere.find('MSBuild') + if len(msbuilds) == 0: + raise Exception('Could not find msbuild') + + msbuild_path = os.path.join(msbuilds[-1:][0], 'Current', 'Bin', 'MSBuild.exe') + if not os.path.exists(msbuild_path): + raise Exception(f'Invalid MSBuild path {msbuild_path}') + return msbuild_path def do_android(rive_renderer_path): try: @@ -58,8 +70,10 @@ def do_android(rive_renderer_path): command = f'{get_base_command(rive_renderer_path)} --os=android --arch=arm64 --out=out/android vs2022' execute_command(command) + msbuild_path = get_msbuild() + os.chdir(os.path.join(rive_renderer_path, 'out', 'android')) - execute_command(f'make') + execute_command(f'"{msbuild_path}" ./rive.sln /t:{";".join(targets)}') print_green(f'Built in {os.getcwd()}') @@ -80,18 +94,8 @@ def do_windows(rive_renderer_path): command = f'{get_base_command(rive_renderer_path)} --force-md --os=windows --out=out/windows vs2022' execute_command(command) - msbuild_path = '' - import vswhere - - msbuilds = vswhere.find('MSBuild') - if len(msbuilds) == 0: - raise Exception('Could not find msbuild') - - msbuild_path = os.path.join(msbuilds[-1:][0], 'Current', 'Bin', 'MSBuild.exe') - if not os.path.exists(msbuild_path): - raise Exception(f'Invalid MSBuild path {msbuild_path}') + msbuild_path = get_msbuild() - os.chdir(os.path.join(rive_renderer_path, 'out', 'windows')) execute_command(f'"{msbuild_path}" ./rive.sln /t:{";".join(targets)}') From 7963587e32fa62606313385cd3bfaff3a32f5cf8 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 24 Apr 2024 15:17:16 -0500 Subject: [PATCH 18/34] ignore "no symbols" when compiling in build script, and allow --release to be specified for release libs --- Scripts/build-rive/build-rive.py | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index 50f995b4..5bfc51ce 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -20,26 +20,27 @@ 'zlib' ] -def get_base_command(rive_renderer_path): +def get_base_command(rive_renderer_path, release): return ( f"premake5 --scripts={rive_renderer_path}/submodules/rive-cpp/build " - f"--release --with_rive_text --with_rive_audio=external" + f"--with_rive_text --with_rive_audio=external {'--release' if release else ''}" ) @click.command() @click.argument('rive_renderer_path') -def main(rive_renderer_path): +@click.option('--release', is_flag=True, default=False) +def main(rive_renderer_path, release): if sys.platform.startswith('darwin'): - if not do_mac(rive_renderer_path): + if not do_mac(rive_renderer_path, release): return - if not do_ios(rive_renderer_path): + if not do_ios(rive_renderer_path, release): return elif sys.platform.startswith('win32'): - if not do_windows(rive_renderer_path): + if not do_windows(rive_renderer_path, release): return - if not do_android(rive_renderer_path): + if not do_android(rive_renderer_path, release): return else: print_red("Unsupported platform") @@ -60,14 +61,14 @@ def get_msbuild(): raise Exception(f'Invalid MSBuild path {msbuild_path}') return msbuild_path -def do_android(rive_renderer_path): +def do_android(rive_renderer_path, release): try: os.chdir(rive_renderer_path) if 'NDK_ROOT' in os.environ and 'NDK_PATH' not in os.environ: os.environ['NDK_PATH'] = os.environ['NDK_ROOT'] - command = f'{get_base_command(rive_renderer_path)} --os=android --arch=arm64 --out=out/android vs2022' + command = f'{get_base_command(rive_renderer_path, release)} --os=android --arch=arm64 --out=out/android vs2022' execute_command(command) msbuild_path = get_msbuild() @@ -88,10 +89,10 @@ def do_android(rive_renderer_path): return True -def do_windows(rive_renderer_path): +def do_windows(rive_renderer_path, release): try: os.chdir(rive_renderer_path) - command = f'{get_base_command(rive_renderer_path)} --force-md --os=windows --out=out/windows vs2022' + command = f'{get_base_command(rive_renderer_path, release)} --force-md --os=windows --out=out/windows vs2022' execute_command(command) msbuild_path = get_msbuild() @@ -113,10 +114,10 @@ def do_windows(rive_renderer_path): return True -def do_ios(rive_renderer_path): +def do_ios(rive_renderer_path, release): try: os.chdir(rive_renderer_path) - command = f'{get_base_command(rive_renderer_path)} gmake2 --os=ios' + command = f'{get_base_command(rive_renderer_path, release)} gmake2 --os=ios' build_dirs = {} print_green('Building iOS') @@ -169,10 +170,10 @@ def do_ios(rive_renderer_path): return True -def do_mac(rive_renderer_path): +def do_mac(rive_renderer_path, release): try: os.chdir(rive_renderer_path) - command = f'{get_base_command(rive_renderer_path)} --os=macosx gmake2' + command = f'{get_base_command(rive_renderer_path, release)} --os=macosx gmake2' build_dirs = {} # we currently don't use fat libs, otherwise we could use this for macOS @@ -273,7 +274,7 @@ def execute_command(cmd): if sys.platform.startswith('darwin'): stdout, stderr = process.communicate() if stderr: - if not "pnglibconf.h: Permission denied" in stderr: + if not "pnglibconf.h: Permission denied" in stderr and not "has no symbols" in stderr: print_red(stderr.strip()) had_errors = True From 8ee6ab548efbe061355d56641acaa2adca356af4 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Thu, 25 Apr 2024 11:36:43 -0500 Subject: [PATCH 19/34] update mac/ios rive libs --- Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_decoders.sim.a | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a | 4 ++-- 28 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a index 427ee4fe..0706dfb2 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28c895e1de8d13000c6a2bb308b399b5fd649c1880b377c6ac01a6dfa257d9e3 -size 2386536 +oid sha256:fbeda61d70b768efc13f25bb9a34211ed738236bc4e032d784efb499309f8cbd +size 2388472 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a index d76bac7e..71ddf910 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:819efe2a667b76774decb0a78938380abfd931cbcf12edeed750c7ec5b677ccd -size 2393848 +oid sha256:e37df23e6c38510088907ded796adb5c5641afe344acb3d175745a909a509f2b +size 2396008 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a index 80761f96..4da8e28e 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9192fc8b7f77414664eeafb64208db8dd25f3406062ce17114df3a042e73e447 -size 115536968 +oid sha256:61a8680406e1f2af0040b8e1d70693ef86be831b79c8de97818d121cbabc1e9e +size 8032824 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a index bced6bb1..95f91fe8 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9c2514a512844c68a420177636ea2764b5c0a92fb2af5770a4f1cffdc74f48d -size 115936056 +oid sha256:f4ad92c5f390e091f005938cfb072d51c088511e48ef4e7dec22962f13d4e2a3 +size 8184840 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a index 43798c7a..f99a265c 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d485c8018fd731fd457072fb6e10fa4b2249a2ae015e492b25e788ee2946966e -size 360024 +oid sha256:41d2911bcccf4aa365914bf14e8dd06a6afa0366f06f9ecc5f97ba036a4abd56 +size 105128 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a index a084f5b6..a92826fa 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f42db642695f1d0b69a4555d58264930caea8fa9920bf8906726d113b8f3153c -size 362776 +oid sha256:703fbc836a3b95450f4b56d8dcf849ade4d19efeb500fc152773a41ae5188468 +size 107128 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a index cbc98502..44d32bc4 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59a9fb36828dcb340adfc3d7367d5547f7b191628499ca0e656f51134318f3c4 -size 248380328 +oid sha256:de2f83db9b5726df641c0776cd685907f621a8248b447f9ca61bb932f5bdb5cf +size 7769704 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a index 4251a79e..033693b5 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3db04d6ae6f96f664624bc70039b2006eaaa035505b93b9c76014fe9c2552b25 -size 248444888 +oid sha256:15064331d52369d1c918d637a49b702e40c17fc641ff9cc0d318831bbf9c144c +size 7799736 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a index 8921fd38..98b59109 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:808bff1cdbad176a0895b04a5af5d69c109864ccc6a51a6f9dab0f7f94882409 -size 15221312 +oid sha256:0838f09a609c53477dd30d7e4aa830c50cb3d56b776144d816831409ee015a89 +size 735200 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a index c36e95ee..d2b94f04 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:33f6afea64189a88c25c04dc4f9a3a6322164b00647eaee3aa63c2698b4bcc8e -size 15264416 +oid sha256:62ae2a559c85a36a8343b6158241b8721e95034a1ca78a50d40af5c1405ed549 +size 753984 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a index a823f835..47c88673 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea9bb55a9f85e343de36bc02c569ac1fea6da32deb368f525a0b1fda20ed1c23 -size 580256 +oid sha256:b7556f01c812251c422a247f98ead3b1f0eb218a004e791f8ec1755248448b08 +size 678032 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a index 0c7aa0c9..97304ee8 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56b13de207d188db3e312ec570ea584fbea772582d71a43d37a68a8807527aa2 -size 586168 +oid sha256:a314c076655c19a05289a87e487dec2ad479e4acec2ac04ccbbeba2e1048a658 +size 585856 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a index 8c31435a..695295c6 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a2949ad1b697ec3fe844c12ef3238bd61031dcffc60fc4cd83f62a03cf02df8 -size 813424 +oid sha256:9b0472cceacbf0f84f15b69dfad84234ca9c7216ad834548643f7664d720d9d8 +size 238728 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a index 93f7bed8..25fb5dd8 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b776fce4cb4bccefbeb924e04de87e68a895c9f57d6e019ac1aa374fc8eca4ac -size 747264 +oid sha256:45afc1029765736fd18ebcb5a4873995b02c18f84679aa9c25c44f25f78d8a42 +size 232344 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a index faa5fdec..69fde851 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f3ed72b4597a9a903b86d281a6ffe063c3fbedb92f4c113767068d71f055b791 -size 837104 +oid sha256:fdf49e76b349d62d1980fdd0587022ad6e43545d9b611c83aeba8174314b1526 +size 818544 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a index 50a8ef0c..2d5fd99b 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da20c289fc4b2b237083a210310a6fa95118781aed2d2447e0b1827ed44f5a03 -size 88250880 +oid sha256:512c3d1590ea6cf8afeaab22cc8ea7f5149edd2bfcded1075357bea6c23a2649 +size 94647448 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a index 74019c9f..f286bbc3 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8dd7287497a553f077c3d38eaccc6d71d1e58f0990b60e0cc829575ef51c1103 -size 211744 +oid sha256:0bf36830a28e56fb34d88215cc7cc4b73d4e7ab9d8996d3659eb3d36d336fff9 +size 63056 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a index 29ea3728..c46cb8ac 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ceb50630f52b7c9ca81de07a9c00d96923fd6702f888ed799031b5cedc213edd -size 106037512 +oid sha256:8e15ae17e5277324b3d108520172ce9a94f8447437bbfad1389e775fdf0ad6ca +size 7858848 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a index 1dea0ad1..0dbb6277 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35c5943a55da57244814c1a8c96c49ac3522003acb236915b29e6752c11d6b21 -size 10706928 +oid sha256:2e6110a58013bc2800c7c72e3cba6b0b6ee79bfe037a6d5b742d2b2f12731fb7 +size 1174360 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a index 6c75044c..7b9190bb 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f93250855a66390089b9e685448cbf05ed3a806ffc619c3a24a25cc729cb5cc8 -size 245920 +oid sha256:8d72d500c0973c3424087116eadfa8458a5efe86e056ca055bb0fb62c9abd7d0 +size 336280 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a index b2c11eb0..b92098f0 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c16c6822c3078f82e7211ee7e591b7d64d61f07bde513d5bb405ab9c59adf23a -size 292696 +oid sha256:fc79eb3e64284fc81f97605b879c5667f36984cc86e24823871fd88c68c6f63c +size 250888 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a index 7996e710..06da1051 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f44c9aaa6c235a06b83770ae1fb2f9b5c271f1b4447aca5e8fe86befa060764 -size 928848 +oid sha256:6ebb7103a962539db534b9809344575c14f14ad7572d4da911e2853e790679e0 +size 881872 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a index f17bdada..b1b0ad25 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c489560d3348f139409e4a83858849821dac46d20b71afa29c0b2c5fa7002347 -size 85080984 +oid sha256:b5c0a1715ef3f65d0c4c045bda2ef40fb24817ee5f44bf66399bfb5939e06c77 +size 8290576 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a index 633aca4b..98d996c9 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6631a819b7d43700ff2a34ac5b70c01ede74f29f0255e52afdf9d141be128b6d -size 196328 +oid sha256:ba3f5019dc7f82e3dac7a5579af6b9d62bfe81cf900b8f1f5c4553c09479788d +size 62048 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a index e80cdc39..fdd982ab 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de1636730a5a69875da5652cf93df1ea7f116db22fe57873fbfc4fd51e388131 -size 103592904 +oid sha256:c82e73c24c0f86e9f26e42172419c1517180e5b93a53a5ede36aeeba2af1a664 +size 7816376 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a index 66cf0e42..b33297d6 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7e234b684aeee4402a8dab0190020698df21ff2699b0a72fab240838f406468 -size 10301736 +oid sha256:f09f8985d862d2c16d11169b109bc7bfa429cd8ef6974c64c2670cc9d6a050ad +size 1131624 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a index 369c50e3..33a67469 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7e7fc9fbc6d7e952016bf2941a8f18155f3841c26b851180828f2143e3a5a9a -size 248712 +oid sha256:bd0e67cec191934b6fc1484fc653d9d3a39b4182cb63ed22e5ead7f5243b105e +size 337328 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a index 2414a0d1..5a2956c6 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7dd9a25fc9f28daaf5a25ee039a00e61f4d589e42d7f6765a03f726dc1ac0982 -size 279256 +oid sha256:c75eb3925fc91e31a864acce9a06a00dc2fd1de5c282111d909ee1802e29dafe +size 234440 From 807bd8267dedb08a387245b2bec3e0000661ef73 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Thu, 25 Apr 2024 19:54:19 -0500 Subject: [PATCH 20/34] Set NumChannels, since it appears to be 0 on mac; removed obsolete code --- Source/RiveCore/Private/RiveAudioEngine.cpp | 11 +++-------- Source/RiveCore/Public/RiveAudioEngine.h | 1 - 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Source/RiveCore/Private/RiveAudioEngine.cpp b/Source/RiveCore/Private/RiveAudioEngine.cpp index 9f2509da..4909706b 100644 --- a/Source/RiveCore/Private/RiveAudioEngine.cpp +++ b/Source/RiveCore/Private/RiveAudioEngine.cpp @@ -14,9 +14,9 @@ void URiveAudioEngine::BeginPlay() NativeAudioEnginePtr->unref(); NativeAudioEnginePtr = nullptr; } - - NativeAudioEnginePtr = rive::rcp(rive::AudioEngine::Make(NumChannels, AudioDevice->SampleRate)); + NumChannels = 2; + NativeAudioEnginePtr = rive::rcp(rive::AudioEngine::Make(NumChannels, AudioDevice->SampleRate)); Start(); } @@ -48,9 +48,4 @@ int32 URiveAudioEngine::OnGenerateAudio(float* OutAudio, int32 NumSamples) return NumSamples; } return 0; -} - -void URiveAudioEngine::Make(int InChannels, int InSampleRate) -{ - -} +} \ No newline at end of file diff --git a/Source/RiveCore/Public/RiveAudioEngine.h b/Source/RiveCore/Public/RiveAudioEngine.h index 2a57f6bd..d6ea4fc5 100644 --- a/Source/RiveCore/Public/RiveAudioEngine.h +++ b/Source/RiveCore/Public/RiveAudioEngine.h @@ -29,7 +29,6 @@ class RIVECORE_API URiveAudioEngine : public USynthComponent virtual int32 OnGenerateAudio(float* OutAudio, int32 NumSamples) override; - void Make(int InChannels, int InSampleRate); rive::rcp GetNativeAudioEngine() { return NativeAudioEnginePtr; } UPROPERTY(BlueprintReadOnly) From 12c177a49d707c5cf3933a08edc6f70cac958bb4 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Tue, 30 Apr 2024 13:58:38 -0500 Subject: [PATCH 21/34] use createinstance in widget and rivefiles to create new rivefile instances --- Source/Rive/Private/Game/RiveActor.cpp | 5 +++++ Source/Rive/Private/UMG/RiveWidget.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Rive/Private/Game/RiveActor.cpp b/Source/Rive/Private/Game/RiveActor.cpp index 3a7c6fee..36d2dd1a 100644 --- a/Source/Rive/Private/Game/RiveActor.cpp +++ b/Source/Rive/Private/Game/RiveActor.cpp @@ -106,6 +106,7 @@ void ARiveActor::BeginPlay() if (IsValid(RiveFile) && IsValid(ActorWorld) && (ActorWorld->WorldType == EWorldType::PIE)) { + RiveFile = RiveFile->CreateInstance(RiveFile->ArtboardName, RiveFile->StateMachineName); RiveFile->InstantiateArtboard(); RiveFile->GetArtboard()->SetAudioEngine(AudioEngine); } @@ -129,6 +130,10 @@ void ARiveActor::EndPlay(const EEndPlayReason::Type EndPlayReason) if (EndPlayReason == EEndPlayReason::EndPlayInEditor && IsValid(RiveFile)) { + if (RiveFile->ParentRiveFile != nullptr) + { + RiveFile = RiveFile->ParentRiveFile; + } RiveFile->InstantiateArtboard(); } } diff --git a/Source/Rive/Private/UMG/RiveWidget.cpp b/Source/Rive/Private/UMG/RiveWidget.cpp index f2943258..79953485 100644 --- a/Source/Rive/Private/UMG/RiveWidget.cpp +++ b/Source/Rive/Private/UMG/RiveWidget.cpp @@ -1,6 +1,8 @@ // Copyright Rive, Inc. All rights reserved. #include "UMG/RiveWidget.h" + +#include "Rive/RiveFile.h" #include "Slate/SRiveWidget.h" #define LOCTEXT_NAMESPACE "RiveWidget" @@ -24,14 +26,14 @@ void URiveWidget::ReleaseSlateResources(bool bReleaseChildren) TSharedRef URiveWidget::RebuildWidget() { RiveWidget = SNew(SRiveWidget); - RiveWidget->SetRiveFile(RiveFile); + SetRiveFile(RiveFile); return RiveWidget.ToSharedRef(); } void URiveWidget::SetRiveFile(URiveFile* InRiveFile) { - RiveFile = InRiveFile; + RiveFile = InRiveFile->CreateInstance(InRiveFile->ArtboardName, InRiveFile->StateMachineName); if (RiveWidget.IsValid()) { From f8db2e1990e7bba2cd6ad0bb47386817e2904920 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 1 May 2024 10:16:02 -0500 Subject: [PATCH 22/34] optimize RiveActor --- Source/Rive/Private/Game/RiveActor.cpp | 154 +++---------------------- Source/Rive/Public/Game/RiveActor.h | 36 +----- 2 files changed, 18 insertions(+), 172 deletions(-) diff --git a/Source/Rive/Private/Game/RiveActor.cpp b/Source/Rive/Private/Game/RiveActor.cpp index 36d2dd1a..c071d80c 100644 --- a/Source/Rive/Private/Game/RiveActor.cpp +++ b/Source/Rive/Private/Game/RiveActor.cpp @@ -15,181 +15,53 @@ ARiveActor::ARiveActor() RootComponent = CreateDefaultSubobject(TEXT("RootComponent0")); check(RootComponent); - - RootComponent->Mobility = EComponentMobility::Movable; - - ScreenUserWidget = CreateDefaultSubobject(TEXT("ScreenUserWidget")); - - ScreenUserWidget->SetDisplayTypes(ERiveWidgetDisplayType::Viewport, ERiveWidgetDisplayType::Viewport, ERiveWidgetDisplayType::Viewport); - ScreenUserWidget->SetRiveActor(this); - -#if WITH_EDITOR - - RootComponent->bVisualizeComponent = true; - -#endif // WITH_EDITOR - AudioEngine = CreateDefaultSubobject(TEXT("RiveAudioEngine")); - - RootComponent->SetMobility(EComponentMobility::Static); - - PrimaryActorTick.bCanEverTick = true; - - PrimaryActorTick.bStartWithTickEnabled = true; - - bAllowTickBeforeBeginPlay = true; - - SetActorTickEnabled(true); - - SetHidden(false); } void ARiveActor::SetWidgetClass(TSubclassOf InWidgetClass) { - ScreenUserWidget->SetWidgetClass(InWidgetClass); -} - -void ARiveActor::PostInitializeComponents() -{ - Super::PostInitializeComponents(); - -#if WITH_EDITOR - - bEditorDisplayRequested = true; - -#endif //WITH_EDITOR + UserWidgetClass = InWidgetClass; } void ARiveActor::PostLoad() { Super::PostLoad(); -#if WITH_EDITOR - - bEditorDisplayRequested = true; - -#endif //WITH_EDITOR - if (RiveFile) { RiveFile->SetAudioEngine(AudioEngine); } } -void ARiveActor::PostActorCreated() -{ - Super::PostActorCreated(); - -#if WITH_EDITOR - - bEditorDisplayRequested = true; - -#endif //WITH_EDITOR -} - -void ARiveActor::Destroyed() -{ - if (ScreenUserWidget) - { - ScreenUserWidget->Hide(); - } - - Super::Destroyed(); -} - void ARiveActor::BeginPlay() { - RequestGameDisplay(); - + Super::BeginPlay(); + UWorld* ActorWorld = GetWorld(); - - if (IsValid(RiveFile) && IsValid(ActorWorld) && (ActorWorld->WorldType == EWorldType::PIE)) - { - RiveFile = RiveFile->CreateInstance(RiveFile->ArtboardName, RiveFile->StateMachineName); - RiveFile->InstantiateArtboard(); - RiveFile->GetArtboard()->SetAudioEngine(AudioEngine); - } - Super::BeginPlay(); -} - -void ARiveActor::EndPlay(const EEndPlayReason::Type EndPlayReason) -{ - Super::EndPlay(EndPlayReason); - - if (ScreenUserWidget) - { - UWorld* ActorWorld = GetWorld(); - - if (ActorWorld && (ActorWorld->WorldType == EWorldType::Game || ActorWorld->WorldType == EWorldType::PIE)) - { - ScreenUserWidget->Hide(); - } - } - - if (EndPlayReason == EEndPlayReason::EndPlayInEditor && IsValid(RiveFile)) + if (IsValid(RiveFile)) { - if (RiveFile->ParentRiveFile != nullptr) + if (IsValid(ActorWorld) && (ActorWorld->WorldType == EWorldType::PIE)) { - RiveFile = RiveFile->ParentRiveFile; + RiveFile->InstantiateArtboard(); } - RiveFile->InstantiateArtboard(); - } -} - -void ARiveActor::Tick(float DeltaSeconds) -{ - Super::Tick(DeltaSeconds); - -#if WITH_EDITOR - - if (bEditorDisplayRequested) - { - bEditorDisplayRequested = false; - - RequestEditorDisplay(); - } -#endif //WITH_EDITOR + RiveFile->GetArtboard()->SetAudioEngine(AudioEngine); - if (ScreenUserWidget) - { - ScreenUserWidget->Tick(DeltaSeconds); + ScreenUserWidget = CreateWidget(ActorWorld, UserWidgetClass); + ScreenUserWidget->AddToViewport(); } } -void ARiveActor::RequestEditorDisplay() +void ARiveActor::EndPlay(const EEndPlayReason::Type EndPlayReason) { -#if WITH_EDITOR - - UWorld* ActorWorld = GetWorld(); - - if (ScreenUserWidget && ActorWorld && ActorWorld->WorldType == EWorldType::Editor) + if (EndPlayReason == EEndPlayReason::EndPlayInEditor && IsValid(RiveFile)) { - ScreenUserWidget->Display(ActorWorld); + RiveFile->InstantiateArtboard(); } - -#endif //WITH_EDITOR -} - -void ARiveActor::RequestGameDisplay() -{ - UWorld* ActorWorld = GetWorld(); - if (ScreenUserWidget && ActorWorld && (ActorWorld->WorldType == EWorldType::Game || ActorWorld->WorldType == EWorldType::PIE)) - { - ScreenUserWidget->Display(ActorWorld); - } -} - -UUserWidget* ARiveActor::GetUserWidget() const -{ - if (ScreenUserWidget) - { - return ScreenUserWidget->GetWidget(); - } - return nullptr; + Super::EndPlay(EndPlayReason); } #undef LOCTEXT_NAMESPACE diff --git a/Source/Rive/Public/Game/RiveActor.h b/Source/Rive/Public/Game/RiveActor.h index 933b8865..5ea01115 100644 --- a/Source/Rive/Public/Game/RiveActor.h +++ b/Source/Rive/Public/Game/RiveActor.h @@ -27,45 +27,15 @@ class RIVE_API ARiveActor : public AActor public: void SetWidgetClass(TSubclassOf InWidgetClass); - - virtual void PostInitializeComponents() override; - virtual void PostLoad() override; - virtual void PostActorCreated() override; - - virtual void Destroyed() override; - virtual void BeginPlay() override; virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; - virtual void Tick(float DeltaSeconds) override; - -#if WITH_EDITOR - - virtual bool ShouldTickIfViewportsOnly() const override { return true; } - -#endif //WITH_EDITOR //~ END : AActor Interface - /** - * Implementation(s) - */ - -public: - - /* Get a pointer to the inner user widget */ - UFUNCTION(BlueprintCallable, Category = "User Interface") - UUserWidget* GetUserWidget() const; - -private: - - void RequestEditorDisplay(); - - void RequestGameDisplay(); - /** * Attribute(s) */ @@ -75,11 +45,15 @@ class RIVE_API ARiveActor : public AActor UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Rive") TObjectPtr RiveFile; + /** Settings for Rive Rendering */ + UPROPERTY(VisibleAnywhere, Category = "User Interface", meta = (ShowOnlyInnerProperties)) + TSubclassOf UserWidgetClass; + protected: /** Settings for Rive Rendering */ UPROPERTY(VisibleAnywhere, Instanced, NoClear, Category = "User Interface", meta = (ShowOnlyInnerProperties)) - TObjectPtr ScreenUserWidget; + TObjectPtr ScreenUserWidget; UPROPERTY(VisibleAnywhere, Instanced, NoClear, Category = "Audio", meta = (ShowOnlyInnerProperties)) TObjectPtr AudioEngine; From 6e6f44aeb974cae4eb5eea3b3d73e8e7ae4389bb Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Wed, 1 May 2024 11:13:39 -0700 Subject: [PATCH 23/34] RiveFile detail panel clean (UR-163) --- Source/Rive/Public/Rive/RiveFile.h | 4 ++-- Source/RiveCore/Public/Assets/RiveAsset.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Rive/Public/Rive/RiveFile.h b/Source/Rive/Public/Rive/RiveFile.h index 7acc0308..60a3f8d7 100644 --- a/Source/Rive/Public/Rive/RiveFile.h +++ b/Source/Rive/Public/Rive/RiveFile.h @@ -29,7 +29,7 @@ class UUserWidget; /** * */ -UCLASS(BlueprintType, Blueprintable, HideCategories="ImportSettings") +UCLASS(BlueprintType, Blueprintable, HideCategories=("ImportSettings", "Compression", "Adjustments", "LevelOfDetail", "Compositing")) class RIVE_API URiveFile : public URiveTexture, public FTickableGameObject { GENERATED_BODY() @@ -174,7 +174,7 @@ class RIVE_API URiveFile : public URiveTexture, public FTickableGameObject UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Rive, meta=(NoResetToDefault)) FString RiveFilePath; - UPROPERTY(VisibleAnywhere, Category=Rive) + UPROPERTY(VisibleAnywhere, Category=Rive, meta=(NoResetToDefault)) TMap> Assets; TMap>& GetAssets() diff --git a/Source/RiveCore/Public/Assets/RiveAsset.h b/Source/RiveCore/Public/Assets/RiveAsset.h index 2360bb9e..c7998394 100644 --- a/Source/RiveCore/Public/Assets/RiveAsset.h +++ b/Source/RiveCore/Public/Assets/RiveAsset.h @@ -35,16 +35,16 @@ class RIVECORE_API URiveAsset : public UObject public: virtual void PostLoad() override; - UPROPERTY(VisibleAnywhere, Category=Rive) + UPROPERTY(VisibleAnywhere, Category=Rive, meta=(NoResetToDefault)) uint32 Id; - UPROPERTY(VisibleAnywhere, Category=Rive) + UPROPERTY(VisibleAnywhere, Category=Rive, meta=(NoResetToDefault)) ERiveAssetType Type; - UPROPERTY(VisibleAnywhere, Category=Rive) + UPROPERTY(VisibleAnywhere, Category=Rive, meta=(NoResetToDefault)) FString Name; - UPROPERTY(VisibleAnywhere, Category=Rive) + UPROPERTY(VisibleAnywhere, Category=Rive, meta=(NoResetToDefault)) bool bIsInBand; UPROPERTY() From 072f2a547320ad61c3399eb0b6cfe188638971b0 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 1 May 2024 16:21:10 -0500 Subject: [PATCH 24/34] adjust build script to set environment for macos deployment target to 11 --- Scripts/build-rive/build-rive.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index 5bfc51ce..b0deb735 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -22,7 +22,7 @@ def get_base_command(rive_renderer_path, release): return ( - f"premake5 --scripts={rive_renderer_path}/submodules/rive-cpp/build " + f"premake5 --scripts=\"{rive_renderer_path}/submodules/rive-cpp/build\" " f"--with_rive_text --with_rive_audio=external {'--release' if release else ''}" ) @@ -31,6 +31,7 @@ def get_base_command(rive_renderer_path, release): @click.option('--release', is_flag=True, default=False) def main(rive_renderer_path, release): if sys.platform.startswith('darwin'): + os.environ["MACOSX_DEPLOYMENT_TARGET"] = '11.0' if not do_mac(rive_renderer_path, release): return From 8ac33828b79678ec0ce67aec2765fa5b5f62b04d Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 1 May 2024 16:39:39 -0500 Subject: [PATCH 25/34] fix crash, let Rive handle it's own ref count; allow UMG to set audio engine with a convenience function; rive file instances will now get audio engine automatically set from parent --- Source/Rive/Private/Rive/RiveFile.cpp | 1 + Source/Rive/Private/UMG/RiveWidget.cpp | 12 ++++++++++++ Source/Rive/Public/Rive/RiveFile.h | 2 +- Source/Rive/Public/UMG/RiveWidget.h | 4 ++++ Source/RiveCore/Private/RiveAudioEngine.cpp | 11 ----------- Source/RiveCore/Public/RiveAudioEngine.h | 1 - 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Source/Rive/Private/Rive/RiveFile.cpp b/Source/Rive/Private/Rive/RiveFile.cpp index bc5bfedf..3b620b80 100644 --- a/Source/Rive/Private/Rive/RiveFile.cpp +++ b/Source/Rive/Private/Rive/RiveFile.cpp @@ -187,6 +187,7 @@ URiveFile* URiveFile::CreateInstance(const FString& InArtboardName, const FStrin NewRiveFileInstance->ArtboardName = InArtboardName.IsEmpty() ? ArtboardName : InArtboardName; NewRiveFileInstance->StateMachineName = InStateMachineName.IsEmpty() ? StateMachineName : InStateMachineName; NewRiveFileInstance->ArtboardIndex = ArtboardIndex; + NewRiveFileInstance->AudioEngine = AudioEngine; NewRiveFileInstance->PostLoad(); return NewRiveFileInstance; } diff --git a/Source/Rive/Private/UMG/RiveWidget.cpp b/Source/Rive/Private/UMG/RiveWidget.cpp index 79953485..4a16537e 100644 --- a/Source/Rive/Private/UMG/RiveWidget.cpp +++ b/Source/Rive/Private/UMG/RiveWidget.cpp @@ -31,6 +31,18 @@ TSharedRef URiveWidget::RebuildWidget() return RiveWidget.ToSharedRef(); } +void URiveWidget::SetAudioEngine(URiveAudioEngine* InAudioEngine) +{ + if (RiveFile) + { + RiveFile->SetAudioEngine(InAudioEngine); + if (RiveFile->GetArtboard() != nullptr) + { + RiveFile->GetArtboard()->SetAudioEngine(InAudioEngine); + } + } +} + void URiveWidget::SetRiveFile(URiveFile* InRiveFile) { RiveFile = InRiveFile->CreateInstance(InRiveFile->ArtboardName, InRiveFile->StateMachineName); diff --git a/Source/Rive/Public/Rive/RiveFile.h b/Source/Rive/Public/Rive/RiveFile.h index 7acc0308..a9e80cb4 100644 --- a/Source/Rive/Public/Rive/RiveFile.h +++ b/Source/Rive/Public/Rive/RiveFile.h @@ -262,7 +262,7 @@ class RIVE_API URiveFile : public URiveTexture, public FTickableGameObject UPROPERTY(Transient, VisibleInstanceOnly, BlueprintReadOnly, Category=Rive, meta=(NoResetToDefault, AllowPrivateAccess, ShowInnerProperties)) URiveArtboard* Artboard = nullptr; - UPROPERTY(Transient, VisibleInstanceOnly, BlueprintReadOnly, Category=Rive, meta=(AllowPrivateAccess)) + UPROPERTY(Transient, VisibleInstanceOnly, Category=Rive, meta=(AllowPrivateAccess)) URiveAudioEngine* AudioEngine = nullptr; FDelegateHandle AudioEngineLambdaHandle; diff --git a/Source/Rive/Public/UMG/RiveWidget.h b/Source/Rive/Public/UMG/RiveWidget.h index 3c0bf18a..460e519b 100644 --- a/Source/Rive/Public/UMG/RiveWidget.h +++ b/Source/Rive/Public/UMG/RiveWidget.h @@ -5,6 +5,7 @@ #include "Components/Widget.h" #include "RiveWidget.generated.h" +class URiveAudioEngine; class SRiveWidget; class URiveFile; @@ -38,6 +39,9 @@ class RIVE_API URiveWidget : public UWidget public: + UFUNCTION(BlueprintCallable) + void SetAudioEngine(URiveAudioEngine* InAudioEngine); + void SetRiveFile(URiveFile* InRiveFile); /** diff --git a/Source/RiveCore/Private/RiveAudioEngine.cpp b/Source/RiveCore/Private/RiveAudioEngine.cpp index 4909706b..a9b574ab 100644 --- a/Source/RiveCore/Private/RiveAudioEngine.cpp +++ b/Source/RiveCore/Private/RiveAudioEngine.cpp @@ -24,17 +24,6 @@ void URiveAudioEngine::BeginPlay() Super::BeginPlay(); } -void URiveAudioEngine::BeginDestroy() -{ - if (NativeAudioEnginePtr != nullptr) { - NativeAudioEnginePtr->unref(); - NativeAudioEnginePtr = nullptr; - } - - Super::BeginDestroy(); - -} - int32 URiveAudioEngine::OnGenerateAudio(float* OutAudio, int32 NumSamples) { if (NativeAudioEnginePtr == nullptr) return 0; diff --git a/Source/RiveCore/Public/RiveAudioEngine.h b/Source/RiveCore/Public/RiveAudioEngine.h index d6ea4fc5..0fbe0f2d 100644 --- a/Source/RiveCore/Public/RiveAudioEngine.h +++ b/Source/RiveCore/Public/RiveAudioEngine.h @@ -21,7 +21,6 @@ class RIVECORE_API URiveAudioEngine : public USynthComponent DECLARE_MULTICAST_DELEGATE(FOnRiveAudioEngineReadyEvent) virtual void BeginPlay() override; - virtual void BeginDestroy() override; // Event called after BeginPlay, and after NativeAudioEnginePtr has been made // This can be used if you expect initialization of a user of this system to initialize before this is ready From fd013406a09cd518a20f0a70462db7ba34268f69 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 1 May 2024 17:22:46 -0500 Subject: [PATCH 26/34] make sure createinstance also calls instantiateartboard --- Source/Rive/Private/Rive/RiveFile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Rive/Private/Rive/RiveFile.cpp b/Source/Rive/Private/Rive/RiveFile.cpp index bc5bfedf..f0279f5a 100644 --- a/Source/Rive/Private/Rive/RiveFile.cpp +++ b/Source/Rive/Private/Rive/RiveFile.cpp @@ -188,6 +188,7 @@ URiveFile* URiveFile::CreateInstance(const FString& InArtboardName, const FStrin NewRiveFileInstance->StateMachineName = InStateMachineName.IsEmpty() ? StateMachineName : InStateMachineName; NewRiveFileInstance->ArtboardIndex = ArtboardIndex; NewRiveFileInstance->PostLoad(); + NewRiveFileInstance->InstantiateArtboard(); return NewRiveFileInstance; } From a4d5c97eed8a9b0779c559f01b499b6f9400014d Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 1 May 2024 18:08:49 -0500 Subject: [PATCH 27/34] enforce osx 12 sdk with build script --- Scripts/build-rive/build-rive.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index b0deb735..b435cea9 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -32,6 +32,15 @@ def get_base_command(rive_renderer_path, release): def main(rive_renderer_path, release): if sys.platform.startswith('darwin'): os.environ["MACOSX_DEPLOYMENT_TARGET"] = '11.0' + # determine a sane build environment + output = subprocess.check_output(["xcrun", "--sdk", "macosx", "--show-sdk-path"], universal_newlines=True) + sdk_path = output.strip() + if "MacOSX12" not in sdk_path: + print_red(f"SDK Path {sdk_path} didn't point to an SDK matching version 12, exiting..") + return + else: + print_green(f"Using SDK at: {output}") + if not do_mac(rive_renderer_path, release): return From 5c699e1b323cd62654176878cc4ca500991000fb Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Wed, 1 May 2024 18:28:31 -0500 Subject: [PATCH 28/34] update mac/ios libs --- Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a | 2 +- Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a | 2 +- Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_decoders.sim.a | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a | 4 ++-- .../ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a | 4 ++-- .../RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a | 2 +- Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a | 2 +- Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a | 2 +- Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_decoders.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a | 4 ++-- .../RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a | 4 ++-- Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a | 4 ++-- 28 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a index 0706dfb2..dce9ff70 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fbeda61d70b768efc13f25bb9a34211ed738236bc4e032d784efb499309f8cbd +oid sha256:167f9c26bd038243aa45b1255f55045758157236e28b2c8e67f73674ba11f20b size 2388472 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a index 71ddf910..0848ffcc 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/liblibpng.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e37df23e6c38510088907ded796adb5c5641afe344acb3d175745a909a509f2b +oid sha256:1b5143527f7eb658512baece2f06eb455e39b01ae47f4305995969feed583b48 size 2396008 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a index 4da8e28e..698c8251 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61a8680406e1f2af0040b8e1d70693ef86be831b79c8de97818d121cbabc1e9e -size 8032824 +oid sha256:4a35c6d6cf50258889525e04c124bb1236fdbe0ce7b3153196ffd03e56be28bc +size 123959176 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a index 95f91fe8..2cbae2ba 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4ad92c5f390e091f005938cfb072d51c088511e48ef4e7dec22962f13d4e2a3 -size 8184840 +oid sha256:ca691acfda29d859d4eba4d4bd63a97876b2ff470e36e030812e8821a2b57790 +size 124365032 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a index f99a265c..16a9b89d 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41d2911bcccf4aa365914bf14e8dd06a6afa0366f06f9ecc5f97ba036a4abd56 -size 105128 +oid sha256:1ef9be1e462665f0055852a5ed46e375cb8816abf887f5776309b90ce0a2c009 +size 360304 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a index a92826fa..bee617c5 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_decoders.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:703fbc836a3b95450f4b56d8dcf849ade4d19efeb500fc152773a41ae5188468 -size 107128 +oid sha256:e33e7bc0fc386f305dd435b6fb9854966ee050b8534622e9e81c39037f2d5a1b +size 363056 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a index 44d32bc4..943a862a 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de2f83db9b5726df641c0776cd685907f621a8248b447f9ca61bb932f5bdb5cf -size 7769704 +oid sha256:f73302e56a05657b00b2be467a9537497753aa0054c9dd978f6e04a1888d8c99 +size 248394440 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a index 033693b5..d5f5915c 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_harfbuzz.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:15064331d52369d1c918d637a49b702e40c17fc641ff9cc0d318831bbf9c144c -size 7799736 +oid sha256:af1318c9530f9a62467da85299aa0c7c2e72e4836aa4489427c2da0afa014789 +size 248459592 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a index 98b59109..514b75a1 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0838f09a609c53477dd30d7e4aa830c50cb3d56b776144d816831409ee015a89 -size 735200 +oid sha256:a982137dada938f1d6776e7962328b317f86162fee258b16c34377b31248bcdd +size 15224000 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a index d2b94f04..b550a337 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_pls_renderer.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:62ae2a559c85a36a8343b6158241b8721e95034a1ca78a50d40af5c1405ed549 -size 753984 +oid sha256:fcf9ac62290b9927f3032ae3953ce85f2ca209ac2063ef9b434975160b31bc76 +size 15267208 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a index 47c88673..dce1fb80 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7556f01c812251c422a247f98ead3b1f0eb218a004e791f8ec1755248448b08 -size 678032 +oid sha256:256c8cbfa3cc3a02721b326fed53a005a608a5b23d40c7740d685b97aa926d66 +size 579792 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a index 97304ee8..d8f3c663 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/librive_sheenbidi.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a314c076655c19a05289a87e487dec2ad479e4acec2ac04ccbbeba2e1048a658 +oid sha256:a17da962f45b9d635044d4bbb5ffa27832919786cdcb0b9119fc127288e03155 size 585856 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a index 695295c6..584feb8f 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b0472cceacbf0f84f15b69dfad84234ca9c7216ad834548643f7664d720d9d8 -size 238728 +oid sha256:6d1a056d4e848b13e95188c33ddd9d4e73e38ae7bab7492cdd02db0a6ff2c1c3 +size 812944 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a index 25fb5dd8..1bc257a1 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/IOS/libzlib.sim.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:45afc1029765736fd18ebcb5a4873995b02c18f84679aa9c25c44f25f78d8a42 -size 232344 +oid sha256:98f865f70ebb85570b10a499d0df0ba5990f4c401a196dafb8b390ce0c50f390 +size 746920 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a index 69fde851..086e33aa 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdf49e76b349d62d1980fdd0587022ad6e43545d9b611c83aeba8174314b1526 +oid sha256:ebc9ca65d25e24c8d34e85f1e3f436f9a17d04839231dd84fa9a7992fefbf8be size 818544 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a index 2d5fd99b..2a767e1b 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:512c3d1590ea6cf8afeaab22cc8ea7f5149edd2bfcded1075357bea6c23a2649 -size 94647448 +oid sha256:ae83671c8286c7adeea513087aa808c82f9d7b2e94d8f46620f568680050de94 +size 94676912 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a index f286bbc3..bbe2301a 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0bf36830a28e56fb34d88215cc7cc4b73d4e7ab9d8996d3659eb3d36d336fff9 -size 63056 +oid sha256:3091e605bec56637a538045fcb6d0c19d9c403bd51ced88af3555f21b2de47e6 +size 232072 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a index c46cb8ac..239468b5 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e15ae17e5277324b3d108520172ce9a94f8447437bbfad1389e775fdf0ad6ca -size 7858848 +oid sha256:1e66d5109d79fb1b993f0c2bd4b901f5b6f1900ed32d9cc2753bbe96657a03c1 +size 108887328 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a index 0dbb6277..ea10d4ef 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e6110a58013bc2800c7c72e3cba6b0b6ee79bfe037a6d5b742d2b2f12731fb7 -size 1174360 +oid sha256:390d4a87b210c1556f55a795618829f3cb3492a633b4ac17546bdb064cde74dd +size 11112512 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a index 7b9190bb..58bd8f96 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d72d500c0973c3424087116eadfa8458a5efe86e056ca055bb0fb62c9abd7d0 -size 336280 +oid sha256:876b7a91c507e9f3d669276f8b6fcb60de0a4defbde2a42e09e9fdeeacd4b7de +size 237096 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a index b92098f0..01883456 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Intel/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc79eb3e64284fc81f97605b879c5667f36984cc86e24823871fd88c68c6f63c -size 250888 +oid sha256:08d96b874bb2a7385364baf7a290105249dbbd8a2e33c3bc54022109dc53b156 +size 287816 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a index 06da1051..9604a1e5 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/liblibpng.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ebb7103a962539db534b9809344575c14f14ad7572d4da911e2853e790679e0 +oid sha256:84119d9846817db42b5f0ac4b76e02ce1c150a1cd2c9c64834eab5eda07f2fbc size 881872 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a index b1b0ad25..08b75898 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b5c0a1715ef3f65d0c4c045bda2ef40fb24817ee5f44bf66399bfb5939e06c77 -size 8290576 +oid sha256:5e9015f86f585fc991b4ca2812a59a0f6fbd3b72c45a43afc42174b885e407e4 +size 91324800 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a index 98d996c9..29a0ea2e 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_decoders.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba3f5019dc7f82e3dac7a5579af6b9d62bfe81cf900b8f1f5c4553c09479788d -size 62048 +oid sha256:f3979b1548324e5621e3d70159cc4730d17a7b0afa1160ce4993f34f7abc5713 +size 214496 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a index fdd982ab..a630c963 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_harfbuzz.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c82e73c24c0f86e9f26e42172419c1517180e5b93a53a5ede36aeeba2af1a664 -size 7816376 +oid sha256:8925185a9deeee82990230926e370286ced5228ca2da6a7a7ad65fe45ef54927 +size 106342712 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a index b33297d6..106561c9 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_pls_renderer.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f09f8985d862d2c16d11169b109bc7bfa429cd8ef6974c64c2670cc9d6a050ad -size 1131624 +oid sha256:51b87647f6a5586ceaa51868022801acd51df9ecf0274c8b78db64eae15c8ef2 +size 10687752 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a index 33a67469..7bc64775 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/librive_sheenbidi.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd0e67cec191934b6fc1484fc653d9d3a39b4182cb63ed22e5ead7f5243b105e -size 337328 +oid sha256:f4357e3566ffc083a76033a73c20f32495ef6422c69879925577c98becf744f5 +size 237472 diff --git a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a index 5a2956c6..c50c4a57 100644 --- a/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a +++ b/Source/ThirdParty/RiveLibrary/Libraries/Mac/Mac/libzlib.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c75eb3925fc91e31a864acce9a06a00dc2fd1de5c282111d909ee1802e29dafe -size 234440 +oid sha256:d0328be060d95ab0a78282c01268ea4c0499dddc04a037578e1c43c5a882ff4d +size 264176 From e9fd52316366bf5df6b6d4aa8a8ccd68a78932af Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Thu, 2 May 2024 08:52:10 -0500 Subject: [PATCH 29/34] use ref_rcp on audioasset --- Source/RiveCore/Private/Assets/RiveAsset.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/RiveCore/Private/Assets/RiveAsset.cpp b/Source/RiveCore/Private/Assets/RiveAsset.cpp index 3b7b687e..6d44465a 100644 --- a/Source/RiveCore/Private/Assets/RiveAsset.cpp +++ b/Source/RiveCore/Private/Assets/RiveAsset.cpp @@ -88,10 +88,8 @@ bool URiveAsset::LoadAudioAsset(rive::FileAsset& InAsset, rive::Factory* InRiveF { rive::SimpleArray Data = rive::SimpleArray(AssetBytes.data(), AssetBytes.count()); rive::AudioSource* AudioSource = new rive::AudioSource(Data); - rive::rcp RcpAudioSource = rive::rcp(AudioSource); - rive::AudioAsset* AudioAsset = InAsset.as(); - AudioAsset->audioSource(RcpAudioSource); + AudioAsset->audioSource(ref_rcp(AudioSource)); NativeAsset = AudioAsset; return true; } \ No newline at end of file From d9cd71ba1b55267165d2b43b0c3fc7b5d0c6850a Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Thu, 2 May 2024 13:16:53 -0500 Subject: [PATCH 30/34] use --windows_runtime=dynamic instead of --force-md, for new rive libs --- Scripts/build-rive/build-rive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index b435cea9..559dd6b0 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -102,7 +102,7 @@ def do_android(rive_renderer_path, release): def do_windows(rive_renderer_path, release): try: os.chdir(rive_renderer_path) - command = f'{get_base_command(rive_renderer_path, release)} --force-md --os=windows --out=out/windows vs2022' + command = f'{get_base_command(rive_renderer_path, release)} --windows_runtime=dynamic --os=windows --out=out/windows vs2022' execute_command(command) msbuild_path = get_msbuild() From bc751085e448c013e049c5aed61439ebb1726e68 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Thu, 2 May 2024 22:53:52 -0500 Subject: [PATCH 31/34] just instantiate artboards on widget --- Source/Rive/Private/UMG/RiveWidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Rive/Private/UMG/RiveWidget.cpp b/Source/Rive/Private/UMG/RiveWidget.cpp index 4a16537e..e7d5f053 100644 --- a/Source/Rive/Private/UMG/RiveWidget.cpp +++ b/Source/Rive/Private/UMG/RiveWidget.cpp @@ -45,11 +45,10 @@ void URiveWidget::SetAudioEngine(URiveAudioEngine* InAudioEngine) void URiveWidget::SetRiveFile(URiveFile* InRiveFile) { - RiveFile = InRiveFile->CreateInstance(InRiveFile->ArtboardName, InRiveFile->StateMachineName); - + InRiveFile->InstantiateArtboard(); if (RiveWidget.IsValid()) { - RiveWidget->SetRiveFile(RiveFile); + RiveWidget->SetRiveFile(InRiveFile); } } From 199397648008502432972c2887773307b9937262 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Fri, 3 May 2024 08:31:12 -0500 Subject: [PATCH 32/34] move instantiate into isvalid --- Source/Rive/Private/UMG/RiveWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Rive/Private/UMG/RiveWidget.cpp b/Source/Rive/Private/UMG/RiveWidget.cpp index e7d5f053..ea9c0f5a 100644 --- a/Source/Rive/Private/UMG/RiveWidget.cpp +++ b/Source/Rive/Private/UMG/RiveWidget.cpp @@ -45,9 +45,9 @@ void URiveWidget::SetAudioEngine(URiveAudioEngine* InAudioEngine) void URiveWidget::SetRiveFile(URiveFile* InRiveFile) { - InRiveFile->InstantiateArtboard(); if (RiveWidget.IsValid()) { + InRiveFile->InstantiateArtboard(); RiveWidget->SetRiveFile(InRiveFile); } } From 7a1ce02db84e48dd19eabaeffd670972d344b531 Mon Sep 17 00:00:00 2001 From: "Ryan M. Shetley" Date: Fri, 3 May 2024 09:35:52 -0500 Subject: [PATCH 33/34] for now, just reset a rivefile when a widget initializes to prevent new instances from being created multiple times over a widgets life --- Source/Rive/Private/UMG/RiveWidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Rive/Private/UMG/RiveWidget.cpp b/Source/Rive/Private/UMG/RiveWidget.cpp index 79953485..18a2f92c 100644 --- a/Source/Rive/Private/UMG/RiveWidget.cpp +++ b/Source/Rive/Private/UMG/RiveWidget.cpp @@ -33,11 +33,10 @@ TSharedRef URiveWidget::RebuildWidget() void URiveWidget::SetRiveFile(URiveFile* InRiveFile) { - RiveFile = InRiveFile->CreateInstance(InRiveFile->ArtboardName, InRiveFile->StateMachineName); - if (RiveWidget.IsValid()) { - RiveWidget->SetRiveFile(RiveFile); + InRiveFile->InstantiateArtboard(); + RiveWidget->SetRiveFile(InRiveFile); } } From 2903328eda06805185de308a1c57c8961b743665 Mon Sep 17 00:00:00 2001 From: "matthieu.begoghina" <12561988+Voulz@users.noreply.github.com> Date: Wed, 8 May 2024 18:14:49 +1000 Subject: [PATCH 34/34] Add decoders includes to build-rive.py --- Scripts/build-rive/build-rive.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Scripts/build-rive/build-rive.py b/Scripts/build-rive/build-rive.py index 559dd6b0..a229d7c0 100644 --- a/Scripts/build-rive/build-rive.py +++ b/Scripts/build-rive/build-rive.py @@ -249,12 +249,14 @@ def copy_includes(rive_renderer_path): print_green('Copying rive includes...') rive_includes_path = os.path.join(rive_renderer_path, 'submodules', 'rive-cpp', 'include') rive_pls_includes_path = os.path.join(rive_renderer_path, 'include') + rive_decoders_includes_path = os.path.join(rive_renderer_path, 'submodules', 'rive-cpp', 'decoders', 'include') target_path = os.path.join(script_directory, '..', '..', 'Source', 'ThirdParty', 'RiveLibrary', 'Includes') if os.path.exists(target_path): shutil.rmtree(target_path) shutil.copytree(rive_includes_path, target_path, dirs_exist_ok=True) shutil.copytree(rive_pls_includes_path, target_path, dirs_exist_ok=True) + shutil.copytree(rive_decoders_includes_path, target_path, dirs_exist_ok=True) def execute_command(cmd):