From 781057ddb1adba74beca49e2eeea5bd4c405a8fa Mon Sep 17 00:00:00 2001 From: badlogic Date: Wed, 28 Mar 2018 17:03:11 +0200 Subject: [PATCH] [ue4] First steps towards UMG widgets. --- .../Content/Test/Blueprints/TestWidget.uasset | Bin 0 -> 18786 bytes spine-ue4/Content/Test/Test.umap | Bin 47438 -> 47283 bytes spine-ue4/Content/Test/Test_BuiltData.uasset | Bin 813738 -> 813947 bytes .../SpinePlugin/Private/SSpineWidget.cpp | 96 ++++++++++++++++++ .../Private/SpinePluginPrivatePCH.h | 1 + .../SpinePlugin/Private/SpineWidget.cpp | 62 +++++++++++ .../Source/SpinePlugin/Public/SSpineWidget.h | 52 ++++++++++ .../Source/SpinePlugin/Public/SpineWidget.h | 60 +++++++++++ .../Source/SpinePlugin/SpinePlugin.Build.cs | 2 +- 9 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 spine-ue4/Content/Test/Blueprints/TestWidget.uasset create mode 100644 spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp create mode 100644 spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp create mode 100644 spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SSpineWidget.h create mode 100644 spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h diff --git a/spine-ue4/Content/Test/Blueprints/TestWidget.uasset b/spine-ue4/Content/Test/Blueprints/TestWidget.uasset new file mode 100644 index 0000000000000000000000000000000000000000..1c28d7d551323d1037142092fa85940b867c1ec1 GIT binary patch literal 18786 zcmeHP3v^UPnyv;^jNn8ERPezK4-p7?6CgNBl1@S(kA@`R3&Tx!b<)z^x4HLrLV_~j zpobZ790wok8Fkg8J7-pRhE?$~IIFljtFC)w9i6kYqvLy-MbuHjx5EBk-KxGf>23lE zJ7>;11>N`FzpDQC|5w%Rs_gpS%sW0mbm-8kk&KNP!9<~3_FmWaxA#`vc;KYp7vEjE zv$kLy!QL+U-S)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A=K~G6?8cK*WhdHKzA!K~uLJYe@s; z{g?dZLY^5dEgz=o;CxE7FN{oU_axmJnjR8Zv4A&u z%;*M*uxZ2ufvyPsQ3EsBMQe1FK~#10x#3wtii4vR#O~-r(yBj70Be$h=uaqwv>^Vl z0=M$%6@pD8SC8K71fpOxAx=-u?Q_afi5AY~o=XtPdFVacK#WQredw>9RM(W!_x!5L zqT+IYB|TQpn^#?2T2eBvvZjpTZv~))oeR5MUUhj*yDX3p)d8anis4)`d~e9}lOp_= z$f~qgVmJh&hQW?(jW7-#*~?fn8w$LBP_MGmn82%?nCuB_peWH)V__F04-K_cRKs!3 zBb}F!1;#6t_eSJ?*6wIrDXLtI+vT&;vLLM*Dd0NUC|_RFF0&;>2>{O&1wyQp z_X?YmHoGBZ2jwDZFO3=7@PsntT-i8{G^8CbD+j)MWK3ytU=4P|J4LaZE1$Ez&o#DQ z|E-t&cHIx2znwpI%lY++GxYP(=Q4>PjYDV&QzR5+VN5wuRAUj?Xov=0%)98XEB!A- Cjgkof literal 0 HcmV?d00001 diff --git a/spine-ue4/Content/Test/Test.umap b/spine-ue4/Content/Test/Test.umap index 22e29af16fb6ccfe0cb79fd9b8309d8a6c026841..045503b823daf8e0243fb21b3a4bbd0d0449a97b 100644 GIT binary patch delta 1213 zcmZ9Jdq`7J9LIN$cc!5=bu~@x0W&uZ+v9FKn;B`jFcYE>F-R;h(O!zL%mTB_sZG;g zn`!n?i?HZ{2hpJDL1jghA|&;f{*lWvdkBsQvU^W*-Mnxw`ddS%_oFc+>BF=x#sR!*J^ZbgYDa9fcAJj8(3NL3IGU(qMMD#7j^? zrdG!Ko$wG_wV2JX^b%B{*2&nlr#!?w9cH;24+0Scz<{qBMaq8ksMJM2=aBCOgH%eX~luKK0y11YHwtp~GNNBFnr~Yr!b|I!(AN zNvQso7|x8xsH*{ZiPK~9JpU2140<~hzRr8e?QTs-YQty_VA_CRq~`wTPMa zbTV_cwc7&rhA6VBiFb}4d7m{|_s&|gbInxd<*BdKI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kySL-#rngCo5Cem z>PjzM|1mpHzk33d%wu}=LcrPj^YO8J6;aRF=U3OxycHuQ;Y>2s^O!C^o`MiZp6?42 z57|N{dsUj=w+ZQ9a~R1NvB8qTT_+vAXDlId=RFhq>!*{y`^@yK6P3>)_C5BSQ?!?! zO;A)o%gBzXIVFefYsv3QCLz%pWTewk140MM(@zQ*Edv@~2X+C^10Mp7r!}<_*ajR0 z-Ugq1vmhl06qm;2EiZL1w0RY2s93XKd=or3cL+W8wP)%0vymtCx)jp{spp6 Bvy=b; diff --git a/spine-ue4/Content/Test/Test_BuiltData.uasset b/spine-ue4/Content/Test/Test_BuiltData.uasset index 5e458903eb0761c00d655ef852462749ab52d1c6..af5b1da6c3f195116afef0371f9d67d28fe40393 100644 GIT binary patch delta 1337 zcmcgqJ!n%=6u$Q*FYo2$K1pMmy!_S1rZH)f)(EAgqNLWrAd0A9McT?GKm?I=Z$bK*eDExqoK|}@K0#<~55DHLk03((F?cR*<$%rX|7l%cW-93)o0Rui5h%X4)94i$nVHO>P0IxAi9bPNZHl%H3UJftw~m#B!e-5wA0l|*l+Q2eY} z^~e_FUlgZjNQ5oGN2Xg75AABE#MPvyUxcxEQs`In{EB+oi$j=yG9a3-n~;=HV*Drb zLbjhTI}*NsIckiDnDf7n`W3+Cln2 zX0b2`F)%YMsIp?1_&|K(HABgXKn>s1d4N&~@E-_{ZdPEdXWV?0sf~$IZ1MtD>B;G= zGK|7tRx_)NpdwT`)NKqhlh3e9Gs;YU!D`NUbg}|lI^zu>=|A~8o5W;!HkZk>*#-Fc zfqIyr`t~wTZe;TU35$U|4iml(HE%cfWJNY7wLd_YKsA6V4Jd~hNIOM9Ts?^ws8nlm zFo%Yi98?-)nj@5bC3W&djv#T6dtq*U1Z9Y(@c^}|PL}7K!WcMt3#Xm81XL4<0@)EA z%RoR#6{Position.X = offset.X + x; + vertex->Position.Y = offset.Y + y; + vertex->TexCoords[0] = u; + vertex->TexCoords[1] = v; + vertex->TexCoords[2] = u; + vertex->TexCoords[3] = v; + vertex->MaterialTexCoords.X = u; + vertex->MaterialTexCoords.Y = v; + vertex->Color = color; + vertex->PixelSize[0] = 1; + vertex->PixelSize[1] = 1; +} + +int32 SSpineWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, + int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const { + SSpineWidget* self = (SSpineWidget*)this; + self->renderData.IndexData.SetNumUninitialized(6); + uint32* indexData = (uint32*)renderData.IndexData.GetData(); + indexData[0] = 0; + indexData[1] = 1; + indexData[2] = 2; + indexData[3] = 2; + indexData[4] = 3; + indexData[5] = 0; + + self->renderData.VertexData.SetNumUninitialized(4); + FSlateVertex* vertexData = (FSlateVertex*)renderData.VertexData.GetData(); + FVector2D offset = AllottedGeometry.AbsolutePosition; + FColor white = FColor(0xffffffff); + setVertex(&vertexData[0], 0, 0, 0, 0, white, offset); + setVertex(&vertexData[1], 200, 0, 1, 0, white, offset); + setVertex(&vertexData[2], 200, 200, 1, 1, white, offset); + setVertex(&vertexData[3], 0, 200, 0, 1, white, offset); + + if (brush && renderData.VertexData.Num() > 0 && renderData.IndexData.Num() > 0) { + FSlateShaderResourceProxy* shaderResource = FSlateDataPayload::ResourceManager->GetShaderResource(*brush); + FSlateResourceHandle resourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(*brush); + if (shaderResource) + FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, resourceHandle, renderData.VertexData, + renderData.IndexData, nullptr, 0, 0); + } + + return LayerId; +} \ No newline at end of file diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePluginPrivatePCH.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePluginPrivatePCH.h index d6f7713f3..d73ab820d 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePluginPrivatePCH.h +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePluginPrivatePCH.h @@ -36,3 +36,4 @@ #include "SpineSkeletonRendererComponent.h" #include "SpineBoneFollowerComponent.h" #include "SpineBoneDriverComponent.h" +#include "SpineWidget.h" diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp new file mode 100644 index 000000000..cd069e29e --- /dev/null +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineWidget.cpp @@ -0,0 +1,62 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#include "SpinePluginPrivatePCH.h" +#include "SpineWidget.h" +#include "SSpineWidget.h" + +#define LOCTEXT_NAMESPACE "Spine" + +USpineWidget::USpineWidget(const FObjectInitializer& ObjectInitializer): Super(ObjectInitializer) { +} + +void USpineWidget::SynchronizeProperties() { + Super::SynchronizeProperties(); + + if (slateWidget.IsValid()) { + slateWidget->SetBrush(&Brush); + } +} + +void USpineWidget::ReleaseSlateResources(bool bReleaseChildren) { + Super::ReleaseSlateResources(bReleaseChildren); + slateWidget.Reset(); +} + +TSharedRef USpineWidget::RebuildWidget() { + this->slateWidget = SNew(SSpineWidget); + return this->slateWidget.ToSharedRef(); +} + +#if WITH_EDITOR +const FText USpineWidget::GetPaletteCategory() { + return LOCTEXT("Spine", "Spine"); +} +#endif \ No newline at end of file diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SSpineWidget.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SSpineWidget.h new file mode 100644 index 000000000..a56191559 --- /dev/null +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SSpineWidget.h @@ -0,0 +1,52 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#pragma once + +#include "SlateCore.h" +#include "Slate/SMeshWidget.h" + +class SSpineWidget: public SMeshWidget { + +public: + SLATE_BEGIN_ARGS(SSpineWidget): _MeshData(nullptr) { } + SLATE_ARGUMENT(USlateVectorArtData*, MeshData) + SLATE_END_ARGS() + + void Construct(const FArguments& Args); + + void SetBrush(FSlateBrush* Brush); + +protected: + virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override; + + FSlateBrush* brush = nullptr; + FRenderData renderData; +}; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h new file mode 100644 index 000000000..867db3ac1 --- /dev/null +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineWidget.h @@ -0,0 +1,60 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#pragma once + +#include "SpinePluginPrivatePCH.h" + +#include "Runtime/UMG/Public/UMG.h" +#include "Runtime/UMG/Public/UMGStyle.h" + +#include "SpineWidget.generated.h" + +class SSpineWidget; + +UCLASS(ClassGroup = (Spine), meta = (BlueprintSpawnableComponent)) +class SPINEPLUGIN_API USpineWidget: public UWidget { + GENERATED_UCLASS_BODY() + +public: + virtual void ReleaseSlateResources(bool bReleaseChildren) override; + virtual void SynchronizeProperties() override; +#if WITH_EDITOR + virtual const FText GetPaletteCategory() override; +#endif + + UPROPERTY(Category = Spine, EditAnywhere, BlueprintReadOnly) + FSlateBrush Brush; + +protected: + virtual TSharedRef RebuildWidget() override; + + TSharedPtr slateWidget; +}; \ No newline at end of file diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/SpinePlugin.Build.cs b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/SpinePlugin.Build.cs index 4b76c55be..907fdd444 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/SpinePlugin.Build.cs +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/SpinePlugin.Build.cs @@ -8,7 +8,7 @@ namespace UnrealBuildTool.Rules { PublicIncludePaths.AddRange(new string[] { "SpinePlugin/Public", "SpinePlugin/Public/spine-c/include" }); PrivateIncludePaths.AddRange(new string[] { "SpinePlugin/Private", "SpinePlugin/Public/spine-c/include" }); - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "RHI", "RenderCore", "ShaderCore", "ProceduralMeshComponent", "RuntimeMeshComponent" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "RHI", "RenderCore", "ShaderCore", "RuntimeMeshComponent", "UMG", "Slate", "SlateCore" }); OptimizeCode = CodeOptimization.Never; } }