diff --git a/native/build/cocos2d_libs.xcodeproj/project.pbxproj b/native/build/cocos2d_libs.xcodeproj/project.pbxproj index fc610403de..4083738117 100644 --- a/native/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/native/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -273,6 +273,18 @@ 0494CFD522BEFC6D00B73B79 /* ParallelTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0494CFD222BEFC6D00B73B79 /* ParallelTask.cpp */; }; 0494CFD622BEFC6D00B73B79 /* ParallelTask.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */; }; 0494CFD722BEFC6D00B73B79 /* ParallelTask.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */; }; + 049B31FB2313B6240004909A /* SkeletonCacheMgr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B31F92313B6240004909A /* SkeletonCacheMgr.cpp */; }; + 049B31FC2313B6240004909A /* SkeletonCacheMgr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B31F92313B6240004909A /* SkeletonCacheMgr.cpp */; }; + 049B31FD2313B6240004909A /* SkeletonCacheMgr.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B31FA2313B6240004909A /* SkeletonCacheMgr.h */; }; + 049B31FE2313B6240004909A /* SkeletonCacheMgr.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B31FA2313B6240004909A /* SkeletonCacheMgr.h */; }; + 049B32072314DF1C0004909A /* SkeletonCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B32052314DF1C0004909A /* SkeletonCache.cpp */; }; + 049B32082314DF1C0004909A /* SkeletonCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B32052314DF1C0004909A /* SkeletonCache.cpp */; }; + 049B32092314DF1C0004909A /* SkeletonCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B32062314DF1C0004909A /* SkeletonCache.h */; }; + 049B320A2314DF1C0004909A /* SkeletonCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B32062314DF1C0004909A /* SkeletonCache.h */; }; + 049B320D231533BF0004909A /* SkeletonCacheAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B320B231533BF0004909A /* SkeletonCacheAnimation.cpp */; }; + 049B320E231533BF0004909A /* SkeletonCacheAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B320B231533BF0004909A /* SkeletonCacheAnimation.cpp */; }; + 049B320F231533BF0004909A /* SkeletonCacheAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B320C231533BF0004909A /* SkeletonCacheAnimation.h */; }; + 049B3210231533BF0004909A /* SkeletonCacheAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B320C231533BF0004909A /* SkeletonCacheAnimation.h */; }; 04AF62FF219190ED00AED9DE /* TypedArrayPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04AF62FD219190ED00AED9DE /* TypedArrayPool.cpp */; }; 04AF6300219190ED00AED9DE /* TypedArrayPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04AF62FD219190ED00AED9DE /* TypedArrayPool.cpp */; }; 04AF6301219190ED00AED9DE /* TypedArrayPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 04AF62FE219190ED00AED9DE /* TypedArrayPool.h */; }; @@ -599,6 +611,18 @@ 04F8563522ABCB9900063A20 /* TiledMapAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04F8563222ABCB9900063A20 /* TiledMapAssembler.cpp */; }; 04F8563622ABCB9900063A20 /* TiledMapAssembler.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 04F8563322ABCB9900063A20 /* TiledMapAssembler.hpp */; }; 04F8563722ABCB9900063A20 /* TiledMapAssembler.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 04F8563322ABCB9900063A20 /* TiledMapAssembler.hpp */; }; + 04FB24092328D42A0021DD02 /* CCArmatureCacheDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FB24032328D42A0021DD02 /* CCArmatureCacheDisplay.h */; }; + 04FB240A2328D42A0021DD02 /* CCArmatureCacheDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FB24032328D42A0021DD02 /* CCArmatureCacheDisplay.h */; }; + 04FB240B2328D42A0021DD02 /* ArmatureCacheMgr.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FB24042328D42A0021DD02 /* ArmatureCacheMgr.h */; }; + 04FB240C2328D42A0021DD02 /* ArmatureCacheMgr.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FB24042328D42A0021DD02 /* ArmatureCacheMgr.h */; }; + 04FB240D2328D42A0021DD02 /* ArmatureCacheMgr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04FB24052328D42A0021DD02 /* ArmatureCacheMgr.cpp */; }; + 04FB240E2328D42A0021DD02 /* ArmatureCacheMgr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04FB24052328D42A0021DD02 /* ArmatureCacheMgr.cpp */; }; + 04FB240F2328D42A0021DD02 /* ArmatureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04FB24062328D42A0021DD02 /* ArmatureCache.cpp */; }; + 04FB24102328D42A0021DD02 /* ArmatureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04FB24062328D42A0021DD02 /* ArmatureCache.cpp */; }; + 04FB24112328D42A0021DD02 /* ArmatureCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FB24072328D42A0021DD02 /* ArmatureCache.h */; }; + 04FB24122328D42A0021DD02 /* ArmatureCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FB24072328D42A0021DD02 /* ArmatureCache.h */; }; + 04FB24132328D42A0021DD02 /* CCArmatureCacheDisplay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04FB24082328D42A0021DD02 /* CCArmatureCacheDisplay.cpp */; }; + 04FB24142328D42A0021DD02 /* CCArmatureCacheDisplay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04FB24082328D42A0021DD02 /* CCArmatureCacheDisplay.cpp */; }; 1A14FD912080B4E300E10ABE /* CCGLUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A14FD8F2080B4E300E10ABE /* CCGLUtils.cpp */; }; 1A14FD922080B4E300E10ABE /* CCGLUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A14FD8F2080B4E300E10ABE /* CCGLUtils.cpp */; }; 1A14FD932080B4E300E10ABE /* CCGLUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A14FD902080B4E300E10ABE /* CCGLUtils.h */; }; @@ -1544,6 +1568,12 @@ 04886B4022CE22F2008CEB66 /* SlicedSprite2D.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SlicedSprite2D.hpp; sourceTree = ""; }; 0494CFD222BEFC6D00B73B79 /* ParallelTask.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ParallelTask.cpp; sourceTree = ""; }; 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ParallelTask.hpp; sourceTree = ""; }; + 049B31F92313B6240004909A /* SkeletonCacheMgr.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonCacheMgr.cpp; path = "../cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp"; sourceTree = ""; }; + 049B31FA2313B6240004909A /* SkeletonCacheMgr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SkeletonCacheMgr.h; path = "../cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h"; sourceTree = ""; }; + 049B32052314DF1C0004909A /* SkeletonCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonCache.cpp; path = "../cocos/editor-support/spine-creator-support/SkeletonCache.cpp"; sourceTree = ""; }; + 049B32062314DF1C0004909A /* SkeletonCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SkeletonCache.h; path = "../cocos/editor-support/spine-creator-support/SkeletonCache.h"; sourceTree = ""; }; + 049B320B231533BF0004909A /* SkeletonCacheAnimation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonCacheAnimation.cpp; path = "../cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp"; sourceTree = ""; }; + 049B320C231533BF0004909A /* SkeletonCacheAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SkeletonCacheAnimation.h; path = "../cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h"; sourceTree = ""; }; 04AF62FD219190ED00AED9DE /* TypedArrayPool.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TypedArrayPool.cpp; path = "../cocos/editor-support/TypedArrayPool.cpp"; sourceTree = ""; }; 04AF62FE219190ED00AED9DE /* TypedArrayPool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypedArrayPool.h; path = "../cocos/editor-support/TypedArrayPool.h"; sourceTree = ""; }; 04DBD30922AE2D8000DBE4CD /* VertexEffectDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexEffectDelegate.h; path = "../cocos/editor-support/spine-creator-support/VertexEffectDelegate.h"; sourceTree = ""; }; @@ -1707,6 +1737,12 @@ 04ED68D721F8188F006E82F8 /* MeshBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MeshBuffer.h; path = "../cocos/editor-support/MeshBuffer.h"; sourceTree = ""; }; 04F8563222ABCB9900063A20 /* TiledMapAssembler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TiledMapAssembler.cpp; sourceTree = ""; }; 04F8563322ABCB9900063A20 /* TiledMapAssembler.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TiledMapAssembler.hpp; sourceTree = ""; }; + 04FB24032328D42A0021DD02 /* CCArmatureCacheDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCArmatureCacheDisplay.h; path = "../cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h"; sourceTree = ""; }; + 04FB24042328D42A0021DD02 /* ArmatureCacheMgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArmatureCacheMgr.h; path = "../cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h"; sourceTree = ""; }; + 04FB24052328D42A0021DD02 /* ArmatureCacheMgr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArmatureCacheMgr.cpp; path = "../cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp"; sourceTree = ""; }; + 04FB24062328D42A0021DD02 /* ArmatureCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArmatureCache.cpp; path = "../cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp"; sourceTree = ""; }; + 04FB24072328D42A0021DD02 /* ArmatureCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArmatureCache.h; path = "../cocos/editor-support/dragonbones-creator-support/ArmatureCache.h"; sourceTree = ""; }; + 04FB24082328D42A0021DD02 /* CCArmatureCacheDisplay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCArmatureCacheDisplay.cpp; path = "../cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp"; sourceTree = ""; }; 051C016F21E2F85C00D4A347 /* CCModuleConfigIOS.debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CCModuleConfigIOS.debug.xcconfig; sourceTree = ""; }; 051C017021E2F85C00D4A347 /* CCModuleConfigIOS.release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CCModuleConfigIOS.release.xcconfig; sourceTree = ""; }; 051C017121E2F86900D4A347 /* CCModuleConfigMac.release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CCModuleConfigMac.release.xcconfig; sourceTree = ""; }; @@ -2433,6 +2469,12 @@ 04DBD31422AE2D8100DBE4CD /* spine-cocos2dx.h */, 04DBD30F22AE2D8100DBE4CD /* VertexEffectDelegate.cpp */, 04DBD30922AE2D8000DBE4CD /* VertexEffectDelegate.h */, + 049B31F92313B6240004909A /* SkeletonCacheMgr.cpp */, + 049B31FA2313B6240004909A /* SkeletonCacheMgr.h */, + 049B32052314DF1C0004909A /* SkeletonCache.cpp */, + 049B32062314DF1C0004909A /* SkeletonCache.h */, + 049B320B231533BF0004909A /* SkeletonCacheAnimation.cpp */, + 049B320C231533BF0004909A /* SkeletonCacheAnimation.h */, ); name = "spine-creator-support"; sourceTree = ""; @@ -2456,6 +2498,12 @@ 046E040B2181A9BE00B24E2D /* dragonbones-creator-support */ = { isa = PBXGroup; children = ( + 04FB24062328D42A0021DD02 /* ArmatureCache.cpp */, + 04FB24072328D42A0021DD02 /* ArmatureCache.h */, + 04FB24052328D42A0021DD02 /* ArmatureCacheMgr.cpp */, + 04FB24042328D42A0021DD02 /* ArmatureCacheMgr.h */, + 04FB24082328D42A0021DD02 /* CCArmatureCacheDisplay.cpp */, + 04FB24032328D42A0021DD02 /* CCArmatureCacheDisplay.h */, 046E06112185B37100B24E2D /* CCArmatureDisplay.cpp */, 046E060B2185B37000B24E2D /* CCArmatureDisplay.h */, 046E06102185B37100B24E2D /* CCDragonBonesHeaders.h */, @@ -3593,6 +3641,7 @@ 46FDDBC3202ADDCE00931238 /* ccConfig.h in Headers */, 46FDDA77202ACC6A00931238 /* Light.h in Headers */, 04DBD45B22AE2DBD00DBE4CD /* Timeline.h in Headers */, + 049B31FD2313B6240004909A /* SkeletonCacheMgr.h in Headers */, 04DBD48122AE2DBD00DBE4CD /* PathConstraintPositionTimeline.h in Headers */, 04DBD3BD22AE2DBD00DBE4CD /* Attachment.h in Headers */, 1A28FF5D1F20AFAB007A1D9D /* SRProxyConnect.h in Headers */, @@ -3609,6 +3658,7 @@ 46AE3FDF2092F3A600F3A228 /* env.h in Headers */, 46AE3FE72092F3A600F3A228 /* inspector_io.h in Headers */, 04DBD45922AE2DBD00DBE4CD /* PointAttachment.h in Headers */, + 04FB24092328D42A0021DD02 /* CCArmatureCacheDisplay.h in Headers */, 04ED68DA21F8188F006E82F8 /* MeshBuffer.h in Headers */, 46FDDBCF202ADDCE00931238 /* CCMap.h in Headers */, 427475FB23214E2A00139DF8 /* MeshAssembler.hpp in Headers */, @@ -3685,6 +3735,7 @@ 04DBD44922AE2DBD00DBE4CD /* DrawOrderTimeline.h in Headers */, 04DBD47122AE2DBD00DBE4CD /* Bone.h in Headers */, 1A52DB63205BCDC700350EE3 /* Object.hpp in Headers */, + 049B320F231533BF0004909A /* SkeletonCacheAnimation.h in Headers */, 469303802046AE05004A3D6C /* config.hpp in Headers */, 04DBD4D522AE2DBD00DBE4CD /* IkConstraint.h in Headers */, 0482F199228D87970019ECF7 /* RenderFlow.hpp in Headers */, @@ -3771,6 +3822,7 @@ 1A52DB68205BCDC700350EE3 /* Base.h in Headers */, 50ABBD521925AB0000A911A9 /* Quaternion.h in Headers */, 1A52DB2D205BCD9200350EE3 /* ObjectWrap.h in Headers */, + 04FB240B2328D42A0021DD02 /* ArmatureCacheMgr.h in Headers */, 04DBD47322AE2DBD00DBE4CD /* AttachmentType.h in Headers */, 042058CF22A61B340092DE5D /* RenderDataList.hpp in Headers */, 1A52DB6A205BCDC700350EE3 /* HelperMacros.h in Headers */, @@ -3891,6 +3943,7 @@ 0482F1A7228D87970019ECF7 /* NodeProxy.hpp in Headers */, 1A28FF951F20AFAB007A1D9D /* SocketRocket.h in Headers */, 46AE40012092F3A600F3A228 /* SHA1.h in Headers */, + 04FB24112328D42A0021DD02 /* ArmatureCache.h in Headers */, 046E06992185B45300B24E2D /* Matrix.h in Headers */, 046E06142185B37100B24E2D /* CCArmatureDisplay.h in Headers */, 04DBD3E722AE2DBD00DBE4CD /* PathConstraintMixTimeline.h in Headers */, @@ -3932,6 +3985,7 @@ 046E0711218B01EF00B24E2D /* jsb_dragonbones_manual.hpp in Headers */, 4617863120522469008256E1 /* SocketIO.h in Headers */, 46FDDBD1202ADDCE00931238 /* ccUTF8.h in Headers */, + 049B32092314DF1C0004909A /* SkeletonCache.h in Headers */, 4693045A2046AE06004A3D6C /* EventDispatcher.h in Headers */, 0494CFD622BEFC6D00B73B79 /* ParallelTask.hpp in Headers */, 1AAAC8F3205CB6E9005321B9 /* AudioEngine.h in Headers */, @@ -4014,16 +4068,19 @@ 46FDDA92202ACC6A00931238 /* Pass.h in Headers */, 046E067C2185B42F00B24E2D /* DragonBonesHeaders.h in Headers */, 46FDDB4E202ADDCE00931238 /* pvr.h in Headers */, + 049B31FE2313B6240004909A /* SkeletonCacheMgr.h in Headers */, 46FDDBB6202ADDCE00931238 /* uthash.h in Headers */, 46FDDB5E202ADDCE00931238 /* ccMacros.h in Headers */, 294D7D9B1D0E93A2002CE7B7 /* CCDevice-apple.h in Headers */, 46178650205224DA008256E1 /* CCDownloaderImpl-apple.h in Headers */, 46FDDAA6202ACC6A00931238 /* Scene.h in Headers */, + 04FB240A2328D42A0021DD02 /* CCArmatureCacheDisplay.h in Headers */, 46AE3FE62092F3A600F3A228 /* base64.h in Headers */, 1A586C4A2064C97800B47573 /* EJConvert.h in Headers */, 04DBD42422AE2DBD00DBE4CD /* SlotData.h in Headers */, 46AE3FE82092F3A600F3A228 /* inspector_io.h in Headers */, 1AAAC8E0205CB6E9005321B9 /* AudioDecoder.h in Headers */, + 049B3210231533BF0004909A /* SkeletonCacheAnimation.h in Headers */, 04DBD3BE22AE2DBD00DBE4CD /* Attachment.h in Headers */, 046E06D02185B49F00B24E2D /* BoundingBoxData.h in Headers */, 1A28FF821F20AFAB007A1D9D /* SRRandom.h in Headers */, @@ -4126,6 +4183,7 @@ 4617864C20522469008256E1 /* HttpCookie.h in Headers */, 04DBD3C622AE2DBD00DBE4CD /* MixDirection.h in Headers */, 1A52DB74205BCDD000350EE3 /* Base.h in Headers */, + 049B320A2314DF1C0004909A /* SkeletonCache.h in Headers */, 04DBD3E222AE2DBD00DBE4CD /* AttachmentTimeline.h in Headers */, 469304012046AE06004A3D6C /* jsb_global.h in Headers */, 04DBD47A22AE2DBD00DBE4CD /* PositionMode.h in Headers */, @@ -4185,6 +4243,7 @@ 04DBD3DE22AE2DBD00DBE4CD /* SkeletonData.h in Headers */, 1A28FF721F20AFAB007A1D9D /* SRHash.h in Headers */, 50ABBD431925AB0000A911A9 /* CCMathBase.h in Headers */, + 04FB24122328D42A0021DD02 /* ArmatureCache.h in Headers */, 46FDDBDE202ADDCE00931238 /* TGAlib.h in Headers */, 046E06DC2185B49F00B24E2D /* ConstraintData.h in Headers */, 469303812046AE05004A3D6C /* config.hpp in Headers */, @@ -4288,6 +4347,7 @@ 46FDDA76202ACC6A00931238 /* Config.h in Headers */, 04DBD3D022AE2DBD00DBE4CD /* Triangulator.h in Headers */, 50643BD519BFAECF00EF68ED /* CCGL.h in Headers */, + 04FB240C2328D42A0021DD02 /* ArmatureCacheMgr.h in Headers */, 046E06D62185B49F00B24E2D /* ArmatureData.h in Headers */, 46FDDB84202ADDCE00931238 /* ccRandom.h in Headers */, 1AAAC8EA205CB6E9005321B9 /* AudioMacros.h in Headers */, @@ -4437,6 +4497,7 @@ 46FDDB65202ADDCE00931238 /* ccRandom.cpp in Sources */, 46FDDAB9202ACC6A00931238 /* FrameBuffer.cpp in Sources */, 50ABBD581925AB0000A911A9 /* Vec2.cpp in Sources */, + 049B31FB2313B6240004909A /* SkeletonCacheMgr.cpp in Sources */, 4626B1FF202D9BD800BE30B9 /* CCApplication-mac.mm in Sources */, 04DBD46F22AE2DBD00DBE4CD /* TransformConstraintData.cpp in Sources */, 5027253C190BF1B900AAF4ED /* cocos2d.cpp in Sources */, @@ -4480,6 +4541,7 @@ 04DBD4B122AE2DBD00DBE4CD /* TwoColorTimeline.cpp in Sources */, 04DBD48522AE2DBD00DBE4CD /* EventTimeline.cpp in Sources */, 046E06DD2185B49F00B24E2D /* AnimationData.cpp in Sources */, + 04FB24132328D42A0021DD02 /* CCArmatureCacheDisplay.cpp in Sources */, 046E06202185B37100B24E2D /* CCArmatureDisplay.cpp in Sources */, 0494CFD422BEFC6D00B73B79 /* ParallelTask.cpp in Sources */, 046E06882185B44A00B24E2D /* BaseFactory.cpp in Sources */, @@ -4507,6 +4569,7 @@ 1A52DB6B205BCDC700350EE3 /* Utils.cpp in Sources */, 4693042E2046AE06004A3D6C /* jsb_helper.cpp in Sources */, 046E06EB2185B4A500B24E2D /* DataParser.cpp in Sources */, + 049B320D231533BF0004909A /* SkeletonCacheAnimation.cpp in Sources */, 04DBD41F22AE2DBD00DBE4CD /* Animation.cpp in Sources */, 1A14FD912080B4E300E10ABE /* CCGLUtils.cpp in Sources */, 046E06B92185B49F00B24E2D /* ConstraintData.cpp in Sources */, @@ -4531,6 +4594,7 @@ 04DBD4B522AE2DBD00DBE4CD /* RTTI.cpp in Sources */, 0482F1A5228D87970019ECF7 /* MeshBuffer.cpp in Sources */, 46FDDA89202ACC6A00931238 /* Effect.cpp in Sources */, + 04FB240F2328D42A0021DD02 /* ArmatureCache.cpp in Sources */, 1ABAD24E20C29F3800BC71C0 /* CCCanvasRenderingContext2D-apple.mm in Sources */, 046E06E12185B49F00B24E2D /* DragonBonesData.cpp in Sources */, ED30577E1BEC76C90083C3ED /* ioapi_mem.cpp in Sources */, @@ -4576,6 +4640,7 @@ 469303BE2046AE05004A3D6C /* jsb_renderer_auto.cpp in Sources */, 04DBD43722AE2DBD00DBE4CD /* TranslateTimeline.cpp in Sources */, 50ABC0191926664800A911A9 /* CCSAXParser.cpp in Sources */, + 04FB240D2328D42A0021DD02 /* ArmatureCacheMgr.cpp in Sources */, 1A28FF571F20AFAB007A1D9D /* SRIOConsumerPool.m in Sources */, 04DBD42922AE2DBD00DBE4CD /* RegionAttachment.cpp in Sources */, 46FDDB7B202ADDCE00931238 /* CCRef.cpp in Sources */, @@ -4721,6 +4786,7 @@ 046E06822185B43B00B24E2D /* EventObject.cpp in Sources */, 046B68A621A292D300B33469 /* jsb_spine_manual.cpp in Sources */, BA21055C21009A2C00E19975 /* Manifest.cpp in Sources */, + 049B32072314DF1C0004909A /* SkeletonCache.cpp in Sources */, 04DBD41B22AE2DBD00DBE4CD /* SlotData.cpp in Sources */, 046E06392185B41100B24E2D /* WorldClock.cpp in Sources */, 1A28FF931F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.m in Sources */, @@ -4742,6 +4808,7 @@ 4617864820522469008256E1 /* CCDownloaderImpl-apple.mm in Sources */, 046E066D2185B41B00B24E2D /* Slot.cpp in Sources */, 1A28FF601F20AFAB007A1D9D /* SRProxyConnect.m in Sources */, + 049B320E231533BF0004909A /* SkeletonCacheAnimation.cpp in Sources */, 04F8563522ABCB9900063A20 /* TiledMapAssembler.cpp in Sources */, 1A28FF901F20AFAB007A1D9D /* NSRunLoop+SRWebSocket.m in Sources */, 046E06C42185B49F00B24E2D /* ArmatureData.cpp in Sources */, @@ -4764,11 +4831,13 @@ 04DBD41422AE2DBD00DBE4CD /* Triangulator.cpp in Sources */, 046B68AF21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp in Sources */, 04DBD3E622AE2DBD00DBE4CD /* PointAttachment.cpp in Sources */, + 04FB24102328D42A0021DD02 /* ArmatureCache.cpp in Sources */, ED30578B1BEC774D0083C3ED /* ioapi_mem.cpp in Sources */, 1A28FF9A1F20AFAB007A1D9D /* SRSecurityPolicy.m in Sources */, 04DBD42022AE2DBD00DBE4CD /* Animation.cpp in Sources */, 1A28FF581F20AFAB007A1D9D /* SRIOConsumerPool.m in Sources */, 04DBD44822AE2DBD00DBE4CD /* Skeleton.cpp in Sources */, + 049B31FC2313B6240004909A /* SkeletonCacheMgr.cpp in Sources */, 469303C72046AE05004A3D6C /* jsb_gfx_auto.cpp in Sources */, 46AE3FF22092F3A600F3A228 /* SHA1.cpp in Sources */, 04DBD3C422AE2DBD00DBE4CD /* VertexEffect.cpp in Sources */, @@ -4907,6 +4976,7 @@ 469304132046AE06004A3D6C /* jsb_classtype.cpp in Sources */, 46FDDAA4202ACC6A00931238 /* InputAssembler.cpp in Sources */, 1A28FF941F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.m in Sources */, + 04FB24142328D42A0021DD02 /* CCArmatureCacheDisplay.cpp in Sources */, 4693042F2046AE06004A3D6C /* jsb_helper.cpp in Sources */, 046E065B2185B41B00B24E2D /* DeformVertices.cpp in Sources */, 4693043D2046AE06004A3D6C /* jsb_gfx_manual.cpp in Sources */, @@ -4956,6 +5026,7 @@ 46FDDAAA202ACC6A00931238 /* Types.cpp in Sources */, 04DBD44622AE2DBD00DBE4CD /* AnimationState.cpp in Sources */, 1A29D797205666F500168D9A /* jsb_opengl_utils.cpp in Sources */, + 04FB240E2328D42A0021DD02 /* ArmatureCacheMgr.cpp in Sources */, 04DBD4BC22AE2DBD00DBE4CD /* PathConstraintPositionTimeline.cpp in Sources */, 046E06E22185B49F00B24E2D /* DragonBonesData.cpp in Sources */, 04DBD4B822AE2DBD00DBE4CD /* SkeletonBounds.cpp in Sources */, @@ -4996,6 +5067,7 @@ 1AAAC8EC205CB6E9005321B9 /* AudioCache.mm in Sources */, 46FDDBE4202ADDCE00931238 /* CCData.cpp in Sources */, 469304592046AE06004A3D6C /* EventDispatcher.cpp in Sources */, + 049B32082314DF1C0004909A /* SkeletonCache.cpp in Sources */, 46FDDAB4202ACC6A00931238 /* VertexBuffer.cpp in Sources */, 4617864E205224CF008256E1 /* HttpClient-apple.mm in Sources */, 04DBD43422AE2DBD00DBE4CD /* Skin.cpp in Sources */, diff --git a/native/build/libcocos2d.vcxproj b/native/build/libcocos2d.vcxproj index 9234c31527..26db51f548 100644 --- a/native/build/libcocos2d.vcxproj +++ b/native/build/libcocos2d.vcxproj @@ -41,6 +41,9 @@ + + + @@ -84,6 +87,9 @@ + + + @@ -325,6 +331,9 @@ + + + @@ -377,6 +386,9 @@ + + + diff --git a/native/build/libcocos2d.vcxproj.filters b/native/build/libcocos2d.vcxproj.filters index 3e0d0b6fcf..05fc60bf3f 100644 --- a/native/build/libcocos2d.vcxproj.filters +++ b/native/build/libcocos2d.vcxproj.filters @@ -818,6 +818,24 @@ js-bindings\auto + + editor-support\spine-creator-support + + + editor-support\spine-creator-support + + + editor-support\spine-creator-support + + + editor-support\dragonbones-creator-support + + + editor-support\dragonbones-creator-support + + + editor-support\dragonbones-creator-support + @@ -1841,6 +1859,24 @@ js-bindings\auto + + editor-support\spine-creator-support + + + editor-support\spine-creator-support + + + editor-support\spine-creator-support + + + editor-support\dragonbones-creator-support + + + editor-support\dragonbones-creator-support + + + editor-support\dragonbones-creator-support + diff --git a/native/cocos/editor-support/Android.mk b/native/cocos/editor-support/Android.mk index e875c09a97..357e441bfc 100644 --- a/native/cocos/editor-support/Android.mk +++ b/native/cocos/editor-support/Android.mk @@ -92,6 +92,9 @@ spine-creator-support/SkeletonDataMgr.cpp \ spine-creator-support/SkeletonRenderer.cpp \ spine-creator-support/spine-cocos2dx.cpp \ spine-creator-support/VertexEffectDelegate.cpp \ +spine-creator-support/SkeletonCacheMgr.cpp \ +spine-creator-support/SkeletonCache.cpp \ +spine-creator-support/SkeletonCacheAnimation.cpp \ ../scripting/js-bindings/manual/jsb_spine_manual.cpp \ ../scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp endif # USE_SPINE @@ -133,6 +136,9 @@ dragonbones-creator-support/CCArmatureDisplay.cpp \ dragonbones-creator-support/CCFactory.cpp \ dragonbones-creator-support/CCSlot.cpp \ dragonbones-creator-support/CCTextureAtlasData.cpp \ +dragonbones-creator-support/ArmatureCache.cpp \ +dragonbones-creator-support/ArmatureCacheMgr.cpp \ +dragonbones-creator-support/CCArmatureCacheDisplay.cpp \ ../scripting/js-bindings/manual/jsb_dragonbones_manual.cpp \ ../scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp endif # USE_DRAGONBONES diff --git a/native/cocos/editor-support/MeshBuffer.cpp b/native/cocos/editor-support/MeshBuffer.cpp index 18ca15696a..8a1f0f484a 100644 --- a/native/cocos/editor-support/MeshBuffer.cpp +++ b/native/cocos/editor-support/MeshBuffer.cpp @@ -34,9 +34,9 @@ MIDDLEWARE_BEGIN MeshBuffer::MeshBuffer(int vertexFormat) : _vertexFormat(vertexFormat) , _ib(INIT_INDEX_BUFFER_SIZE) -, _vb(MAX_VERTEX_BUFFER_SIZE * vertexFormat) +, _vb(MAX_VERTEX_BUFFER_SIZE * vertexFormat * sizeof(float)) { - _vb.setMaxSize(MAX_VERTEX_BUFFER_SIZE * _vertexFormat); + _vb.setMaxSize(MAX_VERTEX_BUFFER_SIZE * _vertexFormat * sizeof(float)); _vb.setFullCallback([this] { uploadVB(); diff --git a/native/cocos/editor-support/MeshBuffer.h b/native/cocos/editor-support/MeshBuffer.h index e75bbc5f85..bd8e0facd9 100644 --- a/native/cocos/editor-support/MeshBuffer.h +++ b/native/cocos/editor-support/MeshBuffer.h @@ -34,7 +34,7 @@ class MeshBuffer { public: MeshBuffer(int vertexFormat); - ~MeshBuffer(); + virtual ~MeshBuffer(); inline cocos2d::renderer::VertexBuffer* getGLVB() { diff --git a/native/cocos/editor-support/MiddlewareManager.cpp b/native/cocos/editor-support/MiddlewareManager.cpp index bd3df1896f..5f9aadeb44 100644 --- a/native/cocos/editor-support/MiddlewareManager.cpp +++ b/native/cocos/editor-support/MiddlewareManager.cpp @@ -24,6 +24,7 @@ #include "MiddlewareManager.h" #include "base/CCGLUtils.h" #include "scripting/js-bindings/jswrapper/SeApi.h" +#include MIDDLEWARE_BEGIN @@ -63,10 +64,10 @@ void MiddlewareManager::_clearRemoveList() for (std::size_t i = 0; i < _removeList.size(); i++) { auto editor = _removeList[i]; - auto it = _updateMap.find(editor); - if (it != _updateMap.end()) + auto it = std::find(_updateList.begin(), _updateList.end(), editor); + if (it != _updateList.end()) { - _updateMap.erase(it); + _updateList.erase(it); } } @@ -77,9 +78,9 @@ void MiddlewareManager::update(float dt) { isUpdating = true; - for (auto it = _updateMap.begin(); it != _updateMap.end(); it++) + for (auto it = _updateList.begin(); it != _updateList.end(); it++) { - auto editor = it->first; + auto editor = *it; if (_removeList.size() > 0) { auto removeIt = std::find(_removeList.begin(), _removeList.end(), editor); @@ -112,9 +113,9 @@ void MiddlewareManager::render(float dt) isRendering = true; - for (auto it = _updateMap.begin(); it != _updateMap.end(); it++) + for (auto it = _updateList.begin(); it != _updateList.end(); it++) { - auto editor = it->first; + auto editor = *it; if (_removeList.size() > 0) { auto removeIt = std::find(_removeList.begin(), _removeList.end(), editor); @@ -146,12 +147,17 @@ void MiddlewareManager::render(float dt) void MiddlewareManager::addTimer(IMiddleware* editor) { - auto it = std::find(_removeList.begin(), _removeList.end(), editor); - if (it != _removeList.end()) - { - _removeList.erase(it); + auto it0 = std::find(_updateList.begin(), _updateList.end(), editor); + if (it0 != _updateList.end()) { + return; } - _updateMap[editor] = true; + + auto it1 = std::find(_removeList.begin(), _removeList.end(), editor); + if (it1 != _removeList.end()) + { + _removeList.erase(it1); + } + _updateList.push_back(editor); } void MiddlewareManager::removeTimer(IMiddleware* editor) @@ -162,10 +168,10 @@ void MiddlewareManager::removeTimer(IMiddleware* editor) } else { - auto it = _updateMap.find(editor); - if (it != _updateMap.end()) + auto it = std::find(_updateList.begin(), _updateList.end(), editor); + if (it != _updateList.end()) { - _updateMap.erase(it); + _updateList.erase(it); } } } diff --git a/native/cocos/editor-support/MiddlewareManager.h b/native/cocos/editor-support/MiddlewareManager.h index 3be25b1cfe..4e661cf9b5 100644 --- a/native/cocos/editor-support/MiddlewareManager.h +++ b/native/cocos/editor-support/MiddlewareManager.h @@ -109,7 +109,7 @@ private: void _clearRemoveList(); private: - std::map _updateMap; + std::vector _updateList; std::vector _removeList; std::map _mbMap; diff --git a/native/cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp new file mode 100644 index 0000000000..aeba95b711 --- /dev/null +++ b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp @@ -0,0 +1,447 @@ +/** +* The MIT License (MIT) +* +* Copyright (c) 2012-2018 DragonBones team and other contributors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to +* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +* the Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "ArmatureCache.h" +#include "CCFactory.h" +#include "base/ccTypes.h" +#include "renderer/gfx/Texture.h" + +USING_NS_CC; +USING_NS_MW; +using namespace cocos2d::renderer; + +DRAGONBONES_NAMESPACE_BEGIN + +float ArmatureCache::FrameTime = 1.0f / 60.0f; +float ArmatureCache::MaxCacheTime = 120.0f; + +ArmatureCache::SegmentData::SegmentData() +{ + +} + +ArmatureCache::SegmentData::~SegmentData() +{ + CC_SAFE_RELEASE_NULL(_texture); +} + +void ArmatureCache::SegmentData::setTexture(cocos2d::middleware::Texture2D* value) +{ + CC_SAFE_RETAIN(value); + CC_SAFE_RELEASE(_texture); + _texture = value; +} + +cocos2d::middleware::Texture2D* ArmatureCache::SegmentData::getTexture() const +{ + return _texture; +} + +ArmatureCache::FrameData::FrameData() +{ + +} + +ArmatureCache::FrameData::~FrameData() +{ + for (std::size_t i = 0, c = _colors.size(); i < c; i++) + { + delete _colors[i]; + } + _colors.clear(); + + for (std::size_t i = 0, c = _segments.size(); i < c; i++) + { + delete _segments[i]; + } + _segments.clear(); +} + +ArmatureCache::ColorData* ArmatureCache::FrameData::buildColorData(std::size_t index) +{ + if (index > _colors.size()) return nullptr; + if (index == _colors.size()) { + ColorData* colorData = new ColorData; + _colors.push_back(colorData); + } + return _colors[index]; +} + +std::size_t ArmatureCache::FrameData::getColorCount() const +{ + return _colors.size(); +} + +ArmatureCache::SegmentData* ArmatureCache::FrameData::buildSegmentData(std::size_t index) +{ + if (index > _segments.size()) return nullptr; + if (index == _segments.size()) + { + SegmentData* segmentData = new SegmentData; + _segments.push_back(segmentData); + } + return _segments[index]; +} + +std::size_t ArmatureCache::FrameData::getSegmentCount() const +{ + return _segments.size(); +} + +ArmatureCache::AnimationData::AnimationData() +{ + +} + +ArmatureCache::AnimationData::~AnimationData() +{ + reset(); +} + +void ArmatureCache::AnimationData::reset() +{ + for (std::size_t i = 0, c = _frames.size(); i < c; i++) + { + delete _frames[i]; + } + _frames.clear(); + _isComplete = false; + _totalTime = 0.0f; +} + +bool ArmatureCache::AnimationData::needUpdate(int toFrameIdx) const +{ + return !_isComplete && _totalTime <= MaxCacheTime && (toFrameIdx == -1 || _frames.size() < toFrameIdx + 1); +} + +ArmatureCache::FrameData* ArmatureCache::AnimationData::buildFrameData(std::size_t frameIdx) +{ + if (frameIdx > _frames.size()) + { + return nullptr; + } + if (frameIdx == _frames.size()) + { + auto frameData = new FrameData(); + _frames.push_back(frameData); + } + return _frames[frameIdx]; +} + +ArmatureCache::FrameData* ArmatureCache::AnimationData::getFrameData(std::size_t frameIdx) const +{ + if (frameIdx >= _frames.size()) + { + return nullptr; + } + return _frames[frameIdx]; +} + +std::size_t ArmatureCache::AnimationData::getFrameCount() const +{ + return _frames.size(); +} + +ArmatureCache::ArmatureCache(const std::string& armatureName, const std::string& armatureKey, const std::string& atlasUUID) +{ + _armatureDisplay = dragonBones::CCFactory::getFactory()->buildArmatureDisplay(armatureName, armatureKey, "", atlasUUID); + if (_armatureDisplay) + { + _armatureDisplay->retain(); + } +} + +ArmatureCache::~ArmatureCache() +{ + if (_armatureDisplay) + { + _armatureDisplay->release(); + _armatureDisplay = nullptr; + } + + for (auto it = _animationCaches.begin(); it != _animationCaches.end(); it++) + { + delete it->second; + } + _animationCaches.clear(); +} + +ArmatureCache::AnimationData* ArmatureCache::buildAnimationData(const std::string& animationName) +{ + if (!_armatureDisplay) return nullptr; + + AnimationData* aniData = nullptr; + auto it = _animationCaches.find(animationName); + if (it == _animationCaches.end()) + { + auto armature = _armatureDisplay->getArmature(); + auto animation = armature->getAnimation(); + auto hasAni = animation->hasAnimation(animationName); + if (!hasAni) return nullptr; + + aniData = new AnimationData(); + aniData->_animationName = animationName; + _animationCaches[animationName] = aniData; + } + else + { + aniData = it->second; + } + return aniData; +} + +ArmatureCache::AnimationData* ArmatureCache::getAnimationData(const std::string& animationName) +{ + auto it = _animationCaches.find(animationName); + if (it == _animationCaches.end()) + { + return nullptr; + } + else + { + return it->second; + } +} + +void ArmatureCache::updateToFrame(const std::string& animationName, int toFrameIdx/*= -1*/) +{ + auto it = _animationCaches.find(animationName); + if (it == _animationCaches.end()) + { + return; + } + + AnimationData* animationData = it->second; + if (!animationData || !animationData->needUpdate(toFrameIdx)) + { + return; + } + + if (_curAnimationName != animationName) + { + updateToFrame(_curAnimationName); + _curAnimationName = animationName; + } + + auto armature = _armatureDisplay->getArmature(); + auto animation = armature->getAnimation(); + + // init animation + if (animationData->getFrameCount() == 0) + { + animation->play(animationName, 1); + } + + do { + armature->advanceTime(FrameTime); + renderAnimationFrame(animationData); + animationData->_totalTime += FrameTime; + if (animation->isCompleted()) + { + animationData->_isComplete = true; + } + } while (animationData->needUpdate(toFrameIdx)); +} + +void ArmatureCache::renderAnimationFrame(AnimationData* animationData) +{ + std::size_t frameIndex = animationData->getFrameCount(); + _frameData = animationData->buildFrameData(frameIndex); + + _preColor = Color4F(-1.0f, -1.0f, -1.0f, -1.0f); + _color = Color4F(1.0f, 1.0f, 1.0f, 1.0f); + + _preBlendMode = -1; + _preTextureIndex = -1; + _curTextureIndex = -1; + _preISegWritePos = -1; + _curISegLen = 0; + _curVSegLen = 0; + _materialLen = 0; + + auto armature = _armatureDisplay->getArmature(); + traverseArmature(armature); + + if (_preISegWritePos != -1) + { + SegmentData* preSegmentData = _frameData->buildSegmentData(_materialLen - 1); + preSegmentData->indexCount = _curISegLen; + preSegmentData->vertexFloatCount = _curVSegLen; + } + + auto colorCount = _frameData->getColorCount(); + if (colorCount > 0) + { + ColorData* preColorData = _frameData->buildColorData(colorCount - 1); + preColorData->vertexFloatOffset = (int)_frameData->vb.getCurPos() / sizeof(float); + } + + _frameData = nullptr; +} + +void ArmatureCache::traverseArmature(Armature* armature, float parentOpacity/*= 1.0f*/) +{ + middleware::IOBuffer& vb = _frameData->vb; + middleware::IOBuffer& ib = _frameData->ib; + + auto& slots = armature->getSlots(); + CCSlot* slot = nullptr; + // range [0.0, 1.0] + Color4F preColor(-1.0f, -1.0f, -1.0f, -1.0f); + Color4F color; + middleware::Texture2D* texture = nullptr; + + auto flush = [&]() + { + // fill pre segment count field + if (_preISegWritePos != -1) + { + SegmentData* preSegmentData = _frameData->buildSegmentData(_materialLen - 1); + preSegmentData->indexCount = _curISegLen; + preSegmentData->vertexFloatCount = _curVSegLen; + } + + SegmentData* segmentData = _frameData->buildSegmentData(_materialLen); + segmentData->setTexture(texture); + segmentData->blendMode = (int)(slot->_blendMode); + + // save new segment count pos field + _preISegWritePos = (int)ib.getCurPos() / sizeof(unsigned short); + // reset pre blend mode to current + _preBlendMode = (int)slot->_blendMode; + // reset pre texture index to current + _preTextureIndex = _curTextureIndex; + // reset index segmentation count + _curISegLen = 0; + // reset vertex segmentation count + _curVSegLen = 0; + // material length increased + _materialLen++; + }; + + for (std::size_t i = 0, len = slots.size(); i < len; i++) + { + slot = (CCSlot*)slots[i]; + if (!slot->getVisible()) + { + continue; + } + slot->updateWorldMatrix(); + + // If slots has child armature,will traverse child first. + Armature* childArmature = slot->getChildArmature(); + if (childArmature != nullptr) + { + traverseArmature(childArmature, parentOpacity * slot->color.a / 255.0f); + continue; + } + + texture = slot->getTexture(); + if (!texture) continue; + _curTextureIndex = texture->getNativeTexture()->getHandle(); + + auto vbSize = slot->triangles.vertCount * sizeof(middleware::V2F_T2F_C4B); + vb.checkSpace(vbSize, true); + + // If texture or blendMode change,will change material. + if (_preTextureIndex != _curTextureIndex || _preBlendMode != (int)slot->_blendMode) + { + flush(); + } + + // Calculation vertex color. + color.a = slot->color.a * parentOpacity; + color.r = slot->color.r; + color.g = slot->color.g; + color.b = slot->color.b; + + if (preColor != color) { + preColor = color; + auto colorCount = _frameData->getColorCount(); + if (colorCount > 0) { + ColorData* preColorData = _frameData->buildColorData(colorCount - 1); + preColorData->vertexFloatOffset = vb.getCurPos() / sizeof(float); + } + ColorData* colorData = _frameData->buildColorData(colorCount); + colorData->color = color; + } + + // Transform component matrix to global matrix + middleware::Triangles& triangles = slot->triangles; + cocos2d::Mat4* worldMatrix = &slot->worldMatrix; + middleware::V2F_T2F_C4B* worldTriangles = slot->worldVerts; + + for (int v = 0, w = 0, vn = triangles.vertCount; v < vn; ++v, w += 2) + { + middleware::V2F_T2F_C4B* vertex = triangles.verts + v; + middleware::V2F_T2F_C4B* worldVertex = worldTriangles + v; + worldVertex->vertex.x = vertex->vertex.x * worldMatrix->m[0] + vertex->vertex.y * worldMatrix->m[4] + worldMatrix->m[12]; + worldVertex->vertex.y = vertex->vertex.x * worldMatrix->m[1] + vertex->vertex.y * worldMatrix->m[5] + worldMatrix->m[13]; + + worldVertex->color.r = (GLubyte)color.r; + worldVertex->color.g = (GLubyte)color.g; + worldVertex->color.b = (GLubyte)color.b; + worldVertex->color.a = (GLubyte)color.a; + } + + vb.writeBytes((char*)worldTriangles, vbSize); + + auto ibSize = triangles.indexCount * sizeof(unsigned short); + ib.checkSpace(ibSize, true); + + auto vertexOffset = _curVSegLen / 5; + for (int ii = 0, nn = triangles.indexCount; ii < nn; ii++) + { + ib.writeUint16(triangles.indices[ii] + vertexOffset); + } + + _curISegLen += triangles.indexCount; + _curVSegLen += vbSize / sizeof(float); + } // End slot traverse +} + +void ArmatureCache::resetAllAnimationData() +{ + for (auto it = _animationCaches.begin(); it != _animationCaches.end(); it++) + { + it->second->reset(); + } +} + +void ArmatureCache::resetAnimationData(const std::string& animationName) { + for (auto it = _animationCaches.begin(); it != _animationCaches.end(); it++) + { + if (it->second->_animationName == animationName) + { + it->second->reset(); + break; + } + } +} + +CCArmatureDisplay* ArmatureCache::getArmatureDisplay() +{ + return _armatureDisplay; +} + +DRAGONBONES_NAMESPACE_END diff --git a/native/cocos/editor-support/dragonbones-creator-support/ArmatureCache.h b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCache.h new file mode 100644 index 0000000000..de18c3f79d --- /dev/null +++ b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCache.h @@ -0,0 +1,141 @@ +/** +* The MIT License (MIT) +* +* Copyright (c) 2012-2018 DragonBones team and other contributors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to +* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +* the Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#pragma once + +#include "IOBuffer.h" +#include "CCArmatureDisplay.h" + +DRAGONBONES_NAMESPACE_BEGIN + +class ArmatureCache : public cocos2d::Ref { +public: + struct SegmentData { + friend class ArmatureCache; + + SegmentData(); + ~SegmentData(); + + void setTexture(cocos2d::middleware::Texture2D* value); + cocos2d::middleware::Texture2D* getTexture() const; + public: + int blendMode = 0; + std::size_t indexCount = 0; + std::size_t vertexFloatCount = 0; + private: + cocos2d::middleware::Texture2D* _texture = nullptr; + }; + + struct ColorData { + cocos2d::Color4F color; + std::size_t vertexFloatOffset = 0; + }; + + struct FrameData { + friend class ArmatureCache; + + FrameData(); + ~FrameData(); + + const std::vector& getColors() const + { + return _colors; + } + std::size_t getColorCount() const; + + const std::vector& getSegments() const + { + return _segments; + } + std::size_t getSegmentCount() const; + private: + // if segment data is empty, it will build new one. + SegmentData* buildSegmentData(std::size_t index); + // if color data is empty, it will build new one. + ColorData* buildColorData(std::size_t index); + + std::vector _colors; + std::vector _segments; + public: + cocos2d::middleware::IOBuffer ib; + cocos2d::middleware::IOBuffer vb; + }; + + struct AnimationData { + friend class ArmatureCache; + + AnimationData(); + ~AnimationData(); + void reset(); + + FrameData* getFrameData(std::size_t frameIdx) const; + std::size_t getFrameCount() const; + + bool isComplete() const { return _isComplete; } + bool needUpdate(int toFrameIdx) const; + private: + // if frame is empty, it will build new one. + FrameData* buildFrameData(std::size_t frameIdx); + private: + std::string _animationName = ""; + bool _isComplete = false; + float _totalTime = 0.0f; + std::vector _frames; + }; + + ArmatureCache(const std::string& armatureName, const std::string& armatureKey, const std::string& atlasUUID); + virtual ~ArmatureCache(); + + void updateToFrame(const std::string& animationName, int toFrameIdx = -1); + // if animation data is empty, it will build new one. + AnimationData* buildAnimationData(const std::string& animationName); + AnimationData* getAnimationData(const std::string& animationName); + CCArmatureDisplay* getArmatureDisplay(); + + void resetAllAnimationData(); + void resetAnimationData(const std::string& animationName); +private: + void renderAnimationFrame(AnimationData* animationData); + void traverseArmature(Armature* armature, float parentOpacity = 1.0f); +public: + static float FrameTime; + static float MaxCacheTime; +private: + FrameData* _frameData = nullptr; + cocos2d::Color4F _preColor = cocos2d::Color4F(-1.0f, -1.0f, -1.0f, -1.0f); + cocos2d::Color4F _color = cocos2d::Color4F(1.0f, 1.0f, 1.0f, 1.0f); + CCArmatureDisplay* _armatureDisplay = nullptr; + int _preBlendMode = -1; + GLuint _preTextureIndex = -1; + GLuint _curTextureIndex = -1; + int _preISegWritePos = -1; + int _curISegLen = 0; + int _curVSegLen = 0; + int _materialLen = 0; + cocos2d::renderer::BlendFactor _curBlendSrc; + cocos2d::renderer::BlendFactor _curBlendDst; + std::string _curAnimationName = ""; + std::map _animationCaches; +}; + +DRAGONBONES_NAMESPACE_END diff --git a/native/cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp new file mode 100644 index 0000000000..9812169ffb --- /dev/null +++ b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp @@ -0,0 +1,57 @@ +/** +* The MIT License (MIT) +* +* Copyright (c) 2012-2018 DragonBones team and other contributors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to +* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +* the Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "ArmatureCacheMgr.h" + +DRAGONBONES_NAMESPACE_BEGIN + +ArmatureCacheMgr* ArmatureCacheMgr::_instance = nullptr; +ArmatureCache* ArmatureCacheMgr::buildArmatureCache(const std::string& armatureName, const std::string& armatureKey, const std::string& atlasUUID) +{ + ArmatureCache* animation = _caches.at(armatureKey); + if (!animation) + { + animation = new ArmatureCache(armatureName, armatureKey, atlasUUID); + _caches.insert(armatureKey, animation); + animation->autorelease(); + } + return animation; +} + +void ArmatureCacheMgr::removeArmatureCache(const std::string& uuid) +{ + for (auto it = _caches.begin(); it != _caches.end();) + { + auto found = it->first.find(uuid); + if (found != std::string::npos) + { + it = _caches.erase(it); + } + else + { + it++; + } + } +} + +DRAGONBONES_NAMESPACE_END \ No newline at end of file diff --git a/native/cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h new file mode 100644 index 0000000000..b8e7a4cc79 --- /dev/null +++ b/native/cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h @@ -0,0 +1,57 @@ +/** +* The MIT License (MIT) +* +* Copyright (c) 2012-2018 DragonBones team and other contributors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to +* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +* the Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#pragma once +#include "dragonbones/DragonBonesHeaders.h" +#include "ArmatureCache.h" +#include "base/CCMap.h" + +DRAGONBONES_NAMESPACE_BEGIN + +class ArmatureCacheMgr { +public: + static ArmatureCacheMgr* getInstance() + { + if (_instance == nullptr) + { + _instance = new ArmatureCacheMgr(); + } + return _instance; + } + + static void destroyInstance() + { + if (_instance) { + delete _instance; + _instance = nullptr; + } + } + + void removeArmatureCache(const std::string& armatureKey); + ArmatureCache* buildArmatureCache(const std::string& armatureName, const std::string& armatureKey, const std::string& atlasUUID); +private: + static ArmatureCacheMgr* _instance; + cocos2d::Map _caches; +}; + +DRAGONBONES_NAMESPACE_END \ No newline at end of file diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp new file mode 100644 index 0000000000..1076324f36 --- /dev/null +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp @@ -0,0 +1,429 @@ +/** +* The MIT License (MIT) +* +* Copyright (c) 2012-2018 DragonBones team and other contributors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to +* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +* the Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "CCArmatureCacheDisplay.h" +#include "MiddlewareManager.h" +#include "ArmatureCacheMgr.h" +#include "CCFactory.h" +#include "renderer/gfx/Texture.h" + +USING_NS_CC; +USING_NS_MW; +using namespace cocos2d::renderer; +static const std::string techStage = "opaque"; +static const std::string textureKey = "texture"; +static const std::string startEvent = "start"; +static const std::string loopCompleteEvent = "loopComplete"; +static const std::string completeEvent = "complete"; + +DRAGONBONES_NAMESPACE_BEGIN + +CCArmatureCacheDisplay::CCArmatureCacheDisplay(const std::string & armatureName, const std::string & armatureKey, const std::string & atlasUUID, bool isShare) +{ + _eventObject = BaseObject::borrowObject(); + + if (isShare) + { + _armatureCache = ArmatureCacheMgr::getInstance()->buildArmatureCache(armatureName, armatureKey, atlasUUID); + _armatureCache->retain(); + } + else + { + _armatureCache = new ArmatureCache(armatureName, armatureKey, atlasUUID); + _armatureCache->retain(); + _armatureCache->autorelease(); + } + beginSchedule(); +} + +CCArmatureCacheDisplay::~CCArmatureCacheDisplay () +{ + dispose(); +} + +void CCArmatureCacheDisplay::dispose() +{ + if (_armatureCache) + { + _armatureCache->release(); + _armatureCache = nullptr; + } + if (_eventObject) + { + _eventObject->returnToPool(); + _eventObject = nullptr; + } + CC_SAFE_RELEASE_NULL(_nodeProxy); + CC_SAFE_RELEASE_NULL(_effect); + stopSchedule(); +} + +void CCArmatureCacheDisplay::update(float dt) +{ + auto gTimeScale = dragonBones::CCFactory::getFactory()->getTimeScale(); + dt *= _timeScale * gTimeScale; + + if (_isAniComplete || !_animationData) + { + if (_animationData && !_animationData->isComplete()) + { + _armatureCache->updateToFrame(_animationName); + } + return; + } + + if (_accTime <= 0.00001 && _playCount == 0) + { + _eventObject->type = EventObject::START; + dispatchDBEvent(startEvent, _eventObject); + } + + _accTime += dt; + int frameIdx = floor(_accTime / ArmatureCache::FrameTime); + if (!_animationData->isComplete()) + { + _armatureCache->updateToFrame(_animationName, frameIdx); + } + + int finalFrameIndex = (int)_animationData->getFrameCount() - 1; + if (_animationData->isComplete() && frameIdx >= finalFrameIndex) + { + _playCount++; + _accTime = 0.0f; + if (_playTimes > 0 && _playCount >= _playTimes) + { + frameIdx = finalFrameIndex; + _playCount = 0; + _isAniComplete = true; + } + else + { + frameIdx = 0; + } + + _eventObject->type = EventObject::COMPLETE; + dispatchDBEvent(completeEvent, _eventObject); + + _eventObject->type = EventObject::LOOP_COMPLETE; + dispatchDBEvent(loopCompleteEvent, _eventObject); + } + _curFrameIndex = frameIdx; +} + +void CCArmatureCacheDisplay::render(float dt) +{ + if (_nodeProxy == nullptr) + { + return; + } + + CustomAssembler* assembler = (CustomAssembler*)_nodeProxy->getAssembler(); + if (assembler == nullptr) + { + return; + } + assembler->reset(); + assembler->setUseModel(!_batch); + + if (!_animationData) return; + ArmatureCache::FrameData* frameData = _animationData->getFrameData(_curFrameIndex); + if (!frameData) return; + + auto mgr = MiddlewareManager::getInstance(); + if (!mgr->isRendering) return; + + _nodeColor.a = _nodeProxy->getRealOpacity() / (float)255; + + middleware::MeshBuffer* mb = mgr->getMeshBuffer(VF_XYUVC); + middleware::IOBuffer& vb = mb->getVB(); + middleware::IOBuffer& ib = mb->getIB(); + const auto& srcVB = frameData->vb; + const auto& srcIB = frameData->ib; + + const cocos2d::Mat4& nodeWorldMat = _nodeProxy->getWorldMatrix(); + auto& segments = frameData->getSegments(); + auto& colors = frameData->getColors(); + + int colorOffset = 0; + ArmatureCache::ColorData* nowColor = colors[colorOffset++]; + auto maxVFOffset = nowColor->vertexFloatOffset; + + Color4B color; + float tempR = 0.0f, tempG = 0.0f, tempB = 0.0f; + float multiplier = 1.0f; + std::size_t srcVertexBytesOffset = 0; + std::size_t srcIndexBytesOffset = 0; + std::size_t vertexBytes = 0; + std::size_t indexBytes = 0; + GLuint textureHandle = 0; + double effectHash = 0; + BlendMode blendMode = BlendMode::Normal; + std::size_t dstVertexOffset = 0; + float* dstVertexBuffer = nullptr; + unsigned int* dstColorBuffer = nullptr; + unsigned short* dstIndexBuffer = nullptr; + bool needColor = false; + BlendFactor curBlendSrc = BlendFactor::ONE; + BlendFactor curBlendDst = BlendFactor::ZERO; + + if (abs(_nodeColor.r - 1.0f) > 0.0001f || + abs(_nodeColor.g - 1.0f) > 0.0001f || + abs(_nodeColor.b - 1.0f) > 0.0001f || + abs(_nodeColor.a - 1.0f) > 0.0001f || + _premultipliedAlpha) { + needColor = true; + } + + auto handleColor = [&](ArmatureCache::ColorData* colorData) + { + color.a = (GLubyte)(colorData->color.a * _nodeColor.a); + multiplier = _premultipliedAlpha ? color.a / 255 : 1; + tempR = _nodeColor.r * multiplier; + tempG = _nodeColor.g * multiplier; + tempB = _nodeColor.b * multiplier; + + color.r = (GLubyte)(colorData->color.r * tempR); + color.g = (GLubyte)(colorData->color.g * tempG); + color.b = (GLubyte)(colorData->color.b * tempB); + }; + + handleColor(nowColor); + + for (std::size_t segIndex = 0, segLen = segments.size(); segIndex < segLen; segIndex++) + { + auto segment = segments[segIndex]; + vertexBytes = segment->vertexFloatCount * sizeof(float); + + // fill vertex buffer + vb.checkSpace(vertexBytes, true); + dstVertexOffset = vb.getCurPos() / sizeof(V2F_T2F_C4B); + dstVertexBuffer = (float*)vb.getCurBuffer(); + dstColorBuffer = (unsigned int*)vb.getCurBuffer(); + vb.writeBytes((char*)srcVB.getBuffer() + srcVertexBytesOffset, vertexBytes); + + // batch handle + if (_batch) + { + cocos2d::Vec3* point = nullptr; + float tempZ = 0.0f; + for (auto posIndex = 0; posIndex < segment->vertexFloatCount; posIndex += 5) + { + point = (cocos2d::Vec3*)(dstVertexBuffer + posIndex); + tempZ = point->z; + point->z = 0; + nodeWorldMat.transformPoint(point); + point->z = tempZ; + } + } + + // handle vertex color + if (needColor) + { + auto frameFloatOffset = srcVertexBytesOffset / sizeof(float); + for (auto colorIndex = 0; colorIndex < segment->vertexFloatCount; colorIndex += 5) + { + if (frameFloatOffset >= maxVFOffset) + { + nowColor = colors[colorOffset++]; + handleColor(nowColor); + maxVFOffset = nowColor->vertexFloatOffset; + } + memcpy(dstColorBuffer + colorIndex + 4, &color, sizeof(color)); + } + } + + // move src vertex buffer offset + srcVertexBytesOffset += vertexBytes; + + // fill index buffer + indexBytes = segment->indexCount * sizeof(unsigned short); + ib.checkSpace(indexBytes, true); + assembler->updateIARange(segIndex, (int)ib.getCurPos() / sizeof(unsigned short), (int)segment->indexCount); + dstIndexBuffer = (unsigned short*)ib.getCurBuffer(); + ib.writeBytes((char*)srcIB.getBuffer() + srcIndexBytesOffset, indexBytes); + for (auto indexPos = 0; indexPos < segment->indexCount; indexPos++) + { + dstIndexBuffer[indexPos] += dstVertexOffset; + } + srcIndexBytesOffset += indexBytes; + + // set assembler glvb and glib + assembler->updateIABuffer(segIndex, mb->getGLVB(), mb->getGLIB()); + + // handle material + textureHandle = segment->getTexture()->getNativeTexture()->getHandle(); + blendMode = (BlendMode)segment->blendMode; + + effectHash = textureHandle + ((uint8_t)blendMode << 16) + ((uint8_t)_batch << 24); + Effect* renderEffect = assembler->getEffect(segIndex); + Technique::Parameter* param = nullptr; + Pass* pass = nullptr; + + if (renderEffect) + { + double renderHash = renderEffect->getHash(); + if (abs(renderHash - effectHash) >= 0.01) + { + param = (Technique::Parameter*)&(renderEffect->getProperty(textureKey)); + Technique* tech = renderEffect->getTechnique(techStage); + cocos2d::Vector& passes = (cocos2d::Vector&)tech->getPasses(); + pass = *(passes.begin()); + } + } + else + { + if (_effect == nullptr) + { + cocos2d::log("ArmatureCacheAnimation:update get effect failed"); + assembler->reset(); + return; + } + auto effect = new cocos2d::renderer::Effect(); + effect->autorelease(); + effect->copy(_effect); + + Technique* tech = effect->getTechnique(techStage); + cocos2d::Vector& passes = (cocos2d::Vector&)tech->getPasses(); + pass = *(passes.begin()); + + assembler->updateEffect(segIndex, effect); + renderEffect = effect; + param = (Technique::Parameter*)&(renderEffect->getProperty(textureKey)); + } + + if (param) + { + param->setTexture(segment->getTexture()->getNativeTexture()); + } + + switch (blendMode) + { + case BlendMode::Add: + curBlendSrc = _premultipliedAlpha ? BlendFactor::ONE : BlendFactor::SRC_ALPHA; + curBlendDst = BlendFactor::ONE; + break; + case BlendMode::Multiply: + curBlendSrc = BlendFactor::DST_COLOR; + curBlendDst = BlendFactor::ONE_MINUS_SRC_ALPHA; + break; + case BlendMode::Screen: + curBlendSrc = BlendFactor::ONE; + curBlendDst = BlendFactor::ONE_MINUS_SRC_COLOR; + break; + default: + curBlendSrc = _premultipliedAlpha ? BlendFactor::ONE : BlendFactor::SRC_ALPHA; + curBlendDst = BlendFactor::ONE_MINUS_SRC_ALPHA; + break; + } + + if (pass) { + pass->setBlend(BlendOp::ADD, curBlendSrc, curBlendDst, + BlendOp::ADD, curBlendSrc, curBlendDst); + } + + renderEffect->updateHash(effectHash); + } +} + +void CCArmatureCacheDisplay::beginSchedule() +{ + MiddlewareManager::getInstance()->addTimer(this); +} + +void CCArmatureCacheDisplay::stopSchedule() +{ + MiddlewareManager::getInstance()->removeTimer(this); +} + +void CCArmatureCacheDisplay::onEnable() +{ + beginSchedule(); +} + +void CCArmatureCacheDisplay::onDisable() +{ + stopSchedule(); +} + +Armature* CCArmatureCacheDisplay::getArmature() const +{ + auto armatureDisplay = _armatureCache->getArmatureDisplay(); + return armatureDisplay->getArmature(); +} + +Animation* CCArmatureCacheDisplay::getAnimation() const +{ + auto armature = getArmature(); + return armature->getAnimation(); +} + +void CCArmatureCacheDisplay::playAnimation(const std::string& name, int playTimes) +{ + _playTimes = playTimes; + _animationName = name; + _animationData = _armatureCache->buildAnimationData(_animationName); + _isAniComplete = false; + _accTime = 0.0f; + _playCount = 0; + _curFrameIndex = 0; +} + +void CCArmatureCacheDisplay::addDBEventListener(const std::string& type) +{ + _listenerIDMap[type] = true; +} + +void CCArmatureCacheDisplay::removeDBEventListener(const std::string& type) +{ + auto it = _listenerIDMap.find(type); + if (it != _listenerIDMap.end()) + { + _listenerIDMap.erase(it); + } +} + +void CCArmatureCacheDisplay::dispatchDBEvent(const std::string& type, EventObject* value) +{ + auto it = _listenerIDMap.find(type); + if (it == _listenerIDMap.end()) + { + return; + } + + if (_dbEventCallback) + { + _dbEventCallback(value); + } +} + +void CCArmatureCacheDisplay::updateAnimationCache (const std::string& animationName) +{ + _armatureCache->resetAnimationData(animationName); +} + +void CCArmatureCacheDisplay::updateAllAnimationCache () +{ + _armatureCache->resetAllAnimationData(); +} + +DRAGONBONES_NAMESPACE_END diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h new file mode 100644 index 0000000000..a724a41007 --- /dev/null +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h @@ -0,0 +1,131 @@ +/** +* The MIT License (MIT) +* +* Copyright (c) 2012-2018 DragonBones team and other contributors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of +* this software and associated documentation files (the "Software"), to deal in +* the Software without restriction, including without limitation the rights to +* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +* the Software, and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#pragma once + +#include "dragonbones/DragonBonesHeaders.h" +#include "base/CCRef.h" +#include "renderer/scene/NodeProxy.hpp" +#include "renderer/scene/assembler/CustomAssembler.hpp" +#include "CCArmatureDisplay.h" +#include "ArmatureCache.h" + +DRAGONBONES_NAMESPACE_BEGIN +class CCArmatureCacheDisplay : public cocos2d::middleware::IMiddleware, public cocos2d::Ref +{ +public: + CCArmatureCacheDisplay(const std::string& armatureName, const std::string& armatureKey, const std::string& atlasUUID, bool isShare); + virtual ~CCArmatureCacheDisplay(); + void dispose(); + + virtual void update(float dt) override; + virtual void render(float dt) override; + + void setTimeScale(float scale) + { + _timeScale = scale; + } + + float getTimeScale() const + { + return _timeScale; + } + + void beginSchedule(); + void stopSchedule(); + void onEnable(); + void onDisable(); + + Armature* getArmature() const; + Animation* getAnimation() const; + + void bindNodeProxy(cocos2d::renderer::NodeProxy* node) + { + CC_SAFE_RELEASE(_nodeProxy); + _nodeProxy = node; + CC_SAFE_RETAIN(_nodeProxy); + } + + void setEffect(cocos2d::renderer::Effect* effect) + { + if (effect == _effect) return; + CC_SAFE_RELEASE(_effect); + _effect = effect; + CC_SAFE_RETAIN(_effect); + } + + void setColor(cocos2d::Color4B& color) + { + _nodeColor.r = color.r / 255.0f; + _nodeColor.g = color.g / 255.0f; + _nodeColor.b = color.b / 255.0f; + _nodeColor.a = color.a / 255.0f; + } + + void setBatchEnabled(bool enabled) + { + _batch = enabled; + } + + void setOpacityModifyRGB(bool value) + { + _premultipliedAlpha = value; + } + + typedef std::function dbEventCallback; + void setDBEventCallback(dbEventCallback callback) + { + _dbEventCallback = callback; + } + void addDBEventListener(const std::string& type); + void removeDBEventListener(const std::string& type); + void dispatchDBEvent(const std::string& type, EventObject* value); + + void playAnimation(const std::string& name, int playTimes); + void updateAnimationCache (const std::string& animationName); + void updateAllAnimationCache (); +private: + float _timeScale = 1; + int _curFrameIndex = -1; + float _accTime = 0.0f; + int _playCount = 0; + int _playTimes = 0; + bool _isAniComplete = true; + std::string _animationName = ""; + + Armature* _armature = nullptr; + ArmatureCache::AnimationData* _animationData = nullptr; + std::map _listenerIDMap; + cocos2d::Color4F _nodeColor = cocos2d::Color4F::WHITE; + + bool _batch = false; + bool _premultipliedAlpha = false; + dbEventCallback _dbEventCallback = nullptr; + cocos2d::renderer::NodeProxy* _nodeProxy = nullptr; + cocos2d::renderer::Effect* _effect = nullptr; + cocos2d::renderer::CustomAssembler* _assembler = nullptr; + ArmatureCache* _armatureCache = nullptr; + EventObject* _eventObject; +}; + +DRAGONBONES_NAMESPACE_END diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp index 272aabc431..6235ee72f6 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp @@ -25,6 +25,7 @@ #include "MiddlewareMacro.h" #include "renderer/renderer/Pass.h" #include "renderer/renderer/Technique.h" +#include "renderer/gfx/Texture.h" USING_NS_CC; USING_NS_MW; @@ -32,7 +33,6 @@ using namespace cocos2d::renderer; static const std::string techStage = "opaque"; static const std::string textureKey = "texture"; -static const uint8_t moduleID = MiddlewareManager::generateModuleID(); DRAGONBONES_NAMESPACE_BEGIN @@ -93,12 +93,6 @@ void CCArmatureDisplay::dbUpdate() {} void CCArmatureDisplay::dbRender() { - if (this->_armature->getParent()) - return; - - auto mgr = MiddlewareManager::getInstance(); - if (!mgr->isRendering) return; - if (_nodeProxy == nullptr) { return; @@ -112,6 +106,12 @@ void CCArmatureDisplay::dbRender() _assembler->reset(); _assembler->setUseModel(!_batch); + if (this->_armature->getParent()) + return; + + auto mgr = MiddlewareManager::getInstance(); + if (!mgr->isRendering) return; + _preBlendMode = -1; _preTextureIndex = -1; _curTextureIndex = -1; @@ -141,7 +141,7 @@ void CCArmatureDisplay::dbRender() auto& bones = _armature->getBones(); std::size_t count = bones.size(); - _debugBuffer->writeFloat32(count*4); + _debugBuffer->writeFloat32(count * 4); for (int i = 0; i < count; i++) { Bone* bone = (Bone*)bones[i]; @@ -216,6 +216,7 @@ void CCArmatureDisplay::traverseArmature(Armature* armature, float parentOpacity IOBuffer& ib = mb->getIB(); float realOpacity = _nodeProxy->getRealOpacity() / 255.0f; + // range [0.0, 255.0] float r, g, b, a; CCSlot* slot = nullptr; middleware::Texture2D* texture = nullptr; @@ -250,7 +251,7 @@ void CCArmatureDisplay::traverseArmature(Armature* armature, float parentOpacity break; } - double curHash = _curTextureIndex + (moduleID << 16) + ((uint8_t)slot->_blendMode << 24); + double curHash = _curTextureIndex + ((uint8_t)slot->_blendMode << 16) + ((uint8_t)_batch << 24); Effect* renderEffect = _assembler->getEffect(_materialLen); Technique::Parameter* param = nullptr; @@ -337,7 +338,7 @@ void CCArmatureDisplay::traverseArmature(Armature* armature, float parentOpacity texture = slot->getTexture(); if (!texture) continue; - _curTextureIndex = texture->getRealTextureIndex(); + _curTextureIndex = texture->getNativeTexture()->getHandle(); auto vbSize = slot->triangles.vertCount * sizeof(middleware::V2F_T2F_C4B); isFull |= vb.checkSpace(vbSize, true); @@ -415,12 +416,12 @@ void CCArmatureDisplay::addDBEventListener(const std::string& type, const std::f void CCArmatureDisplay::dispatchDBEvent(const std::string& type, EventObject* value) { - auto it = _listenerIDMap.find(type); - if (it == _listenerIDMap.end()) - { - return; - } - + auto it = _listenerIDMap.find(type); + if (it == _listenerIDMap.end()) + { + return; + } + if (_dbEventCallback) { _dbEventCallback(value); diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h index e41c21c3c8..b81da1aac8 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h @@ -101,6 +101,13 @@ public: * @inheritDoc */ virtual void removeDBEventListener(const std::string& type, const std::function& listener) override; + + typedef std::function dbEventCallback; + void setDBEventCallback(dbEventCallback callback) + { + _dbEventCallback = callback; + } + /** * @inheritDoc */ @@ -167,12 +174,6 @@ public: _premultipliedAlpha = value; } - typedef std::function dbEventCallback; - void setDBEventCallback(dbEventCallback callback) - { - _dbEventCallback = callback; - } - /** * @brief Convert component position to global position. * @param[in] pos Component position @@ -184,15 +185,14 @@ public: * @return root display,if this diplay is root,then return itself. */ CCArmatureDisplay* getRootDisplay(); - private: std::map _listenerIDMap; cocos2d::middleware::IOTypedArray* _debugBuffer = nullptr; cocos2d::Color4F _nodeColor = cocos2d::Color4F::WHITE; int _preBlendMode = -1; - int _preTextureIndex = -1; - int _curTextureIndex = -1; + GLuint _preTextureIndex = -1; + GLuint _curTextureIndex = -1; cocos2d::renderer::BlendFactor _curBlendSrc; cocos2d::renderer::BlendFactor _curBlendDst; diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h b/native/cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h index 4f0f955c3d..cf76009080 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h +++ b/native/cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h @@ -27,5 +27,7 @@ #include "dragonbones-creator-support/CCArmatureDisplay.h" #include "dragonbones-creator-support/CCSlot.h" #include "dragonbones-creator-support/CCFactory.h" +#include "dragonbones-creator-support/ArmatureCacheMgr.h" +#include "dragonbones-creator-support/CCArmatureCacheDisplay.h" #endif // DRAGONBONES_CC_HEADERS_H diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCFactory.h b/native/cocos/editor-support/dragonbones-creator-support/CCFactory.h index 2113381fa4..ca6bac03c3 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCFactory.h +++ b/native/cocos/editor-support/dragonbones-creator-support/CCFactory.h @@ -106,7 +106,6 @@ public: eventManager->retain(); _dragonBonesInstance = new DragonBones(eventManager); - // _dragonBonesInstance->yDown = false; cocos2d::middleware::MiddlewareManager::getInstance()->addTimer(this); } @@ -250,6 +249,16 @@ public: _dragonBonesInstance->getClock()->timeScale = timeScale; } + float getTimeScale() + { + return _dragonBonesInstance->getClock()->timeScale; + } + + DragonBones* getDragonBones() + { + return _dragonBonesInstance; + } + void removeTextureAtlasDataByIndex(const std::string& name, int textureIndex); void removeDragonBonesDataByUUID(const std::string& uuid, bool disposeData = true); diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCSlot.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCSlot.cpp index 39327db8e1..89c5c9914e 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCSlot.cpp +++ b/native/cocos/editor-support/dragonbones-creator-support/CCSlot.cpp @@ -103,7 +103,7 @@ void CCSlot::_onUpdateDisplay() void CCSlot::_addDisplay() { - + _visible = true; } void CCSlot::_replaceDisplay(void* value, bool isArmatureDisplay) @@ -113,7 +113,7 @@ void CCSlot::_replaceDisplay(void* value, bool isArmatureDisplay) void CCSlot::_removeDisplay() { - + _visible = false; } void CCSlot::_updateZOrder() @@ -121,6 +121,11 @@ void CCSlot::_updateZOrder() } +void CCSlot::_updateVisible() +{ + _visible = _parent->getVisible(); +} + middleware::Texture2D* CCSlot::getTexture() const { const auto currentTextureData = static_cast(_textureData); @@ -498,11 +503,6 @@ void CCSlot::_identityTransform() _worldMatDirty = true; } -void CCSlot::_updateVisible() -{ - -} - void CCSlot::_updateBlendMode() { if (_childArmature != nullptr) diff --git a/native/cocos/editor-support/dragonbones/armature/Bone.cpp b/native/cocos/editor-support/dragonbones/armature/Bone.cpp index b1a1cc8cf8..c84a7058c8 100644 --- a/native/cocos/editor-support/dragonbones/armature/Bone.cpp +++ b/native/cocos/editor-support/dragonbones/armature/Bone.cpp @@ -41,15 +41,30 @@ void Bone::_updateGlobalTransformMatrix(bool isCache) // global = *origin; // Copy. // global.add(offset).add(animationPose); global.x = origin->x + offset.x + animationPose.x; - global.y = origin->y + offset.y + animationPose.y; - global.skew = origin->skew + offset.skew + animationPose.skew; - global.rotation = origin->rotation + offset.rotation + animationPose.rotation; global.scaleX = origin->scaleX * offset.scaleX * animationPose.scaleX; global.scaleY = origin->scaleY * offset.scaleY * animationPose.scaleY; + if (DragonBones::yDown) + { + global.y = origin->y + offset.y + animationPose.y; + global.skew = origin->skew + offset.skew + animationPose.skew; + global.rotation = origin->rotation + offset.rotation + animationPose.rotation; + } + else + { + global.y = origin->y - offset.y + animationPose.y; + global.skew = origin->skew - offset.skew + animationPose.skew; + global.rotation = origin->rotation - offset.rotation + animationPose.rotation; + } } else { global = offset; // Copy. + if (!DragonBones::yDown) + { + global.y = -global.y; + global.skew = -global.skew; + global.rotation = -global.rotation; + } global.add(animationPose); } } @@ -69,6 +84,12 @@ void Bone::_updateGlobalTransformMatrix(bool isCache) { inherit = false; global = offset; + if (!DragonBones::yDown) + { + global.y = -global.y; + global.skew = -global.skew; + global.rotation = -global.rotation; + } } if (inherit) @@ -166,6 +187,11 @@ void Bone::_updateGlobalTransformMatrix(bool isCache) { global.skew += Transform::PI; } + + if (!DragonBones::yDown) + { + global.skew = -global.skew; + } } global.rotation = rotation; diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp index e0b77a7786..73cb5e0d3a 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp @@ -66,9 +66,9 @@ static _TrackEntryListeners* getListeners (TrackEntry* entry) { return (_TrackEntryListeners*)entry->getRendererObject(); } -static float globalTimeScale = 1.0f; +float SkeletonAnimation::GlobalTimeScale = 1.0f; void SkeletonAnimation::setGlobalTimeScale(float timeScale) { - globalTimeScale = timeScale; + GlobalTimeScale = timeScale; } SkeletonAnimation* SkeletonAnimation::create() { @@ -143,7 +143,7 @@ SkeletonAnimation::~SkeletonAnimation () { void SkeletonAnimation::update (float deltaTime) { if (!_skeleton) return; if (!_paused) { - deltaTime *= _timeScale * globalTimeScale; + deltaTime *= _timeScale * GlobalTimeScale; if (_ownsSkeleton) _skeleton->update(deltaTime); _state->update(deltaTime); _state->apply(*_skeleton); diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.h b/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.h index 44ce57a2a8..c4f17c21e7 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.h +++ b/native/cocos/editor-support/spine-creator-support/SkeletonAnimation.h @@ -99,7 +99,9 @@ CC_CONSTRUCTOR_ACCESS: SkeletonAnimation (); virtual ~SkeletonAnimation (); virtual void initialize () override; - + +public: + static float GlobalTimeScale; protected: AnimationState* _state = nullptr; bool _ownsAnimationStateData = false; diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCache.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonCache.cpp new file mode 100644 index 0000000000..0a0f9b3404 --- /dev/null +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCache.cpp @@ -0,0 +1,532 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 "SkeletonCache.h" +#include "spine-creator-support/AttachmentVertices.h" +#include "renderer/gfx/Texture.h" + +USING_NS_CC; +USING_NS_MW; +using namespace cocos2d::renderer; + +namespace spine { + + float SkeletonCache::FrameTime = 1.0f / 60.0f; + float SkeletonCache::MaxCacheTime = 120.0f; + + SkeletonCache::SegmentData::SegmentData () { + + } + + SkeletonCache::SegmentData::~SegmentData () { + CC_SAFE_RELEASE_NULL(_texture); + } + + void SkeletonCache::SegmentData::setTexture (cocos2d::middleware::Texture2D* value) { + CC_SAFE_RETAIN(value); + CC_SAFE_RELEASE(_texture); + _texture = value; + } + + cocos2d::middleware::Texture2D* SkeletonCache::SegmentData::getTexture () const { + return _texture; + } + + SkeletonCache::FrameData::FrameData () { + + } + + SkeletonCache::FrameData::~FrameData () { + for (std::size_t i = 0, c = _colors.size(); i < c; i++) { + delete _colors[i]; + } + _colors.clear(); + + for (std::size_t i = 0, c = _segments.size(); i < c; i++) { + delete _segments[i]; + } + _segments.clear(); + } + + SkeletonCache::ColorData* SkeletonCache::FrameData::buildColorData (std::size_t index) { + if (index > _colors.size()) return nullptr; + if (index == _colors.size()) { + ColorData* colorData = new ColorData; + _colors.push_back(colorData); + } + return _colors[index]; + } + + std::size_t SkeletonCache::FrameData::getColorCount () const { + return _colors.size(); + } + + SkeletonCache::SegmentData* SkeletonCache::FrameData::buildSegmentData (std::size_t index) { + if (index > _segments.size()) return nullptr; + if (index == _segments.size()) { + SegmentData* segmentData = new SegmentData; + _segments.push_back(segmentData); + } + return _segments[index]; + } + + std::size_t SkeletonCache::FrameData::getSegmentCount () const { + return _segments.size(); + } + + SkeletonCache::AnimationData::AnimationData () { + + } + + SkeletonCache::AnimationData::~AnimationData () { + reset(); + } + + void SkeletonCache::AnimationData::reset () { + for (std::size_t i = 0, c = _frames.size(); i < c; i++) { + delete _frames[i]; + } + _frames.clear(); + _isComplete = false; + _totalTime = 0.0f; + } + + bool SkeletonCache::AnimationData::needUpdate (int toFrameIdx) const { + return !_isComplete && _totalTime <= MaxCacheTime && (toFrameIdx == -1 || _frames.size() < toFrameIdx + 1); + } + + SkeletonCache::FrameData* SkeletonCache::AnimationData::buildFrameData (std::size_t frameIdx) { + if (frameIdx > _frames.size()) { + return nullptr; + } + if (frameIdx == _frames.size()) { + auto frameData = new FrameData(); + _frames.push_back(frameData); + } + return _frames[frameIdx]; + } + + SkeletonCache::FrameData* SkeletonCache::AnimationData::getFrameData (std::size_t frameIdx) const { + if (frameIdx >= _frames.size()) { + return nullptr; + } + return _frames[frameIdx]; + } + + std::size_t SkeletonCache::AnimationData::getFrameCount () const { + return _frames.size(); + } + + SkeletonCache::SkeletonCache () { + + } + + SkeletonCache::~SkeletonCache () { + for (auto it = _animationCaches.begin(); it != _animationCaches.end(); it++) { + delete it->second; + } + _animationCaches.clear(); + } + + SkeletonCache::AnimationData* SkeletonCache::buildAnimationData (const std::string& animationName) { + AnimationData* aniData = nullptr; + auto it = _animationCaches.find(animationName); + if (it == _animationCaches.end()) { + auto animation = findAnimation(animationName); + if (animation == nullptr) return nullptr; + + aniData = new AnimationData(); + aniData->_animationName = animationName; + _animationCaches[animationName] = aniData; + } else { + aniData = it->second; + } + return aniData; + } + + SkeletonCache::AnimationData* SkeletonCache::getAnimationData (const std::string& animationName) { + auto it = _animationCaches.find(animationName); + if (it == _animationCaches.end()) { + return nullptr; + } else { + return it->second; + } + } + + void SkeletonCache::update (float deltaTime) { + if (!_skeleton) return; + if (_ownsSkeleton) _skeleton->update(deltaTime); + _state->update(deltaTime); + _state->apply(*_skeleton); + _skeleton->updateWorldTransform(); + } + + void SkeletonCache::updateToFrame (const std::string& animationName, int toFrameIdx/*= -1*/) { + auto it = _animationCaches.find(animationName); + if (it == _animationCaches.end()) { + return; + } + + AnimationData* animationData = it->second; + if (!animationData || !animationData->needUpdate(toFrameIdx)) { + return; + } + + if (_curAnimationName != animationName) { + updateToFrame(_curAnimationName); + _curAnimationName = animationName; + } + + // init animation + if (animationData->getFrameCount() == 0) { + setAnimation(0, animationName, false); + } + + do { + update(FrameTime); + renderAnimationFrame(animationData); + animationData->_totalTime += FrameTime; + } while (animationData->needUpdate(toFrameIdx)); + } + + void SkeletonCache::renderAnimationFrame (AnimationData* animationData) { + std::size_t frameIndex = animationData->getFrameCount(); + FrameData* frameData = animationData->buildFrameData(frameIndex); + + if (!_skeleton) return; + + // If opacity is 0,then return. + if (_skeleton->getColor().a == 0) { + return; + } + + Color4F preColor(-1.0f, -1.0f, -1.0f, -1.0f); + Color4F preDarkColor(-1.0f, -1.0f, -1.0f, -1.0f); + // range [0.0, 1.0] + Color4F color; + Color4F darkColor; + + AttachmentVertices* attachmentVertices = nullptr; + middleware::IOBuffer& vb = frameData->vb; + middleware::IOBuffer& ib = frameData->ib; + + // vertex size int bytes with two color + int vbs2 = sizeof(V2F_T2F_C4B_C4B); + // verex size in floats with two color + int vs2 = vbs2 / sizeof(float); + + int vbSize = 0; + int ibSize = 0; + + int preBlendMode = -1; + GLuint preTextureIndex = -1; + GLuint curTextureIndex = -1; + + int preISegWritePos = -1; + int curISegLen = 0; + int curVSegLen = 0; + + int materialLen = 0; + Slot* slot = nullptr; + + middleware::Texture2D* texture = nullptr; + + auto flush = [&]() { + // fill pre segment count field + if (preISegWritePos != -1) { + SegmentData* preSegmentData = frameData->buildSegmentData(materialLen - 1); + preSegmentData->indexCount = curISegLen; + preSegmentData->vertexFloatCount = curVSegLen; + } + + SegmentData* segmentData = frameData->buildSegmentData(materialLen); + segmentData->setTexture(texture); + segmentData->blendMode = slot->getData().getBlendMode(); + + // save new segment count pos field + preISegWritePos = (int)ib.getCurPos() / sizeof(unsigned short); + // reset pre blend mode to current + preBlendMode = (int)slot->getData().getBlendMode(); + // reset pre texture index to current + preTextureIndex = curTextureIndex; + // reset index segmentation count + curISegLen = 0; + // reset vertex segmentation count + curVSegLen = 0; + // material length increased + materialLen++; + }; + + auto& drawOrder = _skeleton->getDrawOrder(); + for (size_t i = 0, n = drawOrder.size(); i < n; ++i) { + slot = drawOrder[i]; + + if (!slot->getAttachment()) { + _clipper->clipEnd(*slot); + continue; + } + + // Early exit if slot is invisible + if (slot->getColor().a == 0) { + _clipper->clipEnd(*slot); + continue; + } + + TwoColorTriangles trianglesTwoColor; + + if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) { + RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment(); + attachmentVertices = (AttachmentVertices*)attachment->getRendererObject(); + + // Early exit if attachment is invisible + if (attachment->getColor().a == 0) { + _clipper->clipEnd(*slot); + continue; + } + + trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount; + vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); + vb.checkSpace(vbSize, true); + trianglesTwoColor.verts = (V2F_T2F_C4B_C4B*)vb.getCurBuffer(); + for (int ii = 0; ii < trianglesTwoColor.vertCount; ii++) { + trianglesTwoColor.verts[ii].texCoord = attachmentVertices->_triangles->verts[ii].texCoord; + } + attachment->computeWorldVertices(slot->getBone(), (float*)trianglesTwoColor.verts, 0, vs2); + + trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount; + ibSize = trianglesTwoColor.indexCount * sizeof(unsigned short); + ib.checkSpace(ibSize, true); + trianglesTwoColor.indices = (unsigned short*)ib.getCurBuffer(); + memcpy(trianglesTwoColor.indices, attachmentVertices->_triangles->indices, ibSize); + + color.r = attachment->getColor().r; + color.g = attachment->getColor().g; + color.b = attachment->getColor().b; + color.a = attachment->getColor().a; + + } else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) { + MeshAttachment* attachment = (MeshAttachment*)slot->getAttachment(); + attachmentVertices = (AttachmentVertices*)attachment->getRendererObject(); + + // Early exit if attachment is invisible + if (attachment->getColor().a == 0) { + _clipper->clipEnd(*slot); + continue; + } + + trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount; + vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); + vb.checkSpace(vbSize, true); + trianglesTwoColor.verts = (V2F_T2F_C4B_C4B*)vb.getCurBuffer(); + for (int ii = 0; ii < trianglesTwoColor.vertCount; ii++) { + trianglesTwoColor.verts[ii].texCoord = attachmentVertices->_triangles->verts[ii].texCoord; + } + attachment->computeWorldVertices(*slot, 0, attachment->getWorldVerticesLength(), (float*)trianglesTwoColor.verts, 0, vs2); + + trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount; + ibSize = trianglesTwoColor.indexCount * sizeof(unsigned short); + ib.checkSpace(ibSize, true); + trianglesTwoColor.indices = (unsigned short*)ib.getCurBuffer(); + memcpy(trianglesTwoColor.indices, attachmentVertices->_triangles->indices, ibSize); + + color.r = attachment->getColor().r; + color.g = attachment->getColor().g; + color.b = attachment->getColor().b; + color.a = attachment->getColor().a; + + } else if (slot->getAttachment()->getRTTI().isExactly(ClippingAttachment::rtti)) { + ClippingAttachment* clip = (ClippingAttachment*)slot->getAttachment(); + _clipper->clipStart(*slot, clip); + continue; + } else { + _clipper->clipEnd(*slot); + continue; + } + + color.a = _skeleton->getColor().a * slot->getColor().a * color.a * 255; + // skip rendering if the color of this attachment is 0 + if (color.a == 0) { + _clipper->clipEnd(*slot); + continue; + } + + float red = _skeleton->getColor().r * color.r * 255; + float green = _skeleton->getColor().g * color.g * 255; + float blue = _skeleton->getColor().b * color.b * 255; + + color.r = red * slot->getColor().r; + color.g = green * slot->getColor().g; + color.b = blue * slot->getColor().b; + + if (slot->hasDarkColor()) { + darkColor.r = red * slot->getDarkColor().r; + darkColor.g = green * slot->getDarkColor().g; + darkColor.b = blue * slot->getDarkColor().b; + } else { + darkColor.r = 0; + darkColor.g = 0; + darkColor.b = 0; + } + darkColor.a = 0; + + if (preColor != color || preDarkColor != darkColor) { + preColor = color; + preDarkColor = darkColor; + auto colorCount = frameData->getColorCount(); + if (colorCount > 0) { + ColorData* preColorData = frameData->buildColorData(colorCount - 1); + preColorData->vertexFloatOffset = (int) vb.getCurPos() / sizeof(float); + } + ColorData* colorData = frameData->buildColorData(colorCount); + colorData->finalColor = color; + colorData->darkColor = darkColor; + } + + // Two color tint logic + if (_clipper->isClipping()) { + _clipper->clipTriangles((float*)&trianglesTwoColor.verts[0].vertex, trianglesTwoColor.indices, trianglesTwoColor.indexCount, (float*)&trianglesTwoColor.verts[0].texCoord, vs2); + + if (_clipper->getClippedTriangles().size() == 0) { + _clipper->clipEnd(*slot); + continue; + } + + trianglesTwoColor.vertCount = (int)_clipper->getClippedVertices().size() >> 1; + vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); + vb.checkSpace(vbSize, true); + trianglesTwoColor.verts = (V2F_T2F_C4B_C4B*)vb.getCurBuffer(); + + trianglesTwoColor.indexCount = (int)_clipper->getClippedTriangles().size(); + ibSize = trianglesTwoColor.indexCount * sizeof(unsigned short); + trianglesTwoColor.indices = (unsigned short*)ib.getCurBuffer(); + memcpy(trianglesTwoColor.indices, _clipper->getClippedTriangles().buffer(), sizeof(unsigned short) * _clipper->getClippedTriangles().size()); + + float* verts = _clipper->getClippedVertices().buffer(); + float* uvs = _clipper->getClippedUVs().buffer(); + + for (int v = 0, vn = trianglesTwoColor.vertCount, vv = 0; v < vn; ++v, vv += 2) { + V2F_T2F_C4B_C4B* vertex = trianglesTwoColor.verts + v; + vertex->vertex.x = verts[vv]; + vertex->vertex.y = verts[vv + 1]; + vertex->texCoord.u = uvs[vv]; + vertex->texCoord.v = uvs[vv + 1]; + vertex->color.r = (GLubyte)color.r; + vertex->color.g = (GLubyte)color.g; + vertex->color.b = (GLubyte)color.b; + vertex->color.a = (GLubyte)color.a; + vertex->color2.r = (GLubyte)darkColor.r; + vertex->color2.g = (GLubyte)darkColor.g; + vertex->color2.b = (GLubyte)darkColor.b; + vertex->color2.a = (GLubyte)darkColor.a; + } + } else { + for (int v = 0, vn = trianglesTwoColor.vertCount; v < vn; ++v) { + V2F_T2F_C4B_C4B* vertex = trianglesTwoColor.verts + v; + vertex->color.r = (GLubyte)color.r; + vertex->color.g = (GLubyte)color.g; + vertex->color.b = (GLubyte)color.b; + vertex->color.a = (GLubyte)color.a; + vertex->color2.r = (GLubyte)darkColor.r; + vertex->color2.g = (GLubyte)darkColor.g; + vertex->color2.b = (GLubyte)darkColor.b; + vertex->color2.a = (GLubyte)darkColor.a; + } + } + + texture = attachmentVertices->_texture; + curTextureIndex = attachmentVertices->_texture->getNativeTexture()->getHandle(); + // If texture or blendMode change,will change material. + if (preTextureIndex != curTextureIndex || preBlendMode != slot->getData().getBlendMode()) { + flush(); + } + + if (vbSize > 0 && ibSize > 0) { + auto vertexOffset = curVSegLen / vs2; + + if (vertexOffset > 0) { + unsigned short* ibBuffer = (unsigned short*)ib.getCurBuffer(); + for (int ii = 0, nn = ibSize / sizeof(unsigned short); ii < nn; ii++) { + ibBuffer[ii] += vertexOffset; + } + } + vb.move(vbSize); + ib.move(ibSize); + + // Record this turn index segmentation count,it will store in material buffer in the end. + curISegLen += ibSize / sizeof(unsigned short); + curVSegLen += vbSize / sizeof(float); + } + + _clipper->clipEnd(*slot); + } // End slot traverse + + _clipper->clipEnd(); + + if (preISegWritePos != -1) { + SegmentData* preSegmentData = frameData->buildSegmentData(materialLen - 1); + preSegmentData->indexCount = curISegLen; + preSegmentData->vertexFloatCount = curVSegLen; + } + + auto colorCount = frameData->getColorCount(); + if (colorCount > 0) { + ColorData* preColorData = frameData->buildColorData(colorCount - 1); + preColorData->vertexFloatOffset = (int) vb.getCurPos() / sizeof(float); + } + } + + void SkeletonCache::onAnimationStateEvent (TrackEntry* entry, EventType type, Event* event) { + SkeletonAnimation::onAnimationStateEvent(entry, type, event); + if (type == EventType_Complete && entry) { + Animation* ani = entry->getAnimation(); + if (!ani) return; + std::string aniName = ani->getName().buffer(); + if (aniName == _curAnimationName) { + AnimationData* aniData = getAnimationData(_curAnimationName); + if (!aniData) return; + aniData->_isComplete = true; + } + } + } + + void SkeletonCache::resetAllAnimationData() { + for (auto it = _animationCaches.begin(); it != _animationCaches.end(); it++) { + it->second->reset(); + } + } + + void SkeletonCache::resetAnimationData(const std::string& animationName) { + for (auto it = _animationCaches.begin(); it != _animationCaches.end(); it++) { + if (it->second->_animationName == animationName) { + it->second->reset(); + break; + } + } + } +} diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCache.h b/native/cocos/editor-support/spine-creator-support/SkeletonCache.h new file mode 100644 index 0000000000..9e8f87bbd8 --- /dev/null +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCache.h @@ -0,0 +1,136 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 "SkeletonAnimation.h" +#include "IOBuffer.h" +#include "middleware-adapter.h" +#include + +namespace spine { + class SkeletonCache: public SkeletonAnimation { + public: + struct SegmentData { + friend class SkeletonCache; + + SegmentData (); + ~SegmentData (); + + void setTexture (cocos2d::middleware::Texture2D* value); + cocos2d::middleware::Texture2D* getTexture () const; + public: + int indexCount = 0; + int vertexFloatCount = 0; + int blendMode = 0; + private: + cocos2d::middleware::Texture2D* _texture = nullptr; + }; + + struct ColorData { + cocos2d::Color4F finalColor; + cocos2d::Color4F darkColor; + int vertexFloatOffset = 0; + }; + + struct FrameData { + friend class SkeletonCache; + + FrameData (); + ~FrameData (); + + const std::vector& getColors () const { + return _colors; + } + std::size_t getColorCount () const; + + const std::vector& getSegments () const { + return _segments; + } + std::size_t getSegmentCount () const; + private: + // if segment data is empty, it will build new one. + SegmentData* buildSegmentData (std::size_t index); + // if color data is empty, it will build new one. + ColorData* buildColorData (std::size_t index); + + std::vector _colors; + std::vector _segments; + public: + cocos2d::middleware::IOBuffer ib; + cocos2d::middleware::IOBuffer vb; + }; + + struct AnimationData { + friend class SkeletonCache; + + AnimationData (); + ~AnimationData (); + void reset (); + + FrameData* getFrameData (std::size_t frameIdx) const; + std::size_t getFrameCount () const; + + bool isComplete () const { return _isComplete; } + bool needUpdate (int toFrameIdx) const; + private: + // if frame is empty, it will build new one. + FrameData* buildFrameData (std::size_t frameIdx); + private: + std::string _animationName = ""; + bool _isComplete = false; + float _totalTime = 0.0f; + std::vector _frames; + }; + + SkeletonCache (); + virtual ~SkeletonCache (); + + virtual void beginSchedule() override {} + virtual void stopSchedule() override {} + virtual void update (float deltaTime) override; + virtual void render (float deltaTime) override {} + virtual void onAnimationStateEvent (TrackEntry* entry, EventType type, Event* event) override; + + void updateToFrame (const std::string& animationName, int toFrameIdx = -1); + // if animation data is empty, it will build new one. + AnimationData* buildAnimationData (const std::string& animationName); + AnimationData* getAnimationData (const std::string& animationName); + void resetAllAnimationData(); + void resetAnimationData(const std::string& animationName); + private: + void renderAnimationFrame (AnimationData* animationData); + public: + static float FrameTime; + static float MaxCacheTime; + private: + std::string _curAnimationName = ""; + std::map _animationCaches; + }; +} diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp new file mode 100644 index 0000000000..caeb071759 --- /dev/null +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp @@ -0,0 +1,474 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 "SkeletonCacheAnimation.h" +#include "MiddlewareMacro.h" +#include "SkeletonCacheMgr.h" +#include "renderer/renderer/Pass.h" +#include "renderer/renderer/Technique.h" +#include "renderer/scene/assembler/CustomAssembler.hpp" +#include "renderer/gfx/Texture.h" + +USING_NS_CC; +USING_NS_MW; +using namespace cocos2d::renderer; +static const std::string techStage = "opaque"; +static const std::string textureKey = "texture"; + +namespace spine { + + SkeletonCacheAnimation::SkeletonCacheAnimation (const std::string& uuid, bool isShare) { + if (isShare) { + _skeletonCache = SkeletonCacheMgr::getInstance()->buildSkeletonCache(uuid); + _skeletonCache->retain(); + } else { + _skeletonCache = new SkeletonCache(); + _skeletonCache->initWithUUID(uuid); + _skeletonCache->retain(); + _skeletonCache->autorelease(); + } + beginSchedule(); + } + + SkeletonCacheAnimation::~SkeletonCacheAnimation () { + if (_skeletonCache) { + _skeletonCache->release(); + _skeletonCache = nullptr; + } + while (!_animationQueue.empty()) { + auto ani = _animationQueue.front(); + _animationQueue.pop(); + delete ani; + } + CC_SAFE_RELEASE(_nodeProxy); + CC_SAFE_RELEASE(_effect); + stopSchedule(); + } + + void SkeletonCacheAnimation::update(float dt) { + if (_paused) return; + + auto gTimeScale = SkeletonAnimation::GlobalTimeScale; + dt *= _timeScale * gTimeScale; + + if (_isAniComplete) { + if (_animationQueue.empty() && !_headAnimation) { + if (_animationData && !_animationData->isComplete()) { + _skeletonCache->updateToFrame(_animationName); + } + return; + } + if (!_headAnimation) { + _headAnimation = _animationQueue.front(); + _animationQueue.pop(); + } + if (!_headAnimation) { + return; + } + _accTime += dt; + if (_accTime > _headAnimation->delay) { + std::string name = _headAnimation->animationName; + bool loop = _headAnimation->loop; + delete _headAnimation; + _headAnimation = nullptr; + setAnimation(name, loop); + return; + } + } + + if (!_animationData) return; + + if (_accTime <= 0.00001 && _playCount == 0) { + if (_startListener) { + _startListener(_animationName); + } + } + + _accTime += dt; + int frameIdx = floor(_accTime / SkeletonCache::FrameTime); + if (!_animationData->isComplete()) { + _skeletonCache->updateToFrame(_animationName, frameIdx); + } + + int finalFrameIndex = (int)_animationData->getFrameCount() - 1; + if (_animationData->isComplete() && frameIdx >= finalFrameIndex) { + _playCount++; + _accTime = 0.0f; + if (_playTimes > 0 && _playCount >= _playTimes) { + frameIdx = finalFrameIndex; + _playCount = 0; + _isAniComplete = true; + } else { + frameIdx = 0; + } + if (_endListener) { + _endListener(_animationName); + } + if (_completeListener) { + _completeListener(_animationName); + } + } + _curFrameIndex = frameIdx; + } + + void SkeletonCacheAnimation::render(float dt) { + + if (_nodeProxy == nullptr) { + return; + } + + CustomAssembler* assembler = (CustomAssembler*)_nodeProxy->getAssembler(); + if (assembler == nullptr) { + return; + } + assembler->reset(); + assembler->setUseModel(!_batch); + + if (!_animationData) return; + SkeletonCache::FrameData* frameData = _animationData->getFrameData(_curFrameIndex); + if (!frameData) return; + + auto mgr = MiddlewareManager::getInstance(); + if (!mgr->isRendering) return; + + _nodeColor.a = _nodeProxy->getRealOpacity() / (float)255; + + middleware::MeshBuffer* mb = mgr->getMeshBuffer(VF_XYUVCC); + middleware::IOBuffer& vb = mb->getVB(); + middleware::IOBuffer& ib = mb->getIB(); + const auto& srcVB = frameData->vb; + const auto& srcIB = frameData->ib; + + const cocos2d::Mat4& nodeWorldMat = _nodeProxy->getWorldMatrix(); + auto& segments = frameData->getSegments(); + auto& colors = frameData->getColors(); + + int colorOffset = 0; + SkeletonCache::ColorData* nowColor = colors[colorOffset++]; + auto maxVFOffset = nowColor->vertexFloatOffset; + + Color4B finalColor; + Color4B darkColor; + float tempR = 0.0f, tempG = 0.0f, tempB = 0.0f; + float multiplier = 1.0f; + int srcVertexBytesOffset = 0; + int vertexBytes = 0; + int srcIndexBytesOffset = 0; + int indexBytes = 0; + GLuint textureHandle = 0; + double effectHash = 0; + int blendMode = 0; + int dstVertexOffset = 0; + float* dstVertexBuffer = nullptr; + unsigned int* dstColorBuffer = nullptr; + unsigned short* dstIndexBuffer = nullptr; + bool needColor = false; + BlendFactor curBlendSrc = BlendFactor::ONE; + BlendFactor curBlendDst = BlendFactor::ZERO; + + if (abs(_nodeColor.r - 1.0f) > 0.0001f || + abs(_nodeColor.g - 1.0f) > 0.0001f || + abs(_nodeColor.b - 1.0f) > 0.0001f || + abs(_nodeColor.a - 1.0f) > 0.0001f || + _premultipliedAlpha) { + needColor = true; + } + + auto handleColor = [&](SkeletonCache::ColorData* colorData){ + finalColor.a = (GLubyte)(colorData->finalColor.a * _nodeColor.a); + multiplier = _premultipliedAlpha ? finalColor.a / 255 : 1; + tempR = _nodeColor.r * multiplier; + tempG = _nodeColor.g * multiplier; + tempB = _nodeColor.b * multiplier; + + finalColor.r = (GLubyte)(colorData->finalColor.r * tempR); + finalColor.g = (GLubyte)(colorData->finalColor.g * tempG); + finalColor.b = (GLubyte)(colorData->finalColor.b * tempB); + + darkColor.r = (GLubyte)(colorData->darkColor.r * tempR); + darkColor.g = (GLubyte)(colorData->darkColor.g * tempG); + darkColor.b = (GLubyte)(colorData->darkColor.b * tempB); + darkColor.a = _premultipliedAlpha ? 255 : 0; + }; + + handleColor(nowColor); + + for (std::size_t segIndex = 0, segLen = segments.size(); segIndex < segLen; segIndex++) { + auto segment = segments[segIndex]; + vertexBytes = segment->vertexFloatCount * sizeof(float); + + // fill vertex buffer + vb.checkSpace(vertexBytes, true); + dstVertexOffset = (int)vb.getCurPos() / sizeof(V2F_T2F_C4B_C4B); + dstVertexBuffer = (float*)vb.getCurBuffer(); + dstColorBuffer = (unsigned int*)vb.getCurBuffer(); + vb.writeBytes((char*)srcVB.getBuffer() + srcVertexBytesOffset, vertexBytes); + + // batch handle + if (_batch) { + cocos2d::Vec3* point = nullptr; + float tempZ = 0.0f; + for (auto posIndex = 0; posIndex < segment->vertexFloatCount; posIndex += 6) + { + point = (cocos2d::Vec3*)(dstVertexBuffer + posIndex); + tempZ = point->z; + point->z = 0; + nodeWorldMat.transformPoint(point); + point->z = tempZ; + } + } + + // handle vertex color + if (needColor) { + int frameFloatOffset = srcVertexBytesOffset / sizeof(float); + for (auto colorIndex = 0; colorIndex < segment->vertexFloatCount; colorIndex += 6) + { + if (frameFloatOffset >= maxVFOffset) { + nowColor = colors[colorOffset++]; + handleColor(nowColor); + maxVFOffset = nowColor->vertexFloatOffset; + } + memcpy(dstColorBuffer + colorIndex + 4, &finalColor, sizeof(finalColor)); + memcpy(dstColorBuffer + colorIndex + 5, &darkColor, sizeof(darkColor)); + } + } + + // move src vertex buffer offset + srcVertexBytesOffset += vertexBytes; + + // fill index buffer + indexBytes = segment->indexCount * sizeof(unsigned short); + ib.checkSpace(indexBytes, true); + assembler->updateIARange(segIndex, (int)ib.getCurPos() / sizeof(unsigned short), segment->indexCount); + dstIndexBuffer = (unsigned short*)ib.getCurBuffer(); + ib.writeBytes((char*)srcIB.getBuffer() + srcIndexBytesOffset, indexBytes); + for (auto indexPos = 0; indexPos < segment->indexCount; indexPos ++) { + dstIndexBuffer[indexPos] += dstVertexOffset; + } + srcIndexBytesOffset += indexBytes; + + // set assembler glvb and glib + assembler->updateIABuffer(segIndex, mb->getGLVB(), mb->getGLIB()); + + // handle material + textureHandle = segment->getTexture()->getNativeTexture()->getHandle(); + blendMode = segment->blendMode; + effectHash = textureHandle + (blendMode << 16) + (1/*_useTint*/ << 24) + ((int)_batch << 25); + Effect* renderEffect = assembler->getEffect(segIndex); + Technique::Parameter* param = nullptr; + Pass* pass = nullptr; + + if (renderEffect) { + double renderHash = renderEffect->getHash(); + if (abs(renderHash - effectHash) >= 0.01) { + param = (Technique::Parameter*)&(renderEffect->getProperty(textureKey)); + Technique* tech = renderEffect->getTechnique(techStage); + cocos2d::Vector& passes = (cocos2d::Vector&)tech->getPasses(); + pass = *(passes.begin()); + } + } + else { + if (_effect == nullptr) { + cocos2d::log("SkeletonCacheAnimation:update get effect failed"); + assembler->reset(); + return; + } + auto effect = new cocos2d::renderer::Effect(); + effect->autorelease(); + effect->copy(_effect); + + Technique* tech = effect->getTechnique(techStage); + cocos2d::Vector& passes = (cocos2d::Vector&)tech->getPasses(); + pass = *(passes.begin()); + + assembler->updateEffect(segIndex, effect); + renderEffect = effect; + param = (Technique::Parameter*)&(renderEffect->getProperty(textureKey)); + } + + if (param) { + param->setTexture(segment->getTexture()->getNativeTexture()); + } + + switch (blendMode) { + case BlendMode_Additive: + curBlendSrc = _premultipliedAlpha ? BlendFactor::ONE : BlendFactor::SRC_ALPHA; + curBlendDst = BlendFactor::ONE; + break; + case BlendMode_Multiply: + curBlendSrc = BlendFactor::DST_COLOR; + curBlendDst = BlendFactor::ONE_MINUS_SRC_ALPHA; + break; + case BlendMode_Screen: + curBlendSrc = BlendFactor::ONE; + curBlendDst = BlendFactor::ONE_MINUS_SRC_COLOR; + break; + default: + curBlendSrc = _premultipliedAlpha ? BlendFactor::ONE : BlendFactor::SRC_ALPHA; + curBlendDst = BlendFactor::ONE_MINUS_SRC_ALPHA; + } + + if (pass) { + pass->setBlend(BlendOp::ADD, curBlendSrc, curBlendDst, + BlendOp::ADD, curBlendSrc, curBlendDst); + } + + renderEffect->updateHash(effectHash); + } + } + + Skeleton* SkeletonCacheAnimation::getSkeleton() const { + return _skeletonCache->getSkeleton(); + } + + void SkeletonCacheAnimation::setTimeScale (float scale) { + _timeScale = scale; + } + + float SkeletonCacheAnimation::getTimeScale () const { + return _timeScale; + } + + void SkeletonCacheAnimation::paused (bool value) { + _paused = value; + } + + Bone* SkeletonCacheAnimation::findBone (const std::string& boneName) const { + return _skeletonCache->findBone(boneName); + } + + Slot* SkeletonCacheAnimation::findSlot (const std::string& slotName) const { + return _skeletonCache->findSlot(slotName); + } + + void SkeletonCacheAnimation::setSkin (const std::string& skinName) { + _skeletonCache->setSkin(skinName); + _skeletonCache->setToSetupPose(); + _skeletonCache->resetAllAnimationData(); + } + + void SkeletonCacheAnimation::setSkin (const char* skinName) { + _skeletonCache->setSkin(skinName); + _skeletonCache->setToSetupPose(); + _skeletonCache->resetAllAnimationData(); + } + + Attachment* SkeletonCacheAnimation::getAttachment (const std::string& slotName, const std::string& attachmentName) const { + return _skeletonCache->getAttachment(slotName, attachmentName); + } + + bool SkeletonCacheAnimation::setAttachment (const std::string& slotName, const std::string& attachmentName) { + auto ret = _skeletonCache->setAttachment(slotName, attachmentName); + _skeletonCache->resetAllAnimationData(); + return ret; + } + + bool SkeletonCacheAnimation::setAttachment (const std::string& slotName, const char* attachmentName) { + auto ret = _skeletonCache->setAttachment(slotName, attachmentName); + _skeletonCache->resetAllAnimationData(); + return ret; + } + + void SkeletonCacheAnimation::setColor (cocos2d::Color4B& color) { + _nodeColor.r = color.r / 255.0f; + _nodeColor.g = color.g / 255.0f; + _nodeColor.b = color.b / 255.0f; + _nodeColor.a = color.a / 255.0f; + } + + void SkeletonCacheAnimation::setBatchEnabled (bool enabled) { + _batch = enabled; + } + + void SkeletonCacheAnimation::setOpacityModifyRGB (bool value) { + _premultipliedAlpha = value; + } + + bool SkeletonCacheAnimation::isOpacityModifyRGB () const { + return _premultipliedAlpha; + } + + void SkeletonCacheAnimation::beginSchedule() { + MiddlewareManager::getInstance()->addTimer(this); + } + + void SkeletonCacheAnimation::stopSchedule() { + MiddlewareManager::getInstance()->removeTimer(this); + } + + void SkeletonCacheAnimation::onEnable() { + beginSchedule(); + } + + void SkeletonCacheAnimation::onDisable() { + stopSchedule(); + } + + void SkeletonCacheAnimation::setAnimation (const std::string& name, bool loop) { + _playTimes = loop ? 0 : 1; + _animationName = name; + _animationData = _skeletonCache->buildAnimationData(_animationName); + _isAniComplete = false; + _accTime = 0.0f; + _playCount = 0; + _curFrameIndex = 0; + } + + void SkeletonCacheAnimation::addAnimation (const std::string& name, bool loop, float delay) { + auto aniInfo = new AniQueueData(); + aniInfo->animationName = name; + aniInfo->loop = loop; + aniInfo->delay = delay; + _animationQueue.push(aniInfo); + } + + Animation* SkeletonCacheAnimation::findAnimation(const std::string& name) const { + return _skeletonCache->findAnimation(name); + } + + void SkeletonCacheAnimation::setStartListener (const CacheFrameEvent& listener) { + _startListener = listener; + } + + void SkeletonCacheAnimation::setEndListener (const CacheFrameEvent& listener) { + _endListener = listener; + } + + void SkeletonCacheAnimation::setCompleteListener (const CacheFrameEvent& listener) { + _completeListener = listener; + } + + void SkeletonCacheAnimation::updateAnimationCache (const std::string& animationName) { + _skeletonCache->resetAnimationData(animationName); + } + + void SkeletonCacheAnimation::updateAllAnimationCache () { + _skeletonCache->resetAllAnimationData(); + } +} diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h new file mode 100644 index 0000000000..2a9809293b --- /dev/null +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h @@ -0,0 +1,132 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 "spine/spine.h" +#include "base/CCRef.h" +#include "MiddlewareManager.h" +#include "renderer/scene/NodeProxy.hpp" +#include "SkeletonCache.h" +#include + +namespace spine { + class SkeletonCacheAnimation : public cocos2d::middleware::IMiddleware, public cocos2d::Ref { + public: + SkeletonCacheAnimation (const std::string& uuid, bool isShare); + virtual ~SkeletonCacheAnimation (); + + virtual void update(float dt) override; + virtual void render(float dt) override; + + Skeleton* getSkeleton() const; + + void setTimeScale (float scale); + float getTimeScale () const; + + void paused (bool value); + + Bone* findBone (const std::string& boneName) const; + Slot* findSlot (const std::string& slotName) const; + + void setSkin (const std::string& skinName); + void setSkin (const char* skinName); + + Attachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const; + bool setAttachment (const std::string& slotName, const std::string& attachmentName); + bool setAttachment (const std::string& slotName, const char* attachmentName); + + void bindNodeProxy(cocos2d::renderer::NodeProxy* node) { + if (node == _nodeProxy) return; + CC_SAFE_RELEASE(_nodeProxy); + _nodeProxy = node; + CC_SAFE_RETAIN(_nodeProxy); + } + + void setEffect(cocos2d::renderer::Effect* effect) { + if (effect == _effect) return; + CC_SAFE_RELEASE(_effect); + _effect = effect; + CC_SAFE_RETAIN(_effect); + } + + void setColor (cocos2d::Color4B& color); + void setBatchEnabled (bool enabled); + + void setOpacityModifyRGB (bool value); + bool isOpacityModifyRGB () const; + + void beginSchedule(); + void stopSchedule(); + void onEnable(); + void onDisable(); + + void setAnimation (const std::string& name, bool loop); + void addAnimation (const std::string& name, bool loop, float delay = 0); + Animation* findAnimation(const std::string& name) const; + + typedef std::function CacheFrameEvent; + void setStartListener (const CacheFrameEvent& listener); + void setEndListener (const CacheFrameEvent& listener); + void setCompleteListener (const CacheFrameEvent& listener); + void updateAnimationCache (const std::string& animationName); + void updateAllAnimationCache (); + private: + float _timeScale = 1; + bool _paused = false; + + bool _batch = false; + cocos2d::Color4F _nodeColor = cocos2d::Color4F::WHITE; + bool _premultipliedAlpha = false; + + cocos2d::renderer::NodeProxy* _nodeProxy = nullptr; + cocos2d::renderer::Effect* _effect = nullptr; + + CacheFrameEvent _startListener = nullptr; + CacheFrameEvent _endListener = nullptr; + CacheFrameEvent _completeListener = nullptr; + + SkeletonCache* _skeletonCache = nullptr; + SkeletonCache::AnimationData* _animationData = nullptr; + int _curFrameIndex = -1; + + float _accTime = 0.0f; + int _playCount = 0; + int _playTimes = 0; + bool _isAniComplete = true; + std::string _animationName = ""; + + struct AniQueueData { + std::string animationName = ""; + bool loop = false; + float delay = 0.0f; + }; + std::queue _animationQueue; + AniQueueData* _headAnimation = nullptr; + }; +} diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp new file mode 100644 index 0000000000..08f93625d2 --- /dev/null +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp @@ -0,0 +1,51 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 "SkeletonCacheMgr.h" + +namespace spine { + SkeletonCacheMgr* SkeletonCacheMgr::_instance = nullptr; + SkeletonCache* SkeletonCacheMgr::buildSkeletonCache(const std::string& uuid) { + SkeletonCache* animation = _caches.at(uuid); + if (!animation) { + animation = new SkeletonCache(); + animation->initWithUUID(uuid); + _caches.insert(uuid, animation); + animation->autorelease(); + } + return animation; + } + + void SkeletonCacheMgr::removeSkeletonCache (const std::string& uuid) { + auto it = _caches.find(uuid); + if (it != _caches.end()) { + _caches.erase(it); + } + } +} diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h b/native/cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h new file mode 100644 index 0000000000..576eee9459 --- /dev/null +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h @@ -0,0 +1,59 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. + * + * Copyright (c) 2013-2019, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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 "SkeletonCache.h" +#include "base/CCMap.h" + +namespace spine { + +class SkeletonCacheMgr { +public: + static SkeletonCacheMgr* getInstance () { + if (_instance == nullptr) { + _instance = new SkeletonCacheMgr(); + } + return _instance; + } + + static void destroyInstance () { + if (_instance) { + delete _instance; + _instance = nullptr; + } + } + + void removeSkeletonCache (const std::string& uuid); + SkeletonCache* buildSkeletonCache (const std::string& uuid); +private: + static SkeletonCacheMgr* _instance; + cocos2d::Map _caches; +}; + +} diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp index 867ff4bbae..afe1e340b8 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp @@ -37,6 +37,7 @@ #include "renderer/renderer/Technique.h" #include "renderer/scene/assembler/CustomAssembler.hpp" #include "SkeletonDataMgr.h" +#include "renderer/gfx/Texture.h" USING_NS_CC; USING_NS_MW; @@ -49,7 +50,6 @@ using namespace cocos2d::renderer; static const std::string techStage = "opaque"; static const std::string textureKey = "texture"; -static const uint8_t moduleID = MiddlewareManager::generateModuleID(); static Cocos2dTextureLoader textureLoader; @@ -257,10 +257,6 @@ void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, } void SkeletonRenderer::render (float deltaTime) { - if (!_skeleton) return; - // avoid other place call update. - auto mgr = MiddlewareManager::getInstance(); - if (!mgr->isRendering) return; if (_nodeProxy == nullptr) { return; @@ -273,6 +269,11 @@ void SkeletonRenderer::render (float deltaTime) { assembler->reset(); assembler->setUseModel(!_batch); + if (!_skeleton) return; + // avoid other place call update. + auto mgr = MiddlewareManager::getInstance(); + if (!mgr->isRendering) return; + _nodeColor.a = _nodeProxy->getRealOpacity() / (float)255; // If opacity is 0,then return. @@ -280,6 +281,7 @@ void SkeletonRenderer::render (float deltaTime) { return; } + // color range is [0.0, 1.0] Color4F color; Color4F darkColor; AttachmentVertices* attachmentVertices = nullptr; @@ -306,8 +308,8 @@ void SkeletonRenderer::render (float deltaTime) { BlendFactor curBlendDst = BlendFactor::ZERO; int curBlendMode = -1; int preBlendMode = -1; - int preTextureIndex = -1; - int curTextureIndex = -1; + GLuint preTextureIndex = -1; + GLuint curTextureIndex = -1; int preISegWritePos = -1; int curISegLen = 0; @@ -352,7 +354,7 @@ void SkeletonRenderer::render (float deltaTime) { curBlendDst = BlendFactor::ONE_MINUS_SRC_ALPHA; } - double curHash = curTextureIndex + (moduleID << 16) + (curBlendMode << 24) + ((int)_useTint << 25) + ((int)_batch << 27); + double curHash = curTextureIndex + (curBlendMode << 16) + ((int)_useTint << 24) + ((int)_batch << 25); Effect* renderEffect = assembler->getEffect(materialLen); Technique::Parameter* param = nullptr; Pass* pass = nullptr; @@ -812,7 +814,7 @@ void SkeletonRenderer::render (float deltaTime) { } texture = attachmentVertices->_texture; - curTextureIndex = attachmentVertices->_texture->getRealTextureIndex(); + curTextureIndex = attachmentVertices->_texture->getNativeTexture()->getHandle(); // If texture or blendMode change,will change material. if (preTextureIndex != curTextureIndex || preBlendMode != slot->getData().getBlendMode() || isFull) { flush(); diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.h b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.h index e771ce81f5..2adbeaedcc 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.h +++ b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.h @@ -134,8 +134,8 @@ namespace spine { void setOpacityModifyRGB (bool value); bool isOpacityModifyRGB () const; - void beginSchedule(); - void stopSchedule(); + virtual void beginSchedule(); + virtual void stopSchedule(); void onEnable(); void onDisable(); @@ -157,7 +157,6 @@ namespace spine { void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); virtual void initialize (); - protected: void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData); diff --git a/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.h b/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.h index c459299bce..56ca3314b2 100644 --- a/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.h +++ b/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.h @@ -33,6 +33,8 @@ #include "spine-creator-support/SkeletonRenderer.h" #include "spine-creator-support/SkeletonAnimation.h" #include "spine-creator-support/SkeletonDataMgr.h" +#include "spine-creator-support/SkeletonCacheMgr.h" +#include "spine-creator-support/SkeletonCacheAnimation.h" #include "middleware-adapter.h" namespace spine { diff --git a/native/cocos/platform/win32/CCApplication-win32.cpp b/native/cocos/platform/win32/CCApplication-win32.cpp index bf651db230..df3dc26e64 100644 --- a/native/cocos/platform/win32/CCApplication-win32.cpp +++ b/native/cocos/platform/win32/CCApplication-win32.cpp @@ -210,6 +210,7 @@ void Application::start() _renderTexture->draw(); CAST_VIEW(_view)->swapBuffers(); + PoolManager::getInstance()->getCurrentPool()->clear(); } else { diff --git a/native/cocos/renderer/scene/RenderFlow.cpp b/native/cocos/renderer/scene/RenderFlow.cpp index c3fbc74c09..02d022e3c9 100644 --- a/native/cocos/renderer/scene/RenderFlow.cpp +++ b/native/cocos/renderer/scene/RenderFlow.cpp @@ -249,12 +249,6 @@ void RenderFlow::calculateLevelWorldMatrix(int tid, int stage) *dirty &= ~OPACITY; } } - -// if (!(*dirty & PRE_CALCULATE_VERTICES)) continue; -// AssemblerSprite* assemblerSprite = (AssemblerSprite*)info.node->getAssembler(); -// if (!(*dirty & WORLD_TRANSFORM_CHANGED) && !assemblerSprite->isDirty(AssemblerBase::VERTICES_DIRTY)) continue; -// assemblerSprite->generateWorldVertices(); -// assemblerSprite->calculateWorldVertices(*info.worldMat); } } diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_dragonbones_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_dragonbones_auto_api.js index 670d1a1a4a..0ba66e1ade 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_dragonbones_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_dragonbones_auto_api.js @@ -2673,6 +2673,16 @@ int return dragonBones::CCTextureAtlasData; }, +/** + * @method getDragonBones + * @return {dragonBones::DragonBones} + */ +getDragonBones : function ( +) +{ + return dragonBones::DragonBones; +}, + /** * @method parseDragonBonesDataByPath * @param {String} arg0 @@ -2737,6 +2747,16 @@ int { }, +/** + * @method getTimeScale + * @return {float} + */ +getTimeScale : function ( +) +{ + return 0; +}, + /** * @method isInit * @return {bool} @@ -2785,3 +2805,300 @@ CCFactory : function ( }, }; + +/** + * @class ArmatureCacheMgr + */ +dragonBones.ArmatureCacheMgr = { + +/** + * @method removeArmatureCache + * @param {String} arg0 + */ +removeArmatureCache : function ( +str +) +{ +}, + +/** + * @method buildArmatureCache + * @param {String} arg0 + * @param {String} arg1 + * @param {String} arg2 + * @return {dragonBones::ArmatureCache} + */ +buildArmatureCache : function ( +str, +str, +str +) +{ + return dragonBones::ArmatureCache; +}, + +/** + * @method destroyInstance + */ +destroyInstance : function ( +) +{ +}, + +/** + * @method getInstance + * @return {dragonBones::ArmatureCacheMgr} + */ +getInstance : function ( +) +{ + return dragonBones::ArmatureCacheMgr; +}, + +}; + +/** + * @class CCArmatureCacheDisplay + */ +dragonBones.CCArmatureCacheDisplay = { + +/** + * @method setTimeScale + * @param {float} arg0 + */ +setTimeScale : function ( +float +) +{ +}, + +/** + * @method render + * @param {float} arg0 + */ +render : function ( +float +) +{ +}, + +/** + * @method addDBEventListener + * @param {String} arg0 + */ +addDBEventListener : function ( +str +) +{ +}, + +/** + * @method removeDBEventListener + * @param {String} arg0 + */ +removeDBEventListener : function ( +str +) +{ +}, + +/** + * @method onEnable + */ +onEnable : function ( +) +{ +}, + +/** + * @method setEffect + * @param {cc.renderer::Effect} arg0 + */ +setEffect : function ( +effect +) +{ +}, + +/** + * @method dispose + */ +dispose : function ( +) +{ +}, + +/** + * @method setOpacityModifyRGB + * @param {bool} arg0 + */ +setOpacityModifyRGB : function ( +bool +) +{ +}, + +/** + * @method dispatchDBEvent + * @param {String} arg0 + * @param {dragonBones::EventObject} arg1 + */ +dispatchDBEvent : function ( +str, +eventobject +) +{ +}, + +/** + * @method beginSchedule + */ +beginSchedule : function ( +) +{ +}, + +/** + * @method updateAllAnimationCache + */ +updateAllAnimationCache : function ( +) +{ +}, + +/** + * @method update + * @param {float} arg0 + */ +update : function ( +float +) +{ +}, + +/** + * @method playAnimation + * @param {String} arg0 + * @param {int} arg1 + */ +playAnimation : function ( +str, +int +) +{ +}, + +/** + * @method setDBEventCallback + * @param {function} arg0 + */ +setDBEventCallback : function ( +func +) +{ +}, + +/** + * @method updateAnimationCache + * @param {String} arg0 + */ +updateAnimationCache : function ( +str +) +{ +}, + +/** + * @method getTimeScale + * @return {float} + */ +getTimeScale : function ( +) +{ + return 0; +}, + +/** + * @method getAnimation + * @return {dragonBones::Animation} + */ +getAnimation : function ( +) +{ + return dragonBones::Animation; +}, + +/** + * @method onDisable + */ +onDisable : function ( +) +{ +}, + +/** + * @method setColor + * @param {color4b_object} arg0 + */ +setColor : function ( +color4b +) +{ +}, + +/** + * @method bindNodeProxy + * @param {cc.renderer::NodeProxy} arg0 + */ +bindNodeProxy : function ( +nodeproxy +) +{ +}, + +/** + * @method setBatchEnabled + * @param {bool} arg0 + */ +setBatchEnabled : function ( +bool +) +{ +}, + +/** + * @method getArmature + * @return {dragonBones::Armature} + */ +getArmature : function ( +) +{ + return dragonBones::Armature; +}, + +/** + * @method stopSchedule + */ +stopSchedule : function ( +) +{ +}, + +/** + * @method CCArmatureCacheDisplay + * @constructor + * @param {String} arg0 + * @param {String} arg1 + * @param {String} arg2 + * @param {bool} arg3 + */ +CCArmatureCacheDisplay : function ( +str, +str, +str, +bool +) +{ +}, + +}; diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js index 69c2e64fd3..1953e57bde 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js @@ -6786,3 +6786,360 @@ SkeletonDataMgr : function ( }, }; + +/** + * @class SkeletonCacheMgr + */ +spine.SkeletonCacheMgr = { + +/** + * @method removeSkeletonCache + * @param {String} arg0 + */ +removeSkeletonCache : function ( +str +) +{ +}, + +/** + * @method buildSkeletonCache + * @param {String} arg0 + * @return {sp.SkeletonCache} + */ +buildSkeletonCache : function ( +str +) +{ + return sp.SkeletonCache; +}, + +/** + * @method destroyInstance + */ +destroyInstance : function ( +) +{ +}, + +/** + * @method getInstance + * @return {sp.SkeletonCacheMgr} + */ +getInstance : function ( +) +{ + return sp.SkeletonCacheMgr; +}, + +}; + +/** + * @class SkeletonCacheAnimation + */ +spine.SkeletonCacheAnimation = { + +/** + * @method setTimeScale + * @param {float} arg0 + */ +setTimeScale : function ( +float +) +{ +}, + +/** + * @method findAnimation + * @param {String} arg0 + * @return {sp.Animation} + */ +findAnimation : function ( +str +) +{ + return sp.Animation; +}, + +/** + * @method setCompleteListener + * @param {function} arg0 + */ +setCompleteListener : function ( +func +) +{ +}, + +/** + * @method paused + * @param {bool} arg0 + */ +paused : function ( +bool +) +{ +}, + +/** + * @method setAttachment +* @param {String|String} str +* @param {char|String} char +* @return {bool|bool} +*/ +setAttachment : function( +str, +str +) +{ + return false; +}, + +/** + * @method setAnimation + * @param {String} arg0 + * @param {bool} arg1 + */ +setAnimation : function ( +str, +bool +) +{ +}, + +/** + * @method onEnable + */ +onEnable : function ( +) +{ +}, + +/** + * @method setStartListener + * @param {function} arg0 + */ +setStartListener : function ( +func +) +{ +}, + +/** + * @method setEffect + * @param {cc.renderer::Effect} arg0 + */ +setEffect : function ( +effect +) +{ +}, + +/** + * @method isOpacityModifyRGB + * @return {bool} + */ +isOpacityModifyRGB : function ( +) +{ + return false; +}, + +/** + * @method setOpacityModifyRGB + * @param {bool} arg0 + */ +setOpacityModifyRGB : function ( +bool +) +{ +}, + +/** + * @method setEndListener + * @param {function} arg0 + */ +setEndListener : function ( +func +) +{ +}, + +/** + * @method beginSchedule + */ +beginSchedule : function ( +) +{ +}, + +/** + * @method updateAllAnimationCache + */ +updateAllAnimationCache : function ( +) +{ +}, + +/** + * @method addAnimation + * @param {String} arg0 + * @param {bool} arg1 + * @param {float} arg2 + */ +addAnimation : function ( +str, +bool, +float +) +{ +}, + +/** + * @method update + * @param {float} arg0 + */ +update : function ( +float +) +{ +}, + +/** + * @method getAttachment + * @param {String} arg0 + * @param {String} arg1 + * @return {sp.Attachment} + */ +getAttachment : function ( +str, +str +) +{ + return sp.Attachment; +}, + +/** + * @method updateAnimationCache + * @param {String} arg0 + */ +updateAnimationCache : function ( +str +) +{ +}, + +/** + * @method getTimeScale + * @return {float} + */ +getTimeScale : function ( +) +{ + return 0; +}, + +/** + * @method findBone + * @param {String} arg0 + * @return {sp.Bone} + */ +findBone : function ( +str +) +{ + return sp.Bone; +}, + +/** + * @method onDisable + */ +onDisable : function ( +) +{ +}, + +/** + * @method setColor + * @param {color4b_object} arg0 + */ +setColor : function ( +color4b +) +{ +}, + +/** + * @method bindNodeProxy + * @param {cc.renderer::NodeProxy} arg0 + */ +bindNodeProxy : function ( +nodeproxy +) +{ +}, + +/** + * @method setBatchEnabled + * @param {bool} arg0 + */ +setBatchEnabled : function ( +bool +) +{ +}, + +/** + * @method setSkin +* @param {char|String} char +*/ +setSkin : function( +str +) +{ +}, + +/** + * @method findSlot + * @param {String} arg0 + * @return {sp.Slot} + */ +findSlot : function ( +str +) +{ + return sp.Slot; +}, + +/** + * @method getSkeleton + * @return {sp.Skeleton} + */ +getSkeleton : function ( +) +{ + return sp.Skeleton; +}, + +/** + * @method stopSchedule + */ +stopSchedule : function ( +) +{ +}, + +/** + * @method SkeletonCacheAnimation + * @constructor + * @param {String} arg0 + * @param {bool} arg1 + */ +SkeletonCacheAnimation : function ( +str, +bool +) +{ +}, + +}; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp index f49d889787..680f7b77d5 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp @@ -6919,6 +6919,24 @@ static bool js_cocos2dx_dragonbones_CCFactory_getTextureAtlasDataByIndex(se::Sta } SE_BIND_FUNC(js_cocos2dx_dragonbones_CCFactory_getTextureAtlasDataByIndex) +static bool js_cocos2dx_dragonbones_CCFactory_getDragonBones(se::State& s) +{ + dragonBones::CCFactory* cobj = (dragonBones::CCFactory*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCFactory_getDragonBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + dragonBones::DragonBones* result = cobj->getDragonBones(); + ok &= native_ptr_to_seval((dragonBones::DragonBones*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCFactory_getDragonBones : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCFactory_getDragonBones) + static bool js_cocos2dx_dragonbones_CCFactory_parseDragonBonesDataByPath(se::State& s) { dragonBones::CCFactory* cobj = (dragonBones::CCFactory*)s.nativeThisObject(); @@ -7079,6 +7097,24 @@ static bool js_cocos2dx_dragonbones_CCFactory_removeTextureAtlasDataByIndex(se:: } SE_BIND_FUNC(js_cocos2dx_dragonbones_CCFactory_removeTextureAtlasDataByIndex) +static bool js_cocos2dx_dragonbones_CCFactory_getTimeScale(se::State& s) +{ + dragonBones::CCFactory* cobj = (dragonBones::CCFactory*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCFactory_getTimeScale : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTimeScale(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCFactory_getTimeScale : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCFactory_getTimeScale) + static bool js_cocos2dx_dragonbones_CCFactory_isInit(se::State& s) { const auto& args = s.args(); @@ -7180,11 +7216,13 @@ bool js_register_cocos2dx_dragonbones_CCFactory(se::Object* obj) cls->defineFunction("update", _SE(js_cocos2dx_dragonbones_CCFactory_update)); cls->defineFunction("remove", _SE(js_cocos2dx_dragonbones_CCFactory_remove)); cls->defineFunction("getTextureAtlasDataByIndex", _SE(js_cocos2dx_dragonbones_CCFactory_getTextureAtlasDataByIndex)); + cls->defineFunction("getDragonBones", _SE(js_cocos2dx_dragonbones_CCFactory_getDragonBones)); cls->defineFunction("parseDragonBonesDataByPath", _SE(js_cocos2dx_dragonbones_CCFactory_parseDragonBonesDataByPath)); cls->defineFunction("add", _SE(js_cocos2dx_dragonbones_CCFactory_add)); cls->defineFunction("buildArmatureDisplay", _SE(js_cocos2dx_dragonbones_CCFactory_buildArmatureDisplay)); cls->defineFunction("stopSchedule", _SE(js_cocos2dx_dragonbones_CCFactory_stopSchedule)); cls->defineFunction("removeTextureAtlasDataByIndex", _SE(js_cocos2dx_dragonbones_CCFactory_removeTextureAtlasDataByIndex)); + cls->defineFunction("getTimeScale", _SE(js_cocos2dx_dragonbones_CCFactory_getTimeScale)); cls->defineStaticFunction("isInit", _SE(js_cocos2dx_dragonbones_CCFactory_isInit)); cls->defineStaticFunction("destroyFactory", _SE(js_cocos2dx_dragonbones_CCFactory_destroyFactory)); cls->defineStaticFunction("getClock", _SE(js_cocos2dx_dragonbones_CCFactory_getClock)); @@ -7200,6 +7238,634 @@ bool js_register_cocos2dx_dragonbones_CCFactory(se::Object* obj) return true; } +se::Object* __jsb_dragonBones_ArmatureCacheMgr_proto = nullptr; +se::Class* __jsb_dragonBones_ArmatureCacheMgr_class = nullptr; + +static bool js_cocos2dx_dragonbones_ArmatureCacheMgr_removeArmatureCache(se::State& s) +{ + dragonBones::ArmatureCacheMgr* cobj = (dragonBones::ArmatureCacheMgr*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_ArmatureCacheMgr_removeArmatureCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_ArmatureCacheMgr_removeArmatureCache : Error processing arguments"); + cobj->removeArmatureCache(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_removeArmatureCache) + +static bool js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache(se::State& s) +{ + dragonBones::ArmatureCacheMgr* cobj = (dragonBones::ArmatureCacheMgr*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + std::string arg0; + std::string arg1; + std::string arg2; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_std_string(args[1], &arg1); + ok &= seval_to_std_string(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache : Error processing arguments"); + dragonBones::ArmatureCache* result = cobj->buildArmatureCache(arg0, arg1, arg2); + ok &= native_ptr_to_seval((dragonBones::ArmatureCache*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache) + +static bool js_cocos2dx_dragonbones_ArmatureCacheMgr_destroyInstance(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + dragonBones::ArmatureCacheMgr::destroyInstance(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_destroyInstance) + +static bool js_cocos2dx_dragonbones_ArmatureCacheMgr_getInstance(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + dragonBones::ArmatureCacheMgr* result = dragonBones::ArmatureCacheMgr::getInstance(); + ok &= native_ptr_to_seval((dragonBones::ArmatureCacheMgr*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_ArmatureCacheMgr_getInstance : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_getInstance) + + + +static bool js_dragonBones_ArmatureCacheMgr_finalize(se::State& s) +{ + CCLOGINFO("jsbindings: finalizing JS object %p (dragonBones::ArmatureCacheMgr)", s.nativeThisObject()); + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + dragonBones::ArmatureCacheMgr* cobj = (dragonBones::ArmatureCacheMgr*)s.nativeThisObject(); + delete cobj; + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_dragonBones_ArmatureCacheMgr_finalize) + +bool js_register_cocos2dx_dragonbones_ArmatureCacheMgr(se::Object* obj) +{ + auto cls = se::Class::create("ArmatureCacheMgr", obj, nullptr, nullptr); + + cls->defineFunction("removeArmatureCache", _SE(js_cocos2dx_dragonbones_ArmatureCacheMgr_removeArmatureCache)); + cls->defineFunction("buildArmatureCache", _SE(js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache)); + cls->defineStaticFunction("destroyInstance", _SE(js_cocos2dx_dragonbones_ArmatureCacheMgr_destroyInstance)); + cls->defineStaticFunction("getInstance", _SE(js_cocos2dx_dragonbones_ArmatureCacheMgr_getInstance)); + cls->defineFinalizeFunction(_SE(js_dragonBones_ArmatureCacheMgr_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_dragonBones_ArmatureCacheMgr_proto = cls->getProto(); + __jsb_dragonBones_ArmatureCacheMgr_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_dragonBones_CCArmatureCacheDisplay_proto = nullptr; +se::Class* __jsb_dragonBones_CCArmatureCacheDisplay_class = nullptr; + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setTimeScale(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setTimeScale : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setTimeScale : Error processing arguments"); + cobj->setTimeScale(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setTimeScale) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_render(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_render : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_render : Error processing arguments"); + cobj->render(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_render) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_addDBEventListener(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_addDBEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_addDBEventListener : Error processing arguments"); + cobj->addDBEventListener(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_addDBEventListener) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_removeDBEventListener(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_removeDBEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_removeDBEventListener : Error processing arguments"); + cobj->removeDBEventListener(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_removeDBEventListener) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onEnable(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onEnable) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setEffect(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setEffect : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + cocos2d::renderer::Effect* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setEffect : Error processing arguments"); + cobj->setEffect(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setEffect) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispose(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispose : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->dispose(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispose) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setOpacityModifyRGB(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setOpacityModifyRGB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + bool arg0; + ok &= seval_to_boolean(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setOpacityModifyRGB : Error processing arguments"); + cobj->setOpacityModifyRGB(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setOpacityModifyRGB) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + std::string arg0; + dragonBones::EventObject* arg1 = nullptr; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_native_ptr(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent : Error processing arguments"); + cobj->dispatchDBEvent(arg0, arg1); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_beginSchedule(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_beginSchedule : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->beginSchedule(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_beginSchedule) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAllAnimationCache(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAllAnimationCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->updateAllAnimationCache(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAllAnimationCache) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_update(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_update : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_update : Error processing arguments"); + cobj->update(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_update) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_playAnimation(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_playAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + std::string arg0; + int arg1 = 0; + ok &= seval_to_std_string(args[0], &arg0); + do { int32_t tmp = 0; ok &= seval_to_int32(args[1], &tmp); arg1 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_playAnimation : Error processing arguments"); + cobj->playAnimation(arg0, arg1); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_playAnimation) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setDBEventCallback(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setDBEventCallback : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::function arg0; + do { + if (args[0].isObject() && args[0].toObject()->isFunction()) + { + se::Value jsThis(s.thisObject()); + se::Value jsFunc(args[0]); + jsThis.toObject()->attachObject(jsFunc.toObject()); + auto lambda = [=](dragonBones::EventObject* larg0) -> void { + se::ScriptEngine::getInstance()->clearException(); + se::AutoHandleScope hs; + + CC_UNUSED bool ok = true; + se::ValueArray args; + args.resize(1); + ok &= native_ptr_to_rooted_seval((dragonBones::EventObject*)larg0, &args[0]); + se::Value rval; + se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; + se::Object* funcObj = jsFunc.toObject(); + bool succeed = funcObj->call(args, thisObj, &rval); + if (!succeed) { + se::ScriptEngine::getInstance()->clearException(); + } + }; + arg0 = lambda; + } + else + { + arg0 = nullptr; + } + } while(false) + ; + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setDBEventCallback : Error processing arguments"); + cobj->setDBEventCallback(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setDBEventCallback) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAnimationCache(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAnimationCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAnimationCache : Error processing arguments"); + cobj->updateAnimationCache(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAnimationCache) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getTimeScale(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getTimeScale : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTimeScale(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getTimeScale : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getTimeScale) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getAnimation(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + dragonBones::Animation* result = cobj->getAnimation(); + ok &= native_ptr_to_rooted_seval((dragonBones::Animation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getAnimation : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getAnimation) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onDisable(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onDisable) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setColor(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + cocos2d::Color4B arg0; + ok &= seval_to_Color4B(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setColor : Error processing arguments"); + cobj->setColor(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setColor) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_bindNodeProxy(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_bindNodeProxy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + cocos2d::renderer::NodeProxy* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_bindNodeProxy : Error processing arguments"); + cobj->bindNodeProxy(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_bindNodeProxy) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setBatchEnabled(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setBatchEnabled : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + bool arg0; + ok &= seval_to_boolean(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setBatchEnabled : Error processing arguments"); + cobj->setBatchEnabled(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setBatchEnabled) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getArmature(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getArmature : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + dragonBones::Armature* result = cobj->getArmature(); + ok &= native_ptr_to_rooted_seval((dragonBones::Armature*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getArmature : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getArmature) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_stopSchedule(se::State& s) +{ + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_stopSchedule : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->stopSchedule(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_stopSchedule) + +SE_DECLARE_FINALIZE_FUNC(js_dragonBones_CCArmatureCacheDisplay_finalize) + +static bool js_cocos2dx_dragonbones_CCArmatureCacheDisplay_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + std::string arg0; + std::string arg1; + std::string arg2; + bool arg3; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_std_string(args[1], &arg1); + ok &= seval_to_std_string(args[2], &arg2); + ok &= seval_to_boolean(args[3], &arg3); + SE_PRECONDITION2(ok, false, "js_cocos2dx_dragonbones_CCArmatureCacheDisplay_constructor : Error processing arguments"); + dragonBones::CCArmatureCacheDisplay* cobj = new (std::nothrow) dragonBones::CCArmatureCacheDisplay(arg0, arg1, arg2, arg3); + s.thisObject()->setPrivateData(cobj); + return true; +} +SE_BIND_CTOR(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_constructor, __jsb_dragonBones_CCArmatureCacheDisplay_class, js_dragonBones_CCArmatureCacheDisplay_finalize) + + + + +static bool js_dragonBones_CCArmatureCacheDisplay_finalize(se::State& s) +{ + CCLOGINFO("jsbindings: finalizing JS object %p (dragonBones::CCArmatureCacheDisplay)", s.nativeThisObject()); + dragonBones::CCArmatureCacheDisplay* cobj = (dragonBones::CCArmatureCacheDisplay*)s.nativeThisObject(); + cobj->release(); + return true; +} +SE_BIND_FINALIZE_FUNC(js_dragonBones_CCArmatureCacheDisplay_finalize) + +bool js_register_cocos2dx_dragonbones_CCArmatureCacheDisplay(se::Object* obj) +{ + auto cls = se::Class::create("CCArmatureCacheDisplay", obj, nullptr, _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_constructor)); + + cls->defineFunction("setTimeScale", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setTimeScale)); + cls->defineFunction("render", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_render)); + cls->defineFunction("addDBEventListener", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_addDBEventListener)); + cls->defineFunction("removeDBEventListener", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_removeDBEventListener)); + cls->defineFunction("onEnable", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onEnable)); + cls->defineFunction("setEffect", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setEffect)); + cls->defineFunction("dispose", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispose)); + cls->defineFunction("setOpacityModifyRGB", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setOpacityModifyRGB)); + cls->defineFunction("dispatchDBEvent", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent)); + cls->defineFunction("beginSchedule", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_beginSchedule)); + cls->defineFunction("updateAllAnimationCache", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAllAnimationCache)); + cls->defineFunction("update", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_update)); + cls->defineFunction("playAnimation", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_playAnimation)); + cls->defineFunction("setDBEventCallback", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setDBEventCallback)); + cls->defineFunction("updateAnimationCache", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAnimationCache)); + cls->defineFunction("getTimeScale", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getTimeScale)); + cls->defineFunction("getAnimation", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getAnimation)); + cls->defineFunction("onDisable", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onDisable)); + cls->defineFunction("setColor", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setColor)); + cls->defineFunction("bindNodeProxy", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_bindNodeProxy)); + cls->defineFunction("setBatchEnabled", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setBatchEnabled)); + cls->defineFunction("armature", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getArmature)); + cls->defineFunction("stopSchedule", _SE(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_stopSchedule)); + cls->defineFinalizeFunction(_SE(js_dragonBones_CCArmatureCacheDisplay_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_dragonBones_CCArmatureCacheDisplay_proto = cls->getProto(); + __jsb_dragonBones_CCArmatureCacheDisplay_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + bool register_all_cocos2dx_dragonbones(se::Object* obj) { // Get the ns @@ -7232,11 +7898,13 @@ bool register_all_cocos2dx_dragonbones(se::Object* obj) js_register_cocos2dx_dragonbones_CCSlot(ns); js_register_cocos2dx_dragonbones_Armature(ns); js_register_cocos2dx_dragonbones_Bone(ns); + js_register_cocos2dx_dragonbones_ArmatureCacheMgr(ns); js_register_cocos2dx_dragonbones_SkinData(ns); js_register_cocos2dx_dragonbones_EventObject(ns); js_register_cocos2dx_dragonbones_SlotData(ns); js_register_cocos2dx_dragonbones_DragonBonesData(ns); js_register_cocos2dx_dragonbones_AnimationData(ns); + js_register_cocos2dx_dragonbones_CCArmatureCacheDisplay(ns); return true; } diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp index 78881b29d1..bf6e55e261 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp @@ -384,15 +384,57 @@ SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_removeDragonBonesDataByUUID); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_update); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_remove); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_getTextureAtlasDataByIndex); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_getDragonBones); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_parseDragonBonesDataByPath); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_add); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_buildArmatureDisplay); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_stopSchedule); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_removeTextureAtlasDataByIndex); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_getTimeScale); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_isInit); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_destroyFactory); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_getClock); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_getFactory); SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCFactory_CCFactory); +extern se::Object* __jsb_dragonBones_ArmatureCacheMgr_proto; +extern se::Class* __jsb_dragonBones_ArmatureCacheMgr_class; + +bool js_register_dragonBones_ArmatureCacheMgr(se::Object* obj); +bool register_all_cocos2dx_dragonbones(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_removeArmatureCache); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_buildArmatureCache); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_destroyInstance); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_ArmatureCacheMgr_getInstance); + +extern se::Object* __jsb_dragonBones_CCArmatureCacheDisplay_proto; +extern se::Class* __jsb_dragonBones_CCArmatureCacheDisplay_class; + +bool js_register_dragonBones_CCArmatureCacheDisplay(se::Object* obj); +bool register_all_cocos2dx_dragonbones(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_render); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_addDBEventListener); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_removeDBEventListener); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onEnable); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setEffect); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispose); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setOpacityModifyRGB); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_beginSchedule); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAllAnimationCache); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_update); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_playAnimation); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setDBEventCallback); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_updateAnimationCache); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getAnimation); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_onDisable); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setColor); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_bindNodeProxy); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_setBatchEnabled); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_getArmature); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_stopSchedule); +SE_DECLARE_FUNC(js_cocos2dx_dragonbones_CCArmatureCacheDisplay_CCArmatureCacheDisplay); + #endif //#if USE_DRAGONBONES > 0 diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp index 88b6058964..0020b8760e 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp @@ -14226,6 +14226,845 @@ bool js_register_cocos2dx_spine_SkeletonDataMgr(se::Object* obj) return true; } +se::Object* __jsb_spine_SkeletonCacheMgr_proto = nullptr; +se::Class* __jsb_spine_SkeletonCacheMgr_class = nullptr; + +static bool js_cocos2dx_spine_SkeletonCacheMgr_removeSkeletonCache(se::State& s) +{ + spine::SkeletonCacheMgr* cobj = (spine::SkeletonCacheMgr*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheMgr_removeSkeletonCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheMgr_removeSkeletonCache : Error processing arguments"); + cobj->removeSkeletonCache(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_removeSkeletonCache) + +static bool js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache(se::State& s) +{ + spine::SkeletonCacheMgr* cobj = (spine::SkeletonCacheMgr*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache : Error processing arguments"); + spine::SkeletonCache* result = cobj->buildSkeletonCache(arg0); + ok &= native_ptr_to_seval((spine::SkeletonCache*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache) + +static bool js_cocos2dx_spine_SkeletonCacheMgr_destroyInstance(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + spine::SkeletonCacheMgr::destroyInstance(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_destroyInstance) + +static bool js_cocos2dx_spine_SkeletonCacheMgr_getInstance(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SkeletonCacheMgr* result = spine::SkeletonCacheMgr::getInstance(); + ok &= native_ptr_to_seval((spine::SkeletonCacheMgr*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheMgr_getInstance : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_getInstance) + + + +static bool js_spine_SkeletonCacheMgr_finalize(se::State& s) +{ + CCLOGINFO("jsbindings: finalizing JS object %p (spine::SkeletonCacheMgr)", s.nativeThisObject()); + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + spine::SkeletonCacheMgr* cobj = (spine::SkeletonCacheMgr*)s.nativeThisObject(); + delete cobj; + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_spine_SkeletonCacheMgr_finalize) + +bool js_register_cocos2dx_spine_SkeletonCacheMgr(se::Object* obj) +{ + auto cls = se::Class::create("SkeletonCacheMgr", obj, nullptr, nullptr); + + cls->defineFunction("removeSkeletonCache", _SE(js_cocos2dx_spine_SkeletonCacheMgr_removeSkeletonCache)); + cls->defineFunction("buildSkeletonCache", _SE(js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache)); + cls->defineStaticFunction("destroyInstance", _SE(js_cocos2dx_spine_SkeletonCacheMgr_destroyInstance)); + cls->defineStaticFunction("getInstance", _SE(js_cocos2dx_spine_SkeletonCacheMgr_getInstance)); + cls->defineFinalizeFunction(_SE(js_spine_SkeletonCacheMgr_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_SkeletonCacheMgr_proto = cls->getProto(); + __jsb_spine_SkeletonCacheMgr_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_SkeletonCacheAnimation_proto = nullptr; +se::Class* __jsb_spine_SkeletonCacheAnimation_class = nullptr; + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale : Error processing arguments"); + cobj->setTimeScale(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation : Error processing arguments"); + spine::Animation* result = cobj->findAnimation(arg0); + ok &= native_ptr_to_rooted_seval((spine::Animation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setCompleteListener(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setCompleteListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::function arg0; + do { + if (args[0].isObject() && args[0].toObject()->isFunction()) + { + se::Value jsThis(s.thisObject()); + se::Value jsFunc(args[0]); + jsThis.toObject()->attachObject(jsFunc.toObject()); + auto lambda = [=](std::string larg0) -> void { + se::ScriptEngine::getInstance()->clearException(); + se::AutoHandleScope hs; + + CC_UNUSED bool ok = true; + se::ValueArray args; + args.resize(1); + ok &= std_string_to_seval(larg0, &args[0]); + se::Value rval; + se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; + se::Object* funcObj = jsFunc.toObject(); + bool succeed = funcObj->call(args, thisObj, &rval); + if (!succeed) { + se::ScriptEngine::getInstance()->clearException(); + } + }; + arg0 = lambda; + } + else + { + arg0 = nullptr; + } + } while(false) + ; + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setCompleteListener : Error processing arguments"); + cobj->setCompleteListener(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setCompleteListener) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_paused(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_paused : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + bool arg0; + ok &= seval_to_boolean(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_paused : Error processing arguments"); + cobj->paused(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_paused) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 2) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + if (!ok) { ok = true; break; } + const char* arg1 = nullptr; + std::string arg1_tmp; ok &= seval_to_std_string(args[1], &arg1_tmp); arg1 = arg1_tmp.c_str(); + if (!ok) { ok = true; break; } + bool result = cobj->setAttachment(arg0, arg1); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment : Error processing arguments"); + return true; + } + } while(false); + + do { + if (argc == 2) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= seval_to_std_string(args[1], &arg1); + if (!ok) { ok = true; break; } + bool result = cobj->setAttachment(arg0, arg1); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment : Error processing arguments"); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + std::string arg0; + bool arg1; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation : Error processing arguments"); + cobj->setAnimation(arg0, arg1); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_onEnable(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_onEnable) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setStartListener(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setStartListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::function arg0; + do { + if (args[0].isObject() && args[0].toObject()->isFunction()) + { + se::Value jsThis(s.thisObject()); + se::Value jsFunc(args[0]); + jsThis.toObject()->attachObject(jsFunc.toObject()); + auto lambda = [=](std::string larg0) -> void { + se::ScriptEngine::getInstance()->clearException(); + se::AutoHandleScope hs; + + CC_UNUSED bool ok = true; + se::ValueArray args; + args.resize(1); + ok &= std_string_to_seval(larg0, &args[0]); + se::Value rval; + se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; + se::Object* funcObj = jsFunc.toObject(); + bool succeed = funcObj->call(args, thisObj, &rval); + if (!succeed) { + se::ScriptEngine::getInstance()->clearException(); + } + }; + arg0 = lambda; + } + else + { + arg0 = nullptr; + } + } while(false) + ; + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setStartListener : Error processing arguments"); + cobj->setStartListener(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setStartListener) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setEffect(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setEffect : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + cocos2d::renderer::Effect* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setEffect : Error processing arguments"); + cobj->setEffect(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setEffect) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_isOpacityModifyRGB(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_isOpacityModifyRGB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isOpacityModifyRGB(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_isOpacityModifyRGB : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_isOpacityModifyRGB) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setOpacityModifyRGB(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setOpacityModifyRGB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + bool arg0; + ok &= seval_to_boolean(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setOpacityModifyRGB : Error processing arguments"); + cobj->setOpacityModifyRGB(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setOpacityModifyRGB) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setEndListener(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setEndListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::function arg0; + do { + if (args[0].isObject() && args[0].toObject()->isFunction()) + { + se::Value jsThis(s.thisObject()); + se::Value jsFunc(args[0]); + jsThis.toObject()->attachObject(jsFunc.toObject()); + auto lambda = [=](std::string larg0) -> void { + se::ScriptEngine::getInstance()->clearException(); + se::AutoHandleScope hs; + + CC_UNUSED bool ok = true; + se::ValueArray args; + args.resize(1); + ok &= std_string_to_seval(larg0, &args[0]); + se::Value rval; + se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; + se::Object* funcObj = jsFunc.toObject(); + bool succeed = funcObj->call(args, thisObj, &rval); + if (!succeed) { + se::ScriptEngine::getInstance()->clearException(); + } + }; + arg0 = lambda; + } + else + { + arg0 = nullptr; + } + } while(false) + ; + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setEndListener : Error processing arguments"); + cobj->setEndListener(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setEndListener) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_beginSchedule(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_beginSchedule : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->beginSchedule(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_beginSchedule) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_updateAllAnimationCache(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_updateAllAnimationCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->updateAllAnimationCache(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_updateAllAnimationCache) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + std::string arg0; + bool arg1; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation : Error processing arguments"); + cobj->addAnimation(arg0, arg1); + return true; + } + if (argc == 3) { + std::string arg0; + bool arg1; + float arg2 = 0; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation : Error processing arguments"); + cobj->addAnimation(arg0, arg1, arg2); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_update(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_update : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_update : Error processing arguments"); + cobj->update(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_update) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + std::string arg0; + std::string arg1; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_std_string(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment : Error processing arguments"); + spine::Attachment* result = cobj->getAttachment(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::Attachment*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_updateAnimationCache(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_updateAnimationCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_updateAnimationCache : Error processing arguments"); + cobj->updateAnimationCache(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_updateAnimationCache) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_getTimeScale(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getTimeScale : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTimeScale(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getTimeScale : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_getTimeScale) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_findBone(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findBone : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findBone : Error processing arguments"); + spine::Bone* result = cobj->findBone(arg0); + ok &= native_ptr_to_rooted_seval((spine::Bone*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findBone : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findBone) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_onDisable(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_onDisable) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setColor(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + cocos2d::Color4B arg0; + ok &= seval_to_Color4B(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setColor : Error processing arguments"); + cobj->setColor(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setColor) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_bindNodeProxy(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_bindNodeProxy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + cocos2d::renderer::NodeProxy* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_bindNodeProxy : Error processing arguments"); + cobj->bindNodeProxy(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_bindNodeProxy) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setBatchEnabled(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setBatchEnabled : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + bool arg0; + ok &= seval_to_boolean(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setBatchEnabled : Error processing arguments"); + cobj->setBatchEnabled(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setBatchEnabled) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_setSkin(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setSkin : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 1) { + const char* arg0 = nullptr; + std::string arg0_tmp; ok &= seval_to_std_string(args[0], &arg0_tmp); arg0 = arg0_tmp.c_str(); + if (!ok) { ok = true; break; } + cobj->setSkin(arg0); + return true; + } + } while(false); + + do { + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + if (!ok) { ok = true; break; } + cobj->setSkin(arg0); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setSkin) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_findSlot(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findSlot : Error processing arguments"); + spine::Slot* result = cobj->findSlot(arg0); + ok &= native_ptr_to_rooted_seval((spine::Slot*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_findSlot : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findSlot) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_getSkeleton(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getSkeleton : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Skeleton* result = cobj->getSkeleton(); + ok &= native_ptr_to_rooted_seval((spine::Skeleton*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_getSkeleton : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_getSkeleton) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_stopSchedule(se::State& s) +{ + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_stopSchedule : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->stopSchedule(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_stopSchedule) + +SE_DECLARE_FINALIZE_FUNC(js_spine_SkeletonCacheAnimation_finalize) + +static bool js_cocos2dx_spine_SkeletonCacheAnimation_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + std::string arg0; + bool arg1; + ok &= seval_to_std_string(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_constructor : Error processing arguments"); + spine::SkeletonCacheAnimation* cobj = new (std::nothrow) spine::SkeletonCacheAnimation(arg0, arg1); + s.thisObject()->setPrivateData(cobj); + return true; +} +SE_BIND_CTOR(js_cocos2dx_spine_SkeletonCacheAnimation_constructor, __jsb_spine_SkeletonCacheAnimation_class, js_spine_SkeletonCacheAnimation_finalize) + + + + +static bool js_spine_SkeletonCacheAnimation_finalize(se::State& s) +{ + CCLOGINFO("jsbindings: finalizing JS object %p (spine::SkeletonCacheAnimation)", s.nativeThisObject()); + spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject(); + cobj->release(); + return true; +} +SE_BIND_FINALIZE_FUNC(js_spine_SkeletonCacheAnimation_finalize) + +bool js_register_cocos2dx_spine_SkeletonCacheAnimation(se::Object* obj) +{ + auto cls = se::Class::create("SkeletonCacheAnimation", obj, nullptr, _SE(js_cocos2dx_spine_SkeletonCacheAnimation_constructor)); + + cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale)); + cls->defineFunction("findAnimation", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation)); + cls->defineFunction("setCompleteListener", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setCompleteListener)); + cls->defineFunction("paused", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_paused)); + cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment)); + cls->defineFunction("setAnimation", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation)); + cls->defineFunction("onEnable", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_onEnable)); + cls->defineFunction("setStartListener", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setStartListener)); + cls->defineFunction("setEffect", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setEffect)); + cls->defineFunction("isOpacityModifyRGB", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_isOpacityModifyRGB)); + cls->defineFunction("setOpacityModifyRGB", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setOpacityModifyRGB)); + cls->defineFunction("setEndListener", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setEndListener)); + cls->defineFunction("beginSchedule", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_beginSchedule)); + cls->defineFunction("updateAllAnimationCache", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_updateAllAnimationCache)); + cls->defineFunction("addAnimation", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_update)); + cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment)); + cls->defineFunction("updateAnimationCache", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_updateAnimationCache)); + cls->defineFunction("getTimeScale", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_getTimeScale)); + cls->defineFunction("findBone", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_findBone)); + cls->defineFunction("onDisable", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_onDisable)); + cls->defineFunction("setColor", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setColor)); + cls->defineFunction("bindNodeProxy", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_bindNodeProxy)); + cls->defineFunction("setBatchEnabled", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setBatchEnabled)); + cls->defineFunction("setSkin", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setSkin)); + cls->defineFunction("findSlot", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_findSlot)); + cls->defineFunction("getSkeleton", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_getSkeleton)); + cls->defineFunction("stopSchedule", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_stopSchedule)); + cls->defineFinalizeFunction(_SE(js_spine_SkeletonCacheAnimation_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_SkeletonCacheAnimation_proto = cls->getProto(); + __jsb_spine_SkeletonCacheAnimation_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + bool register_all_cocos2dx_spine(se::Object* obj) { // Get the ns @@ -14244,11 +15083,13 @@ bool register_all_cocos2dx_spine(se::Object* obj) js_register_cocos2dx_spine_TranslateTimeline(ns); js_register_cocos2dx_spine_ShearTimeline(ns); js_register_cocos2dx_spine_Polygon(ns); + js_register_cocos2dx_spine_SkeletonCacheAnimation(ns); js_register_cocos2dx_spine_Attachment(ns); js_register_cocos2dx_spine_VertexAttachment(ns); js_register_cocos2dx_spine_SkeletonDataMgr(ns); js_register_cocos2dx_spine_VertexEffect(ns); js_register_cocos2dx_spine_JitterVertexEffect(ns); + js_register_cocos2dx_spine_SkeletonCacheMgr(ns); js_register_cocos2dx_spine_IkConstraintTimeline(ns); js_register_cocos2dx_spine_SkeletonRenderer(ns); js_register_cocos2dx_spine_Animation(ns); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp index f5f7457d64..c1e47fbb56 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp @@ -944,4 +944,49 @@ SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonDataMgr_setDestroyCallback); SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonDataMgr_getInstance); SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonDataMgr_SkeletonDataMgr); +extern se::Object* __jsb_spine_SkeletonCacheMgr_proto; +extern se::Class* __jsb_spine_SkeletonCacheMgr_class; + +bool js_register_spine_SkeletonCacheMgr(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_removeSkeletonCache); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_buildSkeletonCache); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_destroyInstance); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheMgr_getInstance); + +extern se::Object* __jsb_spine_SkeletonCacheAnimation_proto; +extern se::Class* __jsb_spine_SkeletonCacheAnimation_class; + +bool js_register_spine_SkeletonCacheAnimation(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setCompleteListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_paused); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_onEnable); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setStartListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setEffect); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_isOpacityModifyRGB); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setOpacityModifyRGB); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setEndListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_beginSchedule); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_updateAllAnimationCache); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_addAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_getAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_updateAnimationCache); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_getTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findBone); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_onDisable); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_bindNodeProxy); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setBatchEnabled); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findSlot); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_getSkeleton); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_stopSchedule); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_SkeletonCacheAnimation); + #endif //#if USE_SPINE > 0 diff --git a/native/templates/cocos2dx_files.json b/native/templates/cocos2dx_files.json index 3f87d9a0f2..86f9977441 100644 --- a/native/templates/cocos2dx_files.json +++ b/native/templates/cocos2dx_files.json @@ -162,6 +162,12 @@ "cocos/editor-support/MiddlewareManager.h", "cocos/editor-support/TypedArrayPool.cpp", "cocos/editor-support/TypedArrayPool.h", + "cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp", + "cocos/editor-support/dragonbones-creator-support/ArmatureCache.h", + "cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp", + "cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h", + "cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp", + "cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h", "cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp", "cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h", "cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h", @@ -248,6 +254,12 @@ "cocos/editor-support/spine-creator-support/AttachmentVertices.h", "cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp", "cocos/editor-support/spine-creator-support/SkeletonAnimation.h", + "cocos/editor-support/spine-creator-support/SkeletonCache.cpp", + "cocos/editor-support/spine-creator-support/SkeletonCache.h", + "cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp", + "cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h", + "cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp", + "cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h", "cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp", "cocos/editor-support/spine-creator-support/SkeletonDataMgr.h", "cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp", diff --git a/native/tools/bindings-generator b/native/tools/bindings-generator index 6b750dd800..16aee008e3 160000 --- a/native/tools/bindings-generator +++ b/native/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 6b750dd80044d810a277765c0dacd470aa89e2bb +Subproject commit 16aee008e3b4803a8bfcdb52db43c35a8513aa90 diff --git a/native/tools/tojs/cocos2dx_dragonbones.ini b/native/tools/tojs/cocos2dx_dragonbones.ini index 98470339f9..76e6f9fc83 100644 --- a/native/tools/tojs/cocos2dx_dragonbones.ini +++ b/native/tools/tojs/cocos2dx_dragonbones.ini @@ -22,7 +22,7 @@ extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s headers = %(cocosdir)s/cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h -classes = DragonBonesData CCFactory CCArmatureDisplay Armature CCSlot WorldClock Animation Slot BaseFactory BaseObject TextureData CCTextureData TextureAtlasData CCTextureAtlasData AnimationState EventObject Bone Transform Matrix TransformObject ArmatureData BoneData SlotData SkinData AnimationData +classes = DragonBonesData CCFactory CCArmatureDisplay Armature CCSlot WorldClock Animation Slot BaseFactory BaseObject TextureData CCTextureData TextureAtlasData CCTextureAtlasData AnimationState EventObject Bone Transform Matrix TransformObject ArmatureData BoneData SlotData SkinData AnimationData CCArmatureCacheDisplay ArmatureCacheMgr abstract_classes = DragonBonesData Armature CCSlot WorldClock Animation Slot BaseFactory BaseObject TextureData CCTextureData TextureAtlasData CCTextureAtlasData AnimationState EventObject Bone Transform Matrix TransformObject ArmatureData BoneData SlotData SkinData AnimationData @@ -48,7 +48,8 @@ skip = CCFactory::[destroyInstance loadDragonBonesData loadTextureAtlasData], EventObject::[getTypeIndex], TextureData::[copyFrom], CCTextureAtlasData::[getTypeIndex], - CCTextureData::[getTypeIndex] + CCTextureData::[getTypeIndex], + CCArmatureDisplay::[render update] field = Transform::[x y skew scaleX scaleY rotation], Slot::[displayController], @@ -70,7 +71,8 @@ classes_have_no_parents = WorldClock Slot AnimationData base_classes_to_skip = Ref IArmatureProxy IAnimatable IMiddleware -rename_functions = CCArmatureDisplay::[getArmature=armature], +rename_functions = CCArmatureCacheDisplay::[getArmature=armature], + CCArmatureDisplay::[getArmature=armature], CCFactory::[getFactory=getInstance] rename_classes = diff --git a/native/tools/tojs/cocos2dx_spine.ini b/native/tools/tojs/cocos2dx_spine.ini index 04f1233de1..91a19efc7d 100644 --- a/native/tools/tojs/cocos2dx_spine.ini +++ b/native/tools/tojs/cocos2dx_spine.ini @@ -24,7 +24,7 @@ headers = %(cocosdir)s/cocos/editor-support/spine-creator-support/spine-cocos2dx replace_headers = spine-cocos2dx.h::spine-creator-support/spine-cocos2dx.h -classes = SkeletonRenderer SkeletonAnimation VertexEffectDelegate Animation TrackEntry AnimationState AnimationStateData Attachment AttachmentTimeline BoundingBoxAttachment Bone BoneData ClippingAttachment Color ColorTimeline CurveTimeline DeformTimeline DrawOrderTimeline Event EventData EventTimeline IkConstraint IkConstraintData IkConstraintTimeline MeshAttachment Polygon PathAttachment PathConstraint PathConstraintData PathConstraintMixTimeline PathConstraintPositionTimeline PathConstraintSpacingTimeline PointAttachment RegionAttachment RotateTimeline ScaleTimeline ShearTimeline Skeleton Slot Skin SkeletonBounds SkeletonData SlotData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect SkeletonDataMgr +classes = SkeletonRenderer SkeletonAnimation VertexEffectDelegate Animation TrackEntry AnimationState AnimationStateData Attachment AttachmentTimeline BoundingBoxAttachment Bone BoneData ClippingAttachment Color ColorTimeline CurveTimeline DeformTimeline DrawOrderTimeline Event EventData EventTimeline IkConstraint IkConstraintData IkConstraintTimeline MeshAttachment Polygon PathAttachment PathConstraint PathConstraintData PathConstraintMixTimeline PathConstraintPositionTimeline PathConstraintSpacingTimeline PointAttachment RegionAttachment RotateTimeline ScaleTimeline ShearTimeline Skeleton Slot Skin SkeletonBounds SkeletonData SlotData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect SkeletonDataMgr SkeletonCacheAnimation SkeletonCacheMgr classes_need_extend = SkeletonAnimation @@ -69,7 +69,8 @@ skip = SkeletonRenderer::[create createWithData initWithData createWithSkeleton JitterVertexEffect::[begin transform end], SwirlVertexEffect::[begin transform end], VertexAttachment::[computeWorldVertices getBones getRTTI], - SkeletonDataMgr::[destroyInstance hasSkeletonData setSkeletonData retainByUUID releaseByUUID] + SkeletonDataMgr::[destroyInstance hasSkeletonData setSkeletonData retainByUUID releaseByUUID], + SkeletonCacheAnimation::[render] field = Color::[r g b a]