diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 84e2a70bd1f..9b14608446e 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -7,172 +7,298 @@ objects = { /* Begin PBXBuildFile section */ - 0430122121DCF2B80007084D /* Atlas.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D021DCF2A70007084D /* Atlas.c */; }; - 0430122221DCF2B80007084D /* Atlas.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D021DCF2A70007084D /* Atlas.c */; }; - 0430122321DCF2B80007084D /* Attachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D121DCF2A70007084D /* Attachment.h */; }; - 0430122421DCF2B80007084D /* Attachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D121DCF2A70007084D /* Attachment.h */; }; - 0430122521DCF2B80007084D /* BoundingBoxAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D221DCF2A70007084D /* BoundingBoxAttachment.h */; }; - 0430122621DCF2B80007084D /* BoundingBoxAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D221DCF2A70007084D /* BoundingBoxAttachment.h */; }; - 0430122721DCF2B80007084D /* PathConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D321DCF2A70007084D /* PathConstraint.c */; }; - 0430122821DCF2B80007084D /* PathConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D321DCF2A70007084D /* PathConstraint.c */; }; - 0430122921DCF2B80007084D /* MeshAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D421DCF2A80007084D /* MeshAttachment.h */; }; - 0430122A21DCF2B80007084D /* MeshAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D421DCF2A80007084D /* MeshAttachment.h */; }; - 0430122B21DCF2B80007084D /* ClippingAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D521DCF2A80007084D /* ClippingAttachment.h */; }; - 0430122C21DCF2B80007084D /* ClippingAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D521DCF2A80007084D /* ClippingAttachment.h */; }; - 0430122D21DCF2B80007084D /* Animation.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D621DCF2A80007084D /* Animation.h */; }; - 0430122E21DCF2B80007084D /* Animation.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D621DCF2A80007084D /* Animation.h */; }; - 0430122F21DCF2B80007084D /* EventData.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D721DCF2A80007084D /* EventData.h */; }; - 0430123021DCF2B80007084D /* EventData.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011D721DCF2A80007084D /* EventData.h */; }; - 0430123121DCF2B80007084D /* VertexEffect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D821DCF2A80007084D /* VertexEffect.c */; }; - 0430123221DCF2B80007084D /* VertexEffect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D821DCF2A80007084D /* VertexEffect.c */; }; - 0430123321DCF2B80007084D /* AttachmentLoader.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D921DCF2A80007084D /* AttachmentLoader.c */; }; - 0430123421DCF2B80007084D /* AttachmentLoader.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011D921DCF2A80007084D /* AttachmentLoader.c */; }; - 0430123521DCF2B80007084D /* extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011DA21DCF2A80007084D /* extension.h */; }; - 0430123621DCF2B80007084D /* extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011DA21DCF2A80007084D /* extension.h */; }; - 0430123721DCF2B80007084D /* BoneData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011DB21DCF2A90007084D /* BoneData.c */; }; - 0430123821DCF2B80007084D /* BoneData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011DB21DCF2A90007084D /* BoneData.c */; }; - 0430123921DCF2B80007084D /* Slot.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011DC21DCF2A90007084D /* Slot.c */; }; - 0430123A21DCF2B80007084D /* Slot.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011DC21DCF2A90007084D /* Slot.c */; }; - 0430123B21DCF2B80007084D /* PathConstraintData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011DD21DCF2A90007084D /* PathConstraintData.c */; }; - 0430123C21DCF2B80007084D /* PathConstraintData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011DD21DCF2A90007084D /* PathConstraintData.c */; }; - 0430123D21DCF2B80007084D /* spine.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011DE21DCF2A90007084D /* spine.h */; }; - 0430123E21DCF2B80007084D /* spine.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011DE21DCF2A90007084D /* spine.h */; }; - 0430123F21DCF2B80007084D /* Color.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011DF21DCF2A90007084D /* Color.h */; }; - 0430124021DCF2B80007084D /* Color.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011DF21DCF2A90007084D /* Color.h */; }; - 0430124121DCF2B80007084D /* TransformConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E021DCF2A90007084D /* TransformConstraint.c */; }; - 0430124221DCF2B80007084D /* TransformConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E021DCF2A90007084D /* TransformConstraint.c */; }; - 0430124321DCF2B80007084D /* SkeletonJson.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E121DCF2AA0007084D /* SkeletonJson.h */; }; - 0430124421DCF2B80007084D /* SkeletonJson.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E121DCF2AA0007084D /* SkeletonJson.h */; }; - 0430124521DCF2B80007084D /* Json.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E221DCF2AA0007084D /* Json.c */; }; - 0430124621DCF2B80007084D /* Json.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E221DCF2AA0007084D /* Json.c */; }; - 0430124721DCF2B80007084D /* Skin.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E321DCF2AA0007084D /* Skin.h */; }; - 0430124821DCF2B80007084D /* Skin.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E321DCF2AA0007084D /* Skin.h */; }; - 0430124921DCF2B80007084D /* Triangulator.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E421DCF2AA0007084D /* Triangulator.c */; }; - 0430124A21DCF2B80007084D /* Triangulator.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E421DCF2AA0007084D /* Triangulator.c */; }; - 0430124B21DCF2B80007084D /* TransformConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E521DCF2AA0007084D /* TransformConstraint.h */; }; - 0430124C21DCF2B80007084D /* TransformConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E521DCF2AA0007084D /* TransformConstraint.h */; }; - 0430124D21DCF2B80007084D /* SkeletonBinary.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E621DCF2AA0007084D /* SkeletonBinary.h */; }; - 0430124E21DCF2B80007084D /* SkeletonBinary.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011E621DCF2AA0007084D /* SkeletonBinary.h */; }; - 0430124F21DCF2B80007084D /* Skeleton.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E721DCF2AB0007084D /* Skeleton.c */; }; - 0430125021DCF2B80007084D /* Skeleton.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E721DCF2AB0007084D /* Skeleton.c */; }; - 0430125121DCF2B80007084D /* TransformConstraintData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E821DCF2AB0007084D /* TransformConstraintData.c */; }; - 0430125221DCF2B80007084D /* TransformConstraintData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E821DCF2AB0007084D /* TransformConstraintData.c */; }; - 0430125321DCF2B80007084D /* AnimationState.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E921DCF2AB0007084D /* AnimationState.c */; }; - 0430125421DCF2B80007084D /* AnimationState.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011E921DCF2AB0007084D /* AnimationState.c */; }; - 0430125521DCF2B80007084D /* Color.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011EA21DCF2AB0007084D /* Color.c */; }; - 0430125621DCF2B80007084D /* Color.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011EA21DCF2AB0007084D /* Color.c */; }; - 0430125721DCF2B80007084D /* Bone.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EB21DCF2AB0007084D /* Bone.h */; }; - 0430125821DCF2B80007084D /* Bone.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EB21DCF2AB0007084D /* Bone.h */; }; - 0430125921DCF2B80007084D /* AtlasAttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EC21DCF2AB0007084D /* AtlasAttachmentLoader.h */; }; - 0430125A21DCF2B80007084D /* AtlasAttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EC21DCF2AB0007084D /* AtlasAttachmentLoader.h */; }; - 0430125B21DCF2B80007084D /* RegionAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011ED21DCF2AC0007084D /* RegionAttachment.h */; }; - 0430125C21DCF2B80007084D /* RegionAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011ED21DCF2AC0007084D /* RegionAttachment.h */; }; - 0430125D21DCF2B80007084D /* BoneData.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EE21DCF2AC0007084D /* BoneData.h */; }; - 0430125E21DCF2B80007084D /* BoneData.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EE21DCF2AC0007084D /* BoneData.h */; }; - 0430125F21DCF2B80007084D /* Atlas.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EF21DCF2AC0007084D /* Atlas.h */; }; - 0430126021DCF2B80007084D /* Atlas.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011EF21DCF2AC0007084D /* Atlas.h */; }; - 0430126121DCF2B80007084D /* EventData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F021DCF2AC0007084D /* EventData.c */; }; - 0430126221DCF2B80007084D /* EventData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F021DCF2AC0007084D /* EventData.c */; }; - 0430126321DCF2B80007084D /* Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011F121DCF2AC0007084D /* Array.h */; }; - 0430126421DCF2B80007084D /* Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011F121DCF2AC0007084D /* Array.h */; }; - 0430126521DCF2B80007084D /* BoundingBoxAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F221DCF2AD0007084D /* BoundingBoxAttachment.c */; }; - 0430126621DCF2B80007084D /* BoundingBoxAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F221DCF2AD0007084D /* BoundingBoxAttachment.c */; }; - 0430126721DCF2B80007084D /* Triangulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011F321DCF2AD0007084D /* Triangulator.h */; }; - 0430126821DCF2B80007084D /* Triangulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011F321DCF2AD0007084D /* Triangulator.h */; }; - 0430126921DCF2B80007084D /* ClippingAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F421DCF2AD0007084D /* ClippingAttachment.c */; }; - 0430126A21DCF2B80007084D /* ClippingAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F421DCF2AD0007084D /* ClippingAttachment.c */; }; - 0430126B21DCF2B80007084D /* Bone.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F521DCF2AD0007084D /* Bone.c */; }; - 0430126C21DCF2B80007084D /* Bone.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F521DCF2AD0007084D /* Bone.c */; }; - 0430126D21DCF2B80007084D /* RegionAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F621DCF2AD0007084D /* RegionAttachment.c */; }; - 0430126E21DCF2B80007084D /* RegionAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F621DCF2AD0007084D /* RegionAttachment.c */; }; - 0430126F21DCF2B80007084D /* PathAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011F721DCF2AE0007084D /* PathAttachment.h */; }; - 0430127021DCF2B80007084D /* PathAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011F721DCF2AE0007084D /* PathAttachment.h */; }; - 0430127121DCF2B80007084D /* SkeletonBounds.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F821DCF2AE0007084D /* SkeletonBounds.c */; }; - 0430127221DCF2B80007084D /* SkeletonBounds.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F821DCF2AE0007084D /* SkeletonBounds.c */; }; - 0430127321DCF2B80007084D /* SlotData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F921DCF2AE0007084D /* SlotData.c */; }; - 0430127421DCF2B80007084D /* SlotData.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011F921DCF2AE0007084D /* SlotData.c */; }; - 0430127521DCF2B80007084D /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FA21DCF2AF0007084D /* AnimationState.h */; }; - 0430127621DCF2B80007084D /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FA21DCF2AF0007084D /* AnimationState.h */; }; - 0430127721DCF2B80007084D /* SkeletonClipping.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FB21DCF2AF0007084D /* SkeletonClipping.h */; }; - 0430127821DCF2B80007084D /* SkeletonClipping.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FB21DCF2AF0007084D /* SkeletonClipping.h */; }; - 0430127921DCF2B80007084D /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FC21DCF2AF0007084D /* Event.h */; }; - 0430127A21DCF2B80007084D /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FC21DCF2AF0007084D /* Event.h */; }; - 0430127B21DCF2B80007084D /* SkeletonClipping.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011FD21DCF2AF0007084D /* SkeletonClipping.c */; }; - 0430127C21DCF2B80007084D /* SkeletonClipping.c in Sources */ = {isa = PBXBuildFile; fileRef = 043011FD21DCF2AF0007084D /* SkeletonClipping.c */; }; - 0430127D21DCF2B80007084D /* VertexEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FE21DCF2B00007084D /* VertexEffect.h */; }; - 0430127E21DCF2B80007084D /* VertexEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FE21DCF2B00007084D /* VertexEffect.h */; }; - 0430127F21DCF2B80007084D /* TransformConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FF21DCF2B00007084D /* TransformConstraintData.h */; }; - 0430128021DCF2B80007084D /* TransformConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 043011FF21DCF2B00007084D /* TransformConstraintData.h */; }; - 0430128121DCF2B80007084D /* AtlasAttachmentLoader.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120021DCF2B00007084D /* AtlasAttachmentLoader.c */; }; - 0430128221DCF2B80007084D /* AtlasAttachmentLoader.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120021DCF2B00007084D /* AtlasAttachmentLoader.c */; }; - 0430128321DCF2B80007084D /* Skin.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120121DCF2B00007084D /* Skin.c */; }; - 0430128421DCF2B80007084D /* Skin.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120121DCF2B00007084D /* Skin.c */; }; - 0430128521DCF2B80007084D /* PathConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120221DCF2B10007084D /* PathConstraint.h */; }; - 0430128621DCF2B80007084D /* PathConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120221DCF2B10007084D /* PathConstraint.h */; }; - 0430128721DCF2B80007084D /* PathConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120321DCF2B10007084D /* PathConstraintData.h */; }; - 0430128821DCF2B80007084D /* PathConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120321DCF2B10007084D /* PathConstraintData.h */; }; - 0430128921DCF2B80007084D /* IkConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120421DCF2B10007084D /* IkConstraint.c */; }; - 0430128A21DCF2B80007084D /* IkConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120421DCF2B10007084D /* IkConstraint.c */; }; - 0430128B21DCF2B80007084D /* SkeletonBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120521DCF2B10007084D /* SkeletonBounds.h */; }; - 0430128C21DCF2B80007084D /* SkeletonBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120521DCF2B10007084D /* SkeletonBounds.h */; }; - 0430128D21DCF2B80007084D /* SkeletonData.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120621DCF2B10007084D /* SkeletonData.c */; }; - 0430128E21DCF2B80007084D /* SkeletonData.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120621DCF2B10007084D /* SkeletonData.c */; }; - 0430128F21DCF2B80007084D /* PathAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120721DCF2B10007084D /* PathAttachment.c */; }; - 0430129021DCF2B80007084D /* PathAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120721DCF2B10007084D /* PathAttachment.c */; }; - 0430129121DCF2B80007084D /* SlotData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120821DCF2B20007084D /* SlotData.h */; }; - 0430129221DCF2B80007084D /* SlotData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120821DCF2B20007084D /* SlotData.h */; }; - 0430129321DCF2B80007084D /* Skeleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120921DCF2B20007084D /* Skeleton.h */; }; - 0430129421DCF2B80007084D /* Skeleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120921DCF2B20007084D /* Skeleton.h */; }; - 0430129521DCF2B80007084D /* Event.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120A21DCF2B20007084D /* Event.c */; }; - 0430129621DCF2B80007084D /* Event.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120A21DCF2B20007084D /* Event.c */; }; - 0430129721DCF2B80007084D /* Attachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120B21DCF2B20007084D /* Attachment.c */; }; - 0430129821DCF2B80007084D /* Attachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120B21DCF2B20007084D /* Attachment.c */; }; - 0430129921DCF2B80007084D /* AnimationStateData.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120C21DCF2B20007084D /* AnimationStateData.c */; }; - 0430129A21DCF2B80007084D /* AnimationStateData.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120C21DCF2B20007084D /* AnimationStateData.c */; }; - 0430129B21DCF2B80007084D /* AttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120D21DCF2B20007084D /* AttachmentLoader.h */; }; - 0430129C21DCF2B80007084D /* AttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120D21DCF2B20007084D /* AttachmentLoader.h */; }; - 0430129D21DCF2B80007084D /* IkConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120E21DCF2B30007084D /* IkConstraint.h */; }; - 0430129E21DCF2B80007084D /* IkConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430120E21DCF2B30007084D /* IkConstraint.h */; }; - 0430129F21DCF2B80007084D /* SkeletonBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120F21DCF2B30007084D /* SkeletonBinary.c */; }; - 043012A021DCF2B80007084D /* SkeletonBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430120F21DCF2B30007084D /* SkeletonBinary.c */; }; - 043012A121DCF2B80007084D /* VertexAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121021DCF2B30007084D /* VertexAttachment.h */; }; - 043012A221DCF2B80007084D /* VertexAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121021DCF2B30007084D /* VertexAttachment.h */; }; - 043012A321DCF2B80007084D /* PointAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121121DCF2B30007084D /* PointAttachment.h */; }; - 043012A421DCF2B80007084D /* PointAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121121DCF2B30007084D /* PointAttachment.h */; }; - 043012A521DCF2B80007084D /* SkeletonData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121221DCF2B30007084D /* SkeletonData.h */; }; - 043012A621DCF2B80007084D /* SkeletonData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121221DCF2B30007084D /* SkeletonData.h */; }; - 043012A721DCF2B80007084D /* Array.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121321DCF2B40007084D /* Array.c */; }; - 043012A821DCF2B80007084D /* Array.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121321DCF2B40007084D /* Array.c */; }; - 043012A921DCF2B80007084D /* Animation.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121421DCF2B40007084D /* Animation.c */; }; - 043012AA21DCF2B80007084D /* Animation.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121421DCF2B40007084D /* Animation.c */; }; - 043012AB21DCF2B80007084D /* AnimationStateData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121521DCF2B40007084D /* AnimationStateData.h */; }; - 043012AC21DCF2B80007084D /* AnimationStateData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121521DCF2B40007084D /* AnimationStateData.h */; }; - 043012AD21DCF2B80007084D /* MeshAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121621DCF2B40007084D /* MeshAttachment.c */; }; - 043012AE21DCF2B80007084D /* MeshAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121621DCF2B40007084D /* MeshAttachment.c */; }; - 043012AF21DCF2B80007084D /* SkeletonJson.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121721DCF2B50007084D /* SkeletonJson.c */; }; - 043012B021DCF2B80007084D /* SkeletonJson.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121721DCF2B50007084D /* SkeletonJson.c */; }; - 043012B121DCF2B80007084D /* extension.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121821DCF2B50007084D /* extension.c */; }; - 043012B221DCF2B80007084D /* extension.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121821DCF2B50007084D /* extension.c */; }; - 043012B321DCF2B80007084D /* PointAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121921DCF2B50007084D /* PointAttachment.c */; }; - 043012B421DCF2B80007084D /* PointAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121921DCF2B50007084D /* PointAttachment.c */; }; - 043012B521DCF2B80007084D /* Slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121A21DCF2B60007084D /* Slot.h */; }; - 043012B621DCF2B80007084D /* Slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121A21DCF2B60007084D /* Slot.h */; }; - 043012B721DCF2B80007084D /* VertexAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121B21DCF2B60007084D /* VertexAttachment.c */; }; - 043012B821DCF2B80007084D /* VertexAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121B21DCF2B60007084D /* VertexAttachment.c */; }; - 043012B921DCF2B80007084D /* Json.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121C21DCF2B60007084D /* Json.h */; }; - 043012BA21DCF2B80007084D /* Json.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121C21DCF2B60007084D /* Json.h */; }; - 043012BB21DCF2B80007084D /* IkConstraintData.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121D21DCF2B60007084D /* IkConstraintData.c */; }; - 043012BC21DCF2B80007084D /* IkConstraintData.c in Sources */ = {isa = PBXBuildFile; fileRef = 0430121D21DCF2B60007084D /* IkConstraintData.c */; }; - 043012BD21DCF2B80007084D /* IkConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121E21DCF2B70007084D /* IkConstraintData.h */; }; - 043012BE21DCF2B80007084D /* IkConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121E21DCF2B70007084D /* IkConstraintData.h */; }; - 043012BF21DCF2B80007084D /* dll.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121F21DCF2B70007084D /* dll.h */; }; - 043012C021DCF2B80007084D /* dll.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430121F21DCF2B70007084D /* dll.h */; }; - 043012C121DCF2B80007084D /* kvec.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430122021DCF2B70007084D /* kvec.h */; }; - 043012C221DCF2B80007084D /* kvec.h in Headers */ = {isa = PBXBuildFile; fileRef = 0430122021DCF2B70007084D /* kvec.h */; }; 04355816217EADF300B9C056 /* IOBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04355814217EADF300B9C056 /* IOBuffer.cpp */; }; 04355817217EADF300B9C056 /* IOBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04355814217EADF300B9C056 /* IOBuffer.cpp */; }; 04355818217EADF300B9C056 /* IOBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 04355815217EADF300B9C056 /* IOBuffer.h */; }; 04355819217EADF300B9C056 /* IOBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 04355815217EADF300B9C056 /* IOBuffer.h */; }; + 044DE378227552520037572E /* VertexEffectDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044DE376227552520037572E /* VertexEffectDelegate.cpp */; }; + 044DE379227552520037572E /* VertexEffectDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044DE376227552520037572E /* VertexEffectDelegate.cpp */; }; + 044DE37A227552520037572E /* VertexEffectDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 044DE377227552520037572E /* VertexEffectDelegate.h */; }; + 044DE37B227552520037572E /* VertexEffectDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 044DE377227552520037572E /* VertexEffectDelegate.h */; }; + 046AA90E223B4761005191A4 /* SkeletonClipping.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA880223B4743005191A4 /* SkeletonClipping.h */; }; + 046AA90F223B4761005191A4 /* SkeletonClipping.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA880223B4743005191A4 /* SkeletonClipping.h */; }; + 046AA910223B4761005191A4 /* SpineObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA881223B4743005191A4 /* SpineObject.h */; }; + 046AA911223B4761005191A4 /* SpineObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA881223B4743005191A4 /* SpineObject.h */; }; + 046AA912223B4761005191A4 /* PathConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA882223B4743005191A4 /* PathConstraintData.h */; }; + 046AA913223B4761005191A4 /* PathConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA882223B4743005191A4 /* PathConstraintData.h */; }; + 046AA914223B4761005191A4 /* PathConstraintPositionTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA883223B4743005191A4 /* PathConstraintPositionTimeline.cpp */; }; + 046AA915223B4761005191A4 /* PathConstraintPositionTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA883223B4743005191A4 /* PathConstraintPositionTimeline.cpp */; }; + 046AA916223B4761005191A4 /* Pool.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA884223B4743005191A4 /* Pool.h */; }; + 046AA917223B4761005191A4 /* Pool.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA884223B4743005191A4 /* Pool.h */; }; + 046AA918223B4761005191A4 /* Atlas.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA885223B4744005191A4 /* Atlas.h */; }; + 046AA919223B4761005191A4 /* Atlas.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA885223B4744005191A4 /* Atlas.h */; }; + 046AA91A223B4761005191A4 /* IkConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA886223B4744005191A4 /* IkConstraintData.h */; }; + 046AA91B223B4761005191A4 /* IkConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA886223B4744005191A4 /* IkConstraintData.h */; }; + 046AA91C223B4761005191A4 /* TwoColorTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA887223B4744005191A4 /* TwoColorTimeline.h */; }; + 046AA91D223B4761005191A4 /* TwoColorTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA887223B4744005191A4 /* TwoColorTimeline.h */; }; + 046AA91E223B4761005191A4 /* AttachmentTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA888223B4744005191A4 /* AttachmentTimeline.h */; }; + 046AA91F223B4761005191A4 /* AttachmentTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA888223B4744005191A4 /* AttachmentTimeline.h */; }; + 046AA920223B4761005191A4 /* IkConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA889223B4744005191A4 /* IkConstraintData.cpp */; }; + 046AA921223B4761005191A4 /* IkConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA889223B4744005191A4 /* IkConstraintData.cpp */; }; + 046AA922223B4761005191A4 /* DrawOrderTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88A223B4744005191A4 /* DrawOrderTimeline.cpp */; }; + 046AA923223B4761005191A4 /* DrawOrderTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88A223B4744005191A4 /* DrawOrderTimeline.cpp */; }; + 046AA924223B4761005191A4 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88B223B4744005191A4 /* Event.cpp */; }; + 046AA925223B4761005191A4 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88B223B4744005191A4 /* Event.cpp */; }; + 046AA926223B4761005191A4 /* AnimationState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88C223B4745005191A4 /* AnimationState.cpp */; }; + 046AA927223B4761005191A4 /* AnimationState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88C223B4745005191A4 /* AnimationState.cpp */; }; + 046AA928223B4761005191A4 /* RotateTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88D223B4745005191A4 /* RotateTimeline.cpp */; }; + 046AA929223B4761005191A4 /* RotateTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA88D223B4745005191A4 /* RotateTimeline.cpp */; }; + 046AA92A223B4761005191A4 /* SpineString.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA88E223B4745005191A4 /* SpineString.h */; }; + 046AA92B223B4761005191A4 /* SpineString.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA88E223B4745005191A4 /* SpineString.h */; }; + 046AA92C223B4761005191A4 /* IkConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA88F223B4745005191A4 /* IkConstraint.h */; }; + 046AA92D223B4761005191A4 /* IkConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA88F223B4745005191A4 /* IkConstraint.h */; }; + 046AA92E223B4761005191A4 /* ScaleTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA890223B4745005191A4 /* ScaleTimeline.h */; }; + 046AA92F223B4761005191A4 /* ScaleTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA890223B4745005191A4 /* ScaleTimeline.h */; }; + 046AA930223B4761005191A4 /* MixDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA891223B4745005191A4 /* MixDirection.h */; }; + 046AA931223B4761005191A4 /* MixDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA891223B4745005191A4 /* MixDirection.h */; }; + 046AA932223B4761005191A4 /* EventData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA892223B4746005191A4 /* EventData.cpp */; }; + 046AA933223B4761005191A4 /* EventData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA892223B4746005191A4 /* EventData.cpp */; }; + 046AA934223B4761005191A4 /* AttachmentTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA893223B4746005191A4 /* AttachmentTimeline.cpp */; }; + 046AA935223B4761005191A4 /* AttachmentTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA893223B4746005191A4 /* AttachmentTimeline.cpp */; }; + 046AA936223B4761005191A4 /* CurveTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA894223B4746005191A4 /* CurveTimeline.cpp */; }; + 046AA937223B4761005191A4 /* CurveTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA894223B4746005191A4 /* CurveTimeline.cpp */; }; + 046AA938223B4761005191A4 /* DeformTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA895223B4746005191A4 /* DeformTimeline.h */; }; + 046AA939223B4761005191A4 /* DeformTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA895223B4746005191A4 /* DeformTimeline.h */; }; + 046AA93A223B4761005191A4 /* PathConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA896223B4746005191A4 /* PathConstraintData.cpp */; }; + 046AA93B223B4761005191A4 /* PathConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA896223B4746005191A4 /* PathConstraintData.cpp */; }; + 046AA93C223B4761005191A4 /* Timeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA897223B4746005191A4 /* Timeline.cpp */; }; + 046AA93D223B4761005191A4 /* Timeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA897223B4746005191A4 /* Timeline.cpp */; }; + 046AA93E223B4761005191A4 /* VertexAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA898223B4747005191A4 /* VertexAttachment.cpp */; }; + 046AA93F223B4761005191A4 /* VertexAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA898223B4747005191A4 /* VertexAttachment.cpp */; }; + 046AA940223B4761005191A4 /* Slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA899223B4747005191A4 /* Slot.h */; }; + 046AA941223B4761005191A4 /* Slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA899223B4747005191A4 /* Slot.h */; }; + 046AA942223B4761005191A4 /* Updatable.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89A223B4747005191A4 /* Updatable.h */; }; + 046AA943223B4761005191A4 /* Updatable.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89A223B4747005191A4 /* Updatable.h */; }; + 046AA944223B4761005191A4 /* PathConstraintMixTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89B223B4747005191A4 /* PathConstraintMixTimeline.h */; }; + 046AA945223B4761005191A4 /* PathConstraintMixTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89B223B4747005191A4 /* PathConstraintMixTimeline.h */; }; + 046AA946223B4761005191A4 /* Attachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA89C223B4747005191A4 /* Attachment.cpp */; }; + 046AA947223B4761005191A4 /* Attachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA89C223B4747005191A4 /* Attachment.cpp */; }; + 046AA948223B4761005191A4 /* Skeleton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA89D223B4747005191A4 /* Skeleton.cpp */; }; + 046AA949223B4761005191A4 /* Skeleton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA89D223B4747005191A4 /* Skeleton.cpp */; }; + 046AA94A223B4761005191A4 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89E223B4748005191A4 /* AnimationState.h */; }; + 046AA94B223B4761005191A4 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89E223B4748005191A4 /* AnimationState.h */; }; + 046AA94C223B4761005191A4 /* Extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89F223B4748005191A4 /* Extension.h */; }; + 046AA94D223B4761005191A4 /* Extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA89F223B4748005191A4 /* Extension.h */; }; + 046AA94E223B4761005191A4 /* PathAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A0223B4748005191A4 /* PathAttachment.h */; }; + 046AA94F223B4761005191A4 /* PathAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A0223B4748005191A4 /* PathAttachment.h */; }; + 046AA950223B4761005191A4 /* Constraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8A1223B4748005191A4 /* Constraint.cpp */; }; + 046AA951223B4761005191A4 /* Constraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8A1223B4748005191A4 /* Constraint.cpp */; }; + 046AA952223B4761005191A4 /* PathConstraintSpacingTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A2223B4748005191A4 /* PathConstraintSpacingTimeline.h */; }; + 046AA953223B4761005191A4 /* PathConstraintSpacingTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A2223B4748005191A4 /* PathConstraintSpacingTimeline.h */; }; + 046AA954223B4761005191A4 /* ColorTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A3223B4749005191A4 /* ColorTimeline.h */; }; + 046AA955223B4761005191A4 /* ColorTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A3223B4749005191A4 /* ColorTimeline.h */; }; + 046AA956223B4761005191A4 /* PathConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A4223B4749005191A4 /* PathConstraint.h */; }; + 046AA957223B4761005191A4 /* PathConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A4223B4749005191A4 /* PathConstraint.h */; }; + 046AA958223B4761005191A4 /* PathConstraintSpacingTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8A5223B4749005191A4 /* PathConstraintSpacingTimeline.cpp */; }; + 046AA959223B4761005191A4 /* PathConstraintSpacingTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8A5223B4749005191A4 /* PathConstraintSpacingTimeline.cpp */; }; + 046AA95A223B4761005191A4 /* TextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A6223B4749005191A4 /* TextureLoader.h */; }; + 046AA95B223B4761005191A4 /* TextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A6223B4749005191A4 /* TextureLoader.h */; }; + 046AA95C223B4761005191A4 /* TwoColorTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8A7223B4749005191A4 /* TwoColorTimeline.cpp */; }; + 046AA95D223B4761005191A4 /* TwoColorTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8A7223B4749005191A4 /* TwoColorTimeline.cpp */; }; + 046AA95E223B4761005191A4 /* Vertices.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A8223B474A005191A4 /* Vertices.h */; }; + 046AA95F223B4761005191A4 /* Vertices.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A8223B474A005191A4 /* Vertices.h */; }; + 046AA960223B4761005191A4 /* SkeletonBinary.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A9223B474A005191A4 /* SkeletonBinary.h */; }; + 046AA961223B4761005191A4 /* SkeletonBinary.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8A9223B474A005191A4 /* SkeletonBinary.h */; }; + 046AA962223B4761005191A4 /* LinkedMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8AA223B474A005191A4 /* LinkedMesh.cpp */; }; + 046AA963223B4761005191A4 /* LinkedMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8AA223B474A005191A4 /* LinkedMesh.cpp */; }; + 046AA964223B4761005191A4 /* RTTI.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AB223B474A005191A4 /* RTTI.h */; }; + 046AA965223B4761005191A4 /* RTTI.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AB223B474A005191A4 /* RTTI.h */; }; + 046AA966223B4761005191A4 /* MixBlend.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AC223B474A005191A4 /* MixBlend.h */; }; + 046AA967223B4761005191A4 /* MixBlend.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AC223B474A005191A4 /* MixBlend.h */; }; + 046AA968223B4761005191A4 /* BoneData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AD223B474B005191A4 /* BoneData.h */; }; + 046AA969223B4761005191A4 /* BoneData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AD223B474B005191A4 /* BoneData.h */; }; + 046AA96A223B4761005191A4 /* TransformConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AE223B474B005191A4 /* TransformConstraint.h */; }; + 046AA96B223B4761005191A4 /* TransformConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AE223B474B005191A4 /* TransformConstraint.h */; }; + 046AA96C223B4761005191A4 /* MathUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AF223B474B005191A4 /* MathUtil.h */; }; + 046AA96D223B4761005191A4 /* MathUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8AF223B474B005191A4 /* MathUtil.h */; }; + 046AA96E223B4761005191A4 /* SkeletonBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B0223B474B005191A4 /* SkeletonBinary.cpp */; }; + 046AA96F223B4761005191A4 /* SkeletonBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B0223B474B005191A4 /* SkeletonBinary.cpp */; }; + 046AA970223B4761005191A4 /* Timeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B1223B474C005191A4 /* Timeline.h */; }; + 046AA971223B4761005191A4 /* Timeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B1223B474C005191A4 /* Timeline.h */; }; + 046AA972223B4761005191A4 /* TransformConstraintTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B2223B474C005191A4 /* TransformConstraintTimeline.h */; }; + 046AA973223B4761005191A4 /* TransformConstraintTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B2223B474C005191A4 /* TransformConstraintTimeline.h */; }; + 046AA974223B4761005191A4 /* TimelineType.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B3223B474C005191A4 /* TimelineType.h */; }; + 046AA975223B4761005191A4 /* TimelineType.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B3223B474C005191A4 /* TimelineType.h */; }; + 046AA976223B4761005191A4 /* AtlasAttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B4223B474C005191A4 /* AtlasAttachmentLoader.cpp */; }; + 046AA977223B4761005191A4 /* AtlasAttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B4223B474C005191A4 /* AtlasAttachmentLoader.cpp */; }; + 046AA978223B4761005191A4 /* VertexEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B5223B474D005191A4 /* VertexEffect.cpp */; }; + 046AA979223B4761005191A4 /* VertexEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B5223B474D005191A4 /* VertexEffect.cpp */; }; + 046AA97A223B4761005191A4 /* RotateMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B6223B474D005191A4 /* RotateMode.h */; }; + 046AA97B223B4761005191A4 /* RotateMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B6223B474D005191A4 /* RotateMode.h */; }; + 046AA97C223B4761005191A4 /* SkeletonJson.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B7223B474D005191A4 /* SkeletonJson.h */; }; + 046AA97D223B4761005191A4 /* SkeletonJson.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B7223B474D005191A4 /* SkeletonJson.h */; }; + 046AA97E223B4761005191A4 /* AttachmentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B8223B474D005191A4 /* AttachmentType.h */; }; + 046AA97F223B4761005191A4 /* AttachmentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8B8223B474D005191A4 /* AttachmentType.h */; }; + 046AA980223B4761005191A4 /* Skin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B9223B474E005191A4 /* Skin.cpp */; }; + 046AA981223B4761005191A4 /* Skin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8B9223B474E005191A4 /* Skin.cpp */; }; + 046AA982223B4761005191A4 /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8BA223B474E005191A4 /* Vector.h */; }; + 046AA983223B4761005191A4 /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8BA223B474E005191A4 /* Vector.h */; }; + 046AA984223B4761005191A4 /* ShearTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BB223B474E005191A4 /* ShearTimeline.cpp */; }; + 046AA985223B4761005191A4 /* ShearTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BB223B474E005191A4 /* ShearTimeline.cpp */; }; + 046AA986223B4761005191A4 /* Bone.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8BC223B474E005191A4 /* Bone.h */; }; + 046AA987223B4761005191A4 /* Bone.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8BC223B474E005191A4 /* Bone.h */; }; + 046AA988223B4761005191A4 /* TextureLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BD223B474F005191A4 /* TextureLoader.cpp */; }; + 046AA989223B4761005191A4 /* TextureLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BD223B474F005191A4 /* TextureLoader.cpp */; }; + 046AA98A223B4761005191A4 /* PointAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BE223B474F005191A4 /* PointAttachment.cpp */; }; + 046AA98B223B4761005191A4 /* PointAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BE223B474F005191A4 /* PointAttachment.cpp */; }; + 046AA98C223B4761005191A4 /* EventTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BF223B474F005191A4 /* EventTimeline.cpp */; }; + 046AA98D223B4761005191A4 /* EventTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8BF223B474F005191A4 /* EventTimeline.cpp */; }; + 046AA98E223B4761005191A4 /* BoneData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C0223B474F005191A4 /* BoneData.cpp */; }; + 046AA98F223B4761005191A4 /* BoneData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C0223B474F005191A4 /* BoneData.cpp */; }; + 046AA990223B4761005191A4 /* RotateTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C1223B4750005191A4 /* RotateTimeline.h */; }; + 046AA991223B4761005191A4 /* RotateTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C1223B4750005191A4 /* RotateTimeline.h */; }; + 046AA992223B4761005191A4 /* Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C2223B4750005191A4 /* Json.cpp */; }; + 046AA993223B4761005191A4 /* Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C2223B4750005191A4 /* Json.cpp */; }; + 046AA994223B4761005191A4 /* VertexAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C3223B4750005191A4 /* VertexAttachment.h */; }; + 046AA995223B4761005191A4 /* VertexAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C3223B4750005191A4 /* VertexAttachment.h */; }; + 046AA996223B4761005191A4 /* IkConstraintTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C4223B4750005191A4 /* IkConstraintTimeline.cpp */; }; + 046AA997223B4761005191A4 /* IkConstraintTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C4223B4750005191A4 /* IkConstraintTimeline.cpp */; }; + 046AA998223B4761005191A4 /* Atlas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C5223B4751005191A4 /* Atlas.cpp */; }; + 046AA999223B4761005191A4 /* Atlas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C5223B4751005191A4 /* Atlas.cpp */; }; + 046AA99A223B4761005191A4 /* dll.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C6223B4751005191A4 /* dll.h */; }; + 046AA99B223B4761005191A4 /* dll.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C6223B4751005191A4 /* dll.h */; }; + 046AA99C223B4761005191A4 /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C7223B4751005191A4 /* HashMap.h */; }; + 046AA99D223B4761005191A4 /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C7223B4751005191A4 /* HashMap.h */; }; + 046AA99E223B4761005191A4 /* AttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C8223B4751005191A4 /* AttachmentLoader.cpp */; }; + 046AA99F223B4761005191A4 /* AttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8C8223B4751005191A4 /* AttachmentLoader.cpp */; }; + 046AA9A0223B4761005191A4 /* BlendMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C9223B4752005191A4 /* BlendMode.h */; }; + 046AA9A1223B4761005191A4 /* BlendMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8C9223B4752005191A4 /* BlendMode.h */; }; + 046AA9A2223B4761005191A4 /* SpineObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CA223B4752005191A4 /* SpineObject.cpp */; }; + 046AA9A3223B4761005191A4 /* SpineObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CA223B4752005191A4 /* SpineObject.cpp */; }; + 046AA9A4223B4761005191A4 /* TranslateTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CB223B4752005191A4 /* TranslateTimeline.cpp */; }; + 046AA9A5223B4761005191A4 /* TranslateTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CB223B4752005191A4 /* TranslateTimeline.cpp */; }; + 046AA9A6223B4761005191A4 /* SlotData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CC223B4752005191A4 /* SlotData.cpp */; }; + 046AA9A7223B4761005191A4 /* SlotData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CC223B4752005191A4 /* SlotData.cpp */; }; + 046AA9A8223B4761005191A4 /* spine.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8CD223B4753005191A4 /* spine.h */; }; + 046AA9A9223B4761005191A4 /* spine.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8CD223B4753005191A4 /* spine.h */; }; + 046AA9AA223B4761005191A4 /* RegionAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CE223B4753005191A4 /* RegionAttachment.cpp */; }; + 046AA9AB223B4761005191A4 /* RegionAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CE223B4753005191A4 /* RegionAttachment.cpp */; }; + 046AA9AC223B4761005191A4 /* Extension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CF223B4753005191A4 /* Extension.cpp */; }; + 046AA9AD223B4761005191A4 /* Extension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8CF223B4753005191A4 /* Extension.cpp */; }; + 046AA9AE223B4761005191A4 /* VertexEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D0223B4753005191A4 /* VertexEffect.h */; }; + 046AA9AF223B4761005191A4 /* VertexEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D0223B4753005191A4 /* VertexEffect.h */; }; + 046AA9B0223B4761005191A4 /* Slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8D1223B4754005191A4 /* Slot.cpp */; }; + 046AA9B1223B4761005191A4 /* Slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8D1223B4754005191A4 /* Slot.cpp */; }; + 046AA9B2223B4761005191A4 /* AnimationStateData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D2223B4754005191A4 /* AnimationStateData.h */; }; + 046AA9B3223B4761005191A4 /* AnimationStateData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D2223B4754005191A4 /* AnimationStateData.h */; }; + 046AA9B4223B4761005191A4 /* PositionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D3223B4754005191A4 /* PositionMode.h */; }; + 046AA9B5223B4761005191A4 /* PositionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D3223B4754005191A4 /* PositionMode.h */; }; + 046AA9B6223B4761005191A4 /* HasRendererObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D4223B4754005191A4 /* HasRendererObject.h */; }; + 046AA9B7223B4761005191A4 /* HasRendererObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D4223B4754005191A4 /* HasRendererObject.h */; }; + 046AA9B8223B4761005191A4 /* AttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D5223B4755005191A4 /* AttachmentLoader.h */; }; + 046AA9B9223B4761005191A4 /* AttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D5223B4755005191A4 /* AttachmentLoader.h */; }; + 046AA9BA223B4761005191A4 /* TransformConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8D6223B4755005191A4 /* TransformConstraint.cpp */; }; + 046AA9BB223B4761005191A4 /* TransformConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8D6223B4755005191A4 /* TransformConstraint.cpp */; }; + 046AA9BC223B4761005191A4 /* TransformConstraintTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8D7223B4755005191A4 /* TransformConstraintTimeline.cpp */; }; + 046AA9BD223B4761005191A4 /* TransformConstraintTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8D7223B4755005191A4 /* TransformConstraintTimeline.cpp */; }; + 046AA9BE223B4761005191A4 /* DrawOrderTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D8223B4755005191A4 /* DrawOrderTimeline.h */; }; + 046AA9BF223B4762005191A4 /* DrawOrderTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D8223B4755005191A4 /* DrawOrderTimeline.h */; }; + 046AA9C0223B4762005191A4 /* SkeletonBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D9223B4755005191A4 /* SkeletonBounds.h */; }; + 046AA9C1223B4762005191A4 /* SkeletonBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8D9223B4755005191A4 /* SkeletonBounds.h */; }; + 046AA9C2223B4762005191A4 /* ContainerUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DA223B4756005191A4 /* ContainerUtil.h */; }; + 046AA9C3223B4762005191A4 /* ContainerUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DA223B4756005191A4 /* ContainerUtil.h */; }; + 046AA9C4223B4762005191A4 /* BoundingBoxAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8DB223B4756005191A4 /* BoundingBoxAttachment.cpp */; }; + 046AA9C5223B4762005191A4 /* BoundingBoxAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8DB223B4756005191A4 /* BoundingBoxAttachment.cpp */; }; + 046AA9C6223B4762005191A4 /* SkeletonJson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8DC223B4756005191A4 /* SkeletonJson.cpp */; }; + 046AA9C7223B4762005191A4 /* SkeletonJson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8DC223B4756005191A4 /* SkeletonJson.cpp */; }; + 046AA9C8223B4762005191A4 /* SlotData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DD223B4756005191A4 /* SlotData.h */; }; + 046AA9C9223B4762005191A4 /* SlotData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DD223B4756005191A4 /* SlotData.h */; }; + 046AA9CA223B4762005191A4 /* SpacingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DE223B4756005191A4 /* SpacingMode.h */; }; + 046AA9CB223B4762005191A4 /* SpacingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DE223B4756005191A4 /* SpacingMode.h */; }; + 046AA9CC223B4762005191A4 /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DF223B4757005191A4 /* Event.h */; }; + 046AA9CD223B4762005191A4 /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8DF223B4757005191A4 /* Event.h */; }; + 046AA9CE223B4762005191A4 /* RTTI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8E0223B4757005191A4 /* RTTI.cpp */; }; + 046AA9CF223B4762005191A4 /* RTTI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8E0223B4757005191A4 /* RTTI.cpp */; }; + 046AA9D0223B4762005191A4 /* Constraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E1223B4757005191A4 /* Constraint.h */; }; + 046AA9D1223B4762005191A4 /* Constraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E1223B4757005191A4 /* Constraint.h */; }; + 046AA9D2223B4762005191A4 /* Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E2223B4757005191A4 /* Debug.h */; }; + 046AA9D3223B4762005191A4 /* Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E2223B4757005191A4 /* Debug.h */; }; + 046AA9D4223B4762005191A4 /* ClippingAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E3223B4757005191A4 /* ClippingAttachment.h */; }; + 046AA9D5223B4762005191A4 /* ClippingAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E3223B4757005191A4 /* ClippingAttachment.h */; }; + 046AA9D6223B4762005191A4 /* CurveTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E4223B4758005191A4 /* CurveTimeline.h */; }; + 046AA9D7223B4762005191A4 /* CurveTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E4223B4758005191A4 /* CurveTimeline.h */; }; + 046AA9D8223B4762005191A4 /* SkeletonBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8E5223B4758005191A4 /* SkeletonBounds.cpp */; }; + 046AA9D9223B4762005191A4 /* SkeletonBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8E5223B4758005191A4 /* SkeletonBounds.cpp */; }; + 046AA9DA223B4762005191A4 /* TranslateTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E6223B4758005191A4 /* TranslateTimeline.h */; }; + 046AA9DB223B4762005191A4 /* TranslateTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E6223B4758005191A4 /* TranslateTimeline.h */; }; + 046AA9DC223B4762005191A4 /* Triangulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8E7223B4758005191A4 /* Triangulator.cpp */; }; + 046AA9DD223B4762005191A4 /* Triangulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8E7223B4758005191A4 /* Triangulator.cpp */; }; + 046AA9DE223B4762005191A4 /* Animation.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E8223B4759005191A4 /* Animation.h */; }; + 046AA9DF223B4762005191A4 /* Animation.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E8223B4759005191A4 /* Animation.h */; }; + 046AA9E0223B4762005191A4 /* TransformConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E9223B4759005191A4 /* TransformConstraintData.h */; }; + 046AA9E1223B4762005191A4 /* TransformConstraintData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8E9223B4759005191A4 /* TransformConstraintData.h */; }; + 046AA9E2223B4762005191A4 /* PathConstraintMixTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8EA223B4759005191A4 /* PathConstraintMixTimeline.cpp */; }; + 046AA9E3223B4762005191A4 /* PathConstraintMixTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8EA223B4759005191A4 /* PathConstraintMixTimeline.cpp */; }; + 046AA9E4223B4762005191A4 /* PathAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8EB223B4759005191A4 /* PathAttachment.cpp */; }; + 046AA9E5223B4762005191A4 /* PathAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8EB223B4759005191A4 /* PathAttachment.cpp */; }; + 046AA9E6223B4762005191A4 /* Skin.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8EC223B4759005191A4 /* Skin.h */; }; + 046AA9E7223B4762005191A4 /* Skin.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8EC223B4759005191A4 /* Skin.h */; }; + 046AA9E8223B4762005191A4 /* Color.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8ED223B475A005191A4 /* Color.h */; }; + 046AA9E9223B4762005191A4 /* Color.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8ED223B475A005191A4 /* Color.h */; }; + 046AA9EA223B4762005191A4 /* Json.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8EE223B475A005191A4 /* Json.h */; }; + 046AA9EB223B4762005191A4 /* Json.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8EE223B475A005191A4 /* Json.h */; }; + 046AA9EC223B4762005191A4 /* TransformMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8EF223B475A005191A4 /* TransformMode.h */; }; + 046AA9ED223B4762005191A4 /* TransformMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8EF223B475A005191A4 /* TransformMode.h */; }; + 046AA9EE223B4762005191A4 /* SkeletonData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F0223B475A005191A4 /* SkeletonData.h */; }; + 046AA9EF223B4762005191A4 /* SkeletonData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F0223B475A005191A4 /* SkeletonData.h */; }; + 046AA9F0223B4762005191A4 /* MathUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F1223B475B005191A4 /* MathUtil.cpp */; }; + 046AA9F1223B4762005191A4 /* MathUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F1223B475B005191A4 /* MathUtil.cpp */; }; + 046AA9F2223B4762005191A4 /* Skeleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F2223B475B005191A4 /* Skeleton.h */; }; + 046AA9F3223B4762005191A4 /* Skeleton.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F2223B475B005191A4 /* Skeleton.h */; }; + 046AA9F4223B4762005191A4 /* PathConstraintPositionTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F3223B475B005191A4 /* PathConstraintPositionTimeline.h */; }; + 046AA9F5223B4762005191A4 /* PathConstraintPositionTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F3223B475B005191A4 /* PathConstraintPositionTimeline.h */; }; + 046AA9F6223B4762005191A4 /* AnimationStateData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F4223B475B005191A4 /* AnimationStateData.cpp */; }; + 046AA9F7223B4762005191A4 /* AnimationStateData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F4223B475B005191A4 /* AnimationStateData.cpp */; }; + 046AA9F8223B4762005191A4 /* TransformConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F5223B475B005191A4 /* TransformConstraintData.cpp */; }; + 046AA9F9223B4762005191A4 /* TransformConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F5223B475B005191A4 /* TransformConstraintData.cpp */; }; + 046AA9FA223B4762005191A4 /* Attachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F6223B475C005191A4 /* Attachment.h */; }; + 046AA9FB223B4762005191A4 /* Attachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F6223B475C005191A4 /* Attachment.h */; }; + 046AA9FC223B4762005191A4 /* Triangulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F7223B475C005191A4 /* Triangulator.h */; }; + 046AA9FD223B4762005191A4 /* Triangulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F7223B475C005191A4 /* Triangulator.h */; }; + 046AA9FE223B4762005191A4 /* EventData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F8223B475C005191A4 /* EventData.h */; }; + 046AA9FF223B4762005191A4 /* EventData.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8F8223B475C005191A4 /* EventData.h */; }; + 046AAA00223B4762005191A4 /* Updatable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F9223B475C005191A4 /* Updatable.cpp */; }; + 046AAA01223B4762005191A4 /* Updatable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8F9223B475C005191A4 /* Updatable.cpp */; }; + 046AAA02223B4762005191A4 /* SkeletonClipping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8FA223B475D005191A4 /* SkeletonClipping.cpp */; }; + 046AAA03223B4762005191A4 /* SkeletonClipping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8FA223B475D005191A4 /* SkeletonClipping.cpp */; }; + 046AAA04223B4762005191A4 /* LinkedMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8FB223B475D005191A4 /* LinkedMesh.h */; }; + 046AAA05223B4762005191A4 /* LinkedMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8FB223B475D005191A4 /* LinkedMesh.h */; }; + 046AAA06223B4762005191A4 /* BoundingBoxAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8FC223B475D005191A4 /* BoundingBoxAttachment.h */; }; + 046AAA07223B4762005191A4 /* BoundingBoxAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8FC223B475D005191A4 /* BoundingBoxAttachment.h */; }; + 046AAA08223B4762005191A4 /* IkConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8FD223B475D005191A4 /* IkConstraint.cpp */; }; + 046AAA09223B4762005191A4 /* IkConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8FD223B475D005191A4 /* IkConstraint.cpp */; }; + 046AAA0A223B4762005191A4 /* ClippingAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8FE223B475D005191A4 /* ClippingAttachment.cpp */; }; + 046AAA0B223B4762005191A4 /* ClippingAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA8FE223B475D005191A4 /* ClippingAttachment.cpp */; }; + 046AAA0C223B4762005191A4 /* MeshAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8FF223B475E005191A4 /* MeshAttachment.h */; }; + 046AAA0D223B4762005191A4 /* MeshAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA8FF223B475E005191A4 /* MeshAttachment.h */; }; + 046AAA0E223B4762005191A4 /* PathConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA900223B475E005191A4 /* PathConstraint.cpp */; }; + 046AAA0F223B4762005191A4 /* PathConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA900223B475E005191A4 /* PathConstraint.cpp */; }; + 046AAA10223B4762005191A4 /* DeformTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA901223B475E005191A4 /* DeformTimeline.cpp */; }; + 046AAA11223B4762005191A4 /* DeformTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA901223B475E005191A4 /* DeformTimeline.cpp */; }; + 046AAA12223B4762005191A4 /* EventTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA902223B475E005191A4 /* EventTimeline.h */; }; + 046AAA13223B4762005191A4 /* EventTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA902223B475E005191A4 /* EventTimeline.h */; }; + 046AAA14223B4762005191A4 /* IkConstraintTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA903223B475F005191A4 /* IkConstraintTimeline.h */; }; + 046AAA15223B4762005191A4 /* IkConstraintTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA903223B475F005191A4 /* IkConstraintTimeline.h */; }; + 046AAA16223B4762005191A4 /* Animation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA904223B475F005191A4 /* Animation.cpp */; }; + 046AAA17223B4762005191A4 /* Animation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA904223B475F005191A4 /* Animation.cpp */; }; + 046AAA18223B4762005191A4 /* ShearTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA905223B475F005191A4 /* ShearTimeline.h */; }; + 046AAA19223B4762005191A4 /* ShearTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA905223B475F005191A4 /* ShearTimeline.h */; }; + 046AAA1A223B4762005191A4 /* SkeletonData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA906223B475F005191A4 /* SkeletonData.cpp */; }; + 046AAA1B223B4762005191A4 /* SkeletonData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA906223B475F005191A4 /* SkeletonData.cpp */; }; + 046AAA1C223B4762005191A4 /* ScaleTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA907223B4760005191A4 /* ScaleTimeline.cpp */; }; + 046AAA1D223B4762005191A4 /* ScaleTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA907223B4760005191A4 /* ScaleTimeline.cpp */; }; + 046AAA1E223B4762005191A4 /* ColorTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA908223B4760005191A4 /* ColorTimeline.cpp */; }; + 046AAA1F223B4762005191A4 /* ColorTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA908223B4760005191A4 /* ColorTimeline.cpp */; }; + 046AAA20223B4762005191A4 /* Bone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA909223B4760005191A4 /* Bone.cpp */; }; + 046AAA21223B4762005191A4 /* Bone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA909223B4760005191A4 /* Bone.cpp */; }; + 046AAA22223B4762005191A4 /* RegionAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA90A223B4760005191A4 /* RegionAttachment.h */; }; + 046AAA23223B4762005191A4 /* RegionAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA90A223B4760005191A4 /* RegionAttachment.h */; }; + 046AAA24223B4762005191A4 /* PointAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA90B223B4761005191A4 /* PointAttachment.h */; }; + 046AAA25223B4762005191A4 /* PointAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA90B223B4761005191A4 /* PointAttachment.h */; }; + 046AAA26223B4762005191A4 /* MeshAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA90C223B4761005191A4 /* MeshAttachment.cpp */; }; + 046AAA27223B4762005191A4 /* MeshAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046AA90C223B4761005191A4 /* MeshAttachment.cpp */; }; + 046AAA28223B4762005191A4 /* AtlasAttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA90D223B4761005191A4 /* AtlasAttachmentLoader.h */; }; + 046AAA29223B4762005191A4 /* AtlasAttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046AA90D223B4761005191A4 /* AtlasAttachmentLoader.h */; }; 046B688A219FA61200B33469 /* MiddlewareManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046B6888219FA61200B33469 /* MiddlewareManager.cpp */; }; 046B688B219FA61200B33469 /* MiddlewareManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046B6888219FA61200B33469 /* MiddlewareManager.cpp */; }; 046B688C219FA61200B33469 /* MiddlewareManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 046B6889219FA61200B33469 /* MiddlewareManager.h */; }; @@ -191,26 +317,22 @@ 046B68AD21A294B100B33469 /* jsb_cocos2dx_spine_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 046B68AA21A294B100B33469 /* jsb_cocos2dx_spine_auto.hpp */; }; 046B68AE21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046B68AB21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp */; }; 046B68AF21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046B68AB21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp */; }; - 046E03ED21804E6B00B24E2D /* CreatorAttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E021804E6A00B24E2D /* CreatorAttachmentLoader.cpp */; }; - 046E03EE21804E6B00B24E2D /* CreatorAttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E021804E6A00B24E2D /* CreatorAttachmentLoader.cpp */; }; - 046E03EF21804E6B00B24E2D /* SpineAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E121804E6A00B24E2D /* SpineAnimation.cpp */; }; - 046E03F021804E6B00B24E2D /* SpineAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E121804E6A00B24E2D /* SpineAnimation.cpp */; }; - 046E03F121804E6B00B24E2D /* SpineAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E221804E6A00B24E2D /* SpineAnimation.h */; }; - 046E03F221804E6B00B24E2D /* SpineAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E221804E6A00B24E2D /* SpineAnimation.h */; }; + 046E03EF21804E6B00B24E2D /* SkeletonAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E121804E6A00B24E2D /* SkeletonAnimation.cpp */; }; + 046E03F021804E6B00B24E2D /* SkeletonAnimation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E121804E6A00B24E2D /* SkeletonAnimation.cpp */; }; + 046E03F121804E6B00B24E2D /* SkeletonAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E221804E6A00B24E2D /* SkeletonAnimation.h */; }; + 046E03F221804E6B00B24E2D /* SkeletonAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E221804E6A00B24E2D /* SkeletonAnimation.h */; }; 046E03F321804E6B00B24E2D /* spine-cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E321804E6A00B24E2D /* spine-cocos2dx.cpp */; }; 046E03F421804E6B00B24E2D /* spine-cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E321804E6A00B24E2D /* spine-cocos2dx.cpp */; }; 046E03F521804E6B00B24E2D /* spine-cocos2dx.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E421804E6A00B24E2D /* spine-cocos2dx.h */; }; 046E03F621804E6B00B24E2D /* spine-cocos2dx.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E421804E6A00B24E2D /* spine-cocos2dx.h */; }; - 046E03F721804E6B00B24E2D /* SpineRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E521804E6A00B24E2D /* SpineRenderer.h */; }; - 046E03F821804E6B00B24E2D /* SpineRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E521804E6A00B24E2D /* SpineRenderer.h */; }; - 046E03F921804E6B00B24E2D /* SpineRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E621804E6A00B24E2D /* SpineRenderer.cpp */; }; - 046E03FA21804E6B00B24E2D /* SpineRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E621804E6A00B24E2D /* SpineRenderer.cpp */; }; + 046E03F721804E6B00B24E2D /* SkeletonRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E521804E6A00B24E2D /* SkeletonRenderer.h */; }; + 046E03F821804E6B00B24E2D /* SkeletonRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E521804E6A00B24E2D /* SkeletonRenderer.h */; }; + 046E03F921804E6B00B24E2D /* SkeletonRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E621804E6A00B24E2D /* SkeletonRenderer.cpp */; }; + 046E03FA21804E6B00B24E2D /* SkeletonRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E621804E6A00B24E2D /* SkeletonRenderer.cpp */; }; 046E03FB21804E6B00B24E2D /* AttachmentVertices.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E721804E6A00B24E2D /* AttachmentVertices.h */; }; 046E03FC21804E6B00B24E2D /* AttachmentVertices.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E721804E6A00B24E2D /* AttachmentVertices.h */; }; 046E03FD21804E6B00B24E2D /* AttachmentVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E821804E6A00B24E2D /* AttachmentVertices.cpp */; }; 046E03FE21804E6B00B24E2D /* AttachmentVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E03E821804E6A00B24E2D /* AttachmentVertices.cpp */; }; - 046E03FF21804E6B00B24E2D /* CreatorAttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E921804E6A00B24E2D /* CreatorAttachmentLoader.h */; }; - 046E040021804E6B00B24E2D /* CreatorAttachmentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E03E921804E6A00B24E2D /* CreatorAttachmentLoader.h */; }; 046E06142185B37100B24E2D /* CCArmatureDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E060B2185B37000B24E2D /* CCArmatureDisplay.h */; }; 046E06152185B37100B24E2D /* CCArmatureDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = 046E060B2185B37000B24E2D /* CCArmatureDisplay.h */; }; 046E06162185B37100B24E2D /* CCSlot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 046E060C2185B37000B24E2D /* CCSlot.cpp */; }; @@ -1191,89 +1313,152 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 043011D021DCF2A70007084D /* Atlas.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Atlas.c; path = "../cocos/editor-support/spine/Atlas.c"; sourceTree = ""; }; - 043011D121DCF2A70007084D /* Attachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Attachment.h; path = "../cocos/editor-support/spine/Attachment.h"; sourceTree = ""; }; - 043011D221DCF2A70007084D /* BoundingBoxAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoundingBoxAttachment.h; path = "../cocos/editor-support/spine/BoundingBoxAttachment.h"; sourceTree = ""; }; - 043011D321DCF2A70007084D /* PathConstraint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = PathConstraint.c; path = "../cocos/editor-support/spine/PathConstraint.c"; sourceTree = ""; }; - 043011D421DCF2A80007084D /* MeshAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MeshAttachment.h; path = "../cocos/editor-support/spine/MeshAttachment.h"; sourceTree = ""; }; - 043011D521DCF2A80007084D /* ClippingAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClippingAttachment.h; path = "../cocos/editor-support/spine/ClippingAttachment.h"; sourceTree = ""; }; - 043011D621DCF2A80007084D /* Animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Animation.h; path = "../cocos/editor-support/spine/Animation.h"; sourceTree = ""; }; - 043011D721DCF2A80007084D /* EventData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EventData.h; path = "../cocos/editor-support/spine/EventData.h"; sourceTree = ""; }; - 043011D821DCF2A80007084D /* VertexEffect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = VertexEffect.c; path = "../cocos/editor-support/spine/VertexEffect.c"; sourceTree = ""; }; - 043011D921DCF2A80007084D /* AttachmentLoader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = AttachmentLoader.c; path = "../cocos/editor-support/spine/AttachmentLoader.c"; sourceTree = ""; }; - 043011DA21DCF2A80007084D /* extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = extension.h; path = "../cocos/editor-support/spine/extension.h"; sourceTree = ""; }; - 043011DB21DCF2A90007084D /* BoneData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BoneData.c; path = "../cocos/editor-support/spine/BoneData.c"; sourceTree = ""; }; - 043011DC21DCF2A90007084D /* Slot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Slot.c; path = "../cocos/editor-support/spine/Slot.c"; sourceTree = ""; }; - 043011DD21DCF2A90007084D /* PathConstraintData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = PathConstraintData.c; path = "../cocos/editor-support/spine/PathConstraintData.c"; sourceTree = ""; }; - 043011DE21DCF2A90007084D /* spine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spine.h; path = "../cocos/editor-support/spine/spine.h"; sourceTree = ""; }; - 043011DF21DCF2A90007084D /* Color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Color.h; path = "../cocos/editor-support/spine/Color.h"; sourceTree = ""; }; - 043011E021DCF2A90007084D /* TransformConstraint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = TransformConstraint.c; path = "../cocos/editor-support/spine/TransformConstraint.c"; sourceTree = ""; }; - 043011E121DCF2AA0007084D /* SkeletonJson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonJson.h; path = "../cocos/editor-support/spine/SkeletonJson.h"; sourceTree = ""; }; - 043011E221DCF2AA0007084D /* Json.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Json.c; path = "../cocos/editor-support/spine/Json.c"; sourceTree = ""; }; - 043011E321DCF2AA0007084D /* Skin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Skin.h; path = "../cocos/editor-support/spine/Skin.h"; sourceTree = ""; }; - 043011E421DCF2AA0007084D /* Triangulator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Triangulator.c; path = "../cocos/editor-support/spine/Triangulator.c"; sourceTree = ""; }; - 043011E521DCF2AA0007084D /* TransformConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformConstraint.h; path = "../cocos/editor-support/spine/TransformConstraint.h"; sourceTree = ""; }; - 043011E621DCF2AA0007084D /* SkeletonBinary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonBinary.h; path = "../cocos/editor-support/spine/SkeletonBinary.h"; sourceTree = ""; }; - 043011E721DCF2AB0007084D /* Skeleton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Skeleton.c; path = "../cocos/editor-support/spine/Skeleton.c"; sourceTree = ""; }; - 043011E821DCF2AB0007084D /* TransformConstraintData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = TransformConstraintData.c; path = "../cocos/editor-support/spine/TransformConstraintData.c"; sourceTree = ""; }; - 043011E921DCF2AB0007084D /* AnimationState.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = AnimationState.c; path = "../cocos/editor-support/spine/AnimationState.c"; sourceTree = ""; }; - 043011EA21DCF2AB0007084D /* Color.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Color.c; path = "../cocos/editor-support/spine/Color.c"; sourceTree = ""; }; - 043011EB21DCF2AB0007084D /* Bone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bone.h; path = "../cocos/editor-support/spine/Bone.h"; sourceTree = ""; }; - 043011EC21DCF2AB0007084D /* AtlasAttachmentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtlasAttachmentLoader.h; path = "../cocos/editor-support/spine/AtlasAttachmentLoader.h"; sourceTree = ""; }; - 043011ED21DCF2AC0007084D /* RegionAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegionAttachment.h; path = "../cocos/editor-support/spine/RegionAttachment.h"; sourceTree = ""; }; - 043011EE21DCF2AC0007084D /* BoneData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoneData.h; path = "../cocos/editor-support/spine/BoneData.h"; sourceTree = ""; }; - 043011EF21DCF2AC0007084D /* Atlas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Atlas.h; path = "../cocos/editor-support/spine/Atlas.h"; sourceTree = ""; }; - 043011F021DCF2AC0007084D /* EventData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = EventData.c; path = "../cocos/editor-support/spine/EventData.c"; sourceTree = ""; }; - 043011F121DCF2AC0007084D /* Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Array.h; path = "../cocos/editor-support/spine/Array.h"; sourceTree = ""; }; - 043011F221DCF2AD0007084D /* BoundingBoxAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BoundingBoxAttachment.c; path = "../cocos/editor-support/spine/BoundingBoxAttachment.c"; sourceTree = ""; }; - 043011F321DCF2AD0007084D /* Triangulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Triangulator.h; path = "../cocos/editor-support/spine/Triangulator.h"; sourceTree = ""; }; - 043011F421DCF2AD0007084D /* ClippingAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ClippingAttachment.c; path = "../cocos/editor-support/spine/ClippingAttachment.c"; sourceTree = ""; }; - 043011F521DCF2AD0007084D /* Bone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Bone.c; path = "../cocos/editor-support/spine/Bone.c"; sourceTree = ""; }; - 043011F621DCF2AD0007084D /* RegionAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = RegionAttachment.c; path = "../cocos/editor-support/spine/RegionAttachment.c"; sourceTree = ""; }; - 043011F721DCF2AE0007084D /* PathAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathAttachment.h; path = "../cocos/editor-support/spine/PathAttachment.h"; sourceTree = ""; }; - 043011F821DCF2AE0007084D /* SkeletonBounds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SkeletonBounds.c; path = "../cocos/editor-support/spine/SkeletonBounds.c"; sourceTree = ""; }; - 043011F921DCF2AE0007084D /* SlotData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SlotData.c; path = "../cocos/editor-support/spine/SlotData.c"; sourceTree = ""; }; - 043011FA21DCF2AF0007084D /* AnimationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationState.h; path = "../cocos/editor-support/spine/AnimationState.h"; sourceTree = ""; }; - 043011FB21DCF2AF0007084D /* SkeletonClipping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonClipping.h; path = "../cocos/editor-support/spine/SkeletonClipping.h"; sourceTree = ""; }; - 043011FC21DCF2AF0007084D /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Event.h; path = "../cocos/editor-support/spine/Event.h"; sourceTree = ""; }; - 043011FD21DCF2AF0007084D /* SkeletonClipping.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SkeletonClipping.c; path = "../cocos/editor-support/spine/SkeletonClipping.c"; sourceTree = ""; }; - 043011FE21DCF2B00007084D /* VertexEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexEffect.h; path = "../cocos/editor-support/spine/VertexEffect.h"; sourceTree = ""; }; - 043011FF21DCF2B00007084D /* TransformConstraintData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformConstraintData.h; path = "../cocos/editor-support/spine/TransformConstraintData.h"; sourceTree = ""; }; - 0430120021DCF2B00007084D /* AtlasAttachmentLoader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = AtlasAttachmentLoader.c; path = "../cocos/editor-support/spine/AtlasAttachmentLoader.c"; sourceTree = ""; }; - 0430120121DCF2B00007084D /* Skin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Skin.c; path = "../cocos/editor-support/spine/Skin.c"; sourceTree = ""; }; - 0430120221DCF2B10007084D /* PathConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraint.h; path = "../cocos/editor-support/spine/PathConstraint.h"; sourceTree = ""; }; - 0430120321DCF2B10007084D /* PathConstraintData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraintData.h; path = "../cocos/editor-support/spine/PathConstraintData.h"; sourceTree = ""; }; - 0430120421DCF2B10007084D /* IkConstraint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IkConstraint.c; path = "../cocos/editor-support/spine/IkConstraint.c"; sourceTree = ""; }; - 0430120521DCF2B10007084D /* SkeletonBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonBounds.h; path = "../cocos/editor-support/spine/SkeletonBounds.h"; sourceTree = ""; }; - 0430120621DCF2B10007084D /* SkeletonData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SkeletonData.c; path = "../cocos/editor-support/spine/SkeletonData.c"; sourceTree = ""; }; - 0430120721DCF2B10007084D /* PathAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = PathAttachment.c; path = "../cocos/editor-support/spine/PathAttachment.c"; sourceTree = ""; }; - 0430120821DCF2B20007084D /* SlotData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SlotData.h; path = "../cocos/editor-support/spine/SlotData.h"; sourceTree = ""; }; - 0430120921DCF2B20007084D /* Skeleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Skeleton.h; path = "../cocos/editor-support/spine/Skeleton.h"; sourceTree = ""; }; - 0430120A21DCF2B20007084D /* Event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Event.c; path = "../cocos/editor-support/spine/Event.c"; sourceTree = ""; }; - 0430120B21DCF2B20007084D /* Attachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Attachment.c; path = "../cocos/editor-support/spine/Attachment.c"; sourceTree = ""; }; - 0430120C21DCF2B20007084D /* AnimationStateData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = AnimationStateData.c; path = "../cocos/editor-support/spine/AnimationStateData.c"; sourceTree = ""; }; - 0430120D21DCF2B20007084D /* AttachmentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentLoader.h; path = "../cocos/editor-support/spine/AttachmentLoader.h"; sourceTree = ""; }; - 0430120E21DCF2B30007084D /* IkConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IkConstraint.h; path = "../cocos/editor-support/spine/IkConstraint.h"; sourceTree = ""; }; - 0430120F21DCF2B30007084D /* SkeletonBinary.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SkeletonBinary.c; path = "../cocos/editor-support/spine/SkeletonBinary.c"; sourceTree = ""; }; - 0430121021DCF2B30007084D /* VertexAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexAttachment.h; path = "../cocos/editor-support/spine/VertexAttachment.h"; sourceTree = ""; }; - 0430121121DCF2B30007084D /* PointAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PointAttachment.h; path = "../cocos/editor-support/spine/PointAttachment.h"; sourceTree = ""; }; - 0430121221DCF2B30007084D /* SkeletonData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonData.h; path = "../cocos/editor-support/spine/SkeletonData.h"; sourceTree = ""; }; - 0430121321DCF2B40007084D /* Array.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Array.c; path = "../cocos/editor-support/spine/Array.c"; sourceTree = ""; }; - 0430121421DCF2B40007084D /* Animation.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Animation.c; path = "../cocos/editor-support/spine/Animation.c"; sourceTree = ""; }; - 0430121521DCF2B40007084D /* AnimationStateData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationStateData.h; path = "../cocos/editor-support/spine/AnimationStateData.h"; sourceTree = ""; }; - 0430121621DCF2B40007084D /* MeshAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = MeshAttachment.c; path = "../cocos/editor-support/spine/MeshAttachment.c"; sourceTree = ""; }; - 0430121721DCF2B50007084D /* SkeletonJson.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SkeletonJson.c; path = "../cocos/editor-support/spine/SkeletonJson.c"; sourceTree = ""; }; - 0430121821DCF2B50007084D /* extension.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = extension.c; path = "../cocos/editor-support/spine/extension.c"; sourceTree = ""; }; - 0430121921DCF2B50007084D /* PointAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = PointAttachment.c; path = "../cocos/editor-support/spine/PointAttachment.c"; sourceTree = ""; }; - 0430121A21DCF2B60007084D /* Slot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Slot.h; path = "../cocos/editor-support/spine/Slot.h"; sourceTree = ""; }; - 0430121B21DCF2B60007084D /* VertexAttachment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = VertexAttachment.c; path = "../cocos/editor-support/spine/VertexAttachment.c"; sourceTree = ""; }; - 0430121C21DCF2B60007084D /* Json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Json.h; path = "../cocos/editor-support/spine/Json.h"; sourceTree = ""; }; - 0430121D21DCF2B60007084D /* IkConstraintData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = IkConstraintData.c; path = "../cocos/editor-support/spine/IkConstraintData.c"; sourceTree = ""; }; - 0430121E21DCF2B70007084D /* IkConstraintData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IkConstraintData.h; path = "../cocos/editor-support/spine/IkConstraintData.h"; sourceTree = ""; }; - 0430121F21DCF2B70007084D /* dll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dll.h; path = "../cocos/editor-support/spine/dll.h"; sourceTree = ""; }; - 0430122021DCF2B70007084D /* kvec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kvec.h; path = "../cocos/editor-support/spine/kvec.h"; sourceTree = ""; }; 04355814217EADF300B9C056 /* IOBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOBuffer.cpp; path = "../cocos/editor-support/IOBuffer.cpp"; sourceTree = ""; }; 04355815217EADF300B9C056 /* IOBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOBuffer.h; path = "../cocos/editor-support/IOBuffer.h"; sourceTree = ""; }; + 044DE376227552520037572E /* VertexEffectDelegate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = VertexEffectDelegate.cpp; path = "../cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp"; sourceTree = ""; }; + 044DE377227552520037572E /* VertexEffectDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VertexEffectDelegate.h; path = "../cocos/editor-support/spine-creator-support/VertexEffectDelegate.h"; sourceTree = ""; }; + 046AA880223B4743005191A4 /* SkeletonClipping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonClipping.h; path = "../cocos/editor-support/spine/SkeletonClipping.h"; sourceTree = ""; }; + 046AA881223B4743005191A4 /* SpineObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpineObject.h; path = "../cocos/editor-support/spine/SpineObject.h"; sourceTree = ""; }; + 046AA882223B4743005191A4 /* PathConstraintData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraintData.h; path = "../cocos/editor-support/spine/PathConstraintData.h"; sourceTree = ""; }; + 046AA883223B4743005191A4 /* PathConstraintPositionTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathConstraintPositionTimeline.cpp; path = "../cocos/editor-support/spine/PathConstraintPositionTimeline.cpp"; sourceTree = ""; }; + 046AA884223B4743005191A4 /* Pool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Pool.h; path = "../cocos/editor-support/spine/Pool.h"; sourceTree = ""; }; + 046AA885223B4744005191A4 /* Atlas.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Atlas.h; path = "../cocos/editor-support/spine/Atlas.h"; sourceTree = ""; }; + 046AA886223B4744005191A4 /* IkConstraintData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IkConstraintData.h; path = "../cocos/editor-support/spine/IkConstraintData.h"; sourceTree = ""; }; + 046AA887223B4744005191A4 /* TwoColorTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TwoColorTimeline.h; path = "../cocos/editor-support/spine/TwoColorTimeline.h"; sourceTree = ""; }; + 046AA888223B4744005191A4 /* AttachmentTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentTimeline.h; path = "../cocos/editor-support/spine/AttachmentTimeline.h"; sourceTree = ""; }; + 046AA889223B4744005191A4 /* IkConstraintData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IkConstraintData.cpp; path = "../cocos/editor-support/spine/IkConstraintData.cpp"; sourceTree = ""; }; + 046AA88A223B4744005191A4 /* DrawOrderTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DrawOrderTimeline.cpp; path = "../cocos/editor-support/spine/DrawOrderTimeline.cpp"; sourceTree = ""; }; + 046AA88B223B4744005191A4 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Event.cpp; path = "../cocos/editor-support/spine/Event.cpp"; sourceTree = ""; }; + 046AA88C223B4745005191A4 /* AnimationState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AnimationState.cpp; path = "../cocos/editor-support/spine/AnimationState.cpp"; sourceTree = ""; }; + 046AA88D223B4745005191A4 /* RotateTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RotateTimeline.cpp; path = "../cocos/editor-support/spine/RotateTimeline.cpp"; sourceTree = ""; }; + 046AA88E223B4745005191A4 /* SpineString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpineString.h; path = "../cocos/editor-support/spine/SpineString.h"; sourceTree = ""; }; + 046AA88F223B4745005191A4 /* IkConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IkConstraint.h; path = "../cocos/editor-support/spine/IkConstraint.h"; sourceTree = ""; }; + 046AA890223B4745005191A4 /* ScaleTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScaleTimeline.h; path = "../cocos/editor-support/spine/ScaleTimeline.h"; sourceTree = ""; }; + 046AA891223B4745005191A4 /* MixDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MixDirection.h; path = "../cocos/editor-support/spine/MixDirection.h"; sourceTree = ""; }; + 046AA892223B4746005191A4 /* EventData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EventData.cpp; path = "../cocos/editor-support/spine/EventData.cpp"; sourceTree = ""; }; + 046AA893223B4746005191A4 /* AttachmentTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttachmentTimeline.cpp; path = "../cocos/editor-support/spine/AttachmentTimeline.cpp"; sourceTree = ""; }; + 046AA894223B4746005191A4 /* CurveTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CurveTimeline.cpp; path = "../cocos/editor-support/spine/CurveTimeline.cpp"; sourceTree = ""; }; + 046AA895223B4746005191A4 /* DeformTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeformTimeline.h; path = "../cocos/editor-support/spine/DeformTimeline.h"; sourceTree = ""; }; + 046AA896223B4746005191A4 /* PathConstraintData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathConstraintData.cpp; path = "../cocos/editor-support/spine/PathConstraintData.cpp"; sourceTree = ""; }; + 046AA897223B4746005191A4 /* Timeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Timeline.cpp; path = "../cocos/editor-support/spine/Timeline.cpp"; sourceTree = ""; }; + 046AA898223B4747005191A4 /* VertexAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VertexAttachment.cpp; path = "../cocos/editor-support/spine/VertexAttachment.cpp"; sourceTree = ""; }; + 046AA899223B4747005191A4 /* Slot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Slot.h; path = "../cocos/editor-support/spine/Slot.h"; sourceTree = ""; }; + 046AA89A223B4747005191A4 /* Updatable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Updatable.h; path = "../cocos/editor-support/spine/Updatable.h"; sourceTree = ""; }; + 046AA89B223B4747005191A4 /* PathConstraintMixTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraintMixTimeline.h; path = "../cocos/editor-support/spine/PathConstraintMixTimeline.h"; sourceTree = ""; }; + 046AA89C223B4747005191A4 /* Attachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Attachment.cpp; path = "../cocos/editor-support/spine/Attachment.cpp"; sourceTree = ""; }; + 046AA89D223B4747005191A4 /* Skeleton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Skeleton.cpp; path = "../cocos/editor-support/spine/Skeleton.cpp"; sourceTree = ""; }; + 046AA89E223B4748005191A4 /* AnimationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationState.h; path = "../cocos/editor-support/spine/AnimationState.h"; sourceTree = ""; }; + 046AA89F223B4748005191A4 /* Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Extension.h; path = "../cocos/editor-support/spine/Extension.h"; sourceTree = ""; }; + 046AA8A0223B4748005191A4 /* PathAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathAttachment.h; path = "../cocos/editor-support/spine/PathAttachment.h"; sourceTree = ""; }; + 046AA8A1223B4748005191A4 /* Constraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Constraint.cpp; path = "../cocos/editor-support/spine/Constraint.cpp"; sourceTree = ""; }; + 046AA8A2223B4748005191A4 /* PathConstraintSpacingTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraintSpacingTimeline.h; path = "../cocos/editor-support/spine/PathConstraintSpacingTimeline.h"; sourceTree = ""; }; + 046AA8A3223B4749005191A4 /* ColorTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ColorTimeline.h; path = "../cocos/editor-support/spine/ColorTimeline.h"; sourceTree = ""; }; + 046AA8A4223B4749005191A4 /* PathConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraint.h; path = "../cocos/editor-support/spine/PathConstraint.h"; sourceTree = ""; }; + 046AA8A5223B4749005191A4 /* PathConstraintSpacingTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathConstraintSpacingTimeline.cpp; path = "../cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp"; sourceTree = ""; }; + 046AA8A6223B4749005191A4 /* TextureLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextureLoader.h; path = "../cocos/editor-support/spine/TextureLoader.h"; sourceTree = ""; }; + 046AA8A7223B4749005191A4 /* TwoColorTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TwoColorTimeline.cpp; path = "../cocos/editor-support/spine/TwoColorTimeline.cpp"; sourceTree = ""; }; + 046AA8A8223B474A005191A4 /* Vertices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Vertices.h; path = "../cocos/editor-support/spine/Vertices.h"; sourceTree = ""; }; + 046AA8A9223B474A005191A4 /* SkeletonBinary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonBinary.h; path = "../cocos/editor-support/spine/SkeletonBinary.h"; sourceTree = ""; }; + 046AA8AA223B474A005191A4 /* LinkedMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LinkedMesh.cpp; path = "../cocos/editor-support/spine/LinkedMesh.cpp"; sourceTree = ""; }; + 046AA8AB223B474A005191A4 /* RTTI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RTTI.h; path = "../cocos/editor-support/spine/RTTI.h"; sourceTree = ""; }; + 046AA8AC223B474A005191A4 /* MixBlend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MixBlend.h; path = "../cocos/editor-support/spine/MixBlend.h"; sourceTree = ""; }; + 046AA8AD223B474B005191A4 /* BoneData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoneData.h; path = "../cocos/editor-support/spine/BoneData.h"; sourceTree = ""; }; + 046AA8AE223B474B005191A4 /* TransformConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformConstraint.h; path = "../cocos/editor-support/spine/TransformConstraint.h"; sourceTree = ""; }; + 046AA8AF223B474B005191A4 /* MathUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MathUtil.h; path = "../cocos/editor-support/spine/MathUtil.h"; sourceTree = ""; }; + 046AA8B0223B474B005191A4 /* SkeletonBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonBinary.cpp; path = "../cocos/editor-support/spine/SkeletonBinary.cpp"; sourceTree = ""; }; + 046AA8B1223B474C005191A4 /* Timeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Timeline.h; path = "../cocos/editor-support/spine/Timeline.h"; sourceTree = ""; }; + 046AA8B2223B474C005191A4 /* TransformConstraintTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformConstraintTimeline.h; path = "../cocos/editor-support/spine/TransformConstraintTimeline.h"; sourceTree = ""; }; + 046AA8B3223B474C005191A4 /* TimelineType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TimelineType.h; path = "../cocos/editor-support/spine/TimelineType.h"; sourceTree = ""; }; + 046AA8B4223B474C005191A4 /* AtlasAttachmentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtlasAttachmentLoader.cpp; path = "../cocos/editor-support/spine/AtlasAttachmentLoader.cpp"; sourceTree = ""; }; + 046AA8B5223B474D005191A4 /* VertexEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VertexEffect.cpp; path = "../cocos/editor-support/spine/VertexEffect.cpp"; sourceTree = ""; }; + 046AA8B6223B474D005191A4 /* RotateMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RotateMode.h; path = "../cocos/editor-support/spine/RotateMode.h"; sourceTree = ""; }; + 046AA8B7223B474D005191A4 /* SkeletonJson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonJson.h; path = "../cocos/editor-support/spine/SkeletonJson.h"; sourceTree = ""; }; + 046AA8B8223B474D005191A4 /* AttachmentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentType.h; path = "../cocos/editor-support/spine/AttachmentType.h"; sourceTree = ""; }; + 046AA8B9223B474E005191A4 /* Skin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Skin.cpp; path = "../cocos/editor-support/spine/Skin.cpp"; sourceTree = ""; }; + 046AA8BA223B474E005191A4 /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Vector.h; path = "../cocos/editor-support/spine/Vector.h"; sourceTree = ""; }; + 046AA8BB223B474E005191A4 /* ShearTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ShearTimeline.cpp; path = "../cocos/editor-support/spine/ShearTimeline.cpp"; sourceTree = ""; }; + 046AA8BC223B474E005191A4 /* Bone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bone.h; path = "../cocos/editor-support/spine/Bone.h"; sourceTree = ""; }; + 046AA8BD223B474F005191A4 /* TextureLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextureLoader.cpp; path = "../cocos/editor-support/spine/TextureLoader.cpp"; sourceTree = ""; }; + 046AA8BE223B474F005191A4 /* PointAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PointAttachment.cpp; path = "../cocos/editor-support/spine/PointAttachment.cpp"; sourceTree = ""; }; + 046AA8BF223B474F005191A4 /* EventTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EventTimeline.cpp; path = "../cocos/editor-support/spine/EventTimeline.cpp"; sourceTree = ""; }; + 046AA8C0223B474F005191A4 /* BoneData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BoneData.cpp; path = "../cocos/editor-support/spine/BoneData.cpp"; sourceTree = ""; }; + 046AA8C1223B4750005191A4 /* RotateTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RotateTimeline.h; path = "../cocos/editor-support/spine/RotateTimeline.h"; sourceTree = ""; }; + 046AA8C2223B4750005191A4 /* Json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Json.cpp; path = "../cocos/editor-support/spine/Json.cpp"; sourceTree = ""; }; + 046AA8C3223B4750005191A4 /* VertexAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexAttachment.h; path = "../cocos/editor-support/spine/VertexAttachment.h"; sourceTree = ""; }; + 046AA8C4223B4750005191A4 /* IkConstraintTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IkConstraintTimeline.cpp; path = "../cocos/editor-support/spine/IkConstraintTimeline.cpp"; sourceTree = ""; }; + 046AA8C5223B4751005191A4 /* Atlas.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Atlas.cpp; path = "../cocos/editor-support/spine/Atlas.cpp"; sourceTree = ""; }; + 046AA8C6223B4751005191A4 /* dll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dll.h; path = "../cocos/editor-support/spine/dll.h"; sourceTree = ""; }; + 046AA8C7223B4751005191A4 /* HashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HashMap.h; path = "../cocos/editor-support/spine/HashMap.h"; sourceTree = ""; }; + 046AA8C8223B4751005191A4 /* AttachmentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttachmentLoader.cpp; path = "../cocos/editor-support/spine/AttachmentLoader.cpp"; sourceTree = ""; }; + 046AA8C9223B4752005191A4 /* BlendMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlendMode.h; path = "../cocos/editor-support/spine/BlendMode.h"; sourceTree = ""; }; + 046AA8CA223B4752005191A4 /* SpineObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpineObject.cpp; path = "../cocos/editor-support/spine/SpineObject.cpp"; sourceTree = ""; }; + 046AA8CB223B4752005191A4 /* TranslateTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TranslateTimeline.cpp; path = "../cocos/editor-support/spine/TranslateTimeline.cpp"; sourceTree = ""; }; + 046AA8CC223B4752005191A4 /* SlotData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SlotData.cpp; path = "../cocos/editor-support/spine/SlotData.cpp"; sourceTree = ""; }; + 046AA8CD223B4753005191A4 /* spine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spine.h; path = "../cocos/editor-support/spine/spine.h"; sourceTree = ""; }; + 046AA8CE223B4753005191A4 /* RegionAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegionAttachment.cpp; path = "../cocos/editor-support/spine/RegionAttachment.cpp"; sourceTree = ""; }; + 046AA8CF223B4753005191A4 /* Extension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Extension.cpp; path = "../cocos/editor-support/spine/Extension.cpp"; sourceTree = ""; }; + 046AA8D0223B4753005191A4 /* VertexEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexEffect.h; path = "../cocos/editor-support/spine/VertexEffect.h"; sourceTree = ""; }; + 046AA8D1223B4754005191A4 /* Slot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Slot.cpp; path = "../cocos/editor-support/spine/Slot.cpp"; sourceTree = ""; }; + 046AA8D2223B4754005191A4 /* AnimationStateData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationStateData.h; path = "../cocos/editor-support/spine/AnimationStateData.h"; sourceTree = ""; }; + 046AA8D3223B4754005191A4 /* PositionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PositionMode.h; path = "../cocos/editor-support/spine/PositionMode.h"; sourceTree = ""; }; + 046AA8D4223B4754005191A4 /* HasRendererObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HasRendererObject.h; path = "../cocos/editor-support/spine/HasRendererObject.h"; sourceTree = ""; }; + 046AA8D5223B4755005191A4 /* AttachmentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentLoader.h; path = "../cocos/editor-support/spine/AttachmentLoader.h"; sourceTree = ""; }; + 046AA8D6223B4755005191A4 /* TransformConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformConstraint.cpp; path = "../cocos/editor-support/spine/TransformConstraint.cpp"; sourceTree = ""; }; + 046AA8D7223B4755005191A4 /* TransformConstraintTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformConstraintTimeline.cpp; path = "../cocos/editor-support/spine/TransformConstraintTimeline.cpp"; sourceTree = ""; }; + 046AA8D8223B4755005191A4 /* DrawOrderTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawOrderTimeline.h; path = "../cocos/editor-support/spine/DrawOrderTimeline.h"; sourceTree = ""; }; + 046AA8D9223B4755005191A4 /* SkeletonBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonBounds.h; path = "../cocos/editor-support/spine/SkeletonBounds.h"; sourceTree = ""; }; + 046AA8DA223B4756005191A4 /* ContainerUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContainerUtil.h; path = "../cocos/editor-support/spine/ContainerUtil.h"; sourceTree = ""; }; + 046AA8DB223B4756005191A4 /* BoundingBoxAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BoundingBoxAttachment.cpp; path = "../cocos/editor-support/spine/BoundingBoxAttachment.cpp"; sourceTree = ""; }; + 046AA8DC223B4756005191A4 /* SkeletonJson.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonJson.cpp; path = "../cocos/editor-support/spine/SkeletonJson.cpp"; sourceTree = ""; }; + 046AA8DD223B4756005191A4 /* SlotData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SlotData.h; path = "../cocos/editor-support/spine/SlotData.h"; sourceTree = ""; }; + 046AA8DE223B4756005191A4 /* SpacingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpacingMode.h; path = "../cocos/editor-support/spine/SpacingMode.h"; sourceTree = ""; }; + 046AA8DF223B4757005191A4 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Event.h; path = "../cocos/editor-support/spine/Event.h"; sourceTree = ""; }; + 046AA8E0223B4757005191A4 /* RTTI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RTTI.cpp; path = "../cocos/editor-support/spine/RTTI.cpp"; sourceTree = ""; }; + 046AA8E1223B4757005191A4 /* Constraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Constraint.h; path = "../cocos/editor-support/spine/Constraint.h"; sourceTree = ""; }; + 046AA8E2223B4757005191A4 /* Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Debug.h; path = "../cocos/editor-support/spine/Debug.h"; sourceTree = ""; }; + 046AA8E3223B4757005191A4 /* ClippingAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClippingAttachment.h; path = "../cocos/editor-support/spine/ClippingAttachment.h"; sourceTree = ""; }; + 046AA8E4223B4758005191A4 /* CurveTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CurveTimeline.h; path = "../cocos/editor-support/spine/CurveTimeline.h"; sourceTree = ""; }; + 046AA8E5223B4758005191A4 /* SkeletonBounds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonBounds.cpp; path = "../cocos/editor-support/spine/SkeletonBounds.cpp"; sourceTree = ""; }; + 046AA8E6223B4758005191A4 /* TranslateTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TranslateTimeline.h; path = "../cocos/editor-support/spine/TranslateTimeline.h"; sourceTree = ""; }; + 046AA8E7223B4758005191A4 /* Triangulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Triangulator.cpp; path = "../cocos/editor-support/spine/Triangulator.cpp"; sourceTree = ""; }; + 046AA8E8223B4759005191A4 /* Animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Animation.h; path = "../cocos/editor-support/spine/Animation.h"; sourceTree = ""; }; + 046AA8E9223B4759005191A4 /* TransformConstraintData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformConstraintData.h; path = "../cocos/editor-support/spine/TransformConstraintData.h"; sourceTree = ""; }; + 046AA8EA223B4759005191A4 /* PathConstraintMixTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathConstraintMixTimeline.cpp; path = "../cocos/editor-support/spine/PathConstraintMixTimeline.cpp"; sourceTree = ""; }; + 046AA8EB223B4759005191A4 /* PathAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathAttachment.cpp; path = "../cocos/editor-support/spine/PathAttachment.cpp"; sourceTree = ""; }; + 046AA8EC223B4759005191A4 /* Skin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Skin.h; path = "../cocos/editor-support/spine/Skin.h"; sourceTree = ""; }; + 046AA8ED223B475A005191A4 /* Color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Color.h; path = "../cocos/editor-support/spine/Color.h"; sourceTree = ""; }; + 046AA8EE223B475A005191A4 /* Json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Json.h; path = "../cocos/editor-support/spine/Json.h"; sourceTree = ""; }; + 046AA8EF223B475A005191A4 /* TransformMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformMode.h; path = "../cocos/editor-support/spine/TransformMode.h"; sourceTree = ""; }; + 046AA8F0223B475A005191A4 /* SkeletonData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonData.h; path = "../cocos/editor-support/spine/SkeletonData.h"; sourceTree = ""; }; + 046AA8F1223B475B005191A4 /* MathUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MathUtil.cpp; path = "../cocos/editor-support/spine/MathUtil.cpp"; sourceTree = ""; }; + 046AA8F2223B475B005191A4 /* Skeleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Skeleton.h; path = "../cocos/editor-support/spine/Skeleton.h"; sourceTree = ""; }; + 046AA8F3223B475B005191A4 /* PathConstraintPositionTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathConstraintPositionTimeline.h; path = "../cocos/editor-support/spine/PathConstraintPositionTimeline.h"; sourceTree = ""; }; + 046AA8F4223B475B005191A4 /* AnimationStateData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AnimationStateData.cpp; path = "../cocos/editor-support/spine/AnimationStateData.cpp"; sourceTree = ""; }; + 046AA8F5223B475B005191A4 /* TransformConstraintData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformConstraintData.cpp; path = "../cocos/editor-support/spine/TransformConstraintData.cpp"; sourceTree = ""; }; + 046AA8F6223B475C005191A4 /* Attachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Attachment.h; path = "../cocos/editor-support/spine/Attachment.h"; sourceTree = ""; }; + 046AA8F7223B475C005191A4 /* Triangulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Triangulator.h; path = "../cocos/editor-support/spine/Triangulator.h"; sourceTree = ""; }; + 046AA8F8223B475C005191A4 /* EventData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EventData.h; path = "../cocos/editor-support/spine/EventData.h"; sourceTree = ""; }; + 046AA8F9223B475C005191A4 /* Updatable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Updatable.cpp; path = "../cocos/editor-support/spine/Updatable.cpp"; sourceTree = ""; }; + 046AA8FA223B475D005191A4 /* SkeletonClipping.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonClipping.cpp; path = "../cocos/editor-support/spine/SkeletonClipping.cpp"; sourceTree = ""; }; + 046AA8FB223B475D005191A4 /* LinkedMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LinkedMesh.h; path = "../cocos/editor-support/spine/LinkedMesh.h"; sourceTree = ""; }; + 046AA8FC223B475D005191A4 /* BoundingBoxAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoundingBoxAttachment.h; path = "../cocos/editor-support/spine/BoundingBoxAttachment.h"; sourceTree = ""; }; + 046AA8FD223B475D005191A4 /* IkConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IkConstraint.cpp; path = "../cocos/editor-support/spine/IkConstraint.cpp"; sourceTree = ""; }; + 046AA8FE223B475D005191A4 /* ClippingAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClippingAttachment.cpp; path = "../cocos/editor-support/spine/ClippingAttachment.cpp"; sourceTree = ""; }; + 046AA8FF223B475E005191A4 /* MeshAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MeshAttachment.h; path = "../cocos/editor-support/spine/MeshAttachment.h"; sourceTree = ""; }; + 046AA900223B475E005191A4 /* PathConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathConstraint.cpp; path = "../cocos/editor-support/spine/PathConstraint.cpp"; sourceTree = ""; }; + 046AA901223B475E005191A4 /* DeformTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeformTimeline.cpp; path = "../cocos/editor-support/spine/DeformTimeline.cpp"; sourceTree = ""; }; + 046AA902223B475E005191A4 /* EventTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EventTimeline.h; path = "../cocos/editor-support/spine/EventTimeline.h"; sourceTree = ""; }; + 046AA903223B475F005191A4 /* IkConstraintTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IkConstraintTimeline.h; path = "../cocos/editor-support/spine/IkConstraintTimeline.h"; sourceTree = ""; }; + 046AA904223B475F005191A4 /* Animation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Animation.cpp; path = "../cocos/editor-support/spine/Animation.cpp"; sourceTree = ""; }; + 046AA905223B475F005191A4 /* ShearTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ShearTimeline.h; path = "../cocos/editor-support/spine/ShearTimeline.h"; sourceTree = ""; }; + 046AA906223B475F005191A4 /* SkeletonData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonData.cpp; path = "../cocos/editor-support/spine/SkeletonData.cpp"; sourceTree = ""; }; + 046AA907223B4760005191A4 /* ScaleTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScaleTimeline.cpp; path = "../cocos/editor-support/spine/ScaleTimeline.cpp"; sourceTree = ""; }; + 046AA908223B4760005191A4 /* ColorTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ColorTimeline.cpp; path = "../cocos/editor-support/spine/ColorTimeline.cpp"; sourceTree = ""; }; + 046AA909223B4760005191A4 /* Bone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bone.cpp; path = "../cocos/editor-support/spine/Bone.cpp"; sourceTree = ""; }; + 046AA90A223B4760005191A4 /* RegionAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegionAttachment.h; path = "../cocos/editor-support/spine/RegionAttachment.h"; sourceTree = ""; }; + 046AA90B223B4761005191A4 /* PointAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PointAttachment.h; path = "../cocos/editor-support/spine/PointAttachment.h"; sourceTree = ""; }; + 046AA90C223B4761005191A4 /* MeshAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MeshAttachment.cpp; path = "../cocos/editor-support/spine/MeshAttachment.cpp"; sourceTree = ""; }; + 046AA90D223B4761005191A4 /* AtlasAttachmentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtlasAttachmentLoader.h; path = "../cocos/editor-support/spine/AtlasAttachmentLoader.h"; sourceTree = ""; }; 046B6888219FA61200B33469 /* MiddlewareManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MiddlewareManager.cpp; path = "../cocos/editor-support/MiddlewareManager.cpp"; sourceTree = ""; }; 046B6889219FA61200B33469 /* MiddlewareManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MiddlewareManager.h; path = "../cocos/editor-support/MiddlewareManager.h"; sourceTree = ""; }; 046B688E21A00F5600B33469 /* IOTypedArray.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = IOTypedArray.cpp; path = "../cocos/editor-support/IOTypedArray.cpp"; sourceTree = ""; }; @@ -1283,16 +1468,14 @@ 046B68A521A292D200B33469 /* jsb_spine_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_spine_manual.hpp; sourceTree = ""; }; 046B68AA21A294B100B33469 /* jsb_cocos2dx_spine_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_spine_auto.hpp; sourceTree = ""; }; 046B68AB21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_spine_auto.cpp; sourceTree = ""; }; - 046E03E021804E6A00B24E2D /* CreatorAttachmentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CreatorAttachmentLoader.cpp; path = "../cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.cpp"; sourceTree = ""; }; - 046E03E121804E6A00B24E2D /* SpineAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpineAnimation.cpp; path = "../cocos/editor-support/spine-creator-support/SpineAnimation.cpp"; sourceTree = ""; }; - 046E03E221804E6A00B24E2D /* SpineAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpineAnimation.h; path = "../cocos/editor-support/spine-creator-support/SpineAnimation.h"; sourceTree = ""; }; + 046E03E121804E6A00B24E2D /* SkeletonAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonAnimation.cpp; path = "../cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp"; sourceTree = ""; }; + 046E03E221804E6A00B24E2D /* SkeletonAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonAnimation.h; path = "../cocos/editor-support/spine-creator-support/SkeletonAnimation.h"; sourceTree = ""; }; 046E03E321804E6A00B24E2D /* spine-cocos2dx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "spine-cocos2dx.cpp"; path = "../cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp"; sourceTree = ""; }; 046E03E421804E6A00B24E2D /* spine-cocos2dx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "spine-cocos2dx.h"; path = "../cocos/editor-support/spine-creator-support/spine-cocos2dx.h"; sourceTree = ""; }; - 046E03E521804E6A00B24E2D /* SpineRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpineRenderer.h; path = "../cocos/editor-support/spine-creator-support/SpineRenderer.h"; sourceTree = ""; }; - 046E03E621804E6A00B24E2D /* SpineRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpineRenderer.cpp; path = "../cocos/editor-support/spine-creator-support/SpineRenderer.cpp"; sourceTree = ""; }; + 046E03E521804E6A00B24E2D /* SkeletonRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonRenderer.h; path = "../cocos/editor-support/spine-creator-support/SkeletonRenderer.h"; sourceTree = ""; }; + 046E03E621804E6A00B24E2D /* SkeletonRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonRenderer.cpp; path = "../cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp"; sourceTree = ""; }; 046E03E721804E6A00B24E2D /* AttachmentVertices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentVertices.h; path = "../cocos/editor-support/spine-creator-support/AttachmentVertices.h"; sourceTree = ""; }; 046E03E821804E6A00B24E2D /* AttachmentVertices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttachmentVertices.cpp; path = "../cocos/editor-support/spine-creator-support/AttachmentVertices.cpp"; sourceTree = ""; }; - 046E03E921804E6A00B24E2D /* CreatorAttachmentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CreatorAttachmentLoader.h; path = "../cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.h"; sourceTree = ""; }; 046E060B2185B37000B24E2D /* CCArmatureDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCArmatureDisplay.h; path = "../cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h"; sourceTree = ""; }; 046E060C2185B37000B24E2D /* CCSlot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCSlot.cpp; path = "../cocos/editor-support/dragonbones-creator-support/CCSlot.cpp"; sourceTree = ""; }; 046E060D2185B37000B24E2D /* CCTextureAtlasData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCTextureAtlasData.h; path = "../cocos/editor-support/dragonbones-creator-support/CCTextureAtlasData.h"; sourceTree = ""; }; @@ -1935,87 +2118,148 @@ 04355812217EADB900B9C056 /* spine */ = { isa = PBXGroup; children = ( - 0430121421DCF2B40007084D /* Animation.c */, - 043011D621DCF2A80007084D /* Animation.h */, - 043011E921DCF2AB0007084D /* AnimationState.c */, - 043011FA21DCF2AF0007084D /* AnimationState.h */, - 0430120C21DCF2B20007084D /* AnimationStateData.c */, - 0430121521DCF2B40007084D /* AnimationStateData.h */, - 0430121321DCF2B40007084D /* Array.c */, - 043011F121DCF2AC0007084D /* Array.h */, - 043011D021DCF2A70007084D /* Atlas.c */, - 043011EF21DCF2AC0007084D /* Atlas.h */, - 0430120021DCF2B00007084D /* AtlasAttachmentLoader.c */, - 043011EC21DCF2AB0007084D /* AtlasAttachmentLoader.h */, - 0430120B21DCF2B20007084D /* Attachment.c */, - 043011D121DCF2A70007084D /* Attachment.h */, - 043011D921DCF2A80007084D /* AttachmentLoader.c */, - 0430120D21DCF2B20007084D /* AttachmentLoader.h */, - 043011F521DCF2AD0007084D /* Bone.c */, - 043011EB21DCF2AB0007084D /* Bone.h */, - 043011DB21DCF2A90007084D /* BoneData.c */, - 043011EE21DCF2AC0007084D /* BoneData.h */, - 043011F221DCF2AD0007084D /* BoundingBoxAttachment.c */, - 043011D221DCF2A70007084D /* BoundingBoxAttachment.h */, - 043011F421DCF2AD0007084D /* ClippingAttachment.c */, - 043011D521DCF2A80007084D /* ClippingAttachment.h */, - 043011EA21DCF2AB0007084D /* Color.c */, - 043011DF21DCF2A90007084D /* Color.h */, - 0430121F21DCF2B70007084D /* dll.h */, - 0430120A21DCF2B20007084D /* Event.c */, - 043011FC21DCF2AF0007084D /* Event.h */, - 043011F021DCF2AC0007084D /* EventData.c */, - 043011D721DCF2A80007084D /* EventData.h */, - 0430121821DCF2B50007084D /* extension.c */, - 043011DA21DCF2A80007084D /* extension.h */, - 0430120421DCF2B10007084D /* IkConstraint.c */, - 0430120E21DCF2B30007084D /* IkConstraint.h */, - 0430121D21DCF2B60007084D /* IkConstraintData.c */, - 0430121E21DCF2B70007084D /* IkConstraintData.h */, - 043011E221DCF2AA0007084D /* Json.c */, - 0430121C21DCF2B60007084D /* Json.h */, - 0430122021DCF2B70007084D /* kvec.h */, - 0430121621DCF2B40007084D /* MeshAttachment.c */, - 043011D421DCF2A80007084D /* MeshAttachment.h */, - 0430120721DCF2B10007084D /* PathAttachment.c */, - 043011F721DCF2AE0007084D /* PathAttachment.h */, - 043011D321DCF2A70007084D /* PathConstraint.c */, - 0430120221DCF2B10007084D /* PathConstraint.h */, - 043011DD21DCF2A90007084D /* PathConstraintData.c */, - 0430120321DCF2B10007084D /* PathConstraintData.h */, - 0430121921DCF2B50007084D /* PointAttachment.c */, - 0430121121DCF2B30007084D /* PointAttachment.h */, - 043011F621DCF2AD0007084D /* RegionAttachment.c */, - 043011ED21DCF2AC0007084D /* RegionAttachment.h */, - 043011E721DCF2AB0007084D /* Skeleton.c */, - 0430120921DCF2B20007084D /* Skeleton.h */, - 0430120F21DCF2B30007084D /* SkeletonBinary.c */, - 043011E621DCF2AA0007084D /* SkeletonBinary.h */, - 043011F821DCF2AE0007084D /* SkeletonBounds.c */, - 0430120521DCF2B10007084D /* SkeletonBounds.h */, - 043011FD21DCF2AF0007084D /* SkeletonClipping.c */, - 043011FB21DCF2AF0007084D /* SkeletonClipping.h */, - 0430120621DCF2B10007084D /* SkeletonData.c */, - 0430121221DCF2B30007084D /* SkeletonData.h */, - 0430121721DCF2B50007084D /* SkeletonJson.c */, - 043011E121DCF2AA0007084D /* SkeletonJson.h */, - 0430120121DCF2B00007084D /* Skin.c */, - 043011E321DCF2AA0007084D /* Skin.h */, - 043011DC21DCF2A90007084D /* Slot.c */, - 0430121A21DCF2B60007084D /* Slot.h */, - 043011F921DCF2AE0007084D /* SlotData.c */, - 0430120821DCF2B20007084D /* SlotData.h */, - 043011DE21DCF2A90007084D /* spine.h */, - 043011E021DCF2A90007084D /* TransformConstraint.c */, - 043011E521DCF2AA0007084D /* TransformConstraint.h */, - 043011E821DCF2AB0007084D /* TransformConstraintData.c */, - 043011FF21DCF2B00007084D /* TransformConstraintData.h */, - 043011E421DCF2AA0007084D /* Triangulator.c */, - 043011F321DCF2AD0007084D /* Triangulator.h */, - 0430121B21DCF2B60007084D /* VertexAttachment.c */, - 0430121021DCF2B30007084D /* VertexAttachment.h */, - 043011D821DCF2A80007084D /* VertexEffect.c */, - 043011FE21DCF2B00007084D /* VertexEffect.h */, + 046AA904223B475F005191A4 /* Animation.cpp */, + 046AA8E8223B4759005191A4 /* Animation.h */, + 046AA88C223B4745005191A4 /* AnimationState.cpp */, + 046AA89E223B4748005191A4 /* AnimationState.h */, + 046AA8F4223B475B005191A4 /* AnimationStateData.cpp */, + 046AA8D2223B4754005191A4 /* AnimationStateData.h */, + 046AA8C5223B4751005191A4 /* Atlas.cpp */, + 046AA885223B4744005191A4 /* Atlas.h */, + 046AA8B4223B474C005191A4 /* AtlasAttachmentLoader.cpp */, + 046AA90D223B4761005191A4 /* AtlasAttachmentLoader.h */, + 046AA89C223B4747005191A4 /* Attachment.cpp */, + 046AA8F6223B475C005191A4 /* Attachment.h */, + 046AA8C8223B4751005191A4 /* AttachmentLoader.cpp */, + 046AA8D5223B4755005191A4 /* AttachmentLoader.h */, + 046AA893223B4746005191A4 /* AttachmentTimeline.cpp */, + 046AA888223B4744005191A4 /* AttachmentTimeline.h */, + 046AA8B8223B474D005191A4 /* AttachmentType.h */, + 046AA8C9223B4752005191A4 /* BlendMode.h */, + 046AA909223B4760005191A4 /* Bone.cpp */, + 046AA8BC223B474E005191A4 /* Bone.h */, + 046AA8C0223B474F005191A4 /* BoneData.cpp */, + 046AA8AD223B474B005191A4 /* BoneData.h */, + 046AA8DB223B4756005191A4 /* BoundingBoxAttachment.cpp */, + 046AA8FC223B475D005191A4 /* BoundingBoxAttachment.h */, + 046AA8FE223B475D005191A4 /* ClippingAttachment.cpp */, + 046AA8E3223B4757005191A4 /* ClippingAttachment.h */, + 046AA8ED223B475A005191A4 /* Color.h */, + 046AA908223B4760005191A4 /* ColorTimeline.cpp */, + 046AA8A3223B4749005191A4 /* ColorTimeline.h */, + 046AA8A1223B4748005191A4 /* Constraint.cpp */, + 046AA8E1223B4757005191A4 /* Constraint.h */, + 046AA8DA223B4756005191A4 /* ContainerUtil.h */, + 046AA894223B4746005191A4 /* CurveTimeline.cpp */, + 046AA8E4223B4758005191A4 /* CurveTimeline.h */, + 046AA8E2223B4757005191A4 /* Debug.h */, + 046AA901223B475E005191A4 /* DeformTimeline.cpp */, + 046AA895223B4746005191A4 /* DeformTimeline.h */, + 046AA8C6223B4751005191A4 /* dll.h */, + 046AA88A223B4744005191A4 /* DrawOrderTimeline.cpp */, + 046AA8D8223B4755005191A4 /* DrawOrderTimeline.h */, + 046AA88B223B4744005191A4 /* Event.cpp */, + 046AA8DF223B4757005191A4 /* Event.h */, + 046AA892223B4746005191A4 /* EventData.cpp */, + 046AA8F8223B475C005191A4 /* EventData.h */, + 046AA8BF223B474F005191A4 /* EventTimeline.cpp */, + 046AA902223B475E005191A4 /* EventTimeline.h */, + 046AA8CF223B4753005191A4 /* Extension.cpp */, + 046AA89F223B4748005191A4 /* Extension.h */, + 046AA8C7223B4751005191A4 /* HashMap.h */, + 046AA8D4223B4754005191A4 /* HasRendererObject.h */, + 046AA8FD223B475D005191A4 /* IkConstraint.cpp */, + 046AA88F223B4745005191A4 /* IkConstraint.h */, + 046AA889223B4744005191A4 /* IkConstraintData.cpp */, + 046AA886223B4744005191A4 /* IkConstraintData.h */, + 046AA8C4223B4750005191A4 /* IkConstraintTimeline.cpp */, + 046AA903223B475F005191A4 /* IkConstraintTimeline.h */, + 046AA8C2223B4750005191A4 /* Json.cpp */, + 046AA8EE223B475A005191A4 /* Json.h */, + 046AA8AA223B474A005191A4 /* LinkedMesh.cpp */, + 046AA8FB223B475D005191A4 /* LinkedMesh.h */, + 046AA8F1223B475B005191A4 /* MathUtil.cpp */, + 046AA8AF223B474B005191A4 /* MathUtil.h */, + 046AA90C223B4761005191A4 /* MeshAttachment.cpp */, + 046AA8FF223B475E005191A4 /* MeshAttachment.h */, + 046AA8AC223B474A005191A4 /* MixBlend.h */, + 046AA891223B4745005191A4 /* MixDirection.h */, + 046AA8EB223B4759005191A4 /* PathAttachment.cpp */, + 046AA8A0223B4748005191A4 /* PathAttachment.h */, + 046AA900223B475E005191A4 /* PathConstraint.cpp */, + 046AA8A4223B4749005191A4 /* PathConstraint.h */, + 046AA896223B4746005191A4 /* PathConstraintData.cpp */, + 046AA882223B4743005191A4 /* PathConstraintData.h */, + 046AA8EA223B4759005191A4 /* PathConstraintMixTimeline.cpp */, + 046AA89B223B4747005191A4 /* PathConstraintMixTimeline.h */, + 046AA883223B4743005191A4 /* PathConstraintPositionTimeline.cpp */, + 046AA8F3223B475B005191A4 /* PathConstraintPositionTimeline.h */, + 046AA8A5223B4749005191A4 /* PathConstraintSpacingTimeline.cpp */, + 046AA8A2223B4748005191A4 /* PathConstraintSpacingTimeline.h */, + 046AA8BE223B474F005191A4 /* PointAttachment.cpp */, + 046AA90B223B4761005191A4 /* PointAttachment.h */, + 046AA884223B4743005191A4 /* Pool.h */, + 046AA8D3223B4754005191A4 /* PositionMode.h */, + 046AA8CE223B4753005191A4 /* RegionAttachment.cpp */, + 046AA90A223B4760005191A4 /* RegionAttachment.h */, + 046AA8B6223B474D005191A4 /* RotateMode.h */, + 046AA88D223B4745005191A4 /* RotateTimeline.cpp */, + 046AA8C1223B4750005191A4 /* RotateTimeline.h */, + 046AA8E0223B4757005191A4 /* RTTI.cpp */, + 046AA8AB223B474A005191A4 /* RTTI.h */, + 046AA907223B4760005191A4 /* ScaleTimeline.cpp */, + 046AA890223B4745005191A4 /* ScaleTimeline.h */, + 046AA8BB223B474E005191A4 /* ShearTimeline.cpp */, + 046AA905223B475F005191A4 /* ShearTimeline.h */, + 046AA89D223B4747005191A4 /* Skeleton.cpp */, + 046AA8F2223B475B005191A4 /* Skeleton.h */, + 046AA8B0223B474B005191A4 /* SkeletonBinary.cpp */, + 046AA8A9223B474A005191A4 /* SkeletonBinary.h */, + 046AA8E5223B4758005191A4 /* SkeletonBounds.cpp */, + 046AA8D9223B4755005191A4 /* SkeletonBounds.h */, + 046AA8FA223B475D005191A4 /* SkeletonClipping.cpp */, + 046AA880223B4743005191A4 /* SkeletonClipping.h */, + 046AA906223B475F005191A4 /* SkeletonData.cpp */, + 046AA8F0223B475A005191A4 /* SkeletonData.h */, + 046AA8DC223B4756005191A4 /* SkeletonJson.cpp */, + 046AA8B7223B474D005191A4 /* SkeletonJson.h */, + 046AA8B9223B474E005191A4 /* Skin.cpp */, + 046AA8EC223B4759005191A4 /* Skin.h */, + 046AA8D1223B4754005191A4 /* Slot.cpp */, + 046AA899223B4747005191A4 /* Slot.h */, + 046AA8CC223B4752005191A4 /* SlotData.cpp */, + 046AA8DD223B4756005191A4 /* SlotData.h */, + 046AA8DE223B4756005191A4 /* SpacingMode.h */, + 046AA8CD223B4753005191A4 /* spine.h */, + 046AA8CA223B4752005191A4 /* SpineObject.cpp */, + 046AA881223B4743005191A4 /* SpineObject.h */, + 046AA88E223B4745005191A4 /* SpineString.h */, + 046AA8BD223B474F005191A4 /* TextureLoader.cpp */, + 046AA8A6223B4749005191A4 /* TextureLoader.h */, + 046AA897223B4746005191A4 /* Timeline.cpp */, + 046AA8B1223B474C005191A4 /* Timeline.h */, + 046AA8B3223B474C005191A4 /* TimelineType.h */, + 046AA8D6223B4755005191A4 /* TransformConstraint.cpp */, + 046AA8AE223B474B005191A4 /* TransformConstraint.h */, + 046AA8F5223B475B005191A4 /* TransformConstraintData.cpp */, + 046AA8E9223B4759005191A4 /* TransformConstraintData.h */, + 046AA8D7223B4755005191A4 /* TransformConstraintTimeline.cpp */, + 046AA8B2223B474C005191A4 /* TransformConstraintTimeline.h */, + 046AA8EF223B475A005191A4 /* TransformMode.h */, + 046AA8CB223B4752005191A4 /* TranslateTimeline.cpp */, + 046AA8E6223B4758005191A4 /* TranslateTimeline.h */, + 046AA8E7223B4758005191A4 /* Triangulator.cpp */, + 046AA8F7223B475C005191A4 /* Triangulator.h */, + 046AA8A7223B4749005191A4 /* TwoColorTimeline.cpp */, + 046AA887223B4744005191A4 /* TwoColorTimeline.h */, + 046AA8F9223B475C005191A4 /* Updatable.cpp */, + 046AA89A223B4747005191A4 /* Updatable.h */, + 046AA8BA223B474E005191A4 /* Vector.h */, + 046AA898223B4747005191A4 /* VertexAttachment.cpp */, + 046AA8C3223B4750005191A4 /* VertexAttachment.h */, + 046AA8B5223B474D005191A4 /* VertexEffect.cpp */, + 046AA8D0223B4753005191A4 /* VertexEffect.h */, + 046AA8A8223B474A005191A4 /* Vertices.h */, ); name = spine; sourceTree = ""; @@ -2025,16 +2269,16 @@ children = ( 046E03E821804E6A00B24E2D /* AttachmentVertices.cpp */, 046E03E721804E6A00B24E2D /* AttachmentVertices.h */, - 046E03E021804E6A00B24E2D /* CreatorAttachmentLoader.cpp */, - 046E03E921804E6A00B24E2D /* CreatorAttachmentLoader.h */, - 046E03E121804E6A00B24E2D /* SpineAnimation.cpp */, - 046E03E221804E6A00B24E2D /* SpineAnimation.h */, - 046E03E621804E6A00B24E2D /* SpineRenderer.cpp */, - 046E03E521804E6A00B24E2D /* SpineRenderer.h */, + 046E03E121804E6A00B24E2D /* SkeletonAnimation.cpp */, + 046E03E221804E6A00B24E2D /* SkeletonAnimation.h */, + 046E03E621804E6A00B24E2D /* SkeletonRenderer.cpp */, + 046E03E521804E6A00B24E2D /* SkeletonRenderer.h */, 046E03E321804E6A00B24E2D /* spine-cocos2dx.cpp */, 046E03E421804E6A00B24E2D /* spine-cocos2dx.h */, 04F49F3F222A777C00E5CAF1 /* SkeletonDataMgr.cpp */, 04F49F40222A777C00E5CAF1 /* SkeletonDataMgr.h */, + 044DE376227552520037572E /* VertexEffectDelegate.cpp */, + 044DE377227552520037572E /* VertexEffectDelegate.h */, ); name = "spine-creator-support"; sourceTree = ""; @@ -3111,50 +3355,62 @@ buildActionMask = 2147483647; files = ( 046E06802185B43B00B24E2D /* IEventDispatcher.h in Headers */, + 046AA99C223B4761005191A4 /* HashMap.h in Headers */, 1A28FF891F20AFAB007A1D9D /* SRURLUtilities.h in Headers */, 46FDDAA7202ACC6A00931238 /* ForwardRenderer.h in Headers */, + 046AA91A223B4761005191A4 /* IkConstraintData.h in Headers */, 4037F5CC2108751E001C205C /* CCAsyncTaskPool.h in Headers */, + 046AAA0C223B4762005191A4 /* MeshAttachment.h in Headers */, 46AE40052092F3A600F3A228 /* inspector_socket.h in Headers */, 46FDDBC3202ADDCE00931238 /* ccConfig.h in Headers */, + 046AA92A223B4761005191A4 /* SpineString.h in Headers */, + 046AAA12223B4762005191A4 /* EventTimeline.h in Headers */, + 046AAA18223B4762005191A4 /* ShearTimeline.h in Headers */, 46FDDA77202ACC6A00931238 /* Light.h in Headers */, 1A28FF5D1F20AFAB007A1D9D /* SRProxyConnect.h in Headers */, - 0430127921DCF2B80007084D /* Event.h in Headers */, 1A52DB5F205BCDC700350EE3 /* HelperMacros.h in Headers */, 46FDDACF202ACC6A00931238 /* RenderBuffer.h in Headers */, + 046AA9FE223B4762005191A4 /* EventData.h in Headers */, 46FDDAAF202ACC6A00931238 /* Texture2D.h in Headers */, + 046AAA24223B4762005191A4 /* PointAttachment.h in Headers */, 5091A7A319BFABA800AC8789 /* CCPlatformDefine.h in Headers */, 046E06242185B37100B24E2D /* CCSlot.h in Headers */, - 0430122F21DCF2B80007084D /* EventData.h in Headers */, 046E06B72185B49F00B24E2D /* AnimationData.h in Headers */, 46AE3FDF2092F3A600F3A228 /* env.h in Headers */, - 0430124D21DCF2B80007084D /* SkeletonBinary.h in Headers */, 46AE3FE72092F3A600F3A228 /* inspector_io.h in Headers */, + 046AA940223B4761005191A4 /* Slot.h in Headers */, + 046AA9DE223B4762005191A4 /* Animation.h in Headers */, 04ED68DA21F8188F006E82F8 /* MeshBuffer.h in Headers */, + 046AA9EC223B4762005191A4 /* TransformMode.h in Headers */, 46FDDBCF202ADDCE00931238 /* CCMap.h in Headers */, 1A52DB34205BCD9200350EE3 /* Object.hpp in Headers */, 469303962046AE05004A3D6C /* Class.hpp in Headers */, 1A52DB6F205BCDC700350EE3 /* ScriptEngine.hpp in Headers */, 469304002046AE06004A3D6C /* jsb_global.h in Headers */, 1A586C492064C97800B47573 /* EJConvert.h in Headers */, + 046AA9F2223B4762005191A4 /* Skeleton.h in Headers */, 046E03F521804E6B00B24E2D /* spine-cocos2dx.h in Headers */, 046E03FB21804E6B00B24E2D /* AttachmentVertices.h in Headers */, + 044DE37A227552520037572E /* VertexEffectDelegate.h in Headers */, 46AE3FDD2092F3A600F3A228 /* inspector_socket_server.h in Headers */, - 0430126721DCF2B80007084D /* Triangulator.h in Headers */, 4008729620CE20C2002EB77B /* jsb_cocos2dx_network_manual.h in Headers */, + 046AA92E223B4761005191A4 /* ScaleTimeline.h in Headers */, 469303EE2046AE05004A3D6C /* jsb_renderer_auto.hpp in Headers */, 4617863720522469008256E1 /* HttpClient.h in Headers */, + 046AA9BE223B4761005191A4 /* DrawOrderTimeline.h in Headers */, 50ABBD461925AB0000A911A9 /* CCVertex.h in Headers */, 46FDDA9B202ACC6A00931238 /* Effect.h in Headers */, - 0430124321DCF2B80007084D /* SkeletonJson.h in Headers */, 50ABBD3E1925AB0000A911A9 /* CCGeometry.h in Headers */, 46FDDAD9202ACC6A00931238 /* Program.h in Headers */, - 0430122921DCF2B80007084D /* MeshAttachment.h in Headers */, 40CEAEB820CFDC47007A3281 /* CCReachability.h in Headers */, ED30579B1BEC77B70083C3ED /* ConvertUTF.h in Headers */, 46FDDA75202ACC6A00931238 /* Config.h in Headers */, - 0430127F21DCF2B80007084D /* TransformConstraintData.h in Headers */, + 046AA9E6223B4762005191A4 /* Skin.h in Headers */, + 046AA95A223B4761005191A4 /* TextureLoader.h in Headers */, + 046AA956223B4761005191A4 /* PathConstraint.h in Headers */, 469303822046AE05004A3D6C /* Value.hpp in Headers */, 046B689521A10D5800B33469 /* MiddlewareMacro.h in Headers */, + 046AA9B2223B4761005191A4 /* AnimationStateData.h in Headers */, 46FDDAC3202ACC6A00931238 /* FrameBuffer.h in Headers */, 4617863D20522469008256E1 /* HttpResponse.h in Headers */, 1A29D7A320566CAC00168D9A /* CCCanvasRenderingContext2D.h in Headers */, @@ -3163,48 +3419,55 @@ 461DCA3620BBFA2D00B22827 /* EditBox.h in Headers */, 4617862320522469008256E1 /* CCIDownloaderImpl.h in Headers */, 46FDDC66202D504E00931238 /* CCApplication.h in Headers */, + 046AA96C223B4761005191A4 /* MathUtil.h in Headers */, + 046AA97C223B4761005191A4 /* SkeletonJson.h in Headers */, ED3057811BEC76C90083C3ED /* ioapi.h in Headers */, + 046AA9E8223B4762005191A4 /* Color.h in Headers */, + 046AA99A223B4761005191A4 /* dll.h in Headers */, 046E06682185B41B00B24E2D /* Constraint.h in Headers */, + 046AA986223B4761005191A4 /* Bone.h in Headers */, + 046AA968223B4761005191A4 /* BoneData.h in Headers */, + 046AA9FA223B4762005191A4 /* Attachment.h in Headers */, 046B68AC21A294B100B33469 /* jsb_cocos2dx_spine_auto.hpp in Headers */, 469303642046AE05004A3D6C /* RefCounter.hpp in Headers */, 046E06CB2185B49F00B24E2D /* SkinData.h in Headers */, 46FDDA73202ACC6A00931238 /* ProgramLib.h in Headers */, 1A28FF751F20AFAB007A1D9D /* SRHTTPConnectMessage.h in Headers */, 46FDDADF202ACC6A00931238 /* RenderTarget.h in Headers */, + 046AA97A223B4761005191A4 /* RotateMode.h in Headers */, 4617862920522469008256E1 /* Uri.h in Headers */, 469303902046AE05004A3D6C /* MappingUtils.hpp in Headers */, 1AAAC8F5205CB6E9005321B9 /* Export.h in Headers */, + 046AA970223B4761005191A4 /* Timeline.h in Headers */, 046E065E2185B41B00B24E2D /* TransformObject.h in Headers */, 1A28FF5B1F20AFAB007A1D9D /* NSURLRequest+SRWebSocketPrivate.h in Headers */, - 046E03F721804E6B00B24E2D /* SpineRenderer.h in Headers */, + 046E03F721804E6B00B24E2D /* SkeletonRenderer.h in Headers */, 46FDDAAB202ACC6A00931238 /* Types.h in Headers */, 046E06412185B41100B24E2D /* BaseTimelineState.h in Headers */, ED30577D1BEC76C90083C3ED /* crypt.h in Headers */, - 043012AB21DCF2B80007084D /* AnimationStateData.h in Headers */, - 0430124721DCF2B80007084D /* Skin.h in Headers */, - 0430123521DCF2B80007084D /* extension.h in Headers */, 4648882520AC2BC900CD1E4A /* CCRenderTexture.h in Headers */, 46FDDA97202ACC6A00931238 /* Model.h in Headers */, 046E06332185B41100B24E2D /* Animation.h in Headers */, - 043012A121DCF2B80007084D /* VertexAttachment.h in Headers */, 50ABBD4A1925AB0000A911A9 /* Mat4.h in Headers */, - 0430128721DCF2B80007084D /* PathConstraintData.h in Headers */, 046E063F2185B41100B24E2D /* AnimationState.h in Headers */, 1A52DB38205BCD9200350EE3 /* ScriptEngine.hpp in Headers */, 046E068A2185B44A00B24E2D /* BaseFactory.h in Headers */, 1A52DB892060B11800350EE3 /* jsb_platform.h in Headers */, 1A52DB64205BCDC700350EE3 /* ScriptEngine.hpp in Headers */, 46FDDA83202ACC6A00931238 /* Technique.h in Headers */, + 046AA9D4223B4762005191A4 /* ClippingAttachment.h in Headers */, 1A52DB63205BCDC700350EE3 /* Object.hpp in Headers */, - 043012C121DCF2B80007084D /* kvec.h in Headers */, 04F49F43222A777C00E5CAF1 /* SkeletonDataMgr.h in Headers */, + 046AA9FC223B4762005191A4 /* Triangulator.h in Headers */, 469303802046AE05004A3D6C /* config.hpp in Headers */, 46FDDA6D202ACC6A00931238 /* INode.h in Headers */, 046E06782185B42500B24E2D /* BaseObject.h in Headers */, 1A28FF811F20AFAB007A1D9D /* SRRandom.h in Headers */, 50ABC0671926664800A911A9 /* CCPlatformDefine-mac.h in Headers */, + 046AA972223B4761005191A4 /* TransformConstraintTimeline.h in Headers */, 469303922046AE05004A3D6C /* SeApi.h in Headers */, 461786532052301A008256E1 /* CCScheduler.h in Headers */, + 046AA982223B4761005191A4 /* Vector.h in Headers */, 46FDDB4D202ADDCE00931238 /* pvr.h in Headers */, 4617863920522469008256E1 /* CCDownloaderImpl-apple.h in Headers */, 1A52DB73205BCDC700350EE3 /* Base.h in Headers */, @@ -3212,43 +3475,46 @@ 461786632052607E008256E1 /* jsb_socketio.hpp in Headers */, 046E06BD2185B49F00B24E2D /* UserData.h in Headers */, 46FDDBDD202ADDCE00931238 /* TGAlib.h in Headers */, + 046AA94A223B4761005191A4 /* AnimationState.h in Headers */, 046B688C219FA61200B33469 /* MiddlewareManager.h in Headers */, BAEA45551E279D5C00FA219F /* tinydir.h in Headers */, 046B689221A00F5600B33469 /* IOTypedArray.h in Headers */, 46FDDAB7202ACC6A00931238 /* IndexBuffer.h in Headers */, 4617864520522469008256E1 /* HttpAsynConnection-apple.h in Headers */, - 0430129B21DCF2B80007084D /* AttachmentLoader.h in Headers */, 4617865D2052607E008256E1 /* jsb_xmlhttprequest.hpp in Headers */, 46FDDA7B202ACC6A00931238 /* Camera.h in Headers */, 46FDDAA5202ACC6A00931238 /* Scene.h in Headers */, 46FDDB53202ADDCE00931238 /* utlist.h in Headers */, + 046AA9D0223B4762005191A4 /* Constraint.h in Headers */, 046E06622185B41B00B24E2D /* Slot.h in Headers */, 46FDDB5D202ADDCE00931238 /* ccMacros.h in Headers */, 1A29D76B205665BE00168D9A /* jsb_cocos2dx_auto.hpp in Headers */, + 046AA9EA223B4762005191A4 /* Json.h in Headers */, 1A52DB3D205BCD9200350EE3 /* SeApi.h in Headers */, 46FDDABD202ACC6A00931238 /* DeviceGraphics.h in Headers */, 469303982046AE05004A3D6C /* HelperMacros.h in Headers */, + 046AA994223B4761005191A4 /* VertexAttachment.h in Headers */, 46FDDC01202ADDCE00931238 /* ccCArray.h in Headers */, 469304102046AE06004A3D6C /* jsb_helper.hpp in Headers */, - 0430125D21DCF2B80007084D /* BoneData.h in Headers */, 50643BDB19BFAF4400EF68ED /* CCStdC.h in Headers */, + 046AA974223B4761005191A4 /* TimelineType.h in Headers */, 1A28FF591F20AFAB007A1D9D /* NSRunLoop+SRWebSocketPrivate.h in Headers */, 1A29D79A205666F500168D9A /* jsb_opengl_utils.hpp in Headers */, - 0430123D21DCF2B80007084D /* spine.h in Headers */, 46FDDB5B202ADDCE00931238 /* CCData.h in Headers */, 046E06452185B41100B24E2D /* IAnimatable.h in Headers */, 1A29D79E205666F500168D9A /* jsb_opengl_manual.hpp in Headers */, + 046AA916223B4761005191A4 /* Pool.h in Headers */, 469303A22046AE05004A3D6C /* Object.hpp in Headers */, 1A52DAF6205BB81400350EE3 /* CCThreadPool.h in Headers */, - 043012A321DCF2B80007084D /* PointAttachment.h in Headers */, 046E06642185B41B00B24E2D /* Armature.h in Headers */, + 046AA9CA223B4762005191A4 /* SpacingMode.h in Headers */, + 046AAA06223B4762005191A4 /* BoundingBoxAttachment.h in Headers */, 1AAAC8E9205CB6E9005321B9 /* AudioMacros.h in Headers */, 1AAAC8EF205CB6E9005321B9 /* AudioEngine-inl.h in Headers */, - 0430125721DCF2B80007084D /* Bone.h in Headers */, 46FDDB83202ADDCE00931238 /* ccRandom.h in Headers */, 294D7D9A1D0E93A2002CE7B7 /* CCDevice-apple.h in Headers */, 1A28FF851F20AFAB007A1D9D /* SRSIMDHelpers.h in Headers */, - 043012BF21DCF2B80007084D /* dll.h in Headers */, + 046AA966223B4761005191A4 /* MixBlend.h in Headers */, 50ABBD401925AB0000A911A9 /* CCMath.h in Headers */, 046E06F12185B4A500B24E2D /* BinaryDataParser.h in Headers */, ED3057831BEC76C90083C3ED /* unzip.h in Headers */, @@ -3257,14 +3523,16 @@ 46930466204FE20F004A3D6C /* CCLog.h in Headers */, 4617862720522469008256E1 /* WebSocket.h in Headers */, 46FDDA7F202ACC6A00931238 /* Renderer.h in Headers */, + 046AA918223B4761005191A4 /* Atlas.h in Headers */, 46FDDAA1202ACC6A00931238 /* InputAssembler.h in Headers */, - 0430122321DCF2B80007084D /* Attachment.h in Headers */, 46FDDA91202ACC6A00931238 /* Pass.h in Headers */, + 046AA944223B4761005191A4 /* PathConstraintMixTimeline.h in Headers */, + 046AA9DA223B4762005191A4 /* TranslateTimeline.h in Headers */, 046E069F2185B45300B24E2D /* Point.h in Headers */, - 0430125F21DCF2B80007084D /* Atlas.h in Headers */, 04F49F4F222B80C500E5CAF1 /* RenderInfoMgr.h in Headers */, 46FDDAC7202ACC6A00931238 /* GFX.h in Headers */, 46FDDC63202D502F00931238 /* CCApplication.h in Headers */, + 046AA94C223B4761005191A4 /* Extension.h in Headers */, 469303A42046AE05004A3D6C /* ScriptEngine.hpp in Headers */, 46AE3FF32092F3A600F3A228 /* node.h in Headers */, 1A52DB68205BCDC700350EE3 /* Base.h in Headers */, @@ -3273,40 +3541,45 @@ 1A52DB6A205BCDC700350EE3 /* HelperMacros.h in Headers */, 40CEAEB120CFC86D007A3281 /* CustomEventTypes.h in Headers */, 1A52DB23205BCD9200350EE3 /* Class.hpp in Headers */, - 0430127721DCF2B80007084D /* SkeletonClipping.h in Headers */, 046E061A2185B37100B24E2D /* CCFactory.h in Headers */, 046E06D52185B49F00B24E2D /* ArmatureData.h in Headers */, 1A28FF9B1F20AFAB007A1D9D /* SRWebSocket.h in Headers */, 50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, - 0430122D21DCF2B80007084D /* Animation.h in Headers */, 1A28FF611F20AFAB007A1D9D /* SRRunLoopThread.h in Headers */, 469303D22046AE05004A3D6C /* jsb_gfx_auto.hpp in Headers */, + 046AA964223B4761005191A4 /* RTTI.h in Headers */, 046B68A821A292D300B33469 /* jsb_spine_manual.hpp in Headers */, + 046AA9CC223B4762005191A4 /* Event.h in Headers */, + 046AA9E0223B4762005191A4 /* TransformConstraintData.h in Headers */, 1A52DB5E205BCDC700350EE3 /* Class.hpp in Headers */, 4693039C2046AE05004A3D6C /* PlatformUtils.h in Headers */, 046E06C12185B49F00B24E2D /* TextureAtlasData.h in Headers */, 1AAAC8E5205CB6E9005321B9 /* AudioPlayer.h in Headers */, + 046AA9A8223B4761005191A4 /* spine.h in Headers */, 1AAAC8ED205CB6E9005321B9 /* AudioCache.h in Headers */, 046E063D2185B41100B24E2D /* TimelineState.h in Headers */, 46FDDBBB202ADDCE00931238 /* CCRefPtr.h in Headers */, + 046AA9B4223B4761005191A4 /* PositionMode.h in Headers */, + 046AA9EE223B4762005191A4 /* SkeletonData.h in Headers */, 046E06182185B37100B24E2D /* CCTextureAtlasData.h in Headers */, + 046AA94E223B4761005191A4 /* PathAttachment.h in Headers */, 046E067B2185B42F00B24E2D /* DragonBonesHeaders.h in Headers */, 046E06C72185B49F00B24E2D /* DisplayData.h in Headers */, 46FDDADB202ACC6A00931238 /* State.h in Headers */, 1A29D771205665D200168D9A /* jsb_cocos2dx_manual.hpp in Headers */, 46AE3FFF2092F3A600F3A228 /* v8_inspector_protocol_json.h in Headers */, - 046E03F121804E6B00B24E2D /* SpineAnimation.h in Headers */, - 0430122521DCF2B80007084D /* BoundingBoxAttachment.h in Headers */, + 046E03F121804E6B00B24E2D /* SkeletonAnimation.h in Headers */, 046E06842185B43B00B24E2D /* EventObject.h in Headers */, 046E06ED2185B4A500B24E2D /* JSONDataParser.h in Headers */, - 0430125B21DCF2B80007084D /* RegionAttachment.h in Headers */, 046E06F32185B4A500B24E2D /* DataParser.h in Headers */, 46FDDACB202ACC6A00931238 /* VertexFormat.h in Headers */, 46FDDA81202ACC6A00931238 /* RendererUtils.h in Headers */, 469304142046AE06004A3D6C /* jsb_renderer_manual.hpp in Headers */, 46FDDAD1202ACC6A00931238 /* Texture.h in Headers */, 1A52DB72205BCDC700350EE3 /* Utils.hpp in Headers */, + 046AA952223B4761005191A4 /* PathConstraintSpacingTimeline.h in Headers */, 1A52DB70205BCDC700350EE3 /* SeApi.h in Headers */, + 046AA9F4223B4762005191A4 /* PathConstraintPositionTimeline.h in Headers */, 046E06DB2185B49F00B24E2D /* ConstraintData.h in Headers */, 1A28FF971F20AFAB007A1D9D /* SRSecurityPolicy.h in Headers */, 04355818217EADF300B9C056 /* IOBuffer.h in Headers */, @@ -3319,16 +3592,18 @@ 50ABBD421925AB0000A911A9 /* CCMathBase.h in Headers */, 469303862046AE05004A3D6C /* Object.hpp in Headers */, 1A29D788205666B200168D9A /* LocalStorage.h in Headers */, - 0430127521DCF2B80007084D /* AnimationState.h in Headers */, 50ABBD4E1925AB0000A911A9 /* MathUtil.h in Headers */, 1A52DB67205BCDC700350EE3 /* Utils.hpp in Headers */, + 046AA9AE223B4761005191A4 /* VertexEffect.h in Headers */, 1A52DB25205BCD9200350EE3 /* HelperMacros.h in Headers */, 469303AC2046AE05004A3D6C /* Utils.hpp in Headers */, + 046AA9C8223B4762005191A4 /* SlotData.h in Headers */, 1A28FF911F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.h in Headers */, + 046AAA04223B4762005191A4 /* LinkedMesh.h in Headers */, 46FDDAAD202ACC6A00931238 /* Macro.h in Headers */, 046E070B218B015100B24E2D /* jsb_cocos2dx_dragonbones_auto.hpp in Headers */, 461786672052607E008256E1 /* jsb_websocket.hpp in Headers */, - 0430123F21DCF2B80007084D /* Color.h in Headers */, + 046AA960223B4761005191A4 /* SkeletonBinary.h in Headers */, 50ABC01B1926664800A911A9 /* CCSAXParser.h in Headers */, 1A28FF691F20AFAB007A1D9D /* SRConstants.h in Headers */, ED3057891BEC773E0083C3ED /* tinyxml2.h in Headers */, @@ -3338,45 +3613,48 @@ 50ABBD621925AB0000A911A9 /* Vec4.h in Headers */, 46AE40092092F3A600F3A228 /* node_debug_options.h in Headers */, 046E06CF2185B49F00B24E2D /* BoundingBoxData.h in Headers */, - 0430129321DCF2B80007084D /* Skeleton.h in Headers */, + 046AA910223B4761005191A4 /* SpineObject.h in Headers */, 1A28FF791F20AFAB007A1D9D /* SRLog.h in Headers */, 469303AE2046AE05004A3D6C /* Base.h in Headers */, + 046AAA22223B4762005191A4 /* RegionAttachment.h in Headers */, 46FDDB6D202ADDCE00931238 /* etc1.h in Headers */, 46FDDBB7202ADDCE00931238 /* ccUtils.h in Headers */, + 046AA942223B4761005191A4 /* Updatable.h in Headers */, 046E06762185B42500B24E2D /* DragonBones.h in Headers */, - 0430122B21DCF2B80007084D /* ClippingAttachment.h in Headers */, 46FDDB6B202ADDCE00931238 /* base64.h in Headers */, - 046E03FF21804E6B00B24E2D /* CreatorAttachmentLoader.h in Headers */, + 046AAA14223B4762005191A4 /* IkConstraintTimeline.h in Headers */, 046E06D92185B49F00B24E2D /* CanvasData.h in Headers */, 1A52DB45205BCD9200350EE3 /* Base.h in Headers */, + 046AA9B8223B4761005191A4 /* AttachmentLoader.h in Headers */, 1A52DB65205BCDC700350EE3 /* SeApi.h in Headers */, - 043012B521DCF2B80007084D /* Slot.h in Headers */, 046E06602185B41B00B24E2D /* DeformVertices.h in Headers */, - 0430129D21DCF2B80007084D /* IkConstraint.h in Headers */, + 046AA9A0223B4761005191A4 /* BlendMode.h in Headers */, 1A28FF6D1F20AFAB007A1D9D /* SRError.h in Headers */, + 046AA9D2223B4762005191A4 /* Debug.h in Headers */, 46AE3FE32092F3A600F3A228 /* inspector_agent.h in Headers */, - 0430126F21DCF2B80007084D /* PathAttachment.h in Headers */, 46AE3FEB2092F3A600F3A228 /* node_mutex.h in Headers */, 046E063B2185B41100B24E2D /* WorldClock.h in Headers */, + 046AA95E223B4761005191A4 /* Vertices.h in Headers */, + 046AA92C223B4761005191A4 /* IkConstraint.h in Headers */, 046E06F92189990700B24E2D /* middleware-adapter.h in Headers */, + 046AA954223B4761005191A4 /* ColorTimeline.h in Headers */, 4617864320522469008256E1 /* HttpRequest.h in Headers */, 1A28FF651F20AFAB007A1D9D /* SRPinningSecurityPolicy.h in Headers */, 46FDDA85202ACC6A00931238 /* View.h in Headers */, 46AE3FF72092F3A600F3A228 /* util-inl.h in Headers */, 1AAAC875205CB647005321B9 /* jsb_cocos2dx_audioengine_auto.hpp in Headers */, + 046AA9C2223B4762005191A4 /* ContainerUtil.h in Headers */, 1A28FF951F20AFAB007A1D9D /* SocketRocket.h in Headers */, 46AE40012092F3A600F3A228 /* SHA1.h in Headers */, 046E06992185B45300B24E2D /* Matrix.h in Headers */, 046E06142185B37100B24E2D /* CCArmatureDisplay.h in Headers */, 46178670205262BC008256E1 /* jsb_conversions.hpp in Headers */, 469303A82046AE05004A3D6C /* SeApi.h in Headers */, - 0430125921DCF2B80007084D /* AtlasAttachmentLoader.h in Headers */, 50ABBD5A1925AB0000A911A9 /* Vec2.h in Headers */, 46FDDB81202ADDCE00931238 /* ccTypes.h in Headers */, + 046AA9C0223B4762005191A4 /* SkeletonBounds.h in Headers */, 469304302046AE06004A3D6C /* jsb_classtype.hpp in Headers */, 46FDDADD202ACC6A00931238 /* VertexBuffer.h in Headers */, - 0430127D21DCF2B80007084D /* VertexEffect.h in Headers */, - 0430126321DCF2B80007084D /* Array.h in Headers */, 1A28FF8D1F20AFAB007A1D9D /* NSRunLoop+SRWebSocket.h in Headers */, 046E06D72185B49F00B24E2D /* AnimationConfig.h in Headers */, 469304202046AE06004A3D6C /* jsb_gfx_manual.hpp in Headers */, @@ -3384,10 +3662,12 @@ 403ACADB20CE4EB000BB433D /* jsb_module_register.hpp in Headers */, 46FDDACD202ACC6A00931238 /* GraphicsHandle.h in Headers */, 461DCA5A20C7E4BA00B22827 /* JavaScriptObjCBridge.h in Headers */, + 046AA9D6223B4762005191A4 /* CurveTimeline.h in Headers */, 46FDDBCB202ADDCE00931238 /* ZipUtils.h in Headers */, 50ABBFFD1926664800A911A9 /* CCFileUtils-apple.h in Headers */, 46FDDA8F202ACC6A00931238 /* BaseRenderer.h in Headers */, 1A52DB69205BCDC700350EE3 /* Class.hpp in Headers */, + 046AA96A223B4761005191A4 /* TransformConstraint.h in Headers */, 46FDDAD7202ACC6A00931238 /* GFXUtils.h in Headers */, 4617866D2052609B008256E1 /* jsb_cocos2dx_network_auto.hpp in Headers */, 50ABC00F1926664800A911A9 /* CCFileUtils.h in Headers */, @@ -3395,8 +3675,6 @@ 1A28FF4D1F20AFAB007A1D9D /* SRDelegateController.h in Headers */, 46FDDB9F202ADDCE00931238 /* CCVector.h in Headers */, 50ABBD5E1925AB0000A911A9 /* Vec3.h in Headers */, - 0430129121DCF2B80007084D /* SlotData.h in Headers */, - 043012A521DCF2B80007084D /* SkeletonData.h in Headers */, 046E0711218B01EF00B24E2D /* jsb_dragonbones_manual.hpp in Headers */, 4617863120522469008256E1 /* SocketIO.h in Headers */, 46FDDBD1202ADDCE00931238 /* ccUTF8.h in Headers */, @@ -3408,28 +3686,33 @@ 50ABC00B1926664800A911A9 /* CCDevice.h in Headers */, 46FDDB89202ADDCE00931238 /* CCRef.h in Headers */, 046E069D2185B45300B24E2D /* Transform.h in Headers */, + 046AA912223B4761005191A4 /* PathConstraintData.h in Headers */, 46FDDBE9202ADDCE00931238 /* CCAutoreleasePool.h in Headers */, 46FDDB4F202ADDCE00931238 /* CCValue.h in Headers */, + 046AA91C223B4761005191A4 /* TwoColorTimeline.h in Headers */, + 046AA938223B4761005191A4 /* DeformTimeline.h in Headers */, + 046AA90E223B4761005191A4 /* SkeletonClipping.h in Headers */, 046E06952185B45300B24E2D /* ColorTransform.h in Headers */, - 043012B921DCF2B80007084D /* Json.h in Headers */, 46AE3FFD2092F3A600F3A228 /* util.h in Headers */, + 046AA91E223B4761005191A4 /* AttachmentTimeline.h in Headers */, 46FDDBB5202ADDCE00931238 /* uthash.h in Headers */, 1AAAC8DF205CB6E9005321B9 /* AudioDecoder.h in Headers */, + 046AA97E223B4761005191A4 /* AttachmentType.h in Headers */, 4617862520522469008256E1 /* CCDownloader.h in Headers */, 1A28FF7D1F20AFAB007A1D9D /* SRMutex.h in Headers */, 1A28FF711F20AFAB007A1D9D /* SRHash.h in Headers */, 469301CF203FC696004A3D6C /* CCConfiguration.h in Headers */, - 0430128B21DCF2B80007084D /* SkeletonBounds.h in Headers */, - 0430124B21DCF2B80007084D /* TransformConstraint.h in Headers */, - 0430128521DCF2B80007084D /* PathConstraint.h in Headers */, 1A14FD932080B4E300E10ABE /* CCGLUtils.h in Headers */, + 046AA990223B4761005191A4 /* RotateTimeline.h in Headers */, 50ABC0171926664800A911A9 /* CCImage.h in Headers */, ED30577F1BEC76C90083C3ED /* ioapi_mem.h in Headers */, - 043012BD21DCF2B80007084D /* IkConstraintData.h in Headers */, + 046AA930223B4761005191A4 /* MixDirection.h in Headers */, 46AE3FED2092F3A600F3A228 /* http_parser.h in Headers */, + 046AAA28223B4762005191A4 /* AtlasAttachmentLoader.h in Headers */, 4617864B20522469008256E1 /* HttpCookie.h in Headers */, 046E066A2185B41B00B24E2D /* IArmatureProxy.h in Headers */, 1A586C432064C90500B47573 /* EJConvertTypedArray.h in Headers */, + 046AA9B6223B4761005191A4 /* HasRendererObject.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3438,15 +3721,21 @@ buildActionMask = 2147483647; files = ( 4617862A20522469008256E1 /* Uri.h in Headers */, + 046AA94B223B4761005191A4 /* AnimationState.h in Headers */, 046E069A2185B45300B24E2D /* Matrix.h in Headers */, 469303892046AE05004A3D6C /* HandleObject.hpp in Headers */, 503DD8EF1926736A00CD74DD /* CCPlatformDefine-ios.h in Headers */, + 046AAA23223B4762005191A4 /* RegionAttachment.h in Headers */, 1A28FF921F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.h in Headers */, - 043012C221DCF2B80007084D /* kvec.h in Headers */, 046E06CC2185B49F00B24E2D /* SkinData.h in Headers */, 46FDDB5C202ADDCE00931238 /* CCData.h in Headers */, + 046AA9F5223B4762005191A4 /* PathConstraintPositionTimeline.h in Headers */, + 046AA9DB223B4762005191A4 /* TranslateTimeline.h in Headers */, 469303832046AE05004A3D6C /* Value.hpp in Headers */, 046E06A02185B45300B24E2D /* Point.h in Headers */, + 046AA92B223B4761005191A4 /* SpineString.h in Headers */, + 046AA99B223B4761005191A4 /* dll.h in Headers */, + 046AA931223B4761005191A4 /* MixDirection.h in Headers */, 1A28FF961F20AFAB007A1D9D /* SocketRocket.h in Headers */, 4617864620522469008256E1 /* HttpAsynConnection-apple.h in Headers */, 46FDDAA8202ACC6A00931238 /* ForwardRenderer.h in Headers */, @@ -3454,16 +3743,21 @@ 1A28FF8E1F20AFAB007A1D9D /* NSRunLoop+SRWebSocket.h in Headers */, 46FDDBA0202ADDCE00931238 /* CCVector.h in Headers */, 46FDDB54202ADDCE00931238 /* utlist.h in Headers */, + 046AA967223B4761005191A4 /* MixBlend.h in Headers */, 046E06252185B37100B24E2D /* CCSlot.h in Headers */, 46AE40022092F3A600F3A228 /* SHA1.h in Headers */, + 046AA9B7223B4761005191A4 /* HasRendererObject.h in Headers */, 469303932046AE05004A3D6C /* SeApi.h in Headers */, 46FDDA84202ACC6A00931238 /* Technique.h in Headers */, + 046AA9B9223B4761005191A4 /* AttachmentLoader.h in Headers */, + 046AA9ED223B4762005191A4 /* TransformMode.h in Headers */, 1A29D76C205665BE00168D9A /* jsb_cocos2dx_auto.hpp in Headers */, 046B688D219FA61200B33469 /* MiddlewareManager.h in Headers */, + 046AA987223B4761005191A4 /* Bone.h in Headers */, 046E06792185B42500B24E2D /* BaseObject.h in Headers */, - 0430127621DCF2B80007084D /* AnimationState.h in Headers */, 46FDDBB8202ADDCE00931238 /* ccUtils.h in Headers */, 046E06552185B41B00B24E2D /* Bone.h in Headers */, + 046AA9D7223B4762005191A4 /* CurveTimeline.h in Headers */, 50643BE319BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, 46FDDA92202ACC6A00931238 /* Pass.h in Headers */, 046E067C2185B42F00B24E2D /* DragonBonesHeaders.h in Headers */, @@ -3472,13 +3766,15 @@ 46FDDB5E202ADDCE00931238 /* ccMacros.h in Headers */, 294D7D9B1D0E93A2002CE7B7 /* CCDevice-apple.h in Headers */, 46178650205224DA008256E1 /* CCDownloaderImpl-apple.h in Headers */, + 046AAA19223B4762005191A4 /* ShearTimeline.h in Headers */, 46FDDAA6202ACC6A00931238 /* Scene.h in Headers */, 46AE3FE62092F3A600F3A228 /* base64.h in Headers */, + 046AA953223B4761005191A4 /* PathConstraintSpacingTimeline.h in Headers */, 1A586C4A2064C97800B47573 /* EJConvert.h in Headers */, 46AE3FE82092F3A600F3A228 /* inspector_io.h in Headers */, 1AAAC8E0205CB6E9005321B9 /* AudioDecoder.h in Headers */, + 046AA991223B4761005191A4 /* RotateTimeline.h in Headers */, 046E06D02185B49F00B24E2D /* BoundingBoxData.h in Headers */, - 0430128621DCF2B80007084D /* PathConstraint.h in Headers */, 1A28FF821F20AFAB007A1D9D /* SRRandom.h in Headers */, 1A52DB79205BCDD000350EE3 /* Object.hpp in Headers */, 50643BD619BFAEDA00EF68ED /* CCPlatformDefine.h in Headers */, @@ -3486,60 +3782,75 @@ 46FDDA6E202ACC6A00931238 /* INode.h in Headers */, 469304152046AE06004A3D6C /* jsb_renderer_manual.hpp in Headers */, 50ABBD631925AB0000A911A9 /* Vec4.h in Headers */, + 046AA96D223B4761005191A4 /* MathUtil.h in Headers */, 46AE3FDE2092F3A600F3A228 /* inspector_socket_server.h in Headers */, 1A586C442064C90500B47573 /* EJConvertTypedArray.h in Headers */, 46AE3FFE2092F3A600F3A228 /* util.h in Headers */, 046E06652185B41B00B24E2D /* Armature.h in Headers */, 046E06692185B41B00B24E2D /* Constraint.h in Headers */, 046B689621A10D5800B33469 /* MiddlewareMacro.h in Headers */, + 046AA939223B4761005191A4 /* DeformTimeline.h in Headers */, + 046AA941223B4761005191A4 /* Slot.h in Headers */, 04F49F50222B80C500E5CAF1 /* RenderInfoMgr.h in Headers */, 46FDDA82202ACC6A00931238 /* RendererUtils.h in Headers */, + 046AA913223B4761005191A4 /* PathConstraintData.h in Headers */, + 046AA9EB223B4762005191A4 /* Json.h in Headers */, + 046AA94F223B4761005191A4 /* PathAttachment.h in Headers */, 40AEF7B7216D982600729AA5 /* jsb_webview_auto.hpp in Headers */, 50ABC0101926664800A911A9 /* CCFileUtils.h in Headers */, 40FF7AA2216B29CC00E73029 /* VideoPlayer.h in Headers */, 1A29D77E2056667800168D9A /* csscolorparser.hpp in Headers */, - 0430127E21DCF2B80007084D /* VertexEffect.h in Headers */, 46FDDA9C202ACC6A00931238 /* Effect.h in Headers */, 046E07002189999600B24E2D /* jsb_cocos2dx_editor_support_auto.hpp in Headers */, + 046AA94D223B4761005191A4 /* Extension.h in Headers */, 46AE40062092F3A600F3A228 /* inspector_socket.h in Headers */, + 046AA969223B4761005191A4 /* BoneData.h in Headers */, 40AEF7B1216D940200729AA5 /* WebView-inl.h in Headers */, + 046AA9CD223B4762005191A4 /* Event.h in Headers */, 503DD8E61926736A00CD74DD /* CCEAGLView-ios.h in Headers */, 46FDDAC8202ACC6A00931238 /* GFX.h in Headers */, + 046AA9F3223B4762005191A4 /* Skeleton.h in Headers */, 469303972046AE05004A3D6C /* Class.hpp in Headers */, 046E06F22185B4A500B24E2D /* BinaryDataParser.h in Headers */, + 046AA91F223B4761005191A4 /* AttachmentTimeline.h in Headers */, 46FDDA98202ACC6A00931238 /* Model.h in Headers */, 469304112046AE06004A3D6C /* jsb_helper.hpp in Headers */, 1A52DAF7205BB81400350EE3 /* CCThreadPool.h in Headers */, + 046AAA13223B4762005191A4 /* EventTimeline.h in Headers */, 046E06192185B37100B24E2D /* CCTextureAtlasData.h in Headers */, + 046AA96B223B4761005191A4 /* TransformConstraint.h in Headers */, 50ABBD5B1925AB0000A911A9 /* Vec2.h in Headers */, + 046AA983223B4761005191A4 /* Vector.h in Headers */, 4008729720CE20C2002EB77B /* jsb_cocos2dx_network_manual.h in Headers */, 50ABBD411925AB0000A911A9 /* CCMath.h in Headers */, + 046AAA05223B4762005191A4 /* LinkedMesh.h in Headers */, 04355819217EADF300B9C056 /* IOBuffer.h in Headers */, 046E06342185B41100B24E2D /* Animation.h in Headers */, 461786682052607E008256E1 /* jsb_websocket.hpp in Headers */, 4617865E2052607E008256E1 /* jsb_xmlhttprequest.hpp in Headers */, 046E03FC21804E6B00B24E2D /* AttachmentVertices.h in Headers */, 46FDDAB0202ACC6A00931238 /* Texture2D.h in Headers */, + 046AA917223B4761005191A4 /* Pool.h in Headers */, + 046AAA0D223B4762005191A4 /* MeshAttachment.h in Headers */, 50ABBD3F1925AB0000A911A9 /* CCGeometry.h in Headers */, 4693039D2046AE05004A3D6C /* PlatformUtils.h in Headers */, - 0430127821DCF2B80007084D /* SkeletonClipping.h in Headers */, 046E06C22185B49F00B24E2D /* TextureAtlasData.h in Headers */, 046E06402185B41100B24E2D /* AnimationState.h in Headers */, + 046AA9CB223B4762005191A4 /* SpacingMode.h in Headers */, 4617866E2052609B008256E1 /* jsb_cocos2dx_network_auto.hpp in Headers */, + 046AA957223B4761005191A4 /* PathConstraint.h in Headers */, 046E066B2185B41B00B24E2D /* IArmatureProxy.h in Headers */, - 0430128C21DCF2B80007084D /* SkeletonBounds.h in Headers */, 1A28FF6A1F20AFAB007A1D9D /* SRConstants.h in Headers */, - 043012C021DCF2B80007084D /* dll.h in Headers */, - 0430123021DCF2B80007084D /* EventData.h in Headers */, 50ABBFFE1926664800A911A9 /* CCFileUtils-apple.h in Headers */, 046E061F2185B37100B24E2D /* CCDragonBonesHeaders.h in Headers */, 046B689321A00F5600B33469 /* IOTypedArray.h in Headers */, + 046AA90F223B4761005191A4 /* SkeletonClipping.h in Headers */, 46FDDBEA202ADDCE00931238 /* CCAutoreleasePool.h in Headers */, + 046AA97F223B4761005191A4 /* AttachmentType.h in Headers */, 461786642052607E008256E1 /* jsb_socketio.hpp in Headers */, 40AEF7C1216DF22500729AA5 /* jsb_video_auto.hpp in Headers */, + 046AA9FD223B4762005191A4 /* Triangulator.h in Headers */, 46AE40002092F3A600F3A228 /* v8_inspector_protocol_json.h in Headers */, - 0430125E21DCF2B80007084D /* BoneData.h in Headers */, - 0430128821DCF2B80007084D /* PathConstraintData.h in Headers */, 469303EF2046AE05004A3D6C /* jsb_renderer_auto.hpp in Headers */, 1A28FF521F20AFAB007A1D9D /* SRIOConsumer.h in Headers */, 1A28FF981F20AFAB007A1D9D /* SRSecurityPolicy.h in Headers */, @@ -3549,8 +3860,8 @@ 50643BDC19BFAF4400EF68ED /* CCStdC.h in Headers */, 046E06422185B41100B24E2D /* BaseTimelineState.h in Headers */, 469303AF2046AE05004A3D6C /* Base.h in Headers */, - 0430124E21DCF2B80007084D /* SkeletonBinary.h in Headers */, - 046E03F821804E6B00B24E2D /* SpineRenderer.h in Headers */, + 046E03F821804E6B00B24E2D /* SkeletonRenderer.h in Headers */, + 046AA9E1223B4762005191A4 /* TransformConstraintData.h in Headers */, 46930467204FE20F004A3D6C /* CCLog.h in Headers */, 1A28FF761F20AFAB007A1D9D /* SRHTTPConnectMessage.h in Headers */, 046E06942185B45300B24E2D /* Rectangle.h in Headers */, @@ -3558,33 +3869,35 @@ 46AE3FEC2092F3A600F3A228 /* node_mutex.h in Headers */, 4617864C20522469008256E1 /* HttpCookie.h in Headers */, 1A52DB74205BCDD000350EE3 /* Base.h in Headers */, + 046AA99D223B4761005191A4 /* HashMap.h in Headers */, 469304012046AE06004A3D6C /* jsb_global.h in Headers */, 46AE3FF82092F3A600F3A228 /* util-inl.h in Headers */, - 0430126821DCF2B80007084D /* Triangulator.h in Headers */, - 043012BE21DCF2B80007084D /* IkConstraintData.h in Headers */, 46FDDADE202ACC6A00931238 /* VertexBuffer.h in Headers */, 40AEF7B3216D940200729AA5 /* WebViewImpl-ios.h in Headers */, 1A28FF621F20AFAB007A1D9D /* SRRunLoopThread.h in Headers */, 46FDDA86202ACC6A00931238 /* View.h in Headers */, 46FDDAD8202ACC6A00931238 /* GFXUtils.h in Headers */, - 043012B621DCF2B80007084D /* Slot.h in Headers */, - 043012A421DCF2B80007084D /* PointAttachment.h in Headers */, 46FDDB82202ADDCE00931238 /* ccTypes.h in Headers */, + 046AA9B3223B4761005191A4 /* AnimationStateData.h in Headers */, 50ABC00C1926664800A911A9 /* CCDevice.h in Headers */, + 046AA945223B4761005191A4 /* PathConstraintMixTimeline.h in Headers */, + 046AA9C9223B4762005191A4 /* SlotData.h in Headers */, 46FDDA74202ACC6A00931238 /* ProgramLib.h in Headers */, 46FDDAD0202ACC6A00931238 /* RenderBuffer.h in Headers */, 1A28FF7A1F20AFAB007A1D9D /* SRLog.h in Headers */, 46AE3FF42092F3A600F3A228 /* node.h in Headers */, 46FDDC64202D502F00931238 /* CCApplication.h in Headers */, - 0430126021DCF2B80007084D /* Atlas.h in Headers */, 046E06D82185B49F00B24E2D /* AnimationConfig.h in Headers */, 46FDDACC202ACC6A00931238 /* VertexFormat.h in Headers */, 46FDDACE202ACC6A00931238 /* GraphicsHandle.h in Headers */, + 046AA9A9223B4761005191A4 /* spine.h in Headers */, 469303912046AE05004A3D6C /* MappingUtils.hpp in Headers */, 46FDDA80202ACC6A00931238 /* Renderer.h in Headers */, 4617864420522469008256E1 /* HttpRequest.h in Headers */, 46AE3FEE2092F3A600F3A228 /* http_parser.h in Headers */, + 046AA9D3223B4762005191A4 /* Debug.h in Headers */, 046E06632185B41B00B24E2D /* Slot.h in Headers */, + 046AA961223B4761005191A4 /* SkeletonBinary.h in Headers */, 4693045B2046AE06004A3D6C /* EventDispatcher.h in Headers */, 046E06BE2185B49F00B24E2D /* UserData.h in Headers */, 46FDDAA2202ACC6A00931238 /* InputAssembler.h in Headers */, @@ -3595,112 +3908,123 @@ 04AF6302219190ED00AED9DE /* TypedArrayPool.h in Headers */, 46FDDB50202ADDCE00931238 /* CCValue.h in Headers */, 46FDDADA202ACC6A00931238 /* Program.h in Headers */, - 0430122C21DCF2B80007084D /* ClippingAttachment.h in Headers */, 46FDDAC4202ACC6A00931238 /* FrameBuffer.h in Headers */, + 046AA9B5223B4761005191A4 /* PositionMode.h in Headers */, + 046AA92F223B4761005191A4 /* ScaleTimeline.h in Headers */, 46FDDAD2202ACC6A00931238 /* Texture.h in Headers */, 469303992046AE05004A3D6C /* HelperMacros.h in Headers */, 1AAAC8EE205CB6E9005321B9 /* AudioCache.h in Headers */, - 0430127A21DCF2B80007084D /* Event.h in Headers */, 1A28FF721F20AFAB007A1D9D /* SRHash.h in Headers */, 50ABBD431925AB0000A911A9 /* CCMathBase.h in Headers */, 46FDDBDE202ADDCE00931238 /* TGAlib.h in Headers */, 046E06DC2185B49F00B24E2D /* ConstraintData.h in Headers */, + 046AA9C3223B4762005191A4 /* ContainerUtil.h in Headers */, 469303812046AE05004A3D6C /* config.hpp in Headers */, - 0430124C21DCF2B80007084D /* TransformConstraint.h in Headers */, + 046AA9C1223B4762005191A4 /* SkeletonBounds.h in Headers */, 1A28FF9C1F20AFAB007A1D9D /* SRWebSocket.h in Headers */, 046E061B2185B37100B24E2D /* CCFactory.h in Headers */, BAEA45561E279D5C00FA219F /* tinydir.h in Headers */, 4693038B2046AE05004A3D6C /* State.hpp in Headers */, - 0430129421DCF2B80007084D /* Skeleton.h in Headers */, - 0430126421DCF2B80007084D /* Array.h in Headers */, 461DCA5B20C7E4BA00B22827 /* JavaScriptObjCBridge.h in Headers */, 46FDDADC202ACC6A00931238 /* State.h in Headers */, 46FDDB8A202ADDCE00931238 /* CCRef.h in Headers */, 046E06852185B43B00B24E2D /* EventObject.h in Headers */, - 0430124821DCF2B80007084D /* Skin.h in Headers */, + 046AA97D223B4761005191A4 /* SkeletonJson.h in Headers */, 046E06DA2185B49F00B24E2D /* CanvasData.h in Headers */, + 046AA9EF223B4762005191A4 /* SkeletonData.h in Headers */, 46FDDB6C202ADDCE00931238 /* base64.h in Headers */, + 046AA9BF223B4762005191A4 /* DrawOrderTimeline.h in Headers */, + 046AA973223B4761005191A4 /* TransformConstraintTimeline.h in Headers */, 469303652046AE05004A3D6C /* RefCounter.hpp in Headers */, - 0430124421DCF2B80007084D /* SkeletonJson.h in Headers */, + 046AA965223B4761005191A4 /* RTTI.h in Headers */, 469303D32046AE05004A3D6C /* jsb_gfx_auto.hpp in Headers */, 046E068B2185B44A00B24E2D /* BaseFactory.h in Headers */, 046E063C2185B41100B24E2D /* WorldClock.h in Headers */, 40AEF7B2216D940200729AA5 /* WebView.h in Headers */, + 046AA943223B4761005191A4 /* Updatable.h in Headers */, + 046AA955223B4761005191A4 /* ColorTimeline.h in Headers */, 1AAAC8F4205CB6E9005321B9 /* AudioEngine.h in Headers */, + 046AA919223B4761005191A4 /* Atlas.h in Headers */, 046B68A921A292D300B33469 /* jsb_spine_manual.hpp in Headers */, 46FDDA78202ACC6A00931238 /* Light.h in Headers */, - 0430125A21DCF2B80007084D /* AtlasAttachmentLoader.h in Headers */, 1A29D7A420566CAC00168D9A /* CCCanvasRenderingContext2D.h in Headers */, - 0430122E21DCF2B80007084D /* Animation.h in Headers */, + 046AAA15223B4762005191A4 /* IkConstraintTimeline.h in Headers */, 046E06812185B43B00B24E2D /* IEventDispatcher.h in Headers */, - 046E040021804E6B00B24E2D /* CreatorAttachmentLoader.h in Headers */, 1A52DB7C205BCDD000350EE3 /* SeApi.h in Headers */, 469303A92046AE05004A3D6C /* SeApi.h in Headers */, - 0430123621DCF2B80007084D /* extension.h in Headers */, 46FDDAAE202ACC6A00931238 /* Macro.h in Headers */, - 0430123E21DCF2B80007084D /* spine.h in Headers */, + 046AAA07223B4762005191A4 /* BoundingBoxAttachment.h in Headers */, 04ED68DB21F8188F006E82F8 /* MeshBuffer.h in Headers */, - 0430129C21DCF2B80007084D /* AttachmentLoader.h in Headers */, + 046AA9D1223B4762005191A4 /* Constraint.h in Headers */, + 046AA9D5223B4762005191A4 /* ClippingAttachment.h in Headers */, 469303872046AE05004A3D6C /* Object.hpp in Headers */, + 046AA91B223B4761005191A4 /* IkConstraintData.h in Headers */, 1A28FF5E1F20AFAB007A1D9D /* SRProxyConnect.h in Headers */, - 043012A221DCF2B80007084D /* VertexAttachment.h in Headers */, 469303AD2046AE05004A3D6C /* Utils.hpp in Headers */, 046E06FA2189990700B24E2D /* middleware-adapter.h in Headers */, 1A28FF4E1F20AFAB007A1D9D /* SRDelegateController.h in Headers */, - 043012BA21DCF2B80007084D /* Json.h in Headers */, 469301D0203FC696004A3D6C /* CCConfiguration.h in Headers */, 46FDDB6E202ADDCE00931238 /* etc1.h in Headers */, + 046AA91D223B4761005191A4 /* TwoColorTimeline.h in Headers */, + 046AA995223B4761005191A4 /* VertexAttachment.h in Headers */, 461DCA3720BBFA2D00B22827 /* EditBox.h in Headers */, + 046AA9A1223B4761005191A4 /* BlendMode.h in Headers */, + 046AAA25223B4762005191A4 /* PointAttachment.h in Headers */, 1AAAC8E6205CB6E9005321B9 /* AudioPlayer.h in Headers */, - 0430129E21DCF2B80007084D /* IkConstraint.h in Headers */, 469303A52046AE05004A3D6C /* ScriptEngine.hpp in Headers */, - 043012AC21DCF2B80007084D /* AnimationStateData.h in Headers */, 046E069E2185B45300B24E2D /* Transform.h in Headers */, 046E070C218B015100B24E2D /* jsb_cocos2dx_dragonbones_auto.hpp in Headers */, - 046E03F221804E6B00B24E2D /* SpineAnimation.h in Headers */, + 046E03F221804E6B00B24E2D /* SkeletonAnimation.h in Headers */, 046E06152185B37100B24E2D /* CCArmatureDisplay.h in Headers */, - 0430127021DCF2B80007084D /* PathAttachment.h in Headers */, 1A28FF8A1F20AFAB007A1D9D /* SRURLUtilities.h in Headers */, + 046AA911223B4761005191A4 /* SpineObject.h in Headers */, 50ABBD4B1925AB0000A911A9 /* Mat4.h in Headers */, 50ABBD531925AB0000A911A9 /* Quaternion.h in Headers */, 4617863E20522469008256E1 /* HttpResponse.h in Headers */, 461786542052301A008256E1 /* CCScheduler.h in Headers */, 046E065F2185B41B00B24E2D /* TransformObject.h in Headers */, 046E06962185B45300B24E2D /* ColorTransform.h in Headers */, + 046AA975223B4761005191A4 /* TimelineType.h in Headers */, 50ABC0181926664800A911A9 /* CCImage.h in Headers */, 503DD8EB1926736A00CD74DD /* CCGL-ios.h in Headers */, 46FDDA7C202ACC6A00931238 /* Camera.h in Headers */, + 046AA97B223B4761005191A4 /* RotateMode.h in Headers */, 4617862420522469008256E1 /* CCIDownloaderImpl.h in Headers */, + 046AA9E9223B4762005191A4 /* Color.h in Headers */, 046E06EE2185B4A500B24E2D /* JSONDataParser.h in Headers */, 046E06F42185B4A500B24E2D /* DataParser.h in Headers */, 5027253B190BF1B900AAF4ED /* cocos2d.h in Headers */, 46FDDAAC202ACC6A00931238 /* Types.h in Headers */, + 046AA9E7223B4762005191A4 /* Skin.h in Headers */, 1AAAC876205CB647005321B9 /* jsb_cocos2dx_audioengine_auto.hpp in Headers */, 1A52DB7B205BCDD000350EE3 /* ScriptEngine.hpp in Headers */, 4648882620AC2BC900CD1E4A /* CCRenderTexture.h in Headers */, 046E03F621804E6B00B24E2D /* spine-cocos2dx.h in Headers */, - 0430122A21DCF2B80007084D /* MeshAttachment.h in Headers */, 1A29D772205665D200168D9A /* jsb_cocos2dx_manual.hpp in Headers */, + 046AA95F223B4761005191A4 /* Vertices.h in Headers */, 1A29D789205666B200168D9A /* LocalStorage.h in Headers */, 046E0712218B01EF00B24E2D /* jsb_dragonbones_manual.hpp in Headers */, 46FDDC67202D504E00931238 /* CCApplication.h in Headers */, 046E06772185B42500B24E2D /* DragonBones.h in Headers */, 46AE3FE42092F3A600F3A228 /* inspector_agent.h in Headers */, + 046AA9DF223B4762005191A4 /* Animation.h in Headers */, + 044DE37B227552520037572E /* VertexEffectDelegate.h in Headers */, 046E06C82185B49F00B24E2D /* DisplayData.h in Headers */, - 0430125821DCF2B80007084D /* Bone.h in Headers */, 50ABBD4F1925AB0000A911A9 /* MathUtil.h in Headers */, 1A28FF561F20AFAB007A1D9D /* SRIOConsumerPool.h in Headers */, 1A28FF7E1F20AFAB007A1D9D /* SRMutex.h in Headers */, 403ACADD20CE542900BB433D /* jsb_module_register.hpp in Headers */, - 043012A621DCF2B80007084D /* SkeletonData.h in Headers */, + 046AA92D223B4761005191A4 /* IkConstraint.h in Headers */, 46FDDA76202ACC6A00931238 /* Config.h in Headers */, 50643BD519BFAECF00EF68ED /* CCGL.h in Headers */, 046E06D62185B49F00B24E2D /* ArmatureData.h in Headers */, 46FDDB84202ADDCE00931238 /* ccRandom.h in Headers */, 1AAAC8EA205CB6E9005321B9 /* AudioMacros.h in Headers */, + 046AA9FF223B4762005191A4 /* EventData.h in Headers */, 46AE400A2092F3A600F3A228 /* node_debug_options.h in Headers */, + 046AA9FB223B4762005191A4 /* Attachment.h in Headers */, 4617862620522469008256E1 /* CCDownloader.h in Headers */, - 0430124021DCF2B80007084D /* Color.h in Headers */, + 046AA95B223B4761005191A4 /* TextureLoader.h in Headers */, 46FDDBD2202ADDCE00931238 /* ccUTF8.h in Headers */, 1A14FD942080B4E300E10ABE /* CCGLUtils.h in Headers */, 50ABBD5F1925AB0000A911A9 /* Vec3.h in Headers */, @@ -3708,14 +4032,14 @@ 1A29D79F205666F500168D9A /* jsb_opengl_manual.hpp in Headers */, 46FDDAE0202ACC6A00931238 /* RenderTarget.h in Headers */, 046E06B82185B49F00B24E2D /* AnimationData.h in Headers */, - 0430128021DCF2B80007084D /* TransformConstraintData.h in Headers */, 50ABBD471925AB0000A911A9 /* CCVertex.h in Headers */, 46FDDA90202ACC6A00931238 /* BaseRenderer.h in Headers */, 046B68AD21A294B100B33469 /* jsb_cocos2dx_spine_auto.hpp in Headers */, + 046AA971223B4761005191A4 /* Timeline.h in Headers */, 46FDDABE202ACC6A00931238 /* DeviceGraphics.h in Headers */, 4617862820522469008256E1 /* WebSocket.h in Headers */, + 046AAA29223B4762005191A4 /* AtlasAttachmentLoader.h in Headers */, 4617863220522469008256E1 /* SocketIO.h in Headers */, - 0430122421DCF2B80007084D /* Attachment.h in Headers */, 46FDDAB8202ACC6A00931238 /* IndexBuffer.h in Headers */, 1A28FF5C1F20AFAB007A1D9D /* NSURLRequest+SRWebSocketPrivate.h in Headers */, 1AAAC8F0205CB6E9005321B9 /* AudioEngine-inl.h in Headers */, @@ -3726,17 +4050,15 @@ 469303A32046AE05004A3D6C /* Object.hpp in Headers */, 1A28FF661F20AFAB007A1D9D /* SRPinningSecurityPolicy.h in Headers */, 46178671205262BC008256E1 /* jsb_conversions.hpp in Headers */, - 0430122621DCF2B80007084D /* BoundingBoxAttachment.h in Headers */, 469304212046AE06004A3D6C /* jsb_gfx_manual.hpp in Headers */, 04F49F44222A777C00E5CAF1 /* SkeletonDataMgr.h in Headers */, 50ABC01C1926664800A911A9 /* CCSAXParser.h in Headers */, - 0430125C21DCF2B80007084D /* RegionAttachment.h in Headers */, 1A52DB77205BCDD000350EE3 /* HelperMacros.h in Headers */, 469304312046AE06004A3D6C /* jsb_classtype.hpp in Headers */, + 046AA9AF223B4761005191A4 /* VertexEffect.h in Headers */, 46FDDBD0202ADDCE00931238 /* CCMap.h in Headers */, 1A52DB7E205BCDD000350EE3 /* Utils.hpp in Headers */, 503DD8F11926736A00CD74DD /* OpenGL_Internal-ios.h in Headers */, - 0430129221DCF2B80007084D /* SlotData.h in Headers */, 1A28FF5A1F20AFAB007A1D9D /* NSRunLoop+SRWebSocketPrivate.h in Headers */, 1A28FF861F20AFAB007A1D9D /* SRSIMDHelpers.h in Headers */, 4617863820522469008256E1 /* HttpClient.h in Headers */, @@ -3814,167 +4136,166 @@ files = ( 1A29D794205666F500168D9A /* jsb_opengl_manual.cpp in Sources */, 4693038C2046AE05004A3D6C /* config.cpp in Sources */, + 046AA950223B4761005191A4 /* Constraint.cpp in Sources */, 46FDDA7D202ACC6A00931238 /* Light.cpp in Sources */, 046E070F218B01EF00B24E2D /* jsb_dragonbones_manual.cpp in Sources */, 4693042C2046AE06004A3D6C /* jsb_renderer_manual.cpp in Sources */, - 0430123921DCF2B80007084D /* Slot.c in Sources */, 1AAAC8E3205CB6E9005321B9 /* AudioDecoder.mm in Sources */, 1A52DB66205BCDC700350EE3 /* Class.cpp in Sources */, + 046AAA1A223B4762005191A4 /* SkeletonData.cpp in Sources */, 046E0709218B015100B24E2D /* jsb_cocos2dx_dragonbones_auto.cpp in Sources */, 046E06352185B41100B24E2D /* TimelineState.cpp in Sources */, 1A28FF7F1F20AFAB007A1D9D /* SRMutex.m in Sources */, - 0430123B21DCF2B80007084D /* PathConstraintData.c in Sources */, 469303942046AE05004A3D6C /* RefCounter.cpp in Sources */, 469304262046AE06004A3D6C /* jsb_conversions.cpp in Sources */, 469304582046AE06004A3D6C /* EventDispatcher.cpp in Sources */, + 046AAA02223B4762005191A4 /* SkeletonClipping.cpp in Sources */, 04355816217EADF300B9C056 /* IOBuffer.cpp in Sources */, - 043012B721DCF2B80007084D /* VertexAttachment.c in Sources */, 1A52DAF8205BB81400350EE3 /* CCThreadPool.cpp in Sources */, 46AE3FFB2092F3A600F3A228 /* inspector_io.cc in Sources */, - 0430129521DCF2B80007084D /* Event.c in Sources */, 4037F5CE2108751E001C205C /* CCAsyncTaskPool.cpp in Sources */, 46FDDB65202ADDCE00931238 /* ccRandom.cpp in Sources */, 46FDDAB9202ACC6A00931238 /* FrameBuffer.cpp in Sources */, 50ABBD581925AB0000A911A9 /* Vec2.cpp in Sources */, - 043012A721DCF2B80007084D /* Array.c in Sources */, - 0430124521DCF2B80007084D /* Json.c in Sources */, 4626B1FF202D9BD800BE30B9 /* CCApplication-mac.mm in Sources */, 5027253C190BF1B900AAF4ED /* cocos2d.cpp in Sources */, 46FDDAA3202ACC6A00931238 /* InputAssembler.cpp in Sources */, 046E06222185B37100B24E2D /* CCTextureAtlasData.cpp in Sources */, - 0430123721DCF2B80007084D /* BoneData.c in Sources */, - 0430128321DCF2B80007084D /* Skin.c in Sources */, 1AAAC8EB205CB6E9005321B9 /* AudioCache.mm in Sources */, 4648882720AC2BC900CD1E4A /* CCRenderTexture.cpp in Sources */, 46AE3FF92092F3A600F3A228 /* inspector_socket.cc in Sources */, 1A52DB61205BCDC700350EE3 /* Object.cpp in Sources */, 50ABBD501925AB0000A911A9 /* Quaternion.cpp in Sources */, + 046AA9AC223B4761005191A4 /* Extension.cpp in Sources */, ED30579A1BEC77B70083C3ED /* ConvertUTF.c in Sources */, 046E06C92185B49F00B24E2D /* UserData.cpp in Sources */, 46FDDA79202ACC6A00931238 /* Camera.cpp in Sources */, 4617863320522469008256E1 /* Uri.cpp in Sources */, - 0430125121DCF2B80007084D /* TransformConstraintData.c in Sources */, 46FDDAC1202ACC6A00931238 /* Texture.cpp in Sources */, 1A28FF6B1F20AFAB007A1D9D /* SRConstants.m in Sources */, 294D7D9C1D0E93A2002CE7B7 /* CCDevice-apple.mm in Sources */, - 0430127121DCF2B80007084D /* SkeletonBounds.c in Sources */, - 043012A921DCF2B80007084D /* Animation.c in Sources */, 046E061C2185B37100B24E2D /* CCFactory.cpp in Sources */, 1A586C452064C90500B47573 /* EJConvertTypedArray.m in Sources */, + 046AA936223B4761005191A4 /* CurveTimeline.cpp in Sources */, 1A29D77B2056667800168D9A /* csscolorparser.cpp in Sources */, 46FDDA71202ACC6A00931238 /* Scene.cpp in Sources */, 469303C62046AE05004A3D6C /* jsb_gfx_auto.cpp in Sources */, 46AE40072092F3A600F3A228 /* node_debug_options.cc in Sources */, + 044DE378227552520037572E /* VertexEffectDelegate.cpp in Sources */, 469304122046AE06004A3D6C /* jsb_classtype.cpp in Sources */, 50ABBFFF1926664800A911A9 /* CCFileUtils-apple.mm in Sources */, 4617866B2052609B008256E1 /* jsb_cocos2dx_network_auto.cpp in Sources */, 461DCA3E20BBFCFE00B22827 /* EditBox-mac.mm in Sources */, + 046AA980223B4761005191A4 /* Skin.cpp in Sources */, 40CEAEB720CFDC45007A3281 /* CCReachability.cpp in Sources */, 046E06DD2185B49F00B24E2D /* AnimationData.cpp in Sources */, + 046AA9C6223B4762005191A4 /* SkeletonJson.cpp in Sources */, 046E06202185B37100B24E2D /* CCArmatureDisplay.cpp in Sources */, - 0430124921DCF2B80007084D /* Triangulator.c in Sources */, 046E06882185B44A00B24E2D /* BaseFactory.cpp in Sources */, + 046AAA26223B4762005191A4 /* MeshAttachment.cpp in Sources */, 1A52DB30205BCD9200350EE3 /* ScriptEngine.cpp in Sources */, - 0430123321DCF2B80007084D /* AttachmentLoader.c in Sources */, 1A52DB62205BCDC700350EE3 /* ScriptEngine.cpp in Sources */, 4DC57D211F7A58B5005B6546 /* xxtea.cpp in Sources */, 46AE40032092F3A600F3A228 /* http_parser.c in Sources */, + 046AA9CE223B4762005191A4 /* RTTI.cpp in Sources */, 1A586C4B2064C97800B47573 /* EJConvert.m in Sources */, 1AAAC8E7205CB6E9005321B9 /* AudioEngine-inl.mm in Sources */, - 046E03EF21804E6B00B24E2D /* SpineAnimation.cpp in Sources */, - 0430126521DCF2B80007084D /* BoundingBoxAttachment.c in Sources */, + 046E03EF21804E6B00B24E2D /* SkeletonAnimation.cpp in Sources */, 46FDDB71202ADDCE00931238 /* base64.cpp in Sources */, 1AAAC873205CB647005321B9 /* jsb_cocos2dx_audioengine_auto.cpp in Sources */, 46FDDA8D202ACC6A00931238 /* Config.cpp in Sources */, - 0430128921DCF2B80007084D /* IkConstraint.c in Sources */, 46930468204FE20F004A3D6C /* CCLog.cpp in Sources */, 1A28FF991F20AFAB007A1D9D /* SRSecurityPolicy.m in Sources */, 46AE3FF52092F3A600F3A228 /* util.cc in Sources */, 046E06582185B41B00B24E2D /* Armature.cpp in Sources */, + 046AA920223B4761005191A4 /* IkConstraintData.cpp in Sources */, 46FDDAE1202ACC6A00931238 /* GFXUtils.cpp in Sources */, + 046AAA20223B4762005191A4 /* Bone.cpp in Sources */, 1A52DB6B205BCDC700350EE3 /* Utils.cpp in Sources */, 4693042E2046AE06004A3D6C /* jsb_helper.cpp in Sources */, 046E06EB2185B4A500B24E2D /* DataParser.cpp in Sources */, 1A14FD912080B4E300E10ABE /* CCGLUtils.cpp in Sources */, + 046AA9E4223B4762005191A4 /* PathAttachment.cpp in Sources */, 046E06B92185B49F00B24E2D /* ConstraintData.cpp in Sources */, - 046E03F921804E6B00B24E2D /* SpineRenderer.cpp in Sources */, - 0430126D21DCF2B80007084D /* RegionAttachment.c in Sources */, + 046E03F921804E6B00B24E2D /* SkeletonRenderer.cpp in Sources */, 469303A02046AE05004A3D6C /* ScriptEngine.mm in Sources */, 46FDDAB5202ACC6A00931238 /* Program.cpp in Sources */, 046E06662185B41B00B24E2D /* Bone.cpp in Sources */, 46FDDBF9202ADDCE00931238 /* etc1.cpp in Sources */, - 0430124121DCF2B80007084D /* TransformConstraint.c in Sources */, - 043012BB21DCF2B80007084D /* IkConstraintData.c in Sources */, - 0430123121DCF2B80007084D /* VertexEffect.c in Sources */, 50ABBD4C1925AB0000A911A9 /* MathUtil.cpp in Sources */, 046E06C52185B49F00B24E2D /* AnimationConfig.cpp in Sources */, + 046AA932223B4761005191A4 /* EventData.cpp in Sources */, + 046AA948223B4761005191A4 /* Skeleton.cpp in Sources */, 04F49F4D222B80C500E5CAF1 /* RenderInfoMgr.cpp in Sources */, 46FDDA99202ACC6A00931238 /* Model.cpp in Sources */, 4693038E2046AE05004A3D6C /* Value.cpp in Sources */, 46FDDA89202ACC6A00931238 /* Effect.cpp in Sources */, + 046AA9A4223B4761005191A4 /* TranslateTimeline.cpp in Sources */, + 046AA998223B4761005191A4 /* Atlas.cpp in Sources */, 1ABAD24E20C29F3800BC71C0 /* CCCanvasRenderingContext2D-apple.mm in Sources */, - 043012AF21DCF2B80007084D /* SkeletonJson.c in Sources */, 046E06E12185B49F00B24E2D /* DragonBonesData.cpp in Sources */, ED30577E1BEC76C90083C3ED /* ioapi_mem.cpp in Sources */, - 0430128F21DCF2B80007084D /* PathAttachment.c in Sources */, 461DCA5820C7E4BA00B22827 /* JavaScriptObjCBridge.mm in Sources */, - 043012B321DCF2B80007084D /* PointAttachment.c in Sources */, + 046AA946223B4761005191A4 /* Attachment.cpp in Sources */, 4617861920522469008256E1 /* SocketIO.cpp in Sources */, + 046AA9A2223B4761005191A4 /* SpineObject.cpp in Sources */, 46FDDABF202ACC6A00931238 /* State.cpp in Sources */, 46AE3FEF2092F3A600F3A228 /* inspector_agent.cc in Sources */, - 0430126B21DCF2B80007084D /* Bone.c in Sources */, - 0430127B21DCF2B80007084D /* SkeletonClipping.c in Sources */, + 046AAA00223B4762005191A4 /* Updatable.cpp in Sources */, + 046AA9B0223B4761005191A4 /* Slot.cpp in Sources */, 1A28FF5F1F20AFAB007A1D9D /* SRProxyConnect.m in Sources */, 46FDDB8B202ADDCE00931238 /* CCAutoreleasePool.cpp in Sources */, 046E03FD21804E6B00B24E2D /* AttachmentVertices.cpp in Sources */, - 0430129F21DCF2B80007084D /* SkeletonBinary.c in Sources */, 046E06432185B41100B24E2D /* Animation.cpp in Sources */, 046E06312185B41100B24E2D /* BaseTimelineState.cpp in Sources */, 461786652052607E008256E1 /* jsb_websocket.cpp in Sources */, 46FDDA87202ACC6A00931238 /* View.cpp in Sources */, 1A52DB71205BCDC700350EE3 /* Class.cpp in Sources */, 4617862120522469008256E1 /* HttpCookie.cpp in Sources */, - 046E03ED21804E6B00B24E2D /* CreatorAttachmentLoader.cpp in Sources */, 1A29D769205665BE00168D9A /* jsb_cocos2dx_auto.cpp in Sources */, ED3057821BEC76C90083C3ED /* unzip.cpp in Sources */, - 0430125321DCF2B80007084D /* AnimationState.c in Sources */, 046E065A2185B41B00B24E2D /* DeformVertices.cpp in Sources */, 1A28FF8F1F20AFAB007A1D9D /* NSRunLoop+SRWebSocket.m in Sources */, 469303A62046AE05004A3D6C /* PlatformUtils.mm in Sources */, + 046AA93A223B4761005191A4 /* PathConstraintData.cpp in Sources */, + 046AA9DC223B4762005191A4 /* Triangulator.cpp in Sources */, ED3057801BEC76C90083C3ED /* ioapi.cpp in Sources */, - 0430122721DCF2B80007084D /* PathConstraint.c in Sources */, 1A52DB26205BCD9200350EE3 /* Utils.cpp in Sources */, 46FDDA9F202ACC6A00931238 /* ProgramLib.cpp in Sources */, 46FDDABB202ACC6A00931238 /* VertexFormat.cpp in Sources */, - 0430126121DCF2B80007084D /* EventData.c in Sources */, 046E06CD2185B49F00B24E2D /* CanvasData.cpp in Sources */, 403ACADA20CE4EB000BB433D /* jsb_module_register.cpp in Sources */, 1A28FF671F20AFAB007A1D9D /* SRPinningSecurityPolicy.m in Sources */, - 0430129921DCF2B80007084D /* AnimationStateData.c in Sources */, + 046AA96E223B4761005191A4 /* SkeletonBinary.cpp in Sources */, 469303BE2046AE05004A3D6C /* jsb_renderer_auto.cpp in Sources */, - 0430126921DCF2B80007084D /* ClippingAttachment.c in Sources */, 50ABC0191926664800A911A9 /* CCSAXParser.cpp in Sources */, 1A28FF571F20AFAB007A1D9D /* SRIOConsumerPool.m in Sources */, + 046AA9F8223B4762005191A4 /* TransformConstraintData.cpp in Sources */, 46FDDB7B202ADDCE00931238 /* CCRef.cpp in Sources */, + 046AA98A223B4761005191A4 /* PointAttachment.cpp in Sources */, + 046AAA16223B4762005191A4 /* Animation.cpp in Sources */, 46FDDB8D202ADDCE00931238 /* ccTypes.cpp in Sources */, 46FDDAA9202ACC6A00931238 /* Types.cpp in Sources */, 1A28FF4F1F20AFAB007A1D9D /* SRDelegateController.m in Sources */, - 0430128121DCF2B80007084D /* AtlasAttachmentLoader.c in Sources */, 46FDDBFB202ADDCE00931238 /* ccCArray.cpp in Sources */, 1AAAC8E1205CB6E9005321B9 /* AudioPlayer.mm in Sources */, + 046AA924223B4761005191A4 /* Event.cpp in Sources */, 1A28FF631F20AFAB007A1D9D /* SRRunLoopThread.m in Sources */, 04ED68D821F8188F006E82F8 /* MeshBuffer.cpp in Sources */, + 046AA914223B4761005191A4 /* PathConstraintPositionTimeline.cpp in Sources */, 50ABBD5C1925AB0000A911A9 /* Vec3.cpp in Sources */, 469303662046AE05004A3D6C /* HandleObject.cpp in Sources */, 469301D1203FC696004A3D6C /* CCConfiguration.cpp in Sources */, 46FDDB93202ADDCE00931238 /* TGAlib.cpp in Sources */, - 0430122121DCF2B80007084D /* Atlas.c in Sources */, 1A52DB60205BCDC700350EE3 /* Utils.cpp in Sources */, 046E06BB2185B49F00B24E2D /* TextureAtlasData.cpp in Sources */, 1A28FF831F20AFAB007A1D9D /* SRRandom.m in Sources */, 046E03F321804E6B00B24E2D /* spine-cocos2dx.cpp in Sources */, 46FDDAC5202ACC6A00931238 /* RenderTarget.cpp in Sources */, + 046AA9BA223B4761005191A4 /* TransformConstraint.cpp in Sources */, + 046AA93C223B4761005191A4 /* Timeline.cpp in Sources */, 1A52DB6D205BCDC700350EE3 /* ScriptEngine.cpp in Sources */, + 046AA992223B4761005191A4 /* Json.cpp in Sources */, 50ABBD3C1925AB0000A911A9 /* CCGeometry.cpp in Sources */, 1A28FF771F20AFAB007A1D9D /* SRHTTPConnectMessage.m in Sources */, 46FDDB99202ADDCE00931238 /* ccUTF8.cpp in Sources */, @@ -3983,22 +4304,29 @@ 46FDDAE3202ACC6A00931238 /* GFX.cpp in Sources */, ED30579C1BEC77B70083C3ED /* ConvertUTFWrapper.cpp in Sources */, 46AE3FF12092F3A600F3A228 /* SHA1.cpp in Sources */, + 046AA996223B4761005191A4 /* IkConstraintTimeline.cpp in Sources */, 46FDDAB1202ACC6A00931238 /* DeviceGraphics.cpp in Sources */, 1A28FF7B1F20AFAB007A1D9D /* SRLog.m in Sources */, 46FDDAC9202ACC6A00931238 /* RenderBuffer.cpp in Sources */, 46AE3FE92092F3A600F3A228 /* inspector_socket_server.cc in Sources */, + 046AA934223B4761005191A4 /* AttachmentTimeline.cpp in Sources */, 1A28FF6F1F20AFAB007A1D9D /* SRError.m in Sources */, 1A28FF531F20AFAB007A1D9D /* SRIOConsumer.m in Sources */, + 046AAA1C223B4762005191A4 /* ScaleTimeline.cpp in Sources */, 1A29D784205666B200168D9A /* LocalStorage.cpp in Sources */, 046E06C32185B49F00B24E2D /* ArmatureData.cpp in Sources */, 4617864920522469008256E1 /* CCDownloader.cpp in Sources */, 4693039E2046AE05004A3D6C /* Object.mm in Sources */, + 046AA9F6223B4762005191A4 /* AnimationStateData.cpp in Sources */, 4043D65E20D2132E00C55611 /* CCGLView-desktop.cpp in Sources */, 46AE3FE12092F3A600F3A228 /* node.cc in Sources */, 46FDDA8B202ACC6A00931238 /* ForwardRenderer.cpp in Sources */, + 046AAA0A223B4762005191A4 /* ClippingAttachment.cpp in Sources */, + 046AA99E223B4761005191A4 /* AttachmentLoader.cpp in Sources */, 046E06D32185B49F00B24E2D /* SkinData.cpp in Sources */, 50ABBD481925AB0000A911A9 /* Mat4.cpp in Sources */, 046E06EF2185B4A500B24E2D /* BinaryDataParser.cpp in Sources */, + 046AAA1E223B4762005191A4 /* ColorTimeline.cpp in Sources */, 50ABBD441925AB0000A911A9 /* CCVertex.cpp in Sources */, 50ABC0631926664800A911A9 /* CCDevice-mac.mm in Sources */, 461786552052301A008256E1 /* CCScheduler.cpp in Sources */, @@ -4011,10 +4339,13 @@ 4693039A2046AE05004A3D6C /* Utils.cpp in Sources */, 046B689021A00F5600B33469 /* IOTypedArray.cpp in Sources */, 046E06162185B37100B24E2D /* CCSlot.cpp in Sources */, + 046AA984223B4761005191A4 /* ShearTimeline.cpp in Sources */, 1A52DB882060B11800350EE3 /* jsb_platfrom_apple.mm in Sources */, 04F49F41222A777C00E5CAF1 /* SkeletonDataMgr.cpp in Sources */, 046E06372185B41100B24E2D /* AnimationState.cpp in Sources */, + 046AA9E2223B4762005191A4 /* PathConstraintMixTimeline.cpp in Sources */, 046E06BF2185B49F00B24E2D /* BoundingBoxData.cpp in Sources */, + 046AA922223B4761005191A4 /* DrawOrderTimeline.cpp in Sources */, 4617864720522469008256E1 /* CCDownloaderImpl-apple.mm in Sources */, 1A52DB24205BCD9200350EE3 /* ObjectWrap.cpp in Sources */, 1AAAC8F1205CB6E9005321B9 /* AudioEngine.cpp in Sources */, @@ -4022,61 +4353,74 @@ 46FDDAE5202ACC6B00931238 /* IndexBuffer.cpp in Sources */, 046B688A219FA61200B33469 /* MiddlewareManager.cpp in Sources */, 1A29D76F205665D200168D9A /* jsb_cocos2dx_manual.cpp in Sources */, - 0430127321DCF2B80007084D /* SlotData.c in Sources */, 50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */, 46FDDBA3202ADDCE00931238 /* pvr.cpp in Sources */, + 046AAA10223B4762005191A4 /* DeformTimeline.cpp in Sources */, 46FDDBE3202ADDCE00931238 /* CCData.cpp in Sources */, 1A52DB3E205BCD9200350EE3 /* Class.cpp in Sources */, 1A52DB2E205BCD9200350EE3 /* Object.cpp in Sources */, 046E06972185B45300B24E2D /* Transform.cpp in Sources */, + 046AA976223B4761005191A4 /* AtlasAttachmentLoader.cpp in Sources */, + 046AA9C4223B4762005191A4 /* BoundingBoxAttachment.cpp in Sources */, 1A52DB6C205BCDC700350EE3 /* Object.cpp in Sources */, 046E069B2185B45300B24E2D /* Point.cpp in Sources */, - 0430128D21DCF2B80007084D /* SkeletonData.c in Sources */, 046E06E92185B4A500B24E2D /* JSONDataParser.cpp in Sources */, 04AF62FF219190ED00AED9DE /* TypedArrayPool.cpp in Sources */, 1A28FF731F20AFAB007A1D9D /* SRHash.m in Sources */, + 046AAA08223B4762005191A4 /* IkConstraint.cpp in Sources */, + 046AA962223B4761005191A4 /* LinkedMesh.cpp in Sources */, 46FDDAB3202ACC6A00931238 /* VertexBuffer.cpp in Sources */, 046E06722185B42500B24E2D /* BaseObject.cpp in Sources */, + 046AA9D8223B4762005191A4 /* SkeletonBounds.cpp in Sources */, 4008729420CE20C2002EB77B /* jsb_cocos2dx_network_manual.cpp in Sources */, + 046AA9A6223B4761005191A4 /* SlotData.cpp in Sources */, + 046AA926223B4761005191A4 /* AnimationState.cpp in Sources */, 469303842046AE05004A3D6C /* MappingUtils.cpp in Sources */, 4617865F2052607E008256E1 /* jsb_xmlhttprequest.cpp in Sources */, + 046AA93E223B4761005191A4 /* VertexAttachment.cpp in Sources */, BA21055821008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp in Sources */, 469304082046AE06004A3D6C /* jsb_global.cpp in Sources */, 046E066C2185B41B00B24E2D /* Slot.cpp in Sources */, 50ABC0151926664800A911A9 /* CCImage.cpp in Sources */, 046E06D12185B49F00B24E2D /* DisplayData.cpp in Sources */, + 046AA98E223B4761005191A4 /* BoneData.cpp in Sources */, 46AE400B2092F3A600F3A228 /* env.cc in Sources */, - 0430125521DCF2B80007084D /* Color.c in Sources */, 46FDDAD3202ACC6A00931238 /* Texture2D.cpp in Sources */, 46FDDB6F202ADDCE00931238 /* ZipUtils.cpp in Sources */, 1A28FF871F20AFAB007A1D9D /* SRSIMDHelpers.m in Sources */, - 0430129721DCF2B80007084D /* Attachment.c in Sources */, + 046AA95C223B4761005191A4 /* TwoColorTimeline.cpp in Sources */, 046B68AE21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp in Sources */, - 043012AD21DCF2B80007084D /* MeshAttachment.c in Sources */, 50ABBD601925AB0000A911A9 /* Vec4.cpp in Sources */, + 046AA928223B4761005191A4 /* RotateTimeline.cpp in Sources */, 46FDDA93202ACC6A00931238 /* Technique.cpp in Sources */, 46FDDBFD202ADDCE00931238 /* CCValue.cpp in Sources */, ED3057A11BEC77D50083C3ED /* xxhash.c in Sources */, 46FDDA6F202ACC6A00931238 /* Pass.cpp in Sources */, 4617863520522469008256E1 /* HttpAsynConnection-apple.m in Sources */, - 043012B121DCF2B80007084D /* extension.c in Sources */, 461786612052607E008256E1 /* jsb_socketio.cpp in Sources */, + 046AA9F0223B4762005191A4 /* MathUtil.cpp in Sources */, + 046AA9BC223B4761005191A4 /* TransformConstraintTimeline.cpp in Sources */, + 046AA98C223B4761005191A4 /* EventTimeline.cpp in Sources */, 1A28FF8B1F20AFAB007A1D9D /* SRURLUtilities.m in Sources */, ED3057881BEC773E0083C3ED /* tinyxml2.cpp in Sources */, 46FDDA95202ACC6A00931238 /* RendererUtils.cpp in Sources */, 1A28FF9D1F20AFAB007A1D9D /* SRWebSocket.m in Sources */, 46FDDB8F202ADDCE00931238 /* ccUtils.cpp in Sources */, 046E06FD2189999600B24E2D /* jsb_cocos2dx_editor_support_auto.cpp in Sources */, + 046AA988223B4761005191A4 /* TextureLoader.cpp in Sources */, + 046AA978223B4761005191A4 /* VertexEffect.cpp in Sources */, 046E065C2185B41B00B24E2D /* Constraint.cpp in Sources */, - 0430124F21DCF2B80007084D /* Skeleton.c in Sources */, 1A29D796205666F500168D9A /* jsb_opengl_utils.cpp in Sources */, BA21055A21009A2600E19975 /* AssetsManagerEx.cpp in Sources */, 046E06742185B42500B24E2D /* DragonBones.cpp in Sources */, + 046AAA0E223B4762005191A4 /* PathConstraint.cpp in Sources */, BA21055B21009A2900E19975 /* CCEventAssetsManagerEx.cpp in Sources */, 046E06822185B43B00B24E2D /* EventObject.cpp in Sources */, 046B68A621A292D300B33469 /* jsb_spine_manual.cpp in Sources */, BA21055C21009A2C00E19975 /* Manifest.cpp in Sources */, 046E06392185B41100B24E2D /* WorldClock.cpp in Sources */, + 046AA958223B4761005191A4 /* PathConstraintSpacingTimeline.cpp in Sources */, + 046AA9AA223B4761005191A4 /* RegionAttachment.cpp in Sources */, 1A28FF931F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4086,42 +4430,51 @@ buildActionMask = 2147483647; files = ( ED30578D1BEC77550083C3ED /* unzip.cpp in Sources */, - 0430127221DCF2B80007084D /* SkeletonBounds.c in Sources */, 46FDDA9E202ACC6A00931238 /* BaseRenderer.cpp in Sources */, + 046AAA17223B4762005191A4 /* Animation.cpp in Sources */, 1A586C462064C90500B47573 /* EJConvertTypedArray.m in Sources */, 46FDDAC6202ACC6A00931238 /* RenderTarget.cpp in Sources */, 4617864820522469008256E1 /* CCDownloaderImpl-apple.mm in Sources */, - 0430129021DCF2B80007084D /* PathAttachment.c in Sources */, 046E066D2185B41B00B24E2D /* Slot.cpp in Sources */, + 046AA93D223B4761005191A4 /* Timeline.cpp in Sources */, 1A28FF601F20AFAB007A1D9D /* SRProxyConnect.m in Sources */, 1A28FF901F20AFAB007A1D9D /* NSRunLoop+SRWebSocket.m in Sources */, 046E06C42185B49F00B24E2D /* ArmatureData.cpp in Sources */, 50ABC0161926664800A911A9 /* CCImage.cpp in Sources */, + 046AA99F223B4761005191A4 /* AttachmentLoader.cpp in Sources */, 469303852046AE05004A3D6C /* MappingUtils.cpp in Sources */, 046E06F02185B4A500B24E2D /* BinaryDataParser.cpp in Sources */, 46FDDBA4202ADDCE00931238 /* pvr.cpp in Sources */, 46FDDAB6202ACC6A00931238 /* Program.cpp in Sources */, + 046AAA27223B4762005191A4 /* MeshAttachment.cpp in Sources */, + 046AA937223B4761005191A4 /* CurveTimeline.cpp in Sources */, 46FDDAC2202ACC6A00931238 /* Texture.cpp in Sources */, + 046AAA0B223B4762005191A4 /* ClippingAttachment.cpp in Sources */, 50ABC01A1926664800A911A9 /* CCSAXParser.cpp in Sources */, + 046AA9B1223B4761005191A4 /* Slot.cpp in Sources */, 4693039B2046AE05004A3D6C /* Utils.cpp in Sources */, 046E06982185B45300B24E2D /* Transform.cpp in Sources */, - 046E03EE21804E6B00B24E2D /* CreatorAttachmentLoader.cpp in Sources */, + 046AAA09223B4762005191A4 /* IkConstraint.cpp in Sources */, 503DD8EE1926736A00CD74DD /* CCImage-ios.mm in Sources */, 046B68AF21A294B100B33469 /* jsb_cocos2dx_spine_auto.cpp in Sources */, + 046AA959223B4761005191A4 /* PathConstraintSpacingTimeline.cpp in Sources */, ED30578B1BEC774D0083C3ED /* ioapi_mem.cpp in Sources */, + 046AA9F1223B4762005191A4 /* MathUtil.cpp in Sources */, 1A28FF9A1F20AFAB007A1D9D /* SRSecurityPolicy.m in Sources */, 1A28FF581F20AFAB007A1D9D /* SRIOConsumerPool.m in Sources */, 469303C72046AE05004A3D6C /* jsb_gfx_auto.cpp in Sources */, 46AE3FF22092F3A600F3A228 /* SHA1.cpp in Sources */, ED30579E1BEC77BD0083C3ED /* ConvertUTFWrapper.cpp in Sources */, - 0430122821DCF2B80007084D /* PathConstraint.c in Sources */, 046E06892185B44A00B24E2D /* BaseFactory.cpp in Sources */, + 046AA9AB223B4761005191A4 /* RegionAttachment.cpp in Sources */, 1A28FF801F20AFAB007A1D9D /* SRMutex.m in Sources */, 046E06FE2189999600B24E2D /* jsb_cocos2dx_editor_support_auto.cpp in Sources */, + 046AA947223B4761005191A4 /* Attachment.cpp in Sources */, + 046AAA03223B4762005191A4 /* SkeletonClipping.cpp in Sources */, 46AE400C2092F3A600F3A228 /* env.cc in Sources */, 46FDDC69202D733800931238 /* CCApplication-ios.mm in Sources */, ED3057C21BEC78A80083C3ED /* xxhash.c in Sources */, - 0430125421DCF2B80007084D /* AnimationState.c in Sources */, + 046AAA1D223B4762005191A4 /* ScaleTimeline.cpp in Sources */, 4037F5CF2108751E001C205C /* CCAsyncTaskPool.cpp in Sources */, ED30578C1BEC77510083C3ED /* ioapi.cpp in Sources */, 046E06362185B41100B24E2D /* TimelineState.cpp in Sources */, @@ -4133,27 +4486,27 @@ 40AEF7C2216DF22900729AA5 /* jsb_video_auto.cpp in Sources */, 046E03FE21804E6B00B24E2D /* AttachmentVertices.cpp in Sources */, ED30578A1BEC77460083C3ED /* tinyxml2.cpp in Sources */, + 046AAA1B223B4762005191A4 /* SkeletonData.cpp in Sources */, 1A29D76A205665BE00168D9A /* jsb_cocos2dx_auto.cpp in Sources */, 46FDDBFC202ADDCE00931238 /* ccCArray.cpp in Sources */, 04355817217EADF300B9C056 /* IOBuffer.cpp in Sources */, 46FDDB7C202ADDCE00931238 /* CCRef.cpp in Sources */, 046E06F82189990700B24E2D /* middleware-adapter.cpp in Sources */, 046E070A218B015100B24E2D /* jsb_cocos2dx_dragonbones_auto.cpp in Sources */, - 043012AA21DCF2B80007084D /* Animation.c in Sources */, 469301D2203FC696004A3D6C /* CCConfiguration.cpp in Sources */, + 046AA9A3223B4761005191A4 /* SpineObject.cpp in Sources */, 461DCA5920C7E4BA00B22827 /* JavaScriptObjCBridge.mm in Sources */, - 0430125221DCF2B80007084D /* TransformConstraintData.c in Sources */, 46FDDAB2202ACC6A00931238 /* DeviceGraphics.cpp in Sources */, 46FDDBFA202ADDCE00931238 /* etc1.cpp in Sources */, 46FDDA88202ACC6A00931238 /* View.cpp in Sources */, 046E06322185B41100B24E2D /* BaseTimelineState.cpp in Sources */, - 0430128421DCF2B80007084D /* Skin.c in Sources */, - 0430124A21DCF2B80007084D /* Triangulator.c in Sources */, 50ABBD591925AB0000A911A9 /* Vec2.cpp in Sources */, 1A28FF681F20AFAB007A1D9D /* SRPinningSecurityPolicy.m in Sources */, 1A28FF9E1F20AFAB007A1D9D /* SRWebSocket.m in Sources */, + 046AA98B223B4761005191A4 /* PointAttachment.cpp in Sources */, 046E06592185B41B00B24E2D /* Armature.cpp in Sources */, 403ACADC20CE542600BB433D /* jsb_module_register.cpp in Sources */, + 046AA9F9223B4762005191A4 /* TransformConstraintData.cpp in Sources */, 046E06BC2185B49F00B24E2D /* TextureAtlasData.cpp in Sources */, 04ED68D921F8188F006E82F8 /* MeshBuffer.cpp in Sources */, 46FDDA9A202ACC6A00931238 /* Model.cpp in Sources */, @@ -4161,26 +4514,24 @@ 4693038F2046AE05004A3D6C /* Value.cpp in Sources */, 469303A12046AE05004A3D6C /* ScriptEngine.mm in Sources */, 046E06EA2185B4A500B24E2D /* JSONDataParser.cpp in Sources */, - 043012AE21DCF2B80007084D /* MeshAttachment.c in Sources */, - 0430123821DCF2B80007084D /* BoneData.c in Sources */, 046B688B219FA61200B33469 /* MiddlewareManager.cpp in Sources */, 46FDDB8C202ADDCE00931238 /* CCAutoreleasePool.cpp in Sources */, 461786622052607E008256E1 /* jsb_socketio.cpp in Sources */, + 046AA9C7223B4762005191A4 /* SkeletonJson.cpp in Sources */, 4693039F2046AE05004A3D6C /* Object.mm in Sources */, 46FDDABA202ACC6A00931238 /* FrameBuffer.cpp in Sources */, + 046AA93F223B4761005191A4 /* VertexAttachment.cpp in Sources */, 461786562052301A008256E1 /* CCScheduler.cpp in Sources */, 46FDDAE6202ACC6B00931238 /* IndexBuffer.cpp in Sources */, 46FDDB8E202ADDCE00931238 /* ccTypes.cpp in Sources */, 50ABBD4D1925AB0000A911A9 /* MathUtil.cpp in Sources */, 46AE40082092F3A600F3A228 /* node_debug_options.cc in Sources */, 046E06572185B41B00B24E2D /* TransformObject.cpp in Sources */, - 0430122221DCF2B80007084D /* Atlas.c in Sources */, 1A52DB75205BCDD000350EE3 /* Class.cpp in Sources */, 1AAAC8E4205CB6E9005321B9 /* AudioDecoder.mm in Sources */, 46FDDB90202ADDCE00931238 /* ccUtils.cpp in Sources */, 50ABC00E1926664800A911A9 /* CCFileUtils.cpp in Sources */, 46FDDA94202ACC6A00931238 /* Technique.cpp in Sources */, - 0430123221DCF2B80007084D /* VertexEffect.c in Sources */, 46FDDA72202ACC6A00931238 /* Scene.cpp in Sources */, 046E06732185B42500B24E2D /* BaseObject.cpp in Sources */, 046B689121A00F5600B33469 /* IOTypedArray.cpp in Sources */, @@ -4193,78 +4544,86 @@ 4617864A20522469008256E1 /* CCDownloader.cpp in Sources */, 46FDDAD6202ACC6A00931238 /* GraphicsHandle.cpp in Sources */, 04F49F4E222B80C500E5CAF1 /* RenderInfoMgr.cpp in Sources */, + 044DE379227552520037572E /* VertexEffectDelegate.cpp in Sources */, + 046AA95D223B4761005191A4 /* TwoColorTimeline.cpp in Sources */, 046E063A2185B41100B24E2D /* WorldClock.cpp in Sources */, 50ABBD611925AB0000A911A9 /* Vec4.cpp in Sources */, + 046AA9A5223B4761005191A4 /* TranslateTimeline.cpp in Sources */, 46FDDB9A202ADDCE00931238 /* ccUTF8.cpp in Sources */, - 0430123421DCF2B80007084D /* AttachmentLoader.c in Sources */, + 046AAA11223B4762005191A4 /* DeformTimeline.cpp in Sources */, 469304092046AE06004A3D6C /* jsb_global.cpp in Sources */, 46FDDA70202ACC6A00931238 /* Pass.cpp in Sources */, 1A52DB7A205BCDD000350EE3 /* ScriptEngine.cpp in Sources */, 1A14FD922080B4E300E10ABE /* CCGLUtils.cpp in Sources */, + 046AA981223B4761005191A4 /* Skin.cpp in Sources */, 1A28FF741F20AFAB007A1D9D /* SRHash.m in Sources */, + 046AA977223B4761005191A4 /* AtlasAttachmentLoader.cpp in Sources */, + 046AA9AD223B4761005191A4 /* Extension.cpp in Sources */, 46FDDB70202ADDCE00931238 /* ZipUtils.cpp in Sources */, 50ABBD511925AB0000A911A9 /* Quaternion.cpp in Sources */, + 046AA929223B4761005191A4 /* RotateTimeline.cpp in Sources */, 46930469204FE20F004A3D6C /* CCLog.cpp in Sources */, - 0430128E21DCF2B80007084D /* SkeletonData.c in Sources */, 1AAAC874205CB647005321B9 /* jsb_cocos2dx_audioengine_auto.cpp in Sources */, 50ABBD491925AB0000A911A9 /* Mat4.cpp in Sources */, 469303672046AE05004A3D6C /* HandleObject.cpp in Sources */, - 043012B221DCF2B80007084D /* extension.c in Sources */, 46FDDACA202ACC6A00931238 /* RenderBuffer.cpp in Sources */, 461DCA3B20BBFCA300B22827 /* EditBox-ios.mm in Sources */, + 046AA927223B4761005191A4 /* AnimationState.cpp in Sources */, 1A52DB78205BCDD000350EE3 /* Object.cpp in Sources */, + 046AA93B223B4761005191A4 /* PathConstraintData.cpp in Sources */, 469303A72046AE05004A3D6C /* PlatformUtils.mm in Sources */, 046E069C2185B45300B24E2D /* Point.cpp in Sources */, - 043012B021DCF2B80007084D /* SkeletonJson.c in Sources */, 046E06DE2185B49F00B24E2D /* AnimationData.cpp in Sources */, + 046AA9BB223B4761005191A4 /* TransformConstraint.cpp in Sources */, 46FDDAD4202ACC6A00931238 /* Texture2D.cpp in Sources */, - 043012B821DCF2B80007084D /* VertexAttachment.c in Sources */, + 046AA915223B4761005191A4 /* PathConstraintPositionTimeline.cpp in Sources */, 40FF7AA1216B29CC00E73029 /* VideoPlayer-ios.mm in Sources */, 046E06212185B37100B24E2D /* CCArmatureDisplay.cpp in Sources */, 40CEAEB620CFDC28007A3281 /* CCReachability.cpp in Sources */, 046E06BA2185B49F00B24E2D /* ConstraintData.cpp in Sources */, 046E06832185B43B00B24E2D /* EventObject.cpp in Sources */, + 046AA98F223B4761005191A4 /* BoneData.cpp in Sources */, 46FDDA8C202ACC6A00931238 /* ForwardRenderer.cpp in Sources */, - 0430123A21DCF2B80007084D /* Slot.c in Sources */, ED30579D1BEC77B90083C3ED /* ConvertUTF.c in Sources */, 46AE3FE22092F3A600F3A228 /* node.cc in Sources */, 4617864D205224CC008256E1 /* WebSocket-apple.mm in Sources */, 1AAAC8E2205CB6E9005321B9 /* AudioPlayer.mm in Sources */, + 046AA9E5223B4762005191A4 /* PathAttachment.cpp in Sources */, + 046AA9E3223B4762005191A4 /* PathConstraintMixTimeline.cpp in Sources */, 046E06752185B42500B24E2D /* DragonBones.cpp in Sources */, - 0430128221DCF2B80007084D /* AtlasAttachmentLoader.c in Sources */, - 0430124221DCF2B80007084D /* TransformConstraint.c in Sources */, 469304132046AE06004A3D6C /* jsb_classtype.cpp in Sources */, - 0430126E21DCF2B80007084D /* RegionAttachment.c in Sources */, 46FDDAA4202ACC6A00931238 /* InputAssembler.cpp in Sources */, 1A28FF941F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.m in Sources */, 4693042F2046AE06004A3D6C /* jsb_helper.cpp in Sources */, 046E065B2185B41B00B24E2D /* DeformVertices.cpp in Sources */, + 046AA979223B4761005191A4 /* VertexEffect.cpp in Sources */, 4693043D2046AE06004A3D6C /* jsb_gfx_manual.cpp in Sources */, - 043012A821DCF2B80007084D /* Array.c in Sources */, 46FDDBFE202ADDCE00931238 /* CCValue.cpp in Sources */, 1A28FF7C1F20AFAB007A1D9D /* SRLog.m in Sources */, 1A28FF641F20AFAB007A1D9D /* SRRunLoopThread.m in Sources */, - 0430126621DCF2B80007084D /* BoundingBoxAttachment.c in Sources */, 1A28FF6C1F20AFAB007A1D9D /* SRConstants.m in Sources */, + 046AA9A7223B4761005191A4 /* SlotData.cpp in Sources */, 4693042D2046AE06004A3D6C /* jsb_renderer_manual.cpp in Sources */, 1AAAC8E8205CB6E9005321B9 /* AudioEngine-inl.mm in Sources */, - 0430123C21DCF2B80007084D /* PathConstraintData.c in Sources */, 4617862220522469008256E1 /* HttpCookie.cpp in Sources */, + 046AA9BD223B4761005191A4 /* TransformConstraintTimeline.cpp in Sources */, 46FDDAE2202ACC6A00931238 /* GFXUtils.cpp in Sources */, + 046AA9D9223B4762005191A4 /* SkeletonBounds.cpp in Sources */, 1A586C4C2064C97800B47573 /* EJConvert.m in Sources */, 469304272046AE06004A3D6C /* jsb_conversions.cpp in Sources */, - 046E03F021804E6B00B24E2D /* SpineAnimation.cpp in Sources */, + 046AA935223B4761005191A4 /* AttachmentTimeline.cpp in Sources */, + 046E03F021804E6B00B24E2D /* SkeletonAnimation.cpp in Sources */, + 046AA9DD223B4762005191A4 /* Triangulator.cpp in Sources */, 46AE40042092F3A600F3A228 /* http_parser.c in Sources */, - 0430124621DCF2B80007084D /* Json.c in Sources */, - 0430129821DCF2B80007084D /* Attachment.c in Sources */, 046E06EC2185B4A500B24E2D /* DataParser.cpp in Sources */, 46FDDA7A202ACC6A00931238 /* Camera.cpp in Sources */, 461786602052607E008256E1 /* jsb_xmlhttprequest.cpp in Sources */, + 046AA951223B4761005191A4 /* Constraint.cpp in Sources */, 46FDDAA0202ACC6A00931238 /* ProgramLib.cpp in Sources */, 4617863420522469008256E1 /* Uri.cpp in Sources */, + 046AA985223B4761005191A4 /* ShearTimeline.cpp in Sources */, 4008729520CE20C2002EB77B /* jsb_cocos2dx_network_manual.cpp in Sources */, 046E06442185B41100B24E2D /* Animation.cpp in Sources */, - 0430126A21DCF2B80007084D /* ClippingAttachment.c in Sources */, 50ABBD3D1925AB0000A911A9 /* CCGeometry.cpp in Sources */, 046E06CA2185B49F00B24E2D /* UserData.cpp in Sources */, 1A28FF8C1F20AFAB007A1D9D /* SRURLUtilities.m in Sources */, @@ -4272,28 +4631,35 @@ 046B68A721A292D300B33469 /* jsb_spine_manual.cpp in Sources */, 469303692046AE05004A3D6C /* State.cpp in Sources */, 46FDDAAA202ACC6A00931238 /* Types.cpp in Sources */, + 046AA993223B4761005191A4 /* Json.cpp in Sources */, 1A29D797205666F500168D9A /* jsb_opengl_utils.cpp in Sources */, 046E06E22185B49F00B24E2D /* DragonBonesData.cpp in Sources */, - 0430125621DCF2B80007084D /* Color.c in Sources */, 40AEF7B6216D982600729AA5 /* jsb_webview_auto.cpp in Sources */, + 046AA96F223B4761005191A4 /* SkeletonBinary.cpp in Sources */, + 046AA9F7223B4762005191A4 /* AnimationStateData.cpp in Sources */, 5027253D190BF1B900AAF4ED /* cocos2d.cpp in Sources */, 1A28FF781F20AFAB007A1D9D /* SRHTTPConnectMessage.m in Sources */, 046E06C62185B49F00B24E2D /* AnimationConfig.cpp in Sources */, 1A28FF881F20AFAB007A1D9D /* SRSIMDHelpers.m in Sources */, 50ABBD451925AB0000A911A9 /* CCVertex.cpp in Sources */, 294D7D9D1D0E93A2002CE7B7 /* CCDevice-apple.mm in Sources */, - 0430125021DCF2B80007084D /* Skeleton.c in Sources */, 469303BF2046AE05004A3D6C /* jsb_renderer_auto.cpp in Sources */, + 046AA923223B4761005191A4 /* DrawOrderTimeline.cpp in Sources */, 4617864F205224D6008256E1 /* HttpAsynConnection-apple.m in Sources */, BA21055921008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp in Sources */, + 046AA997223B4761005191A4 /* IkConstraintTimeline.cpp in Sources */, 1A52DB8E2060DEF500350EE3 /* jsb_platfrom_apple.mm in Sources */, 503DD8E71926736A00CD74DD /* CCEAGLView-ios.mm in Sources */, 1A29D785205666B200168D9A /* LocalStorage.cpp in Sources */, 46AE3FEA2092F3A600F3A228 /* inspector_socket_server.cc in Sources */, + 046AAA0F223B4762005191A4 /* PathConstraint.cpp in Sources */, 46FDDA8A202ACC6A00931238 /* Effect.cpp in Sources */, 046E06382185B41100B24E2D /* AnimationState.cpp in Sources */, - 046E03FA21804E6B00B24E2D /* SpineRenderer.cpp in Sources */, + 046E03FA21804E6B00B24E2D /* SkeletonRenderer.cpp in Sources */, + 046AA921223B4761005191A4 /* IkConstraintData.cpp in Sources */, + 046AA925223B4761005191A4 /* Event.cpp in Sources */, 4617861A20522469008256E1 /* SocketIO.cpp in Sources */, + 046AA949223B4761005191A4 /* Skeleton.cpp in Sources */, 46FDDB72202ADDCE00931238 /* base64.cpp in Sources */, 46FDDA7E202ACC6A00931238 /* Light.cpp in Sources */, 469303AB2046AE05004A3D6C /* Class.cpp in Sources */, @@ -4301,22 +4667,21 @@ 046E06672185B41B00B24E2D /* Bone.cpp in Sources */, 1ABAD24F20C29F3800BC71C0 /* CCCanvasRenderingContext2D-apple.mm in Sources */, 46AE3FFA2092F3A600F3A228 /* inspector_socket.cc in Sources */, - 0430126221DCF2B80007084D /* EventData.c in Sources */, 1AAAC8EC205CB6E9005321B9 /* AudioCache.mm in Sources */, 46FDDBE4202ADDCE00931238 /* CCData.cpp in Sources */, - 0430127421DCF2B80007084D /* SlotData.c in Sources */, - 0430129621DCF2B80007084D /* Event.c in Sources */, + 046AA999223B4761005191A4 /* Atlas.cpp in Sources */, 469304592046AE06004A3D6C /* EventDispatcher.cpp in Sources */, 46FDDAB4202ACC6A00931238 /* VertexBuffer.cpp in Sources */, - 0430126C21DCF2B80007084D /* Bone.c in Sources */, 4617864E205224CF008256E1 /* HttpClient-apple.mm in Sources */, 40AEF7AF216D940200729AA5 /* WebViewImpl-ios.mm in Sources */, - 043012A021DCF2B80007084D /* SkeletonBinary.c in Sources */, + 046AA9CF223B4762005191A4 /* RTTI.cpp in Sources */, 046E03F421804E6B00B24E2D /* spine-cocos2dx.cpp in Sources */, 46FDDB94202ADDCE00931238 /* TGAlib.cpp in Sources */, - 043012B421DCF2B80007084D /* PointAttachment.c in Sources */, 46FDDB66202ADDCE00931238 /* ccRandom.cpp in Sources */, + 046AAA1F223B4762005191A4 /* ColorTimeline.cpp in Sources */, 1A28FF841F20AFAB007A1D9D /* SRRandom.m in Sources */, + 046AAA01223B4762005191A4 /* Updatable.cpp in Sources */, + 046AAA21223B4762005191A4 /* Bone.cpp in Sources */, 46FDDA96202ACC6A00931238 /* RendererUtils.cpp in Sources */, 046E06232185B37100B24E2D /* CCTextureAtlasData.cpp in Sources */, 04AF6300219190ED00AED9DE /* TypedArrayPool.cpp in Sources */, @@ -4324,16 +4689,16 @@ 469303952046AE05004A3D6C /* RefCounter.cpp in Sources */, 46FDDABC202ACC6A00931238 /* VertexFormat.cpp in Sources */, 046E061D2185B37100B24E2D /* CCFactory.cpp in Sources */, + 046AA98D223B4761005191A4 /* EventTimeline.cpp in Sources */, 50ABBD5D1925AB0000A911A9 /* Vec3.cpp in Sources */, - 043012BC21DCF2B80007084D /* IkConstraintData.c in Sources */, + 046AA963223B4761005191A4 /* LinkedMesh.cpp in Sources */, 46AE3FF62092F3A600F3A228 /* util.cc in Sources */, - 0430129A21DCF2B80007084D /* AnimationStateData.c in Sources */, 461786662052607E008256E1 /* jsb_websocket.cpp in Sources */, 046E06172185B37100B24E2D /* CCSlot.cpp in Sources */, 50ABC0001926664800A911A9 /* CCFileUtils-apple.mm in Sources */, - 0430128A21DCF2B80007084D /* IkConstraint.c in Sources */, 4DC57D331F7B840E005B6546 /* xxtea.cpp in Sources */, 1A29D77C2056667800168D9A /* csscolorparser.cpp in Sources */, + 046AA989223B4761005191A4 /* TextureLoader.cpp in Sources */, 046E06D42185B49F00B24E2D /* SkinData.cpp in Sources */, 46FDDA8E202ACC6A00931238 /* Config.cpp in Sources */, 1A29D795205666F500168D9A /* jsb_opengl_manual.cpp in Sources */, @@ -4342,8 +4707,9 @@ 503DD8E31926736A00CD74DD /* CCDevice-ios.mm in Sources */, 1A28FF701F20AFAB007A1D9D /* SRError.m in Sources */, 1A28FF501F20AFAB007A1D9D /* SRDelegateController.m in Sources */, + 046AA9C5223B4762005191A4 /* BoundingBoxAttachment.cpp in Sources */, 46FDDAC0202ACC6A00931238 /* State.cpp in Sources */, - 0430127C21DCF2B80007084D /* SkeletonClipping.c in Sources */, + 046AA933223B4761005191A4 /* EventData.cpp in Sources */, BA21055E21009A5700E19975 /* AssetsManagerEx.cpp in Sources */, BA21055F21009A5A00E19975 /* CCEventAssetsManagerEx.cpp in Sources */, BA21055D21009A5500E19975 /* Manifest.cpp in Sources */, diff --git a/build/libcocos2d.vcxproj b/build/libcocos2d.vcxproj index 05180817722..01315976153 100644 --- a/build/libcocos2d.vcxproj +++ b/build/libcocos2d.vcxproj @@ -83,50 +83,72 @@ - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -333,38 +355,64 @@ - - - - + + + + + - - + + + + + + + + + + - + + + + + - + + + + + + + + + + + + + + @@ -374,12 +422,25 @@ + + + + + + + + + + + + + diff --git a/build/libcocos2d.vcxproj.filters b/build/libcocos2d.vcxproj.filters index 4627fc36284..d73e69562b1 100644 --- a/build/libcocos2d.vcxproj.filters +++ b/build/libcocos2d.vcxproj.filters @@ -428,19 +428,19 @@ editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support @@ -569,121 +569,247 @@ editor-support - + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + editor-support\spine @@ -1223,19 +1349,19 @@ editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support - + editor-support\spine-creator-support @@ -1397,121 +1523,118 @@ editor-support - - editor-support\spine - - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine - + editor-support\spine @@ -1523,6 +1646,126 @@ editor-support\spine + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + + + editor-support\spine + editor-support diff --git a/cocos/editor-support/Android.mk b/cocos/editor-support/Android.mk index 8683ba0771a..0bb0d76d8a4 100644 --- a/cocos/editor-support/Android.mk +++ b/cocos/editor-support/Android.mk @@ -20,51 +20,73 @@ MiddlewareManager.cpp \ ifeq ($(USE_SPINE),1) LOCAL_SRC_FILES += \ -spine/Animation.c \ -spine/AnimationState.c \ -spine/AnimationStateData.c \ -spine/Array.c \ -spine/Atlas.c \ -spine/AtlasAttachmentLoader.c \ -spine/Attachment.c \ -spine/AttachmentLoader.c \ -spine/Bone.c \ -spine/BoneData.c \ -spine/BoundingBoxAttachment.c \ -spine/ClippingAttachment.c \ -spine/Color.c \ -spine/Event.c \ -spine/EventData.c \ -spine/extension.c \ -spine/IkConstraint.c \ -spine/IkConstraintData.c \ -spine/Json.c \ -spine/MeshAttachment.c \ -spine/PathAttachment.c \ -spine/PathConstraint.c \ -spine/PathConstraintData.c \ -spine/PointAttachment.c \ -spine/RegionAttachment.c \ -spine/Skeleton.c \ -spine/SkeletonBinary.c \ -spine/SkeletonBounds.c \ -spine/SkeletonClipping.c \ -spine/SkeletonData.c \ -spine/SkeletonJson.c \ -spine/Skin.c \ -spine/Slot.c \ -spine/SlotData.c \ -spine/TransformConstraint.c \ -spine/TransformConstraintData.c \ -spine/Triangulator.c \ -spine/VertexAttachment.c \ -spine/VertexEffect.c \ +spine/Animation.cpp \ +spine/AnimationState.cpp \ +spine/AnimationStateData.cpp \ +spine/Atlas.cpp \ +spine/AtlasAttachmentLoader.cpp \ +spine/Attachment.cpp \ +spine/AttachmentLoader.cpp \ +spine/AttachmentTimeline.cpp \ +spine/Bone.cpp \ +spine/BoneData.cpp \ +spine/BoundingBoxAttachment.cpp \ +spine/ClippingAttachment.cpp \ +spine/ColorTimeline.cpp \ +spine/Constraint.cpp \ +spine/CurveTimeline.cpp \ +spine/DeformTimeline.cpp \ +spine/DrawOrderTimeline.cpp \ +spine/Event.cpp \ +spine/EventData.cpp \ +spine/EventTimeline.cpp \ +spine/Extension.cpp \ +spine/IkConstraint.cpp \ +spine/IkConstraintData.cpp \ +spine/IkConstraintTimeline.cpp \ +spine/Json.cpp \ +spine/LinkedMesh.cpp \ +spine/MathUtil.cpp \ +spine/MeshAttachment.cpp \ +spine/PathAttachment.cpp \ +spine/PathConstraint.cpp \ +spine/PathConstraintData.cpp \ +spine/PathConstraintMixTimeline.cpp \ +spine/PathConstraintPositionTimeline.cpp \ +spine/PathConstraintSpacingTimeline.cpp \ +spine/PointAttachment.cpp \ +spine/RegionAttachment.cpp \ +spine/RotateTimeline.cpp \ +spine/RTTI.cpp \ +spine/ScaleTimeline.cpp \ +spine/ShearTimeline.cpp \ +spine/Skeleton.cpp \ +spine/SkeletonBinary.cpp \ +spine/SkeletonBounds.cpp \ +spine/SkeletonClipping.cpp \ +spine/SkeletonData.cpp \ +spine/SkeletonJson.cpp \ +spine/Skin.cpp \ +spine/Slot.cpp \ +spine/SlotData.cpp \ +spine/SpineObject.cpp \ +spine/TextureLoader.cpp \ +spine/Timeline.cpp \ +spine/TransformConstraint.cpp \ +spine/TransformConstraintData.cpp \ +spine/TransformConstraintTimeline.cpp \ +spine/TranslateTimeline.cpp \ +spine/Triangulator.cpp \ +spine/TwoColorTimeline.cpp \ +spine/Updatable.cpp \ +spine/VertexAttachment.cpp \ +spine/VertexEffect.cpp \ spine-creator-support/AttachmentVertices.cpp \ -spine-creator-support/CreatorAttachmentLoader.cpp \ -spine-creator-support/SpineAnimation.cpp \ -spine-creator-support/SpineRenderer.cpp \ -spine-creator-support/spine-cocos2dx.cpp \ +spine-creator-support/SkeletonAnimation.cpp \ spine-creator-support/SkeletonDataMgr.cpp \ +spine-creator-support/SkeletonRenderer.cpp \ +spine-creator-support/spine-cocos2dx.cpp \ +spine-creator-support/VertexEffectDelegate.cpp \ ../scripting/js-bindings/manual/jsb_spine_manual.cpp \ ../scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp endif # USE_SPINE diff --git a/cocos/editor-support/MiddlewareMacro.h b/cocos/editor-support/MiddlewareMacro.h index 155b6abe713..7f51cb52c1e 100644 --- a/cocos/editor-support/MiddlewareMacro.h +++ b/cocos/editor-support/MiddlewareMacro.h @@ -29,7 +29,7 @@ // render info int capacity #define INIT_RENDER_INFO_BUFFER_SIZE 1024000 // fill debug data max capacity -#define MAX_DEBUG_BUFFER_SIZE 40960 +#define MAX_DEBUG_BUFFER_SIZE 409600 // type array pool min size #define MIN_TYPE_ARRAY_SIZE 1024 diff --git a/cocos/editor-support/spine-creator-support/AttachmentVertices.cpp b/cocos/editor-support/spine-creator-support/AttachmentVertices.cpp index a469f49bc48..e6fd952587b 100644 --- a/cocos/editor-support/spine-creator-support/AttachmentVertices.cpp +++ b/cocos/editor-support/spine-creator-support/AttachmentVertices.cpp @@ -1,31 +1,30 @@ /****************************************************************************** - * Spine Runtimes Software License v2.5 + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. + * Copyright (c) 2013-2019, Esoteric Software LLC * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. + * 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 * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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 "spine-creator-support/AttachmentVertices.h" @@ -34,8 +33,7 @@ USING_NS_CC; namespace spine { - AttachmentVertices::AttachmentVertices (middleware::Texture2D* texture, int verticesCount, unsigned short* triangles, int trianglesCount) - { + AttachmentVertices::AttachmentVertices (middleware::Texture2D* texture, int verticesCount, unsigned short* triangles, int trianglesCount) { _texture = texture; _triangles = new middleware::Triangles(); @@ -45,8 +43,7 @@ namespace spine { _triangles->indexCount = trianglesCount; } - AttachmentVertices::~AttachmentVertices () - { + AttachmentVertices::~AttachmentVertices () { delete [] _triangles->verts; delete _triangles; } diff --git a/cocos/editor-support/spine-creator-support/AttachmentVertices.h b/cocos/editor-support/spine-creator-support/AttachmentVertices.h index a93285ec8a7..d50a72ed7d2 100644 --- a/cocos/editor-support/spine-creator-support/AttachmentVertices.h +++ b/cocos/editor-support/spine-creator-support/AttachmentVertices.h @@ -1,31 +1,30 @@ /****************************************************************************** - * Spine Runtimes Software License v2.5 + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. + * Copyright (c) 2013-2019, Esoteric Software LLC * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. + * 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 * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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 @@ -37,8 +36,7 @@ namespace spine{ /** * Store attachment vertex and indice list */ - class AttachmentVertices - { + class AttachmentVertices { public: AttachmentVertices (cocos2d::middleware::Texture2D* texture, int verticesCount, unsigned short* triangles, int trianglesCount); virtual ~AttachmentVertices (); diff --git a/cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.cpp b/cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.cpp deleted file mode 100644 index cb65f04e9ea..00000000000 --- a/cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include "spine-creator-support/CreatorAttachmentLoader.h" -#include "spine/extension.h" -#include "spine-creator-support/AttachmentVertices.h" - -USING_NS_CC; -USING_NS_MW; -using namespace spine; - -static unsigned short quadTriangles[6] = {0, 1, 2, 2, 3, 0}; - -spAttachment* _CreatorAttachmentLoader_createAttachment (spAttachmentLoader* loader, spSkin* skin, spAttachmentType type, - const char* name, const char* path) -{ - CreatorAttachmentLoader* self = SUB_CAST(CreatorAttachmentLoader, loader); - return spAttachmentLoader_createAttachment(SUPER(self->atlasAttachmentLoader), skin, type, name, path); -} - -void _CreatorAttachmentLoader_configureAttachment (spAttachmentLoader* loader, spAttachment* attachment) -{ - attachment->attachmentLoader = loader; - - switch (attachment->type) - { - case SP_ATTACHMENT_REGION: - { - spRegionAttachment* regionAttachment = SUB_CAST(spRegionAttachment, attachment); - spAtlasRegion* region = (spAtlasRegion*)regionAttachment->rendererObject; - AttachmentVertices* attachmentVertices = new AttachmentVertices((Texture2D*)region->page->rendererObject, 4, quadTriangles, 6); - V2F_T2F_C4B* vertices = attachmentVertices->_triangles->verts; - for (int i = 0, ii = 0; i < 4; ++i, ii += 2) - { - vertices[i].texCoord.u = regionAttachment->uvs[ii]; - vertices[i].texCoord.v = regionAttachment->uvs[ii + 1]; - } - regionAttachment->rendererObject = attachmentVertices; - break; - } - case SP_ATTACHMENT_MESH: - { - spMeshAttachment* meshAttachment = SUB_CAST(spMeshAttachment, attachment); - spAtlasRegion* region = (spAtlasRegion*)meshAttachment->rendererObject; - AttachmentVertices* attachmentVertices = new AttachmentVertices((Texture2D*)region->page->rendererObject, - meshAttachment->super.worldVerticesLength >> 1, meshAttachment->triangles, meshAttachment->trianglesCount); - V2F_T2F_C4B* vertices = attachmentVertices->_triangles->verts; - for (int i = 0, ii = 0, nn = meshAttachment->super.worldVerticesLength; ii < nn; ++i, ii += 2) - { - vertices[i].texCoord.u = meshAttachment->uvs[ii]; - vertices[i].texCoord.v = meshAttachment->uvs[ii + 1]; - } - meshAttachment->rendererObject = attachmentVertices; - break; - } - default: ; - } -} - -void _CreatorAttachmentLoader_disposeAttachment (spAttachmentLoader* loader, spAttachment* attachment) -{ - switch (attachment->type) - { - case SP_ATTACHMENT_REGION: - { - spRegionAttachment* regionAttachment = SUB_CAST(spRegionAttachment, attachment); - delete (AttachmentVertices*)regionAttachment->rendererObject; - break; - } - case SP_ATTACHMENT_MESH: - { - spMeshAttachment* meshAttachment = SUB_CAST(spMeshAttachment, attachment); - delete (AttachmentVertices*)meshAttachment->rendererObject; - break; - } - default: ; - } -} - -void _CreatorAttachmentLoader_dispose (spAttachmentLoader* loader) -{ - CreatorAttachmentLoader* self = SUB_CAST(CreatorAttachmentLoader, loader); - spAttachmentLoader_dispose(SUPER_CAST(spAttachmentLoader, self->atlasAttachmentLoader)); - _spAttachmentLoader_deinit(loader); -} - -CreatorAttachmentLoader* CreatorAttachmentLoader_create (spAtlas* atlas) -{ - CreatorAttachmentLoader* self = NEW(CreatorAttachmentLoader); - _spAttachmentLoader_init(SUPER(self), _CreatorAttachmentLoader_dispose, _CreatorAttachmentLoader_createAttachment, - _CreatorAttachmentLoader_configureAttachment, _CreatorAttachmentLoader_disposeAttachment); - self->atlasAttachmentLoader = spAtlasAttachmentLoader_create(atlas); - return self; -} diff --git a/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp b/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp new file mode 100644 index 00000000000..93872854196 --- /dev/null +++ b/cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp @@ -0,0 +1,343 @@ +/****************************************************************************** + * 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 "spine-creator-support/SkeletonAnimation.h" +#include "spine-creator-support/spine-cocos2dx.h" +#include "spine/extension.h" +#include + +USING_NS_CC; +using std::min; +using std::max; +using std::vector; + +namespace spine { + +typedef struct _TrackEntryListeners { + StartListener startListener; + InterruptListener interruptListener; + EndListener endListener; + DisposeListener disposeListener; + CompleteListener completeListener; + EventListener eventListener; +} _TrackEntryListeners; + +void animationCallback (AnimationState* state, EventType type, TrackEntry* entry, Event* event) { + ((SkeletonAnimation*)state->getRendererObject())->onAnimationStateEvent(entry, type, event); +} + +void trackEntryCallback (AnimationState* state, EventType type, TrackEntry* entry, Event* event) { + ((SkeletonAnimation*)state->getRendererObject())->onTrackEntryEvent(entry, type, event); + if (type == EventType_Dispose) + if (entry->getRendererObject()) delete (spine::_TrackEntryListeners*)entry->getRendererObject(); +} + +static _TrackEntryListeners* getListeners (TrackEntry* entry) { + if (!entry->getRendererObject()) { + entry->setRendererObject(new spine::_TrackEntryListeners()); + entry->setListener(trackEntryCallback); + } + return (_TrackEntryListeners*)entry->getRendererObject(); +} + +static float globalTimeScale = 1.0f; +void SkeletonAnimation::setGlobalTimeScale(float timeScale) { + globalTimeScale = timeScale; +} + +SkeletonAnimation* SkeletonAnimation::create() { + SkeletonAnimation* skeleton = new SkeletonAnimation(); + skeleton->autorelease(); + return skeleton; +} + +SkeletonAnimation* SkeletonAnimation::createWithData (SkeletonData* skeletonData, bool ownsSkeletonData) { + SkeletonAnimation* node = new SkeletonAnimation(); + node->initWithData(skeletonData, ownsSkeletonData); + node->autorelease(); + return node; +} + +SkeletonAnimation* SkeletonAnimation::createWithJsonFile (const std::string& skeletonJsonFile, Atlas* atlas, float scale) { + SkeletonAnimation* node = new SkeletonAnimation(); + node->initWithJsonFile(skeletonJsonFile, atlas, scale); + node->autorelease(); + return node; +} + +SkeletonAnimation* SkeletonAnimation::createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale) { + SkeletonAnimation* node = new SkeletonAnimation(); + node->initWithJsonFile(skeletonJsonFile, atlasFile, scale); + node->autorelease(); + return node; +} + +SkeletonAnimation* SkeletonAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, Atlas* atlas, float scale) { + SkeletonAnimation* node = new SkeletonAnimation(); + node->initWithBinaryFile(skeletonBinaryFile, atlas, scale); + node->autorelease(); + return node; +} + +SkeletonAnimation* SkeletonAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale) { + SkeletonAnimation* node = new SkeletonAnimation(); + node->initWithBinaryFile(skeletonBinaryFile, atlasFile, scale); + node->autorelease(); + return node; +} + +void SkeletonAnimation::initialize () { + super::initialize(); + + _ownsAnimationStateData = true; + _state = new (__FILE__, __LINE__) AnimationState(new (__FILE__, __LINE__) AnimationStateData(_skeleton->getData())); + _state->setRendererObject(this); + _state->setListener(animationCallback); +} + +SkeletonAnimation::SkeletonAnimation () +: SkeletonRenderer() { +} + +SkeletonAnimation::~SkeletonAnimation () { + _startListener = nullptr; + _interruptListener = nullptr; + _endListener = nullptr; + _disposeListener = nullptr; + _completeListener = nullptr; + _eventListener = nullptr; + + if (_state) { + clearTracks(); + if (_ownsAnimationStateData) delete _state->getData(); + delete _state; + } +} + +void SkeletonAnimation::update (float deltaTime) { + if (!_skeleton) return; + if (!_paused) { + deltaTime *= _timeScale * globalTimeScale; + if (_ownsSkeleton) _skeleton->update(deltaTime); + _state->update(deltaTime); + _state->apply(*_skeleton); + _skeleton->updateWorldTransform(); + } + super::update(deltaTime); +} + +void SkeletonAnimation::setAnimationStateData (AnimationStateData* stateData) { + CCASSERT(stateData, "stateData cannot be null."); + + if (_state) { + if (_ownsAnimationStateData) delete _state->getData(); + delete _state; + } + + _ownsAnimationStateData = false; + _state = new (__FILE__, __LINE__) AnimationState(stateData); + _state->setRendererObject(this); + _state->setListener(animationCallback); +} + +void SkeletonAnimation::setMix (const std::string& fromAnimation, const std::string& toAnimation, float duration) { + if (_state) { + _state->getData()->setMix(fromAnimation.c_str(), toAnimation.c_str(), duration); + } +} + +TrackEntry* SkeletonAnimation::setAnimation (int trackIndex, const std::string& name, bool loop) { + if (!_skeleton) return 0; + Animation* animation = _skeleton->getData()->findAnimation(name.c_str()); + if (!animation) { + log("Spine: Animation not found: %s", name.c_str()); + return 0; + } + auto trackEntry = _state->setAnimation(trackIndex, animation, loop); + _state->apply(*_skeleton); + return trackEntry; +} + +TrackEntry* SkeletonAnimation::addAnimation (int trackIndex, const std::string& name, bool loop, float delay) { + if (!_skeleton) return 0; + Animation* animation = _skeleton->getData()->findAnimation(name.c_str()); + if (!animation) { + log("Spine: Animation not found: %s", name.c_str()); + return 0; + } + return _state->addAnimation(trackIndex, animation, loop, delay); +} + +TrackEntry* SkeletonAnimation::setEmptyAnimation (int trackIndex, float mixDuration) { + if (_state) { + return _state->setEmptyAnimation(trackIndex, mixDuration); + } + return nullptr; +} + +void SkeletonAnimation::setEmptyAnimations (float mixDuration) { + if (_state) { + _state->setEmptyAnimations(mixDuration); + } +} + +TrackEntry* SkeletonAnimation::addEmptyAnimation (int trackIndex, float mixDuration, float delay) { + if (_state) { + return _state->addEmptyAnimation(trackIndex, mixDuration, delay); + } + return nullptr; +} + +Animation* SkeletonAnimation::findAnimation(const std::string& name) const { + if (_skeleton) { + return _skeleton->getData()->findAnimation(name.c_str()); + } + return nullptr; +} + +TrackEntry* SkeletonAnimation::getCurrent (int trackIndex) { + if (_state) { + return _state->getCurrent(trackIndex); + } + return nullptr; +} + +void SkeletonAnimation::clearTracks () { + if (_state) { + _state->clearTracks(); + } +} + +void SkeletonAnimation::clearTrack (int trackIndex) { + if (_state) { + _state->clearTrack(trackIndex); + } +} + +void SkeletonAnimation::onAnimationStateEvent (TrackEntry* entry, EventType type, Event* event) { + switch (type) { + case EventType_Start: + if (_startListener) _startListener(entry); + break; + case EventType_Interrupt: + if (_interruptListener) _interruptListener(entry); + break; + case EventType_End: + if (_endListener) _endListener(entry); + break; + case EventType_Dispose: + if (_disposeListener) _disposeListener(entry); + break; + case EventType_Complete: + if (_completeListener) _completeListener(entry); + break; + case EventType_Event: + if (_eventListener) _eventListener(entry, event); + break; + } +} + +void SkeletonAnimation::onTrackEntryEvent (TrackEntry* entry, EventType type, Event* event) { + if (!entry->getRendererObject()) return; + _TrackEntryListeners* listeners = (_TrackEntryListeners*)entry->getRendererObject(); + switch (type) { + case EventType_Start: + if (listeners->startListener) listeners->startListener(entry); + break; + case EventType_Interrupt: + if (listeners->interruptListener) listeners->interruptListener(entry); + break; + case EventType_End: + if (listeners->endListener) listeners->endListener(entry); + break; + case EventType_Dispose: + if (listeners->disposeListener) listeners->disposeListener(entry); + break; + case EventType_Complete: + if (listeners->completeListener) listeners->completeListener(entry); + break; + case EventType_Event: + if (listeners->eventListener) listeners->eventListener(entry, event); + break; + } +} + +void SkeletonAnimation::setStartListener (const StartListener& listener) { + _startListener = listener; +} + +void SkeletonAnimation::setInterruptListener (const InterruptListener& listener) { + _interruptListener = listener; +} + +void SkeletonAnimation::setEndListener (const EndListener& listener) { + _endListener = listener; +} + +void SkeletonAnimation::setDisposeListener (const DisposeListener& listener) { + _disposeListener = listener; +} + +void SkeletonAnimation::setCompleteListener (const CompleteListener& listener) { + _completeListener = listener; +} + +void SkeletonAnimation::setEventListener (const EventListener& listener) { + _eventListener = listener; +} + +void SkeletonAnimation::setTrackStartListener (TrackEntry* entry, const StartListener& listener) { + getListeners(entry)->startListener = listener; +} + +void SkeletonAnimation::setTrackInterruptListener (TrackEntry* entry, const InterruptListener& listener) { + getListeners(entry)->interruptListener = listener; +} + +void SkeletonAnimation::setTrackEndListener (TrackEntry* entry, const EndListener& listener) { + getListeners(entry)->endListener = listener; +} + +void SkeletonAnimation::setTrackDisposeListener (TrackEntry* entry, const DisposeListener& listener) { + getListeners(entry)->disposeListener = listener; +} + +void SkeletonAnimation::setTrackCompleteListener (TrackEntry* entry, const CompleteListener& listener) { + getListeners(entry)->completeListener = listener; +} + +void SkeletonAnimation::setTrackEventListener (TrackEntry* entry, const EventListener& listener) { + getListeners(entry)->eventListener = listener; +} + +AnimationState* SkeletonAnimation::getState() const { + return _state; +} + +} diff --git a/cocos/editor-support/spine-creator-support/SkeletonAnimation.h b/cocos/editor-support/spine-creator-support/SkeletonAnimation.h new file mode 100644 index 00000000000..44ce57a2a8c --- /dev/null +++ b/cocos/editor-support/spine-creator-support/SkeletonAnimation.h @@ -0,0 +1,116 @@ +/****************************************************************************** + * 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 "spine-creator-support/SkeletonRenderer.h" + +namespace spine { + +typedef std::function StartListener; +typedef std::function InterruptListener; +typedef std::function EndListener; +typedef std::function DisposeListener; +typedef std::function CompleteListener; +typedef std::function EventListener; + +/** Draws an animated skeleton, providing an AnimationState for applying one or more animations and queuing animations to be + * played later. */ +class SkeletonAnimation: public SkeletonRenderer { +public: + static SkeletonAnimation* create(); + static SkeletonAnimation* createWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false); + static SkeletonAnimation* createWithJsonFile (const std::string& skeletonJsonFile, Atlas* atlas, float scale = 1); + static SkeletonAnimation* createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1); + static SkeletonAnimation* createWithBinaryFile (const std::string& skeletonBinaryFile, Atlas* atlas, float scale = 1); + static SkeletonAnimation* createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale = 1); + static void setGlobalTimeScale(float timeScale); + + // Use createWithJsonFile instead + CC_DEPRECATED_ATTRIBUTE static SkeletonAnimation* createWithFile (const std::string& skeletonJsonFile, Atlas* atlas, float scale = 1) { + return SkeletonAnimation::createWithJsonFile(skeletonJsonFile, atlas, scale); + } + // Use createWithJsonFile instead + CC_DEPRECATED_ATTRIBUTE static SkeletonAnimation* createWithFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1) { + return SkeletonAnimation::createWithJsonFile(skeletonJsonFile, atlasFile, scale); + } + + virtual void update (float deltaTime) override; + + void setAnimationStateData (AnimationStateData* stateData); + void setMix (const std::string& fromAnimation, const std::string& toAnimation, float duration); + + TrackEntry* setAnimation (int trackIndex, const std::string& name, bool loop); + TrackEntry* addAnimation (int trackIndex, const std::string& name, bool loop, float delay = 0); + TrackEntry* setEmptyAnimation (int trackIndex, float mixDuration); + void setEmptyAnimations (float mixDuration); + TrackEntry* addEmptyAnimation (int trackIndex, float mixDuration, float delay = 0); + Animation* findAnimation(const std::string& name) const; + TrackEntry* getCurrent (int trackIndex = 0); + void clearTracks (); + void clearTrack (int trackIndex = 0); + + void setStartListener (const StartListener& listener); + void setInterruptListener (const InterruptListener& listener); + void setEndListener (const EndListener& listener); + void setDisposeListener (const DisposeListener& listener); + void setCompleteListener (const CompleteListener& listener); + void setEventListener (const EventListener& listener); + + void setTrackStartListener (TrackEntry* entry, const StartListener& listener); + void setTrackInterruptListener (TrackEntry* entry, const InterruptListener& listener); + void setTrackEndListener (TrackEntry* entry, const EndListener& listener); + void setTrackDisposeListener (TrackEntry* entry, const DisposeListener& listener); + void setTrackCompleteListener (TrackEntry* entry, const CompleteListener& listener); + void setTrackEventListener (TrackEntry* entry, const EventListener& listener); + + virtual void onAnimationStateEvent (TrackEntry* entry, EventType type, Event* event); + virtual void onTrackEntryEvent (TrackEntry* entry, EventType type, Event* event); + + AnimationState* getState() const; + +CC_CONSTRUCTOR_ACCESS: + SkeletonAnimation (); + virtual ~SkeletonAnimation (); + virtual void initialize () override; + +protected: + AnimationState* _state = nullptr; + bool _ownsAnimationStateData = false; + StartListener _startListener = nullptr; + InterruptListener _interruptListener = nullptr; + EndListener _endListener = nullptr; + DisposeListener _disposeListener = nullptr; + CompleteListener _completeListener = nullptr; + EventListener _eventListener = nullptr; +private: + typedef SkeletonRenderer super; +}; + +} diff --git a/cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp b/cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp index a6e3f4381e0..8a240eaa14d 100644 --- a/cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp +++ b/cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp @@ -1,31 +1,30 @@ /****************************************************************************** - * Spine Runtimes Software License v2.5 + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. + * Copyright (c) 2013-2019, Esoteric Software LLC * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. + * 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 * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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 "SkeletonDataMgr.h" @@ -36,53 +35,45 @@ using namespace spine; class SkeletonDataInfo; static std::map _dataMap; -class SkeletonDataInfo : public cocos2d::Ref{ +class SkeletonDataInfo : public cocos2d::Ref { public: - SkeletonDataInfo (const std::string& uuid) - { + SkeletonDataInfo (const std::string& uuid) { _uuid = uuid; } - ~SkeletonDataInfo () - { - if (data) - { - spSkeletonData_dispose(data); + ~SkeletonDataInfo () { + if (data) { + delete data; data = nullptr; } - if (atlas) - { - spAtlas_dispose(atlas); + if (atlas) { + delete atlas; atlas = nullptr; } - if (attachmentLoader) - { - spAttachmentLoader_dispose(attachmentLoader); + if (attachmentLoader) { + delete attachmentLoader; attachmentLoader = nullptr; } } - spSkeletonData* data = nullptr; - spAtlas* atlas = nullptr; - spAttachmentLoader* attachmentLoader = nullptr; + SkeletonData* data = nullptr; + Atlas* atlas = nullptr; + AttachmentLoader* attachmentLoader = nullptr; std::string _uuid; }; SkeletonDataMgr* SkeletonDataMgr::_instance = nullptr; -bool SkeletonDataMgr::hasSkeletonData (const std::string& uuid) -{ +bool SkeletonDataMgr::hasSkeletonData (const std::string& uuid) { auto it = _dataMap.find(uuid); return it != _dataMap.end(); } -void SkeletonDataMgr::setSkeletonData (const std::string& uuid, spSkeletonData* data, spAtlas* atlas, spAttachmentLoader* attachmentLoader) -{ +void SkeletonDataMgr::setSkeletonData (const std::string& uuid, SkeletonData* data, Atlas* atlas, AttachmentLoader* attachmentLoader) { auto it = _dataMap.find(uuid); - if (it != _dataMap.end()) - { + if (it != _dataMap.end()) { releaseByUUID(uuid); } SkeletonDataInfo* info = new SkeletonDataInfo(uuid); @@ -92,8 +83,7 @@ void SkeletonDataMgr::setSkeletonData (const std::string& uuid, spSkeletonData* _dataMap[uuid] = info; } -spSkeletonData* SkeletonDataMgr::retainByUUID (const std::string& uuid) -{ +SkeletonData* SkeletonDataMgr::retainByUUID (const std::string& uuid) { auto dataIt = _dataMap.find(uuid); if (dataIt == _dataMap.end()) { @@ -103,17 +93,14 @@ spSkeletonData* SkeletonDataMgr::retainByUUID (const std::string& uuid) return dataIt->second->data; } -void SkeletonDataMgr::releaseByUUID (const std::string& uuid) -{ +void SkeletonDataMgr::releaseByUUID (const std::string& uuid) { auto dataIt = _dataMap.find(uuid); - if (dataIt == _dataMap.end()) - { + if (dataIt == _dataMap.end()) { return; } SkeletonDataInfo* info = dataIt->second; // If info reference count is 1, then info will be destroy. - if (info->getReferenceCount() == 1) - { + if (info->getReferenceCount() == 1) { _dataMap.erase(dataIt); } info->release(); diff --git a/cocos/editor-support/spine-creator-support/SkeletonDataMgr.h b/cocos/editor-support/spine-creator-support/SkeletonDataMgr.h index 7998d8a04f3..b14da5d9b7b 100644 --- a/cocos/editor-support/spine-creator-support/SkeletonDataMgr.h +++ b/cocos/editor-support/spine-creator-support/SkeletonDataMgr.h @@ -1,26 +1,31 @@ -/**************************************************************************** - Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - 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. - ****************************************************************************/ +/****************************************************************************** + * 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 @@ -37,19 +42,15 @@ namespace spine { */ class SkeletonDataMgr { public: - static SkeletonDataMgr* getInstance () - { - if (_instance == nullptr) - { + static SkeletonDataMgr* getInstance () { + if (_instance == nullptr) { _instance = new SkeletonDataMgr(); } return _instance; } - static void destroyInstance () - { - if (_instance) - { + static void destroyInstance () { + if (_instance) { delete _instance; _instance = nullptr; } @@ -58,8 +59,8 @@ class SkeletonDataMgr { SkeletonDataMgr () {} virtual ~SkeletonDataMgr () {} bool hasSkeletonData (const std::string& uuid); - void setSkeletonData (const std::string& uuid, spSkeletonData* data, spAtlas* atlas, spAttachmentLoader* attachmentLoader); - spSkeletonData* retainByUUID (const std::string& uuid); + void setSkeletonData (const std::string& uuid, SkeletonData* data, Atlas* atlas, AttachmentLoader* attachmentLoader); + SkeletonData* retainByUUID (const std::string& uuid); void releaseByUUID (const std::string& uuid); private: static SkeletonDataMgr* _instance; diff --git a/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp b/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp new file mode 100644 index 00000000000..18faddeb255 --- /dev/null +++ b/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp @@ -0,0 +1,1032 @@ +/****************************************************************************** + * 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 "spine-creator-support/SkeletonRenderer.h" +#include "spine-creator-support/AttachmentVertices.h" +#include "spine-creator-support/spine-cocos2dx.h" +#include +#include "platform/CCApplication.h" +#include "base/CCScheduler.h" +#include "MiddlewareMacro.h" +#include "MeshBuffer.h" +#include "SkeletonDataMgr.h" +#include "RenderInfoMgr.h" + +USING_NS_CC; +USING_NS_MW; + +using std::min; +using std::max; +using namespace spine; + +static Cocos2dTextureLoader textureLoader; + +enum DebugType { + None = 0, + Slots, + Mesh, + Bones +}; + +SkeletonRenderer* SkeletonRenderer::create () { + SkeletonRenderer* skeleton = new SkeletonRenderer(); + skeleton->autorelease(); + return skeleton; +} + +SkeletonRenderer* SkeletonRenderer::createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) { + SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData); + node->autorelease(); + return node; +} + +SkeletonRenderer* SkeletonRenderer::createWithData (SkeletonData* skeletonData, bool ownsSkeletonData) { + SkeletonRenderer* node = new SkeletonRenderer(skeletonData, ownsSkeletonData); + node->autorelease(); + return node; +} + +SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) { + SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlas, scale); + node->autorelease(); + return node; +} + +SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) { + SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlasFile, scale); + node->autorelease(); + return node; +} + +void SkeletonRenderer::initialize () { + if (_clipper == nullptr) { + _clipper = new (__FILE__, __LINE__) SkeletonClipping(); + } + + if (_renderInfoOffset == nullptr) { + // store global TypedArray begin and end offset + _renderInfoOffset = new IOTypedArray(se::Object::TypedArrayType::UINT32, sizeof(uint32_t)); + } + + _skeleton->setToSetupPose(); + _skeleton->updateWorldTransform(); + beginSchedule(); +} + +void SkeletonRenderer::beginSchedule() { + MiddlewareManager::getInstance()->addTimer(this); +} + +void SkeletonRenderer::onEnable() { + beginSchedule(); +} + +void SkeletonRenderer::onDisable() { + stopSchedule(); +} + +void SkeletonRenderer::stopSchedule() { + MiddlewareManager::getInstance()->removeTimer(this); + if (_renderInfoOffset) { + _renderInfoOffset->reset(); + _renderInfoOffset->clear(); + } + + if (_debugBuffer) { + _debugBuffer->reset(); + _debugBuffer->clear(); + } +} + +void SkeletonRenderer::setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData) { + _skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData); + _ownsSkeletonData = ownsSkeletonData; +} + +SkeletonRenderer::SkeletonRenderer () { +} + +SkeletonRenderer::SkeletonRenderer(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData, bool ownsAtlas) { + initWithSkeleton(skeleton, ownsSkeleton, ownsSkeletonData, ownsAtlas); +} + +SkeletonRenderer::SkeletonRenderer (SkeletonData *skeletonData, bool ownsSkeletonData) { + initWithData(skeletonData, ownsSkeletonData); +} + +SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, Atlas* atlas, float scale) { + initWithJsonFile(skeletonDataFile, atlas, scale); +} + +SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) { + initWithJsonFile(skeletonDataFile, atlasFile, scale); +} + +SkeletonRenderer::~SkeletonRenderer () { + CC_SAFE_RELEASE(_effectDelegate); + + if (_ownsSkeletonData) delete _skeleton->getData(); + if (_ownsSkeleton) delete _skeleton; + if (_ownsAtlas && _atlas) delete _atlas; + if (_attachmentLoader) delete _attachmentLoader; + if (_uuid != "") SkeletonDataMgr::getInstance()->releaseByUUID(_uuid); + if (_clipper) delete _clipper; + + if (_renderInfoOffset) { + delete _renderInfoOffset; + _renderInfoOffset = nullptr; + } + + if (_debugBuffer) { + delete _debugBuffer; + _debugBuffer = nullptr; + } + + stopSchedule(); +} + +void SkeletonRenderer::initWithUUID(const std::string& uuid) { + _ownsSkeleton = true; + _uuid = uuid; + SkeletonData* skeletonData = SkeletonDataMgr::getInstance()->retainByUUID(uuid); + CCASSERT(skeletonData, "Skeleton data is is null"); + + setSkeletonData(skeletonData, false); + initialize(); +} + +void SkeletonRenderer::initWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData, bool ownsAtlas) { + _skeleton = skeleton; + _ownsSkeleton = ownsSkeleton; + _ownsSkeletonData = ownsSkeletonData; + _ownsAtlas = ownsAtlas; + + initialize(); +} + +void SkeletonRenderer::initWithData (SkeletonData* skeletonData, bool ownsSkeletonData) { + _ownsSkeleton = true; + setSkeletonData(skeletonData, ownsSkeletonData); + initialize(); +} + +void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) { + _atlas = atlas; + _attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas); + + SkeletonJson* json = new (__FILE__, __LINE__) SkeletonJson(_attachmentLoader); + json->setScale(scale); + SkeletonData* skeletonData = json->readSkeletonDataFile(skeletonDataFile.c_str()); + CCASSERT(skeletonData, !json->getError().isEmpty() ? json->getError().buffer() : "Error reading skeleton data."); + delete json; + + _ownsSkeleton = true; + setSkeletonData(skeletonData, true); + + initialize(); +} + +void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) { + _atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader); + CCASSERT(_atlas, "Error reading atlas file."); + + _attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas); + + SkeletonJson* json = new (__FILE__, __LINE__) SkeletonJson(_attachmentLoader); + json->setScale(scale); + SkeletonData* skeletonData = json->readSkeletonDataFile(skeletonDataFile.c_str()); + CCASSERT(skeletonData, !json->getError().isEmpty() ? json->getError().buffer() : "Error reading skeleton data."); + delete json; + + _ownsSkeleton = true; + _ownsAtlas = true; + setSkeletonData(skeletonData, true); + + initialize(); +} + +void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) { + _atlas = atlas; + _attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas); + + SkeletonBinary* binary = new (__FILE__, __LINE__) SkeletonBinary(_attachmentLoader); + binary->setScale(scale); + SkeletonData* skeletonData = binary->readSkeletonDataFile(skeletonDataFile.c_str()); + CCASSERT(skeletonData, !binary->getError().isEmpty() ? binary->getError().buffer() : "Error reading skeleton data."); + delete binary; + _ownsSkeleton = true; + setSkeletonData(skeletonData, true); + + initialize(); +} + +void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) { + _atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader); + CCASSERT(_atlas, "Error reading atlas file."); + + _attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas); + + SkeletonBinary* binary = new (__FILE__, __LINE__) SkeletonBinary(_attachmentLoader); + binary->setScale(scale); + SkeletonData* skeletonData = binary->readSkeletonDataFile(skeletonDataFile.c_str()); + CCASSERT(skeletonData, !binary->getError().isEmpty() ? binary->getError().buffer() : "Error reading skeleton data."); + delete binary; + _ownsSkeleton = true; + _ownsAtlas = true; + setSkeletonData(skeletonData, true); + + initialize(); +} + +void SkeletonRenderer::update (float deltaTime) { + if (!_skeleton) return; + + _renderInfoOffset->reset(); + _renderInfoOffset->clear(); + // avoid other place call update. + auto mgr = MiddlewareManager::getInstance(); + if (!mgr->isUpdating) return; + + auto renderMgr = RenderInfoMgr::getInstance(); + auto renderInfo = renderMgr->getBuffer(); + if (!renderInfo) return; + + // store renderInfo offset + _renderInfoOffset->writeUint32((uint32_t)renderInfo->getCurPos() / sizeof(uint32_t)); + + // check enough space + renderInfo->checkSpace(sizeof(uint32_t) * 2, true); + // write border + renderInfo->writeUint32(0xffffffff); + + std::size_t materialLenOffset = renderInfo->getCurPos(); + //reserved space to save material len + renderInfo->writeUint32(0); + + // If opacity is 0,then return. + if (_skeleton->getColor().a == 0) { + { + return; + } + + Color4F color; + Color4F darkColor; + AttachmentVertices* attachmentVertices = nullptr; + bool inRange = _startSlotIndex != -1 || _endSlotIndex != -1 ? false : true; + auto vertexFormat = _useTint? VF_XYUVCC : VF_XYUVC; + MeshBuffer* mb = mgr->getMeshBuffer(vertexFormat); + middleware::IOBuffer& vb = mb->getVB(); + middleware::IOBuffer& ib = mb->getIB(); + + // vertex size in floats with one color + int vs1 = sizeof(V2F_T2F_C4B) / sizeof(float); + // verex size in floats with two color + int vs2 = sizeof(V2F_T2F_C4B_C4B) / sizeof(float); + + int vbSize = 0; + int ibSize = 0; + + int preTextureIndex = -1; + int preBlendMode = -1; + int curBlendSrc = -1; + int curBlendDst = -1; + int curTextureIndex = -1; + + int preISegWritePos = -1; + int curISegLen = 0; + + int materialLen = 0; + Slot* slot = nullptr; + int isFull = 0; + + if (_debugSlots || _debugBones || _debugMesh) { + // If enable debug draw,then init debug buffer. + if (_debugBuffer == nullptr) { + _debugBuffer = new IOTypedArray(se::Object::TypedArrayType::FLOAT32, MAX_DEBUG_BUFFER_SIZE); + } + _debugBuffer->reset(); + } + + // check enough space + renderInfo->checkSpace(sizeof(uint32_t), true); + std::size_t materialLenOffset = renderInfo->getCurPos(); + //reserved space to save material len + renderInfo->writeUint32(0); + + auto flush = [&]() { + // fill pre segment count field + if (preISegWritePos != -1) { + renderInfo->writeUint32(preISegWritePos, curISegLen); + } + + // prepare to fill new segment field + switch (slot->getData().getBlendMode()) { + case BlendMode_Additive: + curBlendSrc = _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; + curBlendDst = GL_ONE; + break; + case BlendMode_Multiply: + curBlendSrc = GL_DST_COLOR; + curBlendDst = GL_ONE_MINUS_SRC_ALPHA; + break; + case BlendMode_Screen: + curBlendSrc = GL_ONE; + curBlendDst = GL_ONE_MINUS_SRC_COLOR; + break; + default: + curBlendSrc = _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; + curBlendDst = GL_ONE_MINUS_SRC_ALPHA; + } + + // check enough space + renderInfo->checkSpace(sizeof(uint32_t) * 7, true); + + // fill new texture index + renderInfo->writeUint32(curTextureIndex); + // fill new blend src and dst + renderInfo->writeUint32(curBlendSrc); + renderInfo->writeUint32(curBlendDst); + // fill new index and vertex buffer id + auto glIB = mb->getGLIB(); + auto glVB = mb->getGLVB(); + renderInfo->writeUint32(glIB); + renderInfo->writeUint32(glVB); + // fill new index offset + renderInfo->writeUint32((uint32_t)ib.getCurPos() / sizeof(unsigned short)); + + // save new segment count pos field + preISegWritePos = (int)renderInfo->getCurPos(); + // reserve indice segamentation count + renderInfo->writeUint32(0); + + // 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; + // material length increased + materialLen++; + }; + + VertexEffect* effect = nullptr; + if (_effectDelegate) { + effect = _effectDelegate->getVertexEffect(); + } + + if (effect) { + effect->begin(*_skeleton); + } + + auto& drawOrder = _skeleton->getDrawOrder(); + for (size_t i = 0, n = drawOrder.size(); i < n; ++i) { + isFull = 0; + slot = drawOrder[i]; + if (_startSlotIndex >= 0 && _startSlotIndex == slot->getData().getIndex()) { + inRange = true; + } + + if (!inRange) { + _clipper->clipEnd(*slot); + continue; + } + + if (_endSlotIndex >= 0 && _endSlotIndex == slot->getData().getIndex()) { + inRange = false; + } + + if (!slot->getAttachment()) { + _clipper->clipEnd(*slot); + continue; + } + + // Early exit if slot is invisible + if (slot->getColor().a == 0) { + _clipper->clipEnd(*slot); + continue; + } + + if (!slot->getAttachment()) { + continue; + } + + Triangles triangles; + 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; + } + + if (!_useTint) { + triangles.vertCount = attachmentVertices->_triangles->vertCount; + vbSize = triangles.vertCount * sizeof(V2F_T2F_C4B); + isFull |= vb.checkSpace(vbSize, true); + triangles.verts = (V2F_T2F_C4B*)vb.getCurBuffer(); + memcpy(triangles.verts, attachmentVertices->_triangles->verts, vbSize); + attachment->computeWorldVertices(slot->getBone(), (float*)triangles.verts, 0, vs1); + + triangles.indexCount = attachmentVertices->_triangles->indexCount; + ibSize = triangles.indexCount * sizeof(unsigned short); + ib.checkSpace(ibSize, true); + triangles.indices = (unsigned short*)ib.getCurBuffer(); + memcpy(triangles.indices, attachmentVertices->_triangles->indices, ibSize); + } else { + trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount; + vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); + isFull |= 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; + + if(_debugSlots) { + _debugBuffer->writeFloat32(DebugType::Slots); + _debugBuffer->writeFloat32(8); + float* vertices = _useTint ? (float*)trianglesTwoColor.verts : (float*)triangles.verts; + int stride = _useTint ? vs2 : vs1; + // Quadrangle has 4 vertex. + for (int ii = 0; ii < 4; ii ++) { + _debugBuffer->writeFloat32(vertices[0]); + _debugBuffer->writeFloat32(vertices[1]); + vertices += stride; + } + } + } 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; + } + + if (!_useTint) { + triangles.vertCount = attachmentVertices->_triangles->vertCount; + vbSize = triangles.vertCount * sizeof(V2F_T2F_C4B); + isFull |= vb.checkSpace(vbSize, true); + triangles.verts = (V2F_T2F_C4B*)vb.getCurBuffer(); + memcpy(triangles.verts, attachmentVertices->_triangles->verts, vbSize); + attachment->computeWorldVertices(*slot, 0, attachment->getWorldVerticesLength(), (float*)triangles.verts, 0, vs1); + + triangles.indexCount = attachmentVertices->_triangles->indexCount; + ibSize = triangles.indexCount * sizeof(unsigned short); + ib.checkSpace(ibSize, true); + triangles.indices = (unsigned short*)ib.getCurBuffer(); + memcpy(triangles.indices, attachmentVertices->_triangles->indices, ibSize); + } else { + trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount; + vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); + isFull |= 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; + + if(_debugMesh) { + int indexCount = _useTint ? trianglesTwoColor.indexCount : triangles.indexCount; + unsigned short* indices = _useTint ? (unsigned short*)trianglesTwoColor.indices : (unsigned short*)triangles.indices; + float* vertices = _useTint ? (float*)trianglesTwoColor.verts : (float*)triangles.verts; + + int stride = _useTint ? vs2 : vs1; + _debugBuffer->writeFloat32(DebugType::Mesh); + _debugBuffer->writeFloat32(indexCount * 2); + for (int ii = 0; ii < indexCount; ii += 3) { + int v1 = indices[ii] * stride; + int v2 = indices[ii + 1] * stride; + int v3 = indices[ii + 2] * stride; + _debugBuffer->writeFloat32(vertices[v1]); + _debugBuffer->writeFloat32(vertices[v1 + 1]); + _debugBuffer->writeFloat32(vertices[v2]); + _debugBuffer->writeFloat32(vertices[v2 + 1]); + _debugBuffer->writeFloat32(vertices[v3]); + _debugBuffer->writeFloat32(vertices[v3 + 1]); + } + } + + } 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 * _nodeColor.a * 255; + // skip rendering if the color of this attachment is 0 + if (color.a == 0) { + _clipper->clipEnd(*slot); + continue; + } + + float multiplier = _premultipliedAlpha ? color.a : 255; + float red = _nodeColor.r * _skeleton->getColor().r * color.r * multiplier; + float green = _nodeColor.g * _skeleton->getColor().g * color.g * multiplier; + float blue = _nodeColor.b * _skeleton->getColor().b * color.b * multiplier; + + 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 = _premultipliedAlpha ? 255 : 0; + + // One color tint logic + if (!_useTint) { + // Cliping logic + if (_clipper->isClipping()) { + _clipper->clipTriangles((float*)&triangles.verts[0].vertex, triangles.indices, triangles.indexCount, (float*)&triangles.verts[0].texCoord, vs1); + + if (_clipper->getClippedTriangles().size() == 0) { + _clipper->clipEnd(*slot); + continue; + } + + triangles.vertCount = (int)_clipper->getClippedVertices().size() >> 1; + vbSize = triangles.vertCount * sizeof(V2F_T2F_C4B); + isFull |= vb.checkSpace(vbSize, true); + triangles.verts = (V2F_T2F_C4B*)vb.getCurBuffer(); + + triangles.indexCount = (int)_clipper->getClippedTriangles().size(); + ibSize = triangles.indexCount * sizeof(unsigned short); + ib.checkSpace(ibSize, true); + triangles.indices = (unsigned short*)ib.getCurBuffer(); + memcpy(triangles.indices, _clipper->getClippedTriangles().buffer(), sizeof(unsigned short) * _clipper->getClippedTriangles().size()); + + float* verts = _clipper->getClippedVertices().buffer(); + float* uvs = _clipper->getClippedUVs().buffer(); + if (effect) { + Color light; + Color dark; + light.r = color.r / 255.0f; + light.g = color.g / 255.0f; + light.b = color.b / 255.0f; + light.a = color.a / 255.0f; + dark.r = dark.g = dark.b = dark.a = 0; + for (int v = 0, vn = triangles.vertCount, vv = 0; v < vn; ++v, vv+=2) { + V2F_T2F_C4B* vertex = triangles.verts + v; + Color lightCopy = light; + Color darkCopy = dark; + vertex->vertex.x = verts[vv]; + vertex->vertex.y = verts[vv + 1]; + vertex->texCoord.u = uvs[vv]; + vertex->texCoord.v = uvs[vv + 1]; + effect->transform(vertex->vertex.x, vertex->vertex.y, vertex->texCoord.u, vertex->texCoord.v, lightCopy, darkCopy); + vertex->color.r = (GLubyte)(lightCopy.r * 255); + vertex->color.g = (GLubyte)(lightCopy.g * 255); + vertex->color.b = (GLubyte)(lightCopy.b * 255); + vertex->color.a = (GLubyte)(lightCopy.a * 255); + } + } else { + for (int v = 0, vn = triangles.vertCount, vv = 0; v < vn; ++v, vv+=2) { + V2F_T2F_C4B* vertex = triangles.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; + } + } + // No cliping logic + } else { + if (effect) { + Color light; + Color dark; + light.r = color.r / 255.0f; + light.g = color.g / 255.0f; + light.b = color.b / 255.0f; + light.a = color.a / 255.0f; + dark.r = dark.g = dark.b = dark.a = 0; + for (int v = 0, vn = triangles.vertCount; v < vn; ++v) { + V2F_T2F_C4B* vertex = triangles.verts + v; + Color lightCopy = light; + Color darkCopy = dark; + effect->transform(vertex->vertex.x, vertex->vertex.y, vertex->texCoord.u, vertex->texCoord.v, lightCopy, darkCopy); + vertex->color.r = (GLubyte)(lightCopy.r * 255); + vertex->color.g = (GLubyte)(lightCopy.g * 255); + vertex->color.b = (GLubyte)(lightCopy.b * 255); + vertex->color.a = (GLubyte)(lightCopy.a * 255); + } + } else { + for (int v = 0, vn = triangles.vertCount; v < vn; ++v) { + V2F_T2F_C4B* vertex = triangles.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; + } + } + } + } + // Two color tint logic + else { + 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); + isFull |= 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(); + + if (effect) { + Color light; + Color dark; + light.r = color.r / 255.0f; + light.g = color.g / 255.0f; + light.b = color.b / 255.0f; + light.a = color.a / 255.0f; + dark.r = darkColor.r / 255.0f; + dark.g = darkColor.g / 255.0f; + dark.b = darkColor.b / 255.0f; + dark.a = darkColor.a / 255.0f; + for (int v = 0, vn = trianglesTwoColor.vertCount, vv = 0; v < vn; ++v, vv += 2) { + V2F_T2F_C4B_C4B* vertex = trianglesTwoColor.verts + v; + Color lightCopy = light; + Color darkCopy = dark; + vertex->vertex.x = verts[vv]; + vertex->vertex.y = verts[vv + 1]; + vertex->texCoord.u = uvs[vv]; + vertex->texCoord.v = uvs[vv + 1]; + effect->transform(vertex->vertex.x, vertex->vertex.y, vertex->texCoord.u, vertex->texCoord.v, lightCopy, darkCopy); + vertex->color.r = (GLubyte)(lightCopy.r * 255); + vertex->color.g = (GLubyte)(lightCopy.g * 255); + vertex->color.b = (GLubyte)(lightCopy.b * 255); + vertex->color.a = (GLubyte)(lightCopy.a * 255); + vertex->color2.r = (GLubyte)(darkCopy.r * 255); + vertex->color2.g = (GLubyte)(darkCopy.g * 255); + vertex->color2.b = (GLubyte)(darkCopy.b * 255); + vertex->color2.a = (GLubyte)darkColor.a; + } + } else { + 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 { + if (effect) { + Color light; + Color dark; + light.r = color.r / 255.0f; + light.g = color.g / 255.0f; + light.b = color.b / 255.0f; + light.a = color.a / 255.0f; + dark.r = darkColor.r / 255.0f; + dark.g = darkColor.g / 255.0f; + dark.b = darkColor.b / 255.0f; + dark.a = darkColor.a / 255.0f; + + for (int v = 0, vn = trianglesTwoColor.vertCount; v < vn; ++v) { + V2F_T2F_C4B_C4B* vertex = trianglesTwoColor.verts + v; + Color lightCopy = light; + Color darkCopy = dark; + effect->transform(vertex->vertex.x, vertex->vertex.y, vertex->texCoord.u, vertex->texCoord.v, lightCopy, darkCopy); + vertex->color.r = (GLubyte)(lightCopy.r * 255); + vertex->color.g = (GLubyte)(lightCopy.g * 255); + vertex->color.b = (GLubyte)(lightCopy.b * 255); + vertex->color.a = (GLubyte)(lightCopy.a * 255); + vertex->color2.r = (GLubyte)(darkCopy.r * 255); + vertex->color2.g = (GLubyte)(darkCopy.g * 255); + vertex->color2.b = (GLubyte)(darkCopy.b * 255); + 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; + } + } + } + } + + curTextureIndex = attachmentVertices->_texture->getRealTextureIndex(); + // If texture or blendMode change,will change material. + if (preTextureIndex != curTextureIndex || preBlendMode != slot->getData().getBlendMode() || isFull) { + flush(); + } + + if (vbSize > 0 && ibSize > 0) { + auto vertexOffset = vb.getCurPos() / sizeof(middleware::V2F_T2F_C4B); + if (_useTint) { + vertexOffset = vb.getCurPos() / sizeof(middleware::V2F_T2F_C4B_C4B); + } + + 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); + } + + _clipper->clipEnd(*slot); + } // End slot traverse + + _clipper->clipEnd(); + + if (effect) effect->end(); + + renderInfo->writeUint32(materialLenOffset, materialLen); + if (preISegWritePos != -1) { + renderInfo->writeUint32(preISegWritePos, curISegLen); + } + + if (_debugBones) { + auto& bones = _skeleton->getBones(); + size_t bonesCount = bones.size(); + _debugBuffer->writeFloat32(DebugType::Bones); + _debugBuffer->writeFloat32(bonesCount * 4); + for (size_t i = 0, n = bonesCount; i < n; i++) { + Bone *bone = bones[i]; + float x = bone->getData().getLength() * bone->getA() + bone->getWorldX(); + float y = bone->getData().getLength() * bone->getC() + bone->getWorldY(); + _debugBuffer->writeFloat32(bone->getWorldX()); + _debugBuffer->writeFloat32(bone->getWorldY()); + _debugBuffer->writeFloat32(x); + _debugBuffer->writeFloat32(y); + } + } + + // debug end + if (_debugBuffer) { + if (_debugBuffer->isOutRange()) { + _debugBuffer->reset(); + cocos2d::log("Spine debug data is too large, debug buffer has no space to put in it!!!!!!!!!!"); + cocos2d::log("You can adjust MAX_DEBUG_BUFFER_SIZE macro"); + } + _debugBuffer->writeFloat32(DebugType::None); + } +} + +cocos2d::Rect SkeletonRenderer::getBoundingBox () const { + static IOBuffer buffer(1024); + float* worldVertices = nullptr; + float minX = FLT_MAX, minY = FLT_MAX, maxX = -FLT_MAX, maxY = -FLT_MAX; + for (int i = 0; i < _skeleton->getSlots().size(); ++i) { + Slot* slot = _skeleton->getSlots()[i]; + if (!slot->getAttachment()) continue; + int verticesCount; + if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) { + RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment(); + buffer.checkSpace(8 * sizeof(float)); + worldVertices = (float*)buffer.getCurBuffer(); + attachment->computeWorldVertices(slot->getBone(), worldVertices, 0, 2); + verticesCount = 8; + } else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) { + MeshAttachment* mesh = (MeshAttachment*)slot->getAttachment(); + buffer.checkSpace(mesh->getWorldVerticesLength() * sizeof(float)); + worldVertices = (float*)buffer.getCurBuffer(); + mesh->computeWorldVertices(*slot, 0, mesh->getWorldVerticesLength(), worldVertices, 0, 2); + verticesCount = (int)mesh->getWorldVerticesLength(); + } else + continue; + for (int ii = 0; ii < verticesCount; ii += 2) { + float x = worldVertices[ii], y = worldVertices[ii + 1]; + minX = min(minX, x); + minY = min(minY, y); + maxX = max(maxX, x); + maxY = max(maxY, y); + } + } + if (minX == FLT_MAX) minX = minY = maxX = maxY = 0; + return cocos2d::Rect(minX, minY, maxX - minX, maxY - minY); +} + +void SkeletonRenderer::updateWorldTransform () { + if (_skeleton) { + _skeleton->updateWorldTransform(); + } +} + +void SkeletonRenderer::setToSetupPose () { + if (_skeleton) { + _skeleton->setToSetupPose(); + } +} + +void SkeletonRenderer::setBonesToSetupPose () { + if (_skeleton) { + _skeleton->setBonesToSetupPose(); + } +} + +void SkeletonRenderer::setSlotsToSetupPose () { + if (_skeleton) { + _skeleton->setSlotsToSetupPose(); + } +} + +Bone* SkeletonRenderer::findBone (const std::string& boneName) const { + if (_skeleton) { + return _skeleton->findBone(boneName.c_str()); + } + return nullptr; +} + +Slot* SkeletonRenderer::findSlot (const std::string& slotName) const { + if (_skeleton) { + return _skeleton->findSlot(slotName.c_str()); + } + return nullptr; +} + +void SkeletonRenderer::setSkin (const std::string& skinName) { + if (_skeleton) { + _skeleton->setSkin(skinName.empty() ? 0 : skinName.c_str()); + } +} + +void SkeletonRenderer::setSkin (const char* skinName) { + if (_skeleton) { + _skeleton->setSkin(skinName); + } +} + +Attachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const { + if (_skeleton) { + return _skeleton->getAttachment(slotName.c_str(), attachmentName.c_str()); + } + return nullptr; +} + +bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) { + if (_skeleton) { + return _skeleton->getAttachment(slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false; + } + return false; +} + +bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* attachmentName) { + if (_skeleton) { + return _skeleton->getAttachment(slotName.c_str(), attachmentName) ? true : false; + } + return false; +} + +void SkeletonRenderer::setUseTint(bool enabled) { + _useTint = enabled; +} + +void SkeletonRenderer::setVertexEffectDelegate(VertexEffectDelegate *effectDelegate) { + if (_effectDelegate == effectDelegate) { + return; + } + CC_SAFE_RELEASE(_effectDelegate); + _effectDelegate = effectDelegate; + CC_SAFE_RETAIN(_effectDelegate); +} + +void SkeletonRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) { + this->_startSlotIndex = startSlotIndex; + this->_endSlotIndex = endSlotIndex; +} + +Skeleton* SkeletonRenderer::getSkeleton () const { + return _skeleton; +} + +void SkeletonRenderer::setTimeScale (float scale) { + _timeScale = scale; +} + +float SkeletonRenderer::getTimeScale () const { + return _timeScale; +} + +void SkeletonRenderer::paused(bool value) { + _paused = value; +} + +void SkeletonRenderer::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 SkeletonRenderer::setDebugBonesEnabled (bool enabled) { + _debugBones = enabled; +} + +void SkeletonRenderer::setDebugSlotsEnabled (bool enabled) { + _debugSlots = enabled; +} + +void SkeletonRenderer::setDebugMeshEnabled (bool enabled) { + _debugMesh = enabled; +} + +void SkeletonRenderer::setOpacityModifyRGB (bool value) { + _premultipliedAlpha = value; +} + +bool SkeletonRenderer::isOpacityModifyRGB () const { + return _premultipliedAlpha; +} diff --git a/cocos/editor-support/spine-creator-support/SkeletonRenderer.h b/cocos/editor-support/spine-creator-support/SkeletonRenderer.h new file mode 100644 index 00000000000..cf4b6ba705e --- /dev/null +++ b/cocos/editor-support/spine-creator-support/SkeletonRenderer.h @@ -0,0 +1,181 @@ +/****************************************************************************** + * 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 "base/ccTypes.h" +#include +#include "scripting/js-bindings/jswrapper/Object.hpp" +#include "IOTypedArray.h" +#include "MiddlewareManager.h" +#include "spine-creator-support/VertexEffectDelegate.h" + +namespace spine { + + class AttachmentVertices; + + /** Draws a skeleton. + */ + class SkeletonRenderer: public cocos2d::middleware::IMiddleware, public cocos2d::Ref { + public: + static SkeletonRenderer* create (); + static SkeletonRenderer* createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false); + static SkeletonRenderer* createWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false); + static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1); + static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); + + virtual void update (float deltaTime); + virtual cocos2d::Rect getBoundingBox () const; + + Skeleton* getSkeleton() const; + + void setTimeScale (float scale); + float getTimeScale () const; + + void updateWorldTransform (); + + void setToSetupPose (); + void setBonesToSetupPose (); + void setSlotsToSetupPose (); + void paused (bool value); + + /* Returns 0 if the bone was not found. */ + Bone* findBone (const std::string& boneName) const; + /* Returns 0 if the slot was not found. */ + Slot* findSlot (const std::string& slotName) const; + + /* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are + * attached if the corresponding attachment from the old skin was attached. + * @param skin May be empty string ("") for no skin.*/ + void setSkin (const std::string& skinName); + /** @param skin May be 0 for no skin.*/ + void setSkin (const char* skinName); + + /* Returns 0 if the slot or attachment was not found. */ + Attachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const; + /* Returns false if the slot or attachment was not found. + * @param attachmentName May be empty string ("") for no attachment. */ + bool setAttachment (const std::string& slotName, const std::string& attachmentName); + /* @param attachmentName May be 0 for no attachment. */ + bool setAttachment (const std::string& slotName, const char* attachmentName); + + /* Enables/disables two color tinting for this instance. May break batching */ + void setUseTint(bool enabled); + + /* Sets the vertex effect to be used, set to 0 to disable vertex effects */ + void setVertexEffectDelegate(VertexEffectDelegate* effectDelegate); + /* Sets the range of slots that should be rendered. Use -1, -1 to clear the range */ + void setSlotsRange(int startSlotIndex, int endSlotIndex); + + /** + * @return debug data,it's a Float32Array, + * format |debug bones length|[beginX|beginY|toX|toY|...loop...] + */ + se_object_ptr getDebugData() const { + if (_debugBuffer) { + return _debugBuffer->getTypeArray(); + } + return nullptr; + } + + /** + * @return render info offset,it's a Uint32Array, + * format |render info offset| + */ + se_object_ptr getRenderInfoOffset() const { + if (_renderInfoOffset) { + return _renderInfoOffset->getTypeArray(); + } + return nullptr; + } + + void setColor (cocos2d::Color4B& color); + void setDebugBonesEnabled (bool enabled); + void setDebugSlotsEnabled (bool enabled); + void setDebugMeshEnabled (bool enabled); + + void setOpacityModifyRGB (bool value); + bool isOpacityModifyRGB () const; + + void beginSchedule(); + void stopSchedule(); + void onEnable(); + void onDisable(); + + CC_CONSTRUCTOR_ACCESS: + SkeletonRenderer (); + SkeletonRenderer(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false); + SkeletonRenderer (SkeletonData* skeletonData, bool ownsSkeletonData = false); + SkeletonRenderer (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1); + SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); + + virtual ~SkeletonRenderer (); + + void initWithUUID(const std::string& uuid); + void initWithSkeleton(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false); + void initWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false); + void initWithJsonFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1); + void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); + void initWithBinaryFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1); + void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); + + virtual void initialize (); + + protected: + void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData); + + bool _ownsSkeletonData = false; + bool _ownsSkeleton = false; + bool _ownsAtlas = false; + Atlas* _atlas = nullptr; + AttachmentLoader* _attachmentLoader = nullptr; + Skeleton* _skeleton = nullptr; + VertexEffectDelegate* _effectDelegate = nullptr; + float _timeScale = 1; + bool _paused = false; + + bool _debugMesh = false; + bool _debugSlots = false; + bool _debugBones = false; + cocos2d::Color4F _nodeColor = cocos2d::Color4F::WHITE; + bool _premultipliedAlpha = false; + SkeletonClipping* _clipper = nullptr; + bool _useTint = false; + std::string _uuid = ""; + + int _startSlotIndex = -1; + int _endSlotIndex = -1; + + cocos2d::middleware::IOTypedArray* _renderInfoOffset = nullptr; + cocos2d::middleware::IOTypedArray* _debugBuffer = nullptr; + }; + +} diff --git a/cocos/editor-support/spine-creator-support/SpineAnimation.cpp b/cocos/editor-support/spine-creator-support/SpineAnimation.cpp deleted file mode 100644 index 2ca2481e302..00000000000 --- a/cocos/editor-support/spine-creator-support/SpineAnimation.cpp +++ /dev/null @@ -1,421 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include "spine-creator-support/SpineAnimation.h" -#include "spine-creator-support/spine-cocos2dx.h" -#include "spine/extension.h" -#include - -USING_NS_CC; -using std::min; -using std::max; -using std::vector; - -namespace spine { - -typedef struct _TrackEntryListeners -{ - StartListener startListener; - InterruptListener interruptListener; - EndListener endListener; - DisposeListener disposeListener; - CompleteListener completeListener; - EventListener eventListener; -} _TrackEntryListeners; - -void animationCallback (spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event) -{ - ((SpineAnimation*)state->rendererObject)->onAnimationStateEvent(entry, type, event); -} - -void trackEntryCallback (spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event) -{ - ((SpineAnimation*)state->rendererObject)->onTrackEntryEvent(entry, type, event); - if (type == SP_ANIMATION_DISPOSE) - if (entry->rendererObject) delete (spine::_TrackEntryListeners*)entry->rendererObject; -} - -static _TrackEntryListeners* getListeners (spTrackEntry* entry) -{ - if (!entry->rendererObject) { - entry->rendererObject = new spine::_TrackEntryListeners(); - entry->listener = trackEntryCallback; - } - return (_TrackEntryListeners*)entry->rendererObject; -} - -static float globalTimeScale = 1.0f; -void SpineAnimation::setGlobalTimeScale(float timeScale) -{ - globalTimeScale = timeScale; -} - -SpineAnimation* SpineAnimation::create() -{ - SpineAnimation* skeleton = new SpineAnimation(); - skeleton->autorelease(); - return skeleton; -} - -SpineAnimation* SpineAnimation::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) -{ - SpineAnimation* node = new SpineAnimation(); - node->initWithData(skeletonData, ownsSkeletonData); - node->autorelease(); - return node; -} - -SpineAnimation* SpineAnimation::createWithJsonFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale) -{ - SpineAnimation* node = new SpineAnimation(); - node->initWithJsonFile(skeletonJsonFile, atlas, scale); - node->autorelease(); - return node; -} - -SpineAnimation* SpineAnimation::createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale) -{ - SpineAnimation* node = new SpineAnimation(); - spAtlas* atlas = spAtlas_createFromFile(atlasFile.c_str(), 0); - node->initWithJsonFile(skeletonJsonFile, atlas, scale); - node->autorelease(); - return node; -} - -SpineAnimation* SpineAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, spAtlas* atlas, float scale) -{ - SpineAnimation* node = new SpineAnimation(); - node->initWithBinaryFile(skeletonBinaryFile, atlas, scale); - node->autorelease(); - return node; -} - -SpineAnimation* SpineAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale) -{ - SpineAnimation* node = new SpineAnimation(); - spAtlas* atlas = spAtlas_createFromFile(atlasFile.c_str(), 0); - node->initWithBinaryFile(skeletonBinaryFile, atlas, scale); - node->autorelease(); - return node; -} - -void SpineAnimation::initialize () -{ - super::initialize(); - - _ownsAnimationStateData = true; - _state = spAnimationState_create(spAnimationStateData_create(_skeleton->data)); - _state->rendererObject = this; - _state->listener = animationCallback; -} - -SpineAnimation::SpineAnimation () -: SpineRenderer() -{ -} - -SpineAnimation::SpineAnimation (spSkeletonData *skeletonData, bool ownsSkeletonData) -: SpineRenderer(skeletonData, ownsSkeletonData) -{ - initialize(); -} - -SpineAnimation::SpineAnimation (const std::string& skeletonDataFile, spAtlas* atlas, float scale) -: SpineRenderer(skeletonDataFile, atlas, scale) -{ - initialize(); -} - -SpineAnimation::SpineAnimation (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) -: SpineRenderer(skeletonDataFile, atlasFile, scale) -{ - initialize(); -} - -SpineAnimation::~SpineAnimation () -{ - _startListener = nullptr; - _interruptListener = nullptr; - _endListener = nullptr; - _disposeListener = nullptr; - _completeListener = nullptr; - _eventListener = nullptr; - - if (_state) - { - clearTracks(); - if (_ownsAnimationStateData) spAnimationStateData_dispose(_state->data); - spAnimationState_dispose(_state); - } -} - -void SpineAnimation::update (float deltaTime) -{ - if (!_skeleton) return; - - if (!_paused) - { - deltaTime *= _timeScale * globalTimeScale; - spSkeleton_update(_skeleton, deltaTime); - spAnimationState_update(_state, deltaTime); - spAnimationState_apply(_state, _skeleton); - spSkeleton_updateWorldTransform(_skeleton); - } - - super::update(deltaTime); -} - -void SpineAnimation::setAnimationStateData (spAnimationStateData* stateData) -{ - CCASSERT(stateData, "stateData cannot be null."); - - if (_state) - { - if (_ownsAnimationStateData) spAnimationStateData_dispose(_state->data); - spAnimationState_dispose(_state); - } - - _ownsAnimationStateData = false; - _state = spAnimationState_create(stateData); - _state->rendererObject = this; - _state->listener = animationCallback; -} - -void SpineAnimation::setMix (const std::string& fromAnimation, const std::string& toAnimation, float duration) -{ - if (_state) { - spAnimationStateData_setMixByName(_state->data, fromAnimation.c_str(), toAnimation.c_str(), duration); - } -} - -spTrackEntry* SpineAnimation::setAnimation (int trackIndex, const std::string& name, bool loop) -{ - if (!_skeleton) return 0; - spAnimation* animation = spSkeletonData_findAnimation(_skeleton->data, name.c_str()); - if (!animation) { - log("Spine: Animation not found: %s", name.c_str()); - return 0; - } - return spAnimationState_setAnimation(_state, trackIndex, animation, loop); -} - -spTrackEntry* SpineAnimation::addAnimation (int trackIndex, const std::string& name, bool loop, float delay) -{ - if (!_skeleton) return 0; - spAnimation* animation = spSkeletonData_findAnimation(_skeleton->data, name.c_str()); - if (!animation) - { - log("Spine: Animation not found: %s", name.c_str()); - return 0; - } - return spAnimationState_addAnimation(_state, trackIndex, animation, loop, delay); -} - -spTrackEntry* SpineAnimation::setEmptyAnimation (int trackIndex, float mixDuration) -{ - if (_state) - { - return spAnimationState_setEmptyAnimation(_state, trackIndex, mixDuration); - } - return nullptr; -} - -void SpineAnimation::setEmptyAnimations (float mixDuration) -{ - if (_state) - { - spAnimationState_setEmptyAnimations(_state, mixDuration); - } -} - -spTrackEntry* SpineAnimation::addEmptyAnimation (int trackIndex, float mixDuration, float delay) -{ - if (_state) - { - return spAnimationState_addEmptyAnimation(_state, trackIndex, mixDuration, delay); - } - return nullptr; -} - -spAnimation* SpineAnimation::findAnimation(const std::string& name) const -{ - if (_skeleton) - { - return spSkeletonData_findAnimation(_skeleton->data, name.c_str()); - } - else - { - return nullptr; - } -} - -spTrackEntry* SpineAnimation::getCurrent (int trackIndex) -{ - if (_state) - { - return spAnimationState_getCurrent(_state, trackIndex); - } - return nullptr; -} - -void SpineAnimation::clearTracks () -{ - if (_state) - { - spAnimationState_clearTracks(_state); - } -} - -void SpineAnimation::clearTrack (int trackIndex) -{ - if (_state) - { - spAnimationState_clearTrack(_state, trackIndex); - } -} - -void SpineAnimation::onAnimationStateEvent (spTrackEntry* entry, spEventType type, spEvent* event) -{ - switch (type) - { - case SP_ANIMATION_START: - if (_startListener) _startListener(entry); - break; - case SP_ANIMATION_INTERRUPT: - if (_interruptListener) _interruptListener(entry); - break; - case SP_ANIMATION_END: - if (_endListener) _endListener(entry); - break; - case SP_ANIMATION_DISPOSE: - if (_disposeListener) _disposeListener(entry); - break; - case SP_ANIMATION_COMPLETE: - if (_completeListener) _completeListener(entry); - break; - case SP_ANIMATION_EVENT: - if (_eventListener) _eventListener(entry, event); - break; - } -} - -void SpineAnimation::onTrackEntryEvent (spTrackEntry* entry, spEventType type, spEvent* event) -{ - if (!entry->rendererObject) return; - _TrackEntryListeners* listeners = (_TrackEntryListeners*)entry->rendererObject; - switch (type) - { - case SP_ANIMATION_START: - if (listeners->startListener) listeners->startListener(entry); - break; - case SP_ANIMATION_INTERRUPT: - if (listeners->interruptListener) listeners->interruptListener(entry); - break; - case SP_ANIMATION_END: - if (listeners->endListener) listeners->endListener(entry); - break; - case SP_ANIMATION_DISPOSE: - if (listeners->disposeListener) listeners->disposeListener(entry); - break; - case SP_ANIMATION_COMPLETE: - if (listeners->completeListener) listeners->completeListener(entry); - break; - case SP_ANIMATION_EVENT: - if (listeners->eventListener) listeners->eventListener(entry, event); - break; - } -} - -void SpineAnimation::setStartListener (const StartListener& listener) -{ - _startListener = listener; -} - -void SpineAnimation::setInterruptListener (const InterruptListener& listener) -{ - _interruptListener = listener; -} - -void SpineAnimation::setEndListener (const EndListener& listener) -{ - _endListener = listener; -} - -void SpineAnimation::setDisposeListener (const DisposeListener& listener) -{ - _disposeListener = listener; -} - -void SpineAnimation::setCompleteListener (const CompleteListener& listener) -{ - _completeListener = listener; -} - -void SpineAnimation::setEventListener (const EventListener& listener) -{ - _eventListener = listener; -} - -void SpineAnimation::setTrackStartListener (spTrackEntry* entry, const StartListener& listener) -{ - getListeners(entry)->startListener = listener; -} - -void SpineAnimation::setTrackInterruptListener (spTrackEntry* entry, const InterruptListener& listener) -{ - getListeners(entry)->interruptListener = listener; -} - -void SpineAnimation::setTrackEndListener (spTrackEntry* entry, const EndListener& listener) -{ - getListeners(entry)->endListener = listener; -} - -void SpineAnimation::setTrackDisposeListener (spTrackEntry* entry, const DisposeListener& listener) -{ - getListeners(entry)->disposeListener = listener; -} - -void SpineAnimation::setTrackCompleteListener (spTrackEntry* entry, const CompleteListener& listener) -{ - getListeners(entry)->completeListener = listener; -} - -void SpineAnimation::setTrackEventListener (spTrackEntry* entry, const EventListener& listener) -{ - getListeners(entry)->eventListener = listener; -} - -spAnimationState* SpineAnimation::getState() const -{ - return _state; -} - -} diff --git a/cocos/editor-support/spine-creator-support/SpineAnimation.h b/cocos/editor-support/spine-creator-support/SpineAnimation.h deleted file mode 100644 index 4d44d2660d1..00000000000 --- a/cocos/editor-support/spine-creator-support/SpineAnimation.h +++ /dev/null @@ -1,123 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#pragma once -#include "spine/spine.h" -#include "spine-creator-support/SpineRenderer.h" - -namespace spine { - -typedef std::function StartListener; -typedef std::function InterruptListener; -typedef std::function EndListener; -typedef std::function DisposeListener; -typedef std::function CompleteListener; -typedef std::function EventListener; - -/** Draws an animated skeleton, providing an AnimationState for applying one or - * more animations and queuing animations to be played later. - */ -class SpineAnimation: public SpineRenderer -{ -public: - static SpineAnimation* create(); - static SpineAnimation* createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false); - static SpineAnimation* createWithJsonFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale = 1); - static SpineAnimation* createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1); - static SpineAnimation* createWithBinaryFile (const std::string& skeletonBinaryFile, spAtlas* atlas, float scale = 1); - static SpineAnimation* createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale = 1); - static void setGlobalTimeScale(float timeScale); - - // Use createWithJsonFile instead - CC_DEPRECATED_ATTRIBUTE static SpineAnimation* createWithFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale = 1) - { - return SpineAnimation::createWithJsonFile(skeletonJsonFile, atlas, scale); - } - // Use createWithJsonFile instead - CC_DEPRECATED_ATTRIBUTE static SpineAnimation* createWithile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1) - { - return SpineAnimation::createWithJsonFile(skeletonJsonFile, atlasFile, scale); - } - - virtual void update (float deltaTime) override; - - void setAnimationStateData (spAnimationStateData* stateData); - void setMix (const std::string& fromAnimation, const std::string& toAnimation, float duration); - - spTrackEntry* setAnimation (int trackIndex, const std::string& name, bool loop); - spTrackEntry* addAnimation (int trackIndex, const std::string& name, bool loop, float delay = 0); - spTrackEntry* setEmptyAnimation (int trackIndex, float mixDuration); - void setEmptyAnimations (float mixDuration); - spTrackEntry* addEmptyAnimation (int trackIndex, float mixDuration, float delay = 0); - spAnimation* findAnimation(const std::string& name) const; - spTrackEntry* getCurrent (int trackIndex = 0); - void clearTracks (); - void clearTrack (int trackIndex = 0); - - void setStartListener (const StartListener& listener); - void setInterruptListener (const InterruptListener& listener); - void setEndListener (const EndListener& listener); - void setDisposeListener (const DisposeListener& listener); - void setCompleteListener (const CompleteListener& listener); - void setEventListener (const EventListener& listener); - - void setTrackStartListener (spTrackEntry* entry, const StartListener& listener); - void setTrackInterruptListener (spTrackEntry* entry, const InterruptListener& listener); - void setTrackEndListener (spTrackEntry* entry, const EndListener& listener); - void setTrackDisposeListener (spTrackEntry* entry, const DisposeListener& listener); - void setTrackCompleteListener (spTrackEntry* entry, const CompleteListener& listener); - void setTrackEventListener (spTrackEntry* entry, const EventListener& listener); - - virtual void onAnimationStateEvent (spTrackEntry* entry, spEventType type, spEvent* event); - virtual void onTrackEntryEvent (spTrackEntry* entry, spEventType type, spEvent* event); - - spAnimationState* getState() const; - -CC_CONSTRUCTOR_ACCESS: - SpineAnimation (); - SpineAnimation (spSkeletonData* skeletonData, bool ownsSkeletonData = false); - SpineAnimation (const std::string&skeletonDataFile, spAtlas* atlas, float scale = 1); - SpineAnimation (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); - virtual ~SpineAnimation (); - virtual void initialize () override; - -protected: - spAnimationState* _state = nullptr; - bool _ownsAnimationStateData = false; - StartListener _startListener = nullptr; - InterruptListener _interruptListener = nullptr; - EndListener _endListener = nullptr; - DisposeListener _disposeListener = nullptr; - CompleteListener _completeListener = nullptr; - EventListener _eventListener = nullptr; -private: - typedef SpineRenderer super; -}; - -} diff --git a/cocos/editor-support/spine-creator-support/SpineRenderer.cpp b/cocos/editor-support/spine-creator-support/SpineRenderer.cpp deleted file mode 100644 index da78d350171..00000000000 --- a/cocos/editor-support/spine-creator-support/SpineRenderer.cpp +++ /dev/null @@ -1,964 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include "spine-creator-support/SpineRenderer.h" -#include "spine/extension.h" -#include "spine-creator-support/AttachmentVertices.h" -#include "spine-creator-support/CreatorAttachmentLoader.h" -#include -#include "platform/CCApplication.h" -#include "base/CCScheduler.h" -#include "MiddlewareMacro.h" -#include "MeshBuffer.h" -#include "SkeletonDataMgr.h" -#include "RenderInfoMgr.h" - -USING_NS_CC; -USING_NS_MW; - -using std::min; -using std::max; -using namespace spine; - -SpineRenderer* SpineRenderer::create () -{ - SpineRenderer* skeleton = new SpineRenderer(); - skeleton->autorelease(); - return skeleton; -} - -SpineRenderer* SpineRenderer::createWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) -{ - SpineRenderer* node = new SpineRenderer(skeleton, ownsSkeleton, ownsSkeletonData); - node->autorelease(); - return node; -} - -SpineRenderer* SpineRenderer::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) -{ - SpineRenderer* node = new SpineRenderer(skeletonData, ownsSkeletonData); - node->autorelease(); - return node; -} - -SpineRenderer* SpineRenderer::createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) -{ - SpineRenderer* node = new SpineRenderer(skeletonDataFile, atlas, scale); - node->autorelease(); - return node; -} - -SpineRenderer* SpineRenderer::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) -{ - SpineRenderer* node = new SpineRenderer(skeletonDataFile, atlasFile, scale); - node->autorelease(); - return node; -} - -void SpineRenderer::initialize () -{ - if (_clipper == nullptr) - { - _clipper = spSkeletonClipping_create(); - } - - if (_renderInfoOffset == nullptr) - { - // store global TypedArray begin and end offset - _renderInfoOffset = new IOTypedArray(se::Object::TypedArrayType::UINT32, sizeof(uint32_t)); - } - - beginSchedule(); -} - -void SpineRenderer::beginSchedule() -{ - MiddlewareManager::getInstance()->addTimer(this); -} - -void SpineRenderer::onEnable() -{ - beginSchedule(); -} - -void SpineRenderer::onDisable() -{ - stopSchedule(); -} - -void SpineRenderer::stopSchedule() -{ - MiddlewareManager::getInstance()->removeTimer(this); - if (_renderInfoOffset) - { - _renderInfoOffset->reset(); - _renderInfoOffset->clear(); - } - - if (_debugBuffer) - { - _debugBuffer->reset(); - _debugBuffer->clear(); - } -} - -void SpineRenderer::setSkeletonData (spSkeletonData *skeletonData, bool ownsSkeletonData) -{ - _skeleton = spSkeleton_create(skeletonData); - _ownsSkeletonData = ownsSkeletonData; -} - -SpineRenderer::SpineRenderer () -{ -} - -SpineRenderer::SpineRenderer(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) -{ - initWithSkeleton(skeleton, ownsSkeleton, ownsSkeletonData); -} - -SpineRenderer::SpineRenderer (spSkeletonData *skeletonData, bool ownsSkeletonData) -{ - initWithData(skeletonData, ownsSkeletonData); -} - -SpineRenderer::SpineRenderer (const std::string& skeletonDataFile, spAtlas* atlas, float scale) -{ - initWithJsonFile(skeletonDataFile, atlas, scale); -} - -SpineRenderer::SpineRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) -{ - initWithJsonFile(skeletonDataFile, atlasFile, scale); -} - -SpineRenderer::~SpineRenderer () -{ - if (_ownsSkeletonData) spSkeletonData_dispose(_skeleton->data); - if (_ownsSkeleton) spSkeleton_dispose(_skeleton); - if (_atlas) spAtlas_dispose(_atlas); - if (_attachmentLoader) spAttachmentLoader_dispose(_attachmentLoader); - if (_uuid != "") SkeletonDataMgr::getInstance()->releaseByUUID(_uuid); - if (_clipper) spSkeletonClipping_dispose(_clipper); - - if (_renderInfoOffset) - { - delete _renderInfoOffset; - _renderInfoOffset = nullptr; - } - - if (_debugBuffer) - { - delete _debugBuffer; - _debugBuffer = nullptr; - } - - stopSchedule(); -} - -void SpineRenderer::initWithUUID(const std::string& uuid) -{ - _ownsSkeleton = true; - _uuid = uuid; - spSkeletonData* skeletonData = SkeletonDataMgr::getInstance()->retainByUUID(uuid); - CCASSERT(skeletonData, "Skeleton data is is null"); - - setSkeletonData(skeletonData, false); - initialize(); -} - -void SpineRenderer::initWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) -{ - _skeleton = skeleton; - _ownsSkeleton = ownsSkeleton; - _ownsSkeletonData = ownsSkeletonData; - - initialize(); -} - -void SpineRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) -{ - _ownsSkeleton = true; - setSkeletonData(skeletonData, ownsSkeletonData); - initialize(); -} - -void SpineRenderer::initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) -{ - _atlas = atlas; - _attachmentLoader = SUPER(CreatorAttachmentLoader_create(_atlas)); - - spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader); - json->scale = scale; - spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonDataFile.c_str()); - CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data."); - spSkeletonJson_dispose(json); - _ownsSkeleton = true; - setSkeletonData(skeletonData, true); - initialize(); -} - -void SpineRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) -{ - _atlas = spAtlas_createFromFile(atlasFile.c_str(), 0); - CCASSERT(_atlas, "Error reading atlas file."); - - _attachmentLoader = SUPER(CreatorAttachmentLoader_create(_atlas)); - - spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader); - json->scale = scale; - spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonDataFile.c_str()); - CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data file."); - spSkeletonJson_dispose(json); - _ownsSkeleton = true; - setSkeletonData(skeletonData, true); - initialize(); -} - -void SpineRenderer::initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) -{ - _atlas = atlas; - _attachmentLoader = SUPER(CreatorAttachmentLoader_create(_atlas)); - - spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader); - binary->scale = scale; - spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str()); - CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file."); - spSkeletonBinary_dispose(binary); - _ownsSkeleton = true; - setSkeletonData(skeletonData, true); - initialize(); -} - -void SpineRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) -{ - _atlas = spAtlas_createFromFile(atlasFile.c_str(), 0); - CCASSERT(_atlas, "Error reading atlas file."); - - _attachmentLoader = SUPER(CreatorAttachmentLoader_create(_atlas)); - - spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader); - binary->scale = scale; - spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str()); - CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file."); - spSkeletonBinary_dispose(binary); - _ownsSkeleton = true; - setSkeletonData(skeletonData, true); - initialize(); -} - -void SpineRenderer::update (float deltaTime) -{ - if (!_skeleton) return; - - _renderInfoOffset->reset(); - _renderInfoOffset->clear(); - - // avoid other place call update. - auto mgr = MiddlewareManager::getInstance(); - if (!mgr->isUpdating) return; - - auto renderMgr = RenderInfoMgr::getInstance(); - auto renderInfo = renderMgr->getBuffer(); - if (!renderInfo) return; - - // store renderInfo offset - _renderInfoOffset->writeUint32((uint32_t)renderInfo->getCurPos() / sizeof(uint32_t)); - - // check enough space - renderInfo->checkSpace(sizeof(uint32_t) * 2, true); - // write border - renderInfo->writeUint32(0xffffffff); - - std::size_t materialLenOffset = renderInfo->getCurPos(); - //reserved space to save material len - renderInfo->writeUint32(0); - - // If opacity is 0,then return. - if (_skeleton->color.a == 0) - { - return; - } - - Color4F color; - Color4F darkColor; - AttachmentVertices* attachmentVertices = nullptr; - bool inRange = _startSlotIndex != -1 || _endSlotIndex != -1 ? false : true; - auto vertexFormat = _useTint? VF_XYUVCC : VF_XYUVC; - MeshBuffer* mb = mgr->getMeshBuffer(vertexFormat); - middleware::IOBuffer& vb = mb->getVB(); - middleware::IOBuffer& ib = mb->getIB(); - - // vertex size in floats with one color - int vs1 = sizeof(V2F_T2F_C4B) / sizeof(float); - // verex size in floats with two color - int vs2 = sizeof(V2F_T2F_C4B_C4B) / sizeof(float); - - int vbSize = 0; - int ibSize = 0; - - int preTextureIndex = -1; - int preBlendMode = -1; - int curBlendSrc = -1; - int curBlendDst = -1; - int curTextureIndex = -1; - - int preISegWritePos = -1; - int curISegLen = 0; - - int debugSlotsLen = 0; - int materialLen = 0; - spSlot* slot = nullptr; - int isFull = 0; - - if (_debugSlots || _debugBones) - { - // If enable debug draw,then init debug buffer. - if (_debugBuffer == nullptr) - { - _debugBuffer = new IOTypedArray(se::Object::TypedArrayType::FLOAT32, MAX_DEBUG_BUFFER_SIZE); - } - _debugBuffer->reset(); - - if (_debugSlots) - { - //reserved 4 bytes to save debug slots len - _debugBuffer->writeUint32(0); - } - } - - auto flush = [&]() - { - // fill pre segment count field - if (preISegWritePos != -1) - { - renderInfo->writeUint32(preISegWritePos, curISegLen); - } - - // prepare to fill new segment field - switch (slot->data->blendMode) - { - case SP_BLEND_MODE_ADDITIVE: - curBlendSrc = _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; - curBlendDst = GL_ONE; - break; - case SP_BLEND_MODE_MULTIPLY: - curBlendSrc = GL_DST_COLOR; - curBlendDst = GL_ONE_MINUS_SRC_ALPHA; - break; - case SP_BLEND_MODE_SCREEN: - curBlendSrc = GL_ONE; - curBlendDst = GL_ONE_MINUS_SRC_COLOR; - break; - default: - curBlendSrc = _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; - curBlendDst = GL_ONE_MINUS_SRC_ALPHA; - } - - // check enough space - renderInfo->checkSpace(sizeof(uint32_t) * 7, true); - - // fill new texture index - renderInfo->writeUint32(curTextureIndex); - // fill new blend src and dst - renderInfo->writeUint32(curBlendSrc); - renderInfo->writeUint32(curBlendDst); - // fill new index and vertex buffer id - auto glIB = mb->getGLIB(); - auto glVB = mb->getGLVB(); - renderInfo->writeUint32(glIB); - renderInfo->writeUint32(glVB); - // fill new index offset - renderInfo->writeUint32((uint32_t)ib.getCurPos() / sizeof(unsigned short)); - - // save new segment count pos field - preISegWritePos = (int)renderInfo->getCurPos(); - // reserve indice segamentation count - renderInfo->writeUint32(0); - - // reset pre blend mode to current - preBlendMode = (int)slot->data->blendMode; - // reset pre texture index to current - preTextureIndex = curTextureIndex; - // reset index segmentation count - curISegLen = 0; - // material length increased - materialLen++; - }; - - for (int i = 0, n = _skeleton->slotsCount; i < n; ++i) - { - isFull = 0; - slot = _skeleton->drawOrder[i]; - if (_startSlotIndex >= 0 && _startSlotIndex == slot->data->index) - { - inRange = true; - } - - if (!inRange) { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - if (_endSlotIndex >= 0 && _endSlotIndex == slot->data->index) - { - inRange = false; - } - - if (!slot->attachment) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - // Early exit if slot is invisible - if (slot->color.a == 0) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - if (!slot->attachment) - { - continue; - } - - Triangles triangles; - TwoColorTriangles trianglesTwoColor; - - switch (slot->attachment->type) - { - case SP_ATTACHMENT_REGION: - { - spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; - attachmentVertices = getAttachmentVertices(attachment); - - // Early exit if attachment is invisible - if (attachment->color.a == 0) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - if (!_useTint) - { - triangles.vertCount = attachmentVertices->_triangles->vertCount; - vbSize = triangles.vertCount * sizeof(V2F_T2F_C4B); - isFull |= vb.checkSpace(vbSize, true); - triangles.verts = (V2F_T2F_C4B*)vb.getCurBuffer(); - memcpy(triangles.verts, attachmentVertices->_triangles->verts, vbSize); - spRegionAttachment_computeWorldVertices(attachment, slot->bone, (float*)triangles.verts, 0, vs1); - - triangles.indexCount = attachmentVertices->_triangles->indexCount; - ibSize = triangles.indexCount * sizeof(unsigned short); - ib.checkSpace(ibSize, true); - triangles.indices = (unsigned short*)ib.getCurBuffer(); - memcpy(triangles.indices, attachmentVertices->_triangles->indices, ibSize); - } - else - { - trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount; - vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); - isFull |= 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; - } - spRegionAttachment_computeWorldVertices(attachment, slot->bone, (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->color.r; - color.g = attachment->color.g; - color.b = attachment->color.b; - color.a = attachment->color.a; - - if(_debugSlots) - { - float* vertices = _useTint ? (float*)trianglesTwoColor.verts : (float*)triangles.verts; - int stride = _useTint ? vs2 : vs1; - // Quadrangle has 4 vertex. - for (int ii = 0; ii < 4; ii ++) - { - _debugBuffer->writeFloat32(vertices[0]); - _debugBuffer->writeFloat32(vertices[1]); - vertices += stride; - } - debugSlotsLen+=8; - } - - break; - } - case SP_ATTACHMENT_MESH: - { - spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment; - attachmentVertices = getAttachmentVertices(attachment); - - // Early exit if attachment is invisible - if (attachment->color.a == 0) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - if (!_useTint) - { - triangles.vertCount = attachmentVertices->_triangles->vertCount; - vbSize = triangles.vertCount * sizeof(V2F_T2F_C4B); - isFull |= vb.checkSpace(vbSize, true); - triangles.verts = (V2F_T2F_C4B*)vb.getCurBuffer(); - memcpy(triangles.verts, attachmentVertices->_triangles->verts, vbSize); - spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->super.worldVerticesLength, (float*)triangles.verts, 0, vs1); - - triangles.indexCount = attachmentVertices->_triangles->indexCount; - ibSize = triangles.indexCount * sizeof(unsigned short); - ib.checkSpace(ibSize, true); - triangles.indices = (unsigned short*)ib.getCurBuffer(); - memcpy(triangles.indices, attachmentVertices->_triangles->indices, ibSize); - } - else - { - trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount; - vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); - isFull |= 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; - } - spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->super.worldVerticesLength, (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->color.r; - color.g = attachment->color.g; - color.b = attachment->color.b; - color.a = attachment->color.a; - break; - } - case SP_ATTACHMENT_CLIPPING: - { - spClippingAttachment* clip = (spClippingAttachment*)slot->attachment; - spSkeletonClipping_clipStart(_clipper, slot, clip); - continue; - } - default: - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - color.a = _skeleton->color.a * slot->color.a * color.a * _nodeColor.a * 255; - // skip rendering if the color of this attachment is 0 - if (color.a == 0) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - float multiplier = _premultipliedAlpha ? color.a : 255; - - float red = _nodeColor.r * _skeleton->color.r * color.r * multiplier; - float green = _nodeColor.g * _skeleton->color.g * color.g * multiplier; - float blue = _nodeColor.b * _skeleton->color.b * color.b * multiplier; - - color.r = red * slot->color.r; - color.g = green * slot->color.g; - color.b = blue * slot->color.b; - - if (slot->darkColor) - { - darkColor.r = red * slot->darkColor->r; - darkColor.g = green * slot->darkColor->g; - darkColor.b = blue * slot->darkColor->b; - } - else - { - darkColor.r = 0; - darkColor.g = 0; - darkColor.b = 0; - } - darkColor.a = _premultipliedAlpha ? 255 : 0; - - // One color tint logic - if (!_useTint) - { - // Cliping logic - if (spSkeletonClipping_isClipping(_clipper)) - { - spSkeletonClipping_clipTriangles(_clipper, (float*)&triangles.verts[0].vertex, triangles.vertCount * vs1, triangles.indices, triangles.indexCount, (float*)&triangles.verts[0].texCoord, vs1); - - if (_clipper->clippedTriangles->size == 0) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - triangles.vertCount = _clipper->clippedVertices->size >> 1; - vbSize = triangles.vertCount * sizeof(V2F_T2F_C4B); - isFull |= vb.checkSpace(vbSize, true); - triangles.verts = (V2F_T2F_C4B*)vb.getCurBuffer(); - - triangles.indexCount = _clipper->clippedTriangles->size; - ibSize = triangles.indexCount * sizeof(unsigned short); - ib.checkSpace(ibSize, true); - triangles.indices = (unsigned short*)ib.getCurBuffer(); - memcpy(triangles.indices, _clipper->clippedTriangles->items, sizeof(unsigned short) * _clipper->clippedTriangles->size); - - float* verts = _clipper->clippedVertices->items; - float* uvs = _clipper->clippedUVs->items; - for (int v = 0, vn = triangles.vertCount, vv = 0; v < vn; ++v, vv+=2) - { - V2F_T2F_C4B* vertex = triangles.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; - } - // No cliping logic - } - else - { - for (int v = 0, vn = triangles.vertCount; v < vn; ++v) - { - V2F_T2F_C4B* vertex = triangles.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; - } - } - } - // Two color tint logic - else - { - if (spSkeletonClipping_isClipping(_clipper)) - { - spSkeletonClipping_clipTriangles(_clipper, (float*)&trianglesTwoColor.verts[0].vertex, trianglesTwoColor.vertCount * vs2, trianglesTwoColor.indices, trianglesTwoColor.indexCount, (float*)&trianglesTwoColor.verts[0].texCoord, vs2); - - if (_clipper->clippedTriangles->size == 0) - { - spSkeletonClipping_clipEnd(_clipper, slot); - continue; - } - - trianglesTwoColor.vertCount = _clipper->clippedVertices->size >> 1; - vbSize = trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4B_C4B); - isFull |= vb.checkSpace(vbSize, true); - trianglesTwoColor.verts = (V2F_T2F_C4B_C4B*)vb.getCurBuffer(); - - trianglesTwoColor.indexCount = _clipper->clippedTriangles->size; - ibSize = trianglesTwoColor.indexCount * sizeof(unsigned short); - trianglesTwoColor.indices = (unsigned short*)ib.getCurBuffer(); - memcpy(trianglesTwoColor.indices, _clipper->clippedTriangles->items, sizeof(unsigned short) * _clipper->clippedTriangles->size); - - float* verts = _clipper->clippedVertices->items; - float* uvs = _clipper->clippedUVs->items; - - 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; - } - } - } - - curTextureIndex = attachmentVertices->_texture->getRealTextureIndex(); - // If texture or blendMode change,will change material. - if (preTextureIndex != curTextureIndex || preBlendMode != slot->data->blendMode || isFull) - { - flush(); - } - - if (vbSize > 0 && ibSize > 0) - { - auto vertexOffset = vb.getCurPos() / sizeof(middleware::V2F_T2F_C4B); - if (_useTint) - { - vertexOffset = vb.getCurPos() / sizeof(middleware::V2F_T2F_C4B_C4B); - } - - 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); - } - - spSkeletonClipping_clipEnd(_clipper, slot); - } // End slot traverse - - spSkeletonClipping_clipEnd2(_clipper); - - if (_debugSlots) - { - _debugBuffer->writeFloat32(0, debugSlotsLen); - } - - renderInfo->writeUint32(materialLenOffset, materialLen); - if (preISegWritePos != -1) - { - renderInfo->writeUint32(preISegWritePos, curISegLen); - } - - if (_debugBones) - { - _debugBuffer->writeFloat32(_skeleton->bonesCount*4); - for (int i = 0, n = _skeleton->bonesCount; i < n; i++) - { - spBone *bone = _skeleton->bones[i]; - float x = bone->data->length * bone->a + bone->worldX; - float y = bone->data->length * bone->c + bone->worldY; - _debugBuffer->writeFloat32(bone->worldX); - _debugBuffer->writeFloat32(bone->worldY); - _debugBuffer->writeFloat32(x); - _debugBuffer->writeFloat32(y); - } - } - - if ((_debugSlots || _debugBones) && _debugBuffer->isOutRange()) - { - _debugBuffer->writeFloat32(0, 0); - _debugBuffer->writeFloat32(sizeof(float), 0); - cocos2d::log("Spine debug data is too large,debug buffer has no space to put in it!!!!!!!!!!"); - cocos2d::log("You can adjust MAX_DEBUG_BUFFER_SIZE in Macro"); - } -} - -AttachmentVertices* SpineRenderer::getAttachmentVertices (spRegionAttachment* attachment) const -{ - return (AttachmentVertices*)attachment->rendererObject; -} - -AttachmentVertices* SpineRenderer::getAttachmentVertices (spMeshAttachment* attachment) const -{ - return (AttachmentVertices*)attachment->rendererObject; -} - -void SpineRenderer::updateWorldTransform () -{ - if (_skeleton) - { - spSkeleton_updateWorldTransform(_skeleton); - } -} - -void SpineRenderer::setToSetupPose () -{ - if (_skeleton) - { - spSkeleton_setToSetupPose(_skeleton); - } -} - -void SpineRenderer::setBonesToSetupPose () -{ - if (_skeleton) - { - spSkeleton_setBonesToSetupPose(_skeleton); - } -} - -void SpineRenderer::setSlotsToSetupPose () -{ - if (_skeleton) - { - spSkeleton_setSlotsToSetupPose(_skeleton); - } -} - -spBone* SpineRenderer::findBone (const std::string& boneName) const -{ - if (_skeleton) - { - return spSkeleton_findBone(_skeleton, boneName.c_str()); - } - return nullptr; -} - -spSlot* SpineRenderer::findSlot (const std::string& slotName) const -{ - if (_skeleton) - { - return spSkeleton_findSlot(_skeleton, slotName.c_str()); - } - return nullptr; -} - -bool SpineRenderer::setSkin (const std::string& skinName) -{ - if (_skeleton) - { - return spSkeleton_setSkinByName(_skeleton, skinName.empty() ? 0 : skinName.c_str()) ? true : false; - } - return false; -} - -bool SpineRenderer::setSkin (const char* skinName) -{ - if (_skeleton) - { - return spSkeleton_setSkinByName(_skeleton, skinName) ? true : false; - } - return nullptr; -} - -spAttachment* SpineRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const -{ - if (_skeleton) - { - return spSkeleton_getAttachmentForSlotName(_skeleton, slotName.c_str(), attachmentName.c_str()); - } - return nullptr; -} - -void SpineRenderer::setUseTint(bool enabled) { - _useTint = enabled; -} - -void SpineRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) -{ - this->_startSlotIndex = startSlotIndex; - this->_endSlotIndex = endSlotIndex; -} - -bool SpineRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) -{ - if (_skeleton) - { - return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false; - } - return false; -} - -bool SpineRenderer::setAttachment (const std::string& slotName, const char* attachmentName) -{ - if (_skeleton) - { - return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName) ? true : false; - } - return false; -} - -spSkeleton* SpineRenderer::getSkeleton () const -{ - return _skeleton; -} - -void SpineRenderer::setTimeScale (float scale) -{ - _timeScale = scale; -} - -float SpineRenderer::getTimeScale () const -{ - return _timeScale; -} - -void SpineRenderer::paused(bool value) -{ - _paused = value; -} - -void SpineRenderer::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 SpineRenderer::setDebugBonesEnabled (bool enabled) -{ - _debugBones = enabled; -} - -void SpineRenderer::setDebugSlotsEnabled (bool enabled) -{ - _debugSlots = enabled; -} - -void SpineRenderer::setOpacityModifyRGB (bool value) -{ - _premultipliedAlpha = value; -} - -bool SpineRenderer::isOpacityModifyRGB () const -{ - return _premultipliedAlpha; -} diff --git a/cocos/editor-support/spine-creator-support/SpineRenderer.h b/cocos/editor-support/spine-creator-support/SpineRenderer.h deleted file mode 100644 index 0e77525acc4..00000000000 --- a/cocos/editor-support/spine-creator-support/SpineRenderer.h +++ /dev/null @@ -1,181 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#pragma once - -#include "spine/spine.h" -#include "base/CCRef.h" -#include "base/ccTypes.h" -#include -#include "scripting/js-bindings/jswrapper/Object.hpp" -#include "IOTypedArray.h" -#include "MiddlewareManager.h" - -namespace spine { - - class AttachmentVertices; - - /** Draws a skeleton. - */ - class SpineRenderer: public cocos2d::middleware::IMiddleware, public cocos2d::Ref - { - public: - static SpineRenderer* create (); - static SpineRenderer* createWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false); - static SpineRenderer* createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false); - static SpineRenderer* createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1); - static SpineRenderer* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); - - virtual void update (float deltaTime); - - spSkeleton* getSkeleton() const; - - void setTimeScale (float scale); - float getTimeScale () const; - - void updateWorldTransform (); - - void setToSetupPose (); - void setBonesToSetupPose (); - void setSlotsToSetupPose (); - void paused (bool value); - - /* Returns 0 if the bone was not found. */ - spBone* findBone (const std::string& boneName) const; - /* Returns 0 if the slot was not found. */ - spSlot* findSlot (const std::string& slotName) const; - - /* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are - * attached if the corresponding attachment from the old skin was attached. Returns false if the skin was not found. - * @param skin May be empty string ("") for no skin.*/ - bool setSkin (const std::string& skinName); - /** @param skin May be 0 for no skin.*/ - bool setSkin (const char* skinName); - - /* Returns 0 if the slot or attachment was not found. */ - spAttachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const; - /* Returns false if the slot or attachment was not found. - * @param attachmentName May be empty string ("") for no attachment. */ - bool setAttachment (const std::string& slotName, const std::string& attachmentName); - /* @param attachmentName May be 0 for no attachment. */ - bool setAttachment (const std::string& slotName, const char* attachmentName); - - /* Enables/disables two color tinting for this instance. May break batching */ - void setUseTint(bool enabled); - - /* Sets the range of slots that should be rendered. Use -1, -1 to clear the range */ - void setSlotsRange(int startSlotIndex, int endSlotIndex); - - /** - * @return debug data,it's a Float32Array, - * format |debug bones length|[beginX|beginY|toX|toY|...loop...] - */ - se_object_ptr getDebugData() const - { - if (_debugBuffer) - { - return _debugBuffer->getTypeArray(); - } - return nullptr; - } - - /** - * @return render info offset,it's a Uint32Array, - * format |render info offset| - */ - se_object_ptr getRenderInfoOffset() const - { - if (_renderInfoOffset) - { - return _renderInfoOffset->getTypeArray(); - } - return nullptr; - } - - void setColor (cocos2d::Color4B& color); - void setDebugBonesEnabled (bool enabled); - void setDebugSlotsEnabled (bool enabled); - - void setOpacityModifyRGB (bool value); - bool isOpacityModifyRGB () const; - - void beginSchedule(); - void stopSchedule(); - void onEnable(); - void onDisable(); - - CC_CONSTRUCTOR_ACCESS: - SpineRenderer (); - SpineRenderer(spSkeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false); - SpineRenderer (spSkeletonData* skeletonData, bool ownsSkeletonData = false); - SpineRenderer (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1); - SpineRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); - - virtual ~SpineRenderer (); - - void initWithUUID(const std::string& uuid); - void initWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false); - void initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false); - void initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1); - void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); - void initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1); - void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1); - - virtual void initialize (); - - protected: - void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData); - virtual AttachmentVertices* getAttachmentVertices (spRegionAttachment* attachment) const; - virtual AttachmentVertices* getAttachmentVertices (spMeshAttachment* attachment) const; - - bool _ownsSkeletonData = false; - bool _ownsSkeleton = false; - spAtlas* _atlas = nullptr; - spAttachmentLoader* _attachmentLoader = nullptr; - spSkeleton* _skeleton = nullptr; - float _timeScale = 1; - bool _paused = false; - - bool _debugSlots = false; - bool _debugBones = false; - cocos2d::Color4F _nodeColor = cocos2d::Color4F::WHITE; - bool _premultipliedAlpha = false; - spSkeletonClipping* _clipper = nullptr; - bool _useTint = false; - std::string _uuid = ""; - - int _startSlotIndex = -1; - int _endSlotIndex = -1; - - cocos2d::middleware::IOTypedArray* _renderInfoOffset = nullptr; - cocos2d::middleware::IOTypedArray* _debugBuffer = nullptr; - }; - -} diff --git a/cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp b/cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp new file mode 100644 index 00000000000..5bbfdf94789 --- /dev/null +++ b/cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp @@ -0,0 +1,85 @@ +/****************************************************************************** + * 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 "VertexEffectDelegate.h" +namespace spine { + + VertexEffectDelegate::VertexEffectDelegate () { + + } + + VertexEffectDelegate::~VertexEffectDelegate () { + clear(); + } + + void VertexEffectDelegate::clear() { + if (_interpolation) { + delete _interpolation; + _interpolation = nullptr; + } + if (_vertexEffect) { + delete _vertexEffect; + _vertexEffect = nullptr; + } + _effectType = "none"; + } + + JitterVertexEffect* VertexEffectDelegate::initJitter (float jitterX, float jitterY) { + clear(); + _vertexEffect = new JitterVertexEffect(jitterX, jitterY); + _effectType = "jitter"; + return (JitterVertexEffect*)_vertexEffect; + } + + SwirlVertexEffect* VertexEffectDelegate::initSwirlWithPow(float radius, int power) { + clear(); + _interpolation = new PowInterpolation(power); + _vertexEffect = new SwirlVertexEffect(radius, *_interpolation); + _effectType = "swirl"; + return (SwirlVertexEffect*)_vertexEffect; + } + + SwirlVertexEffect* VertexEffectDelegate::initSwirlWithPowOut(float radius, int power) { + clear(); + _interpolation = new PowOutInterpolation(power); + _vertexEffect = new SwirlVertexEffect(radius, *_interpolation); + _effectType = "swirl"; + return (SwirlVertexEffect*)_vertexEffect; + } + + JitterVertexEffect* VertexEffectDelegate::getJitterVertexEffect () { + JitterVertexEffect* jitter = dynamic_cast(_vertexEffect); + return jitter; + } + + SwirlVertexEffect* VertexEffectDelegate::getSwirlVertexEffect () { + SwirlVertexEffect* swirl = dynamic_cast(_vertexEffect); + return swirl; + } +} diff --git a/cocos/editor-support/spine-creator-support/VertexEffectDelegate.h b/cocos/editor-support/spine-creator-support/VertexEffectDelegate.h new file mode 100644 index 00000000000..2eab2cd29df --- /dev/null +++ b/cocos/editor-support/spine-creator-support/VertexEffectDelegate.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 "spine/spine.h" +#include "base/CCRef.h" +#include "base/ccTypes.h" +#include + +namespace spine { + class VertexEffectDelegate: public cocos2d::Ref { + public: + VertexEffectDelegate (); + ~VertexEffectDelegate (); + JitterVertexEffect* initJitter (float jitterX, float jitterY); + SwirlVertexEffect* initSwirlWithPow(float radius, int power); + SwirlVertexEffect* initSwirlWithPowOut(float radius, int power); + VertexEffect* getVertexEffect () { + return _vertexEffect; + } + JitterVertexEffect* getJitterVertexEffect (); + SwirlVertexEffect* getSwirlVertexEffect (); + const std::string& getEffectType() const { + return _effectType; + } + void clear(); + private: + VertexEffect* _vertexEffect = nullptr; + Interpolation* _interpolation = nullptr; + std::string _effectType = "none"; + }; +} diff --git a/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp b/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp index 89ca5ac59cc..b9857e3775c 100644 --- a/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp +++ b/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp @@ -1,107 +1,154 @@ /****************************************************************************** - * Spine Runtimes Software License v2.5 + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. + * Copyright (c) 2013-2019, Esoteric Software LLC * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. + * 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 * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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 "spine-creator-support/spine-cocos2dx.h" -#include "spine/extension.h" +#include "spine-creator-support/AttachmentVertices.h" #include "middleware-adapter.h" #include "base/CCData.h" #include "platform/CCFileUtils.h" namespace spine { static CustomTextureLoader _customTextureLoader = nullptr; - void spAtlasPage_setCustomTextureLoader (CustomTextureLoader texLoader) - { + void spAtlasPage_setCustomTextureLoader (CustomTextureLoader texLoader) { _customTextureLoader = texLoader; } + + static SpineObjectDisposeCallback _spineObjectDisposeCallback = 0; + void setSpineObjectDisposeCallback(SpineObjectDisposeCallback callback) { + _spineObjectDisposeCallback = callback; + } } USING_NS_CC; USING_NS_MW; using namespace spine; -GLuint wrap (spAtlasWrap wrap) -{ - return wrap == SP_ATLAS_CLAMPTOEDGE ? GL_CLAMP_TO_EDGE : GL_REPEAT; +static void deleteAttachmentVertices (void* vertices) { + delete (AttachmentVertices *) vertices; } -GLuint filter (spAtlasFilter filter) -{ - switch (filter) - { - case SP_ATLAS_UNKNOWN_FILTER: +static unsigned short quadTriangles[6] = {0, 1, 2, 2, 3, 0}; + +static void setAttachmentVertices(RegionAttachment* attachment) { + AtlasRegion* region = (AtlasRegion*)attachment->getRendererObject(); + AttachmentVertices* attachmentVertices = new AttachmentVertices((Texture2D*)region->page->getRendererObject(), 4, quadTriangles, 6); + V2F_T2F_C4B* vertices = attachmentVertices->_triangles->verts; + for (int i = 0, ii = 0; i < 4; ++i, ii += 2) { + vertices[i].texCoord.u = attachment->getUVs()[ii]; + vertices[i].texCoord.v = attachment->getUVs()[ii + 1]; + } + attachment->setRendererObject(attachmentVertices, deleteAttachmentVertices); +} + +static void setAttachmentVertices(MeshAttachment* attachment) { + AtlasRegion* region = (AtlasRegion*)attachment->getRendererObject(); + AttachmentVertices* attachmentVertices = new AttachmentVertices((Texture2D*)region->page->getRendererObject(), + attachment->getWorldVerticesLength() >> 1, attachment->getTriangles().buffer(), attachment->getTriangles().size()); + V2F_T2F_C4B* vertices = attachmentVertices->_triangles->verts; + for (size_t i = 0, ii = 0, nn = attachment->getWorldVerticesLength(); ii < nn; ++i, ii += 2) { + vertices[i].texCoord.u = attachment->getUVs()[ii]; + vertices[i].texCoord.v = attachment->getUVs()[ii + 1]; + } + attachment->setRendererObject(attachmentVertices, deleteAttachmentVertices); +} + +Cocos2dAtlasAttachmentLoader::Cocos2dAtlasAttachmentLoader(Atlas* atlas): AtlasAttachmentLoader(atlas) { +} + +Cocos2dAtlasAttachmentLoader::~Cocos2dAtlasAttachmentLoader() { } + +void Cocos2dAtlasAttachmentLoader::configureAttachment(Attachment* attachment) { + if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { + setAttachmentVertices((RegionAttachment*)attachment); + } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { + setAttachmentVertices((MeshAttachment*)attachment); + } +} + +GLuint wrap (TextureWrap wrap) { + return wrap == TextureWrap_ClampToEdge ? GL_CLAMP_TO_EDGE : GL_REPEAT; +} + +GLuint filter (TextureFilter filter) { + switch (filter) { + case TextureFilter_Unknown: break; - case SP_ATLAS_NEAREST: + case TextureFilter_Nearest: return GL_NEAREST; - case SP_ATLAS_LINEAR: + case TextureFilter_Linear: return GL_LINEAR; - case SP_ATLAS_MIPMAP: + case TextureFilter_MipMap: return GL_LINEAR_MIPMAP_LINEAR; - case SP_ATLAS_MIPMAP_NEAREST_NEAREST: + case TextureFilter_MipMapNearestNearest: return GL_NEAREST_MIPMAP_NEAREST; - case SP_ATLAS_MIPMAP_LINEAR_NEAREST: + case TextureFilter_MipMapLinearNearest: return GL_LINEAR_MIPMAP_NEAREST; - case SP_ATLAS_MIPMAP_NEAREST_LINEAR: + case TextureFilter_MipMapNearestLinear: return GL_NEAREST_MIPMAP_LINEAR; - case SP_ATLAS_MIPMAP_LINEAR_LINEAR: + case TextureFilter_MipMapLinearLinear: return GL_LINEAR_MIPMAP_LINEAR; } return GL_LINEAR; } -void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) -{ +Cocos2dTextureLoader::Cocos2dTextureLoader() : TextureLoader() { } +Cocos2dTextureLoader::~Cocos2dTextureLoader() { } + +void Cocos2dTextureLoader::load(AtlasPage& page, const spine::String& path) { Texture2D* texture = nullptr; if (spine::_customTextureLoader) { - texture = spine::_customTextureLoader(path); + texture = spine::_customTextureLoader(path.buffer()); } CCASSERT(texture != nullptr, "Invalid image"); texture->retain(); - Texture2D::TexParams textureParams = {filter(self->minFilter), filter(self->magFilter), wrap(self->uWrap), wrap(self->vWrap)}; + Texture2D::TexParams textureParams = {filter(page.minFilter), filter(page.magFilter), wrap(page.uWrap), wrap(page.vWrap)}; texture->setTexParameters(textureParams); - self->rendererObject = texture; - self->width = texture->getPixelsWide(); - self->height = texture->getPixelsHigh(); + page.setRendererObject(texture); + page.width = texture->getPixelsWide(); + page.height = texture->getPixelsHigh(); } -void _spAtlasPage_disposeTexture (spAtlasPage* self) -{ - ((Texture2D*)self->rendererObject)->release(); +void Cocos2dTextureLoader::unload(void* texture) { + ((Texture2D*)texture)->release(); } -char* _spUtil_readFile (const char* path, int* length) -{ + +Cocos2dExtension::Cocos2dExtension() : DefaultSpineExtension() { } + +Cocos2dExtension::~Cocos2dExtension() { } + +char *Cocos2dExtension::_readFile(const spine::String &path, int *length) { *length = 0; - Data data = FileUtils::getInstance()->getDataFromFile(FileUtils::getInstance()->fullPathForFilename(path)); + Data data = FileUtils::getInstance()->getDataFromFile(FileUtils::getInstance()->fullPathForFilename(path.buffer())); if (data.isNull()) return 0; char *ret = (char*)malloc(sizeof(unsigned char) * data.getSize()); @@ -109,3 +156,12 @@ char* _spUtil_readFile (const char* path, int* length) *length = (int)data.getSize(); return ret; } + +SpineExtension *spine::getDefaultExtension () { + return new Cocos2dExtension(); +} + +void Cocos2dExtension::_free(void *mem, const char *file, int line) { + _spineObjectDisposeCallback(mem); + DefaultSpineExtension::_free(mem, file, line); +} diff --git a/cocos/editor-support/spine-creator-support/spine-cocos2dx.h b/cocos/editor-support/spine-creator-support/spine-cocos2dx.h index e6becacefb7..2860e6c2330 100644 --- a/cocos/editor-support/spine-creator-support/spine-cocos2dx.h +++ b/cocos/editor-support/spine-creator-support/spine-cocos2dx.h @@ -1,43 +1,73 @@ /****************************************************************************** - * Spine Runtimes Software License v2.5 + * Spine Runtimes License Agreement + * Last updated May 1, 2019. Replaces all prior versions. * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. + * Copyright (c) 2013-2019, Esoteric Software LLC * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. + * 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 * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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 "spine-creator-support/CreatorAttachmentLoader.h" -#include "spine-creator-support/SpineRenderer.h" -#include "spine-creator-support/SpineAnimation.h" +#include "spine-creator-support/SkeletonRenderer.h" +#include "spine-creator-support/SkeletonAnimation.h" #include "middleware-adapter.h" namespace spine { typedef cocos2d::middleware::Texture2D* (*CustomTextureLoader)(const char* path); // set custom texture loader for _spAtlasPage_createTexture void spAtlasPage_setCustomTextureLoader(CustomTextureLoader texLoader); + + class Cocos2dAtlasAttachmentLoader: public AtlasAttachmentLoader { + public: + Cocos2dAtlasAttachmentLoader(Atlas* atlas); + virtual ~Cocos2dAtlasAttachmentLoader(); + virtual void configureAttachment(Attachment* attachment); + }; + + class Cocos2dTextureLoader: public TextureLoader { + public: + Cocos2dTextureLoader(); + + virtual ~Cocos2dTextureLoader(); + + virtual void load(AtlasPage& page, const String& path); + + virtual void unload(void* texture); + }; + + class Cocos2dExtension: public DefaultSpineExtension { + public: + Cocos2dExtension(); + + virtual ~Cocos2dExtension(); + + virtual void _free(void *mem, const char *file, int line); + protected: + virtual char *_readFile(const String &path, int *length); + }; + + typedef void (*SpineObjectDisposeCallback)(void*); + void setSpineObjectDisposeCallback(SpineObjectDisposeCallback callback); } diff --git a/cocos/editor-support/spine/Animation.c b/cocos/editor-support/spine/Animation.c deleted file mode 100644 index 152007a47ee..00000000000 --- a/cocos/editor-support/spine/Animation.c +++ /dev/null @@ -1,1530 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include -#include - -spAnimation* spAnimation_create (const char* name, int timelinesCount) { - spAnimation* self = NEW(spAnimation); - MALLOC_STR(self->name, name); - self->timelinesCount = timelinesCount; - self->timelines = MALLOC(spTimeline*, timelinesCount); - return self; -} - -void spAnimation_dispose (spAnimation* self) { - int i; - for (i = 0; i < self->timelinesCount; ++i) - spTimeline_dispose(self->timelines[i]); - FREE(self->timelines); - FREE(self->name); - FREE(self); -} - -void spAnimation_apply (const spAnimation* self, spSkeleton* skeleton, float lastTime, float time, int loop, spEvent** events, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int i, n = self->timelinesCount; - - if (loop && self->duration) { - time = FMOD(time, self->duration); - if (lastTime > 0) lastTime = FMOD(lastTime, self->duration); - } - - for (i = 0; i < n; ++i) - spTimeline_apply(self->timelines[i], skeleton, lastTime, time, events, eventsCount, alpha, pose, direction); -} - -/**/ - -typedef struct _spTimelineVtable { - void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction); - int (*getPropertyId) (const spTimeline* self); - void (*dispose) (spTimeline* self); -} _spTimelineVtable; - -void _spTimeline_init (spTimeline* self, spTimelineType type, /**/ - void (*dispose) (spTimeline* self), /**/ - void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction), - int (*getPropertyId) (const spTimeline* self)) { - CONST_CAST(spTimelineType, self->type) = type; - CONST_CAST(_spTimelineVtable*, self->vtable) = NEW(_spTimelineVtable); - VTABLE(spTimeline, self)->dispose = dispose; - VTABLE(spTimeline, self)->apply = apply; - VTABLE(spTimeline, self)->getPropertyId = getPropertyId; -} - -void _spTimeline_deinit (spTimeline* self) { - FREE(self->vtable); -} - -void spTimeline_dispose (spTimeline* self) { - VTABLE(spTimeline, self)->dispose(self); -} - -void spTimeline_apply (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - VTABLE(spTimeline, self)->apply(self, skeleton, lastTime, time, firedEvents, eventsCount, alpha, pose, direction); -} - -int spTimeline_getPropertyId (const spTimeline* self) { - return VTABLE(spTimeline, self)->getPropertyId(self); -} - -/**/ - -static const float CURVE_LINEAR = 0, CURVE_STEPPED = 1, CURVE_BEZIER = 2; -static const int BEZIER_SIZE = 10 * 2 - 1; - -void _spCurveTimeline_init (spCurveTimeline* self, spTimelineType type, int framesCount, /**/ - void (*dispose) (spTimeline* self), /**/ - void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction), - int (*getPropertyId)(const spTimeline* self)) { - _spTimeline_init(SUPER(self), type, dispose, apply, getPropertyId); - self->curves = CALLOC(float, (framesCount - 1) * BEZIER_SIZE); -} - -void _spCurveTimeline_deinit (spCurveTimeline* self) { - _spTimeline_deinit(SUPER(self)); - FREE(self->curves); -} - -void spCurveTimeline_setLinear (spCurveTimeline* self, int frameIndex) { - self->curves[frameIndex * BEZIER_SIZE] = CURVE_LINEAR; -} - -void spCurveTimeline_setStepped (spCurveTimeline* self, int frameIndex) { - self->curves[frameIndex * BEZIER_SIZE] = CURVE_STEPPED; -} - -void spCurveTimeline_setCurve (spCurveTimeline* self, int frameIndex, float cx1, float cy1, float cx2, float cy2) { - float tmpx = (-cx1 * 2 + cx2) * 0.03f, tmpy = (-cy1 * 2 + cy2) * 0.03f; - float dddfx = ((cx1 - cx2) * 3 + 1) * 0.006f, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006f; - float ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy; - float dfx = cx1 * 0.3f + tmpx + dddfx * 0.16666667f, dfy = cy1 * 0.3f + tmpy + dddfy * 0.16666667f; - float x = dfx, y = dfy; - - int i = frameIndex * BEZIER_SIZE, n = i + BEZIER_SIZE - 1; - self->curves[i++] = CURVE_BEZIER; - - for (; i < n; i += 2) { - self->curves[i] = x; - self->curves[i + 1] = y; - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - x += dfx; - y += dfy; - } -} - -float spCurveTimeline_getCurvePercent (const spCurveTimeline* self, int frameIndex, float percent) { - float x, y; - int i = frameIndex * BEZIER_SIZE, start, n; - float type = self->curves[i]; - percent = CLAMP(percent, 0, 1); - if (type == CURVE_LINEAR) return percent; - if (type == CURVE_STEPPED) return 0; - i++; - x = 0; - for (start = i, n = i + BEZIER_SIZE - 1; i < n; i += 2) { - x = self->curves[i]; - if (x >= percent) { - float prevX, prevY; - if (i == start) { - prevX = 0; - prevY = 0; - } else { - prevX = self->curves[i - 2]; - prevY = self->curves[i - 1]; - } - return prevY + (self->curves[i + 1] - prevY) * (percent - prevX) / (x - prevX); - } - } - y = self->curves[i - 1]; - return y + (1 - y) * (percent - x) / (1 - x); /* Last point is 1,1. */ -} - -/* @param target After the first and before the last entry. */ -static int binarySearch (float *values, int valuesLength, float target, int step) { - int low = 0, current; - int high = valuesLength / step - 2; - if (high == 0) return step; - current = high >> 1; - while (1) { - if (values[(current + 1) * step] <= target) - low = current + 1; - else - high = current; - if (low == high) return (low + 1) * step; - current = (low + high) >> 1; - } - return 0; -} - -int _spCurveTimeline_binarySearch (float *values, int valuesLength, float target, int step) { - return binarySearch(values, valuesLength, target, step); -} - -/* @param target After the first and before the last entry. */ -static int binarySearch1 (float *values, int valuesLength, float target) { - int low = 0, current; - int high = valuesLength - 2; - if (high == 0) return 1; - current = high >> 1; - while (1) { - if (values[(current + 1)] <= target) - low = current + 1; - else - high = current; - if (low == high) return low + 1; - current = (low + high) >> 1; - } - return 0; -} - -/**/ - -void _spBaseTimeline_dispose (spTimeline* timeline) { - struct spBaseTimeline* self = SUB_CAST(struct spBaseTimeline, timeline); - _spCurveTimeline_deinit(SUPER(self)); - FREE(self->frames); - FREE(self); -} - -/* Many timelines have structure identical to struct spBaseTimeline and extend spCurveTimeline. **/ -struct spBaseTimeline* _spBaseTimeline_create (int framesCount, spTimelineType type, int frameSize, /**/ - void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction), - int (*getPropertyId) (const spTimeline* self)) { - struct spBaseTimeline* self = NEW(struct spBaseTimeline); - _spCurveTimeline_init(SUPER(self), type, framesCount, _spBaseTimeline_dispose, apply, getPropertyId); - - CONST_CAST(int, self->framesCount) = framesCount * frameSize; - CONST_CAST(float*, self->frames) = CALLOC(float, self->framesCount); - - return self; -} - -/**/ - -void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spBone *bone; - int frame; - float prevRotation, frameTime, percent, r; - - spRotateTimeline* self = SUB_CAST(spRotateTimeline, timeline); - - bone = skeleton->bones[self->boneIndex]; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - bone->rotation = bone->data->rotation; - return; - case SP_MIX_POSE_CURRENT: - r = bone->data->rotation - bone->rotation; - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; - bone->rotation += r * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - if (time >= self->frames[self->framesCount - ROTATE_ENTRIES]) { /* Time is after last frame. */ - if (pose == SP_MIX_POSE_SETUP) - bone->rotation = bone->data->rotation + self->frames[self->framesCount + ROTATE_PREV_ROTATION] * alpha; - else { - r = bone->data->rotation + self->frames[self->framesCount + ROTATE_PREV_ROTATION] - bone->rotation; - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; /* Wrap within -180 and 180. */ - bone->rotation += r * alpha; - } - return; - } - - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(self->frames, self->framesCount, time, ROTATE_ENTRIES); - prevRotation = self->frames[frame + ROTATE_PREV_ROTATION]; - frameTime = self->frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), (frame >> 1) - 1, 1 - (time - frameTime) / (self->frames[frame + ROTATE_PREV_TIME] - frameTime)); - - r = self->frames[frame + ROTATE_ROTATION] - prevRotation; - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; - r = prevRotation + r * percent; - if (pose == SP_MIX_POSE_SETUP) { - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; - bone->rotation = bone->data->rotation + r * alpha; - } else { - r = bone->data->rotation + r - bone->rotation; - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; - bone->rotation += r * alpha; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spRotateTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_ROTATE << 25) + SUB_CAST(spRotateTimeline, timeline)->boneIndex; -} - -spRotateTimeline* spRotateTimeline_create (int framesCount) { - return _spBaseTimeline_create(framesCount, SP_TIMELINE_ROTATE, ROTATE_ENTRIES, _spRotateTimeline_apply, _spRotateTimeline_getPropertyId); -} - -void spRotateTimeline_setFrame (spRotateTimeline* self, int frameIndex, float time, float degrees) { - frameIndex <<= 1; - self->frames[frameIndex] = time; - self->frames[frameIndex + ROTATE_ROTATION] = degrees; -} - -/**/ - -static const int TRANSLATE_PREV_TIME = -3, TRANSLATE_PREV_X = -2, TRANSLATE_PREV_Y = -1; -static const int TRANSLATE_X = 1, TRANSLATE_Y = 2; - -void _spTranslateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spBone *bone; - int frame; - float frameTime, percent; - float x, y; - float *frames; - int framesCount; - - spTranslateTimeline* self = SUB_CAST(spTranslateTimeline, timeline); - - bone = skeleton->bones[self->boneIndex]; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - bone->x = bone->data->x; - bone->y = bone->data->y; - return; - case SP_MIX_POSE_CURRENT: - bone->x += (bone->data->x - bone->x) * alpha; - bone->y += (bone->data->y - bone->y) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - TRANSLATE_ENTRIES]) { /* Time is after last frame. */ - x = frames[framesCount + TRANSLATE_PREV_X]; - y = frames[framesCount + TRANSLATE_PREV_Y]; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, TRANSLATE_ENTRIES); - x = frames[frame + TRANSLATE_PREV_X]; - y = frames[frame + TRANSLATE_PREV_Y]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSLATE_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime)); - - x += (frames[frame + TRANSLATE_X] - x) * percent; - y += (frames[frame + TRANSLATE_Y] - y) * percent; - } - if (pose == SP_MIX_POSE_SETUP) { - bone->x = bone->data->x + x * alpha; - bone->y = bone->data->y + y * alpha; - } else { - bone->x += (bone->data->x + x - bone->x) * alpha; - bone->y += (bone->data->y + y - bone->y) * alpha; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spTranslateTimeline_getPropertyId (const spTimeline* self) { - return (SP_TIMELINE_TRANSLATE << 24) + SUB_CAST(spTranslateTimeline, self)->boneIndex; -} - -spTranslateTimeline* spTranslateTimeline_create (int framesCount) { - return _spBaseTimeline_create(framesCount, SP_TIMELINE_TRANSLATE, TRANSLATE_ENTRIES, _spTranslateTimeline_apply, _spTranslateTimeline_getPropertyId); -} - -void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, float time, float x, float y) { - frameIndex *= TRANSLATE_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + TRANSLATE_X] = x; - self->frames[frameIndex + TRANSLATE_Y] = y; -} - -/**/ - -void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spBone *bone; - int frame; - float frameTime, percent, x, y; - float *frames; - int framesCount; - - spScaleTimeline* self = SUB_CAST(spScaleTimeline, timeline); - - bone = skeleton->bones[self->boneIndex]; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - bone->scaleX = bone->data->scaleX; - bone->scaleY = bone->data->scaleY; - return; - case SP_MIX_POSE_CURRENT: - bone->scaleX += (bone->data->scaleX - bone->scaleX) * alpha; - bone->scaleY += (bone->data->scaleY - bone->scaleY) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - TRANSLATE_ENTRIES]) { /* Time is after last frame. */ - x = frames[framesCount + TRANSLATE_PREV_X] * bone->data->scaleX; - y = frames[framesCount + TRANSLATE_PREV_Y] * bone->data->scaleY; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, TRANSLATE_ENTRIES); - x = frames[frame + TRANSLATE_PREV_X]; - y = frames[frame + TRANSLATE_PREV_Y]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSLATE_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime)); - - x = (x + (frames[frame + TRANSLATE_X] - x) * percent) * bone->data->scaleX; - y = (y + (frames[frame + TRANSLATE_Y] - y) * percent) * bone->data->scaleY; - } - if (alpha == 1) { - bone->scaleX = x; - bone->scaleY = y; - } else { - float bx, by; - if (pose == SP_MIX_POSE_SETUP) { - bx = bone->data->scaleX; - by = bone->data->scaleY; - } else { - bx = bone->scaleX; - by = bone->scaleY; - } - /* Mixing out uses sign of setup or current pose, else use sign of key. */ - if (direction == SP_MIX_DIRECTION_OUT) { - x = ABS(x) * SIGNUM(bx); - y = ABS(y) * SIGNUM(by); - } else { - bx = ABS(bx) * SIGNUM(x); - by = ABS(by) * SIGNUM(y); - } - bone->scaleX = bx + (x - bx) * alpha; - bone->scaleY = by + (y - by) * alpha; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spScaleTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_SCALE << 24) + SUB_CAST(spScaleTimeline, timeline)->boneIndex; -} - -spScaleTimeline* spScaleTimeline_create (int framesCount) { - return _spBaseTimeline_create(framesCount, SP_TIMELINE_SCALE, TRANSLATE_ENTRIES, _spScaleTimeline_apply, _spScaleTimeline_getPropertyId); -} - -void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time, float x, float y) { - spTranslateTimeline_setFrame(self, frameIndex, time, x, y); -} - -/**/ - -void _spShearTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spBone *bone; - int frame; - float frameTime, percent, x, y; - float *frames; - int framesCount; - - spShearTimeline* self = SUB_CAST(spShearTimeline, timeline); - - bone = skeleton->bones[self->boneIndex]; - frames = self->frames; - framesCount = self->framesCount; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - bone->shearX = bone->data->shearX; - bone->shearY = bone->data->shearY; - return; - case SP_MIX_POSE_CURRENT: - bone->shearX += (bone->data->shearX - bone->shearX) * alpha; - bone->shearY += (bone->data->shearY - bone->shearY) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - if (time >= frames[framesCount - TRANSLATE_ENTRIES]) { /* Time is after last frame. */ - x = frames[framesCount + TRANSLATE_PREV_X]; - y = frames[framesCount + TRANSLATE_PREV_Y]; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, TRANSLATE_ENTRIES); - x = frames[frame + TRANSLATE_PREV_X]; - y = frames[frame + TRANSLATE_PREV_Y]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSLATE_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime)); - - x = x + (frames[frame + TRANSLATE_X] - x) * percent; - y = y + (frames[frame + TRANSLATE_Y] - y) * percent; - } - if (pose == SP_MIX_POSE_SETUP) { - bone->shearX = bone->data->shearX + x * alpha; - bone->shearY = bone->data->shearY + y * alpha; - } else { - bone->shearX += (bone->data->shearX + x - bone->shearX) * alpha; - bone->shearY += (bone->data->shearY + y - bone->shearY) * alpha; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spShearTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_SHEAR << 24) + SUB_CAST(spShearTimeline, timeline)->boneIndex; -} - -spShearTimeline* spShearTimeline_create (int framesCount) { - return (spShearTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_SHEAR, 3, _spShearTimeline_apply, _spShearTimeline_getPropertyId); -} - -void spShearTimeline_setFrame (spShearTimeline* self, int frameIndex, float time, float x, float y) { - spTranslateTimeline_setFrame(self, frameIndex, time, x, y); -} - -/**/ - -static const int COLOR_PREV_TIME = -5, COLOR_PREV_R = -4, COLOR_PREV_G = -3, COLOR_PREV_B = -2, COLOR_PREV_A = -1; -static const int COLOR_R = 1, COLOR_G = 2, COLOR_B = 3, COLOR_A = 4; - -void _spColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spSlot *slot; - int frame; - float percent, frameTime; - float r, g, b, a; - spColor* color; - spColor* setup; - spColorTimeline* self = (spColorTimeline*)timeline; - slot = skeleton->slots[self->slotIndex]; - - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - spColor_setFromColor(&slot->color, &slot->data->color); - return; - case SP_MIX_POSE_CURRENT: - color = &slot->color; - setup = &slot->data->color; - spColor_addFloats(color, (setup->r - color->r) * alpha, (setup->g - color->g) * alpha, (setup->b - color->b) * alpha, - (setup->a - color->a) * alpha); - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - if (time >= self->frames[self->framesCount - 5]) { /* Time is after last frame */ - int i = self->framesCount; - r = self->frames[i + COLOR_PREV_R]; - g = self->frames[i + COLOR_PREV_G]; - b = self->frames[i + COLOR_PREV_B]; - a = self->frames[i + COLOR_PREV_A]; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(self->frames, self->framesCount, time, COLOR_ENTRIES); - - r = self->frames[frame + COLOR_PREV_R]; - g = self->frames[frame + COLOR_PREV_G]; - b = self->frames[frame + COLOR_PREV_B]; - a = self->frames[frame + COLOR_PREV_A]; - - frameTime = self->frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / COLOR_ENTRIES - 1, - 1 - (time - frameTime) / (self->frames[frame + COLOR_PREV_TIME] - frameTime)); - - r += (self->frames[frame + COLOR_R] - r) * percent; - g += (self->frames[frame + COLOR_G] - g) * percent; - b += (self->frames[frame + COLOR_B] - b) * percent; - a += (self->frames[frame + COLOR_A] - a) * percent; - } - if (alpha == 1) { - spColor_setFromFloats(&slot->color, r, g, b, a); - } else { - if (pose == SP_MIX_POSE_SETUP) { - spColor_setFromColor(&slot->color, &slot->data->color); - } - spColor_addFloats(&slot->color, (r - slot->color.r) * alpha, (g - slot->color.g) * alpha, (b - slot->color.b) * alpha, (a - slot->color.a) * alpha); - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spColorTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_COLOR << 24) + SUB_CAST(spColorTimeline, timeline)->slotIndex; -} - -spColorTimeline* spColorTimeline_create (int framesCount) { - return (spColorTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_COLOR, 5, _spColorTimeline_apply, _spColorTimeline_getPropertyId); -} - -void spColorTimeline_setFrame (spColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a) { - frameIndex *= COLOR_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + COLOR_R] = r; - self->frames[frameIndex + COLOR_G] = g; - self->frames[frameIndex + COLOR_B] = b; - self->frames[frameIndex + COLOR_A] = a; -} - -/**/ - -static const int TWOCOLOR_PREV_TIME = -8, TWOCOLOR_PREV_R = -7, TWOCOLOR_PREV_G = -6, TWOCOLOR_PREV_B = -5, TWOCOLOR_PREV_A = -4; -static const int TWOCOLOR_PREV_R2 = -3, TWOCOLOR_PREV_G2 = -2, TWOCOLOR_PREV_B2 = -1; -static const int TWOCOLOR_R = 1, TWOCOLOR_G = 2, TWOCOLOR_B = 3, TWOCOLOR_A = 4, TWOCOLOR_R2 = 5, TWOCOLOR_G2 = 6, TWOCOLOR_B2 = 7; - -void _spTwoColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spSlot *slot; - int frame; - float percent, frameTime; - float r, g, b, a, r2, g2, b2; - spColor* light; - spColor* dark; - spColor* setupLight; - spColor* setupDark; - spColorTimeline* self = (spColorTimeline*)timeline; - slot = skeleton->slots[self->slotIndex]; - - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - spColor_setFromColor(&slot->color, &slot->data->color); - spColor_setFromColor(slot->darkColor, slot->data->darkColor); - return; - case SP_MIX_POSE_CURRENT: - light = &slot->color; - dark = slot->darkColor; - setupLight = &slot->data->color; - setupDark = slot->data->darkColor; - spColor_addFloats(light, (setupLight->r - light->r) * alpha, (setupLight->g - light->g) * alpha, (setupLight->b - light->b) * alpha, - (setupLight->a - light->a) * alpha); - spColor_addFloats(dark, (setupDark->r - dark->r) * alpha, (setupDark->g - dark->g) * alpha, (setupDark->b - dark->b) * alpha, 0); - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - if (time >= self->frames[self->framesCount - TWOCOLOR_ENTRIES]) { /* Time is after last frame */ - int i = self->framesCount; - r = self->frames[i + TWOCOLOR_PREV_R]; - g = self->frames[i + TWOCOLOR_PREV_G]; - b = self->frames[i + TWOCOLOR_PREV_B]; - a = self->frames[i + TWOCOLOR_PREV_A]; - r2 = self->frames[i + TWOCOLOR_PREV_R2]; - g2 = self->frames[i + TWOCOLOR_PREV_G2]; - b2 = self->frames[i + TWOCOLOR_PREV_B2]; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(self->frames, self->framesCount, time, TWOCOLOR_ENTRIES); - - r = self->frames[frame + TWOCOLOR_PREV_R]; - g = self->frames[frame + TWOCOLOR_PREV_G]; - b = self->frames[frame + TWOCOLOR_PREV_B]; - a = self->frames[frame + TWOCOLOR_PREV_A]; - r2 = self->frames[frame + TWOCOLOR_PREV_R2]; - g2 = self->frames[frame + TWOCOLOR_PREV_G2]; - b2 = self->frames[frame + TWOCOLOR_PREV_B2]; - - frameTime = self->frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TWOCOLOR_ENTRIES - 1, - 1 - (time - frameTime) / (self->frames[frame + TWOCOLOR_PREV_TIME] - frameTime)); - - r += (self->frames[frame + TWOCOLOR_R] - r) * percent; - g += (self->frames[frame + TWOCOLOR_G] - g) * percent; - b += (self->frames[frame + TWOCOLOR_B] - b) * percent; - a += (self->frames[frame + TWOCOLOR_A] - a) * percent; - r2 += (self->frames[frame + TWOCOLOR_R2] - r2) * percent; - g2 += (self->frames[frame + TWOCOLOR_G2] - g2) * percent; - b2 += (self->frames[frame + TWOCOLOR_B2] - b2) * percent; - } - if (alpha == 1) { - spColor_setFromFloats(&slot->color, r, g, b, a); - spColor_setFromFloats(slot->darkColor, r2, g2, b2, 1); - } else { - light = &slot->color; - dark = slot->darkColor; - if (pose == SP_MIX_POSE_SETUP) { - spColor_setFromColor(light, &slot->data->color); - spColor_setFromColor(dark, slot->data->darkColor); - } - spColor_addFloats(light, (r - light->r) * alpha, (g - light->g) * alpha, (b - light->b) * alpha, (a - light->a) * alpha); - spColor_addFloats(dark, (r2 - dark->r) * alpha, (g2 - dark->g) * alpha, (b2 - dark->b) * alpha, 0); - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spTwoColorTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_TWOCOLOR << 24) + SUB_CAST(spTwoColorTimeline, timeline)->slotIndex; -} - -spTwoColorTimeline* spTwoColorTimeline_create (int framesCount) { - return (spTwoColorTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_TWOCOLOR, TWOCOLOR_ENTRIES, _spTwoColorTimeline_apply, _spTwoColorTimeline_getPropertyId); -} - -void spTwoColorTimeline_setFrame (spTwoColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2) { - frameIndex *= TWOCOLOR_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + TWOCOLOR_R] = r; - self->frames[frameIndex + TWOCOLOR_G] = g; - self->frames[frameIndex + TWOCOLOR_B] = b; - self->frames[frameIndex + TWOCOLOR_A] = a; - self->frames[frameIndex + TWOCOLOR_R2] = r2; - self->frames[frameIndex + TWOCOLOR_G2] = g2; - self->frames[frameIndex + TWOCOLOR_B2] = b2; -} - -/**/ - -void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - const char* attachmentName; - spAttachmentTimeline* self = (spAttachmentTimeline*)timeline; - int frameIndex; - spSlot* slot = skeleton->slots[self->slotIndex]; - - if (direction == SP_MIX_DIRECTION_OUT && pose == SP_MIX_POSE_SETUP) { - const char* attachmentName = slot->data->attachmentName; - spSlot_setAttachment(slot, attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0); - return; - } - - if (time < self->frames[0]) { - if (pose == SP_MIX_POSE_SETUP) { - attachmentName = slot->data->attachmentName; - spSlot_setAttachment(skeleton->slots[self->slotIndex], - attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0); - } - return; - } - - if (time >= self->frames[self->framesCount - 1]) - frameIndex = self->framesCount - 1; - else - frameIndex = binarySearch1(self->frames, self->framesCount, time) - 1; - - attachmentName = self->attachmentNames[frameIndex]; - spSlot_setAttachment(skeleton->slots[self->slotIndex], - attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0); - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); - UNUSED(alpha); -} - -int _spAttachmentTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_ATTACHMENT << 24) + SUB_CAST(spAttachmentTimeline, timeline)->slotIndex; -} - -void _spAttachmentTimeline_dispose (spTimeline* timeline) { - spAttachmentTimeline* self = SUB_CAST(spAttachmentTimeline, timeline); - int i; - - _spTimeline_deinit(timeline); - - for (i = 0; i < self->framesCount; ++i) - FREE(self->attachmentNames[i]); - FREE(self->attachmentNames); - FREE(self->frames); - FREE(self); -} - -spAttachmentTimeline* spAttachmentTimeline_create (int framesCount) { - spAttachmentTimeline* self = NEW(spAttachmentTimeline); - _spTimeline_init(SUPER(self), SP_TIMELINE_ATTACHMENT, _spAttachmentTimeline_dispose, _spAttachmentTimeline_apply, _spAttachmentTimeline_getPropertyId); - - CONST_CAST(int, self->framesCount) = framesCount; - CONST_CAST(float*, self->frames) = CALLOC(float, framesCount); - CONST_CAST(char**, self->attachmentNames) = CALLOC(char*, framesCount); - - return self; -} - -void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex, float time, const char* attachmentName) { - self->frames[frameIndex] = time; - - FREE(self->attachmentNames[frameIndex]); - if (attachmentName) - MALLOC_STR(self->attachmentNames[frameIndex], attachmentName); - else - self->attachmentNames[frameIndex] = 0; -} - -/**/ - -void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int frame, i, vertexCount; - float percent, frameTime; - const float* prevVertices; - const float* nextVertices; - float* frames; - int framesCount; - const float** frameVertices; - float* vertices; - spDeformTimeline* self = (spDeformTimeline*)timeline; - - spSlot *slot = skeleton->slots[self->slotIndex]; - - if (slot->attachment != self->attachment) { - if (!slot->attachment) return; - switch (slot->attachment->type) { - case SP_ATTACHMENT_MESH: { - spMeshAttachment* mesh = SUB_CAST(spMeshAttachment, slot->attachment); - if (!mesh->inheritDeform || mesh->parentMesh != (void*)self->attachment) return; - break; - } - default: - return; - } - } - - frames = self->frames; - framesCount = self->framesCount; - vertexCount = self->frameVerticesCount; - if (slot->attachmentVerticesCount < vertexCount) { - if (slot->attachmentVerticesCapacity < vertexCount) { - FREE(slot->attachmentVertices); - slot->attachmentVertices = MALLOC(float, vertexCount); - slot->attachmentVerticesCapacity = vertexCount; - } - } - if (slot->attachmentVerticesCount == 0) alpha = 1; - - frameVertices = self->frameVertices; - vertices = slot->attachmentVertices; - - if (time < frames[0]) { /* Time is before first frame. */ - spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment); - switch (pose) { - case SP_MIX_POSE_SETUP: - slot->attachmentVerticesCount = 0; - return; - case SP_MIX_POSE_CURRENT: - if (alpha == 1) { - slot->attachmentVerticesCount = 0; - return; - } - slot->attachmentVerticesCount = vertexCount; - if (!vertexAttachment->bones) { - float* setupVertices = vertexAttachment->vertices; - for (i = 0; i < vertexCount; i++) { - vertices[i] += (setupVertices[i] - vertices[i]) * alpha; - } - } else { - alpha = 1 - alpha; - for (i = 0; i < vertexCount; i++) { - vertices[i] *= alpha; - } - } - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - slot->attachmentVerticesCount = vertexCount; - if (time >= frames[framesCount - 1]) { /* Time is after last frame. */ - const float* lastVertices = self->frameVertices[framesCount - 1]; - if (alpha == 1) { - /* Vertex positions or deform offsets, no alpha. */ - memcpy(vertices, lastVertices, vertexCount * sizeof(float)); - } else if (pose == SP_MIX_POSE_SETUP) { - spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment); - if (!vertexAttachment->bones) { - /* Unweighted vertex positions, with alpha. */ - float* setupVertices = vertexAttachment->vertices; - for (i = 0; i < vertexCount; i++) { - float setup = setupVertices[i]; - vertices[i] = setup + (lastVertices[i] - setup) * alpha; - } - } else { - /* Weighted deform offsets, with alpha. */ - for (i = 0; i < vertexCount; i++) - vertices[i] = lastVertices[i] * alpha; - } - } else { - /* Vertex positions or deform offsets, with alpha. */ - for (i = 0; i < vertexCount; i++) - vertices[i] += (lastVertices[i] - vertices[i]) * alpha; - } - return; - } - - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, 1); - prevVertices = frameVertices[frame - 1]; - nextVertices = frameVertices[frame]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime)); - - if (alpha == 1) { - /* Vertex positions or deform offsets, no alpha. */ - for (i = 0; i < vertexCount; i++) { - float prev = prevVertices[i]; - vertices[i] = prev + (nextVertices[i] - prev) * percent; - } - } else if (pose == SP_MIX_POSE_SETUP) { - spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment); - if (!vertexAttachment->bones) { - /* Unweighted vertex positions, with alpha. */ - float* setupVertices = vertexAttachment->vertices; - for (i = 0; i < vertexCount; i++) { - float prev = prevVertices[i], setup = setupVertices[i]; - vertices[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha; - } - } else { - /* Weighted deform offsets, with alpha. */ - for (i = 0; i < vertexCount; i++) { - float prev = prevVertices[i]; - vertices[i] = (prev + (nextVertices[i] - prev) * percent) * alpha; - } - } - } else { - /* Vertex positions or deform offsets, with alpha. */ - for (i = 0; i < vertexCount; i++) { - float prev = prevVertices[i]; - vertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha; - } - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spDeformTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_DEFORM << 27) + SUB_CAST(spVertexAttachment, SUB_CAST(spDeformTimeline, timeline)->attachment)->id + SUB_CAST(spDeformTimeline, timeline)->slotIndex; -} - -void _spDeformTimeline_dispose (spTimeline* timeline) { - spDeformTimeline* self = SUB_CAST(spDeformTimeline, timeline); - int i; - - _spCurveTimeline_deinit(SUPER(self)); - - for (i = 0; i < self->framesCount; ++i) - FREE(self->frameVertices[i]); - FREE(self->frameVertices); - FREE(self->frames); - FREE(self); -} - -spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCount) { - spDeformTimeline* self = NEW(spDeformTimeline); - _spCurveTimeline_init(SUPER(self), SP_TIMELINE_DEFORM, framesCount, _spDeformTimeline_dispose, _spDeformTimeline_apply, _spDeformTimeline_getPropertyId); - CONST_CAST(int, self->framesCount) = framesCount; - CONST_CAST(float*, self->frames) = CALLOC(float, self->framesCount); - CONST_CAST(float**, self->frameVertices) = CALLOC(float*, framesCount); - CONST_CAST(int, self->frameVerticesCount) = frameVerticesCount; - return self; -} - -void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float time, float* vertices) { - self->frames[frameIndex] = time; - - FREE(self->frameVertices[frameIndex]); - if (!vertices) - self->frameVertices[frameIndex] = 0; - else { - self->frameVertices[frameIndex] = MALLOC(float, self->frameVerticesCount); - memcpy(CONST_CAST(float*, self->frameVertices[frameIndex]), vertices, self->frameVerticesCount * sizeof(float)); - } -} - - -/**/ - -/** Fires events for frames > lastTime and <= time. */ -void _spEventTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - spEventTimeline* self = (spEventTimeline*)timeline; - int frame; - if (!firedEvents) return; - - if (lastTime > time) { /* Fire events after last time for looped animations. */ - _spEventTimeline_apply(timeline, skeleton, lastTime, (float)INT_MAX, firedEvents, eventsCount, alpha, pose, direction); - lastTime = -1; - } else if (lastTime >= self->frames[self->framesCount - 1]) /* Last time is after last frame. */ - return; - if (time < self->frames[0]) return; /* Time is before first frame. */ - - if (lastTime < self->frames[0]) - frame = 0; - else { - float frameTime; - frame = binarySearch1(self->frames, self->framesCount, lastTime); - frameTime = self->frames[frame]; - while (frame > 0) { /* Fire multiple events with the same frame. */ - if (self->frames[frame - 1] != frameTime) break; - frame--; - } - } - for (; frame < self->framesCount && time >= self->frames[frame]; ++frame) { - firedEvents[*eventsCount] = self->events[frame]; - (*eventsCount)++; - } -} - -int _spEventTimeline_getPropertyId (const spTimeline* timeline) { - return SP_TIMELINE_EVENT << 24; -} - -void _spEventTimeline_dispose (spTimeline* timeline) { - spEventTimeline* self = SUB_CAST(spEventTimeline, timeline); - int i; - - _spTimeline_deinit(timeline); - - for (i = 0; i < self->framesCount; ++i) - spEvent_dispose(self->events[i]); - FREE(self->events); - FREE(self->frames); - FREE(self); -} - -spEventTimeline* spEventTimeline_create (int framesCount) { - spEventTimeline* self = NEW(spEventTimeline); - _spTimeline_init(SUPER(self), SP_TIMELINE_EVENT, _spEventTimeline_dispose, _spEventTimeline_apply, _spEventTimeline_getPropertyId); - - CONST_CAST(int, self->framesCount) = framesCount; - CONST_CAST(float*, self->frames) = CALLOC(float, framesCount); - CONST_CAST(spEvent**, self->events) = CALLOC(spEvent*, framesCount); - - return self; -} - -void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event) { - self->frames[frameIndex] = event->time; - - FREE(self->events[frameIndex]); - self->events[frameIndex] = event; -} - -/**/ - -void _spDrawOrderTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int i; - int frame; - const int* drawOrderToSetupIndex; - spDrawOrderTimeline* self = (spDrawOrderTimeline*)timeline; - - if (direction == SP_MIX_DIRECTION_OUT && pose == SP_MIX_POSE_SETUP) { - memcpy(skeleton->drawOrder, skeleton->slots, self->slotsCount * sizeof(spSlot*)); - return; - } - - if (time < self->frames[0]) { - if (pose == SP_MIX_POSE_SETUP) memcpy(skeleton->drawOrder, skeleton->slots, self->slotsCount * sizeof(spSlot*)); - return; - } - - if (time >= self->frames[self->framesCount - 1]) /* Time is after last frame. */ - frame = self->framesCount - 1; - else - frame = binarySearch1(self->frames, self->framesCount, time) - 1; - - drawOrderToSetupIndex = self->drawOrders[frame]; - if (!drawOrderToSetupIndex) - memcpy(skeleton->drawOrder, skeleton->slots, self->slotsCount * sizeof(spSlot*)); - else { - for (i = 0; i < self->slotsCount; ++i) - skeleton->drawOrder[i] = skeleton->slots[drawOrderToSetupIndex[i]]; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); - UNUSED(alpha); -} - -int _spDrawOrderTimeline_getPropertyId (const spTimeline* timeline) { - return SP_TIMELINE_DRAWORDER << 24; -} - -void _spDrawOrderTimeline_dispose (spTimeline* timeline) { - spDrawOrderTimeline* self = SUB_CAST(spDrawOrderTimeline, timeline); - int i; - - _spTimeline_deinit(timeline); - - for (i = 0; i < self->framesCount; ++i) - FREE(self->drawOrders[i]); - FREE(self->drawOrders); - FREE(self->frames); - FREE(self); -} - -spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount) { - spDrawOrderTimeline* self = NEW(spDrawOrderTimeline); - _spTimeline_init(SUPER(self), SP_TIMELINE_DRAWORDER, _spDrawOrderTimeline_dispose, _spDrawOrderTimeline_apply, _spDrawOrderTimeline_getPropertyId); - - CONST_CAST(int, self->framesCount) = framesCount; - CONST_CAST(float*, self->frames) = CALLOC(float, framesCount); - CONST_CAST(int**, self->drawOrders) = CALLOC(int*, framesCount); - CONST_CAST(int, self->slotsCount) = slotsCount; - - return self; -} - -void spDrawOrderTimeline_setFrame (spDrawOrderTimeline* self, int frameIndex, float time, const int* drawOrder) { - self->frames[frameIndex] = time; - - FREE(self->drawOrders[frameIndex]); - if (!drawOrder) - self->drawOrders[frameIndex] = 0; - else { - self->drawOrders[frameIndex] = MALLOC(int, self->slotsCount); - memcpy(CONST_CAST(int*, self->drawOrders[frameIndex]), drawOrder, self->slotsCount * sizeof(int)); - } -} - -/**/ - -static const int IKCONSTRAINT_PREV_TIME = -3, IKCONSTRAINT_PREV_MIX = -2, IKCONSTRAINT_PREV_BEND_DIRECTION = -1; -static const int IKCONSTRAINT_MIX = 1, IKCONSTRAINT_BEND_DIRECTION = 2; - -void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int frame; - float frameTime, percent, mix; - float *frames; - int framesCount; - spIkConstraint* constraint; - spIkConstraintTimeline* self = (spIkConstraintTimeline*)timeline; - - constraint = skeleton->ikConstraints[self->ikConstraintIndex]; - - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - constraint->mix = constraint->data->mix; - constraint->bendDirection = constraint->data->bendDirection; - return; - case SP_MIX_POSE_CURRENT: - constraint->mix += (constraint->data->mix - constraint->mix) * alpha; - constraint->bendDirection = constraint->data->bendDirection; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - IKCONSTRAINT_ENTRIES]) { /* Time is after last frame. */ - if (pose == SP_MIX_POSE_SETUP) { - constraint->mix = constraint->data->mix + (frames[framesCount + IKCONSTRAINT_PREV_MIX] - constraint->data->mix) * alpha; - constraint->bendDirection = direction == SP_MIX_DIRECTION_OUT ? constraint->data->bendDirection - : (int)frames[framesCount + IKCONSTRAINT_PREV_BEND_DIRECTION]; - } else { - constraint->mix += (frames[framesCount + IKCONSTRAINT_PREV_MIX] - constraint->mix) * alpha; - if (direction == SP_MIX_DIRECTION_IN) constraint->bendDirection = (int)frames[framesCount + IKCONSTRAINT_PREV_BEND_DIRECTION]; - } - return; - } - - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(self->frames, self->framesCount, time, IKCONSTRAINT_ENTRIES); - mix = self->frames[frame + IKCONSTRAINT_PREV_MIX]; - frameTime = self->frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / IKCONSTRAINT_ENTRIES - 1, 1 - (time - frameTime) / (self->frames[frame + IKCONSTRAINT_PREV_TIME] - frameTime)); - - if (pose == SP_MIX_POSE_SETUP) { - constraint->mix = constraint->data->mix + (mix + (frames[frame + IKCONSTRAINT_MIX] - mix) * percent - constraint->data->mix) * alpha; - constraint->bendDirection = direction == SP_MIX_DIRECTION_OUT ? constraint->data->bendDirection : (int)frames[frame + IKCONSTRAINT_PREV_BEND_DIRECTION]; - } else { - constraint->mix += (mix + (frames[frame + IKCONSTRAINT_MIX] - mix) * percent - constraint->mix) * alpha; - if (direction == SP_MIX_DIRECTION_IN) constraint->bendDirection = (int)frames[frame + IKCONSTRAINT_PREV_BEND_DIRECTION]; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spIkConstraintTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_IKCONSTRAINT << 24) + SUB_CAST(spIkConstraintTimeline, timeline)->ikConstraintIndex; -} - -spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount) { - return (spIkConstraintTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_IKCONSTRAINT, IKCONSTRAINT_ENTRIES, _spIkConstraintTimeline_apply, _spIkConstraintTimeline_getPropertyId); -} - -void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, int bendDirection) { - frameIndex *= IKCONSTRAINT_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + IKCONSTRAINT_MIX] = mix; - self->frames[frameIndex + IKCONSTRAINT_BEND_DIRECTION] = (float)bendDirection; -} - -/**/ -static const int TRANSFORMCONSTRAINT_PREV_TIME = -5; -static const int TRANSFORMCONSTRAINT_PREV_ROTATE = -4; -static const int TRANSFORMCONSTRAINT_PREV_TRANSLATE = -3; -static const int TRANSFORMCONSTRAINT_PREV_SCALE = -2; -static const int TRANSFORMCONSTRAINT_PREV_SHEAR = -1; -static const int TRANSFORMCONSTRAINT_ROTATE = 1; -static const int TRANSFORMCONSTRAINT_TRANSLATE = 2; -static const int TRANSFORMCONSTRAINT_SCALE = 3; -static const int TRANSFORMCONSTRAINT_SHEAR = 4; - -void _spTransformConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int frame; - float frameTime, percent, rotate, translate, scale, shear; - spTransformConstraint* constraint; - spTransformConstraintTimeline* self = (spTransformConstraintTimeline*)timeline; - float *frames; - int framesCount; - - constraint = skeleton->transformConstraints[self->transformConstraintIndex]; - if (time < self->frames[0]) { - spTransformConstraintData* data = constraint->data; - switch (pose) { - case SP_MIX_POSE_SETUP: - constraint->rotateMix = data->rotateMix; - constraint->translateMix = data->translateMix; - constraint->scaleMix = data->scaleMix; - constraint->shearMix = data->shearMix; - return; - case SP_MIX_POSE_CURRENT: - constraint->rotateMix += (data->rotateMix - constraint->rotateMix) * alpha; - constraint->translateMix += (data->translateMix - constraint->translateMix) * alpha; - constraint->scaleMix += (data->scaleMix - constraint->scaleMix) * alpha; - constraint->shearMix += (data->shearMix - constraint->shearMix) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - TRANSFORMCONSTRAINT_ENTRIES]) { /* Time is after last frame. */ - int i = framesCount; - rotate = frames[i + TRANSFORMCONSTRAINT_PREV_ROTATE]; - translate = frames[i + TRANSFORMCONSTRAINT_PREV_TRANSLATE]; - scale = frames[i + TRANSFORMCONSTRAINT_PREV_SCALE]; - shear = frames[i + TRANSFORMCONSTRAINT_PREV_SHEAR]; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, TRANSFORMCONSTRAINT_ENTRIES); - rotate = frames[frame + TRANSFORMCONSTRAINT_PREV_ROTATE]; - translate = frames[frame + TRANSFORMCONSTRAINT_PREV_TRANSLATE]; - scale = frames[frame + TRANSFORMCONSTRAINT_PREV_SCALE]; - shear = frames[frame + TRANSFORMCONSTRAINT_PREV_SHEAR]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSFORMCONSTRAINT_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + TRANSFORMCONSTRAINT_PREV_TIME] - frameTime)); - - rotate += (frames[frame + TRANSFORMCONSTRAINT_ROTATE] - rotate) * percent; - translate += (frames[frame + TRANSFORMCONSTRAINT_TRANSLATE] - translate) * percent; - scale += (frames[frame + TRANSFORMCONSTRAINT_SCALE] - scale) * percent; - shear += (frames[frame + TRANSFORMCONSTRAINT_SHEAR] - shear) * percent; - } - if (pose == SP_MIX_POSE_SETUP) { - spTransformConstraintData* data = constraint->data; - constraint->rotateMix = data->rotateMix + (rotate - data->rotateMix) * alpha; - constraint->translateMix = data->translateMix + (translate - data->translateMix) * alpha; - constraint->scaleMix = data->scaleMix + (scale - data->scaleMix) * alpha; - constraint->shearMix = data->shearMix + (shear - data->shearMix) * alpha; - } else { - constraint->rotateMix += (rotate - constraint->rotateMix) * alpha; - constraint->translateMix += (translate - constraint->translateMix) * alpha; - constraint->scaleMix += (scale - constraint->scaleMix) * alpha; - constraint->shearMix += (shear - constraint->shearMix) * alpha; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spTransformConstraintTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_TRANSFORMCONSTRAINT << 24) + SUB_CAST(spTransformConstraintTimeline, timeline)->transformConstraintIndex; -} - -spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount) { - return (spTransformConstraintTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_TRANSFORMCONSTRAINT, TRANSFORMCONSTRAINT_ENTRIES, _spTransformConstraintTimeline_apply, _spTransformConstraintTimeline_getPropertyId); -} - -void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix) { - frameIndex *= TRANSFORMCONSTRAINT_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + TRANSFORMCONSTRAINT_ROTATE] = rotateMix; - self->frames[frameIndex + TRANSFORMCONSTRAINT_TRANSLATE] = translateMix; - self->frames[frameIndex + TRANSFORMCONSTRAINT_SCALE] = scaleMix; - self->frames[frameIndex + TRANSFORMCONSTRAINT_SHEAR] = shearMix; -} - -/**/ - -static const int PATHCONSTRAINTPOSITION_PREV_TIME = -2; -static const int PATHCONSTRAINTPOSITION_PREV_VALUE = -1; -static const int PATHCONSTRAINTPOSITION_VALUE = 1; - -void _spPathConstraintPositionTimeline_apply(const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int frame; - float frameTime, percent, position; - spPathConstraint* constraint; - spPathConstraintPositionTimeline* self = (spPathConstraintPositionTimeline*)timeline; - float* frames; - int framesCount; - - constraint = skeleton->pathConstraints[self->pathConstraintIndex]; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - constraint->position = constraint->data->position; - return; - case SP_MIX_POSE_CURRENT: - constraint->position += (constraint->data->position - constraint->position) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - PATHCONSTRAINTPOSITION_ENTRIES]) /* Time is after last frame. */ - position = frames[framesCount + PATHCONSTRAINTPOSITION_PREV_VALUE]; - else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, PATHCONSTRAINTPOSITION_ENTRIES); - position = frames[frame + PATHCONSTRAINTPOSITION_PREV_VALUE]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / PATHCONSTRAINTPOSITION_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + PATHCONSTRAINTPOSITION_PREV_TIME] - frameTime)); - - position += (frames[frame + PATHCONSTRAINTPOSITION_VALUE] - position) * percent; - } - if (pose == SP_MIX_POSE_SETUP) - constraint->position = constraint->data->position + (position - constraint->data->position) * alpha; - else - constraint->position += (position - constraint->position) * alpha; - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spPathConstraintPositionTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_PATHCONSTRAINTPOSITION << 24) + SUB_CAST(spPathConstraintPositionTimeline, timeline)->pathConstraintIndex; -} - -spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount) { - return (spPathConstraintPositionTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTPOSITION, PATHCONSTRAINTPOSITION_ENTRIES, _spPathConstraintPositionTimeline_apply, _spPathConstraintPositionTimeline_getPropertyId); -} - -void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value) { - frameIndex *= PATHCONSTRAINTPOSITION_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + PATHCONSTRAINTPOSITION_VALUE] = value; -} - -/**/ -static const int PATHCONSTRAINTSPACING_PREV_TIME = -2; -static const int PATHCONSTRAINTSPACING_PREV_VALUE = -1; -static const int PATHCONSTRAINTSPACING_VALUE = 1; - -void _spPathConstraintSpacingTimeline_apply(const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int frame; - float frameTime, percent, spacing; - spPathConstraint* constraint; - spPathConstraintSpacingTimeline* self = (spPathConstraintSpacingTimeline*)timeline; - float* frames; - int framesCount; - - constraint = skeleton->pathConstraints[self->pathConstraintIndex]; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - constraint->spacing = constraint->data->spacing; - return; - case SP_MIX_POSE_CURRENT: - constraint->spacing += (constraint->data->spacing - constraint->spacing) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - PATHCONSTRAINTSPACING_ENTRIES]) /* Time is after last frame. */ - spacing = frames[framesCount + PATHCONSTRAINTSPACING_PREV_VALUE]; - else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, PATHCONSTRAINTSPACING_ENTRIES); - spacing = frames[frame + PATHCONSTRAINTSPACING_PREV_VALUE]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / PATHCONSTRAINTSPACING_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + PATHCONSTRAINTSPACING_PREV_TIME] - frameTime)); - - spacing += (frames[frame + PATHCONSTRAINTSPACING_VALUE] - spacing) * percent; - } - - if (pose == SP_MIX_POSE_SETUP) - constraint->spacing = constraint->data->spacing + (spacing - constraint->data->spacing) * alpha; - else - constraint->spacing += (spacing - constraint->spacing) * alpha; - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spPathConstraintSpacingTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_PATHCONSTRAINTSPACING << 24) + SUB_CAST(spPathConstraintSpacingTimeline, timeline)->pathConstraintIndex; -} - -spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount) { - return (spPathConstraintSpacingTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTSPACING, PATHCONSTRAINTSPACING_ENTRIES, _spPathConstraintSpacingTimeline_apply, _spPathConstraintSpacingTimeline_getPropertyId); -} - -void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value) { - frameIndex *= PATHCONSTRAINTSPACING_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + PATHCONSTRAINTSPACING_VALUE] = value; -} - -/**/ - -static const int PATHCONSTRAINTMIX_PREV_TIME = -3; -static const int PATHCONSTRAINTMIX_PREV_ROTATE = -2; -static const int PATHCONSTRAINTMIX_PREV_TRANSLATE = -1; -static const int PATHCONSTRAINTMIX_ROTATE = 1; -static const int PATHCONSTRAINTMIX_TRANSLATE = 2; - -void _spPathConstraintMixTimeline_apply(const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, - spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction) { - int frame; - float frameTime, percent, rotate, translate; - spPathConstraint* constraint; - spPathConstraintMixTimeline* self = (spPathConstraintMixTimeline*)timeline; - float* frames; - int framesCount; - - constraint = skeleton->pathConstraints[self->pathConstraintIndex]; - if (time < self->frames[0]) { - switch (pose) { - case SP_MIX_POSE_SETUP: - constraint->rotateMix = constraint->data->rotateMix; - constraint->translateMix = constraint->data->translateMix; - return; - case SP_MIX_POSE_CURRENT: - constraint->rotateMix += (constraint->data->rotateMix - constraint->rotateMix) * alpha; - constraint->translateMix += (constraint->data->translateMix - constraint->translateMix) * alpha; - case SP_MIX_POSE_CURRENT_LAYERED:; /* to appease compiler */ - } - return; - } - - frames = self->frames; - framesCount = self->framesCount; - if (time >= frames[framesCount - PATHCONSTRAINTMIX_ENTRIES]) { /* Time is after last frame. */ - rotate = frames[framesCount + PATHCONSTRAINTMIX_PREV_ROTATE]; - translate = frames[framesCount + PATHCONSTRAINTMIX_PREV_TRANSLATE]; - } else { - /* Interpolate between the previous frame and the current frame. */ - frame = binarySearch(frames, framesCount, time, PATHCONSTRAINTMIX_ENTRIES); - rotate = frames[frame + PATHCONSTRAINTMIX_PREV_ROTATE]; - translate = frames[frame + PATHCONSTRAINTMIX_PREV_TRANSLATE]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / PATHCONSTRAINTMIX_ENTRIES - 1, - 1 - (time - frameTime) / (frames[frame + PATHCONSTRAINTMIX_PREV_TIME] - frameTime)); - - rotate += (frames[frame + PATHCONSTRAINTMIX_ROTATE] - rotate) * percent; - translate += (frames[frame + PATHCONSTRAINTMIX_TRANSLATE] - translate) * percent; - } - - if (pose == SP_MIX_POSE_SETUP) { - constraint->rotateMix = constraint->data->rotateMix + (rotate - constraint->data->rotateMix) * alpha; - constraint->translateMix = constraint->data->translateMix + (translate - constraint->data->translateMix) * alpha; - } else { - constraint->rotateMix += (rotate - constraint->rotateMix) * alpha; - constraint->translateMix += (translate - constraint->translateMix) * alpha; - } - - UNUSED(lastTime); - UNUSED(firedEvents); - UNUSED(eventsCount); -} - -int _spPathConstraintMixTimeline_getPropertyId (const spTimeline* timeline) { - return (SP_TIMELINE_PATHCONSTRAINTMIX << 24) + SUB_CAST(spPathConstraintMixTimeline, timeline)->pathConstraintIndex; -} - -spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount) { - return (spPathConstraintMixTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTMIX, PATHCONSTRAINTMIX_ENTRIES, _spPathConstraintMixTimeline_apply, _spPathConstraintMixTimeline_getPropertyId); -} - -void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float rotateMix, float translateMix) { - frameIndex *= PATHCONSTRAINTMIX_ENTRIES; - self->frames[frameIndex] = time; - self->frames[frameIndex + PATHCONSTRAINTMIX_ROTATE] = rotateMix; - self->frames[frameIndex + PATHCONSTRAINTMIX_TRANSLATE] = translateMix; -} diff --git a/cocos/editor-support/spine/Animation.cpp b/cocos/editor-support/spine/Animation.cpp new file mode 100644 index 00000000000..8ab7ef84c7b --- /dev/null +++ b/cocos/editor-support/spine/Animation.cpp @@ -0,0 +1,141 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include +#include + +#include + +using namespace spine; + +Animation::Animation(const String &name, Vector &timelines, float duration) : + _timelines(timelines), + _duration(duration), + _name(name) { + assert(_name.length() > 0); +} + +Animation::~Animation() { + ContainerUtil::cleanUpVectorOfPointers(_timelines); +} + +void Animation::apply(Skeleton &skeleton, float lastTime, float time, bool loop, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + if (loop && _duration != 0) { + time = MathUtil::fmod(time, _duration); + if (lastTime > 0) { + lastTime = MathUtil::fmod(lastTime, _duration); + } + } + + for (size_t i = 0, n = _timelines.size(); i < n; ++i) { + _timelines[i]->apply(skeleton, lastTime, time, pEvents, alpha, blend, direction); + } +} + +const String &Animation::getName() { + return _name; +} + +Vector &Animation::getTimelines() { + return _timelines; +} + +float Animation::getDuration() { + return _duration; +} + +void Animation::setDuration(float inValue) { + _duration = inValue; +} + +int Animation::binarySearch(Vector &values, float target, int step) { + int low = 0; + int size = (int)values.size(); + int high = size / step - 2; + if (high == 0) { + return step; + } + + int current = (int) (static_cast(high) >> 1); + while (true) { + if (values[(current + 1) * step] <= target) { + low = current + 1; + } else { + high = current; + } + + if (low == high) { + return (low + 1) * step; + } + + current = (int) (static_cast(low + high) >> 1); + } +} + +int Animation::binarySearch(Vector &values, float target) { + int low = 0; + int size = (int)values.size(); + int high = size - 2; + if (high == 0) { + return 1; + } + + int current = (int) (static_cast(high) >> 1); + while (true) { + if (values[(current + 1)] <= target) { + low = current + 1; + } else { + high = current; + } + + if (low == high) { + return (low + 1); + } + + current = (int) (static_cast(low + high) >> 1); + } +} + +int Animation::linearSearch(Vector &values, float target, int step) { + for (int i = 0, last = (int)values.size() - step; i <= last; i += step) { + if (values[i] > target) { + return i; + } + } + + return -1; +} diff --git a/cocos/editor-support/spine/Animation.h b/cocos/editor-support/spine/Animation.h index e47a835cef5..4cb9fdc9860 100644 --- a/cocos/editor-support/spine/Animation.h +++ b/cocos/editor-support/spine/Animation.h @@ -1,588 +1,119 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ANIMATION_H_ -#define SPINE_ANIMATION_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spTimeline spTimeline; -struct spSkeleton; - -typedef struct spAnimation { - const char* const name; - float duration; - - int timelinesCount; - spTimeline** timelines; - -#ifdef __cplusplus - spAnimation() : - name(0), - duration(0), - timelinesCount(0), - timelines(0) { - } -#endif -} spAnimation; - -typedef enum { - SP_MIX_POSE_SETUP, - SP_MIX_POSE_CURRENT, - SP_MIX_POSE_CURRENT_LAYERED -} spMixPose; - -typedef enum { - SP_MIX_DIRECTION_IN, - SP_MIX_DIRECTION_OUT -} spMixDirection; - -SP_API spAnimation* spAnimation_create (const char* name, int timelinesCount); -SP_API void spAnimation_dispose (spAnimation* self); - -/** Poses the skeleton at the specified time for this animation. - * @param lastTime The last time the animation was applied. - * @param events Any triggered events are added. May be null.*/ -SP_API void spAnimation_apply (const spAnimation* self, struct spSkeleton* skeleton, float lastTime, float time, int loop, - spEvent** events, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction); - -#ifdef SPINE_SHORT_NAMES -typedef spAnimation Animation; -#define Animation_create(...) spAnimation_create(__VA_ARGS__) -#define Animation_dispose(...) spAnimation_dispose(__VA_ARGS__) -#define Animation_apply(...) spAnimation_apply(__VA_ARGS__) -#endif - -/**/ - -typedef enum { - SP_TIMELINE_ROTATE, - SP_TIMELINE_TRANSLATE, - SP_TIMELINE_SCALE, - SP_TIMELINE_SHEAR, - SP_TIMELINE_ATTACHMENT, - SP_TIMELINE_COLOR, - SP_TIMELINE_DEFORM, - SP_TIMELINE_EVENT, - SP_TIMELINE_DRAWORDER, - SP_TIMELINE_IKCONSTRAINT, - SP_TIMELINE_TRANSFORMCONSTRAINT, - SP_TIMELINE_PATHCONSTRAINTPOSITION, - SP_TIMELINE_PATHCONSTRAINTSPACING, - SP_TIMELINE_PATHCONSTRAINTMIX, - SP_TIMELINE_TWOCOLOR -} spTimelineType; - -struct spTimeline { - const spTimelineType type; - const void* const vtable; - -#ifdef __cplusplus - spTimeline() : - type(SP_TIMELINE_SCALE), - vtable(0) { - } -#endif -}; - -SP_API void spTimeline_dispose (spTimeline* self); -SP_API void spTimeline_apply (const spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction); -SP_API int spTimeline_getPropertyId (const spTimeline* self); - -#ifdef SPINE_SHORT_NAMES -typedef spTimeline Timeline; -#define TIMELINE_SCALE SP_TIMELINE_SCALE -#define TIMELINE_ROTATE SP_TIMELINE_ROTATE -#define TIMELINE_TRANSLATE SP_TIMELINE_TRANSLATE -#define TIMELINE_COLOR SP_TIMELINE_COLOR -#define TIMELINE_ATTACHMENT SP_TIMELINE_ATTACHMENT -#define TIMELINE_EVENT SP_TIMELINE_EVENT -#define TIMELINE_DRAWORDER SP_TIMELINE_DRAWORDER -#define Timeline_dispose(...) spTimeline_dispose(__VA_ARGS__) -#define Timeline_apply(...) spTimeline_apply(__VA_ARGS__) -#endif - -/**/ - -typedef struct spCurveTimeline { - spTimeline super; - float* curves; /* type, x, y, ... */ - -#ifdef __cplusplus - spCurveTimeline() : - super(), - curves(0) { - } -#endif -} spCurveTimeline; - -SP_API void spCurveTimeline_setLinear (spCurveTimeline* self, int frameIndex); -SP_API void spCurveTimeline_setStepped (spCurveTimeline* self, int frameIndex); - -/* Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next. - * cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of - * the difference between the keyframe's values. */ -SP_API void spCurveTimeline_setCurve (spCurveTimeline* self, int frameIndex, float cx1, float cy1, float cx2, float cy2); -SP_API float spCurveTimeline_getCurvePercent (const spCurveTimeline* self, int frameIndex, float percent); - -#ifdef SPINE_SHORT_NAMES -typedef spCurveTimeline CurveTimeline; -#define CurveTimeline_setLinear(...) spCurveTimeline_setLinear(__VA_ARGS__) -#define CurveTimeline_setStepped(...) spCurveTimeline_setStepped(__VA_ARGS__) -#define CurveTimeline_setCurve(...) spCurveTimeline_setCurve(__VA_ARGS__) -#define CurveTimeline_getCurvePercent(...) spCurveTimeline_getCurvePercent(__VA_ARGS__) -#endif - -/**/ - -typedef struct spBaseTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, angle, ... for rotate. time, x, y, ... for translate and scale. */ - int boneIndex; - -#ifdef __cplusplus - spBaseTimeline() : - super(), - framesCount(0), - frames(0), - boneIndex(0) { - } -#endif -} spBaseTimeline; - -/**/ - -static const int ROTATE_PREV_TIME = -2, ROTATE_PREV_ROTATION = -1; -static const int ROTATE_ROTATION = 1; -static const int ROTATE_ENTRIES = 2; - -typedef struct spBaseTimeline spRotateTimeline; - -SP_API spRotateTimeline* spRotateTimeline_create (int framesCount); - -SP_API void spRotateTimeline_setFrame (spRotateTimeline* self, int frameIndex, float time, float angle); - -#ifdef SPINE_SHORT_NAMES -typedef spRotateTimeline RotateTimeline; -#define RotateTimeline_create(...) spRotateTimeline_create(__VA_ARGS__) -#define RotateTimeline_setFrame(...) spRotateTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int TRANSLATE_ENTRIES = 3; - -typedef struct spBaseTimeline spTranslateTimeline; - -SP_API spTranslateTimeline* spTranslateTimeline_create (int framesCount); - -SP_API void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, float time, float x, float y); - -#ifdef SPINE_SHORT_NAMES -typedef spTranslateTimeline TranslateTimeline; -#define TranslateTimeline_create(...) spTranslateTimeline_create(__VA_ARGS__) -#define TranslateTimeline_setFrame(...) spTranslateTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -typedef struct spBaseTimeline spScaleTimeline; - -SP_API spScaleTimeline* spScaleTimeline_create (int framesCount); - -SP_API void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time, float x, float y); - -#ifdef SPINE_SHORT_NAMES -typedef spScaleTimeline ScaleTimeline; -#define ScaleTimeline_create(...) spScaleTimeline_create(__VA_ARGS__) -#define ScaleTimeline_setFrame(...) spScaleTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -typedef struct spBaseTimeline spShearTimeline; - -SP_API spShearTimeline* spShearTimeline_create (int framesCount); - -SP_API void spShearTimeline_setFrame (spShearTimeline* self, int frameIndex, float time, float x, float y); - -#ifdef SPINE_SHORT_NAMES -typedef spShearTimeline ShearTimeline; -#define ShearTimeline_create(...) spShearTimeline_create(__VA_ARGS__) -#define ShearTimeline_setFrame(...) spShearTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int COLOR_ENTRIES = 5; - -typedef struct spColorTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, r, g, b, a, ... */ - int slotIndex; - -#ifdef __cplusplus - spColorTimeline() : - super(), - framesCount(0), - frames(0), - slotIndex(0) { - } -#endif -} spColorTimeline; - -SP_API spColorTimeline* spColorTimeline_create (int framesCount); - -SP_API void spColorTimeline_setFrame (spColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a); - -#ifdef SPINE_SHORT_NAMES -typedef spColorTimeline ColorTimeline; -#define ColorTimeline_create(...) spColorTimeline_create(__VA_ARGS__) -#define ColorTimeline_setFrame(...) spColorTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int TWOCOLOR_ENTRIES = 8; - -typedef struct spTwoColorTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, r, g, b, a, ... */ - int slotIndex; - -#ifdef __cplusplus - spTwoColorTimeline() : - super(), - framesCount(0), - frames(0), - slotIndex(0) { - } -#endif -} spTwoColorTimeline; - -SP_API spTwoColorTimeline* spTwoColorTimeline_create (int framesCount); - -SP_API void spTwoColorTimeline_setFrame (spTwoColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2); - -#ifdef SPINE_SHORT_NAMES -typedef spTwoColorTimeline TwoColorTimeline; -#define TwoColorTimeline_create(...) spTwoColorTimeline_create(__VA_ARGS__) -#define TwoColorTimeline_setFrame(...) spTwoColorTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -typedef struct spAttachmentTimeline { - spTimeline super; - int const framesCount; - float* const frames; /* time, ... */ - int slotIndex; - const char** const attachmentNames; - -#ifdef __cplusplus - spAttachmentTimeline() : - super(), - framesCount(0), - frames(0), - slotIndex(0), - attachmentNames(0) { - } -#endif -} spAttachmentTimeline; - -SP_API spAttachmentTimeline* spAttachmentTimeline_create (int framesCount); - -/* @param attachmentName May be 0. */ -SP_API void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex, float time, const char* attachmentName); - -#ifdef SPINE_SHORT_NAMES -typedef spAttachmentTimeline AttachmentTimeline; -#define AttachmentTimeline_create(...) spAttachmentTimeline_create(__VA_ARGS__) -#define AttachmentTimeline_setFrame(...) spAttachmentTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -typedef struct spEventTimeline { - spTimeline super; - int const framesCount; - float* const frames; /* time, ... */ - spEvent** const events; - -#ifdef __cplusplus - spEventTimeline() : - super(), - framesCount(0), - frames(0), - events(0) { - } -#endif -} spEventTimeline; - -SP_API spEventTimeline* spEventTimeline_create (int framesCount); - -SP_API void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event); - -#ifdef SPINE_SHORT_NAMES -typedef spEventTimeline EventTimeline; -#define EventTimeline_create(...) spEventTimeline_create(__VA_ARGS__) -#define EventTimeline_setFrame(...) spEventTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -typedef struct spDrawOrderTimeline { - spTimeline super; - int const framesCount; - float* const frames; /* time, ... */ - const int** const drawOrders; - int const slotsCount; - -#ifdef __cplusplus - spDrawOrderTimeline() : - super(), - framesCount(0), - frames(0), - drawOrders(0), - slotsCount(0) { - } -#endif -} spDrawOrderTimeline; - -SP_API spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount); - -SP_API void spDrawOrderTimeline_setFrame (spDrawOrderTimeline* self, int frameIndex, float time, const int* drawOrder); - -#ifdef SPINE_SHORT_NAMES -typedef spDrawOrderTimeline DrawOrderTimeline; -#define DrawOrderTimeline_create(...) spDrawOrderTimeline_create(__VA_ARGS__) -#define DrawOrderTimeline_setFrame(...) spDrawOrderTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -typedef struct spDeformTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, ... */ - int const frameVerticesCount; - const float** const frameVertices; - int slotIndex; - spAttachment* attachment; - -#ifdef __cplusplus - spDeformTimeline() : - super(), - framesCount(0), - frames(0), - frameVerticesCount(0), - frameVertices(0), - slotIndex(0) { - } -#endif -} spDeformTimeline; - -SP_API spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCount); - -SP_API void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float time, float* vertices); - -#ifdef SPINE_SHORT_NAMES -typedef spDeformTimeline DeformTimeline; -#define DeformTimeline_create(...) spDeformTimeline_create(__VA_ARGS__) -#define DeformTimeline_setFrame(...) spDeformTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int IKCONSTRAINT_ENTRIES = 3; - -typedef struct spIkConstraintTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, mix, bendDirection, ... */ - int ikConstraintIndex; - -#ifdef __cplusplus - spIkConstraintTimeline() : - super(), - framesCount(0), - frames(0), - ikConstraintIndex(0) { - } -#endif -} spIkConstraintTimeline; - -SP_API spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount); - -SP_API void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, int bendDirection); - -#ifdef SPINE_SHORT_NAMES -typedef spIkConstraintTimeline IkConstraintTimeline; -#define IkConstraintTimeline_create(...) spIkConstraintTimeline_create(__VA_ARGS__) -#define IkConstraintTimeline_setFrame(...) spIkConstraintTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int TRANSFORMCONSTRAINT_ENTRIES = 5; - -typedef struct spTransformConstraintTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */ - int transformConstraintIndex; - -#ifdef __cplusplus - spTransformConstraintTimeline() : - super(), - framesCount(0), - frames(0), - transformConstraintIndex(0) { - } -#endif -} spTransformConstraintTimeline; - -SP_API spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount); - -SP_API void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix); - -#ifdef SPINE_SHORT_NAMES -typedef spTransformConstraintTimeline TransformConstraintTimeline; -#define TransformConstraintTimeline_create(...) spTransformConstraintTimeline_create(__VA_ARGS__) -#define TransformConstraintTimeline_setFrame(...) spTransformConstraintTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int PATHCONSTRAINTPOSITION_ENTRIES = 2; - -typedef struct spPathConstraintPositionTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */ - int pathConstraintIndex; - -#ifdef __cplusplus - spPathConstraintPositionTimeline() : - super(), - framesCount(0), - frames(0), - pathConstraintIndex(0) { - } -#endif -} spPathConstraintPositionTimeline; - -SP_API spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount); - -SP_API void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value); - -#ifdef SPINE_SHORT_NAMES -typedef spPathConstraintPositionTimeline PathConstraintPositionTimeline; -#define PathConstraintPositionTimeline_create(...) spPathConstraintPositionTimeline_create(__VA_ARGS__) -#define PathConstraintPositionTimeline_setFrame(...) spPathConstraintPositionTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int PATHCONSTRAINTSPACING_ENTRIES = 2; - -typedef struct spPathConstraintSpacingTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */ - int pathConstraintIndex; - -#ifdef __cplusplus - spPathConstraintSpacingTimeline() : - super(), - framesCount(0), - frames(0), - pathConstraintIndex(0) { - } -#endif -} spPathConstraintSpacingTimeline; - -SP_API spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount); - -SP_API void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value); - -#ifdef SPINE_SHORT_NAMES -typedef spPathConstraintSpacingTimeline PathConstraintSpacingTimeline; -#define PathConstraintSpacingTimeline_create(...) spPathConstraintSpacingTimeline_create(__VA_ARGS__) -#define PathConstraintSpacingTimeline_setFrame(...) spPathConstraintSpacingTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -static const int PATHCONSTRAINTMIX_ENTRIES = 3; - -typedef struct spPathConstraintMixTimeline { - spCurveTimeline super; - int const framesCount; - float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */ - int pathConstraintIndex; - -#ifdef __cplusplus - spPathConstraintMixTimeline() : - super(), - framesCount(0), - frames(0), - pathConstraintIndex(0) { - } -#endif -} spPathConstraintMixTimeline; - -SP_API spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount); - -SP_API void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float rotateMix, float translateMix); - -#ifdef SPINE_SHORT_NAMES -typedef spPathConstraintMixTimeline PathConstraintMixTimeline; -#define PathConstraintMixTimeline_create(...) spPathConstraintMixTimeline_create(__VA_ARGS__) -#define PathConstraintMixTimeline_setFrame(...) spPathConstraintMixTimeline_setFrame(__VA_ARGS__) -#endif - -/**/ - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ANIMATION_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Animation_h +#define Spine_Animation_h + +#include +#include +#include +#include +#include + +namespace spine { +class Timeline; + +class Skeleton; + +class Event; + +class SP_API Animation : public SpineObject { + friend class AnimationState; + + friend class TrackEntry; + + friend class AnimationStateData; + + friend class AttachmentTimeline; + + friend class ColorTimeline; + + friend class DeformTimeline; + + friend class DrawOrderTimeline; + + friend class EventTimeline; + + friend class IkConstraintTimeline; + + friend class PathConstraintMixTimeline; + + friend class PathConstraintPositionTimeline; + + friend class PathConstraintSpacingTimeline; + + friend class RotateTimeline; + + friend class ScaleTimeline; + + friend class ShearTimeline; + + friend class TransformConstraintTimeline; + + friend class TranslateTimeline; + + friend class TwoColorTimeline; + +public: + Animation(const String &name, Vector &timelines, float duration); + + ~Animation(); + + /// Applies all the animation's timelines to the specified skeleton. + /// See also Timeline::apply(Skeleton&, float, float, Vector, float, MixPose, MixDirection) + void apply(Skeleton &skeleton, float lastTime, float time, bool loop, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction); + + const String &getName(); + + Vector &getTimelines(); + + float getDuration(); + + void setDuration(float inValue); + + + +private: + Vector _timelines; + float _duration; + String _name; + + /// @param target After the first and before the last entry. + static int binarySearch(Vector &values, float target, int step); + + /// @param target After the first and before the last entry. + static int binarySearch(Vector &values, float target); + + static int linearSearch(Vector &values, float target, int step); +}; +} + +#endif /* Spine_Animation_h */ diff --git a/cocos/editor-support/spine/AnimationState.c b/cocos/editor-support/spine/AnimationState.c deleted file mode 100644 index 5e644edd225..00000000000 --- a/cocos/editor-support/spine/AnimationState.c +++ /dev/null @@ -1,963 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -#define SUBSEQUENT 0 -#define FIRST 1 -#define DIP 2 -#define DIP_MIX 3 - -_SP_ARRAY_IMPLEMENT_TYPE(spTrackEntryArray, spTrackEntry*) - -static spAnimation* SP_EMPTY_ANIMATION = 0; -static TrackEntryDisposeCallback _trackEntryDisposeCallback = 0; - -void spAnimationState_disposeStatics () { - if (SP_EMPTY_ANIMATION) spAnimation_dispose(SP_EMPTY_ANIMATION); - SP_EMPTY_ANIMATION = 0; -} - -/* Forward declaration of some "private" functions so we can keep - the same function order in C as we have method order in Java */ -void _spAnimationState_disposeTrackEntry (spTrackEntry* entry); -void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntry* entry); -int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTrackEntry* entry, float delta); -float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* entry, spSkeleton* skeleton, spMixPose currentPose); -void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float time, float alpha, spMixPose pose, float* timelinesRotation, int i, int /*boolean*/ firstFrame); -void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry, float animationTime); -void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current, int /*boolean*/ interrupt); -spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index); -spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackIndex, spAnimation* animation, int /*boolean*/ loop, spTrackEntry* last); -void _spAnimationState_disposeNext (spAnimationState* self, spTrackEntry* entry); -void _spAnimationState_animationsChanged (spAnimationState* self); -float* _spAnimationState_resizeTimelinesRotation(spTrackEntry* entry, int newSize); -int* _spAnimationState_resizeTimelinesFirst(spTrackEntry* entry, int newSize); -void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState* self, int capacity); -int _spAnimationState_addPropertyID(spAnimationState* self, int id); -spTrackEntry* _spTrackEntry_setTimelineData(spTrackEntry* self, spTrackEntry* to, spTrackEntryArray* mixingToArray, spAnimationState* state); - - -_spEventQueue* _spEventQueue_create (_spAnimationState* state) { - _spEventQueue *self = CALLOC(_spEventQueue, 1); - self->state = state; - self->objectsCount = 0; - self->objectsCapacity = 16; - self->objects = CALLOC(_spEventQueueItem, self->objectsCapacity); - self->drainDisabled = 0; - return self; -} - -void _spEventQueue_free (_spEventQueue* self) { - FREE(self->objects); - FREE(self); -} - -void _spEventQueue_ensureCapacity (_spEventQueue* self, int newElements) { - if (self->objectsCount + newElements > self->objectsCapacity) { - _spEventQueueItem* newObjects; - self->objectsCapacity <<= 1; - newObjects = CALLOC(_spEventQueueItem, self->objectsCapacity); - memcpy(newObjects, self->objects, sizeof(_spEventQueueItem) * self->objectsCount); - FREE(self->objects); - self->objects = newObjects; - } -} - -void _spEventQueue_addType (_spEventQueue* self, spEventType type) { - _spEventQueue_ensureCapacity(self, 1); - self->objects[self->objectsCount++].type = type; -} - -void _spEventQueue_addEntry (_spEventQueue* self, spTrackEntry* entry) { - _spEventQueue_ensureCapacity(self, 1); - self->objects[self->objectsCount++].entry = entry; -} - -void _spEventQueue_addEvent (_spEventQueue* self, spEvent* event) { - _spEventQueue_ensureCapacity(self, 1); - self->objects[self->objectsCount++].event = event; -} - -void _spEventQueue_start (_spEventQueue* self, spTrackEntry* entry) { - _spEventQueue_addType(self, SP_ANIMATION_START); - _spEventQueue_addEntry(self, entry); - self->state->animationsChanged = 1; -} - -void _spEventQueue_interrupt (_spEventQueue* self, spTrackEntry* entry) { - _spEventQueue_addType(self, SP_ANIMATION_INTERRUPT); - _spEventQueue_addEntry(self, entry); -} - -void _spEventQueue_end (_spEventQueue* self, spTrackEntry* entry) { - _spEventQueue_addType(self, SP_ANIMATION_END); - _spEventQueue_addEntry(self, entry); - self->state->animationsChanged = 1; -} - -void _spEventQueue_dispose (_spEventQueue* self, spTrackEntry* entry) { - _spEventQueue_addType(self, SP_ANIMATION_DISPOSE); - _spEventQueue_addEntry(self, entry); -} - -void _spEventQueue_complete (_spEventQueue* self, spTrackEntry* entry) { - _spEventQueue_addType(self, SP_ANIMATION_COMPLETE); - _spEventQueue_addEntry(self, entry); -} - -void _spEventQueue_event (_spEventQueue* self, spTrackEntry* entry, spEvent* event) { - _spEventQueue_addType(self, SP_ANIMATION_EVENT); - _spEventQueue_addEntry(self, entry); - _spEventQueue_addEvent(self, event); -} - -void _spEventQueue_clear (_spEventQueue* self) { - self->objectsCount = 0; -} - -void _spEventQueue_drain (_spEventQueue* self) { - int i; - if (self->drainDisabled) return; - self->drainDisabled = 1; - for (i = 0; i < self->objectsCount; i += 2) { - spEventType type = (spEventType)self->objects[i].type; - spTrackEntry* entry = self->objects[i+1].entry; - spEvent* event; - switch (type) { - case SP_ANIMATION_START: - case SP_ANIMATION_INTERRUPT: - case SP_ANIMATION_COMPLETE: - if (entry->listener) entry->listener(SUPER(self->state), type, entry, 0); - if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, 0); - break; - case SP_ANIMATION_END: - if (entry->listener) entry->listener(SUPER(self->state), type, entry, 0); - if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, 0); - /* Fall through. */ - case SP_ANIMATION_DISPOSE: - if (entry->listener) entry->listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0); - if (self->state->super.listener) self->state->super.listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0); - _spAnimationState_disposeTrackEntry(entry); - break; - case SP_ANIMATION_EVENT: - event = self->objects[i+2].event; - if (entry->listener) entry->listener(SUPER(self->state), type, entry, event); - if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, event); - i++; - break; - } - } - _spEventQueue_clear(self); - - self->drainDisabled = 0; -} - -/* These two functions are needed in the UE4 runtime, see #1037 */ -void _spAnimationState_enableQueue(spAnimationState* self) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - internal->queue->drainDisabled = 0; -} - -void _spAnimationState_disableQueue(spAnimationState* self) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - internal->queue->drainDisabled = 1; -} - -void _spAnimationState_disposeTrackEntry (spTrackEntry* entry) { - if (_trackEntryDisposeCallback) - { - _trackEntryDisposeCallback(entry); - } - - spIntArray_dispose(entry->timelineData); - spTrackEntryArray_dispose(entry->timelineDipMix); - FREE(entry->timelinesRotation); - FREE(entry); -} - -void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntry* entry) { - while (entry) { - spTrackEntry* next = entry->next; - spTrackEntry* from = entry->mixingFrom; - while (from) { - spTrackEntry* nextFrom = from->mixingFrom; - if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, from, 0); - if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, from, 0); - _spAnimationState_disposeTrackEntry(from); - from = nextFrom; - } - if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, entry, 0); - if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, entry, 0); - _spAnimationState_disposeTrackEntry(entry); - entry = next; - } -} - -void spTrackEntry_setDisposeCallback(TrackEntryDisposeCallback cb) -{ - _trackEntryDisposeCallback = cb; -} - -spAnimationState* spAnimationState_create (spAnimationStateData* data) { - _spAnimationState* internal; - spAnimationState* self; - - if (!SP_EMPTY_ANIMATION) { - SP_EMPTY_ANIMATION = (spAnimation*)1; /* dirty trick so we can recursively call spAnimation_create */ - SP_EMPTY_ANIMATION = spAnimation_create("", 0); - } - - internal = NEW(_spAnimationState); - self = SUPER(internal); - - CONST_CAST(spAnimationStateData*, self->data) = data; - self->timeScale = 1; - - internal->queue = _spEventQueue_create(internal); - internal->events = CALLOC(spEvent*, 128); - - internal->propertyIDs = CALLOC(int, 128); - internal->propertyIDsCapacity = 128; - - self->mixingTo = spTrackEntryArray_create(16); - - return self; -} - -void spAnimationState_dispose (spAnimationState* self) { - int i; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - for (i = 0; i < self->tracksCount; i++) - _spAnimationState_disposeTrackEntries(self, self->tracks[i]); - FREE(self->tracks); - _spEventQueue_free(internal->queue); - FREE(internal->events); - FREE(internal->propertyIDs); - spTrackEntryArray_dispose(self->mixingTo); - FREE(internal); -} - -void spAnimationState_update (spAnimationState* self, float delta) { - int i, n; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - delta *= self->timeScale; - for (i = 0, n = self->tracksCount; i < n; i++) { - float currentDelta; - spTrackEntry* current = self->tracks[i]; - spTrackEntry* next; - if (!current) continue; - - current->animationLast = current->nextAnimationLast; - current->trackLast = current->nextTrackLast; - - currentDelta = delta * current->timeScale; - - if (current->delay > 0) { - current->delay -= currentDelta; - if (current->delay > 0) continue; - currentDelta = -current->delay; - current->delay = 0; - } - - next = current->next; - if (next) { - /* When the next entry's delay is passed, change to the next entry, preserving leftover time. */ - float nextTime = current->trackLast - next->delay; - if (nextTime >= 0) { - next->delay = 0; - next->trackTime = nextTime + delta * next->timeScale; - current->trackTime += currentDelta; - _spAnimationState_setCurrent(self, i, next, 1); - while (next->mixingFrom) { - next->mixTime += currentDelta; - next = next->mixingFrom; - } - continue; - } - } else { - /* Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom. */ - if (current->trackLast >= current->trackEnd && current->mixingFrom == 0) { - self->tracks[i] = 0; - _spEventQueue_end(internal->queue, current); - _spAnimationState_disposeNext(self, current); - continue; - } - } - if (current->mixingFrom != 0 && _spAnimationState_updateMixingFrom(self, current, delta)) { - /* End mixing from entries once all have completed. */ - spTrackEntry* from = current->mixingFrom; - current->mixingFrom = 0; - while (from != 0) { - _spEventQueue_end(internal->queue, from); - from = from->mixingFrom; - } - } - - current->trackTime += currentDelta; - } - - _spEventQueue_drain(internal->queue); -} - -int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTrackEntry* to, float delta) { - spTrackEntry* from = to->mixingFrom; - int finished; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - if (!from) return -1; - - finished = _spAnimationState_updateMixingFrom(self, from, delta); - - from->animationLast = from->nextAnimationLast; - from->trackLast = from->nextTrackLast; - - /* Require mixTime > 0 to ensure the mixing from entry was applied at least once. */ - if (to->mixTime > 0 && (to->mixTime >= to->mixDuration || to->timeScale == 0)) { - /* Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). */ - if (from->totalAlpha == 0 || to->mixDuration == 0) { - to->mixingFrom = from->mixingFrom; - to->interruptAlpha = from->interruptAlpha; - _spEventQueue_end(internal->queue, from); - } - return finished; - } - - from->trackTime += delta * from->timeScale; - to->mixTime += delta * to->timeScale; - return 0; -} - -int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - spTrackEntry* current; - int i, ii, n; - float animationLast, animationTime; - int timelineCount; - spTimeline** timelines; - int /*boolean*/ firstFrame; - float* timelinesRotation; - spTimeline* timeline; - int applied = 0; - spMixPose currentPose; - spMixPose pose; - - if (internal->animationsChanged) _spAnimationState_animationsChanged(self); - - for (i = 0, n = self->tracksCount; i < n; i++) { - float mix; - current = self->tracks[i]; - if (!current || current->delay > 0) continue; - applied = -1; - currentPose = i == 0 ? SP_MIX_POSE_CURRENT : SP_MIX_POSE_CURRENT_LAYERED; - - /* Apply mixing from entries first. */ - mix = current->alpha; - if (current->mixingFrom) - mix *= _spAnimationState_applyMixingFrom(self, current, skeleton, currentPose); - else if (current->trackTime >= current->trackEnd && current->next == 0) - mix = 0; - - /* Apply current entry. */ - animationLast = current->animationLast; animationTime = spTrackEntry_getAnimationTime(current); - timelineCount = current->animation->timelinesCount; - timelines = current->animation->timelines; - if (mix == 1) { - for (ii = 0; ii < timelineCount; ii++) - spTimeline_apply(timelines[ii], skeleton, animationLast, animationTime, internal->events, &internal->eventsCount, 1, SP_MIX_POSE_SETUP, SP_MIX_DIRECTION_IN); - } else { - spIntArray* timelineData = current->timelineData; - - firstFrame = current->timelinesRotationCount == 0; - if (firstFrame) _spAnimationState_resizeTimelinesRotation(current, timelineCount << 1); - timelinesRotation = current->timelinesRotation; - - for (ii = 0; ii < timelineCount; ii++) { - timeline = timelines[ii]; - pose = timelineData->items[ii] >= FIRST ? SP_MIX_POSE_SETUP : currentPose; - if (timeline->type == SP_TIMELINE_ROTATE) - _spAnimationState_applyRotateTimeline(self, timeline, skeleton, animationTime, mix, pose, timelinesRotation, ii << 1, firstFrame); - else - spTimeline_apply(timeline, skeleton, animationLast, animationTime, internal->events, &internal->eventsCount, mix, pose, SP_MIX_DIRECTION_IN); - } - } - _spAnimationState_queueEvents(self, current, animationTime); - internal->eventsCount = 0; - current->nextAnimationLast = animationTime; - current->nextTrackLast = current->trackTime; - } - - _spEventQueue_drain(internal->queue); - return applied; -} - -float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* to, spSkeleton* skeleton, spMixPose currentPose) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - float mix; - spEvent** events; - int /*boolean*/ attachments; - int /*boolean*/ drawOrder; - float animationLast; - float animationTime; - int timelineCount; - spTimeline** timelines; - spIntArray* timelineData; - spTrackEntryArray* timelineDipMix; - float alphaDip; - float alphaMix; - float alpha; - int /*boolean*/ firstFrame; - float* timelinesRotation; - spMixPose pose; - int i; - spTrackEntry* dipMix; - - spTrackEntry* from = to->mixingFrom; - if (from->mixingFrom) _spAnimationState_applyMixingFrom(self, from, skeleton, currentPose); - - if (to->mixDuration == 0) { /* Single frame mix to undo mixingFrom changes. */ - mix = 1; - currentPose = SP_MIX_POSE_SETUP; - } else { - mix = to->mixTime / to->mixDuration; - if (mix > 1) mix = 1; - } - - events = mix < from->eventThreshold ? internal->events : 0; - attachments = mix < from->attachmentThreshold; - drawOrder = mix < from->drawOrderThreshold; - animationLast = from->animationLast; - animationTime = spTrackEntry_getAnimationTime(from); - timelineCount = from->animation->timelinesCount; - timelines = from->animation->timelines; - timelineData = from->timelineData; - timelineDipMix = from->timelineDipMix; - - firstFrame = from->timelinesRotationCount == 0; - if (firstFrame) _spAnimationState_resizeTimelinesRotation(from, timelineCount << 1); - timelinesRotation = from->timelinesRotation; - - alphaDip = from->alpha * to->interruptAlpha; alphaMix = alphaDip * (1 - mix); - from->totalAlpha = 0; - for (i = 0; i < timelineCount; i++) { - spTimeline* timeline = timelines[i]; - switch (timelineData->items[i]) { - case SUBSEQUENT: - if (!attachments && timeline->type == SP_TIMELINE_ATTACHMENT) continue; - if (!drawOrder && timeline->type == SP_TIMELINE_DRAWORDER) continue; - pose = currentPose; - alpha = alphaMix; - break; - case FIRST: - pose = SP_MIX_POSE_SETUP; - alpha = alphaMix; - break; - case DIP: - pose = SP_MIX_POSE_SETUP; - alpha = alphaDip; - break; - default: - pose = SP_MIX_POSE_SETUP; - alpha = alphaDip; - dipMix = timelineDipMix->items[i]; - alpha *= MAX(0, 1 - dipMix->mixTime / dipMix->mixDuration); - break; - } - from->totalAlpha += alpha; - if (timeline->type == SP_TIMELINE_ROTATE) - _spAnimationState_applyRotateTimeline(self, timeline, skeleton, animationTime, alpha, pose, timelinesRotation, i << 1, firstFrame); - else { - spTimeline_apply(timeline, skeleton, animationLast, animationTime, events, &internal->eventsCount, alpha, pose, SP_MIX_DIRECTION_OUT); - } - } - - - if (to->mixDuration > 0) _spAnimationState_queueEvents(self, from, animationTime); - internal->eventsCount = 0; - from->nextAnimationLast = animationTime; - from->nextTrackLast = from->trackTime; - - return mix; -} - -void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float time, float alpha, spMixPose pose, float* timelinesRotation, int i, int /*boolean*/ firstFrame) { - spRotateTimeline *rotateTimeline; - float *frames; - spBone* bone; - float r1, r2; - int frame; - float prevRotation; - float frameTime; - float percent; - float total, diff; - int /*boolean*/ current, dir; - - if (firstFrame) timelinesRotation[i] = 0; - - if (alpha == 1) { - spTimeline_apply(timeline, skeleton, 0, time, 0, 0, 1, pose, SP_MIX_DIRECTION_IN); - return; - } - - rotateTimeline = SUB_CAST(spRotateTimeline, timeline); - frames = rotateTimeline->frames; - bone = skeleton->bones[rotateTimeline->boneIndex]; - if (time < frames[0]) { - if (pose == SP_MIX_POSE_SETUP) { - bone->rotation = bone->data->rotation; - } - return; /* Time is before first frame. */ - } - - if (time >= frames[rotateTimeline->framesCount - ROTATE_ENTRIES]) /* Time is after last frame. */ - r2 = bone->data->rotation + frames[rotateTimeline->framesCount + ROTATE_PREV_ROTATION]; - else { - /* Interpolate between the previous frame and the current frame. */ - frame = _spCurveTimeline_binarySearch(frames, rotateTimeline->framesCount, time, ROTATE_ENTRIES); - prevRotation = frames[frame + ROTATE_PREV_ROTATION]; - frameTime = frames[frame]; - percent = spCurveTimeline_getCurvePercent(SUPER(rotateTimeline), (frame >> 1) - 1, - 1 - (time - frameTime) / (frames[frame + ROTATE_PREV_TIME] - frameTime)); - - r2 = frames[frame + ROTATE_ROTATION] - prevRotation; - r2 -= (16384 - (int)(16384.499999999996 - r2 / 360)) * 360; - r2 = prevRotation + r2 * percent + bone->data->rotation; - r2 -= (16384 - (int)(16384.499999999996 - r2 / 360)) * 360; - } - - /* Mix between rotations using the direction of the shortest route on the first frame while detecting crosses. */ - r1 = pose == SP_MIX_POSE_SETUP ? bone->data->rotation : bone->rotation; - diff = r2 - r1; - if (diff == 0) { - total = timelinesRotation[i]; - } else { - float lastTotal, lastDiff; - diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360; - if (firstFrame) { - lastTotal = 0; - lastDiff = diff; - } else { - lastTotal = timelinesRotation[i]; /* Angle and direction of mix, including loops. */ - lastDiff = timelinesRotation[i + 1]; /* Difference between bones. */ - } - current = diff > 0; - dir = lastTotal >= 0; - /* Detect cross at 0 (not 180). */ - if (SIGNUM(lastDiff) != SIGNUM(diff) && ABS(lastDiff) <= 90) { - /* A cross after a 360 rotation is a loop. */ - if (ABS(lastTotal) > 180) lastTotal += 360 * SIGNUM(lastTotal); - dir = current; - } - total = diff + lastTotal - FMOD(lastTotal, 360); /* Store loops as part of lastTotal. */ - if (dir != current) total += 360 * SIGNUM(lastTotal); - timelinesRotation[i] = total; - } - timelinesRotation[i + 1] = diff; - r1 += total * alpha; - bone->rotation = r1 - (16384 - (int)(16384.499999999996 - r1 / 360)) * 360; -} - -void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry, float animationTime) { - spEvent** events; - spEvent* event; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - int i, n, complete; - float animationStart = entry->animationStart, animationEnd = entry->animationEnd; - float duration = animationEnd - animationStart; - float trackLastWrapped = FMOD(entry->trackLast, duration); - - /* Queue events before complete. */ - events = internal->events; - for (i = 0, n = internal->eventsCount; i < n; i++) { - event = events[i]; - if (event->time < trackLastWrapped) break; - if (event->time > animationEnd) continue; /* Discard events outside animation start/end. */ - _spEventQueue_event(internal->queue, entry, event); - } - - /* Queue complete if completed a loop iteration or the animation. */ - if (entry->loop) - complete = duration == 0 || (trackLastWrapped > FMOD(entry->trackTime, duration)); - else - complete = (animationTime >= animationEnd && entry->animationLast < animationEnd); - if (complete) _spEventQueue_complete(internal->queue, entry); - - /* Queue events after complete. */ - for (; i < n; i++) { - event = events[i]; - if (event->time < animationStart) continue; /* Discard events outside animation start/end. */ - _spEventQueue_event(internal->queue, entry, event); - } -} - -void spAnimationState_clearTracks (spAnimationState* self) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - int i, n, oldDrainDisabled; - oldDrainDisabled = internal->queue->drainDisabled; - internal->queue->drainDisabled = 1; - for (i = 0, n = self->tracksCount; i < n; i++) - spAnimationState_clearTrack(self, i); - self->tracksCount = 0; - internal->queue->drainDisabled = oldDrainDisabled; - _spEventQueue_drain(internal->queue); -} - -void spAnimationState_clearTrack (spAnimationState* self, int trackIndex) { - spTrackEntry* current; - spTrackEntry* entry; - spTrackEntry* from; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - - if (trackIndex >= self->tracksCount) return; - current = self->tracks[trackIndex]; - if (!current) return; - - _spEventQueue_end(internal->queue, current); - - _spAnimationState_disposeNext(self, current); - - entry = current; - while (1) { - from = entry->mixingFrom; - if (!from) break; - _spEventQueue_end(internal->queue, from); - entry->mixingFrom = 0; - entry = from; - } - - self->tracks[current->trackIndex] = 0; - _spEventQueue_drain(internal->queue); -} - -void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current, int /*boolean*/ interrupt) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - spTrackEntry* from = _spAnimationState_expandToIndex(self, index); - self->tracks[index] = current; - - if (from) { - if (interrupt) _spEventQueue_interrupt(internal->queue, from); - current->mixingFrom = from; - current->mixTime = 0; - - /* Store the interrupted mix percentage. */ - if (from->mixingFrom != 0 && from->mixDuration > 0) - current->interruptAlpha *= MIN(1, from->mixTime / from->mixDuration); - - from->timelinesRotationCount = 0; - } - - _spEventQueue_start(internal->queue, current); -} - -/** Set the current animation. Any queued animations are cleared. */ -spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, - int/*bool*/loop) { - spAnimation* animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName); - return spAnimationState_setAnimation(self, trackIndex, animation, loop); -} - -spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop) { - spTrackEntry* entry; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - int interrupt = 1; - spTrackEntry* current = _spAnimationState_expandToIndex(self, trackIndex); - if (current) { - if (current->nextTrackLast == -1) { - /* Don't mix from an entry that was never applied. */ - self->tracks[trackIndex] = current->mixingFrom; - _spEventQueue_interrupt(internal->queue, current); - _spEventQueue_end(internal->queue, current); - _spAnimationState_disposeNext(self, current); - current = current->mixingFrom; - interrupt = 0; - } else - _spAnimationState_disposeNext(self, current); - } - entry = _spAnimationState_trackEntry(self, trackIndex, animation, loop, current); - _spAnimationState_setCurrent(self, trackIndex, entry, interrupt); - _spEventQueue_drain(internal->queue); - return entry; -} - -/** Adds an animation to be played delay seconds after the current or last queued animation, taking into account any mix - * duration. */ -spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, - int/*bool*/loop, float delay) { - spAnimation* animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName); - return spAnimationState_addAnimation(self, trackIndex, animation, loop, delay); -} - -spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop, - float delay) { - spTrackEntry* entry; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - spTrackEntry* last = _spAnimationState_expandToIndex(self, trackIndex); - if (last) { - while (last->next) - last = last->next; - } - - entry = _spAnimationState_trackEntry(self, trackIndex, animation, loop, last); - - if (!last) { - _spAnimationState_setCurrent(self, trackIndex, entry, 1); - _spEventQueue_drain(internal->queue); - } else { - last->next = entry; - if (delay <= 0) { - float duration = last->animationEnd - last->animationStart; - if (duration != 0) { - if (last->loop) { - delay += duration * (1 + (int) (last->trackTime / duration)); - } else { - delay += duration; - } - delay -= spAnimationStateData_getMix(self->data, last->animation, animation); - } else - delay = 0; - } - } - - entry->delay = delay; - return entry; -} - -spTrackEntry* spAnimationState_setEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration) { - spTrackEntry* entry = spAnimationState_setAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0); - entry->mixDuration = mixDuration; - entry->trackEnd = mixDuration; - return entry; -} - -spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration, float delay) { - spTrackEntry* entry; - if (delay <= 0) delay -= mixDuration; - entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay); - entry->mixDuration = mixDuration; - entry->trackEnd = mixDuration; - return entry; -} - -void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration) { - int i, n, oldDrainDisabled; - spTrackEntry* current; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - oldDrainDisabled = internal->queue->drainDisabled; - internal->queue->drainDisabled = 1; - for (i = 0, n = self->tracksCount; i < n; i++) { - current = self->tracks[i]; - if (current) spAnimationState_setEmptyAnimation(self, current->trackIndex, mixDuration); - } - internal->queue->drainDisabled = oldDrainDisabled; - _spEventQueue_drain(internal->queue); -} - -spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index) { - spTrackEntry** newTracks; - if (index < self->tracksCount) return self->tracks[index]; - newTracks = CALLOC(spTrackEntry*, index + 1); - memcpy(newTracks, self->tracks, self->tracksCount * sizeof(spTrackEntry*)); - FREE(self->tracks); - self->tracks = newTracks; - self->tracksCount = index + 1; - return 0; -} - -spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackIndex, spAnimation* animation, int /*boolean*/ loop, spTrackEntry* last) { - spTrackEntry* entry = NEW(spTrackEntry); - entry->trackIndex = trackIndex; - entry->animation = animation; - entry->loop = loop; - - entry->eventThreshold = 0; - entry->attachmentThreshold = 0; - entry->drawOrderThreshold = 0; - - entry->animationStart = 0; - entry->animationEnd = animation->duration; - entry->animationLast = -1; - entry->nextAnimationLast = -1; - - entry->delay = 0; - entry->trackTime = 0; - entry->trackLast = -1; - entry->nextTrackLast = -1; - entry->trackEnd = (float)INT_MAX; - entry->timeScale = 1; - - entry->alpha = 1; - entry->interruptAlpha = 1; - entry->mixTime = 0; - entry->mixDuration = !last ? 0 : spAnimationStateData_getMix(self->data, last->animation, animation); - - entry->timelineData = spIntArray_create(16); - entry->timelineDipMix = spTrackEntryArray_create(16); - return entry; -} - -void _spAnimationState_disposeNext (spAnimationState* self, spTrackEntry* entry) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - spTrackEntry* next = entry->next; - while (next) { - _spEventQueue_dispose(internal->queue, next); - next = next->next; - } - entry->next = 0; -} - -void _spAnimationState_animationsChanged (spAnimationState* self) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - int i, n; - spTrackEntry* entry; - spTrackEntryArray* mixingTo; - internal->animationsChanged = 0; - - internal->propertyIDsCount = 0; - i = 0; n = self->tracksCount; - - mixingTo = self->mixingTo; - - for (;i < n; i++) { - entry = self->tracks[i]; - if (entry != 0) _spTrackEntry_setTimelineData(entry, 0, mixingTo, self); - } -} - -float* _spAnimationState_resizeTimelinesRotation(spTrackEntry* entry, int newSize) { - if (entry->timelinesRotationCount != newSize) { - float* newTimelinesRotation = CALLOC(float, newSize); - FREE(entry->timelinesRotation); - entry->timelinesRotation = newTimelinesRotation; - entry->timelinesRotationCount = newSize; - } - return entry->timelinesRotation; -} - -void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState* self, int capacity) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - if (internal->propertyIDsCapacity < capacity) { - int *newPropertyIDs = CALLOC(int, capacity << 1); - memcpy(newPropertyIDs, internal->propertyIDs, sizeof(int) * internal->propertyIDsCount); - FREE(internal->propertyIDs); - internal->propertyIDs = newPropertyIDs; - internal->propertyIDsCapacity = capacity << 1; - } -} - -int _spAnimationState_addPropertyID(spAnimationState* self, int id) { - int i, n; - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - - for (i = 0, n = internal->propertyIDsCount; i < n; i++) { - if (internal->propertyIDs[i] == id) return 0; - } - - _spAnimationState_ensureCapacityPropertyIDs(self, internal->propertyIDsCount + 1); - internal->propertyIDs[internal->propertyIDsCount] = id; - internal->propertyIDsCount++; - return 1; -} - -spTrackEntry* spAnimationState_getCurrent (spAnimationState* self, int trackIndex) { - if (trackIndex >= self->tracksCount) return 0; - return self->tracks[trackIndex]; -} - -void spAnimationState_clearListenerNotifications(spAnimationState* self) { - _spAnimationState* internal = SUB_CAST(_spAnimationState, self); - _spEventQueue_clear(internal->queue); -} - -float spTrackEntry_getAnimationTime (spTrackEntry* entry) { - if (entry->loop) { - float duration = entry->animationEnd - entry->animationStart; - if (duration == 0) return entry->animationStart; - return FMOD(entry->trackTime, duration) + entry->animationStart; - } - return MIN(entry->trackTime + entry->animationStart, entry->animationEnd); -} - -int /*boolean*/ _spTrackEntry_hasTimeline(spTrackEntry* self, int id) { - spTimeline** timelines = self->animation->timelines; - int i, n; - for (i = 0, n = self->animation->timelinesCount; i < n; i++) - if (spTimeline_getPropertyId(timelines[i]) == id) return 1; - return 0; -} - -spTrackEntry* _spTrackEntry_setTimelineData(spTrackEntry* self, spTrackEntry* to, spTrackEntryArray* mixingToArray, spAnimationState* state) { - spTrackEntry* lastEntry; - spTrackEntry** mixingTo; - int mixingToLast; - spTimeline** timelines; - int timelinesCount; - int* timelineData; - spTrackEntry** timelineDipMix; - int i, ii; - - if (to != 0) spTrackEntryArray_add(mixingToArray, to); - lastEntry = self->mixingFrom != 0 ? _spTrackEntry_setTimelineData(self->mixingFrom, self, mixingToArray, state) : self; - if (to != 0) spTrackEntryArray_pop(mixingToArray); - - mixingTo = mixingToArray->items; - mixingToLast = mixingToArray->size - 1; - timelines = self->animation->timelines; - timelinesCount = self->animation->timelinesCount; - timelineData = spIntArray_setSize(self->timelineData, timelinesCount)->items; - spTrackEntryArray_clear(self->timelineDipMix); - timelineDipMix = spTrackEntryArray_setSize(self->timelineDipMix, timelinesCount)->items; - - i = 0; - continue_outer: - for (; i < timelinesCount; i++) { - int id = spTimeline_getPropertyId(timelines[i]); - if (!_spAnimationState_addPropertyID(state, id)) - timelineData[i] = SUBSEQUENT; - else if (to == 0 || !_spTrackEntry_hasTimeline(to, id)) - timelineData[i] = FIRST; - else { - for (ii = mixingToLast; ii >= 0; ii--) { - spTrackEntry* entry = mixingTo[ii]; - if (!_spTrackEntry_hasTimeline(entry, id)) { - if (entry->mixDuration > 0) { - timelineData[i] = DIP_MIX; - timelineDipMix[i] = entry; - i++; - goto continue_outer; - } - } - break; - } - timelineData[i] = DIP; - } - } - return lastEntry; -} diff --git a/cocos/editor-support/spine/AnimationState.cpp b/cocos/editor-support/spine/AnimationState.cpp new file mode 100644 index 00000000000..67456c25811 --- /dev/null +++ b/cocos/editor-support/spine/AnimationState.cpp @@ -0,0 +1,1031 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace spine; + +void dummyOnAnimationEventFunc(AnimationState *state, spine::EventType type, TrackEntry *entry, Event *event = NULL) { + SP_UNUSED(state); + SP_UNUSED(type); + SP_UNUSED(entry); + SP_UNUSED(event); +} + +TrackEntry::TrackEntry() : _animation(NULL), _next(NULL), _mixingFrom(NULL), _mixingTo(0), _trackIndex(0), _loop(false), _holdPrevious(false), + _eventThreshold(0), _attachmentThreshold(0), _drawOrderThreshold(0), _animationStart(0), + _animationEnd(0), _animationLast(0), _nextAnimationLast(0), _delay(0), _trackTime(0), + _trackLast(0), _nextTrackLast(0), _trackEnd(0), _timeScale(1.0f), _alpha(0), _mixTime(0), + _mixDuration(0), _interruptAlpha(0), _totalAlpha(0), _mixBlend(MixBlend_Replace), + _listener(dummyOnAnimationEventFunc) { +} + +TrackEntry::~TrackEntry() { } + +int TrackEntry::getTrackIndex() { return _trackIndex; } + +Animation *TrackEntry::getAnimation() { return _animation; } + +bool TrackEntry::getLoop() { return _loop; } + +void TrackEntry::setLoop(bool inValue) { _loop = inValue; } + +bool TrackEntry::getHoldPrevious() { return _holdPrevious; } + +void TrackEntry::setHoldPrevious(bool inValue) { _holdPrevious = inValue; } + +float TrackEntry::getDelay() { return _delay; } + +void TrackEntry::setDelay(float inValue) { _delay = inValue; } + +float TrackEntry::getTrackTime() { return _trackTime; } + +void TrackEntry::setTrackTime(float inValue) { _trackTime = inValue; } + +float TrackEntry::getTrackEnd() { return _trackEnd; } + +void TrackEntry::setTrackEnd(float inValue) { _trackEnd = inValue; } + +float TrackEntry::getAnimationStart() { return _animationStart; } + +void TrackEntry::setAnimationStart(float inValue) { _animationStart = inValue; } + +float TrackEntry::getAnimationEnd() { return _animationEnd; } + +void TrackEntry::setAnimationEnd(float inValue) { _animationEnd = inValue; } + +float TrackEntry::getAnimationLast() { return _animationLast; } + +void TrackEntry::setAnimationLast(float inValue) { + _animationLast = inValue; + _nextAnimationLast = inValue; +} + +float TrackEntry::getAnimationTime() { + if (_loop) { + float duration = _animationEnd - _animationStart; + if (duration == 0) { + return _animationStart; + } + + return MathUtil::fmod(_trackTime, duration) + _animationStart; + } + + return MathUtil::min(_trackTime + _animationStart, _animationEnd); +} + +float TrackEntry::getTimeScale() { return _timeScale; } + +void TrackEntry::setTimeScale(float inValue) { _timeScale = inValue; } + +float TrackEntry::getAlpha() { return _alpha; } + +void TrackEntry::setAlpha(float inValue) { _alpha = inValue; } + +float TrackEntry::getEventThreshold() { return _eventThreshold; } + +void TrackEntry::setEventThreshold(float inValue) { _eventThreshold = inValue; } + +float TrackEntry::getAttachmentThreshold() { return _attachmentThreshold; } + +void TrackEntry::setAttachmentThreshold(float inValue) { _attachmentThreshold = inValue; } + +float TrackEntry::getDrawOrderThreshold() { return _drawOrderThreshold; } + +void TrackEntry::setDrawOrderThreshold(float inValue) { _drawOrderThreshold = inValue; } + +TrackEntry *TrackEntry::getNext() { return _next; } + +bool TrackEntry::isComplete() { + return _trackTime >= _animationEnd - _animationStart; +} + +float TrackEntry::getMixTime() { return _mixTime; } + +void TrackEntry::setMixTime(float inValue) { _mixTime = inValue; } + +float TrackEntry::getMixDuration() { return _mixDuration; } + +void TrackEntry::setMixDuration(float inValue) { _mixDuration = inValue; } + +TrackEntry *TrackEntry::getMixingFrom() { return _mixingFrom; } + +TrackEntry *TrackEntry::getMixingTo() { return _mixingTo; } + +void TrackEntry::setMixBlend(MixBlend blend) { _mixBlend = blend; } + +MixBlend TrackEntry::getMixBlend() { return _mixBlend; } + +void TrackEntry::resetRotationDirections() { + _timelinesRotation.clear(); +} + +void TrackEntry::setListener(AnimationStateListener inValue) { + _listener = inValue; +} + +void TrackEntry::reset() { + _animation = NULL; + _next = NULL; + _mixingFrom = NULL; + _mixingTo = NULL; + + setRendererObject(NULL); + + _timelineMode.clear(); + _timelineHoldMix.clear(); + _timelinesRotation.clear(); + + _listener = dummyOnAnimationEventFunc; +} + +EventQueueEntry::EventQueueEntry(EventType eventType, TrackEntry *trackEntry, Event *event) : + _type(eventType), + _entry(trackEntry), + _event(event) { +} + +EventQueue *EventQueue::newEventQueue(AnimationState &state, Pool &trackEntryPool) { + return new(__FILE__, __LINE__) EventQueue(state, trackEntryPool); +} + +EventQueueEntry EventQueue::newEventQueueEntry(EventType eventType, TrackEntry *entry, Event *event) { + return EventQueueEntry(eventType, entry, event); +} + +EventQueue::EventQueue(AnimationState &state, Pool &trackEntryPool) : _state(state), + _trackEntryPool(trackEntryPool), + _drainDisabled(false) { +} + +EventQueue::~EventQueue() { +} + +void EventQueue::start(TrackEntry *entry) { + _eventQueueEntries.add(newEventQueueEntry(EventType_Start, entry)); + _state._animationsChanged = true; +} + +void EventQueue::interrupt(TrackEntry *entry) { + _eventQueueEntries.add(newEventQueueEntry(EventType_Interrupt, entry)); +} + +void EventQueue::end(TrackEntry *entry) { + _eventQueueEntries.add(newEventQueueEntry(EventType_End, entry)); + _state._animationsChanged = true; +} + +void EventQueue::dispose(TrackEntry *entry) { + _eventQueueEntries.add(newEventQueueEntry(EventType_Dispose, entry)); +} + +void EventQueue::complete(TrackEntry *entry) { + _eventQueueEntries.add(newEventQueueEntry(EventType_Complete, entry)); +} + +void EventQueue::event(TrackEntry *entry, Event *event) { + _eventQueueEntries.add(newEventQueueEntry(EventType_Event, entry, event)); +} + +/// Raises all events in the queue and drains the queue. +void EventQueue::drain() { + if (_drainDisabled) { + return; + } + + _drainDisabled = true; + + AnimationState &state = _state; + + // Don't cache _eventQueueEntries.size() so callbacks can queue their own events (eg, call setAnimation in AnimationState_Complete). + for (size_t i = 0; i < _eventQueueEntries.size(); ++i) { + EventQueueEntry *queueEntry = &_eventQueueEntries[i]; + TrackEntry *trackEntry = queueEntry->_entry; + + switch (queueEntry->_type) { + case EventType_Start: + case EventType_Interrupt: + case EventType_Complete: + trackEntry->_listener(&state, queueEntry->_type, trackEntry, NULL); + state._listener(&state, queueEntry->_type, trackEntry, NULL); + break; + case EventType_End: + trackEntry->_listener(&state, queueEntry->_type, trackEntry, NULL); + state._listener(&state, queueEntry->_type, trackEntry, NULL); + /* Yes, we want to fall through here */ + case EventType_Dispose: + trackEntry->_listener(&state, EventType_Dispose, trackEntry, NULL); + state._listener(&state, EventType_Dispose, trackEntry, NULL); + trackEntry->reset(); + _trackEntryPool.free(trackEntry); + break; + case EventType_Event: + trackEntry->_listener(&state, queueEntry->_type, trackEntry, queueEntry->_event); + state._listener(&state, queueEntry->_type, trackEntry, queueEntry->_event); + break; + } + } + _eventQueueEntries.clear(); + + _drainDisabled = false; +} + +const int Subsequent = 0; +const int First = 1; +const int Hold = 2; +const int HoldMix = 3; + +AnimationState::AnimationState(AnimationStateData *data) : + _data(data), + _queue(EventQueue::newEventQueue(*this, _trackEntryPool)), + _animationsChanged(false), + _listener(dummyOnAnimationEventFunc), + _timeScale(1) { +} + +AnimationState::~AnimationState() { + for (size_t i = 0; i < _tracks.size(); i++) { + TrackEntry* entry = _tracks[i]; + if (entry) { + TrackEntry* from = entry->_mixingFrom; + while (from) { + TrackEntry* curr = from; + from = curr->_mixingFrom; + delete curr; + } + TrackEntry* next = entry->_next; + while (next) { + TrackEntry* curr = next; + next = curr->_next; + delete curr; + } + delete entry; + } + } + delete _queue; +} + +void AnimationState::update(float delta) { + delta *= _timeScale; + for (size_t i = 0, n = _tracks.size(); i < n; ++i) { + TrackEntry *currentP = _tracks[i]; + if (currentP == NULL) { + continue; + } + + TrackEntry ¤t = *currentP; + + current._animationLast = current._nextAnimationLast; + current._trackLast = current._nextTrackLast; + + float currentDelta = delta * current._timeScale; + + if (current._delay > 0) { + current._delay -= currentDelta; + if (current._delay > 0) { + continue; + } + currentDelta = -current._delay; + current._delay = 0; + } + + TrackEntry *next = current._next; + if (next != NULL) { + // When the next entry's delay is passed, change to the next entry, preserving leftover time. + float nextTime = current._trackLast - next->_delay; + if (nextTime >= 0) { + next->_delay = 0; + next->_trackTime = current._timeScale == 0 ? 0 : (nextTime / current._timeScale + delta) * next->_timeScale; + current._trackTime += currentDelta; + setCurrent(i, next, true); + while (next->_mixingFrom != NULL) { + next->_mixTime += delta; + next = next->_mixingFrom; + } + continue; + } + } else if (current._trackLast >= current._trackEnd && current._mixingFrom == NULL) { + // clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom. + _tracks[i] = NULL; + + _queue->end(currentP); + disposeNext(currentP); + continue; + } + + if (current._mixingFrom != NULL && updateMixingFrom(currentP, delta)) { + // End mixing from entries once all have completed. + TrackEntry *from = current._mixingFrom; + current._mixingFrom = NULL; + if (from != NULL) from->_mixingTo = NULL; + while (from != NULL) { + _queue->end(from); + from = from->_mixingFrom; + } + } + + current._trackTime += currentDelta; + } + + _queue->drain(); +} + +bool AnimationState::apply(Skeleton &skeleton) { + if (_animationsChanged) { + animationsChanged(); + } + + bool applied = false; + for (size_t i = 0, n = _tracks.size(); i < n; ++i) { + TrackEntry *currentP = _tracks[i]; + if (currentP == NULL || currentP->_delay > 0) { + continue; + } + + TrackEntry ¤t = *currentP; + + applied = true; + MixBlend blend = i == 0 ? MixBlend_First : current._mixBlend; + + // apply mixing from entries first. + float mix = current._alpha; + if (current._mixingFrom != NULL) { + mix *= applyMixingFrom(currentP, skeleton, blend); + } else if (current._trackTime >= current._trackEnd && current._next == NULL) { + mix = 0; // Set to setup pose the last time the entry will be applied. + } + + // apply current entry. + float animationLast = current._animationLast, animationTime = current.getAnimationTime(); + size_t timelineCount = current._animation->_timelines.size(); + Vector &timelines = current._animation->_timelines; + if ((i == 0 && mix == 1) || blend == MixBlend_Add) { + for (size_t ii = 0; ii < timelineCount; ++ii) { + timelines[ii]->apply(skeleton, animationLast, animationTime, &_events, mix, blend, + MixDirection_In); + } + } else { + Vector &timelineMode = current._timelineMode; + + bool firstFrame = current._timelinesRotation.size() == 0; + if (firstFrame) { + current._timelinesRotation.setSize(timelines.size() << 1, 0); + } + Vector &timelinesRotation = current._timelinesRotation; + + for (size_t ii = 0; ii < timelineCount; ++ii) { + Timeline *timeline = timelines[ii]; + assert(timeline); + + MixBlend timelineBlend = timelineMode[ii] == Subsequent ? blend : MixBlend_Setup; + + RotateTimeline *rotateTimeline = NULL; + if (timeline->getRTTI().isExactly(RotateTimeline::rtti)) { + rotateTimeline = static_cast(timeline); + } + + if (rotateTimeline != NULL) { + applyRotateTimeline(rotateTimeline, skeleton, animationTime, mix, timelineBlend, timelinesRotation, ii << 1, + firstFrame); + } else { + timeline->apply(skeleton, animationLast, animationTime, &_events, mix, timelineBlend, MixDirection_In); + } + } + } + + queueEvents(currentP, animationTime); + _events.clear(); + current._nextAnimationLast = animationTime; + current._nextTrackLast = current._trackTime; + } + + _queue->drain(); + return applied; +} + +void AnimationState::clearTracks() { + bool oldDrainDisabled = _queue->_drainDisabled; + _queue->_drainDisabled = true; + for (size_t i = 0, n = _tracks.size(); i < n; ++i) { + clearTrack(i); + } + _tracks.clear(); + _queue->_drainDisabled = oldDrainDisabled; + _queue->drain(); +} + +void AnimationState::clearTrack(size_t trackIndex) { + if (trackIndex >= _tracks.size()) { + return; + } + + TrackEntry *current = _tracks[trackIndex]; + if (current == NULL) { + return; + } + + _queue->end(current); + + disposeNext(current); + + TrackEntry *entry = current; + while (true) { + TrackEntry *from = entry->_mixingFrom; + if (from == NULL) { + break; + } + + _queue->end(from); + entry->_mixingFrom = NULL; + entry->_mixingTo = NULL; + entry = from; + } + + _tracks[current->_trackIndex] = NULL; + + _queue->drain(); +} + +TrackEntry *AnimationState::setAnimation(size_t trackIndex, const String &animationName, bool loop) { + Animation *animation = _data->_skeletonData->findAnimation(animationName); + assert(animation != NULL); + + return setAnimation(trackIndex, animation, loop); +} + +TrackEntry *AnimationState::setAnimation(size_t trackIndex, Animation *animation, bool loop) { + assert(animation != NULL); + + bool interrupt = true; + TrackEntry *current = expandToIndex(trackIndex); + if (current != NULL) { + if (current->_nextTrackLast == -1) { + // Don't mix from an entry that was never applied. + _tracks[trackIndex] = current->_mixingFrom; + _queue->interrupt(current); + _queue->end(current); + disposeNext(current); + current = current->_mixingFrom; + interrupt = false; + } else { + disposeNext(current); + } + } + + TrackEntry *entry = newTrackEntry(trackIndex, animation, loop, current); + setCurrent(trackIndex, entry, interrupt); + _queue->drain(); + + return entry; +} + +TrackEntry *AnimationState::addAnimation(size_t trackIndex, const String &animationName, bool loop, float delay) { + Animation *animation = _data->_skeletonData->findAnimation(animationName); + assert(animation != NULL); + + return addAnimation(trackIndex, animation, loop, delay); +} + +TrackEntry *AnimationState::addAnimation(size_t trackIndex, Animation *animation, bool loop, float delay) { + assert(animation != NULL); + + TrackEntry *last = expandToIndex(trackIndex); + if (last != NULL) { + while (last->_next != NULL) { + last = last->_next; + } + } + + TrackEntry *entry = newTrackEntry(trackIndex, animation, loop, last); + + if (last == NULL) { + setCurrent(trackIndex, entry, true); + _queue->drain(); + } else { + last->_next = entry; + if (delay <= 0) { + float duration = last->_animationEnd - last->_animationStart; + if (duration != 0) { + if (last->_loop) { + delay += duration * (1 + (int) (last->_trackTime / duration)); + } else { + delay += MathUtil::max(duration, last->_trackTime); + } + delay -= _data->getMix(last->_animation, animation); + } else { + delay = last->_trackTime; + } + } + } + + entry->_delay = delay; + return entry; +} + +TrackEntry *AnimationState::setEmptyAnimation(size_t trackIndex, float mixDuration) { + TrackEntry *entry = setAnimation(trackIndex, AnimationState::getEmptyAnimation(), false); + entry->_mixDuration = mixDuration; + entry->_trackEnd = mixDuration; + return entry; +} + +TrackEntry *AnimationState::addEmptyAnimation(size_t trackIndex, float mixDuration, float delay) { + if (delay <= 0) { + delay -= mixDuration; + } + + TrackEntry *entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay); + entry->_mixDuration = mixDuration; + entry->_trackEnd = mixDuration; + return entry; +} + +void AnimationState::setEmptyAnimations(float mixDuration) { + bool oldDrainDisabled = _queue->_drainDisabled; + _queue->_drainDisabled = true; + for (size_t i = 0, n = _tracks.size(); i < n; ++i) { + TrackEntry *current = _tracks[i]; + if (current != NULL) { + setEmptyAnimation(i, mixDuration); + } + } + _queue->_drainDisabled = oldDrainDisabled; + _queue->drain(); +} + +TrackEntry *AnimationState::getCurrent(size_t trackIndex) { + return trackIndex >= _tracks.size() ? NULL : _tracks[trackIndex]; +} + +AnimationStateData *AnimationState::getData() { + return _data; +} + +Vector &AnimationState::getTracks() { + return _tracks; +} + +float AnimationState::getTimeScale() { + return _timeScale; +} + +void AnimationState::setTimeScale(float inValue) { + _timeScale = inValue; +} + +void AnimationState::setListener(AnimationStateListener inValue) { + _listener = inValue; +} + +void AnimationState::disableQueue() { + _queue->_drainDisabled = true; +} +void AnimationState::enableQueue() { + _queue->_drainDisabled = false; +} + +Animation *AnimationState::getEmptyAnimation() { + static Vector timelines; + static Animation ret(String(""), timelines, 0); + return &ret; +} + +void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleton &skeleton, float time, float alpha, + MixBlend blend, Vector &timelinesRotation, size_t i, bool firstFrame) { + if (firstFrame) { + timelinesRotation[i] = 0; + } + + if (alpha == 1) { + rotateTimeline->apply(skeleton, 0, time, NULL, 1, blend, MixDirection_In); + return; + } + + Bone *bone = skeleton._bones[rotateTimeline->_boneIndex]; + Vector& frames = rotateTimeline->_frames; + float r1, r2; + if (time < frames[0]) { + switch (blend) { + case MixBlend_Setup: + bone->_rotation = bone->_data._rotation; + default: + return; + case MixBlend_First: + r1 = bone->_rotation; + r2 = bone->_data._rotation; + } + } else { + r1 = blend == MixBlend_Setup ? bone->_data._rotation : bone->_rotation; + if (time >= frames[frames.size() - RotateTimeline::ENTRIES]) { + // Time is after last frame. + r2 = bone->_data._rotation + frames[frames.size() + RotateTimeline::PREV_ROTATION]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(frames, time, RotateTimeline::ENTRIES); + float prevRotation = frames[frame + RotateTimeline::PREV_ROTATION]; + float frameTime = frames[frame]; + float percent = rotateTimeline->getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + + RotateTimeline::PREV_TIME] - + frameTime)); + + r2 = frames[frame + RotateTimeline::ROTATION] - prevRotation; + r2 -= (16384 - (int) (16384.499999999996 - r2 / 360)) * 360; + r2 = prevRotation + r2 * percent + bone->_data._rotation; + r2 -= (16384 - (int) (16384.499999999996 - r2 / 360)) * 360; + } + } + + // Mix between rotations using the direction of the shortest route on the first frame while detecting crosses. + float total, diff = r2 - r1; + diff -= (16384 - (int) (16384.499999999996 - diff / 360)) * 360; + if (diff == 0) { + total = timelinesRotation[i]; + } else { + float lastTotal, lastDiff; + if (firstFrame) { + lastTotal = 0; + lastDiff = diff; + } else { + lastTotal = timelinesRotation[i]; // Angle and direction of mix, including loops. + lastDiff = timelinesRotation[i + 1]; // Difference between bones. + } + + bool current = diff > 0, dir = lastTotal >= 0; + // Detect cross at 0 (not 180). + if (MathUtil::sign(lastDiff) != MathUtil::sign(diff) && MathUtil::abs(lastDiff) <= 90) { + // A cross after a 360 rotation is a loop. + if (MathUtil::abs(lastTotal) > 180) { + lastTotal += 360 * MathUtil::sign(lastTotal); + } + dir = current; + } + + total = diff + lastTotal - MathUtil::fmod(lastTotal, 360); // Store loops as part of lastTotal. + if (dir != current) { + total += 360 * MathUtil::sign(lastTotal); + } + timelinesRotation[i] = total; + } + timelinesRotation[i + 1] = diff; + r1 += total * alpha; + bone->_rotation = r1 - (16384 - (int) (16384.499999999996 - r1 / 360)) * 360; +} + +bool AnimationState::updateMixingFrom(TrackEntry *to, float delta) { + TrackEntry *from = to->_mixingFrom; + if (from == NULL) { + return true; + } + + bool finished = updateMixingFrom(from, delta); + + from->_animationLast = from->_nextAnimationLast; + from->_trackLast = from->_nextTrackLast; + + // Require mixTime > 0 to ensure the mixing from entry was applied at least once. + if (to->_mixTime > 0 && to->_mixTime >= to->_mixDuration) { + // Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). + if (from->_totalAlpha == 0 || to->_mixDuration == 0) { + to->_mixingFrom = from->_mixingFrom; + if (from->_mixingFrom != NULL) from->_mixingFrom->_mixingTo = to; + to->_interruptAlpha = from->_interruptAlpha; + _queue->end(from); + } + return finished; + } + + from->_trackTime += delta * from->_timeScale; + to->_mixTime += delta; + + return false; +} + +float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBlend blend) { + TrackEntry *from = to->_mixingFrom; + if (from->_mixingFrom != NULL) { + applyMixingFrom(from, skeleton, blend); + } + + float mix; + if (to->_mixDuration == 0) { + // Single frame mix to undo mixingFrom changes. + mix = 1; + if (blend == MixBlend_First) blend = MixBlend_Setup; + } else { + mix = to->_mixTime / to->_mixDuration; + if (mix > 1) { + mix = 1; + } + if (blend != MixBlend_First) blend = from->_mixBlend; + } + + Vector *eventBuffer = mix < from->_eventThreshold ? &_events : NULL; + bool attachments = mix < from->_attachmentThreshold, drawOrder = mix < from->_drawOrderThreshold; + float animationLast = from->_animationLast, animationTime = from->getAnimationTime(); + Vector &timelines = from->_animation->_timelines; + size_t timelineCount = timelines.size(); + float alphaHold = from->_alpha * to->_interruptAlpha, alphaMix = alphaHold * (1 - mix); + + if (blend == MixBlend_Add) { + for (size_t i = 0; i < timelineCount; i++) + timelines[i]->apply(skeleton, animationLast, animationTime, eventBuffer, alphaMix, blend, MixDirection_Out); + } else { + Vector &timelineMode = from->_timelineMode; + Vector &timelineHoldMix = from->_timelineHoldMix; + + bool firstFrame = from->_timelinesRotation.size() == 0; + if (firstFrame) { + from->_timelinesRotation.setSize(timelines.size() << 1, 0); + } + + Vector &timelinesRotation = from->_timelinesRotation; + + from->_totalAlpha = 0; + for (size_t i = 0; i < timelineCount; i++) { + Timeline *timeline = timelines[i]; + MixDirection direction = MixDirection_Out; + MixBlend timelineBlend; + float alpha; + switch (timelineMode[i]) { + case Subsequent: + if (!attachments && (timeline->getRTTI().isExactly(AttachmentTimeline::rtti))) continue; + if (!drawOrder && (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti))) continue; + timelineBlend = blend; + alpha = alphaMix; + break; + case First: + timelineBlend = MixBlend_Setup; + alpha = alphaMix; + break; + case Hold: + timelineBlend = MixBlend_Setup; + alpha = alphaHold; + break; + default: + timelineBlend = MixBlend_Setup; + TrackEntry *holdMix = timelineHoldMix[i]; + alpha = alphaHold * MathUtil::max(0.0f, 1.0f - holdMix->_mixTime / holdMix->_mixDuration); + break; + } + from->_totalAlpha += alpha; + if ((timeline->getRTTI().isExactly(RotateTimeline::rtti))) { + applyRotateTimeline((RotateTimeline*)timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, + firstFrame); + } else { + if (timelineBlend == MixBlend_Setup) { + if (timeline->getRTTI().isExactly(AttachmentTimeline::rtti)) { + if (attachments) direction = MixDirection_In; + } else if (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti)) { + if (drawOrder) direction = MixDirection_In; + } + } + timeline->apply(skeleton, animationLast, animationTime, eventBuffer, alpha, timelineBlend, + direction); + } + } + } + + if (to->_mixDuration > 0) { + queueEvents(from, animationTime); + } + + _events.clear(); + from->_nextAnimationLast = animationTime; + from->_nextTrackLast = from->_trackTime; + + return mix; +} + +void AnimationState::queueEvents(TrackEntry *entry, float animationTime) { + float animationStart = entry->_animationStart, animationEnd = entry->_animationEnd; + float duration = animationEnd - animationStart; + float trackLastWrapped = MathUtil::fmod(entry->_trackLast, duration); + + // Queue events before complete. + size_t i = 0, n = _events.size(); + for (; i < n; ++i) { + Event *e = _events[i]; + if (e->_time < trackLastWrapped) { + break; + } + if (e->_time > animationEnd) { + // Discard events outside animation start/end. + continue; + } + _queue->event(entry, e); + } + + // Queue complete if completed a loop iteration or the animation. + bool complete = false; + if (entry->_loop) + complete = duration == 0 || (trackLastWrapped > MathUtil::fmod(entry->_trackTime, duration)); + else + complete = animationTime >= animationEnd && entry->_animationLast < animationEnd; + if (complete) _queue->complete(entry); + + // Queue events after complete. + for (; i < n; ++i) { + Event *e = _events[i]; + if (e->_time < animationStart) { + // Discard events outside animation start/end. + continue; + } + _queue->event(entry, _events[i]); + } +} + +void AnimationState::setCurrent(size_t index, TrackEntry *current, bool interrupt) { + TrackEntry *from = expandToIndex(index); + _tracks[index] = current; + + if (from != NULL) { + if (interrupt) { + _queue->interrupt(from); + } + + current->_mixingFrom = from; + from->_mixingTo = current; + current->_mixTime = 0; + + // Store interrupted mix percentage. + if (from->_mixingFrom != NULL && from->_mixDuration > 0) { + current->_interruptAlpha *= MathUtil::min(1.0f, from->_mixTime / from->_mixDuration); + } + + from->_timelinesRotation.clear(); // Reset rotation for mixing out, in case entry was mixed in. + } + + _queue->start(current); // triggers animationsChanged +} + +TrackEntry *AnimationState::expandToIndex(size_t index) { + if (index < _tracks.size()) { + return _tracks[index]; + } + + while (index >= _tracks.size()) { + _tracks.add(NULL); + } + + return NULL; +} + +TrackEntry *AnimationState::newTrackEntry(size_t trackIndex, Animation *animation, bool loop, TrackEntry *last) { + TrackEntry *entryP = _trackEntryPool.obtain(); // Pooling + TrackEntry &entry = *entryP; + + entry._trackIndex = trackIndex; + entry._animation = animation; + entry._loop = loop; + entry._holdPrevious = 0; + + entry._eventThreshold = 0; + entry._attachmentThreshold = 0; + entry._drawOrderThreshold = 0; + + entry._animationStart = 0; + entry._animationEnd = animation->getDuration(); + entry._animationLast = -1; + entry._nextAnimationLast = -1; + + entry._delay = 0; + entry._trackTime = 0; + entry._trackLast = -1; + entry._nextTrackLast = -1; // nextTrackLast == -1 signifies a TrackEntry that wasn't applied yet. + entry._trackEnd = std::numeric_limits::max(); // loop ? float.MaxValue : animation.Duration; + entry._timeScale = 1; + + entry._alpha = 1; + entry._interruptAlpha = 1; + entry._mixTime = 0; + entry._mixDuration = (last == NULL) ? 0 : _data->getMix(last->_animation, animation); + + return entryP; +} + +void AnimationState::disposeNext(TrackEntry *entry) { + TrackEntry *next = entry->_next; + while (next != NULL) { + _queue->dispose(next); + next = next->_next; + } + entry->_next = NULL; +} + +void AnimationState::animationsChanged() { + _animationsChanged = false; + + _propertyIDs.clear(); + + for (size_t i = 0, n = _tracks.size(); i < n; ++i) { + TrackEntry *entry = _tracks[i]; + + if (!entry) continue; + + while (entry->_mixingFrom != NULL) + entry = entry->_mixingFrom; + + do { + if (entry->_mixingTo == NULL || entry->_mixBlend != MixBlend_Add) setTimelineModes(entry); + entry = entry->_mixingTo; + } while (entry != NULL); + } +} + +void AnimationState::setTimelineModes(TrackEntry *entry) { + TrackEntry* to = entry->_mixingTo; + Vector &timelines = entry->_animation->_timelines; + size_t timelinesCount = timelines.size(); + Vector &timelineMode = entry->_timelineMode; + timelineMode.setSize(timelinesCount, 0); + Vector &timelineHoldMix = entry->_timelineHoldMix; + timelineHoldMix.setSize(timelinesCount, 0); + + if (to != NULL && to->_holdPrevious) { + for (size_t i = 0; i < timelinesCount; i++) { + int id = timelines[i]->getPropertyId(); + if (!_propertyIDs.contains(id)) _propertyIDs.add(id); + timelineMode[i] = Hold; + } + return; + } + + // outer: + size_t i = 0; + continue_outer: + for (; i < timelinesCount; ++i) { + int id = timelines[i]->getPropertyId(); + if (_propertyIDs.contains(id)) { + timelineMode[i] = Subsequent; + } else { + _propertyIDs.add(id); + + if (to == NULL || !hasTimeline(to, id)) { + timelineMode[i] = First; + } else { + for (TrackEntry *next = to->_mixingTo; next != NULL; next = next->_mixingTo) { + if (hasTimeline(next, id)) continue; + if (entry->_mixDuration > 0) { + timelineMode[i] = HoldMix; + timelineHoldMix[i] = entry; + i++; + goto continue_outer; // continue outer; + } + break; + } + timelineMode[i] = Hold; + } + } + } +} + +bool AnimationState::hasTimeline(TrackEntry* entry, int inId) { + Vector &timelines = entry->_animation->_timelines; + for (size_t i = 0, n = timelines.size(); i < n; ++i) { + if (timelines[i]->getPropertyId() == inId) { + return true; + } + } + return false; +} diff --git a/cocos/editor-support/spine/AnimationState.h b/cocos/editor-support/spine/AnimationState.h index 5da57e401c3..92d57781531 100644 --- a/cocos/editor-support/spine/AnimationState.h +++ b/cocos/editor-support/spine/AnimationState.h @@ -1,191 +1,450 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ANIMATIONSTATE_H_ -#define SPINE_ANIMATIONSTATE_H_ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - SP_ANIMATION_START, SP_ANIMATION_INTERRUPT, SP_ANIMATION_END, SP_ANIMATION_COMPLETE, SP_ANIMATION_DISPOSE, SP_ANIMATION_EVENT -} spEventType; - -typedef struct spAnimationState spAnimationState; -typedef struct spTrackEntry spTrackEntry; - -typedef void (*spAnimationStateListener) (spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event); - -_SP_ARRAY_DECLARE_TYPE(spTrackEntryArray, spTrackEntry*) - -struct spTrackEntry { - spAnimation* animation; - spTrackEntry* next; - spTrackEntry* mixingFrom; - spAnimationStateListener listener; - int trackIndex; - int /*boolean*/ loop; - float eventThreshold, attachmentThreshold, drawOrderThreshold; - float animationStart, animationEnd, animationLast, nextAnimationLast; - float delay, trackTime, trackLast, nextTrackLast, trackEnd, timeScale; - float alpha, mixTime, mixDuration, interruptAlpha, totalAlpha; - spIntArray* timelineData; - spTrackEntryArray* timelineDipMix; - float* timelinesRotation; - int timelinesRotationCount; - void* rendererObject; - void* userData; - -#ifdef __cplusplus - spTrackEntry() : - animation(0), - next(0), mixingFrom(0), - listener(0), - trackIndex(0), - loop(0), - eventThreshold(0), attachmentThreshold(0), drawOrderThreshold(0), - animationStart(0), animationEnd(0), animationLast(0), nextAnimationLast(0), - delay(0), trackTime(0), trackLast(0), nextTrackLast(0), trackEnd(0), timeScale(0), - alpha(0), mixTime(0), mixDuration(0), interruptAlpha(0), totalAlpha(0), - timelineData(0), - timelineDipMix(0), - timelinesRotation(0), - timelinesRotationCount(0), - rendererObject(0), userData(0) { - } -#endif -}; - -struct spAnimationState { - spAnimationStateData* const data; - - int tracksCount; - spTrackEntry** tracks; - - spAnimationStateListener listener; - - float timeScale; - - spTrackEntryArray* mixingTo; - - void* rendererObject; - void* userData; - -#ifdef __cplusplus - spAnimationState() : - data(0), - tracksCount(0), - tracks(0), - listener(0), - timeScale(0), - mixingTo(0), - rendererObject(0), - userData(0) { - } -#endif -}; - -/* @param data May be 0 for no mixing. */ -SP_API spAnimationState* spAnimationState_create (spAnimationStateData* data); -SP_API void spAnimationState_dispose (spAnimationState* self); - -SP_API void spAnimationState_update (spAnimationState* self, float delta); -SP_API int /**bool**/ spAnimationState_apply (spAnimationState* self, struct spSkeleton* skeleton); - -SP_API void spAnimationState_clearTracks (spAnimationState* self); -SP_API void spAnimationState_clearTrack (spAnimationState* self, int trackIndex); - -/** Set the current animation. Any queued animations are cleared. */ -SP_API spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, - int/*bool*/loop); -SP_API spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop); - -/** Adds an animation to be played delay seconds after the current or last queued animation, taking into account any mix - * duration. */ -SP_API spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, - int/*bool*/loop, float delay); -SP_API spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop, - float delay); -SP_API spTrackEntry* spAnimationState_setEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration); -SP_API spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration, float delay); -SP_API void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration); - -SP_API spTrackEntry* spAnimationState_getCurrent (spAnimationState* self, int trackIndex); - -SP_API void spAnimationState_clearListenerNotifications(spAnimationState* self); - -SP_API float spTrackEntry_getAnimationTime (spTrackEntry* entry); - -/** Use this to dispose static memory before your app exits to appease your memory leak detector*/ -SP_API void spAnimationState_disposeStatics (); - -typedef void (*TrackEntryDisposeCallback)(spTrackEntry*); -void spTrackEntry_setDisposeCallback(TrackEntryDisposeCallback cb); - -#ifdef SPINE_SHORT_NAMES -typedef spEventType EventType; -#define ANIMATION_START SP_ANIMATION_START -#define ANIMATION_INTERRUPT SP_ANIMATION_INTERRUPT -#define ANIMATION_END SP_ANIMATION_END -#define ANIMATION_COMPLETE SP_ANIMATION_COMPLETE -#define ANIMATION_DISPOSE SP_ANIMATION_DISPOSE -#define ANIMATION_EVENT SP_ANIMATION_EVENT -typedef spAnimationStateListener AnimationStateListener; -typedef spTrackEntry TrackEntry; -typedef spAnimationState AnimationState; -#define AnimationState_create(...) spAnimationState_create(__VA_ARGS__) -#define AnimationState_dispose(...) spAnimationState_dispose(__VA_ARGS__) -#define AnimationState_update(...) spAnimationState_update(__VA_ARGS__) -#define AnimationState_apply(...) spAnimationState_apply(__VA_ARGS__) -#define AnimationState_clearTracks(...) spAnimationState_clearTracks(__VA_ARGS__) -#define AnimationState_clearTrack(...) spAnimationState_clearTrack(__VA_ARGS__) -#define AnimationState_setAnimationByName(...) spAnimationState_setAnimationByName(__VA_ARGS__) -#define AnimationState_setAnimation(...) spAnimationState_setAnimation(__VA_ARGS__) -#define AnimationState_addAnimationByName(...) spAnimationState_addAnimationByName(__VA_ARGS__) -#define AnimationState_addAnimation(...) spAnimationState_addAnimation(__VA_ARGS__) -#define AnimationState_setEmptyAnimation(...) spAnimatinState_setEmptyAnimation(__VA_ARGS__) -#define AnimationState_addEmptyAnimation(...) spAnimatinState_addEmptyAnimation(__VA_ARGS__) -#define AnimationState_setEmptyAnimations(...) spAnimatinState_setEmptyAnimations(__VA_ARGS__) -#define AnimationState_getCurrent(...) spAnimationState_getCurrent(__VA_ARGS__) -#define AnimationState_clearListenerNotifications(...) spAnimatinState_clearListenerNotifications(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ANIMATIONSTATE_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_AnimationState_h +#define Spine_AnimationState_h + +#include +#include +#include +#include +#include +#include + +namespace spine { + enum EventType { + EventType_Start, + EventType_Interrupt, + EventType_End, + EventType_Complete, + EventType_Dispose, + EventType_Event + }; + + class AnimationState; + class TrackEntry; + + class Animation; + class Event; + class AnimationStateData; + class Skeleton; + class RotateTimeline; + + typedef void (*AnimationStateListener) (AnimationState* state, EventType type, TrackEntry* entry, Event* event); + + /// State for the playback of an animation + class SP_API TrackEntry : public SpineObject, public HasRendererObject { + friend class EventQueue; + friend class AnimationState; + + public: + TrackEntry(); + + virtual ~TrackEntry(); + + /// The index of the track where this entry is either current or queued. + int getTrackIndex(); + + /// The animation to apply for this track entry. + Animation* getAnimation(); + + /// + /// If true, the animation will repeat. If false, it will not, instead its last frame is applied if played beyond its duration. + bool getLoop(); + void setLoop(bool inValue); + + /// + /// If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead + /// of being mixed out. + /// + /// When mixing between animations that key the same property, if a lower track also keys that property then the value will + /// briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0% + /// while the second animation mixes from 0% to 100%. Setting holdPrevious to true applies the first animation + /// at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which + /// keys the property, only when a higher track also keys the property. + /// + /// Snapping will occur if holdPrevious is true and this animation does not key all the same properties as the + /// previous animation. + bool getHoldPrevious(); + void setHoldPrevious(bool inValue); + + /// + /// Seconds to postpone playing the animation. When a track entry is the current track entry, delay postpones incrementing + /// the track time. When a track entry is queued, delay is the time from the start of the previous animation to when the + /// track entry will become the current track entry. + float getDelay(); + void setDelay(float inValue); + + /// + /// Current time in seconds this track entry has been the current track entry. The track time determines + /// TrackEntry.AnimationTime. The track time can be set to start the animation at a time other than 0, without affecting looping. + float getTrackTime(); + void setTrackTime(float inValue); + + /// + /// The track time in seconds when this animation will be removed from the track. Defaults to the animation duration for + /// non-looping animations and to int.MaxValue for looping animations. If the track end time is reached and no + /// other animations are queued for playback, and mixing from any previous animations is complete, properties keyed by the animation, + /// are set to the setup pose and the track is cleared. + /// + /// It may be desired to use AnimationState.addEmptyAnimation(int, float, float) to mix the properties back to the + /// setup pose over time, rather than have it happen instantly. + /// + float getTrackEnd(); + void setTrackEnd(float inValue); + + /// + /// Seconds when this animation starts, both initially and after looping. Defaults to 0. + /// + /// When changing the animation start time, it often makes sense to set TrackEntry.AnimationLast to the same value to + /// prevent timeline keys before the start time from triggering. + /// + float getAnimationStart(); + void setAnimationStart(float inValue); + + /// + /// Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will + /// loop back to TrackEntry.AnimationStart at this time. Defaults to the animation duration. + float getAnimationEnd(); + void setAnimationEnd(float inValue); + + /// + /// The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this + /// animation is applied, event timelines will fire all events between the animation last time (exclusive) and animation time + /// (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation is applied. + float getAnimationLast(); + void setAnimationLast(float inValue); + + /// + /// Uses TrackEntry.TrackTime to compute the animation time between TrackEntry.AnimationStart. and + /// TrackEntry.AnimationEnd. When the track time is 0, the animation time is equal to the animation start time. + /// + float getAnimationTime(); + + /// + /// Multiplier for the delta time when the animation state is updated, causing time for this animation to play slower or + /// faster. Defaults to 1. + /// + float getTimeScale(); + void setTimeScale(float inValue); + + /// + /// Values less than 1 mix this animation with the last skeleton pose. Defaults to 1, which overwrites the last skeleton pose with + /// this animation. + /// + /// Typically track 0 is used to completely pose the skeleton, then alpha can be used on higher tracks. It doesn't make sense + /// to use alpha on track 0 if the skeleton pose is from the last frame render. + /// + float getAlpha(); + void setAlpha(float inValue); + + /// + /// When the mix percentage (mix time / mix duration) is less than the event threshold, event timelines for the animation + /// being mixed out will be applied. Defaults to 0, so event timelines are not applied for an animation being mixed out. + float getEventThreshold(); + void setEventThreshold(float inValue); + + /// + /// When the mix percentage (mix time / mix duration) is less than the attachment threshold, attachment timelines for the + /// animation being mixed out will be applied. Defaults to 0, so attachment timelines are not applied for an animation being + /// mixed out. + float getAttachmentThreshold(); + void setAttachmentThreshold(float inValue); + + /// + /// When the mix percentage (mix time / mix duration) is less than the draw order threshold, draw order timelines for the + /// animation being mixed out will be applied. Defaults to 0, so draw order timelines are not applied for an animation being + /// mixed out. + /// + float getDrawOrderThreshold(); + void setDrawOrderThreshold(float inValue); + + /// + /// The animation queued to start after this animation, or NULL. + TrackEntry* getNext(); + + /// + /// Returns true if at least one loop has been completed. + bool isComplete(); + + /// + /// Seconds from 0 to the mix duration when mixing from the previous animation to this animation. May be slightly more than + /// TrackEntry.MixDuration when the mix is complete. + float getMixTime(); + void setMixTime(float inValue); + + /// + /// Seconds for mixing from the previous animation to this animation. Defaults to the value provided by + /// AnimationStateData based on the animation before this animation (if any). + /// + /// The mix duration can be set manually rather than use the value from AnimationStateData.GetMix. + /// In that case, the mixDuration must be set before AnimationState.update(float) is next called. + /// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with a delay + /// less than or equal to 0, note the Delay is set using the mix duration from the AnimationStateData + /// + /// + /// + float getMixDuration(); + void setMixDuration(float inValue); + + + MixBlend getMixBlend(); + void setMixBlend(MixBlend blend); + + /// + /// The track entry for the previous animation when mixing from the previous animation to this animation, or NULL if no + /// mixing is currently occuring. When mixing from multiple animations, MixingFrom makes up a double linked list with MixingTo. + TrackEntry* getMixingFrom(); + + /// + /// The track entry for the next animation when mixing from this animation, or NULL if no mixing is currently occuring. + /// When mixing from multiple animations, MixingTo makes up a double linked list with MixingFrom. + TrackEntry* getMixingTo(); + + /// + /// Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the + /// long way around when using alpha and starting animations on other tracks. + /// + /// Mixing involves finding a rotation between two others, which has two possible solutions: the short way or the long way around. + /// The two rotations likely change over time, so which direction is the short or long way also changes. + /// If the short way was always chosen, bones would flip to the other side when that direction became the long way. + /// TrackEntry chooses the short way the first time it is applied and remembers that direction. + void resetRotationDirections(); + + void setListener(AnimationStateListener listener); + + private: + Animation* _animation; + + TrackEntry* _next; + TrackEntry* _mixingFrom; + TrackEntry* _mixingTo; + int _trackIndex; + + bool _loop, _holdPrevious; + float _eventThreshold, _attachmentThreshold, _drawOrderThreshold; + float _animationStart, _animationEnd, _animationLast, _nextAnimationLast; + float _delay, _trackTime, _trackLast, _nextTrackLast, _trackEnd, _timeScale; + float _alpha, _mixTime, _mixDuration, _interruptAlpha, _totalAlpha; + MixBlend _mixBlend; + Vector _timelineMode; + Vector _timelineHoldMix; + Vector _timelinesRotation; + AnimationStateListener _listener; + + void reset(); + }; + + class SP_API EventQueueEntry : public SpineObject { + friend class EventQueue; + + public: + EventType _type; + TrackEntry* _entry; + Event* _event; + + EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL); + }; + + class SP_API EventQueue : public SpineObject { + friend class AnimationState; + + private: + Vector _eventQueueEntries; + AnimationState& _state; + Pool& _trackEntryPool; + bool _drainDisabled; + + static EventQueue* newEventQueue(AnimationState& state, Pool& trackEntryPool); + + static EventQueueEntry newEventQueueEntry(EventType eventType, TrackEntry* entry, Event* event = NULL); + + EventQueue(AnimationState& state, Pool& trackEntryPool); + + ~EventQueue(); + + void start(TrackEntry* entry); + + void interrupt(TrackEntry* entry); + + void end(TrackEntry* entry); + + void dispose(TrackEntry* entry); + + void complete(TrackEntry* entry); + + void event(TrackEntry* entry, Event* event); + + /// Raises all events in the queue and drains the queue. + void drain(); + }; + + class SP_API AnimationState : public SpineObject, public HasRendererObject { + friend class TrackEntry; + friend class EventQueue; + + public: + explicit AnimationState(AnimationStateData* data); + + ~AnimationState(); + + /// + /// Increments the track entry times, setting queued animations as current if needed + /// @param delta delta time + void update(float delta); + + /// + /// Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the + /// animation state can be applied to multiple skeletons to pose them identically. + bool apply(Skeleton& skeleton); + + /// + /// Removes all animations from all tracks, leaving skeletons in their previous pose. + /// It may be desired to use AnimationState.setEmptyAnimations(float) to mix the skeletons back to the setup pose, + /// rather than leaving them in their previous pose. + void clearTracks(); + + /// + /// Removes all animations from the tracks, leaving skeletons in their previous pose. + /// It may be desired to use AnimationState.setEmptyAnimations(float) to mix the skeletons back to the setup pose, + /// rather than leaving them in their previous pose. + void clearTrack(size_t trackIndex); + + /// Sets an animation by name. setAnimation(int, Animation, bool) + TrackEntry* setAnimation(size_t trackIndex, const String& animationName, bool loop); + + /// Sets the current animation for a track, discarding any queued animations. + /// @param loop If true, the animation will repeat. + /// If false, it will not, instead its last frame is applied if played beyond its duration. + /// In either case TrackEntry.TrackEnd determines when the track is cleared. + /// @return + /// A track entry to allow further customization of animation playback. References to the track entry must not be kept + /// after AnimationState.Dispose. + TrackEntry* setAnimation(size_t trackIndex, Animation* animation, bool loop); + + /// Queues an animation by name. + /// addAnimation(int, Animation, bool, float) + TrackEntry* addAnimation(size_t trackIndex, const String& animationName, bool loop, float delay); + + /// Adds an animation to be played delay seconds after the current or last queued animation + /// for a track. If the track is empty, it is equivalent to calling setAnimation. + /// @param delay + /// Seconds to begin this animation after the start of the previous animation. May be <= 0 to use the animation + /// duration of the previous track minus any mix duration plus the negative delay. + /// + /// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept + /// after AnimationState.Dispose + TrackEntry* addAnimation(size_t trackIndex, Animation* animation, bool loop, float delay); + + /// + /// Sets an empty animation for a track, discarding any queued animations, and mixes to it over the specified mix duration. + TrackEntry* setEmptyAnimation(size_t trackIndex, float mixDuration); + + /// + /// Adds an empty animation to be played after the current or last queued animation for a track, and mixes to it over the + /// specified mix duration. + /// @return + /// A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose. + /// + /// @param trackIndex Track number. + /// @param mixDuration Mix duration. + /// @param delay Seconds to begin this animation after the start of the previous animation. May be <= 0 to use the animation + /// duration of the previous track minus any mix duration plus the negative delay. + TrackEntry* addEmptyAnimation(size_t trackIndex, float mixDuration, float delay); + + /// + /// Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration. + void setEmptyAnimations(float mixDuration); + + /// @return The track entry for the animation currently playing on the track, or NULL if no animation is currently playing. + TrackEntry* getCurrent(size_t trackIndex); + + AnimationStateData* getData(); + + /// A list of tracks that have animations, which may contain NULLs. + Vector &getTracks(); + + float getTimeScale(); + void setTimeScale(float inValue); + + void setListener(AnimationStateListener listener); + + void disableQueue(); + void enableQueue(); + + private: + + AnimationStateData* _data; + + Pool _trackEntryPool; + Vector _tracks; + Vector _events; + EventQueue* _queue; + + Vector _propertyIDs; + bool _animationsChanged; + + AnimationStateListener _listener; + + float _timeScale; + + static Animation* getEmptyAnimation(); + + static void applyRotateTimeline(RotateTimeline* rotateTimeline, Skeleton& skeleton, float time, float alpha, MixBlend pose, Vector& timelinesRotation, size_t i, bool firstFrame); + + /// Returns true when all mixing from entries are complete. + bool updateMixingFrom(TrackEntry* to, float delta); + + float applyMixingFrom(TrackEntry* to, Skeleton& skeleton, MixBlend currentPose); + + void queueEvents(TrackEntry* entry, float animationTime); + + /// Sets the active TrackEntry for a given track number. + void setCurrent(size_t index, TrackEntry* current, bool interrupt); + + TrackEntry* expandToIndex(size_t index); + + /// Object-pooling version of new TrackEntry. Obtain an unused TrackEntry from the pool and clear/initialize its values. + /// @param last May be NULL. + TrackEntry* newTrackEntry(size_t trackIndex, Animation* animation, bool loop, TrackEntry* last); + + /// Dispose all track entries queued after the given TrackEntry. + void disposeNext(TrackEntry* entry); + + void animationsChanged(); + + void setTimelineModes(TrackEntry* entry); + + bool hasTimeline(TrackEntry* entry, int inId); + }; +} + +#endif /* Spine_AnimationState_h */ diff --git a/cocos/editor-support/spine/AnimationStateData.c b/cocos/editor-support/spine/AnimationStateData.c deleted file mode 100644 index 2aeb25addaa..00000000000 --- a/cocos/editor-support/spine/AnimationStateData.c +++ /dev/null @@ -1,151 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -typedef struct _ToEntry _ToEntry; -struct _ToEntry { - spAnimation* animation; - float duration; - _ToEntry* next; -}; - -_ToEntry* _ToEntry_create (spAnimation* to, float duration) { - _ToEntry* self = NEW(_ToEntry); - self->animation = to; - self->duration = duration; - return self; -} - -void _ToEntry_dispose (_ToEntry* self) { - FREE(self); -} - -/**/ - -typedef struct _FromEntry _FromEntry; -struct _FromEntry { - spAnimation* animation; - _ToEntry* toEntries; - _FromEntry* next; -}; - -_FromEntry* _FromEntry_create (spAnimation* from) { - _FromEntry* self = NEW(_FromEntry); - self->animation = from; - return self; -} - -void _FromEntry_dispose (_FromEntry* self) { - FREE(self); -} - -/**/ - -spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData) { - spAnimationStateData* self = NEW(spAnimationStateData); - CONST_CAST(spSkeletonData*, self->skeletonData) = skeletonData; - return self; -} - -void spAnimationStateData_dispose (spAnimationStateData* self) { - _ToEntry* toEntry; - _ToEntry* nextToEntry; - _FromEntry* nextFromEntry; - - _FromEntry* fromEntry = (_FromEntry*)self->entries; - while (fromEntry) { - toEntry = fromEntry->toEntries; - while (toEntry) { - nextToEntry = toEntry->next; - _ToEntry_dispose(toEntry); - toEntry = nextToEntry; - } - nextFromEntry = fromEntry->next; - _FromEntry_dispose(fromEntry); - fromEntry = nextFromEntry; - } - - FREE(self); -} - -void spAnimationStateData_setMixByName (spAnimationStateData* self, const char* fromName, const char* toName, float duration) { - spAnimation* to; - spAnimation* from = spSkeletonData_findAnimation(self->skeletonData, fromName); - if (!from) return; - to = spSkeletonData_findAnimation(self->skeletonData, toName); - if (!to) return; - spAnimationStateData_setMix(self, from, to, duration); -} - -void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from, spAnimation* to, float duration) { - /* Find existing FromEntry. */ - _ToEntry* toEntry; - _FromEntry* fromEntry = (_FromEntry*)self->entries; - while (fromEntry) { - if (fromEntry->animation == from) { - /* Find existing ToEntry. */ - toEntry = fromEntry->toEntries; - while (toEntry) { - if (toEntry->animation == to) { - toEntry->duration = duration; - return; - } - toEntry = toEntry->next; - } - break; /* Add new ToEntry to the existing FromEntry. */ - } - fromEntry = fromEntry->next; - } - if (!fromEntry) { - fromEntry = _FromEntry_create(from); - fromEntry->next = (_FromEntry*)self->entries; - CONST_CAST(_FromEntry*, self->entries) = fromEntry; - } - toEntry = _ToEntry_create(to, duration); - toEntry->next = fromEntry->toEntries; - fromEntry->toEntries = toEntry; -} - -float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to) { - _FromEntry* fromEntry = (_FromEntry*)self->entries; - while (fromEntry) { - if (fromEntry->animation == from) { - _ToEntry* toEntry = fromEntry->toEntries; - while (toEntry) { - if (toEntry->animation == to) return toEntry->duration; - toEntry = toEntry->next; - } - } - fromEntry = fromEntry->next; - } - return self->defaultMix; -} diff --git a/cocos/editor-support/spine/AnimationStateData.cpp b/cocos/editor-support/spine/AnimationStateData.cpp new file mode 100644 index 00000000000..e7d93ecf9dd --- /dev/null +++ b/cocos/editor-support/spine/AnimationStateData.cpp @@ -0,0 +1,86 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include + +using namespace spine; + +AnimationStateData::AnimationStateData(SkeletonData *skeletonData) : _skeletonData(skeletonData), _defaultMix(0) { +} + +void AnimationStateData::setMix(const String &fromName, const String &toName, float duration) { + Animation *from = _skeletonData->findAnimation(fromName); + Animation *to = _skeletonData->findAnimation(toName); + + setMix(from, to, duration); +} + +void AnimationStateData::setMix(Animation *from, Animation *to, float duration) { + assert(from != NULL); + assert(to != NULL); + + AnimationPair key(from, to); + _animationToMixTime.put(key, duration); +} + +float AnimationStateData::getMix(Animation *from, Animation *to) { + assert(from != NULL); + assert(to != NULL); + + AnimationPair key(from, to); + + if (_animationToMixTime.containsKey(key)) return _animationToMixTime[key]; + return _defaultMix; +} + +SkeletonData *AnimationStateData::getSkeletonData() { + return _skeletonData; +} + +float AnimationStateData::getDefaultMix() { + return _defaultMix; +} + +void AnimationStateData::setDefaultMix(float inValue) { + _defaultMix = inValue; +} + +AnimationStateData::AnimationPair::AnimationPair(Animation *a1, Animation *a2) : _a1(a1), _a2(a2) { +} + +bool AnimationStateData::AnimationPair::operator==(const AnimationPair &other) const { + return _a1->_name == other._a1->_name && _a2->_name == other._a2->_name; +} diff --git a/cocos/editor-support/spine/AnimationStateData.h b/cocos/editor-support/spine/AnimationStateData.h index 95f936e809e..94a008e112d 100644 --- a/cocos/editor-support/spine/AnimationStateData.h +++ b/cocos/editor-support/spine/AnimationStateData.h @@ -1,77 +1,88 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ANIMATIONSTATEDATA_H_ -#define SPINE_ANIMATIONSTATEDATA_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spAnimationStateData { - spSkeletonData* const skeletonData; - float defaultMix; - const void* const entries; - -#ifdef __cplusplus - spAnimationStateData() : - skeletonData(0), - defaultMix(0), - entries(0) { - } -#endif -} spAnimationStateData; - -SP_API spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData); -SP_API void spAnimationStateData_dispose (spAnimationStateData* self); - -SP_API void spAnimationStateData_setMixByName (spAnimationStateData* self, const char* fromName, const char* toName, float duration); -SP_API void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from, spAnimation* to, float duration); -/* Returns 0 if there is no mixing between the animations. */ -SP_API float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to); - -#ifdef SPINE_SHORT_NAMES -typedef spAnimationStateData AnimationStateData; -#define AnimationStateData_create(...) spAnimationStateData_create(__VA_ARGS__) -#define AnimationStateData_dispose(...) spAnimationStateData_dispose(__VA_ARGS__) -#define AnimationStateData_setMixByName(...) spAnimationStateData_setMixByName(__VA_ARGS__) -#define AnimationStateData_setMix(...) spAnimationStateData_setMix(__VA_ARGS__) -#define AnimationStateData_getMix(...) spAnimationStateData_getMix(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ANIMATIONSTATEDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_AnimationStateData_h +#define Spine_AnimationStateData_h + +#include +#include +#include + +#include + +namespace spine { + class SkeletonData; + class Animation; + + /// Stores mix (crossfade) durations to be applied when AnimationState animations are changed. + class SP_API AnimationStateData : public SpineObject { + friend class AnimationState; + + public: + explicit AnimationStateData(SkeletonData* skeletonData); + + /// The SkeletonData to look up animations when they are specified by name. + SkeletonData* getSkeletonData(); + + /// The mix duration to use when no mix duration has been specifically defined between two animations. + float getDefaultMix(); + void setDefaultMix(float inValue); + + /// Sets a mix duration by animation names. + void setMix(const String& fromName, const String& toName, float duration); + + /// Sets a mix duration when changing from the specified animation to the other. + /// See TrackEntry.MixDuration. + void setMix(Animation* from, Animation* to, float duration); + + /// + /// The mix duration to use when changing from the specified animation to the other, + /// or the DefaultMix if no mix duration has been set. + /// + float getMix(Animation* from, Animation* to); + + private: + class AnimationPair : public SpineObject { + public: + Animation* _a1; + Animation* _a2; + + explicit AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL); + + bool operator==(const AnimationPair &other) const; + }; + + SkeletonData* _skeletonData; + float _defaultMix; + HashMap _animationToMixTime; + }; +} + +#endif /* Spine_AnimationStateData_h */ diff --git a/cocos/editor-support/spine/Array.h b/cocos/editor-support/spine/Array.h deleted file mode 100644 index 3beb083253f..00000000000 --- a/cocos/editor-support/spine/Array.h +++ /dev/null @@ -1,133 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ARRAY_H -#define SPINE_ARRAY_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define _SP_ARRAY_DECLARE_TYPE(name, itemType) \ - typedef struct name { int size; int capacity; itemType* items; } name; \ - SP_API name* name##_create(int initialCapacity); \ - SP_API void name##_dispose(name* self); \ - SP_API void name##_clear(name* self); \ - SP_API name* name##_setSize(name* self, int newSize); \ - SP_API void name##_ensureCapacity(name* self, int newCapacity); \ - SP_API void name##_add(name* self, itemType value); \ - SP_API void name##_addAll(name* self, name* other); \ - SP_API void name##_addAllValues(name* self, itemType* values, int offset, int count); \ - SP_API void name##_removeAt(name* self, int index); \ - SP_API int name##_contains(name* self, itemType value); \ - SP_API itemType name##_pop(name* self); \ - SP_API itemType name##_peek(name* self); - -#define _SP_ARRAY_IMPLEMENT_TYPE(name, itemType) \ - name* name##_create(int initialCapacity) { \ - name* array = CALLOC(name, 1); \ - array->size = 0; \ - array->capacity = initialCapacity; \ - array->items = CALLOC(itemType, initialCapacity); \ - return array; \ - } \ - void name##_dispose(name* self) { \ - FREE(self->items); \ - FREE(self); \ - } \ - void name##_clear(name* self) { \ - self->size = 0; \ - } \ - name* name##_setSize(name* self, int newSize) { \ - self->size = newSize; \ - if (self->capacity < newSize) { \ - self->capacity = MAX(8, (int)(self->size * 1.75f)); \ - self->items = REALLOC(self->items, itemType, self->capacity); \ - } \ - return self; \ - } \ - void name##_ensureCapacity(name* self, int newCapacity) { \ - if (self->capacity >= newCapacity) return; \ - self->capacity = newCapacity; \ - self->items = REALLOC(self->items, itemType, self->capacity); \ - } \ - void name##_add(name* self, itemType value) { \ - if (self->size == self->capacity) { \ - self->capacity = MAX(8, (int)(self->size * 1.75f)); \ - self->items = REALLOC(self->items, itemType, self->capacity); \ - } \ - self->items[self->size++] = value; \ - } \ - void name##_addAll(name* self, name* other) { \ - int i = 0; \ - for (; i < other->size; i++) { \ - name##_add(self, other->items[i]); \ - } \ - } \ - void name##_addAllValues(name* self, itemType* values, int offset, int count) { \ - int i = offset, n = offset + count; \ - for (; i < n; i++) { \ - name##_add(self, values[i]); \ - } \ - } \ - void name##_removeAt(name* self, int index) { \ - self->size--; \ - memmove(self->items + index, self->items + index + 1, sizeof(itemType) * (self->size - index)); \ - } \ - int name##_contains(name* self, itemType value) { \ - itemType* items = self->items; \ - int i, n; \ - for (i = 0, n = self->size; i < n; i++) { \ - if (items[i] == value) return -1; \ - } \ - return 0; \ - } \ - itemType name##_pop(name* self) { \ - itemType item = self->items[--self->size]; \ - return item; \ - } \ - itemType name##_peek(name* self) { \ - return self->items[self->size - 1]; \ - } - -_SP_ARRAY_DECLARE_TYPE(spFloatArray, float) -_SP_ARRAY_DECLARE_TYPE(spIntArray, int) -_SP_ARRAY_DECLARE_TYPE(spShortArray, short) -_SP_ARRAY_DECLARE_TYPE(spUnsignedShortArray, unsigned short) -_SP_ARRAY_DECLARE_TYPE(spArrayFloatArray, spFloatArray*) -_SP_ARRAY_DECLARE_TYPE(spArrayShortArray, spShortArray*) - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ARRAY_H */ diff --git a/cocos/editor-support/spine/Atlas.c b/cocos/editor-support/spine/Atlas.c deleted file mode 100644 index d2a0bfe5200..00000000000 --- a/cocos/editor-support/spine/Atlas.c +++ /dev/null @@ -1,359 +0,0 @@ -/****************************************************************************** -* Spine Runtimes Software License v2.5 -* -* Copyright (c) 2013-2016, Esoteric Software -* All rights reserved. -* -* You are granted a perpetual, non-exclusive, non-sublicensable, and -* non-transferable license to use, install, execute, and perform the Spine -* Runtimes software and derivative works solely for personal or internal -* use. Without the written permission of Esoteric Software (see Section 2 of -* the Spine Software License Agreement), you may not (a) modify, translate, -* adapt, or develop new applications using the Spine Runtimes or otherwise -* create derivative works or improvements of the Spine Runtimes or (b) remove, -* delete, alter, or obscure any trademarks or any copyright, trademark, patent, -* or other intellectual property or proprietary rights notices on or in the -* Software, including any copy thereof. Redistributions in binary or source -* form must include this license and terms. -* -* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR -* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF -* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include -#include -#include - -spAtlasPage* spAtlasPage_create(spAtlas* atlas, const char* name) { - spAtlasPage* self = NEW(spAtlasPage); - CONST_CAST(spAtlas*, self->atlas) = atlas; - MALLOC_STR(self->name, name); - return self; -} - -void spAtlasPage_dispose(spAtlasPage* self) { - _spAtlasPage_disposeTexture(self); - FREE(self->name); - FREE(self); -} - -/**/ - -spAtlasRegion* spAtlasRegion_create() { - return NEW(spAtlasRegion); -} - -void spAtlasRegion_dispose(spAtlasRegion* self) { - FREE(self->name); - FREE(self->splits); - FREE(self->pads); - FREE(self); -} - -/**/ - -typedef struct { - const char* begin; - const char* end; -} Str; - -static void trim(Str* str) { - while (isspace((unsigned char)*str->begin) && str->begin < str->end) - (str->begin)++; - if (str->begin == str->end) return; - str->end--; - while (((unsigned char)*str->end == '\r') && str->end >= str->begin) - str->end--; - str->end++; -} - -/* Tokenize string without modification. Returns 0 on failure. */ -static int readLine(const char** begin, const char* end, Str* str) { - if (*begin == end) return 0; - str->begin = *begin; - - /* Find next delimiter. */ - while (*begin != end && **begin != '\n') - (*begin)++; - - str->end = *begin; - trim(str); - - if (*begin != end) (*begin)++; - return 1; -} - -/* Moves str->begin past the first occurence of c. Returns 0 on failure. */ -static int beginPast(Str* str, char c) { - const char* begin = str->begin; - while (1) { - char lastSkippedChar = *begin; - if (begin == str->end) return 0; - begin++; - if (lastSkippedChar == c) break; - } - str->begin = begin; - return 1; -} - -/* Returns 0 on failure. */ -static int readValue(const char** begin, const char* end, Str* str) { - readLine(begin, end, str); - if (!beginPast(str, ':')) return 0; - trim(str); - return 1; -} - -/* Returns the number of tuple values read (1, 2, 4, or 0 for failure). */ -static int readTuple(const char** begin, const char* end, Str tuple[]) { - int i; - Str str = { NULL, NULL }; - readLine(begin, end, &str); - if (!beginPast(&str, ':')) return 0; - - for (i = 0; i < 3; ++i) { - tuple[i].begin = str.begin; - if (!beginPast(&str, ',')) break; - tuple[i].end = str.begin - 2; - trim(&tuple[i]); - } - tuple[i].begin = str.begin; - tuple[i].end = str.end; - trim(&tuple[i]); - return i + 1; -} - -static char* mallocString(Str* str) { - int length = (int)(str->end - str->begin); - char* string = MALLOC(char, length + 1); - memcpy(string, str->begin, length); - string[length] = '\0'; - return string; -} - -static int indexOf(const char** array, int count, Str* str) { - int length = (int)(str->end - str->begin); - int i; - for (i = count - 1; i >= 0; i--) - if (strncmp(array[i], str->begin, length) == 0) return i; - return 0; -} - -static int equals(Str* str, const char* other) { - return strncmp(other, str->begin, str->end - str->begin) == 0; -} - -static int toInt(Str* str) { - return (int)strtol(str->begin, (char**)&str->end, 10); -} - -static spAtlas* abortAtlas(spAtlas* self) { - spAtlas_dispose(self); - return 0; -} - -static const char* formatNames[] = { "", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888", "RGBA8888" }; -static const char* textureFilterNames[] = { "", "Nearest", "Linear", "MipMap", "MipMapNearestNearest", "MipMapLinearNearest", -"MipMapNearestLinear", "MipMapLinearLinear" }; - -spAtlas* spAtlas_create(const char* begin, int length, const char* dir, void* rendererObject) { - spAtlas* self; - - int count; - const char* end = begin + length; - int dirLength = (int)strlen(dir); - int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\'; - - spAtlasPage *page = 0; - spAtlasPage *lastPage = 0; - spAtlasRegion *lastRegion = 0; - Str str; - Str tuple[4]; - - self = NEW(spAtlas); - self->rendererObject = rendererObject; - - while (readLine(&begin, end, &str)) { - if (str.end - str.begin == 0) { - page = 0; - } - else if (!page) { - char* name = mallocString(&str); - char* path = MALLOC(char, dirLength + needsSlash + strlen(name) + 1); - memcpy(path, dir, dirLength); - if (needsSlash) path[dirLength] = '/'; - strcpy(path + dirLength + needsSlash, name); - - page = spAtlasPage_create(self, name); - FREE(name); - if (lastPage) - lastPage->next = page; - else - self->pages = page; - lastPage = page; - - switch (readTuple(&begin, end, tuple)) { - case 0: - return abortAtlas(self); - case 2: /* size is only optional for an atlas packed with an old TexturePacker. */ - page->width = toInt(tuple); - page->height = toInt(tuple + 1); - if (!readTuple(&begin, end, tuple)) return abortAtlas(self); - } - page->format = (spAtlasFormat)indexOf(formatNames, 8, tuple); - - if (!readTuple(&begin, end, tuple)) return abortAtlas(self); - page->minFilter = (spAtlasFilter)indexOf(textureFilterNames, 8, tuple); - page->magFilter = (spAtlasFilter)indexOf(textureFilterNames, 8, tuple + 1); - - if (!readValue(&begin, end, &str)) return abortAtlas(self); - - page->uWrap = SP_ATLAS_CLAMPTOEDGE; - page->vWrap = SP_ATLAS_CLAMPTOEDGE; - if (!equals(&str, "none")) { - if (str.end - str.begin == 1) { - if (*str.begin == 'x') - page->uWrap = SP_ATLAS_REPEAT; - else if (*str.begin == 'y') - page->vWrap = SP_ATLAS_REPEAT; - } - else if (equals(&str, "xy")) { - page->uWrap = SP_ATLAS_REPEAT; - page->vWrap = SP_ATLAS_REPEAT; - } - } - - _spAtlasPage_createTexture(page, path); - FREE(path); - } - else { - spAtlasRegion *region = spAtlasRegion_create(); - if (lastRegion) - lastRegion->next = region; - else - self->regions = region; - lastRegion = region; - - region->page = page; - region->name = mallocString(&str); - - if (!readValue(&begin, end, &str)) return abortAtlas(self); - region->rotate = equals(&str, "true"); - - if (readTuple(&begin, end, tuple) != 2) return abortAtlas(self); - region->x = toInt(tuple); - region->y = toInt(tuple + 1); - - if (readTuple(&begin, end, tuple) != 2) return abortAtlas(self); - region->width = toInt(tuple); - region->height = toInt(tuple + 1); - - region->u = region->x / (float)page->width; - region->v = region->y / (float)page->height; - if (region->rotate) { - region->u2 = (region->x + region->height) / (float)page->width; - region->v2 = (region->y + region->width) / (float)page->height; - } - else { - region->u2 = (region->x + region->width) / (float)page->width; - region->v2 = (region->y + region->height) / (float)page->height; - } - - count = readTuple(&begin, end, tuple); - if (!count) return abortAtlas(self); - if (count == 4) { /* split is optional */ - region->splits = MALLOC(int, 4); - region->splits[0] = toInt(tuple); - region->splits[1] = toInt(tuple + 1); - region->splits[2] = toInt(tuple + 2); - region->splits[3] = toInt(tuple + 3); - - count = readTuple(&begin, end, tuple); - if (!count) return abortAtlas(self); - if (count == 4) { /* pad is optional, but only present with splits */ - region->pads = MALLOC(int, 4); - region->pads[0] = toInt(tuple); - region->pads[1] = toInt(tuple + 1); - region->pads[2] = toInt(tuple + 2); - region->pads[3] = toInt(tuple + 3); - - if (!readTuple(&begin, end, tuple)) return abortAtlas(self); - } - } - - region->originalWidth = toInt(tuple); - region->originalHeight = toInt(tuple + 1); - - readTuple(&begin, end, tuple); - region->offsetX = toInt(tuple); - region->offsetY = toInt(tuple + 1); - - if (!readValue(&begin, end, &str)) return abortAtlas(self); - region->index = toInt(&str); - } - } - - return self; -} - -spAtlas* spAtlas_createFromFile(const char* path, void* rendererObject) { - int dirLength; - char *dir; - int length; - const char* data; - - spAtlas* atlas = 0; - - /* Get directory from atlas path. */ - const char* lastForwardSlash = strrchr(path, '/'); - const char* lastBackwardSlash = strrchr(path, '\\'); - const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash; - if (lastSlash == path) lastSlash++; /* Never drop starting slash. */ - dirLength = (int)(lastSlash ? lastSlash - path : 0); - dir = MALLOC(char, dirLength + 1); - memcpy(dir, path, dirLength); - dir[dirLength] = '\0'; - - data = _spUtil_readFile(path, &length); - if (data) atlas = spAtlas_create(data, length, dir, rendererObject); - - FREE(data); - FREE(dir); - return atlas; -} - -void spAtlas_dispose(spAtlas* self) { - spAtlasRegion* region, *nextRegion; - spAtlasPage* page = self->pages; - while (page) { - spAtlasPage* nextPage = page->next; - spAtlasPage_dispose(page); - page = nextPage; - } - - region = self->regions; - while (region) { - nextRegion = region->next; - spAtlasRegion_dispose(region); - region = nextRegion; - } - - FREE(self); -} - -spAtlasRegion* spAtlas_findRegion(const spAtlas* self, const char* name) { - spAtlasRegion* region = self->regions; - while (region) { - if (strcmp(region->name, name) == 0) return region; - region = region->next; - } - return 0; -} diff --git a/cocos/editor-support/spine/Atlas.cpp b/cocos/editor-support/spine/Atlas.cpp new file mode 100644 index 00000000000..ea3b6f3484b --- /dev/null +++ b/cocos/editor-support/spine/Atlas.cpp @@ -0,0 +1,357 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include + +#include + +using namespace spine; + +Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) { + int dirLength; + char *dir; + int length; + const char *data; + + /* Get directory from atlas path. */ + const char *lastForwardSlash = strrchr(path.buffer(), '/'); + const char *lastBackwardSlash = strrchr(path.buffer(), '\\'); + const char *lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash; + if (lastSlash == path) lastSlash++; /* Never drop starting slash. */ + dirLength = (int) (lastSlash ? lastSlash - path.buffer() : 0); + dir = SpineExtension::calloc(dirLength + 1, __FILE__, __LINE__); + memcpy(dir, path.buffer(), dirLength); + dir[dirLength] = '\0'; + + data = SpineExtension::readFile(path, &length); + if (data) { + load(data, length, dir); + } + + SpineExtension::free(data, __FILE__, __LINE__); + SpineExtension::free(dir, __FILE__, __LINE__); +} + +Atlas::Atlas(const char *data, int length, const char *dir, TextureLoader *textureLoader) : _textureLoader( + textureLoader) { + load(data, length, dir); +} + +Atlas::~Atlas() { + if (_textureLoader) { + for (size_t i = 0, n = _pages.size(); i < n; ++i) { + _textureLoader->unload(_pages[i]->getRendererObject()); + } + } + ContainerUtil::cleanUpVectorOfPointers(_pages); + ContainerUtil::cleanUpVectorOfPointers(_regions); +} + +void Atlas::flipV() { + for (size_t i = 0, n = _regions.size(); i < n; ++i) { + AtlasRegion *regionP = _regions[i]; + AtlasRegion ®ion = *regionP; + region.v = 1 - region.v; + region.v2 = 1 - region.v2; + } +} + +AtlasRegion *Atlas::findRegion(const String &name) { + for (size_t i = 0, n = _regions.size(); i < n; ++i) { + if (_regions[i]->name == name) { + return _regions[i]; + } + } + + return NULL; +} + +Vector &Atlas::getPages() { + return _pages; +} + +void Atlas::load(const char *begin, int length, const char *dir) { + static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888", + "RGBA8888"}; + static const char *textureFilterNames[] = {"", "Nearest", "Linear", "MipMap", "MipMapNearestNearest", + "MipMapLinearNearest", + "MipMapNearestLinear", "MipMapLinearLinear"}; + + int count; + const char *end = begin + length; + int dirLength = (int) strlen(dir); + int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\'; + + AtlasPage *page = NULL; + Str str; + Str tuple[4]; + + while (readLine(&begin, end, &str)) { + if (str.end - str.begin == 0) { + page = 0; + } else if (!page) { + char *name = mallocString(&str); + char *path = SpineExtension::calloc(dirLength + needsSlash + strlen(name) + 1, __FILE__, __LINE__); + memcpy(path, dir, dirLength); + if (needsSlash) { + path[dirLength] = '/'; + } + strcpy(path + dirLength + needsSlash, name); + + page = new(__FILE__, __LINE__) AtlasPage(String(name, true)); + + int tupleVal = readTuple(&begin, end, tuple); + assert(tupleVal == 2); + + /* size is only optional for an atlas packed with an old TexturePacker. */ + page->width = toInt(tuple); + page->height = toInt(tuple + 1); + readTuple(&begin, end, tuple); + + page->format = (Format) indexOf(formatNames, 8, tuple); + + readTuple(&begin, end, tuple); + page->minFilter = (TextureFilter) indexOf(textureFilterNames, 8, tuple); + page->magFilter = (TextureFilter) indexOf(textureFilterNames, 8, tuple + 1); + + readValue(&begin, end, &str); + + page->uWrap = TextureWrap_ClampToEdge; + page->vWrap = TextureWrap_ClampToEdge; + if (!equals(&str, "none")) { + if (str.end - str.begin == 1) { + if (*str.begin == 'x') { + page->uWrap = TextureWrap_Repeat; + } else if (*str.begin == 'y') { + page->vWrap = TextureWrap_Repeat; + } + } else if (equals(&str, "xy")) { + page->uWrap = TextureWrap_Repeat; + page->vWrap = TextureWrap_Repeat; + } + } + + if (_textureLoader) _textureLoader->load(*page, String(path)); + + SpineExtension::free(path, __FILE__, __LINE__); + + _pages.add(page); + } else { + AtlasRegion *region = new(__FILE__, __LINE__) AtlasRegion(); + + region->page = page; + region->name = String(mallocString(&str), true); + + readValue(&begin, end, &str); + region->rotate = equals(&str, "true") ? true : false; + + readTuple(&begin, end, tuple); + region->x = toInt(tuple); + region->y = toInt(tuple + 1); + + readTuple(&begin, end, tuple); + region->width = toInt(tuple); + region->height = toInt(tuple + 1); + + region->u = region->x / (float) page->width; + region->v = region->y / (float) page->height; + if (region->rotate) { + region->u2 = (region->x + region->height) / (float) page->width; + region->v2 = (region->y + region->width) / (float) page->height; + } else { + region->u2 = (region->x + region->width) / (float) page->width; + region->v2 = (region->y + region->height) / (float) page->height; + } + + count = readTuple(&begin, end, tuple); + assert(count); + + if (count == 4) { + /* split is optional */ + region->splits.setSize(4, 0); + region->splits[0] = toInt(tuple); + region->splits[1] = toInt(tuple + 1); + region->splits[2] = toInt(tuple + 2); + region->splits[3] = toInt(tuple + 3); + + count = readTuple(&begin, end, tuple); + assert(count); + + if (count == 4) { + /* pad is optional, but only present with splits */ + region->pads.setSize(4, 0); + region->pads[0] = toInt(tuple); + region->pads[1] = toInt(tuple + 1); + region->pads[2] = toInt(tuple + 2); + region->pads[3] = toInt(tuple + 3); + + readTuple(&begin, end, tuple); + } + } + + region->originalWidth = toInt(tuple); + region->originalHeight = toInt(tuple + 1); + + readTuple(&begin, end, tuple); + region->offsetX = (float)toInt(tuple); + region->offsetY = (float)toInt(tuple + 1); + + readValue(&begin, end, &str); + + region->index = toInt(&str); + + _regions.add(region); + } + } +} + +void Atlas::trim(Str *str) { + while (isspace((unsigned char) *str->begin) && str->begin < str->end) { + (str->begin)++; + } + + if (str->begin == str->end) { + return; + } + + str->end--; + + while (((unsigned char)*str->end == '\r') && str->end >= str->begin) { + str->end--; + } + + str->end++; +} + +int Atlas::readLine(const char **begin, const char *end, Str *str) { + if (*begin == end) { + return 0; + } + + str->begin = *begin; + + /* Find next delimiter. */ + while (*begin != end && **begin != '\n') { + (*begin)++; + } + + str->end = *begin; + trim(str); + + if (*begin != end) { + (*begin)++; + } + + return 1; +} + +int Atlas::beginPast(Str *str, char c) { + const char *begin = str->begin; + while (true) { + char lastSkippedChar = *begin; + if (begin == str->end) { + return 0; + } + begin++; + if (lastSkippedChar == c) { + break; + } + } + str->begin = begin; + return 1; +} + +int Atlas::readValue(const char **begin, const char *end, Str *str) { + readLine(begin, end, str); + if (!beginPast(str, ':')) { + return 0; + } + + trim(str); + return 1; +} + +int Atlas::readTuple(const char **begin, const char *end, Str tuple[]) { + int i; + Str str = {NULL, NULL}; + readLine(begin, end, &str); + if (!beginPast(&str, ':')) { + return 0; + } + + for (i = 0; i < 3; ++i) { + tuple[i].begin = str.begin; + if (!beginPast(&str, ',')) { + break; + } + + tuple[i].end = str.begin - 2; + trim(&tuple[i]); + } + + tuple[i].begin = str.begin; + tuple[i].end = str.end; + trim(&tuple[i]); + + return i + 1; +} + +char *Atlas::mallocString(Str *str) { + int length = (int) (str->end - str->begin); + char *string = SpineExtension::calloc(length + 1, __FILE__, __LINE__); + memcpy(string, str->begin, length); + string[length] = '\0'; + return string; +} + +int Atlas::indexOf(const char **array, int count, Str *str) { + int length = (int) (str->end - str->begin); + int i; + for (i = count - 1; i >= 0; i--) { + if (strncmp(array[i], str->begin, length) == 0) { + return i; + } + } + return 0; +} + +int Atlas::equals(Str *str, const char *other) { + return strncmp(other, str->begin, str->end - str->begin) == 0; +} + +int Atlas::toInt(Str *str) { + return (int) strtol(str->begin, (char **) &str->end, 10); +} diff --git a/cocos/editor-support/spine/Atlas.h b/cocos/editor-support/spine/Atlas.h index 7812e0440fb..6b49518c38e 100644 --- a/cocos/editor-support/spine/Atlas.h +++ b/cocos/editor-support/spine/Atlas.h @@ -1,174 +1,159 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ATLAS_H_ -#define SPINE_ATLAS_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spAtlas spAtlas; - -typedef enum { - SP_ATLAS_UNKNOWN_FORMAT, - SP_ATLAS_ALPHA, - SP_ATLAS_INTENSITY, - SP_ATLAS_LUMINANCE_ALPHA, - SP_ATLAS_RGB565, - SP_ATLAS_RGBA4444, - SP_ATLAS_RGB888, - SP_ATLAS_RGBA8888 -} spAtlasFormat; - -typedef enum { - SP_ATLAS_UNKNOWN_FILTER, - SP_ATLAS_NEAREST, - SP_ATLAS_LINEAR, - SP_ATLAS_MIPMAP, - SP_ATLAS_MIPMAP_NEAREST_NEAREST, - SP_ATLAS_MIPMAP_LINEAR_NEAREST, - SP_ATLAS_MIPMAP_NEAREST_LINEAR, - SP_ATLAS_MIPMAP_LINEAR_LINEAR -} spAtlasFilter; - -typedef enum { - SP_ATLAS_MIRROREDREPEAT, - SP_ATLAS_CLAMPTOEDGE, - SP_ATLAS_REPEAT -} spAtlasWrap; - -typedef struct spAtlasPage spAtlasPage; -struct spAtlasPage { - const spAtlas* atlas; - const char* name; - spAtlasFormat format; - spAtlasFilter minFilter, magFilter; - spAtlasWrap uWrap, vWrap; - - void* rendererObject; - int width, height; - - spAtlasPage* next; -}; - -SP_API spAtlasPage* spAtlasPage_create (spAtlas* atlas, const char* name); -SP_API void spAtlasPage_dispose (spAtlasPage* self); - -#ifdef SPINE_SHORT_NAMES -typedef spAtlasFormat AtlasFormat; -#define ATLAS_UNKNOWN_FORMAT SP_ATLAS_UNKNOWN_FORMAT -#define ATLAS_ALPHA SP_ATLAS_ALPHA -#define ATLAS_INTENSITY SP_ATLAS_INTENSITY -#define ATLAS_LUMINANCE_ALPHA SP_ATLAS_LUMINANCE_ALPHA -#define ATLAS_RGB565 SP_ATLAS_RGB565 -#define ATLAS_RGBA4444 SP_ATLAS_RGBA4444 -#define ATLAS_RGB888 SP_ATLAS_RGB888 -#define ATLAS_RGBA8888 SP_ATLAS_RGBA8888 -typedef spAtlasFilter AtlasFilter; -#define ATLAS_UNKNOWN_FILTER SP_ATLAS_UNKNOWN_FILTER -#define ATLAS_NEAREST SP_ATLAS_NEAREST -#define ATLAS_LINEAR SP_ATLAS_LINEAR -#define ATLAS_MIPMAP SP_ATLAS_MIPMAP -#define ATLAS_MIPMAP_NEAREST_NEAREST SP_ATLAS_MIPMAP_NEAREST_NEAREST -#define ATLAS_MIPMAP_LINEAR_NEAREST SP_ATLAS_MIPMAP_LINEAR_NEAREST -#define ATLAS_MIPMAP_NEAREST_LINEAR SP_ATLAS_MIPMAP_NEAREST_LINEAR -#define ATLAS_MIPMAP_LINEAR_LINEAR SP_ATLAS_MIPMAP_LINEAR_LINEAR -typedef spAtlasWrap AtlasWrap; -#define ATLAS_MIRROREDREPEAT SP_ATLAS_MIRROREDREPEAT -#define ATLAS_CLAMPTOEDGE SP_ATLAS_CLAMPTOEDGE -#define ATLAS_REPEAT SP_ATLAS_REPEAT -typedef spAtlasPage AtlasPage; -#define AtlasPage_create(...) spAtlasPage_create(__VA_ARGS__) -#define AtlasPage_dispose(...) spAtlasPage_dispose(__VA_ARGS__) -#endif - -/**/ - -typedef struct spAtlasRegion spAtlasRegion; -struct spAtlasRegion { - const char* name; - int x, y, width, height; - float u, v, u2, v2; - int offsetX, offsetY; - int originalWidth, originalHeight; - int index; - int/*bool*/rotate; - int/*bool*/flip; - int* splits; - int* pads; - - spAtlasPage* page; - - spAtlasRegion* next; -}; - -SP_API spAtlasRegion* spAtlasRegion_create (); -SP_API void spAtlasRegion_dispose (spAtlasRegion* self); - -#ifdef SPINE_SHORT_NAMES -typedef spAtlasRegion AtlasRegion; -#define AtlasRegion_create(...) spAtlasRegion_create(__VA_ARGS__) -#define AtlasRegion_dispose(...) spAtlasRegion_dispose(__VA_ARGS__) -#endif - -/**/ - -struct spAtlas { - spAtlasPage* pages; - spAtlasRegion* regions; - - void* rendererObject; -}; - -/* Image files referenced in the atlas file will be prefixed with dir. */ -SP_API spAtlas* spAtlas_create (const char* data, int length, const char* dir, void* rendererObject); -/* Image files referenced in the atlas file will be prefixed with the directory containing the atlas file. */ -SP_API spAtlas* spAtlas_createFromFile (const char* path, void* rendererObject); -SP_API void spAtlas_dispose (spAtlas* atlas); - -/* Returns 0 if the region was not found. */ -SP_API spAtlasRegion* spAtlas_findRegion (const spAtlas* self, const char* name); - -#ifdef SPINE_SHORT_NAMES -typedef spAtlas Atlas; -#define Atlas_create(...) spAtlas_create(__VA_ARGS__) -#define Atlas_createFromFile(...) spAtlas_createFromFile(__VA_ARGS__) -#define Atlas_dispose(...) spAtlas_dispose(__VA_ARGS__) -#define Atlas_findRegion(...) spAtlas_findRegion(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ATLAS_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Atlas_h +#define Spine_Atlas_h + +#include +#include +#include +#include +#include + +namespace spine { +enum Format { + Format_Alpha, + Format_Intensity, + Format_LuminanceAlpha, + Format_RGB565, + Format_RGBA4444, + Format_RGB888, + Format_RGBA8888 +}; + +enum TextureFilter { + TextureFilter_Unknown, + TextureFilter_Nearest, + TextureFilter_Linear, + TextureFilter_MipMap, + TextureFilter_MipMapNearestNearest, + TextureFilter_MipMapLinearNearest, + TextureFilter_MipMapNearestLinear, + TextureFilter_MipMapLinearLinear +}; + +enum TextureWrap { + TextureWrap_MirroredRepeat, + TextureWrap_ClampToEdge, + TextureWrap_Repeat +}; + +class SP_API AtlasPage : public SpineObject, public HasRendererObject { +public: + String name; + Format format; + TextureFilter minFilter; + TextureFilter magFilter; + TextureWrap uWrap; + TextureWrap vWrap; + int width, height; + + explicit AtlasPage(const String &inName) : name(inName), format(Format_RGBA8888), minFilter(TextureFilter_Nearest), + magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge), + vWrap(TextureWrap_ClampToEdge) { + } + + virtual ~AtlasPage() { } +}; + +class SP_API AtlasRegion : public SpineObject { +public: + AtlasPage *page; + String name; + int x, y, width, height; + float u, v, u2, v2; + float offsetX, offsetY; + int originalWidth, originalHeight; + int index; + bool rotate; + Vector splits; + Vector pads; +}; + +class TextureLoader; + +class SP_API Atlas : public SpineObject { +public: + Atlas(const String &path, TextureLoader *textureLoader); + + Atlas(const char *data, int length, const char *dir, TextureLoader *textureLoader); + + ~Atlas(); + + void flipV(); + + /// Returns the first region found with the specified name. This method uses String comparison to find the region, so the result + /// should be cached rather than calling this method multiple times. + /// @return The region, or NULL. + AtlasRegion *findRegion(const String &name); + + Vector &getPages(); + +private: + Vector _pages; + Vector _regions; + TextureLoader *_textureLoader; + + void load(const char *begin, int length, const char *dir); + + class Str { + public: + const char *begin; + const char *end; + }; + + static void trim(Str *str); + + /// Tokenize string without modification. Returns 0 on failure + static int readLine(const char **begin, const char *end, Str *str); + + /// Moves str->begin past the first occurence of c. Returns 0 on failure + static int beginPast(Str *str, char c); + + /// Returns 0 on failure + static int readValue(const char **begin, const char *end, Str *str); + + /// Returns the number of tuple values read (1, 2, 4, or 0 for failure) + static int readTuple(const char **begin, const char *end, Str tuple[]); + + static char *mallocString(Str *str); + + static int indexOf(const char **array, int count, Str *str); + + static int equals(Str *str, const char *other); + + static int toInt(Str *str); + + static Atlas *abortAtlas(Atlas *atlas); +}; +} + +#endif /* Spine_Atlas_h */ + diff --git a/cocos/editor-support/spine/AtlasAttachmentLoader.c b/cocos/editor-support/spine/AtlasAttachmentLoader.c deleted file mode 100644 index c4a61370975..00000000000 --- a/cocos/editor-support/spine/AtlasAttachmentLoader.c +++ /dev/null @@ -1,100 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spAttachment* _spAtlasAttachmentLoader_createAttachment (spAttachmentLoader* loader, spSkin* skin, spAttachmentType type, - const char* name, const char* path) { - spAtlasAttachmentLoader* self = SUB_CAST(spAtlasAttachmentLoader, loader); - switch (type) { - case SP_ATTACHMENT_REGION: { - spRegionAttachment* attachment; - spAtlasRegion* region = spAtlas_findRegion(self->atlas, path); - if (!region) { - _spAttachmentLoader_setError(loader, "Region not found: ", path); - return 0; - } - attachment = spRegionAttachment_create(name); - attachment->rendererObject = region; - spRegionAttachment_setUVs(attachment, region->u, region->v, region->u2, region->v2, region->rotate); - attachment->regionOffsetX = region->offsetX; - attachment->regionOffsetY = region->offsetY; - attachment->regionWidth = region->width; - attachment->regionHeight = region->height; - attachment->regionOriginalWidth = region->originalWidth; - attachment->regionOriginalHeight = region->originalHeight; - return SUPER(attachment); - } - case SP_ATTACHMENT_MESH: - case SP_ATTACHMENT_LINKED_MESH: { - spMeshAttachment* attachment; - spAtlasRegion* region = spAtlas_findRegion(self->atlas, path); - if (!region) { - _spAttachmentLoader_setError(loader, "Region not found: ", path); - return 0; - } - attachment = spMeshAttachment_create(name); - attachment->rendererObject = region; - attachment->regionU = region->u; - attachment->regionV = region->v; - attachment->regionU2 = region->u2; - attachment->regionV2 = region->v2; - attachment->regionRotate = region->rotate; - attachment->regionOffsetX = region->offsetX; - attachment->regionOffsetY = region->offsetY; - attachment->regionWidth = region->width; - attachment->regionHeight = region->height; - attachment->regionOriginalWidth = region->originalWidth; - attachment->regionOriginalHeight = region->originalHeight; - return SUPER(SUPER(attachment)); - } - case SP_ATTACHMENT_BOUNDING_BOX: - return SUPER(SUPER(spBoundingBoxAttachment_create(name))); - case SP_ATTACHMENT_PATH: - return SUPER(SUPER(spPathAttachment_create(name))); - case SP_ATTACHMENT_POINT: - return SUPER(SUPER(spPointAttachment_create(name))); - case SP_ATTACHMENT_CLIPPING: - return SUPER(SUPER(spClippingAttachment_create(name))); - default: - _spAttachmentLoader_setUnknownTypeError(loader, type); - return 0; - } - - UNUSED(skin); -} - -spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas) { - spAtlasAttachmentLoader* self = NEW(spAtlasAttachmentLoader); - _spAttachmentLoader_init(SUPER(self), _spAttachmentLoader_deinit, _spAtlasAttachmentLoader_createAttachment, 0, 0); - self->atlas = atlas; - return self; -} diff --git a/cocos/editor-support/spine/AtlasAttachmentLoader.cpp b/cocos/editor-support/spine/AtlasAttachmentLoader.cpp new file mode 100644 index 00000000000..ad6c3c51934 --- /dev/null +++ b/cocos/editor-support/spine/AtlasAttachmentLoader.cpp @@ -0,0 +1,129 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +******************************************************S**********************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace spine { +RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader) + +AtlasAttachmentLoader::AtlasAttachmentLoader(Atlas *atlas) : AttachmentLoader(), _atlas(atlas) { +} + +RegionAttachment *AtlasAttachmentLoader::newRegionAttachment(Skin &skin, const String &name, const String &path) { + SP_UNUSED(skin); + + AtlasRegion *regionP = findRegion(path); + if (!regionP) return NULL; + + AtlasRegion ®ion = *regionP; + + RegionAttachment *attachmentP = new(__FILE__, __LINE__) RegionAttachment(name); + + RegionAttachment &attachment = *attachmentP; + attachment.setRendererObject(regionP); + attachment.setUVs(region.u, region.v, region.u2, region.v2, region.rotate); + attachment._regionOffsetX = region.offsetX; + attachment._regionOffsetY = region.offsetY; + attachment._regionWidth = (float)region.width; + attachment._regionHeight = (float)region.height; + attachment._regionOriginalWidth = (float)region.originalWidth; + attachment._regionOriginalHeight = (float)region.originalHeight; + return attachmentP; +} + +MeshAttachment *AtlasAttachmentLoader::newMeshAttachment(Skin &skin, const String &name, const String &path) { + SP_UNUSED(skin); + + AtlasRegion *regionP = findRegion(path); + if (!regionP) return NULL; + + AtlasRegion ®ion = *regionP; + + MeshAttachment *attachmentP = new(__FILE__, __LINE__) MeshAttachment(name); + + MeshAttachment &attachment = *attachmentP; + attachment.setRendererObject(regionP); + attachment._regionU = region.u; + attachment._regionV = region.v; + attachment._regionU2 = region.u2; + attachment._regionV2 = region.v2; + attachment._regionRotate = region.rotate; + attachment._regionOffsetX = region.offsetX; + attachment._regionOffsetY = region.offsetY; + attachment._regionWidth = (float)region.width; + attachment._regionHeight = (float)region.height; + attachment._regionOriginalWidth = (float)region.originalWidth; + attachment._regionOriginalHeight = (float)region.originalHeight; + + return attachmentP; +} + +BoundingBoxAttachment *AtlasAttachmentLoader::newBoundingBoxAttachment(Skin &skin, const String &name) { + SP_UNUSED(skin); + return new(__FILE__, __LINE__) BoundingBoxAttachment(name); +} + +PathAttachment *AtlasAttachmentLoader::newPathAttachment(Skin &skin, const String &name) { + SP_UNUSED(skin); + return new(__FILE__, __LINE__) PathAttachment(name); +} + +PointAttachment *AtlasAttachmentLoader::newPointAttachment(Skin &skin, const String &name) { + SP_UNUSED(skin); + return new(__FILE__, __LINE__) PointAttachment(name); +} + +ClippingAttachment *AtlasAttachmentLoader::newClippingAttachment(Skin &skin, const String &name) { + SP_UNUSED(skin); + return new(__FILE__, __LINE__) ClippingAttachment(name); +} + +void AtlasAttachmentLoader::configureAttachment(Attachment* attachment) { + SP_UNUSED(attachment); +} + +AtlasRegion *AtlasAttachmentLoader::findRegion(const String &name) { + return _atlas->findRegion(name); +} + +} diff --git a/cocos/editor-support/spine/AtlasAttachmentLoader.h b/cocos/editor-support/spine/AtlasAttachmentLoader.h index 6b9ed688e09..bb1a5a5d082 100644 --- a/cocos/editor-support/spine/AtlasAttachmentLoader.h +++ b/cocos/editor-support/spine/AtlasAttachmentLoader.h @@ -1,58 +1,74 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ATLASATTACHMENTLOADER_H_ -#define SPINE_ATLASATTACHMENTLOADER_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spAtlasAttachmentLoader { - spAttachmentLoader super; - spAtlas* atlas; -} spAtlasAttachmentLoader; - -SP_API spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas); - -#ifdef SPINE_SHORT_NAMES -typedef spAtlasAttachmentLoader AtlasAttachmentLoader; -#define AtlasAttachmentLoader_create(...) spAtlasAttachmentLoader_create(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ATLASATTACHMENTLOADER_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_AtlasAttachmentLoader_h +#define Spine_AtlasAttachmentLoader_h + +#include +#include +#include + + +namespace spine { + class Atlas; + class AtlasRegion; + + /// + /// An AttachmentLoader that configures attachments using texture regions from an Atlas. + /// See http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data about Loading Skeleton Data in the Spine Runtimes Guide. + /// + class SP_API AtlasAttachmentLoader : public AttachmentLoader { + public: + RTTI_DECL + + explicit AtlasAttachmentLoader(Atlas* atlas); + + virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path); + + virtual MeshAttachment* newMeshAttachment(Skin& skin, const String& name, const String& path); + + virtual BoundingBoxAttachment* newBoundingBoxAttachment(Skin& skin, const String& name); + + virtual PathAttachment* newPathAttachment(Skin& skin, const String& name); + + virtual PointAttachment* newPointAttachment(Skin& skin, const String& name); + + virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name); + + virtual void configureAttachment(Attachment* attachment); + + AtlasRegion* findRegion(const String& name); + + private: + Atlas* _atlas; + }; +} + +#endif /* Spine_AtlasAttachmentLoader_h */ diff --git a/cocos/editor-support/spine/Attachment.cpp b/cocos/editor-support/spine/Attachment.cpp new file mode 100644 index 00000000000..e3bb6f26cef --- /dev/null +++ b/cocos/editor-support/spine/Attachment.cpp @@ -0,0 +1,52 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +RTTI_IMPL_NOPARENT(Attachment) + +Attachment::Attachment(const String &name) : _name(name) { + assert(_name.length() > 0); +} + +Attachment::~Attachment() { +} + +const String &Attachment::getName() const { + return _name; +} diff --git a/cocos/editor-support/spine/Attachment.h b/cocos/editor-support/spine/Attachment.h index 286a8bec4db..0a0c000183e 100644 --- a/cocos/editor-support/spine/Attachment.h +++ b/cocos/editor-support/spine/Attachment.h @@ -1,83 +1,54 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ATTACHMENT_H_ -#define SPINE_ATTACHMENT_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct spAttachmentLoader; - -typedef enum { - SP_ATTACHMENT_REGION, - SP_ATTACHMENT_BOUNDING_BOX, - SP_ATTACHMENT_MESH, - SP_ATTACHMENT_LINKED_MESH, - SP_ATTACHMENT_PATH, - SP_ATTACHMENT_POINT, - SP_ATTACHMENT_CLIPPING -} spAttachmentType; - -typedef struct spAttachment { - const char* const name; - const spAttachmentType type; - const void* const vtable; - struct spAttachmentLoader* attachmentLoader; - -#ifdef __cplusplus - spAttachment() : - name(0), - type(SP_ATTACHMENT_REGION), - vtable(0) { - } -#endif -} spAttachment; - -void spAttachment_dispose (spAttachment* self); - -#ifdef SPINE_SHORT_NAMES -typedef spAttachmentType AttachmentType; -#define ATTACHMENT_REGION SP_ATTACHMENT_REGION -#define ATTACHMENT_BOUNDING_BOX SP_ATTACHMENT_BOUNDING_BOX -#define ATTACHMENT_MESH SP_ATTACHMENT_MESH -#define ATTACHMENT_LINKED_MESH SP_ATTACHMENT_LINKED_MESH -typedef spAttachment Attachment; -#define Attachment_dispose(...) spAttachment_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Attachment_h +#define Spine_Attachment_h + +#include +#include +#include + +namespace spine { +class SP_API Attachment : public SpineObject { +RTTI_DECL + +public: + explicit Attachment(const String &name); + + virtual ~Attachment(); + + const String &getName() const; + +private: + const String _name; +}; +} + +#endif /* Spine_Attachment_h */ diff --git a/cocos/editor-support/spine/AttachmentLoader.c b/cocos/editor-support/spine/AttachmentLoader.c deleted file mode 100644 index 14cbd92ab63..00000000000 --- a/cocos/editor-support/spine/AttachmentLoader.c +++ /dev/null @@ -1,98 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -typedef struct _spAttachmentLoaderVtable { - spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, - const char* path); - void (*configureAttachment) (spAttachmentLoader* self, spAttachment*); - void (*disposeAttachment) (spAttachmentLoader* self, spAttachment*); - void (*dispose) (spAttachmentLoader* self); -} _spAttachmentLoaderVtable; - -void _spAttachmentLoader_init (spAttachmentLoader* self, - void (*dispose) (spAttachmentLoader* self), - spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, - const char* path), - void (*configureAttachment) (spAttachmentLoader* self, spAttachment*), - void (*disposeAttachment) (spAttachmentLoader* self, spAttachment*) -) { - CONST_CAST(_spAttachmentLoaderVtable*, self->vtable) = NEW(_spAttachmentLoaderVtable); - VTABLE(spAttachmentLoader, self)->dispose = dispose; - VTABLE(spAttachmentLoader, self)->createAttachment = createAttachment; - VTABLE(spAttachmentLoader, self)->configureAttachment = configureAttachment; - VTABLE(spAttachmentLoader, self)->disposeAttachment = disposeAttachment; -} - -void _spAttachmentLoader_deinit (spAttachmentLoader* self) { - FREE(self->vtable); - FREE(self->error1); - FREE(self->error2); -} - -void spAttachmentLoader_dispose (spAttachmentLoader* self) { - VTABLE(spAttachmentLoader, self)->dispose(self); - FREE(self); -} - -spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, - const char* path) { - FREE(self->error1); - FREE(self->error2); - self->error1 = 0; - self->error2 = 0; - return VTABLE(spAttachmentLoader, self)->createAttachment(self, skin, type, name, path); -} - -void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, spAttachment* attachment) { - if (!VTABLE(spAttachmentLoader, self)->configureAttachment) return; - VTABLE(spAttachmentLoader, self)->configureAttachment(self, attachment); -} - -void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment) { - if (!VTABLE(spAttachmentLoader, self)->disposeAttachment) return; - VTABLE(spAttachmentLoader, self)->disposeAttachment(self, attachment); -} - -void _spAttachmentLoader_setError (spAttachmentLoader* self, const char* error1, const char* error2) { - FREE(self->error1); - FREE(self->error2); - MALLOC_STR(self->error1, error1); - MALLOC_STR(self->error2, error2); -} - -void _spAttachmentLoader_setUnknownTypeError (spAttachmentLoader* self, spAttachmentType type) { - char buffer[16]; - sprintf(buffer, "%d", type); - _spAttachmentLoader_setError(self, "Unknown attachment type: ", buffer); -} diff --git a/cocos/editor-support/spine/AttachmentLoader.cpp b/cocos/editor-support/spine/AttachmentLoader.cpp new file mode 100644 index 00000000000..1e3011fd67f --- /dev/null +++ b/cocos/editor-support/spine/AttachmentLoader.cpp @@ -0,0 +1,53 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL_NOPARENT(AttachmentLoader) + +AttachmentLoader::AttachmentLoader() { +} + +AttachmentLoader::~AttachmentLoader() { +} diff --git a/cocos/editor-support/spine/AttachmentLoader.h b/cocos/editor-support/spine/AttachmentLoader.h index f0f556553c6..730083d1eda 100644 --- a/cocos/editor-support/spine/AttachmentLoader.h +++ b/cocos/editor-support/spine/AttachmentLoader.h @@ -1,79 +1,76 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_ATTACHMENTLOADER_H_ -#define SPINE_ATTACHMENTLOADER_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spAttachmentLoader { - const char* error1; - const char* error2; - - const void* const vtable; -#ifdef __cplusplus - spAttachmentLoader () : - error1(0), - error2(0), - vtable(0) { - } -#endif -} spAttachmentLoader; - -SP_API void spAttachmentLoader_dispose (spAttachmentLoader* self); - -/* Called to create each attachment. Returns 0 to not load an attachment. If 0 is returned and _spAttachmentLoader_setError was - * called, an error occurred. */ -SP_API spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, - const char* path); -/* Called after the attachment has been fully configured. */ -SP_API void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, spAttachment* attachment); -/* Called just before the attachment is disposed. This can release allocations made in spAttachmentLoader_configureAttachment. */ -SP_API void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment); - -#ifdef SPINE_SHORT_NAMES -typedef spAttachmentLoader AttachmentLoader; -#define AttachmentLoader_dispose(...) spAttachmentLoader_dispose(__VA_ARGS__) -#define AttachmentLoader_createAttachment(...) spAttachmentLoader_createAttachment(__VA_ARGS__) -#define AttachmentLoader_configureAttachment(...) spAttachmentLoader_configureAttachment(__VA_ARGS__) -#define AttachmentLoader_disposeAttachment(...) spAttachmentLoader_disposeAttachment(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_ATTACHMENTLOADER_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_AttachmentLoader_h +#define Spine_AttachmentLoader_h + +#include +#include +#include + +namespace spine { + class Skin; + class Attachment; + class RegionAttachment; + class MeshAttachment; + class BoundingBoxAttachment; + class PathAttachment; + class PointAttachment; + class ClippingAttachment; + + class SP_API AttachmentLoader : public SpineObject { + public: + RTTI_DECL + + AttachmentLoader(); + + virtual ~AttachmentLoader(); + + /// @return May be NULL to not load any attachment. + virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path) = 0; + + /// @return May be NULL to not load any attachment. + virtual MeshAttachment* newMeshAttachment(Skin& skin, const String& name, const String& path) = 0; + + /// @return May be NULL to not load any attachment. + virtual BoundingBoxAttachment* newBoundingBoxAttachment(Skin& skin, const String& name) = 0; + + /// @return May be NULL to not load any attachment + virtual PathAttachment* newPathAttachment(Skin& skin, const String& name) = 0; + + virtual PointAttachment* newPointAttachment(Skin& skin, const String& name) = 0; + + virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name) = 0; + + virtual void configureAttachment(Attachment* attachment) = 0; + }; +} + +#endif /* Spine_AttachmentLoader_h */ diff --git a/cocos/editor-support/spine/AttachmentTimeline.cpp b/cocos/editor-support/spine/AttachmentTimeline.cpp new file mode 100644 index 00000000000..3d132dbc688 --- /dev/null +++ b/cocos/editor-support/spine/AttachmentTimeline.cpp @@ -0,0 +1,125 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(AttachmentTimeline, Timeline) + +AttachmentTimeline::AttachmentTimeline(int frameCount) : Timeline(), _slotIndex(0) { + _frames.ensureCapacity(frameCount); + _attachmentNames.ensureCapacity(frameCount); + + _frames.setSize(frameCount, 0); + + for (int i = 0; i < frameCount; ++i) { + _attachmentNames.add(String()); + } +} + +void AttachmentTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(alpha); + + assert(_slotIndex < skeleton._slots.size()); + + String *attachmentName; + Slot *slotP = skeleton._slots[_slotIndex]; + Slot &slot = *slotP; + if (direction == MixDirection_Out && blend == MixBlend_Setup) { + attachmentName = &slot._data._attachmentName; + slot.setAttachment(attachmentName->length() == 0 ? NULL : skeleton.getAttachment(_slotIndex, *attachmentName)); + return; + } + + if (time < _frames[0]) { + // Time is before first frame. + if (blend == MixBlend_Setup || blend == MixBlend_First) { + attachmentName = &slot._data._attachmentName; + slot.setAttachment(attachmentName->length() == 0 ? NULL : skeleton.getAttachment(_slotIndex, *attachmentName)); + } + return; + } + + size_t frameIndex; + if (time >= _frames[_frames.size() - 1]) { + // Time is after last frame. + frameIndex = _frames.size() - 1; + } else { + frameIndex = Animation::binarySearch(_frames, time, 1) - 1; + } + + attachmentName = &_attachmentNames[frameIndex]; + slot.setAttachment(attachmentName->length() == 0 ? NULL : skeleton.getAttachment(_slotIndex, *attachmentName)); +} + +int AttachmentTimeline::getPropertyId() { + return ((int) TimelineType_Attachment << 24) + _slotIndex; +} + +void AttachmentTimeline::setFrame(int frameIndex, float time, const String &attachmentName) { + _frames[frameIndex] = time; + _attachmentNames[frameIndex] = attachmentName; +} + +size_t AttachmentTimeline::getSlotIndex() { + return _slotIndex; +} + +void AttachmentTimeline::setSlotIndex(size_t inValue) { + _slotIndex = inValue; +} + +const Vector &AttachmentTimeline::getFrames() { + return _frames; +} + +const Vector &AttachmentTimeline::getAttachmentNames() { + return _attachmentNames; +} + +size_t AttachmentTimeline::getFrameCount() { + return _frames.size(); +} diff --git a/cocos/editor-support/spine/AttachmentTimeline.h b/cocos/editor-support/spine/AttachmentTimeline.h new file mode 100644 index 00000000000..b281c043de4 --- /dev/null +++ b/cocos/editor-support/spine/AttachmentTimeline.h @@ -0,0 +1,74 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_AttachmentTimeline_h +#define Spine_AttachmentTimeline_h + +#include +#include +#include +#include +#include +#include + +namespace spine { + + class Skeleton; + class Event; + + class SP_API AttachmentTimeline : public Timeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit AttachmentTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, const String& attachmentName); + + size_t getSlotIndex(); + void setSlotIndex(size_t inValue); + const Vector& getFrames(); + const Vector& getAttachmentNames(); + size_t getFrameCount(); + private: + size_t _slotIndex; + Vector _frames; + Vector _attachmentNames; + }; +} + +#endif /* Spine_AttachmentTimeline_h */ diff --git a/cocos/editor-support/spine/AttachmentType.h b/cocos/editor-support/spine/AttachmentType.h new file mode 100644 index 00000000000..c77f36b8c8a --- /dev/null +++ b/cocos/editor-support/spine/AttachmentType.h @@ -0,0 +1,46 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_AttachmentType_h +#define Spine_AttachmentType_h + +namespace spine { + enum AttachmentType { + AttachmentType_Region, + AttachmentType_Boundingbox, + AttachmentType_Mesh, + AttachmentType_Linkedmesh, + AttachmentType_Path, + AttachmentType_Point, + AttachmentType_Clipping + }; +} + +#endif /* Spine_AttachmentType_h */ diff --git a/cocos/editor-support/spine/Event.c b/cocos/editor-support/spine/BlendMode.h similarity index 83% rename from cocos/editor-support/spine/Event.c rename to cocos/editor-support/spine/BlendMode.h index 7c1435cef2d..729fdcf06d7 100644 --- a/cocos/editor-support/spine/Event.c +++ b/cocos/editor-support/spine/BlendMode.h @@ -1,44 +1,43 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spEvent* spEvent_create (float time, spEventData* data) { - spEvent* self = NEW(spEvent); - CONST_CAST(spEventData*, self->data) = data; - CONST_CAST(float, self->time) = time; - return self; -} - -void spEvent_dispose (spEvent* self) { - FREE(self->stringValue); - FREE(self); -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_BlendMode_h +#define Spine_BlendMode_h + +namespace spine { +enum BlendMode { + BlendMode_Normal = 0, + BlendMode_Additive, + BlendMode_Multiply, + BlendMode_Screen +}; +} + +#endif /* Spine_BlendMode_h */ diff --git a/cocos/editor-support/spine/Bone.c b/cocos/editor-support/spine/Bone.c deleted file mode 100644 index 96d43cb6d8b..00000000000 --- a/cocos/editor-support/spine/Bone.c +++ /dev/null @@ -1,304 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include -static int yDown; - -void spBone_setYDown (int value) { - yDown = value; -} - -int spBone_isYDown () { - return yDown; -} - -spBone* spBone_create (spBoneData* data, spSkeleton* skeleton, spBone* parent) { - spBone* self = NEW(spBone); - CONST_CAST(spBoneData*, self->data) = data; - CONST_CAST(spSkeleton*, self->skeleton) = skeleton; - CONST_CAST(spBone*, self->parent) = parent; - CONST_CAST(float, self->a) = 1.0f; - CONST_CAST(float, self->d) = 1.0f; - spBone_setToSetupPose(self); - return self; -} - -void spBone_dispose (spBone* self) { - FREE(self->children); - FREE(self); -} - -void spBone_updateWorldTransform (spBone* self) { - spBone_updateWorldTransformWith(self, self->x, self->y, self->rotation, self->scaleX, self->scaleY, self->shearX, self->shearY); -} - -void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY) { - float cosine, sine; - float pa, pb, pc, pd; - spBone* parent = self->parent; - - self->ax = x; - self->ay = y; - self->arotation = rotation; - self->ascaleX = scaleX; - self->ascaleY = scaleY; - self->ashearX = shearX; - self->ashearY = shearY; - self->appliedValid = 1; - - if (!parent) { /* Root bone. */ - float rotationY = rotation + 90 + shearY; - float la = COS_DEG(rotation + shearX) * scaleX; - float lb = COS_DEG(rotationY) * scaleY; - float lc = SIN_DEG(rotation + shearX) * scaleX; - float ld = SIN_DEG(rotationY) * scaleY; - if (self->skeleton->flipX) { - x = -x; - la = -la; - lb = -lb; - } - if (self->skeleton->flipY != yDown) { - y = -y; - lc = -lc; - ld = -ld; - } - CONST_CAST(float, self->a) = la; - CONST_CAST(float, self->b) = lb; - CONST_CAST(float, self->c) = lc; - CONST_CAST(float, self->d) = ld; - CONST_CAST(float, self->worldX) = x + self->skeleton->x; - CONST_CAST(float, self->worldY) = y + self->skeleton->y; - return; - } - - pa = parent->a; - pb = parent->b; - pc = parent->c; - pd = parent->d; - - CONST_CAST(float, self->worldX) = pa * x + pb * y + parent->worldX; - CONST_CAST(float, self->worldY) = pc * x + pd * y + parent->worldY; - - switch (self->data->transformMode) { - case SP_TRANSFORMMODE_NORMAL: { - float rotationY = rotation + 90 + shearY; - float la = COS_DEG(rotation + shearX) * scaleX; - float lb = COS_DEG(rotationY) * scaleY; - float lc = SIN_DEG(rotation + shearX) * scaleX; - float ld = SIN_DEG(rotationY) * scaleY; - CONST_CAST(float, self->a) = pa * la + pb * lc; - CONST_CAST(float, self->b) = pa * lb + pb * ld; - CONST_CAST(float, self->c) = pc * la + pd * lc; - CONST_CAST(float, self->d) = pc * lb + pd * ld; - return; - } - case SP_TRANSFORMMODE_ONLYTRANSLATION: { - float rotationY = rotation + 90 + shearY; - CONST_CAST(float, self->a) = COS_DEG(rotation + shearX) * scaleX; - CONST_CAST(float, self->b) = COS_DEG(rotationY) * scaleY; - CONST_CAST(float, self->c) = SIN_DEG(rotation + shearX) * scaleX; - CONST_CAST(float, self->d) = SIN_DEG(rotationY) * scaleY; - break; - } - case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: { - float s = pa * pa + pc * pc; - float prx, rx, ry, la, lb, lc, ld; - if (s > 0.0001f) { - s = ABS(pa * pd - pb * pc) / s; - pb = pc * s; - pd = pa * s; - prx = ATAN2(pc, pa) * RAD_DEG; - } else { - pa = 0; - pc = 0; - prx = 90 - ATAN2(pd, pb) * RAD_DEG; - } - rx = rotation + shearX - prx; - ry = rotation + shearY - prx + 90; - la = COS_DEG(rx) * scaleX; - lb = COS_DEG(ry) * scaleY; - lc = SIN_DEG(rx) * scaleX; - ld = SIN_DEG(ry) * scaleY; - CONST_CAST(float, self->a) = pa * la - pb * lc; - CONST_CAST(float, self->b) = pa * lb - pb * ld; - CONST_CAST(float, self->c) = pc * la + pd * lc; - CONST_CAST(float, self->d) = pc * lb + pd * ld; - break; - } - case SP_TRANSFORMMODE_NOSCALE: - case SP_TRANSFORMMODE_NOSCALEORREFLECTION: { - float za, zc, s; - float r, zb, zd, la, lb, lc, ld; - cosine = COS_DEG(rotation); sine = SIN_DEG(rotation); - za = pa * cosine + pb * sine; - zc = pc * cosine + pd * sine; - s = SQRT(za * za + zc * zc); - if (s > 0.00001f) s = 1 / s; - za *= s; - zc *= s; - s = SQRT(za * za + zc * zc); - r = PI / 2 + atan2(zc, za); - zb = COS(r) * s; - zd = SIN(r) * s; - la = COS_DEG(shearX) * scaleX; - lb = COS_DEG(90 + shearY) * scaleY; - lc = SIN_DEG(shearX) * scaleX; - ld = SIN_DEG(90 + shearY) * scaleY; - if (self->data->transformMode != SP_TRANSFORMMODE_NOSCALEORREFLECTION ? pa * pd - pb * pc < 0 : self->skeleton->flipX != self->skeleton->flipY) { - zb = -zb; - zd = -zd; - } - CONST_CAST(float, self->a) = za * la + zb * lc; - CONST_CAST(float, self->b) = za * lb + zb * ld; - CONST_CAST(float, self->c) = zc * la + zd * lc; - CONST_CAST(float, self->d) = zc * lb + zd * ld; - return; - } - } - if (self->skeleton->flipX) { - CONST_CAST(float, self->a) = -self->a; - CONST_CAST(float, self->b) = -self->b; - } - if (self->skeleton->flipY != yDown) { - CONST_CAST(float, self->c) = -self->c; - CONST_CAST(float, self->d) = -self->d; - } -} - -void spBone_setToSetupPose (spBone* self) { - self->x = self->data->x; - self->y = self->data->y; - self->rotation = self->data->rotation; - self->scaleX = self->data->scaleX; - self->scaleY = self->data->scaleY; - self->shearX = self->data->shearX; - self->shearY = self->data->shearY; -} - -float spBone_getWorldRotationX (spBone* self) { - return ATAN2(self->c, self->a) * RAD_DEG; -} - -float spBone_getWorldRotationY (spBone* self) { - return ATAN2(self->d, self->b) * RAD_DEG; -} - -float spBone_getWorldScaleX (spBone* self) { - return SQRT(self->a * self->a + self->c * self->c); -} - -float spBone_getWorldScaleY (spBone* self) { - return SQRT(self->b * self->b + self->d * self->d); -} - -/** Computes the individual applied transform values from the world transform. This can be useful to perform processing using - * the applied transform after the world transform has been modified directly (eg, by a constraint). - *

- * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. */ -void spBone_updateAppliedTransform (spBone* self) { - spBone* parent = self->parent; - self->appliedValid = 1; - if (!parent) { - self->ax = self->worldX; - self->ay = self->worldY; - self->arotation = ATAN2(self->c, self->a) * RAD_DEG; - self->ascaleX = SQRT(self->a * self->a + self->c * self->c); - self->ascaleY = SQRT(self->b * self->b + self->d * self->d); - self->ashearX = 0; - self->ashearY = ATAN2(self->a * self->b + self->c * self->d, self->a * self->d - self->b * self->c) * RAD_DEG; - } else { - float pa = parent->a, pb = parent->b, pc = parent->c, pd = parent->d; - float pid = 1 / (pa * pd - pb * pc); - float dx = self->worldX - parent->worldX, dy = self->worldY - parent->worldY; - float ia = pid * pd; - float id = pid * pa; - float ib = pid * pb; - float ic = pid * pc; - float ra = ia * self->a - ib * self->c; - float rb = ia * self->b - ib * self->d; - float rc = id * self->c - ic * self->a; - float rd = id * self->d - ic * self->b; - self->ax = (dx * pd * pid - dy * pb * pid); - self->ay = (dy * pa * pid - dx * pc * pid); - self->ashearX = 0; - self->ascaleX = SQRT(ra * ra + rc * rc); - if (self->ascaleX > 0.0001f) { - float det = ra * rd - rb * rc; - self->ascaleY = det / self->ascaleX; - self->ashearY = ATAN2(ra * rb + rc * rd, det) * RAD_DEG; - self->arotation = ATAN2(rc, ra) * RAD_DEG; - } else { - self->ascaleX = 0; - self->ascaleY = SQRT(rb * rb + rd * rd); - self->ashearY = 0; - self->arotation = 90 - ATAN2(rd, rb) * RAD_DEG; - } - } -} - -void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY) { - float a = self->a, b = self->b, c = self->c, d = self->d; - float invDet = 1 / (a * d - b * c); - float x = worldX - self->worldX, y = worldY - self->worldY; - *localX = (x * d * invDet - y * b * invDet); - *localY = (y * a * invDet - x * c * invDet); -} - -void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY) { - float x = localX, y = localY; - *worldX = x * self->a + y * self->b + self->worldX; - *worldY = x * self->c + y * self->d + self->worldY; -} - -float spBone_worldToLocalRotation (spBone* self, float worldRotation) { - float sine, cosine; - sine = SIN_DEG(worldRotation); - cosine = COS_DEG(worldRotation); - return ATAN2(self->a * sine - self->c * cosine, self->d * cosine - self->b * sine) * RAD_DEG; -} - -float spBone_localToWorldRotation (spBone* self, float localRotation) { - float sine, cosine; - sine = SIN_DEG(localRotation); - cosine = COS_DEG(localRotation); - return ATAN2(cosine * self->c + sine * self->d, cosine * self->a + sine * self->b) * RAD_DEG; -} - -void spBone_rotateWorld (spBone* self, float degrees) { - float a = self->a, b = self->b, c = self->c, d = self->d; - float cosine = COS_DEG(degrees), sine = SIN_DEG(degrees); - CONST_CAST(float, self->a) = cosine * a - sine * c; - CONST_CAST(float, self->b) = cosine * b - sine * d; - CONST_CAST(float, self->c) = sine * a + cosine * c; - CONST_CAST(float, self->d) = sine * b + cosine * d; - CONST_CAST(int, self->appliedValid) = 0; -} diff --git a/cocos/editor-support/spine/Bone.cpp b/cocos/editor-support/spine/Bone.cpp new file mode 100644 index 00000000000..f235afea2c6 --- /dev/null +++ b/cocos/editor-support/spine/Bone.cpp @@ -0,0 +1,541 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +using namespace spine; + +RTTI_IMPL(Bone, Updatable) + +bool Bone::yDown = false; + +void Bone::setYDown(bool inValue) { + yDown = inValue; +} + +bool Bone::isYDown() { + return yDown; +} + +Bone::Bone(BoneData &data, Skeleton &skeleton, Bone *parent) : Updatable(), + _data(data), + _skeleton(skeleton), + _parent(parent), + _x(0), + _y(0), + _rotation(0), + _scaleX(0), + _scaleY(0), + _shearX(0), + _shearY(0), + _ax(0), + _ay(0), + _arotation(0), + _ascaleX(0), + _ascaleY(0), + _ashearX(0), + _ashearY(0), + _appliedValid(false), + _a(1), + _b(0), + _worldX(0), + _c(0), + _d(1), + _worldY(0), + _sorted(false) { + setToSetupPose(); +} + +void Bone::update() { + updateWorldTransform(_x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY); +} + +void Bone::updateWorldTransform() { + updateWorldTransform(_x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY); +} + +void +Bone::updateWorldTransform(float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY) { + float cosine, sine; + float pa, pb, pc, pd; + Bone *parent = _parent; + + _ax = x; + _ay = y; + _arotation = rotation; + _ascaleX = scaleX; + _ascaleY = scaleY; + _ashearX = shearX; + _ashearY = shearY; + _appliedValid = true; + + if (!parent) { /* Root bone. */ + float rotationY = rotation + 90 + shearY; + float sx = _skeleton.getScaleX(); + float sy = _skeleton.getScaleY(); + _a = MathUtil::cosDeg(rotation + shearX) * scaleX * sx; + _b = MathUtil::cosDeg(rotationY) * scaleY * sy; + _c = MathUtil::sinDeg(rotation + shearX) * scaleX * sx; + _d = MathUtil::sinDeg(rotationY) * scaleY * sy; + _worldX = x * sx + _skeleton.getX(); + _worldY = y * sy + _skeleton.getY(); + return; + } + + pa = parent->_a; + pb = parent->_b; + pc = parent->_c; + pd = parent->_d; + + _worldX = pa * x + pb * y + parent->_worldX; + _worldY = pc * x + pd * y + parent->_worldY; + + switch (_data.getTransformMode()) { + case TransformMode_Normal: { + float rotationY = rotation + 90 + shearY; + float la = MathUtil::cosDeg(rotation + shearX) * scaleX; + float lb = MathUtil::cosDeg(rotationY) * scaleY; + float lc = MathUtil::sinDeg(rotation + shearX) * scaleX; + float ld = MathUtil::sinDeg(rotationY) * scaleY; + _a = pa * la + pb * lc; + _b = pa * lb + pb * ld; + _c = pc * la + pd * lc; + _d = pc * lb + pd * ld; + return; + } + case TransformMode_OnlyTranslation: { + float rotationY = rotation + 90 + shearY; + _a = MathUtil::cosDeg(rotation + shearX) * scaleX; + _b = MathUtil::cosDeg(rotationY) * scaleY; + _c = MathUtil::sinDeg(rotation + shearX) * scaleX; + _d = MathUtil::sinDeg(rotationY) * scaleY; + break; + } + case TransformMode_NoRotationOrReflection: { + float s = pa * pa + pc * pc; + float prx, rx, ry, la, lb, lc, ld; + if (s > 0.0001f) { + s = MathUtil::abs(pa * pd - pb * pc) / s; + pb = pc * s; + pd = pa * s; + prx = MathUtil::atan2(pc, pa) * MathUtil::Rad_Deg; + } else { + pa = 0; + pc = 0; + prx = 90 - MathUtil::atan2(pd, pb) * MathUtil::Rad_Deg; + } + rx = rotation + shearX - prx; + ry = rotation + shearY - prx + 90; + la = MathUtil::cosDeg(rx) * scaleX; + lb = MathUtil::cosDeg(ry) * scaleY; + lc = MathUtil::sinDeg(rx) * scaleX; + ld = MathUtil::sinDeg(ry) * scaleY; + _a = pa * la - pb * lc; + _b = pa * lb - pb * ld; + _c = pc * la + pd * lc; + _d = pc * lb + pd * ld; + break; + } + case TransformMode_NoScale: + case TransformMode_NoScaleOrReflection: { + float za, zc, s; + float r, zb, zd, la, lb, lc, ld; + cosine = MathUtil::cosDeg(rotation); + sine = MathUtil::sinDeg(rotation); + za = (pa * cosine + pb * sine) / _skeleton.getScaleX(); + zc = (pc * cosine + pd * sine) / _skeleton.getScaleY(); + s = MathUtil::sqrt(za * za + zc * zc); + if (s > 0.00001f) s = 1 / s; + za *= s; + zc *= s; + s = MathUtil::sqrt(za * za + zc * zc); + if (_data.getTransformMode() == TransformMode_NoScale + && (pa * pd - pb * pc < 0) != (_skeleton.getScaleX() < 0 != _skeleton.getScaleY() < 0)) + s = -s; + r = MathUtil::Pi / 2 + MathUtil::atan2(zc, za); + zb = MathUtil::cos(r) * s; + zd = MathUtil::sin(r) * s; + la = MathUtil::cosDeg(shearX) * scaleX; + lb = MathUtil::cosDeg(90 + shearY) * scaleY; + lc = MathUtil::sinDeg(shearX) * scaleX; + ld = MathUtil::sinDeg(90 + shearY) * scaleY; + _a = za * la + zb * lc; + _b = za * lb + zb * ld; + _c = zc * la + zd * lc; + _d = zc * lb + zd * ld; + break; + } + } + _a *= _skeleton.getScaleX(); + _b *= _skeleton.getScaleX(); + _c *= _skeleton.getScaleY(); + _d *= _skeleton.getScaleY(); +} + +void Bone::setToSetupPose() { + BoneData &data = _data; + _x = data.getX(); + _y = data.getY(); + _rotation = data.getRotation(); + _scaleX = data.getScaleX(); + _scaleY = data.getScaleY(); + _shearX = data.getShearX(); + _shearY = data.getShearY(); +} + +void Bone::worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY) { + float a = _a; + float b = _b; + float c = _c; + float d = _d; + + float invDet = 1 / (a * d - b * c); + float x = worldX - _worldX; + float y = worldY - _worldY; + + outLocalX = (x * d * invDet - y * b * invDet); + outLocalY = (y * a * invDet - x * c * invDet); +} + +void Bone::localToWorld(float localX, float localY, float &outWorldX, float &outWorldY) { + outWorldX = localX * _a + localY * _b + _worldX; + outWorldY = localX * _c + localY * _d + _worldY; +} + +float Bone::worldToLocalRotation(float worldRotation) { + float sin = MathUtil::sinDeg(worldRotation); + float cos = MathUtil::cosDeg(worldRotation); + + return MathUtil::atan2(_a * sin - _c * cos, _d * cos - _b * sin) * MathUtil::Rad_Deg + this->_rotation - this->_shearX; +} + +float Bone::localToWorldRotation(float localRotation) { + localRotation -= this->_rotation - this->_shearX; + float sin = MathUtil::sinDeg(localRotation); + float cos = MathUtil::cosDeg(localRotation); + + return MathUtil::atan2(cos * _c + sin * _d, cos * _a + sin * _b) * MathUtil::Rad_Deg; +} + +void Bone::rotateWorld(float degrees) { + float a = _a; + float b = _b; + float c = _c; + float d = _d; + + float cos = MathUtil::cosDeg(degrees); + float sin = MathUtil::sinDeg(degrees); + + _a = cos * a - sin * c; + _b = cos * b - sin * d; + _c = sin * a + cos * c; + _d = sin * b + cos * d; + + _appliedValid = false; +} + +float Bone::getWorldToLocalRotationX() { + Bone *parent = _parent; + if (!parent) { + return _arotation; + } + + float pa = parent->_a; + float pb = parent->_b; + float pc = parent->_c; + float pd = parent->_d; + float a = _a; + float c = _c; + + return MathUtil::atan2(pa * c - pc * a, pd * a - pb * c) * MathUtil::Rad_Deg; +} + +float Bone::getWorldToLocalRotationY() { + Bone *parent = _parent; + if (!parent) { + return _arotation; + } + + float pa = parent->_a; + float pb = parent->_b; + float pc = parent->_c; + float pd = parent->_d; + float b = _b; + float d = _d; + + return MathUtil::atan2(pa * d - pc * b, pd * b - pb * d) * MathUtil::Rad_Deg; +} + +BoneData &Bone::getData() { + return _data; +} + +Skeleton &Bone::getSkeleton() { + return _skeleton; +} + +Bone *Bone::getParent() { + return _parent; +} + +Vector &Bone::getChildren() { + return _children; +} + +float Bone::getX() { + return _x; +} + +void Bone::setX(float inValue) { + _x = inValue; +} + +float Bone::getY() { + return _y; +} + +void Bone::setY(float inValue) { + _y = inValue; +} + +float Bone::getRotation() { + return _rotation; +} + +void Bone::setRotation(float inValue) { + _rotation = inValue; +} + +float Bone::getScaleX() { + return _scaleX; +} + +void Bone::setScaleX(float inValue) { + _scaleX = inValue; +} + +float Bone::getScaleY() { + return _scaleY; +} + +void Bone::setScaleY(float inValue) { + _scaleY = inValue; +} + +float Bone::getShearX() { + return _shearX; +} + +void Bone::setShearX(float inValue) { + _shearX = inValue; +} + +float Bone::getShearY() { + return _shearY; +} + +void Bone::setShearY(float inValue) { + _shearY = inValue; +} + +float Bone::getAppliedRotation() { + return _arotation; +} + +void Bone::setAppliedRotation(float inValue) { + _arotation = inValue; +} + +float Bone::getAX() { + return _ax; +} + +void Bone::setAX(float inValue) { + _ax = inValue; +} + +float Bone::getAY() { + return _ay; +} + +void Bone::setAY(float inValue) { + _ay = inValue; +} + +float Bone::getAScaleX() { + return _ascaleX; +} + +void Bone::setAScaleX(float inValue) { + _ascaleX = inValue; +} + +float Bone::getAScaleY() { + return _ascaleY; +} + +void Bone::setAScaleY(float inValue) { + _ascaleY = inValue; +} + +float Bone::getAShearX() { + return _ashearX; +} + +void Bone::setAShearX(float inValue) { + _ashearX = inValue; +} + +float Bone::getAShearY() { + return _ashearY; +} + +void Bone::setAShearY(float inValue) { + _ashearY = inValue; +} + +float Bone::getA() { + return _a; +} + +void Bone::setA(float inValue) { + _a = inValue; +} + +float Bone::getB() { + return _b; +} + +void Bone::setB(float inValue) { + _b = inValue; +} + +float Bone::getC() { + return _c; +} + +void Bone::setC(float inValue) { + _c = inValue; +} + +float Bone::getD() { + return _d; +} + +void Bone::setD(float inValue) { + _d = inValue; +} + +float Bone::getWorldX() { + return _worldX; +} + +void Bone::setWorldX(float inValue) { + _worldX = inValue; +} + +float Bone::getWorldY() { + return _worldY; +} + +void Bone::setWorldY(float inValue) { + _worldY = inValue; +} + +float Bone::getWorldRotationX() { + return MathUtil::atan2(_c, _a) * MathUtil::MathUtil::Rad_Deg; +} + +float Bone::getWorldRotationY() { + return MathUtil::atan2(_d, _b) * MathUtil::Rad_Deg; +} + +float Bone::getWorldScaleX() { + return MathUtil::sqrt(_a * _a + _c * _c); +} + +float Bone::getWorldScaleY() { + return MathUtil::sqrt(_b * _b + _d * _d); +} + +bool Bone::isAppliedValid() { + return _appliedValid; +} +void Bone::setAppliedValid(bool valid) { + _appliedValid = valid; +} + +void Bone::updateAppliedTransform() { + Bone *parent = _parent; + _appliedValid = 1; + if (!parent) { + _ax = _worldX; + _ay = _worldY; + _arotation = MathUtil::atan2(_c, _a) * MathUtil::Rad_Deg; + _ascaleX = MathUtil::sqrt(_a * _a + _c * _c); + _ascaleY = MathUtil::sqrt(_b * _b + _d * _d); + _ashearX = 0; + _ashearY = MathUtil::atan2(_a * _b + _c * _d, _a * _d - _b * _c) * MathUtil::Rad_Deg; + } else { + float pa = parent->_a, pb = parent->_b, pc = parent->_c, pd = parent->_d; + float pid = 1 / (pa * pd - pb * pc); + float dx = _worldX - parent->_worldX, dy = _worldY - parent->_worldY; + float ia = pid * pd; + float id = pid * pa; + float ib = pid * pb; + float ic = pid * pc; + float ra = ia * _a - ib * _c; + float rb = ia * _b - ib * _d; + float rc = id * _c - ic * _a; + float rd = id * _d - ic * _b; + _ax = (dx * pd * pid - dy * pb * pid); + _ay = (dy * pa * pid - dx * pc * pid); + _ashearX = 0; + _ascaleX = MathUtil::sqrt(ra * ra + rc * rc); + if (_ascaleX > 0.0001f) { + float det = ra * rd - rb * rc; + _ascaleY = det / _ascaleX; + _ashearY = MathUtil::atan2(ra * rb + rc * rd, det) * MathUtil::Rad_Deg; + _arotation = MathUtil::atan2(rc, ra) * MathUtil::Rad_Deg; + } else { + _ascaleX = 0; + _ascaleY = MathUtil::sqrt(rb * rb + rd * rd); + _ashearY = 0; + _arotation = 90 - MathUtil::atan2(rd, rb) * MathUtil::Rad_Deg; + } + } +} diff --git a/cocos/editor-support/spine/Bone.h b/cocos/editor-support/spine/Bone.h index 12b2af92812..dbb837445b8 100644 --- a/cocos/editor-support/spine/Bone.h +++ b/cocos/editor-support/spine/Bone.h @@ -1,127 +1,249 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_BONE_H_ -#define SPINE_BONE_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct spSkeleton; - -typedef struct spBone spBone; -struct spBone { - spBoneData* const data; - struct spSkeleton* const skeleton; - spBone* const parent; - int childrenCount; - spBone** const children; - float x, y, rotation, scaleX, scaleY, shearX, shearY; - float ax, ay, arotation, ascaleX, ascaleY, ashearX, ashearY; - int /*bool*/ appliedValid; - - float const a, b, worldX; - float const c, d, worldY; - - int/*bool*/ sorted; - -#ifdef __cplusplus - spBone() : - data(0), - skeleton(0), - parent(0), - childrenCount(0), children(0), - x(0), y(0), rotation(0), scaleX(0), scaleY(0), - ax(0), ay(0), arotation(0), ascaleX(0), ascaleY(0), ashearX(0), ashearY(0), - appliedValid(0), - - a(0), b(0), worldX(0), - c(0), d(0), worldY(0), - - sorted(0) { - } -#endif -}; - -SP_API void spBone_setYDown (int/*bool*/yDown); -SP_API int/*bool*/spBone_isYDown (); - -/* @param parent May be 0. */ -SP_API spBone* spBone_create (spBoneData* data, struct spSkeleton* skeleton, spBone* parent); -SP_API void spBone_dispose (spBone* self); - -SP_API void spBone_setToSetupPose (spBone* self); - -SP_API void spBone_updateWorldTransform (spBone* self); -SP_API void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY); - -SP_API float spBone_getWorldRotationX (spBone* self); -SP_API float spBone_getWorldRotationY (spBone* self); -SP_API float spBone_getWorldScaleX (spBone* self); -SP_API float spBone_getWorldScaleY (spBone* self); - -SP_API void spBone_updateAppliedTransform (spBone* self); - -SP_API void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY); -SP_API void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY); -SP_API float spBone_worldToLocalRotation (spBone* self, float worldRotation); -SP_API float spBone_localToWorldRotation (spBone* self, float localRotation); -SP_API void spBone_rotateWorld (spBone* self, float degrees); - -#ifdef SPINE_SHORT_NAMES -typedef spBone Bone; -#define Bone_setYDown(...) spBone_setYDown(__VA_ARGS__) -#define Bone_isYDown() spBone_isYDown() -#define Bone_create(...) spBone_create(__VA_ARGS__) -#define Bone_dispose(...) spBone_dispose(__VA_ARGS__) -#define Bone_setToSetupPose(...) spBone_setToSetupPose(__VA_ARGS__) -#define Bone_updateWorldTransform(...) spBone_updateWorldTransform(__VA_ARGS__) -#define Bone_updateWorldTransformWith(...) spBone_updateWorldTransformWith(__VA_ARGS__) -#define Bone_getWorldRotationX(...) spBone_getWorldRotationX(__VA_ARGS__) -#define Bone_getWorldRotationY(...) spBone_getWorldRotationY(__VA_ARGS__) -#define Bone_getWorldScaleX(...) spBone_getWorldScaleX(__VA_ARGS__) -#define Bone_getWorldScaleY(...) spBone_getWorldScaleY(__VA_ARGS__) -#define Bone_updateAppliedTransform(...) spBone_updateAppliedTransform(__VA_ARGS__) -#define Bone_worldToLocal(...) spBone_worldToLocal(__VA_ARGS__) -#define Bone_localToWorld(...) spBone_localToWorld(__VA_ARGS__) -#define Bone_worldToLocalRotation(...) spBone_worldToLocalRotation(__VA_ARGS__) -#define Bone_localToWorldRotation(...) spBone_localToWorldRotation(__VA_ARGS__) -#define Bone_rotateWorld(...) spBone_rotateWorld(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_BONE_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Bone_h +#define Spine_Bone_h + +#include +#include +#include + +namespace spine { +class BoneData; + +class Skeleton; + +/// Stores a bone's current pose. +/// +/// A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a +/// local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a +/// constraint or application code modifies the world transform after it was computed from the local transform. +class SP_API Bone : public Updatable { + friend class AnimationState; + + friend class RotateTimeline; + + friend class IkConstraint; + + friend class TransformConstraint; + + friend class VertexAttachment; + + friend class PathConstraint; + + friend class Skeleton; + + friend class RegionAttachment; + + friend class PointAttachment; + + friend class ScaleTimeline; + + friend class ShearTimeline; + + friend class TranslateTimeline; + +RTTI_DECL + +public: + static void setYDown(bool inValue); + + static bool isYDown(); + + /// @param parent May be NULL. + Bone(BoneData &data, Skeleton &skeleton, Bone *parent = NULL); + + /// Same as updateWorldTransform. This method exists for Bone to implement Spine::Updatable. + virtual void update(); + + /// Computes the world transform using the parent bone and this bone's local transform. + void updateWorldTransform(); + + /// Computes the world transform using the parent bone and the specified local transform. + void updateWorldTransform(float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY); + + void setToSetupPose(); + + void worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY); + + void localToWorld(float localX, float localY, float &outWorldX, float &outWorldY); + + float worldToLocalRotation(float worldRotation); + + float localToWorldRotation(float localRotation); + + /// + /// Rotates the world transform the specified amount and sets isAppliedValid to false. + /// + /// @param degrees Degrees. + void rotateWorld(float degrees); + + float getWorldToLocalRotationX(); + + float getWorldToLocalRotationY(); + + BoneData &getData(); + + Skeleton &getSkeleton(); + + Bone *getParent(); + + Vector &getChildren(); + + /// The local X translation. + float getX(); + + void setX(float inValue); + + /// The local Y translation. + float getY(); + + void setY(float inValue); + + /// The local rotation. + float getRotation(); + + void setRotation(float inValue); + + /// The local scaleX. + float getScaleX(); + + void setScaleX(float inValue); + + /// The local scaleY. + float getScaleY(); + + void setScaleY(float inValue); + + /// The local shearX. + float getShearX(); + + void setShearX(float inValue); + + /// The local shearY. + float getShearY(); + + void setShearY(float inValue); + + /// The rotation, as calculated by any constraints. + float getAppliedRotation(); + + void setAppliedRotation(float inValue); + + /// The applied local x translation. + float getAX(); + + void setAX(float inValue); + + /// The applied local y translation. + float getAY(); + + void setAY(float inValue); + + /// The applied local scaleX. + float getAScaleX(); + + void setAScaleX(float inValue); + + /// The applied local scaleY. + float getAScaleY(); + + void setAScaleY(float inValue); + + /// The applied local shearX. + float getAShearX(); + + void setAShearX(float inValue); + + /// The applied local shearY. + float getAShearY(); + + void setAShearY(float inValue); + + float getA(); + + void setA(float inValue); + + float getB(); + + void setB(float inValue); + + float getC(); + + void setC(float inValue); + + float getD(); + + void setD(float inValue); + + float getWorldX(); + + void setWorldX(float inValue); + + float getWorldY(); + + void setWorldY(float inValue); + + float getWorldRotationX(); + + float getWorldRotationY(); + + /// Returns the magnitide (always positive) of the world scale X. + float getWorldScaleX(); + + /// Returns the magnitide (always positive) of the world scale Y. + float getWorldScaleY(); + + bool isAppliedValid(); + void setAppliedValid(bool valid); + +private: + static bool yDown; + + BoneData &_data; + Skeleton &_skeleton; + Bone *_parent; + Vector _children; + float _x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY; + float _ax, _ay, _arotation, _ascaleX, _ascaleY, _ashearX, _ashearY; + bool _appliedValid; + float _a, _b, _worldX; + float _c, _d, _worldY; + bool _sorted; + + /// Computes the individual applied transform values from the world transform. This can be useful to perform processing using + /// the applied transform after the world transform has been modified directly (eg, by a constraint).. + /// + /// Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. + void updateAppliedTransform(); +}; +} + +#endif /* Spine_Bone_h */ diff --git a/cocos/editor-support/spine/BoneData.cpp b/cocos/editor-support/spine/BoneData.cpp new file mode 100644 index 00000000000..bda7d5ed52d --- /dev/null +++ b/cocos/editor-support/spine/BoneData.cpp @@ -0,0 +1,140 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +BoneData::BoneData(int index, const String &name, BoneData *parent) : + _index(index), + _name(name), + _parent(parent), + _length(0), + _x(0), + _y(0), + _rotation(0), + _scaleX(1), + _scaleY(1), + _shearX(0), + _shearY(0), + _transformMode(TransformMode_Normal) { + assert(index >= 0); + assert(_name.length() > 0); +} + +int BoneData::getIndex() { + return _index; +} + +const String &BoneData::getName() { + return _name; +} + +BoneData *BoneData::getParent() { + return _parent; +} + +float BoneData::getLength() { + return _length; +} + +void BoneData::setLength(float inValue) { + _length = inValue; +} + +float BoneData::getX() { + return _x; +} + +void BoneData::setX(float inValue) { + _x = inValue; +} + +float BoneData::getY() { + return _y; +} + +void BoneData::setY(float inValue) { + _y = inValue; +} + +float BoneData::getRotation() { + return _rotation; +} + +void BoneData::setRotation(float inValue) { + _rotation = inValue; +} + +float BoneData::getScaleX() { + return _scaleX; +} + +void BoneData::setScaleX(float inValue) { + _scaleX = inValue; +} + +float BoneData::getScaleY() { + return _scaleY; +} + +void BoneData::setScaleY(float inValue) { + _scaleY = inValue; +} + +float BoneData::getShearX() { + return _shearX; +} + +void BoneData::setShearX(float inValue) { + _shearX = inValue; +} + +float BoneData::getShearY() { + return _shearY; +} + +void BoneData::setShearY(float inValue) { + _shearY = inValue; +} + +TransformMode BoneData::getTransformMode() { + return _transformMode; +} + +void BoneData::setTransformMode(TransformMode inValue) { + _transformMode = inValue; +} diff --git a/cocos/editor-support/spine/BoneData.h b/cocos/editor-support/spine/BoneData.h index d73162b2bec..d0487b7e6bc 100644 --- a/cocos/editor-support/spine/BoneData.h +++ b/cocos/editor-support/spine/BoneData.h @@ -1,85 +1,120 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_BONEDATA_H_ -#define SPINE_BONEDATA_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - SP_TRANSFORMMODE_NORMAL, - SP_TRANSFORMMODE_ONLYTRANSLATION, - SP_TRANSFORMMODE_NOROTATIONORREFLECTION, - SP_TRANSFORMMODE_NOSCALE, - SP_TRANSFORMMODE_NOSCALEORREFLECTION -} spTransformMode; - -typedef struct spBoneData spBoneData; -struct spBoneData { - const int index; - const char* const name; - spBoneData* const parent; - float length; - float x, y, rotation, scaleX, scaleY, shearX, shearY; - spTransformMode transformMode; - -#ifdef __cplusplus - spBoneData() : - index(0), - name(0), - parent(0), - length(0), - x(0), y(0), - rotation(0), - scaleX(0), scaleY(0), - shearX(0), shearY(0), - transformMode(SP_TRANSFORMMODE_NORMAL) { - } -#endif -}; - -SP_API spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent); -SP_API void spBoneData_dispose (spBoneData* self); - -#ifdef SPINE_SHORT_NAMES -typedef spBoneData BoneData; -#define BoneData_create(...) spBoneData_create(__VA_ARGS__) -#define BoneData_dispose(...) spBoneData_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_BONEDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_BoneData_h +#define Spine_BoneData_h + +#include +#include +#include + +namespace spine { +class SP_API BoneData : public SpineObject { + friend class SkeletonBinary; + + friend class SkeletonJson; + + friend class AnimationState; + + friend class RotateTimeline; + + friend class ScaleTimeline; + + friend class ShearTimeline; + + friend class TranslateTimeline; + +public: + BoneData(int index, const String &name, BoneData *parent = NULL); + + /// The index of the bone in Skeleton.Bones + int getIndex(); + + /// The name of the bone, which is unique within the skeleton. + const String &getName(); + + /// May be NULL. + BoneData *getParent(); + + float getLength(); + + void setLength(float inValue); + + /// Local X translation. + float getX(); + + void setX(float inValue); + + /// Local Y translation. + float getY(); + + void setY(float inValue); + + /// Local rotation. + float getRotation(); + + void setRotation(float inValue); + + /// Local scaleX. + float getScaleX(); + + void setScaleX(float inValue); + + /// Local scaleY. + float getScaleY(); + + void setScaleY(float inValue); + + /// Local shearX. + float getShearX(); + + void setShearX(float inValue); + + /// Local shearY. + float getShearY(); + + void setShearY(float inValue); + + /// The transform mode for how parent world transforms affect this bone. + TransformMode getTransformMode(); + + void setTransformMode(TransformMode inValue); + +private: + const int _index; + const String _name; + BoneData *_parent; + float _length; + float _x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY; + TransformMode _transformMode; +}; +} + +#endif /* Spine_BoneData_h */ diff --git a/cocos/editor-support/spine/BoundingBoxAttachment.cpp b/cocos/editor-support/spine/BoundingBoxAttachment.cpp new file mode 100644 index 00000000000..9e6ee5ec5de --- /dev/null +++ b/cocos/editor-support/spine/BoundingBoxAttachment.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +using namespace spine; + +RTTI_IMPL(BoundingBoxAttachment, VertexAttachment) + +BoundingBoxAttachment::BoundingBoxAttachment(const String &name) : VertexAttachment(name) { +} diff --git a/cocos/editor-support/spine/BoundingBoxAttachment.h b/cocos/editor-support/spine/BoundingBoxAttachment.h index 2c9194b6993..fd7be209c1c 100644 --- a/cocos/editor-support/spine/BoundingBoxAttachment.h +++ b/cocos/editor-support/spine/BoundingBoxAttachment.h @@ -1,59 +1,46 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_BOUNDINGBOXATTACHMENT_H_ -#define SPINE_BOUNDINGBOXATTACHMENT_H_ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spBoundingBoxAttachment { - spVertexAttachment super; -} spBoundingBoxAttachment; - -SP_API spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name); - -#ifdef SPINE_SHORT_NAMES -typedef spBoundingBoxAttachment BoundingBoxAttachment; -#define BoundingBoxAttachment_create(...) spBoundingBoxAttachment_create(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_BOUNDINGBOXATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_BoundingBoxAttachment_h +#define Spine_BoundingBoxAttachment_h + +#include +#include + +namespace spine { + /// Attachment that has a polygon for bounds checking. + class SP_API BoundingBoxAttachment : public VertexAttachment { + RTTI_DECL + + explicit BoundingBoxAttachment(const String& name); + }; +} + +#endif /* Spine_BoundingBoxAttachment_h */ diff --git a/cocos/editor-support/spine/ClippingAttachment.cpp b/cocos/editor-support/spine/ClippingAttachment.cpp new file mode 100644 index 00000000000..7b11101fb3d --- /dev/null +++ b/cocos/editor-support/spine/ClippingAttachment.cpp @@ -0,0 +1,52 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +RTTI_IMPL(ClippingAttachment, VertexAttachment) + +ClippingAttachment::ClippingAttachment(const String &name) : VertexAttachment(name), _endSlot(NULL) { +} + +SlotData *ClippingAttachment::getEndSlot() { + return _endSlot; +} + +void ClippingAttachment::setEndSlot(SlotData *inValue) { + _endSlot = inValue; +} diff --git a/cocos/editor-support/spine/ClippingAttachment.h b/cocos/editor-support/spine/ClippingAttachment.h index 8683437c766..64187745c8d 100644 --- a/cocos/editor-support/spine/ClippingAttachment.h +++ b/cocos/editor-support/spine/ClippingAttachment.h @@ -1,61 +1,58 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_CLIPPINGATTACHMENT_H_ -#define SPINE_CLIPPINGATTACHMENT_H_ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spClippingAttachment { - spVertexAttachment super; - spSlotData* endSlot; -} spClippingAttachment; - -SP_API void _spClippingAttachment_dispose(spAttachment* self); -SP_API spClippingAttachment* spClippingAttachment_create (const char* name); - -#ifdef SPINE_SHORT_NAMES -typedef spClippingAttachment ClippingAttachment; -#define ClippingAttachment_create(...) spClippingAttachment_create(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_CLIPPINGATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_ClippingAttachment_h +#define Spine_ClippingAttachment_h + +#include + +namespace spine { + class SlotData; + + class SP_API ClippingAttachment : public VertexAttachment { + friend class SkeletonBinary; + friend class SkeletonJson; + + friend class SkeletonClipping; + + RTTI_DECL + + public: + explicit ClippingAttachment(const String& name); + + SlotData* getEndSlot(); + void setEndSlot(SlotData* inValue); + + private: + SlotData* _endSlot; + }; +} + +#endif /* Spine_ClippingAttachment_h */ diff --git a/cocos/editor-support/spine/Color.h b/cocos/editor-support/spine/Color.h index 272ba95524b..0f0817f1bf0 100644 --- a/cocos/editor-support/spine/Color.h +++ b/cocos/editor-support/spine/Color.h @@ -27,52 +27,68 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifndef SPINE_COLOR_H +#define SPINE_COLOR_H -#ifndef SPINE_COLOR_H_ -#define SPINE_COLOR_H_ +#include -#include +namespace spine { +class SP_API Color : public SpineObject { +public: + Color() : r(0), g(0), b(0), a(0) { + } -#ifdef __cplusplus -extern "C" { -#endif + Color(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) { + clamp(); + } -typedef struct spColor { - float r, g, b, a; + inline Color &set(float _r, float _g, float _b, float _a) { + this->r = _r; + this->g = _g; + this->b = _b; + this->a = _a; + clamp(); + return *this; + } -#ifdef __cplusplus - spColor() : - r(0), g(0), b(0), a(0) { + inline Color &set(const Color &other) { + r = other.r; + g = other.g; + b = other.b; + a = other.a; + clamp(); + return *this; } - bool operator==(const spColor& rhs) { - return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a; + inline Color &add(float _r, float _g, float _b, float _a) { + this->r += _r; + this->g += _g; + this->b += _b; + this->a += _a; + clamp(); + return *this; } -#endif -} spColor; -/* @param attachmentName May be 0 for no setup pose attachment. */ -SP_API spColor* spColor_create(); -SP_API void spColor_dispose(spColor* self); -SP_API void spColor_setFromFloats(spColor* color, float r, float g, float b, float a); -SP_API void spColor_setFromColor(spColor* color, spColor* otherColor); -SP_API void spColor_addFloats(spColor* color, float r, float g, float b, float a); -SP_API void spColor_addColor(spColor* color, spColor* otherColor); -SP_API void spColor_clamp(spColor* color); + inline Color &add(const Color &other) { + r += other.r; + g += other.g; + b += other.b; + a += other.a; + clamp(); + return *this; + } -#ifdef SPINE_SHORT_NAMES -typedef spColor color; -#define Color_create() spColor_create() -#define Color_dispose(...) spColor_dispose(__VA_ARGS__) -#define Color_setFromFloats(...) spColor_setFromFloats(__VA_ARGS__) -#define Color_setFromColor(...) spColor_setFromColor(__VA_ARGS__) -#define Color_addColor(...) spColor_addColor(__VA_ARGS__) -#define Color_addFloats(...) spColor_addFloats(__VA_ARGS__) -#define Color_clamp(...) spColor_clamp(__VA_ARGS__) -#endif + inline Color &clamp() { + r = MathUtil::clamp(this->r, 0, 1); + g = MathUtil::clamp(this->g, 0, 1); + b = MathUtil::clamp(this->b, 0, 1); + a = MathUtil::clamp(this->a, 0, 1); + return *this; + } -#ifdef __cplusplus + float r, g, b, a; +}; } -#endif -#endif /* SPINE_COLOR_H_ */ + +#endif //SPINE_COLOR_H diff --git a/cocos/editor-support/spine/ColorTimeline.cpp b/cocos/editor-support/spine/ColorTimeline.cpp new file mode 100644 index 00000000000..604fdd7d9fb --- /dev/null +++ b/cocos/editor-support/spine/ColorTimeline.cpp @@ -0,0 +1,144 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(ColorTimeline, CurveTimeline) + +const int ColorTimeline::ENTRIES = 5; +const int ColorTimeline::PREV_TIME = -5; +const int ColorTimeline::PREV_R = -4; +const int ColorTimeline::PREV_G = -3; +const int ColorTimeline::PREV_B = -2; +const int ColorTimeline::PREV_A = -1; +const int ColorTimeline::R = 1; +const int ColorTimeline::G = 2; +const int ColorTimeline::B = 3; +const int ColorTimeline::A = 4; + +ColorTimeline::ColorTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0) { + _frames.setSize(frameCount * ENTRIES, 0); +} + +void ColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + Slot *slotP = skeleton._slots[_slotIndex]; + Slot &slot = *slotP; + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + slot._color.set(slot._data._color); + return; + case MixBlend_First: { + Color &color = slot._color, setup = slot._data._color; + color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha, + (setup.a - color.a) * alpha); + } + default: ; + } + return; + } + + float r, g, b, a; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + size_t i = _frames.size(); + r = _frames[i + PREV_R]; + g = _frames[i + PREV_G]; + b = _frames[i + PREV_B]; + a = _frames[i + PREV_A]; + } else { + // Interpolate between the previous frame and the current frame. + size_t frame = (size_t)Animation::binarySearch(_frames, time, ENTRIES); + r = _frames[frame + PREV_R]; + g = _frames[frame + PREV_G]; + b = _frames[frame + PREV_B]; + a = _frames[frame + PREV_A]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + r += (_frames[frame + R] - r) * percent; + g += (_frames[frame + G] - g) * percent; + b += (_frames[frame + B] - b) * percent; + a += (_frames[frame + A] - a) * percent; + } + + if (alpha == 1) { + slot.getColor().set(r, g, b, a); + } else { + Color &color = slot.getColor(); + if (blend == MixBlend_Setup) color.set(slot.getData().getColor()); + color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha); + } +} + +int ColorTimeline::getPropertyId() { + return ((int) TimelineType_Color << 24) + _slotIndex; +} + +void ColorTimeline::setFrame(int frameIndex, float time, float r, float g, float b, float a) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + R] = r; + _frames[frameIndex + G] = g; + _frames[frameIndex + B] = b; + _frames[frameIndex + A] = a; +} + +int ColorTimeline::getSlotIndex() { + return _slotIndex; +} + +void ColorTimeline::setSlotIndex(int inValue) { + _slotIndex = inValue; +} + +Vector &ColorTimeline::getFrames() { + return _frames; +} diff --git a/cocos/editor-support/spine/PointAttachment.c b/cocos/editor-support/spine/ColorTimeline.h similarity index 64% rename from cocos/editor-support/spine/PointAttachment.c rename to cocos/editor-support/spine/ColorTimeline.h index 9a013966352..49a6bbbb9e3 100644 --- a/cocos/editor-support/spine/PointAttachment.c +++ b/cocos/editor-support/spine/ColorTimeline.h @@ -28,34 +28,54 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#ifndef Spine_ColorTimeline_h +#define Spine_ColorTimeline_h -void _spPointAttachment_dispose (spAttachment* attachment) { - spPathAttachment* self = SUB_CAST(spPathAttachment, attachment); +#include - _spVertexAttachment_deinit(SUPER(self)); +namespace spine { +class SP_API ColorTimeline : public CurveTimeline { + friend class SkeletonBinary; - FREE(self); -} + friend class SkeletonJson; -spPointAttachment* spPointAttachment_create (const char* name) { - spPointAttachment* self = NEW(spPointAttachment); - _spVertexAttachment_init(SUPER(self)); - _spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_POINT, _spPointAttachment_dispose); - return self; -} +RTTI_DECL -void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y) { - *x = self->x * bone->a + self->y * bone->b + bone->worldX; - *y = self->x * bone->c + self->y * bone->d + bone->worldY; -} +public: + static const int ENTRIES; + + explicit ColorTimeline(int frameCount); + + virtual void + apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, MixBlend blend, + MixDirection direction); + + virtual int getPropertyId(); -float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone) { - float cosine, sine, x, y; - cosine = COS_DEG(self->rotation); - sine = SIN_DEG(self->rotation); - x = cosine * bone->a + sine * bone->b; - y = cosine * bone->c + sine * bone->d; - return ATAN2(y, x) * RAD_DEG; + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, float r, float g, float b, float a); + + int getSlotIndex(); + + void setSlotIndex(int inValue); + + Vector &getFrames(); + +protected: + static const int PREV_TIME; + static const int PREV_R; + static const int PREV_G; + static const int PREV_B; + static const int PREV_A; + static const int R; + static const int G; + static const int B; + static const int A; + +private: + int _slotIndex; + Vector _frames; +}; } + +#endif /* Spine_ColorTimeline_h */ diff --git a/cocos/editor-support/spine/EventData.c b/cocos/editor-support/spine/Constraint.cpp similarity index 84% rename from cocos/editor-support/spine/EventData.c rename to cocos/editor-support/spine/Constraint.cpp index 8b0014f7857..39ca6656ab6 100644 --- a/cocos/editor-support/spine/EventData.c +++ b/cocos/editor-support/spine/Constraint.cpp @@ -1,44 +1,45 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spEventData* spEventData_create (const char* name) { - spEventData* self = NEW(spEventData); - MALLOC_STR(self->name, name); - return self; -} - -void spEventData_dispose (spEventData* self) { - FREE(self->stringValue); - FREE(self->name); - FREE(self); -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +using namespace spine; + +RTTI_IMPL(Constraint, Updatable) + +Constraint::Constraint() { +} + +Constraint::~Constraint() { +} diff --git a/cocos/editor-support/spine/PathConstraintData.c b/cocos/editor-support/spine/Constraint.h similarity index 81% rename from cocos/editor-support/spine/PathConstraintData.c rename to cocos/editor-support/spine/Constraint.h index e0556cbe5b4..3d42586eb54 100644 --- a/cocos/editor-support/spine/PathConstraintData.c +++ b/cocos/editor-support/spine/Constraint.h @@ -1,44 +1,53 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spPathConstraintData* spPathConstraintData_create (const char* name) { - spPathConstraintData* self = NEW(spPathConstraintData); - MALLOC_STR(self->name, name); - return self; -} - -void spPathConstraintData_dispose (spPathConstraintData* self) { - FREE(self->name); - FREE(self->bones); - FREE(self); -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Constraint_h +#define Spine_Constraint_h + +#include + +namespace spine { +/// The interface for all constraints. +class SP_API Constraint : public Updatable { +RTTI_DECL + +public: + Constraint(); + + virtual ~Constraint(); + + virtual void update() = 0; + + /// The ordinal for the order a skeleton's constraints will be applied. + virtual int getOrder() = 0; +}; +} + +#endif /* Spine_Constraint_h */ diff --git a/cocos/editor-support/spine/ContainerUtil.h b/cocos/editor-support/spine/ContainerUtil.h new file mode 100644 index 00000000000..28e4ade1bc0 --- /dev/null +++ b/cocos/editor-support/spine/ContainerUtil.h @@ -0,0 +1,128 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_ContainerUtil_h +#define Spine_ContainerUtil_h + +#include +#include +#include +#include +#include + +#include + +namespace spine { + class SP_API ContainerUtil : public SpineObject { + public: + /// Finds an item by comparing each item's name. + /// It is more efficient to cache the results of this method than to call it multiple times. + /// @return May be NULL. + template + static T* findWithName(Vector& items, const String& name) { + assert(name.length() > 0); + + for (size_t i = 0; i < items.size(); ++i) { + T* item = items[i]; + if (item->getName() == name) { + return item; + } + } + + return NULL; + } + + /// @return -1 if the item was not found. + template + static int findIndexWithName(Vector& items, const String& name) { + assert(name.length() > 0); + + for (size_t i = 0, len = items.size(); i < len; ++i) { + T* item = items[i]; + if (item->getName() == name) { + return static_cast(i); + } + } + + return -1; + } + + /// Finds an item by comparing each item's name. + /// It is more efficient to cache the results of this method than to call it multiple times. + /// @return May be NULL. + template + static T* findWithDataName(Vector& items, const String& name) { + assert(name.length() > 0); + + for (size_t i = 0; i < items.size(); ++i) { + T* item = items[i]; + if (item->getData().getName() == name) { + return item; + } + } + + return NULL; + } + + /// @return -1 if the item was not found. + template + static int findIndexWithDataName(Vector& items, const String& name) { + assert(name.length() > 0); + + for (size_t i = 0, len = items.size(); i < len; ++i) { + T* item = items[i]; + if (item->getData().getName() == name) { + return static_cast(i); + } + } + + return -1; + } + + template + static void cleanUpVectorOfPointers(Vector& items) { + for (int i = (int)items.size() - 1; i >= 0; i--) { + T* item = items[i]; + + delete item; + + items.removeAt(i); + } + } + + private: + // ctor, copy ctor, and assignment should be private in a Singleton + ContainerUtil(); + ContainerUtil(const ContainerUtil&); + ContainerUtil& operator=(const ContainerUtil&); + }; +} + +#endif /* Spine_ContainerUtil_h */ diff --git a/cocos/editor-support/spine/CurveTimeline.cpp b/cocos/editor-support/spine/CurveTimeline.cpp new file mode 100644 index 00000000000..adb2623ad1b --- /dev/null +++ b/cocos/editor-support/spine/CurveTimeline.cpp @@ -0,0 +1,129 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +RTTI_IMPL(CurveTimeline, Timeline) + +const float CurveTimeline::LINEAR = 0; +const float CurveTimeline::STEPPED = 1; +const float CurveTimeline::BEZIER = 2; +const int CurveTimeline::BEZIER_SIZE = 10 * 2 - 1; + +CurveTimeline::CurveTimeline(int frameCount) { + assert(frameCount > 0); + + _curves.setSize((frameCount - 1) * BEZIER_SIZE, 0); +} + +CurveTimeline::~CurveTimeline() { +} + +size_t CurveTimeline::getFrameCount() { + return _curves.size() / BEZIER_SIZE + 1; +} + +void CurveTimeline::setLinear(size_t frameIndex) { + _curves[frameIndex * BEZIER_SIZE] = LINEAR; +} + +void CurveTimeline::setStepped(size_t frameIndex) { + _curves[frameIndex * BEZIER_SIZE] = STEPPED; +} + +void CurveTimeline::setCurve(size_t frameIndex, float cx1, float cy1, float cx2, float cy2) { + float tmpx = (-cx1 * 2 + cx2) * 0.03f, tmpy = (-cy1 * 2 + cy2) * 0.03f; + float dddfx = ((cx1 - cx2) * 3 + 1) * 0.006f, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006f; + float ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy; + float dfx = cx1 * 0.3f + tmpx + dddfx * 0.16666667f, dfy = cy1 * 0.3f + tmpy + dddfy * 0.16666667f; + + size_t i = frameIndex * BEZIER_SIZE; + _curves[i++] = BEZIER; + + float x = dfx, y = dfy; + for (size_t n = i + BEZIER_SIZE - 1; i < n; i += 2) { + _curves[i] = x; + _curves[i + 1] = y; + dfx += ddfx; + dfy += ddfy; + ddfx += dddfx; + ddfy += dddfy; + x += dfx; + y += dfy; + } +} + +float CurveTimeline::getCurvePercent(size_t frameIndex, float percent) { + percent = MathUtil::clamp(percent, 0, 1); + size_t i = frameIndex * BEZIER_SIZE; + float type = _curves[i]; + + if (type == LINEAR) { + return percent; + } + + if (type == STEPPED) { + return 0; + } + + i++; + float x = 0; + for (size_t start = i, n = i + BEZIER_SIZE - 1; i < n; i += 2) { + x = _curves[i]; + if (x >= percent) { + float prevX, prevY; + if (i == start) { + prevX = 0; + prevY = 0; + } else { + prevX = _curves[i - 2]; + prevY = _curves[i - 1]; + } + + return prevY + (_curves[i + 1] - prevY) * (percent - prevX) / (x - prevX); + } + } + + float y = _curves[i - 1]; + + return y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1. +} + +float CurveTimeline::getCurveType(size_t frameIndex) { + return _curves[frameIndex * BEZIER_SIZE]; +} diff --git a/cocos/editor-support/spine/CurveTimeline.h b/cocos/editor-support/spine/CurveTimeline.h new file mode 100644 index 00000000000..f78043bb4e0 --- /dev/null +++ b/cocos/editor-support/spine/CurveTimeline.h @@ -0,0 +1,77 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_CurveTimeline_h +#define Spine_CurveTimeline_h + +#include +#include + +namespace spine { + /// Base class for frames that use an interpolation bezier curve. + class SP_API CurveTimeline : public Timeline { + RTTI_DECL + + public: + explicit CurveTimeline(int frameCount); + + virtual ~CurveTimeline(); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction) = 0; + + virtual int getPropertyId() = 0; + + size_t getFrameCount(); + + void setLinear(size_t frameIndex); + + void setStepped(size_t frameIndex); + + /// Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next. + /// cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of + /// the difference between the keyframe's values. + void setCurve(size_t frameIndex, float cx1, float cy1, float cx2, float cy2); + + float getCurvePercent(size_t frameIndex, float percent); + + float getCurveType(size_t frameIndex); + + protected: + static const float LINEAR; + static const float STEPPED; + static const float BEZIER; + static const int BEZIER_SIZE; + + private: + Vector _curves; // type, x, y, ... + }; +} + +#endif /* Spine_CurveTimeline_h */ diff --git a/cocos/editor-support/spine/Debug.h b/cocos/editor-support/spine/Debug.h new file mode 100644 index 00000000000..436df90b430 --- /dev/null +++ b/cocos/editor-support/spine/Debug.h @@ -0,0 +1,117 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef SPINE_DEBUG_H +#define SPINE_DEBUG_H + +#include + +#include + +namespace spine { +class SP_API DebugExtension : public SpineExtension { + struct Allocation { + void *address; + size_t size; + const char *fileName; + int line; + + Allocation() : address(NULL), size(0), fileName(NULL), line(0) { + } + + Allocation(void *a, size_t s, const char *f, int l) : address(a), size(s), fileName(f), line(l) { + } + }; + +public: + DebugExtension(SpineExtension* extension): _extension(extension), _allocations(0), _reallocations(0), _frees(0) { + } + + void reportLeaks() { + for (std::map::iterator it = _allocated.begin(); it != _allocated.end(); it++) { + printf("\"%s:%i (%zu bytes at %p)\n", it->second.fileName, it->second.line, it->second.size, it->second.address); + } + printf("allocations: %zu, reallocations: %zu, frees: %zu\n", _allocations, _reallocations, _frees); + if (_allocated.empty()) printf("No leaks detected"); + } + + void clearAllocations() { + _allocated.clear(); + } + + virtual void *_alloc(size_t size, const char *file, int line) { + void *result = _extension->_alloc(size, file, line); + _allocated[result] = Allocation(result, size, file, line); + _allocations++; + return result; + } + + virtual void *_calloc(size_t size, const char *file, int line) { + void *result = _extension->_calloc(size, file, line); + _allocated[result] = Allocation(result, size, file, line); + _allocations++; + return result; + } + + virtual void *_realloc(void *ptr, size_t size, const char *file, int line) { + _allocated.erase(ptr); + void *result = _extension->_realloc(ptr, size, file, line); + _reallocations++; + _allocated[result] = Allocation(result, size, file, line); + return result; + } + + virtual void _free(void *mem, const char *file, int line) { + if (_allocated.count(mem)) { + _extension->_free(mem, file, line); + _frees++; + _allocated.erase(mem); + return; + } + + printf("%s:%i (address %p): Double free or not allocated through SpineExtension\n", file, line, mem); + _extension->_free(mem, file, line); + } + + virtual char *_readFile(const String &path, int *length) { + return _extension->_readFile(path, length); + } + +private: + SpineExtension* _extension; + std::map _allocated; + size_t _allocations; + size_t _reallocations; + size_t _frees; +}; +} + + +#endif //SPINE_DEBUG_H diff --git a/cocos/editor-support/spine/DeformTimeline.cpp b/cocos/editor-support/spine/DeformTimeline.cpp new file mode 100644 index 00000000000..de62f9e65cc --- /dev/null +++ b/cocos/editor-support/spine/DeformTimeline.cpp @@ -0,0 +1,297 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(DeformTimeline, CurveTimeline) + +DeformTimeline::DeformTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0), _attachment(NULL) { + _frames.ensureCapacity(frameCount); + _frameVertices.ensureCapacity(frameCount); + + _frames.setSize(frameCount, 0); + + for (int i = 0; i < frameCount; ++i) { + Vector vec; + _frameVertices.add(vec); + } +} + +void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + Slot *slotP = skeleton._slots[_slotIndex]; + Slot &slot = *slotP; + + Attachment *slotAttachment = slot.getAttachment(); + if (slotAttachment == NULL || !slotAttachment->getRTTI().instanceOf(VertexAttachment::rtti)) { + return; + } + + VertexAttachment *attachment = static_cast(slotAttachment); + if (!attachment->applyDeform(_attachment)) { + return; + } + + Vector &verticesArray = slot._attachmentVertices; + if (verticesArray.size() == 0) { + blend = MixBlend_Setup; + } + + Vector< Vector > &frameVertices = _frameVertices; + size_t vertexCount = frameVertices[0].size(); + + Vector &frames = _frames; + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + verticesArray.clear(); + return; + case MixBlend_First: { + if (alpha == 1) { + verticesArray.clear(); + return; + } + verticesArray.setSize(vertexCount, 0); + Vector &vertices = verticesArray; + if (attachment->getBones().size() == 0) { + // Unweighted vertex positions. + Vector &setupVertices = attachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) + vertices[i] += (setupVertices[i] - vertices[i]) * alpha; + } else { + // Weighted deform offsets. + alpha = 1 - alpha; + for (size_t i = 0; i < vertexCount; i++) + vertices[i] *= alpha; + } + } + case MixBlend_Replace: + case MixBlend_Add: + return; + } + } + + verticesArray.setSize(vertexCount, 0); + Vector &vertices = verticesArray; + + if (time >= frames[frames.size() - 1]) { // Time is after last frame. + Vector &lastVertices = frameVertices[frames.size() - 1]; + if (alpha == 1) { + if (blend == MixBlend_Add) { + VertexAttachment *vertexAttachment = static_cast(slotAttachment); + if (vertexAttachment->getBones().size() == 0) { + // Unweighted vertex positions, no alpha. + Vector &setupVertices = vertexAttachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) + vertices[i] += lastVertices[i] - setupVertices[i]; + } else { + // Weighted deform offsets, no alpha. + for (size_t i = 0; i < vertexCount; i++) + vertices[i] += lastVertices[i]; + } + } else { + // Vertex positions or deform offsets, no alpha. + memcpy(vertices.buffer(), lastVertices.buffer(), vertexCount * sizeof(float)); + } + } else { + switch (blend) { + case MixBlend_Setup: { + VertexAttachment *vertexAttachment = static_cast(slotAttachment); + if (vertexAttachment->getBones().size() == 0) { + // Unweighted vertex positions, with alpha. + Vector &setupVertices = vertexAttachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) { + float setup = setupVertices[i]; + vertices[i] = setup + (lastVertices[i] - setup) * alpha; + } + } else { + // Weighted deform offsets, with alpha. + for (size_t i = 0; i < vertexCount; i++) + vertices[i] = lastVertices[i] * alpha; + } + break; + } + case MixBlend_First: + case MixBlend_Replace: + // Vertex positions or deform offsets, with alpha. + for (size_t i = 0; i < vertexCount; i++) + vertices[i] += (lastVertices[i] - vertices[i]) * alpha; + break; + case MixBlend_Add: + VertexAttachment *vertexAttachment = static_cast(slotAttachment); + if (vertexAttachment->getBones().size() == 0) { + // Unweighted vertex positions, no alpha. + Vector &setupVertices = vertexAttachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) + vertices[i] += (lastVertices[i] - setupVertices[i]) * alpha; + } else { + // Weighted deform offsets, alpha. + for (size_t i = 0; i < vertexCount; i++) + vertices[i] += lastVertices[i] * alpha; + } + } + } + return; + } + + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(frames, time); + Vector &prevVertices = frameVertices[frame - 1]; + Vector &nextVertices = frameVertices[frame]; + float frameTime = frames[frame]; + float percent = getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime)); + + if (alpha == 1) { + if (blend == MixBlend_Add) { + VertexAttachment *vertexAttachment = static_cast(slotAttachment); + if (vertexAttachment->getBones().size() == 0) { + // Unweighted vertex positions, no alpha. + Vector &setupVertices = vertexAttachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] += prev + (nextVertices[i] - prev) * percent - setupVertices[i]; + } + } else { + // Weighted deform offsets, no alpha. + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] += prev + (nextVertices[i] - prev) * percent; + } + } + } else { + // Vertex positions or deform offsets, no alpha. + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] = prev + (nextVertices[i] - prev) * percent; + } + } + } else { + switch (blend) { + case MixBlend_Setup: { + VertexAttachment *vertexAttachment = static_cast(slotAttachment); + if (vertexAttachment->getBones().size() == 0) { + // Unweighted vertex positions, with alpha. + Vector &setupVertices = vertexAttachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i], setup = setupVertices[i]; + vertices[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha; + } + } else { + // Weighted deform offsets, with alpha. + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] = (prev + (nextVertices[i] - prev) * percent) * alpha; + } + } + break; + } + case MixBlend_First: + case MixBlend_Replace: + // Vertex positions or deform offsets, with alpha. + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha; + } + break; + case MixBlend_Add: + VertexAttachment *vertexAttachment = static_cast(slotAttachment); + if (vertexAttachment->getBones().size() == 0) { + // Unweighted vertex positions, with alpha. + Vector &setupVertices = vertexAttachment->getVertices(); + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha; + } + } else { + // Weighted deform offsets, with alpha. + for (size_t i = 0; i < vertexCount; i++) { + float prev = prevVertices[i]; + vertices[i] += (prev + (nextVertices[i] - prev) * percent) * alpha; + } + } + } + } +} + +int DeformTimeline::getPropertyId() { + assert(_attachment != NULL); + + return ((int) TimelineType_Deform << 24) + _attachment->_id + _slotIndex; +} + +void DeformTimeline::setFrame(int frameIndex, float time, Vector &vertices) { + _frames[frameIndex] = time; + _frameVertices[frameIndex].clear(); + _frameVertices[frameIndex].addAll(vertices); +} + +int DeformTimeline::getSlotIndex() { + return _slotIndex; +} + +void DeformTimeline::setSlotIndex(int inValue) { + _slotIndex = inValue; +} + +Vector &DeformTimeline::getFrames() { + return _frames; +} + +Vector > &DeformTimeline::getVertices() { + return _frameVertices; +} + +VertexAttachment *DeformTimeline::getAttachment() { + return _attachment; +} + +void DeformTimeline::setAttachment(VertexAttachment *inValue) { + _attachment = inValue; +} diff --git a/cocos/editor-support/spine/DeformTimeline.h b/cocos/editor-support/spine/DeformTimeline.h new file mode 100644 index 00000000000..ccec3455e76 --- /dev/null +++ b/cocos/editor-support/spine/DeformTimeline.h @@ -0,0 +1,70 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_DeformTimeline_h +#define Spine_DeformTimeline_h + +#include + +namespace spine { + class VertexAttachment; + + class SP_API DeformTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit DeformTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, Vector& vertices); + + int getSlotIndex(); + void setSlotIndex(int inValue); + Vector& getFrames(); + Vector< Vector >& getVertices(); + VertexAttachment* getAttachment(); + void setAttachment(VertexAttachment* inValue); + + private: + int _slotIndex; + Vector _frames; + Vector< Vector > _frameVertices; + VertexAttachment* _attachment; + }; +} + +#endif /* Spine_DeformTimeline_h */ diff --git a/cocos/editor-support/spine/DrawOrderTimeline.cpp b/cocos/editor-support/spine/DrawOrderTimeline.cpp new file mode 100644 index 00000000000..d79d3fc6c03 --- /dev/null +++ b/cocos/editor-support/spine/DrawOrderTimeline.cpp @@ -0,0 +1,130 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(DrawOrderTimeline, Timeline) + +DrawOrderTimeline::DrawOrderTimeline(int frameCount) : Timeline() { + _frames.ensureCapacity(frameCount); + _drawOrders.ensureCapacity(frameCount); + + _frames.setSize(frameCount, 0); + + for (int i = 0; i < frameCount; ++i) { + Vector vec; + _drawOrders.add(vec); + } +} + +void DrawOrderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(alpha); + + Vector &drawOrder = skeleton._drawOrder; + Vector &slots = skeleton._slots; + if (direction == MixDirection_Out && blend == MixBlend_Setup) { + drawOrder.clear(); + drawOrder.ensureCapacity(slots.size()); + for (size_t i = 0, n = slots.size(); i < n; ++i) { + drawOrder.add(slots[i]); + } + return; + } + + if (time < _frames[0]) { + if (blend == MixBlend_Setup || blend == MixBlend_First) { + drawOrder.clear(); + drawOrder.ensureCapacity(slots.size()); + for (size_t i = 0, n = slots.size(); i < n; ++i) { + drawOrder.add(slots[i]); + } + } + return; + } + + size_t frame; + if (time >= _frames[_frames.size() - 1]) { + // Time is after last frame. + frame = _frames.size() - 1; + } else { + frame = (size_t)Animation::binarySearch(_frames, time) - 1; + } + + Vector &drawOrderToSetupIndex = _drawOrders[frame]; + if (drawOrderToSetupIndex.size() == 0) { + drawOrder.clear(); + for (size_t i = 0, n = slots.size(); i < n; ++i) { + drawOrder.add(slots[i]); + } + } else { + for (size_t i = 0, n = drawOrderToSetupIndex.size(); i < n; ++i) { + drawOrder[i] = slots[drawOrderToSetupIndex[i]]; + } + } +} + +int DrawOrderTimeline::getPropertyId() { + return ((int) TimelineType_DrawOrder << 24); +} + +void DrawOrderTimeline::setFrame(size_t frameIndex, float time, Vector &drawOrder) { + _frames[frameIndex] = time; + _drawOrders[frameIndex].clear(); + _drawOrders[frameIndex].addAll(drawOrder); +} + +Vector &DrawOrderTimeline::getFrames() { + return _frames; +} + +Vector > &DrawOrderTimeline::getDrawOrders() { + return _drawOrders; +} + +size_t DrawOrderTimeline::getFrameCount() { + return _frames.size(); +} diff --git a/cocos/editor-support/spine/DrawOrderTimeline.h b/cocos/editor-support/spine/DrawOrderTimeline.h new file mode 100644 index 00000000000..cdb65e8d6b3 --- /dev/null +++ b/cocos/editor-support/spine/DrawOrderTimeline.h @@ -0,0 +1,64 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_DrawOrderTimeline_h +#define Spine_DrawOrderTimeline_h + +#include + +namespace spine { + class SP_API DrawOrderTimeline : public Timeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit DrawOrderTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + /// @param drawOrder May be NULL to use bind pose draw order + void setFrame(size_t frameIndex, float time, Vector& drawOrder); + + Vector& getFrames(); + Vector< Vector >& getDrawOrders(); + size_t getFrameCount(); + + private: + Vector _frames; + Vector< Vector > _drawOrders; + }; +} + +#endif /* Spine_DrawOrderTimeline_h */ diff --git a/cocos/editor-support/spine/Event.cpp b/cocos/editor-support/spine/Event.cpp new file mode 100644 index 00000000000..e397b4e6868 --- /dev/null +++ b/cocos/editor-support/spine/Event.cpp @@ -0,0 +1,96 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +spine::Event::Event(float time, const spine::EventData &data) : + _data(data), + _time(time), + _intValue(0), + _floatValue(0), + _stringValue(), + _volume(1), + _balance(0) { +} + +const spine::EventData &spine::Event::getData() { + return _data; +} + +float spine::Event::getTime() { + return _time; +} + +int spine::Event::getIntValue() { + return _intValue; +} + +void spine::Event::setIntValue(int inValue) { + _intValue = inValue; +} + +float spine::Event::getFloatValue() { + return _floatValue; +} + +void spine::Event::setFloatValue(float inValue) { + _floatValue = inValue; +} + +const spine::String &spine::Event::getStringValue() { + return _stringValue; +} + +void spine::Event::setStringValue(const spine::String &inValue) { + _stringValue = inValue; +} + + +float spine::Event::getVolume() { + return _volume; +} + +void spine::Event::setVolume(float inValue) { + _volume = inValue; +} + +float spine::Event::getBalance() { + return _balance; +} + +void spine::Event::setBalance(float inValue) { + _balance = inValue; +} diff --git a/cocos/editor-support/spine/Event.h b/cocos/editor-support/spine/Event.h index c92b713de8c..1378da9cfe9 100644 --- a/cocos/editor-support/spine/Event.h +++ b/cocos/editor-support/spine/Event.h @@ -1,72 +1,87 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_EVENT_H_ -#define SPINE_EVENT_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spEvent { - spEventData* const data; - float const time; - int intValue; - float floatValue; - const char* stringValue; - -#ifdef __cplusplus - spEvent() : - data(0), - time(0), - intValue(0), - floatValue(0), - stringValue(0) { - } -#endif -} spEvent; - -SP_API spEvent* spEvent_create (float time, spEventData* data); -SP_API void spEvent_dispose (spEvent* self); - -#ifdef SPINE_SHORT_NAMES -typedef spEvent Event; -#define Event_create(...) spEvent_create(__VA_ARGS__) -#define Event_dispose(...) spEvent_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_EVENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Event_h +#define Spine_Event_h + +#include +#include + +namespace spine { +class EventData; + +/// Stores the current pose values for an Event. +class SP_API Event : public SpineObject { + friend class SkeletonBinary; + + friend class SkeletonJson; + + friend class AnimationState; + +public: + Event(float time, const EventData &data); + + const EventData &getData(); + + /// The animation time this event was keyed. + float getTime(); + + int getIntValue(); + + void setIntValue(int inValue); + + float getFloatValue(); + + void setFloatValue(float inValue); + + const String &getStringValue(); + + void setStringValue(const String &inValue); + + float getVolume(); + + void setVolume(float inValue); + + float getBalance(); + + void setBalance(float inValue); + +private: + const EventData &_data; + const float _time; + int _intValue; + float _floatValue; + String _stringValue; + float _volume; + float _balance; +}; +} + +#endif /* Spine_Event_h */ diff --git a/cocos/editor-support/spine/EventData.cpp b/cocos/editor-support/spine/EventData.cpp new file mode 100644 index 00000000000..489f185b954 --- /dev/null +++ b/cocos/editor-support/spine/EventData.cpp @@ -0,0 +1,102 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +spine::EventData::EventData(const spine::String &name) : + _name(name), + _intValue(0), + _floatValue(0), + _stringValue(), + _audioPath(), + _volume(1), + _balance(0) { + assert(_name.length() > 0); +} + +/// The name of the event, which is unique within the skeleton. +const spine::String &spine::EventData::getName() const { + return _name; +} + +int spine::EventData::getIntValue() { + return _intValue; +} + +void spine::EventData::setIntValue(int inValue) { + _intValue = inValue; +} + +float spine::EventData::getFloatValue() { + return _floatValue; +} + +void spine::EventData::setFloatValue(float inValue) { + _floatValue = inValue; +} + +const spine::String &spine::EventData::getStringValue() { + return _stringValue; +} + +void spine::EventData::setStringValue(const spine::String &inValue) { + this->_stringValue = inValue; +} + +const spine::String &spine::EventData::getAudioPath() { + return _audioPath; +} + +void spine::EventData::setAudioPath(const spine::String &inValue) { + _audioPath = inValue; +} + + +float spine::EventData::getVolume() { + return _volume; +} + +void spine::EventData::setVolume(float inValue) { + _volume = inValue; +} + +float spine::EventData::getBalance() { + return _balance; +} + +void spine::EventData::setBalance(float inValue) { + _balance = inValue; +} diff --git a/cocos/editor-support/spine/EventData.h b/cocos/editor-support/spine/EventData.h index 70b95507122..ec5d5332912 100644 --- a/cocos/editor-support/spine/EventData.h +++ b/cocos/editor-support/spine/EventData.h @@ -1,69 +1,87 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_EVENTDATA_H_ -#define SPINE_EVENTDATA_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spEventData { - const char* const name; - int intValue; - float floatValue; - const char* stringValue; - -#ifdef __cplusplus - spEventData() : - name(0), - intValue(0), - floatValue(0), - stringValue(0) { - } -#endif -} spEventData; - -SP_API spEventData* spEventData_create (const char* name); -SP_API void spEventData_dispose (spEventData* self); - -#ifdef SPINE_SHORT_NAMES -typedef spEventData EventData; -#define EventData_create(...) spEventData_create(__VA_ARGS__) -#define EventData_dispose(...) spEventData_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_EVENTDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_EventData_h +#define Spine_EventData_h + +#include +#include + +namespace spine { +/// Stores the setup pose values for an Event. +class SP_API EventData : public SpineObject { + friend class SkeletonBinary; + + friend class SkeletonJson; + + friend class Event; + +public: + explicit EventData(const String &name); + + /// The name of the event, which is unique within the skeleton. + const String &getName() const; + + int getIntValue(); + + void setIntValue(int inValue); + + float getFloatValue(); + + void setFloatValue(float inValue); + + const String &getStringValue(); + + void setStringValue(const String &inValue); + + const String &getAudioPath(); + + void setAudioPath(const String &inValue); + + float getVolume(); + + void setVolume(float inValue); + + float getBalance(); + + void setBalance(float inValue); + +private: + const String _name; + int _intValue; + float _floatValue; + String _stringValue; + String _audioPath; + float _volume; + float _balance; +}; +} + +#endif /* Spine_EventData_h */ diff --git a/cocos/editor-support/spine/EventTimeline.cpp b/cocos/editor-support/spine/EventTimeline.cpp new file mode 100644 index 00000000000..d1218380f91 --- /dev/null +++ b/cocos/editor-support/spine/EventTimeline.cpp @@ -0,0 +1,116 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(EventTimeline, Timeline) + +EventTimeline::EventTimeline(int frameCount) : Timeline() { + _frames.setSize(frameCount, 0); + _events.setSize(frameCount, NULL); +} + +EventTimeline::~EventTimeline() { + ContainerUtil::cleanUpVectorOfPointers(_events); +} + +void EventTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + if (pEvents == NULL) { + return; + } + + Vector &events = *pEvents; + + size_t frameCount = _frames.size(); + + if (lastTime > time) { + // Fire events after last time for looped animations. + apply(skeleton, lastTime, std::numeric_limits::max(), pEvents, alpha, blend, direction); + lastTime = -1.0f; + } else if (lastTime >= _frames[frameCount - 1]) { + // Last time is after last frame. + return; + } + + if (time < _frames[0]) { + return; // Time is before first frame. + } + + int frame; + if (lastTime < _frames[0]) { + frame = 0; + } else { + frame = Animation::binarySearch(_frames, lastTime); + float frameTime = _frames[frame]; + while (frame > 0) { + // Fire multiple events with the same frame. + if (_frames[frame - 1] != frameTime) { + break; + } + frame--; + } + } + + for (; (size_t)frame < frameCount && time >= _frames[frame]; ++frame) { + events.add(_events[frame]); + } +} + +int EventTimeline::getPropertyId() { + return ((int) TimelineType_Event << 24); +} + +void EventTimeline::setFrame(size_t frameIndex, Event *event) { + _frames[frameIndex] = event->getTime(); + _events[frameIndex] = event; +} + +Vector EventTimeline::getFrames() { return _frames; } + +Vector &EventTimeline::getEvents() { return _events; } + +size_t EventTimeline::getFrameCount() { return _frames.size(); } diff --git a/cocos/editor-support/spine/Attachment.c b/cocos/editor-support/spine/EventTimeline.h similarity index 66% rename from cocos/editor-support/spine/Attachment.c rename to cocos/editor-support/spine/EventTimeline.h index 3dad43a69b0..a3a14bd388b 100644 --- a/cocos/editor-support/spine/Attachment.c +++ b/cocos/editor-support/spine/EventTimeline.h @@ -1,57 +1,65 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -typedef struct _spAttachmentVtable { - void (*dispose) (spAttachment* self); -} _spAttachmentVtable; - -void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType type, /**/ - void (*dispose) (spAttachment* self)) { - - CONST_CAST(_spAttachmentVtable*, self->vtable) = NEW(_spAttachmentVtable); - VTABLE(spAttachment, self) ->dispose = dispose; - - MALLOC_STR(self->name, name); - CONST_CAST(spAttachmentType, self->type) = type; -} - -void _spAttachment_deinit (spAttachment* self) { - if (self->attachmentLoader) spAttachmentLoader_disposeAttachment(self->attachmentLoader, self); - FREE(self->vtable); - FREE(self->name); -} - -void spAttachment_dispose (spAttachment* self) { - VTABLE(spAttachment, self) ->dispose(self); -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_EventTimeline_h +#define Spine_EventTimeline_h + +#include + +namespace spine { + class SP_API EventTimeline : public Timeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit EventTimeline(int frameCount); + + ~EventTimeline(); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(size_t frameIndex, Event* event); + + Vector getFrames(); + Vector& getEvents(); + size_t getFrameCount(); + + private: + Vector _frames; + Vector _events; + }; +} + +#endif /* Spine_EventTimeline_h */ diff --git a/cocos/editor-support/spine/Extension.cpp b/cocos/editor-support/spine/Extension.cpp new file mode 100644 index 00000000000..3766524bb63 --- /dev/null +++ b/cocos/editor-support/spine/Extension.cpp @@ -0,0 +1,128 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include + +#include + +using namespace spine; + +SpineExtension *SpineExtension::_instance = NULL; + +void SpineExtension::setInstance(SpineExtension *inValue) { + assert(inValue); + + _instance = inValue; +} + +SpineExtension *SpineExtension::getInstance() { + if (!_instance) _instance = spine::getDefaultExtension(); + assert(_instance); + + return _instance; +} + +SpineExtension::~SpineExtension() { +} + +SpineExtension::SpineExtension() { +} + +DefaultSpineExtension::~DefaultSpineExtension() { +} + +void *DefaultSpineExtension::_alloc(size_t size, const char *file, int line) { + SP_UNUSED(file); + SP_UNUSED(line); + + if (size == 0) + return 0; + void *ptr = ::malloc(size); + return ptr; +} + +void *DefaultSpineExtension::_calloc(size_t size, const char *file, int line) { + SP_UNUSED(file); + SP_UNUSED(line); + + if (size == 0) + return 0; + + void *ptr = ::malloc(size); + if (ptr) { + memset(ptr, 0, size); + } + return ptr; +} + +void *DefaultSpineExtension::_realloc(void *ptr, size_t size, const char *file, int line) { + SP_UNUSED(file); + SP_UNUSED(line); + + void *mem = NULL; + if (size == 0) + return 0; + if (ptr == NULL) + mem = ::malloc(size); + else + mem = ::realloc(ptr, size); + return mem; +} + +void DefaultSpineExtension::_free(void *mem, const char *file, int line) { + SP_UNUSED(file); + SP_UNUSED(line); + + ::free(mem); +} + +char *DefaultSpineExtension::_readFile(const String &path, int *length) { + char *data; + FILE *file = fopen(path.buffer(), "rb"); + if (!file) return 0; + + fseek(file, 0, SEEK_END); + *length = (int) ftell(file); + fseek(file, 0, SEEK_SET); + + data = SpineExtension::alloc(*length, __FILE__, __LINE__); + fread(data, 1, *length, file); + fclose(file); + + return data; +} + +DefaultSpineExtension::DefaultSpineExtension() : SpineExtension() { +} diff --git a/cocos/editor-support/spine/Extension.h b/cocos/editor-support/spine/Extension.h new file mode 100644 index 00000000000..95d9cd9fea1 --- /dev/null +++ b/cocos/editor-support/spine/Extension.h @@ -0,0 +1,118 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Extension_h +#define Spine_Extension_h + +#include +#include + +#define SP_UNUSED(x) (void)(x) + +namespace spine { +class String; + +class SP_API SpineExtension { +public: + template + static T *alloc(size_t num, const char *file, int line) { + return (T *) getInstance()->_alloc(sizeof(T) * num, file, line); + } + + template + static T *calloc(size_t num, const char *file, int line) { + return (T *) getInstance()->_calloc(sizeof(T) * num, file, line); + } + + template + static T *realloc(T *ptr, size_t num, const char *file, int line) { + return (T *) getInstance()->_realloc(ptr, sizeof(T) * num, file, line); + } + + template + static void free(T *ptr, const char *file, int line) { + getInstance()->_free((void *) ptr, file, line); + } + + static char *readFile(const String &path, int *length) { + return getInstance()->_readFile(path, length); + } + + static void setInstance(SpineExtension *inSpineExtension); + + static SpineExtension *getInstance(); + + virtual ~SpineExtension(); + + /// Implement this function to use your own memory allocator + virtual void *_alloc(size_t size, const char *file, int line) = 0; + + virtual void *_calloc(size_t size, const char *file, int line) = 0; + + virtual void *_realloc(void *ptr, size_t size, const char *file, int line) = 0; + + /// If you provide a spineAllocFunc, you should also provide a spineFreeFunc + virtual void _free(void *mem, const char *file, int line) = 0; + + virtual char *_readFile(const String &path, int *length) = 0; + +protected: + SpineExtension(); + +private: + static SpineExtension *_instance; +}; + +class SP_API DefaultSpineExtension : public SpineExtension { +public: + DefaultSpineExtension(); + + virtual ~DefaultSpineExtension(); + +protected: + virtual void *_alloc(size_t size, const char *file, int line); + + virtual void *_calloc(size_t size, const char *file, int line); + + virtual void *_realloc(void *ptr, size_t size, const char *file, int line); + + virtual void _free(void *mem, const char *file, int line); + + virtual char *_readFile(const String &path, int *length); +}; + +// This function is to be implemented by engine specific runtimes to provide +// the default extension for that engine. It is called the first time +// SpineExtension::getInstance() is called, when no instance has been set +// yet. +extern SpineExtension *getDefaultExtension(); +} + +#endif /* Spine_Extension_h */ diff --git a/cocos/editor-support/spine/ClippingAttachment.c b/cocos/editor-support/spine/HasRendererObject.h similarity index 74% rename from cocos/editor-support/spine/ClippingAttachment.c rename to cocos/editor-support/spine/HasRendererObject.h index 38ea8dd3149..929fee7997b 100644 --- a/cocos/editor-support/spine/ClippingAttachment.c +++ b/cocos/editor-support/spine/HasRendererObject.h @@ -1,48 +1,59 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -void _spClippingAttachment_dispose (spAttachment* attachment) { - spClippingAttachment* self = SUB_CAST(spClippingAttachment, attachment); - - _spVertexAttachment_deinit(SUPER(self)); - - FREE(self); -} - -spClippingAttachment* spClippingAttachment_create (const char* name) { - spClippingAttachment* self = NEW(spClippingAttachment); - _spVertexAttachment_init(SUPER(self)); - _spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_CLIPPING, _spClippingAttachment_dispose); - self->endSlot = 0; - return self; -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_HasRendererObject_h +#define Spine_HasRendererObject_h + +namespace spine { + +typedef void (*DisposeRendererObject) (void* rendererObject); + +class SP_API HasRendererObject { +public: + explicit HasRendererObject() : _rendererObject(NULL), _dispose(NULL) {}; + + virtual ~HasRendererObject() { + if (_dispose && _rendererObject) + _dispose(_rendererObject); + } + + void* getRendererObject() { return _rendererObject; } + void setRendererObject(void* rendererObject, DisposeRendererObject dispose = NULL) { + _rendererObject = rendererObject; + _dispose = dispose; + } +private: + void *_rendererObject; + DisposeRendererObject _dispose; +}; + +} + +#endif diff --git a/cocos/editor-support/spine/HashMap.h b/cocos/editor-support/spine/HashMap.h new file mode 100755 index 00000000000..2aa5a2158f7 --- /dev/null +++ b/cocos/editor-support/spine/HashMap.h @@ -0,0 +1,185 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_HashMap_h +#define Spine_HashMap_h + +#include +#include +#include + + // Required for new with line number and file name in MSVC +#ifdef _MSC_VER +#pragma warning(disable:4291) +#endif + +namespace spine { +template +class SP_API HashMap : public SpineObject { +private: + class Entry; + +public: + class SP_API Pair { + public: + explicit Pair(K &k, V &v) : key(k), value(v) {} + + K &key; + V &value; + }; + + class SP_API Entries { + public: + friend class HashMap; + + explicit Entries(Entry *entry) : _entry(NULL), _hasChecked(false) { + _start.next = entry; + _entry = &_start; + } + + Pair next() { + assert(_entry); + assert(_hasChecked); + _entry = _entry->next; + Pair pair(_entry->_key, _entry->_value); + _hasChecked = false; + return pair; + } + + bool hasNext() { + _hasChecked = true; + return _entry->next; + } + + private: + bool _hasChecked; + Entry _start; + Entry *_entry; + }; + + HashMap() : + _head(NULL), + _size(0) { + } + + ~HashMap() { + for (Entry *entry = _head; entry != NULL;) { + Entry* next = entry->next; + delete entry; + entry = next; + } + } + + size_t size() { + return _size; + } + + void put(const K &key, const V &value) { + Entry *entry = find(key); + if (entry) { + entry->_key = key; + entry->_value = value; + } else { + entry = new(__FILE__, __LINE__) Entry(); + entry->_key = key; + entry->_value = value; + + Entry *oldHead = _head; + + if (oldHead) { + _head = entry; + oldHead->prev = entry; + entry->next = oldHead; + } else { + _head = entry; + } + _size++; + } + } + + bool containsKey(const K &key) { + return find(key) != NULL; + } + + bool remove(const K &key) { + Entry *entry = find(key); + if (!entry) return false; + + Entry *prev = entry->prev; + Entry *next = entry->next; + + if (prev) prev->next = next; + else _head = next; + if (next) next->prev = entry->prev; + + delete entry; + _size--; + + return true; + } + + V operator[](const K &key) { + Entry *entry = find(key); + if (entry) return entry->_value; + else { + assert(false); + return 0; + } + } + + Entries getEntries() const { + return Entries(_head); + } + +private: + Entry *find(const K &key) { + for (Entry *entry = _head; entry != NULL; entry = entry->next) { + if (entry->_key == key) + return entry; + } + return NULL; + } + + class SP_API Entry : public SpineObject { + public: + K _key; + V _value; + Entry *next; + Entry *prev; + + Entry() : next(NULL), prev(NULL) {} + }; + + Entry *_head; + size_t _size; +}; +} + +#endif /* Spine_HashMap_h */ diff --git a/cocos/editor-support/spine/IkConstraint.c b/cocos/editor-support/spine/IkConstraint.c deleted file mode 100644 index 1caab6379de..00000000000 --- a/cocos/editor-support/spine/IkConstraint.c +++ /dev/null @@ -1,208 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include -#include - -spIkConstraint *spIkConstraint_create(spIkConstraintData *data, const spSkeleton *skeleton) { - int i; - - spIkConstraint *self = NEW(spIkConstraint); - CONST_CAST(spIkConstraintData*, self->data) = data; - self->bendDirection = data->bendDirection; - self->mix = data->mix; - - self->bonesCount = self->data->bonesCount; - self->bones = MALLOC(spBone*, self->bonesCount); - for (i = 0; i < self->bonesCount; ++i) - self->bones[i] = spSkeleton_findBone(skeleton, self->data->bones[i]->name); - self->target = spSkeleton_findBone(skeleton, self->data->target->name); - - return self; -} - -void spIkConstraint_dispose(spIkConstraint *self) { - FREE(self->bones); - FREE(self); -} - -void spIkConstraint_apply(spIkConstraint *self) { - switch (self->bonesCount) { - case 1: - spIkConstraint_apply1(self->bones[0], self->target->worldX, self->target->worldY, self->mix); - break; - case 2: - spIkConstraint_apply2(self->bones[0], self->bones[1], self->target->worldX, self->target->worldY, self->bendDirection, self->mix); - break; - } -} - -void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, float alpha) { - spBone* p = bone->parent; - float id, x, y, tx, ty, rotationIK; - if (!bone->appliedValid) spBone_updateAppliedTransform(bone); - id = 1 / (p->a * p->d - p->b * p->c); - x = targetX - p->worldX, y = targetY - p->worldY; - tx = (x * p->d - y * p->b) * id - bone->ax; ty = (y * p->a - x * p->c) * id - bone->ay; - rotationIK = ATAN2(ty, tx) * RAD_DEG - bone->ashearX - bone->arotation; - if (bone->ascaleX < 0) rotationIK += 180; - if (rotationIK > 180) rotationIK -= 360; - else if (rotationIK < -180) rotationIK += 360; - spBone_updateWorldTransformWith(bone, bone->ax, bone->ay, bone->arotation + rotationIK * alpha, bone->ascaleX, - bone->ascaleY, bone->ashearX, bone->ashearY); -} - -void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDir, float alpha) { - float px, py, psx, psy; - float cx, cy, csx, cwx, cwy; - int o1, o2, s2, u; - spBone* pp = parent->parent; - float tx, ty, dx, dy, l1, l2, a1, a2, r; - float id, x, y; - if (alpha == 0) { - spBone_updateWorldTransform(child); - return; - } - if (!parent->appliedValid) spBone_updateAppliedTransform(parent); - if (!child->appliedValid) spBone_updateAppliedTransform(child); - px = parent->ax; py = parent->ay; psx = parent->ascaleX; psy = parent->ascaleY; csx = child->ascaleX; - if (psx < 0) { - psx = -psx; - o1 = 180; - s2 = -1; - } else { - o1 = 0; - s2 = 1; - } - if (psy < 0) { - psy = -psy; - s2 = -s2; - } - if (csx < 0) { - csx = -csx; - o2 = 180; - } else - o2 = 0; - r = psx - psy; - cx = child->ax; - u = (r < 0 ? -r : r) <= 0.0001f; - if (!u) { - cy = 0; - cwx = parent->a * cx + parent->worldX; - cwy = parent->c * cx + parent->worldY; - } else { - cy = child->ay; - cwx = parent->a * cx + parent->b * cy + parent->worldX; - cwy = parent->c * cx + parent->d * cy + parent->worldY; - } - id = 1 / (pp->a * pp->d - pp->b * pp->c); - x = targetX - pp->worldX; - y = targetY - pp->worldY; - tx = (x * pp->d - y * pp->b) * id - px; - ty = (y * pp->a - x * pp->c) * id - py; - x = cwx - pp->worldX; - y = cwy - pp->worldY; - dx = (x * pp->d - y * pp->b) * id - px; - dy = (y * pp->a - x * pp->c) * id - py; - l1 = SQRT(dx * dx + dy * dy); - l2 = child->data->length * csx; - if (u) { - float cosine, a, b; - l2 *= psx; - cosine = (tx * tx + ty * ty - l1 * l1 - l2 * l2) / (2 * l1 * l2); - if (cosine < -1) cosine = -1; - else if (cosine > 1) cosine = 1; - a2 = ACOS(cosine) * bendDir; - a = l1 + l2 * cosine; - b = l2 * SIN(a2); - a1 = ATAN2(ty * a - tx * b, tx * a + ty * b); - } else { - float a = psx * l2, b = psy * l2; - float aa = a * a, bb = b * b, ll = l1 * l1, dd = tx * tx + ty * ty, ta = ATAN2(ty, tx); - float c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa; - float d = c1 * c1 - 4 * c2 * c0; - if (d >= 0) { - float q = SQRT(d), r0, r1; - if (c1 < 0) q = -q; - q = -(c1 + q) / 2; - r0 = q / c2; r1 = c0 / q; - r = ABS(r0) < ABS(r1) ? r0 : r1; - if (r * r <= dd) { - y = SQRT(dd - r * r) * bendDir; - a1 = ta - ATAN2(y, r); - a2 = ATAN2(y / psy, (r - l1) / psx); - goto break_outer; - } - } - { - float minAngle = PI, minX = l1 - a, minDist = minX * minX, minY = 0; - float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0; - c0 = -a * l1 / (aa - bb); - if (c0 >= -1 && c0 <= 1) { - c0 = ACOS(c0); - x = a * COS(c0) + l1; - y = b * SIN(c0); - d = x * x + y * y; - if (d < minDist) { - minAngle = c0; - minDist = d; - minX = x; - minY = y; - } - if (d > maxDist) { - maxAngle = c0; - maxDist = d; - maxX = x; - maxY = y; - } - } - if (dd <= (minDist + maxDist) / 2) { - a1 = ta - ATAN2(minY * bendDir, minX); - a2 = minAngle * bendDir; - } else { - a1 = ta - ATAN2(maxY * bendDir, maxX); - a2 = maxAngle * bendDir; - } - } - } - break_outer: { - float os = ATAN2(cy, cx) * s2; - a1 = (a1 - os) * RAD_DEG + o1 - parent->arotation; - if (a1 > 180) a1 -= 360; - else if (a1 < -180) a1 += 360; - spBone_updateWorldTransformWith(parent, px, py, parent->rotation + a1 * alpha, parent->ascaleX, parent->ascaleY, 0, 0); - a2 = ((a2 + os) * RAD_DEG - child->ashearX) * s2 + o2 - child->arotation; - if (a2 > 180) a2 -= 360; - else if (a2 < -180) a2 += 360; - spBone_updateWorldTransformWith(child, cx, cy, child->arotation + a2 * alpha, child->ascaleX, child->ascaleY, child->ashearX, child->ashearY); - } -} diff --git a/cocos/editor-support/spine/IkConstraint.cpp b/cocos/editor-support/spine/IkConstraint.cpp new file mode 100644 index 00000000000..1c2237e62a8 --- /dev/null +++ b/cocos/editor-support/spine/IkConstraint.cpp @@ -0,0 +1,297 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include + +#include + +using namespace spine; + +RTTI_IMPL(IkConstraint, Constraint) + +void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress, bool stretch, bool uniform, float alpha) { + Bone *p = bone.getParent(); + float id, x, y, tx, ty, rotationIK; + if (!bone._appliedValid) bone.updateAppliedTransform(); + id = 1 / (p->_a * p->_d - p->_b * p->_c); + x = targetX - p->_worldX, y = targetY - p->_worldY; + tx = (x * p->_d - y * p->_b) * id - bone._ax; + ty = (y * p->_a - x * p->_c) * id - bone._ay; + rotationIK = MathUtil::atan2(ty, tx) * MathUtil::Rad_Deg - bone._ashearX - bone._arotation; + if (bone._ascaleX < 0) rotationIK += 180; + if (rotationIK > 180) rotationIK -= 360; + else if (rotationIK < -180) rotationIK += 360; + float sx = bone._ascaleX; + float sy = bone._ascaleY; + if (compress || stretch) { + float b = bone._data.getLength() * sx, dd = MathUtil::sqrt(tx * tx + ty * ty); + if (((compress && dd < b) || (stretch && dd > b)) && (b > 0.0001f)) { + float s = (dd / b - 1) * alpha + 1; + sx *= s; + if (uniform) sy *= s; + } + } + bone.updateWorldTransform(bone._ax, bone._ay, bone._arotation + rotationIK * alpha, sx, + sy, bone._ashearX, bone._ashearY); +} + +void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY, int bendDir, bool stretch, float alpha) { + float px, py, psx, sx, psy; + float cx, cy, csx, cwx, cwy; + int o1, o2, s2, u; + Bone *pp = parent.getParent(); + float tx, ty, dx, dy, dd, l1, l2, a1, a2, r; + float id, x, y; + if (alpha == 0) { + child.updateWorldTransform(); + return; + } + if (!parent._appliedValid) parent.updateAppliedTransform(); + if (!child._appliedValid) child.updateAppliedTransform(); + px = parent._ax; + py = parent._ay; + psx = parent._ascaleX; + sx = psx; + psy = parent._ascaleY; + csx = child._ascaleX; + if (psx < 0) { + psx = -psx; + o1 = 180; + s2 = -1; + } else { + o1 = 0; + s2 = 1; + } + if (psy < 0) { + psy = -psy; + s2 = -s2; + } + if (csx < 0) { + csx = -csx; + o2 = 180; + } else + o2 = 0; + r = psx - psy; + cx = child._ax; + u = (r < 0 ? -r : r) <= 0.0001f; + if (!u) { + cy = 0; + cwx = parent._a * cx + parent._worldX; + cwy = parent._c * cx + parent._worldY; + } else { + cy = child._ay; + cwx = parent._a * cx + parent._b * cy + parent._worldX; + cwy = parent._c * cx + parent._d * cy + parent._worldY; + } + id = 1 / (pp->_a * pp->_d - pp->_b * pp->_c); + x = targetX - pp->_worldX; + y = targetY - pp->_worldY; + tx = (x * pp->_d - y * pp->_b) * id - px; + ty = (y * pp->_a - x * pp->_c) * id - py; + dd = tx * tx + ty * ty; + x = cwx - pp->_worldX; + y = cwy - pp->_worldY; + dx = (x * pp->_d - y * pp->_b) * id - px; + dy = (y * pp->_a - x * pp->_c) * id - py; + l1 = MathUtil::sqrt(dx * dx + dy * dy); + l2 = child.getData().getLength() * csx; + if (u) { + float cosine, a, b; + l2 *= psx; + cosine = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2); + if (cosine < -1) cosine = -1; + else if (cosine > 1) { + cosine = 1; + if (stretch && l1 + l2 > 0.0001f) sx *= (MathUtil::sqrt(dd) / (l1 + l2) - 1) * alpha + 1; + } + a2 = MathUtil::acos(cosine) * bendDir; + a = l1 + l2 * cosine; + b = l2 * MathUtil::sin(a2); + a1 = MathUtil::atan2(ty * a - tx * b, tx * a + ty * b); + } else { + float a = psx * l2, b = psy * l2; + float aa = a * a, bb = b * b, ll = l1 * l1, ta = MathUtil::atan2(ty, tx); + float c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa; + float d = c1 * c1 - 4 * c2 * c0; + if (d >= 0) { + float q = MathUtil::sqrt(d), r0, r1; + if (c1 < 0) q = -q; + q = -(c1 + q) / 2; + r0 = q / c2; + r1 = c0 / q; + r = MathUtil::abs(r0) < MathUtil::abs(r1) ? r0 : r1; + if (r * r <= dd) { + y = MathUtil::sqrt(dd - r * r) * bendDir; + a1 = ta - MathUtil::atan2(y, r); + a2 = MathUtil::atan2(y / psy, (r - l1) / psx); + goto break_outer; + } + } + { + float minAngle = MathUtil::Pi, minX = l1 - a, minDist = minX * minX, minY = 0; + float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0; + c0 = -a * l1 / (aa - bb); + if (c0 >= -1 && c0 <= 1) { + c0 = MathUtil::acos(c0); + x = a * MathUtil::cos(c0) + l1; + y = b * MathUtil::sin(c0); + d = x * x + y * y; + if (d < minDist) { + minAngle = c0; + minDist = d; + minX = x; + minY = y; + } + if (d > maxDist) { + maxAngle = c0; + maxDist = d; + maxX = x; + maxY = y; + } + } + if (dd <= (minDist + maxDist) / 2) { + a1 = ta - MathUtil::atan2(minY * bendDir, minX); + a2 = minAngle * bendDir; + } else { + a1 = ta - MathUtil::atan2(maxY * bendDir, maxX); + a2 = maxAngle * bendDir; + } + } + } + break_outer: + { + float os = MathUtil::atan2(cy, cx) * s2; + a1 = (a1 - os) * MathUtil::Rad_Deg + o1 - parent._arotation; + if (a1 > 180) a1 -= 360; + else if (a1 < -180) a1 += 360; + parent.updateWorldTransform(px, py, parent._rotation + a1 * alpha, sx, parent._ascaleY, 0, 0); + a2 = ((a2 + os) * MathUtil::Rad_Deg - child._ashearX) * s2 + o2 - child._arotation; + if (a2 > 180) a2 -= 360; + else if (a2 < -180) a2 += 360; + child.updateWorldTransform(cx, cy, child._arotation + a2 * alpha, child._ascaleX, child._ascaleY, + child._ashearX, child._ashearY); + } +} + +IkConstraint::IkConstraint(IkConstraintData &data, Skeleton &skeleton) : Constraint(), + _data(data), + _bendDirection(data.getBendDirection()), + _compress(data.getCompress()), + _stretch(data.getStretch()), + _mix(data.getMix()), + _target(skeleton.findBone( + data.getTarget()->getName())) { + _bones.ensureCapacity(_data.getBones().size()); + for (size_t i = 0; i < _data.getBones().size(); i++) { + BoneData *boneData = _data.getBones()[i]; + _bones.add(skeleton.findBone(boneData->getName())); + } +} + +/// Applies the constraint to the constrained bones. +void IkConstraint::apply() { + update(); +} + +void IkConstraint::update() { + switch (_bones.size()) { + case 1: { + Bone *bone0 = _bones[0]; + apply(*bone0, _target->getWorldX(), _target->getWorldY(), _compress, _stretch, _data._uniform, _mix); + } + break; + case 2: { + Bone *bone0 = _bones[0]; + Bone *bone1 = _bones[1]; + apply(*bone0, *bone1, _target->getWorldX(), _target->getWorldY(), _bendDirection, _stretch, _mix); + } + break; + } +} + +int IkConstraint::getOrder() { + return _data.getOrder(); +} + +IkConstraintData &IkConstraint::getData() { + return _data; +} + +Vector &IkConstraint::getBones() { + return _bones; +} + +Bone *IkConstraint::getTarget() { + return _target; +} + +void IkConstraint::setTarget(Bone *inValue) { + _target = inValue; +} + +int IkConstraint::getBendDirection() { + return _bendDirection; +} + +void IkConstraint::setBendDirection(int inValue) { + _bendDirection = inValue; +} + +float IkConstraint::getMix() { + return _mix; +} + +void IkConstraint::setMix(float inValue) { + _mix = inValue; +} + +bool IkConstraint::getStretch() { + return _stretch; +} + +void IkConstraint::setStretch(bool inValue) { + _stretch = inValue; +} + +bool IkConstraint::getCompress() { + return _compress; +} + +void IkConstraint::setCompress(bool inValue) { + _compress = inValue; +} diff --git a/cocos/editor-support/spine/IkConstraint.h b/cocos/editor-support/spine/IkConstraint.h index e5b0f7b72d0..fc0cffb84cf 100644 --- a/cocos/editor-support/spine/IkConstraint.h +++ b/cocos/editor-support/spine/IkConstraint.h @@ -1,87 +1,106 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_IKCONSTRAINT_H_ -#define SPINE_IKCONSTRAINT_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct spSkeleton; - -typedef struct spIkConstraint { - spIkConstraintData* const data; - - int bonesCount; - spBone** bones; - - spBone* target; - int bendDirection; - float mix; - -#ifdef __cplusplus - spIkConstraint() : - data(0), - bonesCount(0), - bones(0), - target(0), - bendDirection(0), - mix(0) { - } -#endif -} spIkConstraint; - -SP_API spIkConstraint* spIkConstraint_create (spIkConstraintData* data, const struct spSkeleton* skeleton); -SP_API void spIkConstraint_dispose (spIkConstraint* self); - -SP_API void spIkConstraint_apply (spIkConstraint* self); - -SP_API void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, float alpha); -SP_API void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDirection, float alpha); - -#ifdef SPINE_SHORT_NAMES -typedef spIkConstraint IkConstraint; -#define IkConstraint_create(...) spIkConstraint_create(__VA_ARGS__) -#define IkConstraint_dispose(...) spIkConstraint_dispose(__VA_ARGS__) -#define IkConstraint_apply(...) spIkConstraint_apply(__VA_ARGS__) -#define IkConstraint_apply1(...) spIkConstraint_apply1(__VA_ARGS__) -#define IkConstraint_apply2(...) spIkConstraint_apply2(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_IKCONSTRAINT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_IkConstraint_h +#define Spine_IkConstraint_h + +#include + +#include + +namespace spine { +class IkConstraintData; + +class Skeleton; + +class Bone; + +class SP_API IkConstraint : public Constraint { + friend class Skeleton; + + friend class IkConstraintTimeline; + +RTTI_DECL + +public: + /// Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified + /// in the world coordinate system. + static void apply(Bone &bone, float targetX, float targetY, bool compress, bool stretch, bool uniform, float alpha); + + /// Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as + /// possible. The target is specified in the world coordinate system. + /// @param child A direct descendant of the parent bone. + static void apply(Bone &parent, Bone &child, float targetX, float targetY, int bendDir, bool stretch, float alpha); + + IkConstraint(IkConstraintData &data, Skeleton &skeleton); + + /// Applies the constraint to the constrained bones. + void apply(); + + virtual void update(); + + virtual int getOrder(); + + IkConstraintData &getData(); + + Vector &getBones(); + + Bone *getTarget(); + + void setTarget(Bone *inValue); + + int getBendDirection(); + + void setBendDirection(int inValue); + + bool getCompress(); + + void setCompress(bool inValue); + + bool getStretch(); + + void setStretch(bool inValue); + + float getMix(); + + void setMix(float inValue); + +private: + IkConstraintData &_data; + Vector _bones; + int _bendDirection; + bool _compress; + bool _stretch; + float _mix; + Bone *_target; +}; +} + +#endif /* Spine_IkConstraint_h */ diff --git a/cocos/editor-support/spine/IkConstraintData.c b/cocos/editor-support/spine/IkConstraintData.c deleted file mode 100644 index b557cc58f84..00000000000 --- a/cocos/editor-support/spine/IkConstraintData.c +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spIkConstraintData* spIkConstraintData_create (const char* name) { - spIkConstraintData* self = NEW(spIkConstraintData); - MALLOC_STR(self->name, name); - self->bendDirection = 1; - self->mix = 1; - return self; -} - -void spIkConstraintData_dispose (spIkConstraintData* self) { - FREE(self->name); - FREE(self->bones); - FREE(self); -} diff --git a/cocos/editor-support/spine/IkConstraintData.cpp b/cocos/editor-support/spine/IkConstraintData.cpp new file mode 100644 index 00000000000..149ab0e7159 --- /dev/null +++ b/cocos/editor-support/spine/IkConstraintData.cpp @@ -0,0 +1,115 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +IkConstraintData::IkConstraintData(const String &name) : + _name(name), + _order(0), + _target(NULL), + _bendDirection(1), + _compress(false), + _stretch(false), + _uniform(false), + _mix(1) { +} + +const String &IkConstraintData::getName() { + return _name; +} + +size_t IkConstraintData::getOrder() { + return _order; +} + +void IkConstraintData::setOrder(size_t inValue) { + _order = inValue; +} + +Vector &IkConstraintData::getBones() { + return _bones; +} + +BoneData *IkConstraintData::getTarget() { + return _target; +} + +void IkConstraintData::setTarget(BoneData *inValue) { + _target = inValue; +} + +int IkConstraintData::getBendDirection() { + return _bendDirection; +} + +void IkConstraintData::setBendDirection(int inValue) { + _bendDirection = inValue; +} + +float IkConstraintData::getMix() { + return _mix; +} + +void IkConstraintData::setMix(float inValue) { + _mix = inValue; +} + +bool IkConstraintData::getStretch() { + return _stretch; +} + +void IkConstraintData::setStretch(bool inValue) { + _stretch = inValue; +} + +bool IkConstraintData::getCompress() { + return _compress; +} + +void IkConstraintData::setCompress(bool inValue) { + _compress = inValue; +} + + +bool IkConstraintData::getUniform() { + return _uniform; +} + +void IkConstraintData::setUniform(bool inValue) { + _uniform = inValue; +} diff --git a/cocos/editor-support/spine/IkConstraintData.h b/cocos/editor-support/spine/IkConstraintData.h index fc3f3cc090f..7432e497a6b 100644 --- a/cocos/editor-support/spine/IkConstraintData.h +++ b/cocos/editor-support/spine/IkConstraintData.h @@ -1,76 +1,93 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_IKCONSTRAINTDATA_H_ -#define SPINE_IKCONSTRAINTDATA_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spIkConstraintData { - const char* const name; - int order; - int bonesCount; - spBoneData** bones; - - spBoneData* target; - int bendDirection; - float mix; - -#ifdef __cplusplus - spIkConstraintData() : - name(0), - bonesCount(0), - bones(0), - target(0), - bendDirection(0), - mix(0) { - } -#endif -} spIkConstraintData; - -SP_API spIkConstraintData* spIkConstraintData_create (const char* name); -SP_API void spIkConstraintData_dispose (spIkConstraintData* self); - -#ifdef SPINE_SHORT_NAMES -typedef spIkConstraintData IkConstraintData; -#define IkConstraintData_create(...) spIkConstraintData_create(__VA_ARGS__) -#define IkConstraintData_dispose(...) spIkConstraintData_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_IKCONSTRAINTDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_IkConstraintData_h +#define Spine_IkConstraintData_h + +#include +#include +#include + +namespace spine { + class BoneData; + + class SP_API IkConstraintData : public SpineObject { + friend class SkeletonBinary; + friend class SkeletonJson; + friend class IkConstraint; + friend class Skeleton; + friend class IkConstraintTimeline; + + public: + explicit IkConstraintData(const String& name); + + /// The IK constraint's name, which is unique within the skeleton. + const String& getName(); + + size_t getOrder(); + void setOrder(size_t inValue); + + /// The bones that are constrained by this IK Constraint. + Vector& getBones(); + + /// The bone that is the IK target. + BoneData* getTarget(); + void setTarget(BoneData* inValue); + + /// Controls the bend direction of the IK bones, either 1 or -1. + int getBendDirection(); + void setBendDirection(int inValue); + + bool getCompress(); + void setCompress(bool inValue); + + bool getStretch(); + void setStretch(bool inValue); + + bool getUniform(); + void setUniform(bool inValue); + + float getMix(); + void setMix(float inValue); + + private: + const String _name; + size_t _order; + Vector _bones; + BoneData* _target; + int _bendDirection; + bool _compress; + bool _stretch; + bool _uniform; + float _mix; + }; +} + +#endif /* Spine_IkConstraintData_h */ diff --git a/cocos/editor-support/spine/IkConstraintTimeline.cpp b/cocos/editor-support/spine/IkConstraintTimeline.cpp new file mode 100644 index 00000000000..6293964e045 --- /dev/null +++ b/cocos/editor-support/spine/IkConstraintTimeline.cpp @@ -0,0 +1,157 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(IkConstraintTimeline, CurveTimeline) + +const int IkConstraintTimeline::ENTRIES = 5; +const int IkConstraintTimeline::PREV_TIME = -5; +const int IkConstraintTimeline::PREV_MIX = -4; +const int IkConstraintTimeline::PREV_BEND_DIRECTION = -3; +const int IkConstraintTimeline::PREV_COMPRESS = -2; +const int IkConstraintTimeline::PREV_STRETCH = -1; +const int IkConstraintTimeline::MIX = 1; +const int IkConstraintTimeline::BEND_DIRECTION = 2; +const int IkConstraintTimeline::COMPRESS = 3; +const int IkConstraintTimeline::STRETCH = 4; + +IkConstraintTimeline::IkConstraintTimeline(int frameCount) : CurveTimeline(frameCount), _ikConstraintIndex(0) { + _frames.setSize(frameCount * ENTRIES, 0); +} + +void IkConstraintTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + + IkConstraint *constraintP = skeleton._ikConstraints[_ikConstraintIndex]; + IkConstraint &constraint = *constraintP; + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + constraint._mix = constraint._data._mix; + constraint._bendDirection = constraint._data._bendDirection; + constraint._compress = constraint._data._compress; + constraint._stretch = constraint._data._stretch; + return; + case MixBlend_First: + constraint._mix += (constraint._data._mix - constraint._mix) * alpha; + constraint._bendDirection = constraint._data._bendDirection; + constraint._compress = constraint._data._compress; + constraint._stretch = constraint._data._stretch; + return; + default: + return; + } + } + + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + if (blend == MixBlend_Setup) { + constraint._mix = + constraint._data._mix + (_frames[_frames.size() + PREV_MIX] - constraint._data._mix) * alpha; + if (direction == MixDirection_Out) { + constraint._bendDirection = constraint._data._bendDirection; + constraint._compress = constraint._data._compress; + constraint._stretch = constraint._data._stretch; + } else { + constraint._bendDirection = (int) _frames[_frames.size() + PREV_BEND_DIRECTION]; + constraint._compress = _frames[_frames.size() + PREV_COMPRESS] != 0; + constraint._stretch = _frames[_frames.size() + PREV_STRETCH] != 0; + } + } else { + constraint._mix += (_frames[_frames.size() + PREV_MIX] - constraint._mix) * alpha; + if (direction == MixDirection_In) { + constraint._bendDirection = (int) _frames[_frames.size() + PREV_BEND_DIRECTION]; + constraint._compress = _frames[_frames.size() + PREV_COMPRESS] != 0; + constraint._stretch = _frames[_frames.size() + PREV_STRETCH] != 0; + } + } + return; + } + + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + float mix = _frames[frame + PREV_MIX]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + if (blend == MixBlend_Setup) { + constraint._mix = + constraint._data._mix + (mix + (_frames[frame + MIX] - mix) * percent - constraint._data._mix) * alpha; + if (direction == MixDirection_Out) { + constraint._bendDirection = constraint._data._bendDirection; + constraint._compress = constraint._data._compress; + constraint._stretch = constraint._data._stretch; + } else { + constraint._bendDirection = (int) _frames[_frames.size() + PREV_BEND_DIRECTION]; + constraint._compress = _frames[frame + PREV_COMPRESS] != 0; + constraint._stretch = _frames[frame + PREV_STRETCH] != 0; + } + } else { + constraint._mix += (mix + (_frames[frame + MIX] - mix) * percent - constraint._mix) * alpha; + if (direction == MixDirection_In) { + constraint._bendDirection = (int) _frames[frame + PREV_BEND_DIRECTION]; + constraint._compress = _frames[frame + PREV_COMPRESS] != 0; + constraint._stretch = _frames[frame + PREV_STRETCH] != 0; + } + } +} + +int IkConstraintTimeline::getPropertyId() { + return ((int) TimelineType_IkConstraint << 24) + _ikConstraintIndex; +} + +void IkConstraintTimeline::setFrame(int frameIndex, float time, float mix, int bendDirection, bool compress, bool stretch) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + MIX] = mix; + _frames[frameIndex + BEND_DIRECTION] = (float)bendDirection; + _frames[frameIndex + COMPRESS] = compress ? 1 : 0; + _frames[frameIndex + STRETCH] = stretch ? 1 : 0; +} diff --git a/cocos/editor-support/spine/IkConstraintTimeline.h b/cocos/editor-support/spine/IkConstraintTimeline.h new file mode 100644 index 00000000000..82001b994e6 --- /dev/null +++ b/cocos/editor-support/spine/IkConstraintTimeline.h @@ -0,0 +1,72 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_IkConstraintTimeline_h +#define Spine_IkConstraintTimeline_h + +#include + +namespace spine { + + class SP_API IkConstraintTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + static const int ENTRIES; + + explicit IkConstraintTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time, mix and bend direction of the specified keyframe. + void setFrame (int frameIndex, float time, float mix, int bendDirection, bool compress, bool stretch); + + private: + static const int PREV_TIME; + static const int PREV_MIX; + static const int PREV_BEND_DIRECTION; + static const int PREV_COMPRESS; + static const int PREV_STRETCH; + static const int MIX; + static const int BEND_DIRECTION; + static const int COMPRESS; + static const int STRETCH; + + Vector _frames; + int _ikConstraintIndex; + }; +} + +#endif /* Spine_IkConstraintTimeline_h */ diff --git a/cocos/editor-support/spine/Json.c b/cocos/editor-support/spine/Json.c deleted file mode 100644 index c260bb39f6a..00000000000 --- a/cocos/editor-support/spine/Json.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - Copyright (c) 2009, Dave Gamble - Copyright (c) 2013, Esoteric Software - - Permission is hereby granted, dispose 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. - */ - -/* Json */ -/* JSON parser in C. */ - -#ifndef _DEFAULT_SOURCE -/* Bring strings.h definitions into string.h, where appropriate */ -#define _DEFAULT_SOURCE -#endif - -#ifndef _BSD_SOURCE -/* Bring strings.h definitions into string.h, where appropriate */ -#define _BSD_SOURCE -#endif - -#include "Json.h" -#include -#include -#include /* strtod (C89), strtof (C99) */ -#include /* strcasecmp (4.4BSD - compatibility), _stricmp (_WIN32) */ -#include - -#ifndef SPINE_JSON_DEBUG -/* Define this to do extra NULL and expected-character checking */ -#define SPINE_JSON_DEBUG 0 -#endif - -static const char* ep; - -const char* Json_getError (void) { - return ep; -} - -static int Json_strcasecmp (const char* s1, const char* s2) { - /* TODO we may be able to elide these NULL checks if we can prove - * the graph and input (only callsite is Json_getItem) should not have NULLs - */ - if (s1 && s2) { -#if defined(_WIN32) - return _stricmp(s1, s2); -#else - return strcasecmp( s1, s2 ); -#endif - } else { - if (s1 < s2) - return -1; /* s1 is null, s2 is not */ - else if (s1 == s2) - return 0; /* both are null */ - else - return 1; /* s2 is nul s1 is not */ - } -} - -/* Internal constructor. */ -static Json *Json_new (void) { - return (Json*)CALLOC(Json, 1); -} - -/* Delete a Json structure. */ -void Json_dispose (Json *c) { - Json *next; - while (c) { - next = c->next; - if (c->child) Json_dispose(c->child); - if (c->valueString) FREE(c->valueString); - if (c->name) FREE(c->name); - FREE(c); - c = next; - } -} - -/* Parse the input text to generate a number, and populate the result into item. */ -static const char* parse_number (Json *item, const char* num) { - double result = 0.0; - int negative = 0; - char* ptr = (char*)num; - - if (*ptr == '-') { - negative = -1; - ++ptr; - } - - while (*ptr >= '0' && *ptr <= '9') { - result = result * 10.0 + (*ptr - '0'); - ++ptr; - } - - if (*ptr == '.') { - double fraction = 0.0; - int n = 0; - ++ptr; - - while (*ptr >= '0' && *ptr <= '9') { - fraction = (fraction * 10.0) + (*ptr - '0'); - ++ptr; - ++n; - } - result += fraction / POW(10.0, n); - } - if (negative) result = -result; - - if (*ptr == 'e' || *ptr == 'E') { - double exponent = 0; - int expNegative = 0; - int n = 0; - ++ptr; - - if (*ptr == '-') { - expNegative = -1; - ++ptr; - } else if (*ptr == '+') { - ++ptr; - } - - while (*ptr >= '0' && *ptr <= '9') { - exponent = (exponent * 10.0) + (*ptr - '0'); - ++ptr; - ++n; - } - - if (expNegative) - result = result / POW(10, exponent); - else - result = result * POW(10, exponent); - } - - if (ptr != num) { - /* Parse success, number found. */ - item->valueFloat = result; - item->valueInt = (int)result; - item->type = Json_Number; - return ptr; - } else { - /* Parse failure, ep is set. */ - ep = num; - return 0; - } -} - -/* Parse the input text into an unescaped cstring, and populate item. */ -static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; -static const char* parse_string (Json *item, const char* str) { - const char* ptr = str + 1; - char* ptr2; - char* out; - int len = 0; - unsigned uc, uc2; - if (*str != '\"') { /* TODO: don't need this check when called from parse_value, but do need from parse_object */ - ep = str; - return 0; - } /* not a string! */ - - while (*ptr != '\"' && *ptr && ++len) - if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */ - - out = MALLOC(char, len + 1); /* The length needed for the string, roughly. */ - if (!out) return 0; - - ptr = str + 1; - ptr2 = out; - while (*ptr != '\"' && *ptr) { - if (*ptr != '\\') - *ptr2++ = *ptr++; - else { - ptr++; - switch (*ptr) { - case 'b': - *ptr2++ = '\b'; - break; - case 'f': - *ptr2++ = '\f'; - break; - case 'n': - *ptr2++ = '\n'; - break; - case 'r': - *ptr2++ = '\r'; - break; - case 't': - *ptr2++ = '\t'; - break; - case 'u': /* transcode utf16 to utf8. */ - sscanf(ptr + 1, "%4x", &uc); - ptr += 4; /* get the unicode char. */ - - if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) break; /* check for invalid. */ - - /* TODO provide an option to ignore surrogates, use unicode replacement character? */ - if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs. */ - { - if (ptr[1] != '\\' || ptr[2] != 'u') break; /* missing second-half of surrogate. */ - sscanf(ptr + 3, "%4x", &uc2); - ptr += 6; - if (uc2 < 0xDC00 || uc2 > 0xDFFF) break; /* invalid second-half of surrogate. */ - uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF)); - } - - len = 4; - if (uc < 0x80) - len = 1; - else if (uc < 0x800) - len = 2; - else if (uc < 0x10000) len = 3; - ptr2 += len; - - switch (len) { - case 4: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - /* fallthrough */ - case 3: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - /* fallthrough */ - case 2: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - /* fallthrough */ - case 1: - *--ptr2 = (uc | firstByteMark[len]); - } - ptr2 += len; - break; - default: - *ptr2++ = *ptr; - break; - } - ptr++; - } - } - *ptr2 = 0; - if (*ptr == '\"') ptr++; /* TODO error handling if not \" or \0 ? */ - item->valueString = out; - item->type = Json_String; - return ptr; -} - -/* Predeclare these prototypes. */ -static const char* parse_value (Json *item, const char* value); -static const char* parse_array (Json *item, const char* value); -static const char* parse_object (Json *item, const char* value); - -/* Utility to jump whitespace and cr/lf */ -static const char* skip (const char* in) { - if (!in) return 0; /* must propagate NULL since it's often called in skip(f(...)) form */ - while (*in && (unsigned char)*in <= 32) - in++; - return in; -} - -/* Parse an object - create a new root, and populate. */ -Json *Json_create (const char* value) { - Json *c; - ep = 0; - if (!value) return 0; /* only place we check for NULL other than skip() */ - c = Json_new(); - if (!c) return 0; /* memory fail */ - - value = parse_value(c, skip(value)); - if (!value) { - Json_dispose(c); - return 0; - } /* parse failure. ep is set. */ - - return c; -} - -/* Parser core - when encountering text, process appropriately. */ -static const char* parse_value (Json *item, const char* value) { - /* Referenced by Json_create(), parse_array(), and parse_object(). */ - /* Always called with the result of skip(). */ -#if SPINE_JSON_DEBUG /* Checked at entry to graph, Json_create, and after every parse_ call. */ - if (!value) return 0; /* Fail on null. */ -#endif - - switch (*value) { - case 'n': { - if (!strncmp(value + 1, "ull", 3)) { - item->type = Json_NULL; - return value + 4; - } - break; - } - case 'f': { - if (!strncmp(value + 1, "alse", 4)) { - item->type = Json_False; - /* calloc prevents us needing item->type = Json_False or valueInt = 0 here */ - return value + 5; - } - break; - } - case 't': { - if (!strncmp(value + 1, "rue", 3)) { - item->type = Json_True; - item->valueInt = 1; - return value + 4; - } - break; - } - case '\"': - return parse_string(item, value); - case '[': - return parse_array(item, value); - case '{': - return parse_object(item, value); - case '-': /* fallthrough */ - case '0': /* fallthrough */ - case '1': /* fallthrough */ - case '2': /* fallthrough */ - case '3': /* fallthrough */ - case '4': /* fallthrough */ - case '5': /* fallthrough */ - case '6': /* fallthrough */ - case '7': /* fallthrough */ - case '8': /* fallthrough */ - case '9': - return parse_number(item, value); - default: - break; - } - - ep = value; - return 0; /* failure. */ -} - -/* Build an array from input text. */ -static const char* parse_array (Json *item, const char* value) { - Json *child; - -#if SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ - if (*value != '[') { - ep = value; - return 0; - } /* not an array! */ -#endif - - item->type = Json_Array; - value = skip(value + 1); - if (*value == ']') return value + 1; /* empty array. */ - - item->child = child = Json_new(); - if (!item->child) return 0; /* memory fail */ - value = skip(parse_value(child, skip(value))); /* skip any spacing, get the value. */ - if (!value) return 0; - item->size = 1; - - while (*value == ',') { - Json *new_item = Json_new(); - if (!new_item) return 0; /* memory fail */ - child->next = new_item; -#if SPINE_JSON_HAVE_PREV - new_item->prev = child; -#endif - child = new_item; - value = skip(parse_value(child, skip(value + 1))); - if (!value) return 0; /* parse fail */ - item->size++; - } - - if (*value == ']') return value + 1; /* end of array */ - ep = value; - return 0; /* malformed. */ -} - -/* Build an object from the text. */ -static const char* parse_object (Json *item, const char* value) { - Json *child; - -#if SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ - if (*value != '{') { - ep = value; - return 0; - } /* not an object! */ -#endif - - item->type = Json_Object; - value = skip(value + 1); - if (*value == '}') return value + 1; /* empty array. */ - - item->child = child = Json_new(); - if (!item->child) return 0; - value = skip(parse_string(child, skip(value))); - if (!value) return 0; - child->name = child->valueString; - child->valueString = 0; - if (*value != ':') { - ep = value; - return 0; - } /* fail! */ - value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ - if (!value) return 0; - item->size = 1; - - while (*value == ',') { - Json *new_item = Json_new(); - if (!new_item) return 0; /* memory fail */ - child->next = new_item; -#if SPINE_JSON_HAVE_PREV - new_item->prev = child; -#endif - child = new_item; - value = skip(parse_string(child, skip(value + 1))); - if (!value) return 0; - child->name = child->valueString; - child->valueString = 0; - if (*value != ':') { - ep = value; - return 0; - } /* fail! */ - value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ - if (!value) return 0; - item->size++; - } - - if (*value == '}') return value + 1; /* end of array */ - ep = value; - return 0; /* malformed. */ -} - -Json *Json_getItem (Json *object, const char* string) { - Json *c = object->child; - while (c && Json_strcasecmp(c->name, string)) - c = c->next; - return c; -} - -const char* Json_getString (Json* object, const char* name, const char* defaultValue) { - object = Json_getItem(object, name); - if (object) return object->valueString; - return defaultValue; -} - -float Json_getFloat (Json* value, const char* name, float defaultValue) { - value = Json_getItem(value, name); - return value ? value->valueFloat : defaultValue; -} - -int Json_getInt (Json* value, const char* name, int defaultValue) { - value = Json_getItem(value, name); - return value ? value->valueInt : defaultValue; -} diff --git a/cocos/editor-support/spine/Json.cpp b/cocos/editor-support/spine/Json.cpp new file mode 100644 index 00000000000..1b71ce8e277 --- /dev/null +++ b/cocos/editor-support/spine/Json.cpp @@ -0,0 +1,544 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +/* Json */ +/* JSON parser in CPP, shamelessly ripped from json.c in the spine-c runtime */ + +#ifndef _DEFAULT_SOURCE +/* Bring strings.h definitions into string.h, where appropriate */ +#define _DEFAULT_SOURCE +#endif + +#ifndef _BSD_SOURCE +/* Bring strings.h definitions into string.h, where appropriate */ +#define _BSD_SOURCE +#endif + +#include +#include +#include + +#include +#include + +using namespace spine; + +const int Json::JSON_FALSE = 0; +const int Json::JSON_TRUE = 1; +const int Json::JSON_NULL = 2; +const int Json::JSON_NUMBER = 3; +const int Json::JSON_STRING = 4; +const int Json::JSON_ARRAY = 5; +const int Json::JSON_OBJECT = 6; + +const char *Json::_error = NULL; + +Json *Json::getItem(Json *object, const char *string) { + Json *c = object->_child; + while (c && json_strcasecmp(c->_name, string)) { + c = c->_next; + } + return c; +} + +const char *Json::getString(Json *object, const char *name, const char *defaultValue) { + object = getItem(object, name); + if (object) { + return object->_valueString; + } + + return defaultValue; +} + +float Json::getFloat(Json *value, const char *name, float defaultValue) { + value = getItem(value, name); + return value ? value->_valueFloat : defaultValue; +} + +int Json::getInt(Json *value, const char *name, int defaultValue) { + value = getItem(value, name); + return value ? value->_valueInt : defaultValue; +} + +const char *Json::getError() { + return _error; +} + +Json::Json(const char *value) : + _next(NULL), +#if SPINE_JSON_HAVE_PREV + _prev(NULL), +#endif + _child(NULL), + _type(0), + _size(0), + _valueString(NULL), + _valueInt(0), + _valueFloat(0), + _name(NULL) { + if (value) { + value = parseValue(this, skip(value)); + + assert(value); + } +} + +Json::~Json() { + delete _child; + + if (_valueString) { + SpineExtension::free(_valueString, __FILE__, __LINE__); + } + + if (_name) { + SpineExtension::free(_name, __FILE__, __LINE__); + } + + delete _next; +} + +const char *Json::skip(const char *inValue) { + if (!inValue) { + /* must propagate NULL since it's often called in skip(f(...)) form */ + return NULL; + } + + while (*inValue && (unsigned char) *inValue <= 32) { + inValue++; + } + + return inValue; +} + +const char *Json::parseValue(Json *item, const char *value) { + /* Referenced by constructor, parseArray(), and parseObject(). */ + /* Always called with the result of skip(). */ +#ifdef SPINE_JSON_DEBUG /* Checked at entry to graph, constructor, and after every parse call. */ + if (!value) { + /* Fail on null. */ + return NULL; + } +#endif + + switch (*value) { + case 'n': { + if (!strncmp(value + 1, "ull", 3)) { + item->_type = JSON_NULL; + return value + 4; + } + break; + } + case 'f': { + if (!strncmp(value + 1, "alse", 4)) { + item->_type = JSON_FALSE; + /* calloc prevents us needing item->_type = JSON_FALSE or valueInt = 0 here */ + return value + 5; + } + break; + } + case 't': { + if (!strncmp(value + 1, "rue", 3)) { + item->_type = JSON_TRUE; + item->_valueInt = 1; + return value + 4; + } + break; + } + case '\"': + return parseString(item, value); + case '[': + return parseArray(item, value); + case '{': + return parseObject(item, value); + case '-': /* fallthrough */ + case '0': /* fallthrough */ + case '1': /* fallthrough */ + case '2': /* fallthrough */ + case '3': /* fallthrough */ + case '4': /* fallthrough */ + case '5': /* fallthrough */ + case '6': /* fallthrough */ + case '7': /* fallthrough */ + case '8': /* fallthrough */ + case '9': + return parseNumber(item, value); + default: + break; + } + + _error = value; + return NULL; /* failure. */ +} + +static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; + +const char *Json::parseString(Json *item, const char *str) { + const char *ptr = str + 1; + char *ptr2; + char *out; + int len = 0; + unsigned uc, uc2; + if (*str != '\"') { + /* TODO: don't need this check when called from parseValue, but do need from parseObject */ + _error = str; + return 0; + } /* not a string! */ + + while (*ptr != '\"' && *ptr && ++len) { + if (*ptr++ == '\\') { + ptr++; /* Skip escaped quotes. */ + } + } + + out = SpineExtension::alloc(len + 1, __FILE__, __LINE__); /* The length needed for the string, roughly. */ + if (!out) { + return 0; + } + + ptr = str + 1; + ptr2 = out; + while (*ptr != '\"' && *ptr) { + if (*ptr != '\\') { + *ptr2++ = *ptr++; + } else { + ptr++; + switch (*ptr) { + case 'b': + *ptr2++ = '\b'; + break; + case 'f': + *ptr2++ = '\f'; + break; + case 'n': + *ptr2++ = '\n'; + break; + case 'r': + *ptr2++ = '\r'; + break; + case 't': + *ptr2++ = '\t'; + break; + case 'u': { + /* transcode utf16 to utf8. */ + sscanf(ptr + 1, "%4x", &uc); + ptr += 4; /* get the unicode char. */ + + if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) { + break; /* check for invalid. */ + } + + /* TODO provide an option to ignore surrogates, use unicode replacement character? */ + if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs. */ { + if (ptr[1] != '\\' || ptr[2] != 'u') { + break; /* missing second-half of surrogate. */ + } + sscanf(ptr + 3, "%4x", &uc2); + ptr += 6; + if (uc2 < 0xDC00 || uc2 > 0xDFFF) { + break; /* invalid second-half of surrogate. */ + } + uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF)); + } + + len = 4; + if (uc < 0x80) { + len = 1; + } else if (uc < 0x800) { + len = 2; + } else if (uc < 0x10000) { + len = 3; + } + ptr2 += len; + + switch (len) { + case 4: + *--ptr2 = ((uc | 0x80) & 0xBF); + uc >>= 6; + /* fallthrough */ + case 3: + *--ptr2 = ((uc | 0x80) & 0xBF); + uc >>= 6; + /* fallthrough */ + case 2: + *--ptr2 = ((uc | 0x80) & 0xBF); + uc >>= 6; + /* fallthrough */ + case 1: + *--ptr2 = (uc | firstByteMark[len]); + } + ptr2 += len; + break; + } + default: + *ptr2++ = *ptr; + break; + } + ptr++; + } + } + + *ptr2 = 0; + + if (*ptr == '\"') { + ptr++; /* TODO error handling if not \" or \0 ? */ + } + + item->_valueString = out; + item->_type = JSON_STRING; + + return ptr; +} + +const char *Json::parseNumber(Json *item, const char *num) { + double result = 0.0; + int negative = 0; + char *ptr = (char *) num; + + if (*ptr == '-') { + negative = -1; + ++ptr; + } + + while (*ptr >= '0' && *ptr <= '9') { + result = result * 10.0 + (*ptr - '0'); + ++ptr; + } + + if (*ptr == '.') { + double fraction = 0.0; + int n = 0; + ++ptr; + + while (*ptr >= '0' && *ptr <= '9') { + fraction = (fraction * 10.0) + (*ptr - '0'); + ++ptr; + ++n; + } + result += fraction / pow(10.0, n); + } + + if (negative) { + result = -result; + } + + if (*ptr == 'e' || *ptr == 'E') { + double exponent = 0; + int expNegative = 0; + int n = 0; + ++ptr; + + if (*ptr == '-') { + expNegative = -1; + ++ptr; + } else if (*ptr == '+') { + ++ptr; + } + + while (*ptr >= '0' && *ptr <= '9') { + exponent = (exponent * 10.0) + (*ptr - '0'); + ++ptr; + ++n; + } + + if (expNegative) { + result = result / pow(10, exponent); + } else { + result = result * pow(10, exponent); + } + } + + if (ptr != num) { + /* Parse success, number found. */ + item->_valueFloat = (float)result; + item->_valueInt = (int)result; + item->_type = JSON_NUMBER; + return ptr; + } else { + /* Parse failure, _error is set. */ + _error = num; + return NULL; + } +} + +const char *Json::parseArray(Json *item, const char *value) { + Json *child; + +#ifdef SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ + if (*value != '[') { + ep = value; + return 0; + } /* not an array! */ +#endif + + item->_type = JSON_ARRAY; + value = skip(value + 1); + if (*value == ']') { + return value + 1; /* empty array. */ + } + + item->_child = child = new(__FILE__, __LINE__) Json(NULL); + if (!item->_child) { + return NULL; /* memory fail */ + } + + value = skip(parseValue(child, skip(value))); /* skip any spacing, get the value. */ + + if (!value) { + return NULL; + } + + item->_size = 1; + + while (*value == ',') { + Json *new_item = new(__FILE__, __LINE__) Json(NULL); + if (!new_item) { + return NULL; /* memory fail */ + } + child->_next = new_item; +#if SPINE_JSON_HAVE_PREV + new_item->prev = child; +#endif + child = new_item; + value = skip(parseValue(child, skip(value + 1))); + if (!value) { + return NULL; /* parse fail */ + } + item->_size++; + } + + if (*value == ']') { + return value + 1; /* end of array */ + } + + _error = value; + + return NULL; /* malformed. */ +} + +/* Build an object from the text. */ +const char *Json::parseObject(Json *item, const char *value) { + Json *child; + +#ifdef SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ + if (*value != '{') { + ep = value; + return 0; + } /* not an object! */ +#endif + + item->_type = JSON_OBJECT; + value = skip(value + 1); + if (*value == '}') { + return value + 1; /* empty array. */ + } + + item->_child = child = new(__FILE__, __LINE__) Json(NULL); + if (!item->_child) { + return NULL; + } + value = skip(parseString(child, skip(value))); + if (!value) { + return NULL; + } + child->_name = child->_valueString; + child->_valueString = 0; + if (*value != ':') { + _error = value; + return NULL; + } /* fail! */ + + value = skip(parseValue(child, skip(value + 1))); /* skip any spacing, get the value. */ + if (!value) { + return NULL; + } + + item->_size = 1; + + while (*value == ',') { + Json *new_item = new(__FILE__, __LINE__) Json(NULL); + if (!new_item) { + return NULL; /* memory fail */ + } + child->_next = new_item; +#if SPINE_JSON_HAVE_PREV + new_item->prev = child; +#endif + child = new_item; + value = skip(parseString(child, skip(value + 1))); + if (!value) { + return NULL; + } + child->_name = child->_valueString; + child->_valueString = 0; + if (*value != ':') { + _error = value; + return NULL; + } /* fail! */ + + value = skip(parseValue(child, skip(value + 1))); /* skip any spacing, get the value. */ + if (!value) { + return NULL; + } + item->_size++; + } + + if (*value == '}') { + return value + 1; /* end of array */ + } + + _error = value; + + return NULL; /* malformed. */ +} + +int Json::json_strcasecmp(const char *s1, const char *s2) { + /* TODO we may be able to elide these NULL checks if we can prove + * the graph and input (only callsite is Json_getItem) should not have NULLs + */ + if (s1 && s2) { +#if defined(_WIN32) + return _stricmp(s1, s2); +#else + return strcasecmp(s1, s2); +#endif + } else { + if (s1 < s2) { + return -1; /* s1 is null, s2 is not */ + } else if (s1 == s2) { + return 0; /* both are null */ + } else { + return 1; /* s2 is nul s1 is not */ + } + } +} diff --git a/cocos/editor-support/spine/Json.h b/cocos/editor-support/spine/Json.h index 078a5a71582..31d003d70bf 100644 --- a/cocos/editor-support/spine/Json.h +++ b/cocos/editor-support/spine/Json.h @@ -1,83 +1,114 @@ -/* - Copyright (c) 2009 Dave Gamble - - Permission is hereby granted, dispose 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. - */ - -/* Esoteric Software: Removed everything except parsing, shorter method names, more get methods, double to float, formatted. */ - -#ifndef SPINE_JSON_H_ -#define SPINE_JSON_H_ - -#ifdef __cplusplus -extern "C" { -#endif +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Json_h +#define Spine_Json_h -/* Json Types: */ -#define Json_False 0 -#define Json_True 1 -#define Json_NULL 2 -#define Json_Number 3 -#define Json_String 4 -#define Json_Array 5 -#define Json_Object 6 +#include #ifndef SPINE_JSON_HAVE_PREV -/* Spine doesn't use the "prev" link in the Json sibling lists. */ +/* spine doesn't use the "prev" link in the Json sibling lists. */ #define SPINE_JSON_HAVE_PREV 0 #endif -/* The Json structure: */ -typedef struct Json { - struct Json* next; +namespace spine { +class SP_API Json : public SpineObject { + friend class SkeletonJson; + +public: + /* Json Types: */ + static const int JSON_FALSE; + static const int JSON_TRUE; + static const int JSON_NULL; + static const int JSON_NUMBER; + static const int JSON_STRING; + static const int JSON_ARRAY; + static const int JSON_OBJECT; + + /* Get item "string" from object. Case insensitive. */ + static Json *getItem(Json *object, const char *string); + + static const char *getString(Json *object, const char *name, const char *defaultValue); + + static float getFloat(Json *object, const char *name, float defaultValue); + + static int getInt(Json *object, const char *name, int defaultValue); + + /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when Json_create() returns 0. 0 when Json_create() succeeds. */ + static const char *getError(); + + /* Supply a block of JSON, and this returns a Json object you can interrogate. Call Json_dispose when finished. */ + explicit Json(const char *value); + + ~Json(); + + + +private: + static const char *_error; + + Json *_next; #if SPINE_JSON_HAVE_PREV - struct Json* prev; /* next/prev allow you to walk array/object chains. Alternatively, use getSize/getItem */ + Json* _prev; /* next/prev allow you to walk array/object chains. Alternatively, use getSize/getItem */ #endif - struct Json* child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + Json *_child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + + int _type; /* The type of the item, as above. */ + int _size; /* The number of children. */ - int type; /* The type of the item, as above. */ - int size; /* The number of children. */ + const char *_valueString; /* The item's string, if type==JSON_STRING */ + int _valueInt; /* The item's number, if type==JSON_NUMBER */ + float _valueFloat; /* The item's number, if type==JSON_NUMBER */ - const char* valueString; /* The item's string, if type==Json_String */ - int valueInt; /* The item's number, if type==Json_Number */ - float valueFloat; /* The item's number, if type==Json_Number */ + const char *_name; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ - const char* name; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ -} Json; + /* Utility to jump whitespace and cr/lf */ + static const char *skip(const char *inValue); -/* Supply a block of JSON, and this returns a Json object you can interrogate. Call Json_dispose when finished. */ -Json* Json_create (const char* value); + /* Parser core - when encountering text, process appropriately. */ + static const char *parseValue(Json *item, const char *value); -/* Delete a Json entity and all subentities. */ -void Json_dispose (Json* json); + /* Parse the input text into an unescaped cstring, and populate item. */ + static const char *parseString(Json *item, const char *str); -/* Get item "string" from object. Case insensitive. */ -Json* Json_getItem (Json* json, const char* string); -const char* Json_getString (Json* json, const char* name, const char* defaultValue); -float Json_getFloat (Json* json, const char* name, float defaultValue); -int Json_getInt (Json* json, const char* name, int defaultValue); + /* Parse the input text to generate a number, and populate the result into item. */ + static const char *parseNumber(Json *item, const char *num); -/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when Json_create() returns 0. 0 when Json_create() succeeds. */ -const char* Json_getError (void); + /* Build an array from input text. */ + static const char *parseArray(Json *item, const char *value); -#ifdef __cplusplus + /* Build an object from the text. */ + static const char *parseObject(Json *item, const char *value); + + static int json_strcasecmp(const char *s1, const char *s2); +}; } -#endif -#endif /* SPINE_JSON_H_ */ +#endif /* Spine_Json_h */ diff --git a/cocos/editor-support/spine/LinkedMesh.cpp b/cocos/editor-support/spine/LinkedMesh.cpp new file mode 100644 index 00000000000..ee07057e581 --- /dev/null +++ b/cocos/editor-support/spine/LinkedMesh.cpp @@ -0,0 +1,46 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, size_t slotIndex, const String &parent) : + _mesh(mesh), + _skin(skin), + _slotIndex(slotIndex), + _parent(parent) { +} diff --git a/cocos/editor-support/spine/LinkedMesh.h b/cocos/editor-support/spine/LinkedMesh.h new file mode 100644 index 00000000000..b2086ac1864 --- /dev/null +++ b/cocos/editor-support/spine/LinkedMesh.h @@ -0,0 +1,56 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_LinkedMesh_h +#define Spine_LinkedMesh_h + +#include +#include + +namespace spine { +class MeshAttachment; + +class SP_API LinkedMesh : public SpineObject { + friend class SkeletonBinary; + + friend class SkeletonJson; + +public: + LinkedMesh(MeshAttachment *mesh, const String &skin, size_t slotIndex, const String &parent); + +private: + MeshAttachment *_mesh; + String _skin; + size_t _slotIndex; + String _parent; +}; +} + +#endif /* Spine_LinkedMesh_h */ diff --git a/cocos/editor-support/spine/MathUtil.cpp b/cocos/editor-support/spine/MathUtil.cpp new file mode 100644 index 00000000000..4304f9d17cb --- /dev/null +++ b/cocos/editor-support/spine/MathUtil.cpp @@ -0,0 +1,129 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include +#include + +// Required for division by 0 in _isNaN on MSVC +#ifdef _MSC_VER +#pragma warning(disable:4723) +#endif + +using namespace spine; + +const float MathUtil::Pi = 3.1415926535897932385f; +const float MathUtil::Pi_2 = 3.1415926535897932385f * 2; +const float MathUtil::Deg_Rad = (3.1415926535897932385f / 180.0f); +const float MathUtil::Rad_Deg = (180.0f / 3.1415926535897932385f); + +float MathUtil::abs(float v) { + return ((v) < 0 ? -(v) : (v)); +} + +float MathUtil::sign(float v) { + return ((v) < 0 ? -1.0f : (v) > 0 ? 1.0f : 0.0f); +} + +float MathUtil::clamp(float x, float min, float max) { + return ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))); +} + +float MathUtil::fmod(float a, float b) { + return (float)::fmod(a, b); +} + +/// Returns atan2 in radians, faster but less accurate than Math.Atan2. Average error of 0.00231 radians (0.1323 +/// degrees), largest error of 0.00488 radians (0.2796 degrees). +float MathUtil::atan2(float y, float x) { + return (float)::atan2(y, x); +} + +/// Returns the cosine in radians from a lookup table. +float MathUtil::cos(float radians) { + return (float)::cos(radians); +} + +/// Returns the sine in radians from a lookup table. +float MathUtil::sin(float radians) { + return (float)::sin(radians); +} + +float MathUtil::sqrt(float v) { + return (float)::sqrt(v); +} + +float MathUtil::acos(float v) { + return (float)::acos(v); +} + +/// Returns the sine in radians from a lookup table. +float MathUtil::sinDeg(float degrees) { + return (float)::sin(degrees * MathUtil::Deg_Rad); +} + +/// Returns the cosine in radians from a lookup table. +float MathUtil::cosDeg(float degrees) { + return (float)::cos(degrees * MathUtil::Deg_Rad); +} + +/* Need to pass 0 as an argument, so VC++ doesn't error with C2124 */ +static bool _isNan(float value, float zero) { + float _nan = (float) 0.0 / zero; + return 0 == memcmp((void *) &value, (void *) &_nan, sizeof(value)); +} + +bool MathUtil::isNan(float v) { + return _isNan(v, 0); +} + +float MathUtil::random() { + return ::rand() / (float)RAND_MAX; +} + +float MathUtil::randomTriangular(float min, float max) { + return randomTriangular(min, max, (min + max) * 0.5f); +} + +float MathUtil::randomTriangular(float min, float max, float mode) { + float u = random(); + float d = max - min; + if (u <= (mode - min) / d) return min + sqrt(u * d * (mode - min)); + return max - sqrt((1 - u) * d * (max - mode)); +} + +float MathUtil::pow(float a, float b) { + return (float)::pow(a, b); +} diff --git a/cocos/editor-support/spine/MathUtil.h b/cocos/editor-support/spine/MathUtil.h new file mode 100644 index 00000000000..44522d5a510 --- /dev/null +++ b/cocos/editor-support/spine/MathUtil.h @@ -0,0 +1,130 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_MathUtil_h +#define Spine_MathUtil_h + +#include + +#include + +namespace spine { + +class SP_API MathUtil : public SpineObject { +private: + MathUtil(); + +public: + static const float Pi; + static const float Pi_2; + static const float Deg_Rad; + static const float Rad_Deg; + + template + static inline T min(T a, T b) { return a < b ? a : b; } + + template + static inline T max(T a, T b) { return a > b ? a : b; } + + static float sign(float val); + + static float clamp(float x, float lower, float upper); + + static float abs(float v); + + /// Returns the sine in radians from a lookup table. + static float sin(float radians); + + /// Returns the cosine in radians from a lookup table. + static float cos(float radians); + + /// Returns the sine in radians from a lookup table. + static float sinDeg(float degrees); + + /// Returns the cosine in radians from a lookup table. + static float cosDeg(float degrees); + + /// Returns atan2 in radians, faster but less accurate than Math.Atan2. Average error of 0.00231 radians (0.1323 + /// degrees), largest error of 0.00488 radians (0.2796 degrees). + static float atan2(float y, float x); + + static float acos(float v); + + static float sqrt(float v); + + static float fmod(float a, float b); + + static bool isNan(float v); + + static float random(); + + static float randomTriangular(float min, float max); + + static float randomTriangular(float min, float max, float mode); + + static float pow(float a, float b); +}; + +struct SP_API Interpolation { + virtual float apply(float a) = 0; + + virtual float interpolate(float start, float end, float a) { + return start + (end - start) * apply(a); + } + + virtual ~Interpolation() {}; +}; + +struct SP_API PowInterpolation: public Interpolation { + PowInterpolation(int power): power(power) { + } + + float apply(float a) { + if (a <= 0.5f) return MathUtil::pow(a * 2.0f, (float)power) / 2.0f; + return MathUtil::pow((a - 1.0f) * 2.0f, (float)power) / (power % 2 == 0 ? -2.0f : 2.0f) + 1.0f; + } + + int power; +}; + +struct SP_API PowOutInterpolation: public Interpolation { + PowOutInterpolation(int power): power(power) { + } + + float apply(float a) { + return MathUtil::pow(a - 1, (float)power) * (power % 2 == 0 ? -1.0f : 1.0f) + 1.0f; + } + + int power; +}; + +} + +#endif /* Spine_MathUtil_h */ diff --git a/cocos/editor-support/spine/MeshAttachment.c b/cocos/editor-support/spine/MeshAttachment.c deleted file mode 100644 index b7a49bfdcec..00000000000 --- a/cocos/editor-support/spine/MeshAttachment.c +++ /dev/null @@ -1,100 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -void _spMeshAttachment_dispose (spAttachment* attachment) { - spMeshAttachment* self = SUB_CAST(spMeshAttachment, attachment); - FREE(self->path); - FREE(self->uvs); - if (!self->parentMesh) { - _spVertexAttachment_deinit(SUPER(self)); - FREE(self->regionUVs); - FREE(self->triangles); - FREE(self->edges); - } else - _spAttachment_deinit(attachment); - FREE(self); -} - -spMeshAttachment* spMeshAttachment_create (const char* name) { - spMeshAttachment* self = NEW(spMeshAttachment); - _spVertexAttachment_init(SUPER(self)); - spColor_setFromFloats(&self->color, 1, 1, 1, 1); - _spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_MESH, _spMeshAttachment_dispose); - return self; -} - -void spMeshAttachment_updateUVs (spMeshAttachment* self) { - int i; - float width = self->regionU2 - self->regionU, height = self->regionV2 - self->regionV; - int verticesLength = SUPER(self)->worldVerticesLength; - FREE(self->uvs); - self->uvs = MALLOC(float, verticesLength); - if (self->regionRotate) { - for (i = 0; i < verticesLength; i += 2) { - self->uvs[i] = self->regionU + self->regionUVs[i + 1] * width; - self->uvs[i + 1] = self->regionV + height - self->regionUVs[i] * height; - } - } else { - for (i = 0; i < verticesLength; i += 2) { - self->uvs[i] = self->regionU + self->regionUVs[i] * width; - self->uvs[i + 1] = self->regionV + self->regionUVs[i + 1] * height; - } - } -} - -void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh) { - CONST_CAST(spMeshAttachment*, self->parentMesh) = parentMesh; - if (parentMesh) { - - self->super.bones = parentMesh->super.bones; - self->super.bonesCount = parentMesh->super.bonesCount; - - self->super.vertices = parentMesh->super.vertices; - self->super.verticesCount = parentMesh->super.verticesCount; - - self->regionUVs = parentMesh->regionUVs; - - self->triangles = parentMesh->triangles; - self->trianglesCount = parentMesh->trianglesCount; - - self->hullLength = parentMesh->hullLength; - - self->super.worldVerticesLength = parentMesh->super.worldVerticesLength; - - self->edges = parentMesh->edges; - self->edgesCount = parentMesh->edgesCount; - - self->width = parentMesh->width; - self->height = parentMesh->height; - } -} diff --git a/cocos/editor-support/spine/MeshAttachment.cpp b/cocos/editor-support/spine/MeshAttachment.cpp new file mode 100644 index 00000000000..90582109442 --- /dev/null +++ b/cocos/editor-support/spine/MeshAttachment.cpp @@ -0,0 +1,264 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include + +using namespace spine; + +RTTI_IMPL(MeshAttachment, VertexAttachment) + +MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), HasRendererObject(), + _regionOffsetX(0), + _regionOffsetY(0), + _regionWidth(0), + _regionHeight(0), + _regionOriginalWidth(0), + _regionOriginalHeight(0), + _parentMesh(NULL), + _path(), + _regionU(0), + _regionV(0), + _regionU2(0), + _regionV2(0), + _width(0), + _height(0), + _color(1, 1, 1, 1), + _hullLength(0), + _inheritDeform(false), + _regionRotate(false) { +} + +MeshAttachment::~MeshAttachment() {} + +void MeshAttachment::updateUVs() { + if (_uvs.size() != _regionUVs.size()) { + _uvs.setSize(_regionUVs.size(), 0); + } + + if (_regionRotate) { + float textureHeight = _regionWidth / (_regionV2 - _regionV); + float textureWidth = _regionHeight / (_regionU2 - _regionU); + float u = _regionU - (_regionOriginalHeight - _regionOffsetY - _regionHeight) / textureWidth; + float v = _regionV - (_regionOriginalWidth - _regionOffsetX - _regionWidth) / textureHeight; + float width = _regionOriginalHeight / textureWidth; + float height = _regionOriginalWidth / textureHeight; + for (size_t i = 0, n = _uvs.size(); i < n; i += 2) { + _uvs[i] = u + _regionUVs[i + 1] * width; + _uvs[i + 1] = v + height - _regionUVs[i] * height; + } + } else { + float textureWidth = _regionWidth / (_regionU2 - _regionU); + float textureHeight = _regionHeight / (_regionV2 - _regionV); + float u = _regionU - _regionOffsetX / textureWidth; + float v = _regionV - (_regionOriginalHeight - _regionOffsetY - _regionHeight) / textureHeight; + float width = _regionOriginalWidth / textureWidth; + float height = _regionOriginalHeight / textureHeight; + for (size_t i = 0, n = _uvs.size(); i < n; i += 2) { + _uvs[i] = u + _regionUVs[i] * width; + _uvs[i + 1] = v + _regionUVs[i + 1] * height; + } + } +} + +bool MeshAttachment::applyDeform(VertexAttachment *sourceAttachment) { + return this == sourceAttachment || (_inheritDeform && _parentMesh == sourceAttachment); +} + +int MeshAttachment::getHullLength() { + return _hullLength; +} + +void MeshAttachment::setHullLength(int inValue) { + _hullLength = inValue; +} + +Vector &MeshAttachment::getRegionUVs() { + return _regionUVs; +} + +Vector &MeshAttachment::getUVs() { + return _uvs; +} + +Vector &MeshAttachment::getTriangles() { + return _triangles; +} + +const String &MeshAttachment::getPath() { + return _path; +} + +void MeshAttachment::setPath(const String &inValue) { + _path = inValue; +} + +float MeshAttachment::getRegionU() { + return _regionU; +} + +void MeshAttachment::setRegionU(float inValue) { + _regionU = inValue; +} + +float MeshAttachment::getRegionV() { + return _regionV; +} + +void MeshAttachment::setRegionV(float inValue) { + _regionV = inValue; +} + +float MeshAttachment::getRegionU2() { + return _regionU2; +} + +void MeshAttachment::setRegionU2(float inValue) { + _regionU2 = inValue; +} + +float MeshAttachment::getRegionV2() { + return _regionV2; +} + +void MeshAttachment::setRegionV2(float inValue) { + _regionV2 = inValue; +} + +bool MeshAttachment::getRegionRotate() { + return _regionRotate; +} + +void MeshAttachment::setRegionRotate(bool inValue) { + _regionRotate = inValue; +} + +float MeshAttachment::getRegionOffsetX() { + return _regionOffsetX; +} + +void MeshAttachment::setRegionOffsetX(float inValue) { + _regionOffsetX = inValue; +} + +float MeshAttachment::getRegionOffsetY() { + return _regionOffsetY; +} + +void MeshAttachment::setRegionOffsetY(float inValue) { + _regionOffsetY = inValue; +} + +float MeshAttachment::getRegionWidth() { + return _regionWidth; +} + +void MeshAttachment::setRegionWidth(float inValue) { + _regionWidth = inValue; +} + +float MeshAttachment::getRegionHeight() { + return _regionHeight; +} + +void MeshAttachment::setRegionHeight(float inValue) { + _regionHeight = inValue; +} + +float MeshAttachment::getRegionOriginalWidth() { + return _regionOriginalWidth; +} + +void MeshAttachment::setRegionOriginalWidth(float inValue) { + _regionOriginalWidth = inValue; +} + +float MeshAttachment::getRegionOriginalHeight() { + return _regionOriginalHeight; +} + +void MeshAttachment::setRegionOriginalHeight(float inValue) { + _regionOriginalHeight = inValue; +} + +bool MeshAttachment::getInheritDeform() { + return _inheritDeform; +} + +void MeshAttachment::setInheritDeform(bool inValue) { + _inheritDeform = inValue; +} + +MeshAttachment *MeshAttachment::getParentMesh() { + return _parentMesh; +} + +void MeshAttachment::setParentMesh(MeshAttachment *inValue) { + _parentMesh = inValue; + if (inValue != NULL) { + _bones.clearAndAddAll(inValue->_bones); + _vertices.clearAndAddAll(inValue->_vertices); + _worldVerticesLength = inValue->_worldVerticesLength; + _regionUVs.clearAndAddAll(inValue->_regionUVs); + _triangles.clearAndAddAll(inValue->_triangles); + _hullLength = inValue->_hullLength; + _edges.clearAndAddAll(inValue->_edges); + _width = inValue->_width; + _height = inValue->_height; + } +} + +Vector &MeshAttachment::getEdges() { + return _edges; +} + +float MeshAttachment::getWidth() { + return _width; +} + +void MeshAttachment::setWidth(float inValue) { + _width = inValue; +} + +float MeshAttachment::getHeight() { + return _height; +} + +void MeshAttachment::setHeight(float inValue) { + _height = inValue; +} + +spine::Color &MeshAttachment::getColor() { + return _color; +} diff --git a/cocos/editor-support/spine/MeshAttachment.h b/cocos/editor-support/spine/MeshAttachment.h index 2876abfd560..8f42c5518bf 100644 --- a/cocos/editor-support/spine/MeshAttachment.h +++ b/cocos/editor-support/spine/MeshAttachment.h @@ -1,91 +1,142 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_MESHATTACHMENT_H_ -#define SPINE_MESHATTACHMENT_H_ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spMeshAttachment spMeshAttachment; -struct spMeshAttachment { - spVertexAttachment super; - - void* rendererObject; - int regionOffsetX, regionOffsetY; /* Pixels stripped from the bottom left, unrotated. */ - int regionWidth, regionHeight; /* Unrotated, stripped pixel size. */ - int regionOriginalWidth, regionOriginalHeight; /* Unrotated, unstripped pixel size. */ - float regionU, regionV, regionU2, regionV2; - int/*bool*/regionRotate; - - const char* path; - - float* regionUVs; - float* uvs; - - int trianglesCount; - unsigned short* triangles; - - spColor color; - - int hullLength; - - spMeshAttachment* const parentMesh; - int/*bool*/inheritDeform; - - /* Nonessential. */ - int edgesCount; - int* edges; - float width, height; -}; - -SP_API spMeshAttachment* spMeshAttachment_create (const char* name); -SP_API void spMeshAttachment_updateUVs (spMeshAttachment* self); -SP_API void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh); - -#ifdef SPINE_SHORT_NAMES -typedef spMeshAttachment MeshAttachment; -#define MeshAttachment_create(...) spMeshAttachment_create(__VA_ARGS__) -#define MeshAttachment_updateUVs(...) spMeshAttachment_updateUVs(__VA_ARGS__) -#define MeshAttachment_setParentMesh(...) spMeshAttachment_setParentMesh(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_MESHATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_MeshAttachment_h +#define Spine_MeshAttachment_h + +#include +#include +#include +#include + +namespace spine { + /// Attachment that displays a texture region using a mesh. + class SP_API MeshAttachment : public VertexAttachment, public HasRendererObject { + friend class SkeletonBinary; + friend class SkeletonJson; + friend class AtlasAttachmentLoader; + + RTTI_DECL + + public: + explicit MeshAttachment(const String& name); + + virtual ~MeshAttachment(); + + void updateUVs(); + + virtual bool applyDeform(VertexAttachment* sourceAttachment); + + int getHullLength(); + void setHullLength(int inValue); + + Vector& getRegionUVs(); + + /// The UV pair for each vertex, normalized within the entire texture. See also MeshAttachment::updateUVs + Vector& getUVs(); + + Vector& getTriangles(); + + Color& getColor(); + + const String& getPath(); + void setPath(const String& inValue); + + float getRegionU(); + void setRegionU(float inValue); + + float getRegionV(); + void setRegionV(float inValue); + + float getRegionU2(); + void setRegionU2(float inValue); + + float getRegionV2(); + void setRegionV2(float inValue); + + bool getRegionRotate(); + void setRegionRotate(bool inValue); + + float getRegionOffsetX(); + void setRegionOffsetX(float inValue); + + // Pixels stripped from the bottom left, unrotated. + float getRegionOffsetY(); + void setRegionOffsetY(float inValue); + + float getRegionWidth(); + void setRegionWidth(float inValue); + + // Unrotated, stripped size. + float getRegionHeight(); + void setRegionHeight(float inValue); + + float getRegionOriginalWidth(); + void setRegionOriginalWidth(float inValue); + + // Unrotated, unstripped size. + float getRegionOriginalHeight(); + void setRegionOriginalHeight(float inValue); + + bool getInheritDeform(); + void setInheritDeform(bool inValue); + + MeshAttachment* getParentMesh(); + void setParentMesh(MeshAttachment* inValue); + + // Nonessential. + Vector& getEdges(); + float getWidth(); + void setWidth(float inValue); + float getHeight(); + void setHeight(float inValue); + + private: + float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight; + MeshAttachment* _parentMesh; + Vector _uvs; + Vector _regionUVs; + Vector _triangles; + Vector _edges; + String _path; + float _regionU; + float _regionV; + float _regionU2; + float _regionV2; + float _width; + float _height; + Color _color; + int _hullLength; + bool _inheritDeform; + bool _regionRotate; + }; +} + +#endif /* Spine_MeshAttachment_h */ diff --git a/cocos/editor-support/spine/Array.c b/cocos/editor-support/spine/MixBlend.h similarity index 83% rename from cocos/editor-support/spine/Array.c rename to cocos/editor-support/spine/MixBlend.h index 03a32bc78b3..937f1d40ea5 100644 --- a/cocos/editor-support/spine/Array.c +++ b/cocos/editor-support/spine/MixBlend.h @@ -28,12 +28,19 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#ifndef Spine_MixPose_h +#define Spine_MixPose_h -_SP_ARRAY_IMPLEMENT_TYPE(spFloatArray, float) -_SP_ARRAY_IMPLEMENT_TYPE(spIntArray, int) -_SP_ARRAY_IMPLEMENT_TYPE(spShortArray, short) -_SP_ARRAY_IMPLEMENT_TYPE(spUnsignedShortArray, unsigned short) -_SP_ARRAY_IMPLEMENT_TYPE(spArrayFloatArray, spFloatArray*) -_SP_ARRAY_IMPLEMENT_TYPE(spArrayShortArray, spShortArray*) +namespace spine { +/// +/// Controls how a timeline is mixed with the setup or current pose. +/// See also Timeline::apply(Skeleton&, float, float, Vector&, float, Blend, MixDirection) +enum MixBlend { + MixBlend_Setup = 0, + MixBlend_First, + MixBlend_Replace, + MixBlend_Add +}; +} + +#endif /* Spine_MixPose_h */ diff --git a/cocos/editor-support/spine/MixDirection.h b/cocos/editor-support/spine/MixDirection.h new file mode 100644 index 00000000000..6c758d0a8a0 --- /dev/null +++ b/cocos/editor-support/spine/MixDirection.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_MixDirection_h +#define Spine_MixDirection_h + +namespace spine { +/// +/// Indicates whether a timeline's alpha is mixing out over time toward 0 (the setup or current pose) or mixing in toward 1 (the timeline's pose). +/// See also Timeline::apply(Skeleton&, float, float, Vector&, float, MixPose, MixDirection) +enum MixDirection { + MixDirection_In = 0, + MixDirection_Out +}; +} + +#endif /* Spine_MixDirection_h */ diff --git a/cocos/editor-support/spine/PathAttachment.cpp b/cocos/editor-support/spine/PathAttachment.cpp new file mode 100644 index 00000000000..bcf54c6e3df --- /dev/null +++ b/cocos/editor-support/spine/PathAttachment.cpp @@ -0,0 +1,62 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +using namespace spine; + +RTTI_IMPL(PathAttachment, VertexAttachment) + +PathAttachment::PathAttachment(const String &name) : VertexAttachment(name), _closed(false), _constantSpeed(false) { +} + +Vector &PathAttachment::getLengths() { + return _lengths; +} + +bool PathAttachment::isClosed() { + return _closed; +} + +void PathAttachment::setClosed(bool inValue) { + _closed = inValue; +} + +bool PathAttachment::isConstantSpeed() { + return _constantSpeed; +} + +void PathAttachment::setConstantSpeed(bool inValue) { + _constantSpeed = inValue; +} diff --git a/cocos/editor-support/spine/PathAttachment.h b/cocos/editor-support/spine/PathAttachment.h index a953924a187..bde87449040 100644 --- a/cocos/editor-support/spine/PathAttachment.h +++ b/cocos/editor-support/spine/PathAttachment.h @@ -1,63 +1,60 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_PATHATTACHMENT_H_ -#define SPINE_PATHATTACHMENT_H_ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spPathAttachment { - spVertexAttachment super; - int lengthsLength; - float* lengths; - int/*bool*/ closed, constantSpeed; -} spPathAttachment; - -SP_API spPathAttachment* spPathAttachment_create (const char* name); - -#ifdef SPINE_SHORT_NAMES -typedef spPathAttachment PathAttachment; -#define PathAttachment_create(...) spPathAttachment_create(__VA_ARGS__) -#define PathAttachment_computeWorldVertices(...) spPathAttachment_computeWorldVertices(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_PATHATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathAttachment_h +#define Spine_PathAttachment_h + +#include + +namespace spine { + class SP_API PathAttachment : public VertexAttachment { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit PathAttachment(const String& name); + + /// The length in the setup pose from the start of the path to the end of each curve. + Vector& getLengths(); + bool isClosed(); + void setClosed(bool inValue); + bool isConstantSpeed(); + void setConstantSpeed(bool inValue); + + private: + Vector _lengths; + bool _closed; + bool _constantSpeed; + }; +} + +#endif /* Spine_PathAttachment_h */ diff --git a/cocos/editor-support/spine/PathConstraint.c b/cocos/editor-support/spine/PathConstraint.c deleted file mode 100644 index a660272335e..00000000000 --- a/cocos/editor-support/spine/PathConstraint.c +++ /dev/null @@ -1,472 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -#define PATHCONSTRAINT_NONE -1 -#define PATHCONSTRAINT_BEFORE -2 -#define PATHCONSTRAINT_AFTER -3 -#define EPSILON 0.00001f - -spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const spSkeleton* skeleton) { - int i; - spPathConstraint *self = NEW(spPathConstraint); - CONST_CAST(spPathConstraintData*, self->data) = data; - self->bonesCount = data->bonesCount; - CONST_CAST(spBone**, self->bones) = MALLOC(spBone*, self->bonesCount); - for (i = 0; i < self->bonesCount; ++i) - self->bones[i] = spSkeleton_findBone(skeleton, self->data->bones[i]->name); - self->target = spSkeleton_findSlot(skeleton, self->data->target->name); - self->position = data->position; - self->spacing = data->spacing; - self->rotateMix = data->rotateMix; - self->translateMix = data->translateMix; - self->spacesCount = 0; - self->spaces = 0; - self->positionsCount = 0; - self->positions = 0; - self->worldCount = 0; - self->world = 0; - self->curvesCount = 0; - self->curves = 0; - self->lengthsCount = 0; - self->lengths = 0; - return self; -} - -void spPathConstraint_dispose (spPathConstraint* self) { - FREE(self->bones); - FREE(self->spaces); - if (self->positions) FREE(self->positions); - if (self->world) FREE(self->world); - if (self->curves) FREE(self->curves); - if (self->lengths) FREE(self->lengths); - FREE(self); -} - -void spPathConstraint_apply (spPathConstraint* self) { - int i, p, n; - float length, setupLength, x, y, dx, dy, s; - float* spaces, *lengths, *positions; - float spacing; - float boneX, boneY, offsetRotation; - int/*bool*/tip; - float rotateMix = self->rotateMix, translateMix = self->translateMix; - int/*bool*/ translate = translateMix > 0, rotate = rotateMix > 0; - spPathAttachment* attachment = (spPathAttachment*)self->target->attachment; - spPathConstraintData* data = self->data; - spSpacingMode spacingMode = data->spacingMode; - int lengthSpacing = spacingMode == SP_SPACING_MODE_LENGTH; - spRotateMode rotateMode = data->rotateMode; - int tangents = rotateMode == SP_ROTATE_MODE_TANGENT, scale = rotateMode == SP_ROTATE_MODE_CHAIN_SCALE; - int boneCount = self->bonesCount, spacesCount = tangents ? boneCount : boneCount + 1; - spBone** bones = self->bones; - spBone* pa; - - if (!translate && !rotate) return; - if ((attachment == 0) || (attachment->super.super.type != SP_ATTACHMENT_PATH)) return; - - if (self->spacesCount != spacesCount) { - if (self->spaces) FREE(self->spaces); - self->spaces = MALLOC(float, spacesCount); - self->spacesCount = spacesCount; - } - spaces = self->spaces; - spaces[0] = 0; - lengths = 0; - spacing = self->spacing; - if (scale || lengthSpacing) { - if (scale) { - if (self->lengthsCount != boneCount) { - if (self->lengths) FREE(self->lengths); - self->lengths = MALLOC(float, boneCount); - self->lengthsCount = boneCount; - } - lengths = self->lengths; - } - for (i = 0, n = spacesCount - 1; i < n;) { - spBone *bone = bones[i]; - setupLength = bone->data->length; - if (setupLength < EPSILON) { - if (scale) lengths[i] = 0; - spaces[++i] = 0; - } else { - x = setupLength * bone->a, y = setupLength * bone->c; - length = SQRT(x * x + y * y); - if (scale) lengths[i] = length; - spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength; - } - } - } else { - for (i = 1; i < spacesCount; i++) { - spaces[i] = spacing; - } - } - - positions = spPathConstraint_computeWorldPositions(self, attachment, spacesCount, tangents, - data->positionMode == SP_POSITION_MODE_PERCENT, spacingMode == SP_SPACING_MODE_PERCENT); - boneX = positions[0], boneY = positions[1], offsetRotation = self->data->offsetRotation; - tip = 0; - if (offsetRotation == 0) - tip = rotateMode == SP_ROTATE_MODE_CHAIN; - else { - tip = 0; - pa = self->target->bone; - offsetRotation *= pa->a * pa->d - pa->b * pa->c > 0 ? DEG_RAD : -DEG_RAD; - } - for (i = 0, p = 3; i < boneCount; i++, p += 3) { - spBone* bone = bones[i]; - CONST_CAST(float, bone->worldX) += (boneX - bone->worldX) * translateMix; - CONST_CAST(float, bone->worldY) += (boneY - bone->worldY) * translateMix; - x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY; - if (scale) { - length = lengths[i]; - if (length != 0) { - s = (SQRT(dx * dx + dy * dy) / length - 1) * rotateMix + 1; - CONST_CAST(float, bone->a) *= s; - CONST_CAST(float, bone->c) *= s; - } - } - boneX = x; - boneY = y; - if (rotate) { - float a = bone->a, b = bone->b, c = bone->c, d = bone->d, r, cosine, sine; - if (tangents) - r = positions[p - 1]; - else if (spaces[i + 1] == 0) - r = positions[p + 2]; - else - r = ATAN2(dy, dx); - r -= ATAN2(c, a) - offsetRotation * DEG_RAD; - if (tip) { - cosine = COS(r); - sine = SIN(r); - length = bone->data->length; - boneX += (length * (cosine * a - sine * c) - dx) * rotateMix; - boneY += (length * (sine * a + cosine * c) - dy) * rotateMix; - } else - r += offsetRotation; - if (r > PI) - r -= PI2; - else if (r < -PI) - r += PI2; - r *= rotateMix; - cosine = COS(r); - sine = SIN(r); - CONST_CAST(float, bone->a) = cosine * a - sine * c; - CONST_CAST(float, bone->b) = cosine * b - sine * d; - CONST_CAST(float, bone->c) = sine * a + cosine * c; - CONST_CAST(float, bone->d) = sine * b + cosine * d; - } - CONST_CAST(int, bone->appliedValid) = -1; - } -} - -static void _addBeforePosition(float p, float* temp, int i, float* out, int o) { - float x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = ATAN2(dy, dx); - out[o] = x1 + p * COS(r); - out[o + 1] = y1 + p * SIN(r); - out[o + 2] = r; -} - -static void _addAfterPosition (float p, float* temp, int i, float* out, int o) { - float x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = ATAN2(dy, dx); - out[o] = x1 + p * COS(r); - out[o + 1] = y1 + p * SIN(r); - out[o + 2] = r; -} - -/* Need to pass 0 as an argument, so VC++ doesn't error with C2124 */ -static int _isNan(float value, float zero) { - float _nan = (float)0.0 / zero; - return 0 == memcmp((void*)&value, (void*)&_nan, sizeof(value)); -} - -static void _addCurvePosition (float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, - float* out, int o, int/*bool*/tangents) { - float tt, ttt, u, uu, uuu; - float ut, ut3, uut3, utt3; - float x, y; - if (p == 0 || _isNan(p, 0)) p = 0.0001f; - tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u; - ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p; - x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt; - out[o] = x; - out[o + 1] = y; - if (tangents) out[o + 2] = ATAN2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt)); -} - -float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents, int/*bool*/percentPosition, int/**/percentSpacing) { - int i, o, w, curve, segment, /*bool*/closed, verticesLength, curveCount, prevCurve; - float* out, *curves, *segments; - float tmpx, tmpy, dddfx, dddfy, ddfx, ddfy, dfx, dfy, pathLength, curveLength, p; - float x1, y1, cx1, cy1, cx2, cy2, x2, y2; - spSlot* target = self->target; - float position = self->position; - float* spaces = self->spaces, *world = 0; - if (self->positionsCount != spacesCount * 3 + 2) { - if (self->positions) FREE(self->positions); - self->positions = MALLOC(float, spacesCount * 3 + 2); - self->positionsCount = spacesCount * 3 + 2; - } - out = self->positions; - closed = path->closed; - verticesLength = path->super.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PATHCONSTRAINT_NONE; - - if (!path->constantSpeed) { - float* lengths = path->lengths; - curveCount -= closed ? 1 : 2; - pathLength = lengths[curveCount]; - if (percentPosition) position *= pathLength; - if (percentSpacing) { - for (i = 0; i < spacesCount; i++) - spaces[i] *= pathLength; - } - if (self->worldCount != 8) { - if (self->world) FREE(self->world); - self->world = MALLOC(float, 8); - self->worldCount = 8; - } - world = self->world; - for (i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) { - float space = spaces[i]; - position += space; - p = position; - - if (closed) { - p = FMOD(p, pathLength); - if (p < 0) p += pathLength; - curve = 0; - } else if (p < 0) { - if (prevCurve != PATHCONSTRAINT_BEFORE) { - prevCurve = PATHCONSTRAINT_BEFORE; - spVertexAttachment_computeWorldVertices(SUPER(path), target, 2, 4, world, 0, 2); - } - _addBeforePosition(p, world, 0, out, o); - continue; - } else if (p > pathLength) { - if (prevCurve != PATHCONSTRAINT_AFTER) { - prevCurve = PATHCONSTRAINT_AFTER; - spVertexAttachment_computeWorldVertices(SUPER(path), target, verticesLength - 6, 4, world, 0, 2); - } - _addAfterPosition(p - pathLength, world, 0, out, o); - continue; - } - - /* Determine curve containing position. */ - for (;; curve++) { - float length = lengths[curve]; - if (p > length) continue; - if (curve == 0) - p /= length; - else { - float prev = lengths[curve - 1]; - p = (p - prev) / (length - prev); - } - break; - } - if (curve != prevCurve) { - prevCurve = curve; - if (closed && curve == curveCount) { - spVertexAttachment_computeWorldVertices(SUPER(path), target, verticesLength - 4, 4, world, 0, 2); - spVertexAttachment_computeWorldVertices(SUPER(path), target, 0, 4, world, 4, 2); - } else - spVertexAttachment_computeWorldVertices(SUPER(path), target, curve * 6 + 2, 8, world, 0, 2); - } - _addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, - tangents || (i > 0 && space == 0)); - } - return out; - } - - /* World vertices. */ - if (closed) { - verticesLength += 2; - if (self->worldCount != verticesLength) { - if (self->world) FREE(self->world); - self->world = MALLOC(float, verticesLength); - self->worldCount = verticesLength; - } - world = self->world; - spVertexAttachment_computeWorldVertices(SUPER(path), target, 2, verticesLength - 4, world, 0, 2); - spVertexAttachment_computeWorldVertices(SUPER(path), target, 0, 2, world, verticesLength - 4, 2); - world[verticesLength - 2] = world[0]; - world[verticesLength - 1] = world[1]; - } else { - curveCount--; - verticesLength -= 4; - if (self->worldCount != verticesLength) { - if (self->world) FREE(self->world); - self->world = MALLOC(float, verticesLength); - self->worldCount = verticesLength; - } - world = self->world; - spVertexAttachment_computeWorldVertices(SUPER(path), target, 2, verticesLength, world, 0, 2); - } - - /* Curve lengths. */ - if (self->curvesCount != curveCount) { - if (self->curves) FREE(self->curves); - self->curves = MALLOC(float, curveCount); - self->curvesCount = curveCount; - } - curves = self->curves; - pathLength = 0; - x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0; - for (i = 0, w = 2; i < curveCount; i++, w += 6) { - cx1 = world[w]; - cy1 = world[w + 1]; - cx2 = world[w + 2]; - cy2 = world[w + 3]; - x2 = world[w + 4]; - y2 = world[w + 5]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.1875f; - tmpy = (y1 - cy1 * 2 + cy2) * 0.1875f; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375f; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375f; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.75f + tmpx + dddfx * 0.16666667f; - dfy = (cy1 - y1) * 0.75f + tmpy + dddfy * 0.16666667f; - pathLength += SQRT(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - pathLength += SQRT(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - pathLength += SQRT(dfx * dfx + dfy * dfy); - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - pathLength += SQRT(dfx * dfx + dfy * dfy); - curves[i] = pathLength; - x1 = x2; - y1 = y2; - } - if (percentPosition) position *= pathLength; - if (percentSpacing) { - for (i = 0; i < spacesCount; i++) - spaces[i] *= pathLength; - } - - segments = self->segments; - curveLength = 0; - for (i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) { - float space = spaces[i]; - position += space; - p = position; - - if (closed) { - p = FMOD(p, pathLength); - if (p < 0) p += pathLength; - curve = 0; - } else if (p < 0) { - _addBeforePosition(p, world, 0, out, o); - continue; - } else if (p > pathLength) { - _addAfterPosition(p - pathLength, world, verticesLength - 4, out, o); - continue; - } - - /* Determine curve containing position. */ - for (;; curve++) { - float length = curves[curve]; - if (p > length) continue; - if (curve == 0) - p /= length; - else { - float prev = curves[curve - 1]; - p = (p - prev) / (length - prev); - } - break; - } - - /* Curve segment lengths. */ - if (curve != prevCurve) { - int ii; - prevCurve = curve; - ii = curve * 6; - x1 = world[ii]; - y1 = world[ii + 1]; - cx1 = world[ii + 2]; - cy1 = world[ii + 3]; - cx2 = world[ii + 4]; - cy2 = world[ii + 5]; - x2 = world[ii + 6]; - y2 = world[ii + 7]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.03f; - tmpy = (y1 - cy1 * 2 + cy2) * 0.03f; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006f; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006f; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.3f + tmpx + dddfx * 0.16666667f; - dfy = (cy1 - y1) * 0.3f + tmpy + dddfy * 0.16666667f; - curveLength = SQRT(dfx * dfx + dfy * dfy); - segments[0] = curveLength; - for (ii = 1; ii < 8; ii++) { - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - curveLength += SQRT(dfx * dfx + dfy * dfy); - segments[ii] = curveLength; - } - dfx += ddfx; - dfy += ddfy; - curveLength += SQRT(dfx * dfx + dfy * dfy); - segments[8] = curveLength; - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - curveLength += SQRT(dfx * dfx + dfy * dfy); - segments[9] = curveLength; - segment = 0; - } - - /* Weight by segment length. */ - p *= curveLength; - for (;; segment++) { - float length = segments[segment]; - if (p > length) continue; - if (segment == 0) - p /= length; - else { - float prev = segments[segment - 1]; - p = segment + (p - prev) / (length - prev); - } - break; - } - _addCurvePosition(p * 0.1f, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0)); - } - return out; -} diff --git a/cocos/editor-support/spine/PathConstraint.cpp b/cocos/editor-support/spine/PathConstraint.cpp new file mode 100644 index 00000000000..2796079c4c8 --- /dev/null +++ b/cocos/editor-support/spine/PathConstraint.cpp @@ -0,0 +1,571 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include +#include + +#include +#include + +using namespace spine; + +RTTI_IMPL(PathConstraint, Constraint) + +const float PathConstraint::EPSILON = 0.00001f; +const int PathConstraint::NONE = -1; +const int PathConstraint::BEFORE = -2; +const int PathConstraint::AFTER = -3; + +PathConstraint::PathConstraint(PathConstraintData &data, Skeleton &skeleton) : Constraint(), + _data(data), + _target(skeleton.findSlot( + data.getTarget()->getName())), + _position(data.getPosition()), + _spacing(data.getSpacing()), + _rotateMix(data.getRotateMix()), + _translateMix(data.getTranslateMix()) { + _bones.ensureCapacity(_data.getBones().size()); + for (size_t i = 0; i < _data.getBones().size(); i++) { + BoneData *boneData = _data.getBones()[i]; + _bones.add(skeleton.findBone(boneData->getName())); + } + + _segments.setSize(10, 0); +} + +void PathConstraint::apply() { + update(); +} + +void PathConstraint::update() { + Attachment *baseAttachment = _target->getAttachment(); + if (baseAttachment == NULL || !baseAttachment->getRTTI().instanceOf(PathAttachment::rtti)) { + return; + } + + PathAttachment *attachment = static_cast(baseAttachment); + + float rotateMix = _rotateMix; + float translateMix = _translateMix; + bool translate = translateMix > 0; + bool rotate = rotateMix > 0; + if (!translate && !rotate) { + return; + } + + PathConstraintData &data = _data; + bool percentSpacing = data._spacingMode == SpacingMode_Percent; + RotateMode rotateMode = data._rotateMode; + bool tangents = rotateMode == RotateMode_Tangent, scale = rotateMode == RotateMode_ChainScale; + size_t boneCount = _bones.size(); + size_t spacesCount = tangents ? boneCount : boneCount + 1; + _spaces.setSize(spacesCount, 0); + float spacing = _spacing; + if (scale || !percentSpacing) { + if (scale) { + _lengths.setSize(boneCount, 0); + } + bool lengthSpacing = data._spacingMode == SpacingMode_Length; + + for (size_t i = 0, n = spacesCount - 1; i < n;) { + Bone *boneP = _bones[i]; + Bone &bone = *boneP; + float setupLength = bone._data.getLength(); + if (setupLength < PathConstraint::EPSILON) { + if (scale) { + _lengths[i] = 0; + } + _spaces[++i] = 0; + } else if (percentSpacing) { + if (scale) { + float x = setupLength * bone._a, y = setupLength * bone._c; + float length = MathUtil::sqrt(x * x + y * y); + _lengths[i] = length; + } + _spaces[++i] = spacing; + } else { + float x = setupLength * bone._a; + float y = setupLength * bone._c; + float length = MathUtil::sqrt(x * x + y * y); + if (scale) { + _lengths[i] = length; + } + + _spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength; + } + } + } else { + for (size_t i = 1; i < spacesCount; ++i) { + _spaces[i] = spacing; + } + } + + Vector& positions = computeWorldPositions(*attachment, spacesCount, tangents, + data.getPositionMode() == PositionMode_Percent, + percentSpacing); + float boneX = positions[0]; + float boneY = positions[1]; + float offsetRotation = data.getOffsetRotation(); + bool tip; + if (offsetRotation == 0) { + tip = rotateMode == RotateMode_Chain; + } else { + tip = false; + Bone &p = _target->getBone(); + offsetRotation *= p.getA() * p.getD() - p.getB() * p.getC() > 0 ? MathUtil::Deg_Rad : -MathUtil::Deg_Rad; + } + + for (size_t i = 0, p = 3; i < boneCount; i++, p += 3) { + Bone *boneP = _bones[i]; + Bone &bone = *boneP; + bone._worldX += (boneX - bone._worldX) * translateMix; + bone._worldY += (boneY - bone._worldY) * translateMix; + float x = positions[p]; + float y = positions[p + 1]; + float dx = x - boneX; + float dy = y - boneY; + if (scale) { + float length = _lengths[i]; + if (length >= PathConstraint::EPSILON) { + float s = (MathUtil::sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1; + bone._a *= s; + bone._c *= s; + } + } + + boneX = x; + boneY = y; + + if (rotate) { + float a = bone._a, b = bone._b, c = bone._c, d = bone._d, r, cos, sin; + if (tangents) { + r = positions[p - 1]; + } else if (_spaces[i + 1] < PathConstraint::EPSILON) { + r = positions[p + 2]; + } else { + r = MathUtil::atan2(dy, dx); + } + + r -= MathUtil::atan2(c, a); + + if (tip) { + cos = MathUtil::cos(r); + sin = MathUtil::sin(r); + float length = bone._data.getLength(); + boneX += (length * (cos * a - sin * c) - dx) * rotateMix; + boneY += (length * (sin * a + cos * c) - dy) * rotateMix; + } else { + r += offsetRotation; + } + + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; + } + + r *= rotateMix; + cos = MathUtil::cos(r); + sin = MathUtil::sin(r); + bone._a = cos * a - sin * c; + bone._b = cos * b - sin * d; + bone._c = sin * a + cos * c; + bone._d = sin * b + cos * d; + } + + bone._appliedValid = false; + } +} + +int PathConstraint::getOrder() { + return _data.getOrder(); +} + +float PathConstraint::getPosition() { + return _position; +} + +void PathConstraint::setPosition(float inValue) { + _position = inValue; +} + +float PathConstraint::getSpacing() { + return _spacing; +} + +void PathConstraint::setSpacing(float inValue) { + _spacing = inValue; +} + +float PathConstraint::getRotateMix() { + return _rotateMix; +} + +void PathConstraint::setRotateMix(float inValue) { + _rotateMix = inValue; +} + +float PathConstraint::getTranslateMix() { + return _translateMix; +} + +void PathConstraint::setTranslateMix(float inValue) { + _translateMix = inValue; +} + +Vector &PathConstraint::getBones() { + return _bones; +} + +Slot *PathConstraint::getTarget() { + return _target; +} + +void PathConstraint::setTarget(Slot *inValue) { + _target = inValue; +} + +PathConstraintData &PathConstraint::getData() { + return _data; +} + +Vector& +PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, bool tangents, bool percentPosition, + bool percentSpacing) { + Slot &target = *_target; + float position = _position; + _positions.setSize(spacesCount * 3 + 2, 0); + Vector &out = _positions; + Vector &world = _world; + bool closed = path.isClosed(); + int verticesLength = path.getWorldVerticesLength(); + int curveCount = verticesLength / 6; + int prevCurve = NONE; + + float pathLength; + if (!path.isConstantSpeed()) { + Vector &lengths = path.getLengths(); + curveCount -= closed ? 1 : 2; + pathLength = lengths[curveCount]; + if (percentPosition) { + position *= pathLength; + } + + if (percentSpacing) { + for (int i = 1; i < spacesCount; ++i) { + _spaces[i] *= pathLength; + } + } + + world.setSize(8, 0); + for (int i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) { + float space = _spaces[i]; + position += space; + float p = position; + + if (closed) { + p = MathUtil::fmod(p, pathLength); + + if (p < 0) { + p += pathLength; + } + curve = 0; + } else if (p < 0) { + if (prevCurve != BEFORE) { + prevCurve = BEFORE; + path.computeWorldVertices(target, 2, 4, world, 0); + } + + addBeforePosition(p, world, 0, out, o); + + continue; + } else if (p > pathLength) { + if (prevCurve != AFTER) { + prevCurve = AFTER; + path.computeWorldVertices(target, verticesLength - 6, 4, world, 0); + } + + addAfterPosition(p - pathLength, world, 0, out, o); + + continue; + } + + // Determine curve containing position. + for (;; curve++) { + float length = lengths[curve]; + if (p > length) { + continue; + } + + if (curve == 0) { + p /= length; + } else { + float prev = lengths[curve - 1]; + p = (p - prev) / (length - prev); + } + break; + } + + if (curve != prevCurve) { + prevCurve = curve; + if (closed && curve == curveCount) { + path.computeWorldVertices(target, verticesLength - 4, 4, world, 0); + path.computeWorldVertices(target, 0, 4, world, 4); + } else { + path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0); + } + } + + addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], + out, o, tangents || (i > 0 && space < EPSILON)); + } + return out; + } + + // World vertices. + if (closed) { + verticesLength += 2; + world.setSize(verticesLength, 0); + path.computeWorldVertices(target, 2, verticesLength - 4, world, 0); + path.computeWorldVertices(target, 0, 2, world, verticesLength - 4); + world[verticesLength - 2] = world[0]; + world[verticesLength - 1] = world[1]; + } else { + curveCount--; + verticesLength -= 4; + world.setSize(verticesLength, 0); + path.computeWorldVertices(target, 2, verticesLength, world, 0); + } + + // Curve lengths. + _curves.setSize(curveCount, 0); + pathLength = 0; + float x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0; + float tmpx, tmpy, dddfx, dddfy, ddfx, ddfy, dfx, dfy; + for (int i = 0, w = 2; i < curveCount; i++, w += 6) { + cx1 = world[w]; + cy1 = world[w + 1]; + cx2 = world[w + 2]; + cy2 = world[w + 3]; + x2 = world[w + 4]; + y2 = world[w + 5]; + tmpx = (x1 - cx1 * 2 + cx2) * 0.1875f; + tmpy = (y1 - cy1 * 2 + cy2) * 0.1875f; + dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375f; + dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375f; + ddfx = tmpx * 2 + dddfx; + ddfy = tmpy * 2 + dddfy; + dfx = (cx1 - x1) * 0.75f + tmpx + dddfx * 0.16666667f; + dfy = (cy1 - y1) * 0.75f + tmpy + dddfy * 0.16666667f; + pathLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + dfx += ddfx; + dfy += ddfy; + ddfx += dddfx; + ddfy += dddfy; + pathLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + dfx += ddfx; + dfy += ddfy; + pathLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + dfx += ddfx + dddfx; + dfy += ddfy + dddfy; + pathLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + _curves[i] = pathLength; + x1 = x2; + y1 = y2; + } + + if (percentPosition) { + position *= pathLength; + } else { + position *= pathLength / path.getLengths()[curveCount - 1]; + } + + if (percentSpacing) { + for (int i = 1; i < spacesCount; ++i) { + _spaces[i] *= pathLength; + } + } + + float curveLength = 0; + for (int i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) { + float space = _spaces[i]; + position += space; + float p = position; + + if (closed) { + p = MathUtil::fmod(p, pathLength); + + if (p < 0) { + p += pathLength; + } + curve = 0; + } else if (p < 0) { + addBeforePosition(p, world, 0, out, o); + continue; + } else if (p > pathLength) { + addAfterPosition(p - pathLength, world, verticesLength - 4, out, o); + continue; + } + + // Determine curve containing position. + for (;; curve++) { + float length = _curves[curve]; + if (p > length) { + continue; + } + + if (curve == 0) { + p /= length; + } else { + float prev = _curves[curve - 1]; + p = (p - prev) / (length - prev); + } + break; + } + + // Curve segment lengths. + if (curve != prevCurve) { + prevCurve = curve; + int ii = curve * 6; + x1 = world[ii]; + y1 = world[ii + 1]; + cx1 = world[ii + 2]; + cy1 = world[ii + 3]; + cx2 = world[ii + 4]; + cy2 = world[ii + 5]; + x2 = world[ii + 6]; + y2 = world[ii + 7]; + tmpx = (x1 - cx1 * 2 + cx2) * 0.03f; + tmpy = (y1 - cy1 * 2 + cy2) * 0.03f; + dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006f; + dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006f; + ddfx = tmpx * 2 + dddfx; + ddfy = tmpy * 2 + dddfy; + dfx = (cx1 - x1) * 0.3f + tmpx + dddfx * 0.16666667f; + dfy = (cy1 - y1) * 0.3f + tmpy + dddfy * 0.16666667f; + curveLength = MathUtil::sqrt(dfx * dfx + dfy * dfy); + _segments[0] = curveLength; + for (ii = 1; ii < 8; ii++) { + dfx += ddfx; + dfy += ddfy; + ddfx += dddfx; + ddfy += dddfy; + curveLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + _segments[ii] = curveLength; + } + dfx += ddfx; + dfy += ddfy; + curveLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + _segments[8] = curveLength; + dfx += ddfx + dddfx; + dfy += ddfy + dddfy; + curveLength += MathUtil::sqrt(dfx * dfx + dfy * dfy); + _segments[9] = curveLength; + segment = 0; + } + + // Weight by segment length. + p *= curveLength; + for (;; segment++) { + float length = _segments[segment]; + if (p > length) { + continue; + } + + if (segment == 0) { + p /= length; + } else { + float prev = _segments[segment - 1]; + p = segment + (p - prev) / (length - prev); + } + break; + } + addCurvePosition(p * 0.1f, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, + tangents || (i > 0 && space < EPSILON)); + } + + return out; +} + +void PathConstraint::addBeforePosition(float p, Vector &temp, int i, Vector &output, int o) { + float x1 = temp[i]; + float y1 = temp[i + 1]; + float dx = temp[i + 2] - x1; + float dy = temp[i + 3] - y1; + float r = MathUtil::atan2(dy, dx); + + output[o] = x1 + p * MathUtil::cos(r); + output[o + 1] = y1 + p * MathUtil::sin(r); + output[o + 2] = r; +} + +void PathConstraint::addAfterPosition(float p, Vector &temp, int i, Vector &output, int o) { + float x1 = temp[i + 2]; + float y1 = temp[i + 3]; + float dx = x1 - temp[i]; + float dy = y1 - temp[i + 1]; + float r = MathUtil::atan2(dy, dx); + output[o] = x1 + p * MathUtil::cos(r); + output[o + 1] = y1 + p * MathUtil::sin(r); + output[o + 2] = r; +} + +void PathConstraint::addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, + float y2, Vector &output, int o, bool tangents) { + if (p < EPSILON || MathUtil::isNan(p)) { + output[o] = x1; + output[o + 1] = y1; + output[o + 2] = MathUtil::atan2(cy1 - y1, cx1 - x1); + return; + } + + float tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u; + float ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p; + float x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt; + output[o] = x; + output[o + 1] = y; + if (tangents) { + if (p < 0.001) { + output[o + 2] = MathUtil::atan2(cy1 - y1, cx1 - x1); + } else { + output[o + 2] = MathUtil::atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), + x - (x1 * uu + cx1 * ut * 2 + cx2 * tt)); + } + } +} diff --git a/cocos/editor-support/spine/PathConstraint.h b/cocos/editor-support/spine/PathConstraint.h index 9d0ec10bebe..7a7632b7d0d 100644 --- a/cocos/editor-support/spine/PathConstraint.h +++ b/cocos/editor-support/spine/PathConstraint.h @@ -1,113 +1,110 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_PATHCONSTRAINT_H_ -#define SPINE_PATHCONSTRAINT_H_ - -#include -#include -#include -#include -#include "PathAttachment.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct spSkeleton; - -typedef struct spPathConstraint { - spPathConstraintData* const data; - int bonesCount; - spBone** const bones; - spSlot* target; - float position, spacing, rotateMix, translateMix; - - int spacesCount; - float* spaces; - - int positionsCount; - float* positions; - - int worldCount; - float* world; - - int curvesCount; - float* curves; - - int lengthsCount; - float* lengths; - - float segments[10]; - -#ifdef __cplusplus - spPathConstraint() : - data(0), - bonesCount(0), - bones(0), - target(0), - position(0), - spacing(0), - rotateMix(0), - translateMix(0), - spacesCount(0), - spaces(0), - positionsCount(0), - positions(0), - worldCount(0), - world(0), - curvesCount(0), - curves(0), - lengthsCount(0), - lengths(0) { - } -#endif -} spPathConstraint; - -#define SP_PATHCONSTRAINT_ - -SP_API spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const struct spSkeleton* skeleton); -SP_API void spPathConstraint_dispose (spPathConstraint* self); - -SP_API void spPathConstraint_apply (spPathConstraint* self); -SP_API float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents, int/*bool*/percentPosition, int/**/percentSpacing); - -#ifdef SPINE_SHORT_NAMES -typedef spPathConstraint PathConstraint; -#define PathConstraint_create(...) spPathConstraint_create(__VA_ARGS__) -#define PathConstraint_dispose(...) spPathConstraint_dispose(__VA_ARGS__) -#define PathConstraint_apply(...) spPathConstraint_apply(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_PATHCONSTRAINT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathConstraint_h +#define Spine_PathConstraint_h + +#include + +#include + +namespace spine { + class PathConstraintData; + class Skeleton; + class PathAttachment; + class Bone; + class Slot; + + class SP_API PathConstraint : public Constraint { + friend class Skeleton; + friend class PathConstraintMixTimeline; + friend class PathConstraintPositionTimeline; + friend class PathConstraintSpacingTimeline; + + RTTI_DECL + + public: + PathConstraint(PathConstraintData& data, Skeleton& skeleton); + + /// Applies the constraint to the constrained bones. + void apply(); + + virtual void update(); + + virtual int getOrder(); + + float getPosition(); + void setPosition(float inValue); + + float getSpacing(); + void setSpacing(float inValue); + + float getRotateMix(); + void setRotateMix(float inValue); + + float getTranslateMix(); + void setTranslateMix(float inValue); + + Vector& getBones(); + + Slot* getTarget(); + void setTarget(Slot* inValue); + + PathConstraintData& getData(); + + private: + static const float EPSILON; + static const int NONE; + static const int BEFORE; + static const int AFTER; + + PathConstraintData& _data; + Vector _bones; + Slot* _target; + float _position, _spacing, _rotateMix, _translateMix; + + Vector _spaces; + Vector _positions; + Vector _world; + Vector _curves; + Vector _lengths; + Vector _segments; + + Vector& computeWorldPositions(PathAttachment& path, int spacesCount, bool tangents, bool percentPosition, bool percentSpacing); + + static void addBeforePosition(float p, Vector& temp, int i, Vector& output, int o); + + static void addAfterPosition(float p, Vector& temp, int i, Vector& output, int o); + + static void addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, Vector& output, int o, bool tangents); + }; +} + +#endif /* Spine_PathConstraint_h */ diff --git a/cocos/editor-support/spine/PathConstraintData.cpp b/cocos/editor-support/spine/PathConstraintData.cpp new file mode 100644 index 00000000000..381030dc2bb --- /dev/null +++ b/cocos/editor-support/spine/PathConstraintData.cpp @@ -0,0 +1,145 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include + +using namespace spine; + +PathConstraintData::PathConstraintData(const String &name) : + _name(name), + _order(0), + _target(NULL), + _positionMode(PositionMode_Fixed), + _spacingMode(SpacingMode_Length), + _rotateMode(RotateMode_Tangent), + _offsetRotation(0), + _position(0), + _spacing(0), + _rotateMix(0), + _translateMix(0) { + assert(_name.length() > 0); +} + +const String &PathConstraintData::getName() { + return _name; +} + +int PathConstraintData::getOrder() { + return _order; +} + +void PathConstraintData::setOrder(int inValue) { + _order = inValue; +} + +Vector &PathConstraintData::getBones() { + return _bones; +} + +SlotData *PathConstraintData::getTarget() { + return _target; +} + +void PathConstraintData::setTarget(SlotData *inValue) { + _target = inValue; +} + +PositionMode PathConstraintData::getPositionMode() { + return _positionMode; +} + +void PathConstraintData::setPositionMode(PositionMode inValue) { + _positionMode = inValue; +} + +SpacingMode PathConstraintData::getSpacingMode() { + return _spacingMode; +} + +void PathConstraintData::setSpacingMode(SpacingMode inValue) { + _spacingMode = inValue; +} + +RotateMode PathConstraintData::getRotateMode() { + return _rotateMode; +} + +void PathConstraintData::setRotateMode(RotateMode inValue) { + _rotateMode = inValue; +} + +float PathConstraintData::getOffsetRotation() { + return _offsetRotation; +} + +void PathConstraintData::setOffsetRotation(float inValue) { + _offsetRotation = inValue; +} + +float PathConstraintData::getPosition() { + return _position; +} + +void PathConstraintData::setPosition(float inValue) { + _position = inValue; +} + +float PathConstraintData::getSpacing() { + return _spacing; +} + +void PathConstraintData::setSpacing(float inValue) { + _spacing = inValue; +} + +float PathConstraintData::getRotateMix() { + return _rotateMix; +} + +void PathConstraintData::setRotateMix(float inValue) { + _rotateMix = inValue; +} + +float PathConstraintData::getTranslateMix() { + return _translateMix; +} + +void PathConstraintData::setTranslateMix(float inValue) { + _translateMix = inValue; +} diff --git a/cocos/editor-support/spine/PathConstraintData.h b/cocos/editor-support/spine/PathConstraintData.h index 5a24cc37f73..ee86ecd5ca7 100644 --- a/cocos/editor-support/spine/PathConstraintData.h +++ b/cocos/editor-support/spine/PathConstraintData.h @@ -1,97 +1,105 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_PATHCONSTRAINTDATA_H_ -#define SPINE_PATHCONSTRAINTDATA_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - SP_POSITION_MODE_FIXED, SP_POSITION_MODE_PERCENT -} spPositionMode; - -typedef enum { - SP_SPACING_MODE_LENGTH, SP_SPACING_MODE_FIXED, SP_SPACING_MODE_PERCENT -} spSpacingMode; - -typedef enum { - SP_ROTATE_MODE_TANGENT, SP_ROTATE_MODE_CHAIN, SP_ROTATE_MODE_CHAIN_SCALE -} spRotateMode; - -typedef struct spPathConstraintData { - const char* const name; - int order; - int bonesCount; - spBoneData** const bones; - spSlotData* target; - spPositionMode positionMode; - spSpacingMode spacingMode; - spRotateMode rotateMode; - float offsetRotation; - float position, spacing, rotateMix, translateMix; - -#ifdef __cplusplus - spPathConstraintData() : - name(0), - bonesCount(0), - bones(0), - target(0), - positionMode(SP_POSITION_MODE_FIXED), - spacingMode(SP_SPACING_MODE_LENGTH), - rotateMode(SP_ROTATE_MODE_TANGENT), - offsetRotation(0), - position(0), - spacing(0), - rotateMix(0), - translateMix(0) { - } -#endif -} spPathConstraintData; - -SP_API spPathConstraintData* spPathConstraintData_create (const char* name); -SP_API void spPathConstraintData_dispose (spPathConstraintData* self); - -#ifdef SPINE_SHORT_NAMES -typedef spPathConstraintData PathConstraintData; -#define PathConstraintData_create(...) spPathConstraintData_create(__VA_ARGS__) -#define PathConstraintData_dispose(...) spPathConstraintData_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_PATHCONSTRAINTDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathConstraintData_h +#define Spine_PathConstraintData_h + +#include +#include +#include +#include +#include +#include + +namespace spine { + class BoneData; + class SlotData; + + class SP_API PathConstraintData : public SpineObject { + friend class SkeletonBinary; + friend class SkeletonJson; + + friend class PathConstraint; + friend class Skeleton; + friend class PathConstraintMixTimeline; + friend class PathConstraintPositionTimeline; + friend class PathConstraintSpacingTimeline; + + public: + explicit PathConstraintData(const String& name); + + const String& getName(); + + int getOrder(); + void setOrder(int inValue); + + Vector& getBones(); + + SlotData* getTarget(); + void setTarget(SlotData* inValue); + + PositionMode getPositionMode(); + void setPositionMode(PositionMode inValue); + + SpacingMode getSpacingMode(); + void setSpacingMode(SpacingMode inValue); + + RotateMode getRotateMode(); + void setRotateMode(RotateMode inValue); + + float getOffsetRotation(); + void setOffsetRotation(float inValue); + + float getPosition(); + void setPosition(float inValue); + + float getSpacing(); + void setSpacing(float inValue); + + float getRotateMix(); + void setRotateMix(float inValue); + + float getTranslateMix(); + void setTranslateMix(float inValue); + + private: + const String _name; + int _order; + Vector _bones; + SlotData* _target; + PositionMode _positionMode; + SpacingMode _spacingMode; + RotateMode _rotateMode; + float _offsetRotation; + float _position, _spacing, _rotateMix, _translateMix; + }; +} + +#endif /* Spine_PathConstraintData_h */ diff --git a/cocos/editor-support/spine/PathConstraintMixTimeline.cpp b/cocos/editor-support/spine/PathConstraintMixTimeline.cpp new file mode 100644 index 00000000000..a879bdbf8aa --- /dev/null +++ b/cocos/editor-support/spine/PathConstraintMixTimeline.cpp @@ -0,0 +1,124 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline) + +const int PathConstraintMixTimeline::ENTRIES = 3; +const int PathConstraintMixTimeline::PREV_TIME = -3; +const int PathConstraintMixTimeline::PREV_ROTATE = -2; +const int PathConstraintMixTimeline::PREV_TRANSLATE = -1; +const int PathConstraintMixTimeline::ROTATE = 1; +const int PathConstraintMixTimeline::TRANSLATE = 2; + +PathConstraintMixTimeline::PathConstraintMixTimeline(int frameCount) : CurveTimeline(frameCount), + _pathConstraintIndex(0) { + _frames.setSize(frameCount * ENTRIES, 0); +} + +void +PathConstraintMixTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + PathConstraint *constraintP = skeleton._pathConstraints[_pathConstraintIndex]; + PathConstraint &constraint = *constraintP; + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + constraint._rotateMix = constraint._data._rotateMix; + constraint._translateMix = constraint._data._translateMix; + return; + case MixBlend_First: + constraint._rotateMix += (constraint._data._rotateMix - constraint._rotateMix) * alpha; + constraint._translateMix += (constraint._data._translateMix - constraint._translateMix) * alpha; + return; + default: + return; + } + } + + float rotate, translate; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + rotate = _frames[_frames.size() + PREV_ROTATE]; + translate = _frames[_frames.size() + PREV_TRANSLATE]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + rotate = _frames[frame + PREV_ROTATE]; + translate = _frames[frame + PREV_TRANSLATE]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + rotate += (_frames[frame + ROTATE] - rotate) * percent; + translate += (_frames[frame + TRANSLATE] - translate) * percent; + } + + if (blend == MixBlend_Setup) { + constraint._rotateMix = constraint._data._rotateMix + (rotate - constraint._data._rotateMix) * alpha; + constraint._translateMix = + constraint._data._translateMix + (translate - constraint._data._translateMix) * alpha; + } else { + constraint._rotateMix += (rotate - constraint._rotateMix) * alpha; + constraint._translateMix += (translate - constraint._translateMix) * alpha; + } +} + +int PathConstraintMixTimeline::getPropertyId() { + return ((int) TimelineType_PathConstraintMix << 24) + _pathConstraintIndex; +} + +void PathConstraintMixTimeline::setFrame(int frameIndex, float time, float rotateMix, float translateMix) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + ROTATE] = rotateMix; + _frames[frameIndex + TRANSLATE] = translateMix; +} diff --git a/cocos/editor-support/spine/PathConstraintMixTimeline.h b/cocos/editor-support/spine/PathConstraintMixTimeline.h new file mode 100644 index 00000000000..0b53ede2ce9 --- /dev/null +++ b/cocos/editor-support/spine/PathConstraintMixTimeline.h @@ -0,0 +1,69 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathConstraintMixTimeline_h +#define Spine_PathConstraintMixTimeline_h + +#include + +namespace spine { +#define SP_PATHCONSTRAINTMIXTIMELINE_ENTRIES 5 + + class SP_API PathConstraintMixTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + static const int ENTRIES; + + explicit PathConstraintMixTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + private: + static const int PREV_TIME; + static const int PREV_ROTATE; + static const int PREV_TRANSLATE; + static const int ROTATE; + static const int TRANSLATE; + + Vector _frames; + int _pathConstraintIndex; + + /// Sets the time and mixes of the specified keyframe. + void setFrame(int frameIndex, float time, float rotateMix, float translateMix); + }; +} + +#endif /* Spine_PathConstraintMixTimeline_h */ diff --git a/cocos/editor-support/spine/PathConstraintPositionTimeline.cpp b/cocos/editor-support/spine/PathConstraintPositionTimeline.cpp new file mode 100644 index 00000000000..55a8f760022 --- /dev/null +++ b/cocos/editor-support/spine/PathConstraintPositionTimeline.cpp @@ -0,0 +1,114 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline) + +const int PathConstraintPositionTimeline::ENTRIES = 2; +const int PathConstraintPositionTimeline::PREV_TIME = -2; +const int PathConstraintPositionTimeline::PREV_VALUE = -1; +const int PathConstraintPositionTimeline::VALUE = 1; + +PathConstraintPositionTimeline::PathConstraintPositionTimeline(int frameCount) : CurveTimeline(frameCount), + _pathConstraintIndex(0) { + _frames.setSize(frameCount * ENTRIES, 0); +} + +PathConstraintPositionTimeline::~PathConstraintPositionTimeline() { +} + +void PathConstraintPositionTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, + float alpha, MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + PathConstraint *constraintP = skeleton._pathConstraints[_pathConstraintIndex]; + PathConstraint &constraint = *constraintP; + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + constraint._position = constraint._data._position; + return; + case MixBlend_First: + constraint._position += (constraint._data._position - constraint._position) * alpha; + return; + default: + return; + } + } + + float position; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + position = _frames[_frames.size() + PREV_VALUE]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + position = _frames[frame + PREV_VALUE]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + position += (_frames[frame + VALUE] - position) * percent; + } + if (blend == MixBlend_Setup) { + constraint._position = constraint._data._position + (position - constraint._data._position) * alpha; + } else { + constraint._position += (position - constraint._position) * alpha; + } +} + +int PathConstraintPositionTimeline::getPropertyId() { + return ((int) TimelineType_PathConstraintPosition << 24) + _pathConstraintIndex; +} + +void PathConstraintPositionTimeline::setFrame(int frameIndex, float time, float value) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + VALUE] = value; +} diff --git a/cocos/editor-support/spine/PathConstraintPositionTimeline.h b/cocos/editor-support/spine/PathConstraintPositionTimeline.h new file mode 100644 index 00000000000..a9ae41db9fe --- /dev/null +++ b/cocos/editor-support/spine/PathConstraintPositionTimeline.h @@ -0,0 +1,68 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathConstraintPositionTimeline_h +#define Spine_PathConstraintPositionTimeline_h + +#include + +namespace spine { + + class SP_API PathConstraintPositionTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + static const int ENTRIES; + + explicit PathConstraintPositionTimeline(int frameCount); + + virtual ~PathConstraintPositionTimeline(); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, float value); + + protected: + static const int PREV_TIME; + static const int PREV_VALUE; + static const int VALUE; + + Vector _frames; + int _pathConstraintIndex; + }; +} + +#endif /* Spine_PathConstraintPositionTimeline_h */ diff --git a/cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp b/cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp new file mode 100644 index 00000000000..c46c73bbf5c --- /dev/null +++ b/cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp @@ -0,0 +1,100 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline) + +PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(int frameCount) : PathConstraintPositionTimeline( + frameCount) { +} + +void PathConstraintSpacingTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, + float alpha, MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + PathConstraint *constraintP = skeleton._pathConstraints[_pathConstraintIndex]; + PathConstraint &constraint = *constraintP; + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + constraint._spacing = constraint._data._spacing; + return; + case MixBlend_First: + constraint._spacing += (constraint._data._spacing - constraint._spacing) * alpha; + return; + default: + return; + } + } + + float spacing; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + spacing = _frames[_frames.size() + PREV_VALUE]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + spacing = _frames[frame + PREV_VALUE]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + spacing += (_frames[frame + VALUE] - spacing) * percent; + } + + if (blend == MixBlend_Setup) { + constraint._spacing = constraint._data._spacing + (spacing - constraint._data._spacing) * alpha; + } else { + constraint._spacing += (spacing - constraint._spacing) * alpha; + } +} + +int PathConstraintSpacingTimeline::getPropertyId() { + return ((int) TimelineType_PathConstraintSpacing << 24) + _pathConstraintIndex; +} diff --git a/cocos/editor-support/spine/BoundingBoxAttachment.c b/cocos/editor-support/spine/PathConstraintSpacingTimeline.h similarity index 72% rename from cocos/editor-support/spine/BoundingBoxAttachment.c rename to cocos/editor-support/spine/PathConstraintSpacingTimeline.h index f8b45f5c77a..3dd96491949 100644 --- a/cocos/editor-support/spine/BoundingBoxAttachment.c +++ b/cocos/editor-support/spine/PathConstraintSpacingTimeline.h @@ -1,47 +1,52 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -void _spBoundingBoxAttachment_dispose (spAttachment* attachment) { - spBoundingBoxAttachment* self = SUB_CAST(spBoundingBoxAttachment, attachment); - - _spVertexAttachment_deinit(SUPER(self)); - - FREE(self); -} - -spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name) { - spBoundingBoxAttachment* self = NEW(spBoundingBoxAttachment); - _spVertexAttachment_init(SUPER(self)); - _spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_BOUNDING_BOX, _spBoundingBoxAttachment_dispose); - return self; -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathConstraintSpacingTimeline_h +#define Spine_PathConstraintSpacingTimeline_h + +#include + +namespace spine { + class SP_API PathConstraintSpacingTimeline : public PathConstraintPositionTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit PathConstraintSpacingTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + }; +} + +#endif /* Spine_PathConstraintSpacingTimeline_h */ diff --git a/cocos/editor-support/spine/PointAttachment.cpp b/cocos/editor-support/spine/PointAttachment.cpp new file mode 100644 index 00000000000..39c76236d70 --- /dev/null +++ b/cocos/editor-support/spine/PointAttachment.cpp @@ -0,0 +1,83 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +#include + +using namespace spine; + +RTTI_IMPL(PointAttachment, Attachment) + +PointAttachment::PointAttachment(const String &name) : Attachment(name), _x(0), _y(0), _rotation(0) { +} + +void PointAttachment::computeWorldPosition(Bone &bone, float &ox, float &oy) { + bone.localToWorld(_x, _y, ox, oy); +} + +float PointAttachment::computeWorldRotation(Bone &bone) { + float cos = MathUtil::cosDeg(_rotation); + float sin = MathUtil::sinDeg(_rotation); + float ix = cos * bone._a + sin * bone._b; + float iy = cos * bone._c + sin * bone._d; + + return MathUtil::atan2(iy, ix) * MathUtil::Rad_Deg; +} + +float PointAttachment::getX() { + return _x; +} + +void PointAttachment::setX(float inValue) { + _x = inValue; +} + +float PointAttachment::getY() { + return _y; +} + +void PointAttachment::setY(float inValue) { + _y = inValue; +} + +float PointAttachment::getRotation() { + return _rotation; +} + +void PointAttachment::setRotation(float inValue) { + _rotation = inValue; +} diff --git a/cocos/editor-support/spine/PointAttachment.h b/cocos/editor-support/spine/PointAttachment.h index da8df6cbbdf..6751ed2f7db 100644 --- a/cocos/editor-support/spine/PointAttachment.h +++ b/cocos/editor-support/spine/PointAttachment.h @@ -28,38 +28,46 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef SPINE_POINTATTACHMENT_H_ -#define SPINE_POINTATTACHMENT_H_ +#ifndef Spine_PointAttachment_h +#define Spine_PointAttachment_h -#include #include -#include -#include -#include -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spPointAttachment { - spVertexAttachment super; - float x, y, rotation; - spColor color; -} spPointAttachment; - -SP_API spPointAttachment* spPointAttachment_create (const char* name); -SP_API void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y); -SP_API float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone); - -#ifdef SPINE_SHORT_NAMES -typedef spPointAttachment PointAttachment; -#define PointAttachment_create(...) spPointAttachment_create(__VA_ARGS__) -#define PointAttachment_computeWorldPosition(...) spPointAttachment_computeWorldPosition(__VA_ARGS__) -#define PointAttachment_computeWorldRotation(...) spPointAttachment_computeWorldRotation(__VA_ARGS__) -#endif - -#ifdef __cplusplus +namespace spine { + class Bone; + + /// + /// An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be + /// used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a + /// skin. + /// + /// See http://esotericsoftware.com/spine-point-attachments for Point Attachments in the Spine User Guide. + /// + class SP_API PointAttachment : public Attachment { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit PointAttachment(const String& name); + + void computeWorldPosition(Bone& bone, float& ox, float& oy); + + float computeWorldRotation(Bone& bone); + + float getX(); + void setX(float inValue); + + float getY(); + void setY(float inValue); + + float getRotation(); + void setRotation(float inValue); + + private: + float _x, _y, _rotation; + }; } -#endif -#endif /* SPINE_POINTATTACHMENT_H_ */ +#endif /* Spine_PointAttachment_h */ diff --git a/cocos/editor-support/spine/Pool.h b/cocos/editor-support/spine/Pool.h new file mode 100644 index 00000000000..01e0cfdb64b --- /dev/null +++ b/cocos/editor-support/spine/Pool.h @@ -0,0 +1,75 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Pool_h +#define Spine_Pool_h + +#include +#include +#include +#include + +namespace spine { +template +class SP_API Pool : public SpineObject { +public: + Pool() { + } + + ~Pool() { + ContainerUtil::cleanUpVectorOfPointers(_objects); + } + + T *obtain() { + if (_objects.size() > 0) { + T **object = &_objects[_objects.size() - 1]; + T *ret = *object; + _objects.removeAt(_objects.size() - 1); + + return ret; + } else { + T *ret = new(__FILE__, __LINE__) T(); + + return ret; + } + } + + void free(T *object) { + if (!_objects.contains(object)) { + _objects.add(object); + } + } + +private: + Vector _objects; +}; +} + +#endif /* Spine_Pool_h */ diff --git a/cocos/editor-support/spine/PositionMode.h b/cocos/editor-support/spine/PositionMode.h new file mode 100644 index 00000000000..46fb89646ed --- /dev/null +++ b/cocos/editor-support/spine/PositionMode.h @@ -0,0 +1,41 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PositionMode_h +#define Spine_PositionMode_h + +namespace spine { +enum PositionMode { + PositionMode_Fixed = 0, + PositionMode_Percent +}; +} + +#endif /* Spine_PositionMode_h */ diff --git a/cocos/editor-support/spine/RTTI.cpp b/cocos/editor-support/spine/RTTI.cpp new file mode 100644 index 00000000000..0822ebc72b3 --- /dev/null +++ b/cocos/editor-support/spine/RTTI.cpp @@ -0,0 +1,66 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include + +using namespace spine; + +RTTI::RTTI(const std::string &className) : _className(className), _pBaseRTTI(NULL) { +} + +RTTI::RTTI(const std::string &className, const RTTI &baseRTTI) : _className(className), _pBaseRTTI(&baseRTTI) { +} + +const std::string &RTTI::getClassName() const { + return _className; +} + +bool RTTI::isExactly(const RTTI &rtti) const { + return (this->_className == rtti._className); +} + +bool RTTI::instanceOf(const RTTI &rtti) const { + const RTTI *pCompare = this; + + while (pCompare) { + if (pCompare->_className == rtti._className) { + return true; + } + + pCompare = pCompare->_pBaseRTTI; + } + + return false; +} diff --git a/cocos/editor-support/spine/RTTI.h b/cocos/editor-support/spine/RTTI.h new file mode 100644 index 00000000000..987f5da68c7 --- /dev/null +++ b/cocos/editor-support/spine/RTTI.h @@ -0,0 +1,76 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_RTTI_h +#define Spine_RTTI_h + +#include + +#include + +namespace spine { +class SP_API RTTI : public SpineObject { +public: + explicit RTTI(const std::string &className); + + RTTI(const std::string &className, const RTTI &baseRTTI); + + const std::string &getClassName() const; + + bool isExactly(const RTTI &rtti) const; + + bool instanceOf(const RTTI &rtti) const; + +private: + // Prevent copying + RTTI(const RTTI &obj); + + RTTI &operator=(const RTTI &obj); + + const std::string _className; + const RTTI *_pBaseRTTI; +}; +} + +#define RTTI_DECL \ +public: \ +static const spine::RTTI rtti; \ +virtual const spine::RTTI& getRTTI() const; + +#define RTTI_IMPL_NOPARENT(name) \ +const spine::RTTI name::rtti(#name); \ +const spine::RTTI& name::getRTTI() const { return rtti; } + +#define RTTI_IMPL(name, parent) \ +const spine::RTTI name::rtti(#name, parent::rtti); \ +const spine::RTTI& name::getRTTI() const { return rtti; } + +#endif /* Spine_RTTI_h */ + diff --git a/cocos/editor-support/spine/RegionAttachment.c b/cocos/editor-support/spine/RegionAttachment.c deleted file mode 100644 index 56e981eded3..00000000000 --- a/cocos/editor-support/spine/RegionAttachment.c +++ /dev/null @@ -1,130 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -typedef enum { - BLX = 0, BLY, ULX, ULY, URX, URY, BRX, BRY -} spVertexIndex; - -void _spRegionAttachment_dispose (spAttachment* attachment) { - spRegionAttachment* self = SUB_CAST(spRegionAttachment, attachment); - _spAttachment_deinit(attachment); - FREE(self->path); - FREE(self); -} - -spRegionAttachment* spRegionAttachment_create (const char* name) { - spRegionAttachment* self = NEW(spRegionAttachment); - self->scaleX = 1; - self->scaleY = 1; - spColor_setFromFloats(&self->color, 1, 1, 1, 1); - _spAttachment_init(SUPER(self), name, SP_ATTACHMENT_REGION, _spRegionAttachment_dispose); - return self; -} - -void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, int/*bool*/rotate) { - if (rotate) { - self->uvs[URX] = u; - self->uvs[URY] = v2; - self->uvs[BRX] = u; - self->uvs[BRY] = v; - self->uvs[BLX] = u2; - self->uvs[BLY] = v; - self->uvs[ULX] = u2; - self->uvs[ULY] = v2; - } else { - self->uvs[ULX] = u; - self->uvs[ULY] = v2; - self->uvs[URX] = u; - self->uvs[URY] = v; - self->uvs[BRX] = u2; - self->uvs[BRY] = v; - self->uvs[BLX] = u2; - self->uvs[BLY] = v2; - } -} - -void spRegionAttachment_updateOffset (spRegionAttachment* self) { - float regionScaleX = self->width / self->regionOriginalWidth * self->scaleX; - float regionScaleY = self->height / self->regionOriginalHeight * self->scaleY; - float localX = -self->width / 2 * self->scaleX + self->regionOffsetX * regionScaleX; - float localY = -self->height / 2 * self->scaleY + self->regionOffsetY * regionScaleY; - float localX2 = localX + self->regionWidth * regionScaleX; - float localY2 = localY + self->regionHeight * regionScaleY; - float radians = self->rotation * DEG_RAD; - float cosine = COS(radians), sine = SIN(radians); - float localXCos = localX * cosine + self->x; - float localXSin = localX * sine; - float localYCos = localY * cosine + self->y; - float localYSin = localY * sine; - float localX2Cos = localX2 * cosine + self->x; - float localX2Sin = localX2 * sine; - float localY2Cos = localY2 * cosine + self->y; - float localY2Sin = localY2 * sine; - self->offset[BLX] = localXCos - localYSin; - self->offset[BLY] = localYCos + localXSin; - self->offset[ULX] = localXCos - localY2Sin; - self->offset[ULY] = localY2Cos + localXSin; - self->offset[URX] = localX2Cos - localY2Sin; - self->offset[URY] = localY2Cos + localX2Sin; - self->offset[BRX] = localX2Cos - localYSin; - self->offset[BRY] = localYCos + localX2Sin; -} - -void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride) { - const float* offsets = self->offset; - float x = bone->worldX, y = bone->worldY; - float offsetX, offsetY; - - offsetX = offsets[BRX]; - offsetY = offsets[BRY]; - vertices[offset] = offsetX * bone->a + offsetY * bone->b + x; /* br */ - vertices[offset + 1] = offsetX * bone->c + offsetY * bone->d + y; - offset += stride; - - offsetX = offsets[BLX]; - offsetY = offsets[BLY]; - vertices[offset] = offsetX * bone->a + offsetY * bone->b + x; /* bl */ - vertices[offset + 1] = offsetX * bone->c + offsetY * bone->d + y; - offset += stride; - - offsetX = offsets[ULX]; - offsetY = offsets[ULY]; - vertices[offset] = offsetX * bone->a + offsetY * bone->b + x; /* ul */ - vertices[offset + 1] = offsetX * bone->c + offsetY * bone->d + y; - offset += stride; - - offsetX = offsets[URX]; - offsetY = offsets[URY]; - vertices[offset] = offsetX * bone->a + offsetY * bone->b + x; /* ur */ - vertices[offset + 1] = offsetX * bone->c + offsetY * bone->d + y; -} diff --git a/cocos/editor-support/spine/RegionAttachment.cpp b/cocos/editor-support/spine/RegionAttachment.cpp new file mode 100644 index 00000000000..cdd05e0cb13 --- /dev/null +++ b/cocos/editor-support/spine/RegionAttachment.cpp @@ -0,0 +1,284 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +#include + +using namespace spine; + +RTTI_IMPL(RegionAttachment, Attachment) + +const int RegionAttachment::BLX = 0; +const int RegionAttachment::BLY = 1; +const int RegionAttachment::ULX = 2; +const int RegionAttachment::ULY = 3; +const int RegionAttachment::URX = 4; +const int RegionAttachment::URY = 5; +const int RegionAttachment::BRX = 6; +const int RegionAttachment::BRY = 7; + +RegionAttachment::RegionAttachment(const String &name) : Attachment(name), HasRendererObject(), + _x(0), + _y(0), + _rotation(0), + _scaleX(1), + _scaleY(1), + _width(0), + _height(0), + _regionOffsetX(0), + _regionOffsetY(0), + _regionWidth(0), + _regionHeight(0), + _regionOriginalWidth(0), + _regionOriginalHeight(0), + _path(), + _regionU(0), + _regionV(0), + _regionU2(0), + _regionV2(0), + _color(1, 1, 1, 1) { + _vertexOffset.setSize(NUM_UVS, 0); + _uvs.setSize(NUM_UVS, 0); +} + +void RegionAttachment::updateOffset() { + float regionScaleX = _width / _regionOriginalWidth * _scaleX; + float regionScaleY = _height / _regionOriginalHeight * _scaleY; + float localX = -_width / 2 * _scaleX + _regionOffsetX * regionScaleX; + float localY = -_height / 2 * _scaleY + _regionOffsetY * regionScaleY; + float localX2 = localX + _regionWidth * regionScaleX; + float localY2 = localY + _regionHeight * regionScaleY; + float cos = MathUtil::cosDeg(_rotation); + float sin = MathUtil::sinDeg(_rotation); + float localXCos = localX * cos + _x; + float localXSin = localX * sin; + float localYCos = localY * cos + _y; + float localYSin = localY * sin; + float localX2Cos = localX2 * cos + _x; + float localX2Sin = localX2 * sin; + float localY2Cos = localY2 * cos + _y; + float localY2Sin = localY2 * sin; + + _vertexOffset[BLX] = localXCos - localYSin; + _vertexOffset[BLY] = localYCos + localXSin; + _vertexOffset[ULX] = localXCos - localY2Sin; + _vertexOffset[ULY] = localY2Cos + localXSin; + _vertexOffset[URX] = localX2Cos - localY2Sin; + _vertexOffset[URY] = localY2Cos + localX2Sin; + _vertexOffset[BRX] = localX2Cos - localYSin; + _vertexOffset[BRY] = localYCos + localX2Sin; +} + +void RegionAttachment::setUVs(float u, float v, float u2, float v2, bool rotate) { + if (rotate) { + _uvs[URX] = u; + _uvs[URY] = v2; + _uvs[BRX] = u; + _uvs[BRY] = v; + _uvs[BLX] = u2; + _uvs[BLY] = v; + _uvs[ULX] = u2; + _uvs[ULY] = v2; + } else { + _uvs[ULX] = u; + _uvs[ULY] = v2; + _uvs[URX] = u; + _uvs[URY] = v; + _uvs[BRX] = u2; + _uvs[BRY] = v; + _uvs[BLX] = u2; + _uvs[BLY] = v2; + } +} + +void RegionAttachment::computeWorldVertices(Bone &bone, Vector &worldVertices, size_t offset, size_t stride) { + assert(worldVertices.size() >= (offset + 8)); + computeWorldVertices(bone, worldVertices.buffer(), offset, stride); +} + +void RegionAttachment::computeWorldVertices(Bone &bone, float* worldVertices, size_t offset, size_t stride) { + float x = bone.getWorldX(), y = bone.getWorldY(); + float a = bone.getA(), b = bone.getB(), c = bone.getC(), d = bone.getD(); + float offsetX, offsetY; + + offsetX = _vertexOffset[BRX]; + offsetY = _vertexOffset[BRY]; + worldVertices[offset] = offsetX * a + offsetY * b + x; // br + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + offset += stride; + + offsetX = _vertexOffset[BLX]; + offsetY = _vertexOffset[BLY]; + worldVertices[offset] = offsetX * a + offsetY * b + x; // bl + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + offset += stride; + + offsetX = _vertexOffset[ULX]; + offsetY = _vertexOffset[ULY]; + worldVertices[offset] = offsetX * a + offsetY * b + x; // ul + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + offset += stride; + + offsetX = _vertexOffset[URX]; + offsetY = _vertexOffset[URY]; + worldVertices[offset] = offsetX * a + offsetY * b + x; // ur + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; +} + +float RegionAttachment::getX() { + return _x; +} + +void RegionAttachment::setX(float inValue) { + _x = inValue; +} + +float RegionAttachment::getY() { + return _y; +} + +void RegionAttachment::setY(float inValue) { + _y = inValue; +} + +float RegionAttachment::getRotation() { + return _rotation; +} + +void RegionAttachment::setRotation(float inValue) { + _rotation = inValue; +} + +float RegionAttachment::getScaleX() { + return _scaleX; +} + +void RegionAttachment::setScaleX(float inValue) { + _scaleX = inValue; +} + +float RegionAttachment::getScaleY() { + return _scaleY; +} + +void RegionAttachment::setScaleY(float inValue) { + _scaleY = inValue; +} + +float RegionAttachment::getWidth() { + return _width; +} + +void RegionAttachment::setWidth(float inValue) { + _width = inValue; +} + +float RegionAttachment::getHeight() { + return _height; +} + +void RegionAttachment::setHeight(float inValue) { + _height = inValue; +} + +const String &RegionAttachment::getPath() { + return _path; +} + +void RegionAttachment::setPath(const String &inValue) { + _path = inValue; +} + +float RegionAttachment::getRegionOffsetX() { + return _regionOffsetX; +} + +void RegionAttachment::setRegionOffsetX(float inValue) { + _regionOffsetX = inValue; +} + +float RegionAttachment::getRegionOffsetY() { + return _regionOffsetY; +} + +void RegionAttachment::setRegionOffsetY(float inValue) { + _regionOffsetY = inValue; +} + +float RegionAttachment::getRegionWidth() { + return _regionWidth; +} + +void RegionAttachment::setRegionWidth(float inValue) { + _regionWidth = inValue; +} + +float RegionAttachment::getRegionHeight() { + return _regionHeight; +} + +void RegionAttachment::setRegionHeight(float inValue) { + _regionHeight = inValue; +} + +float RegionAttachment::getRegionOriginalWidth() { + return _regionOriginalWidth; +} + +void RegionAttachment::setRegionOriginalWidth(float inValue) { + _regionOriginalWidth = inValue; +} + +float RegionAttachment::getRegionOriginalHeight() { + return _regionOriginalHeight; +} + +void RegionAttachment::setRegionOriginalHeight(float inValue) { + _regionOriginalHeight = inValue; +} + +Vector &RegionAttachment::getOffset() { + return _vertexOffset; +} + +Vector &RegionAttachment::getUVs() { + return _uvs; +} + +spine::Color &RegionAttachment::getColor() { + return _color; +} diff --git a/cocos/editor-support/spine/RegionAttachment.h b/cocos/editor-support/spine/RegionAttachment.h index 9e23d5bdf3a..995cc39924f 100644 --- a/cocos/editor-support/spine/RegionAttachment.h +++ b/cocos/editor-support/spine/RegionAttachment.h @@ -1,75 +1,133 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_REGIONATTACHMENT_H_ -#define SPINE_REGIONATTACHMENT_H_ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spRegionAttachment { - spAttachment super; - const char* path; - float x, y, scaleX, scaleY, rotation, width, height; - spColor color; - - void* rendererObject; - int regionOffsetX, regionOffsetY; /* Pixels stripped from the bottom left, unrotated. */ - int regionWidth, regionHeight; /* Unrotated, stripped pixel size. */ - int regionOriginalWidth, regionOriginalHeight; /* Unrotated, unstripped pixel size. */ - - float offset[8]; - float uvs[8]; -} spRegionAttachment; - -SP_API spRegionAttachment* spRegionAttachment_create (const char* name); -SP_API void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, int/*bool*/rotate); -SP_API void spRegionAttachment_updateOffset (spRegionAttachment* self); -SP_API void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride); - -#ifdef SPINE_SHORT_NAMES -typedef spRegionAttachment RegionAttachment; -#define RegionAttachment_create(...) spRegionAttachment_create(__VA_ARGS__) -#define RegionAttachment_setUVs(...) spRegionAttachment_setUVs(__VA_ARGS__) -#define RegionAttachment_updateOffset(...) spRegionAttachment_updateOffset(__VA_ARGS__) -#define RegionAttachment_computeWorldVertices(...) spRegionAttachment_computeWorldVertices(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_REGIONATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_RegionAttachment_h +#define Spine_RegionAttachment_h + +#include +#include +#include + +#include +#include + +#define NUM_UVS 8 + +namespace spine { + class Bone; + + /// Attachment that displays a texture region. + class SP_API RegionAttachment : public Attachment, public HasRendererObject { + friend class SkeletonBinary; + friend class SkeletonJson; + friend class AtlasAttachmentLoader; + + RTTI_DECL + + public: + explicit RegionAttachment(const String& name); + + void updateOffset(); + + void setUVs(float u, float v, float u2, float v2, bool rotate); + + /// Transforms the attachment's four vertices to world coordinates. + /// @param bone The parent bone. + /// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + 8. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. + void computeWorldVertices(Bone& bone, float *worldVertices, size_t offset, size_t stride = 2); + void computeWorldVertices(Bone& bone, Vector& worldVertices, size_t offset, size_t stride = 2); + + float getX(); + void setX(float inValue); + float getY(); + void setY(float inValue); + float getRotation(); + void setRotation(float inValue); + float getScaleX(); + void setScaleX(float inValue); + float getScaleY(); + void setScaleY(float inValue); + float getWidth(); + void setWidth(float inValue); + float getHeight(); + void setHeight(float inValue); + + Color& getColor(); + + const String& getPath(); + void setPath(const String& inValue); + + float getRegionOffsetX(); + void setRegionOffsetX(float inValue); + + float getRegionOffsetY(); + void setRegionOffsetY(float inValue); + + float getRegionWidth(); + void setRegionWidth(float inValue); + + float getRegionHeight(); + void setRegionHeight(float inValue); + + float getRegionOriginalWidth(); + void setRegionOriginalWidth(float inValue); + + float getRegionOriginalHeight(); + void setRegionOriginalHeight(float inValue); + + Vector& getOffset(); + Vector& getUVs(); + + private: + static const int BLX; + static const int BLY; + static const int ULX; + static const int ULY; + static const int URX; + static const int URY; + static const int BRX; + static const int BRY; + + float _x, _y, _rotation, _scaleX, _scaleY, _width, _height; + float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight; + Vector _vertexOffset; + Vector _uvs; + String _path; + float _regionU; + float _regionV; + float _regionU2; + float _regionV2; + Color _color; + }; +} + +#endif /* Spine_RegionAttachment_h */ diff --git a/cocos/editor-support/spine/RotateMode.h b/cocos/editor-support/spine/RotateMode.h new file mode 100644 index 00000000000..a9a78f665ff --- /dev/null +++ b/cocos/editor-support/spine/RotateMode.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_RotateMode_h +#define Spine_RotateMode_h + +namespace spine { +enum RotateMode { + RotateMode_Tangent = 0, + RotateMode_Chain, + RotateMode_ChainScale +}; +} + +#endif /* Spine_RotateMode_h */ diff --git a/cocos/editor-support/spine/RotateTimeline.cpp b/cocos/editor-support/spine/RotateTimeline.cpp new file mode 100644 index 00000000000..4f4e1b86a9f --- /dev/null +++ b/cocos/editor-support/spine/RotateTimeline.cpp @@ -0,0 +1,139 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(RotateTimeline, CurveTimeline) + +RotateTimeline::RotateTimeline(int frameCount) : CurveTimeline(frameCount), _boneIndex(0) { + _frames.setSize(frameCount << 1, 0); +} + +void RotateTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + Bone *bone = skeleton.getBones()[_boneIndex]; + + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: { + bone->_rotation = bone->_data._rotation; + break; + } + case MixBlend_First: { + float r = bone->_data._rotation - bone->_rotation; + bone->_rotation += (r - (16384 - (int) (16384.499999999996 - r / 360)) * 360) * alpha; + break; + } + default: { + // TODO? + break; + } + } + + return; + } + + if (time >= _frames[_frames.size() - ENTRIES]) { + float r = _frames[_frames.size() + PREV_ROTATION]; + switch (blend) { + case MixBlend_Setup: + bone->_rotation = bone->_data._rotation + r * alpha; + break; + case MixBlend_First: + case MixBlend_Replace: + r += bone->_data._rotation - bone->_rotation; + r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; + // Fall through. + case MixBlend_Add: + bone->_rotation += r * alpha; + } + return; + } + + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + float prevRotation = _frames[frame + PREV_ROTATION]; + float frameTime = _frames[frame]; + float percent = getCurvePercent((frame >> 1) - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + float r = _frames[frame + ROTATION] - prevRotation; + r = prevRotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * percent; + switch (blend) { + case MixBlend_Setup: + bone->_rotation = bone->_data._rotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha; + break; + case MixBlend_First: + case MixBlend_Replace: + r += bone->_data._rotation - bone->_rotation; + // Fall through. + case MixBlend_Add: + bone->_rotation += (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha; + } +} + +int RotateTimeline::getPropertyId() { + return ((int) TimelineType_Rotate << 24) + _boneIndex; +} + +void RotateTimeline::setFrame(int frameIndex, float time, float degrees) { + frameIndex <<= 1; + _frames[frameIndex] = time; + _frames[frameIndex + ROTATION] = degrees; +} + +int RotateTimeline::getBoneIndex() { + return _boneIndex; +} + +void RotateTimeline::setBoneIndex(int inValue) { + _boneIndex = inValue; +} + +Vector &RotateTimeline::getFrames() { + return _frames; +} diff --git a/cocos/editor-support/spine/RotateTimeline.h b/cocos/editor-support/spine/RotateTimeline.h new file mode 100644 index 00000000000..cdc46d50758 --- /dev/null +++ b/cocos/editor-support/spine/RotateTimeline.h @@ -0,0 +1,71 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_RotateTimeline_h +#define Spine_RotateTimeline_h + +#include + +namespace spine { + class SP_API RotateTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + friend class AnimationState; + + RTTI_DECL + + public: + static const int ENTRIES = 2; + + explicit RotateTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, float degrees); + + int getBoneIndex(); + void setBoneIndex(int inValue); + + Vector& getFrames(); + + private: + static const int PREV_TIME = -2; + static const int PREV_ROTATION = -1; + static const int ROTATION = 1; + + int _boneIndex; + Vector _frames; // time, angle, ... + }; +} + +#endif /* Spine_RotateTimeline_h */ diff --git a/cocos/editor-support/spine/ScaleTimeline.cpp b/cocos/editor-support/spine/ScaleTimeline.cpp new file mode 100644 index 00000000000..f2a8d6600de --- /dev/null +++ b/cocos/editor-support/spine/ScaleTimeline.cpp @@ -0,0 +1,151 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(ScaleTimeline, TranslateTimeline) + +ScaleTimeline::ScaleTimeline(int frameCount) : TranslateTimeline(frameCount) { +} + +void ScaleTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + + Bone *boneP = skeleton._bones[_boneIndex]; + Bone &bone = *boneP; + + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + bone._scaleX = bone._data._scaleX; + bone._scaleY = bone._data._scaleY; + return; + case MixBlend_First: + bone._scaleX += (bone._data._scaleX - bone._scaleX) * alpha; + bone._scaleY += (bone._data._scaleY - bone._scaleY) * alpha; + default: {} + } + return; + } + + float x, y; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + x = _frames[_frames.size() + PREV_X] * bone._data._scaleX; + y = _frames[_frames.size() + PREV_Y] * bone._data._scaleY; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + x = _frames[frame + PREV_X]; + y = _frames[frame + PREV_Y]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + x = (x + (_frames[frame + X] - x) * percent) * bone._data._scaleX; + y = (y + (_frames[frame + Y] - y) * percent) * bone._data._scaleY; + } + + if (alpha == 1) { + if (blend == MixBlend_Add) { + bone._scaleX += x - bone._data._scaleX; + bone._scaleY += y - bone._data._scaleY; + } else { + bone._scaleX = x; + bone._scaleY = y; + } + } else { + // Mixing out uses sign of setup or current pose, else use sign of key. + float bx, by; + if (direction == MixDirection_Out) { + switch (blend) { + case MixBlend_Setup: + bx = bone._data._scaleX; + by = bone._data._scaleY; + bone._scaleX = bx + (MathUtil::abs(x) * MathUtil::sign(bx) - bx) * alpha; + bone._scaleY = by + (MathUtil::abs(y) * MathUtil::sign(by) - by) * alpha; + break; + case MixBlend_First: + case MixBlend_Replace: + bx = bone._scaleX; + by = bone._scaleY; + bone._scaleX = bx + (MathUtil::abs(x) * MathUtil::sign(bx) - bx) * alpha; + bone._scaleY = by + (MathUtil::abs(y) * MathUtil::sign(by) - by) * alpha; + break; + case MixBlend_Add: + bx = bone._scaleX; + by = bone._scaleY; + bone._scaleX = bx + (MathUtil::abs(x) * MathUtil::sign(bx) - bone._data._scaleX) * alpha; + bone._scaleY = by + (MathUtil::abs(y) * MathUtil::sign(by) - bone._data._scaleY) * alpha; + } + } else { + switch (blend) { + case MixBlend_Setup: + bx = MathUtil::abs(bone._data._scaleX) * MathUtil::sign(x); + by = MathUtil::abs(bone._data._scaleY) * MathUtil::sign(y); + bone._scaleX = bx + (x - bx) * alpha; + bone._scaleY = by + (y - by) * alpha; + break; + case MixBlend_First: + case MixBlend_Replace: + bx = MathUtil::abs(bone._scaleX) * MathUtil::sign(x); + by = MathUtil::abs(bone._scaleY) * MathUtil::sign(y); + bone._scaleX = bx + (x - bx) * alpha; + bone._scaleY = by + (y - by) * alpha; + break; + case MixBlend_Add: + bx = MathUtil::sign(x); + by = MathUtil::sign(y); + bone._scaleX = MathUtil::abs(bone._scaleX) * bx + (x - MathUtil::abs(bone._data._scaleX) * bx) * alpha; + bone._scaleY = MathUtil::abs(bone._scaleY) * by + (y - MathUtil::abs(bone._data._scaleY) * by) * alpha; + } + } + } +} + +int ScaleTimeline::getPropertyId() { + return ((int) TimelineType_Scale << 24) + _boneIndex; +} diff --git a/cocos/editor-support/spine/PathAttachment.c b/cocos/editor-support/spine/ScaleTimeline.h similarity index 75% rename from cocos/editor-support/spine/PathAttachment.c rename to cocos/editor-support/spine/ScaleTimeline.h index f81b3fd1c96..fcb75721d02 100644 --- a/cocos/editor-support/spine/PathAttachment.c +++ b/cocos/editor-support/spine/ScaleTimeline.h @@ -1,48 +1,52 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -void _spPathAttachment_dispose (spAttachment* attachment) { - spPathAttachment* self = SUB_CAST(spPathAttachment, attachment); - - _spVertexAttachment_deinit(SUPER(self)); - - FREE(self->lengths); - FREE(self); -} - -spPathAttachment* spPathAttachment_create (const char* name) { - spPathAttachment* self = NEW(spPathAttachment); - _spVertexAttachment_init(SUPER(self)); - _spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_PATH, _spPathAttachment_dispose); - return self; -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_ScaleTimeline_h +#define Spine_ScaleTimeline_h + +#include + +namespace spine { + class SP_API ScaleTimeline : public TranslateTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit ScaleTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + }; +} + +#endif /* Spine_ScaleTimeline_h */ diff --git a/cocos/editor-support/spine/ShearTimeline.cpp b/cocos/editor-support/spine/ShearTimeline.cpp new file mode 100644 index 00000000000..cf4f01519e2 --- /dev/null +++ b/cocos/editor-support/spine/ShearTimeline.cpp @@ -0,0 +1,111 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(ShearTimeline, TranslateTimeline) + +ShearTimeline::ShearTimeline(int frameCount) : TranslateTimeline(frameCount) { +} + +void ShearTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + Bone *boneP = skeleton._bones[_boneIndex]; + Bone &bone = *boneP; + + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + bone._shearX = bone._data._shearX; + bone._shearY = bone._data._shearY; + return; + case MixBlend_First: + bone._shearX += (bone._data._shearX - bone._shearX) * alpha; + bone._shearY += (bone._data._shearY - bone._shearY) * alpha; + default: {} + } + return; + } + + float x, y; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + x = _frames[_frames.size() + PREV_X]; + y = _frames[_frames.size() + PREV_Y]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + x = _frames[frame + PREV_X]; + y = _frames[frame + PREV_Y]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + x = x + (_frames[frame + X] - x) * percent; + y = y + (_frames[frame + Y] - y) * percent; + } + + switch (blend) { + case MixBlend_Setup: + bone._shearX = bone._data._shearX + x * alpha; + bone._shearY = bone._data._shearY + y * alpha; + break; + case MixBlend_First: + case MixBlend_Replace: + bone._shearX += (bone._data._shearX + x - bone._shearX) * alpha; + bone._shearY += (bone._data._shearY + y - bone._shearY) * alpha; + break; + case MixBlend_Add: + bone._shearX += x * alpha; + bone._shearY += y * alpha; + } +} + +int ShearTimeline::getPropertyId() { + return ((int) TimelineType_Shear << 24) + _boneIndex; +} diff --git a/cocos/editor-support/spine/ShearTimeline.h b/cocos/editor-support/spine/ShearTimeline.h new file mode 100644 index 00000000000..69631f7ce93 --- /dev/null +++ b/cocos/editor-support/spine/ShearTimeline.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_ShearTimeline_h +#define Spine_ShearTimeline_h + +#include + +namespace spine { + class SP_API ShearTimeline : public TranslateTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + explicit ShearTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + }; +} + +#endif /* Spine_ShearTimeline_h */ diff --git a/cocos/editor-support/spine/Skeleton.c b/cocos/editor-support/spine/Skeleton.c deleted file mode 100644 index 7383b0c1db4..00000000000 --- a/cocos/editor-support/spine/Skeleton.c +++ /dev/null @@ -1,583 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include -#include - -typedef enum { - SP_UPDATE_BONE, SP_UPDATE_IK_CONSTRAINT, SP_UPDATE_PATH_CONSTRAINT, SP_UPDATE_TRANSFORM_CONSTRAINT -} _spUpdateType; - -typedef struct { - _spUpdateType type; - void* object; -} _spUpdate; - -typedef struct { - spSkeleton super; - - int updateCacheCount; - int updateCacheCapacity; - _spUpdate* updateCache; - - int updateCacheResetCount; - int updateCacheResetCapacity; - spBone** updateCacheReset; -} _spSkeleton; - -spSkeleton* spSkeleton_create (spSkeletonData* data) { - int i; - int* childrenCounts; - - _spSkeleton* internal = NEW(_spSkeleton); - spSkeleton* self = SUPER(internal); - CONST_CAST(spSkeletonData*, self->data) = data; - - self->bonesCount = self->data->bonesCount; - self->bones = MALLOC(spBone*, self->bonesCount); - childrenCounts = CALLOC(int, self->bonesCount); - - for (i = 0; i < self->bonesCount; ++i) { - spBoneData* boneData = self->data->bones[i]; - spBone* newBone; - if (!boneData->parent) - newBone = spBone_create(boneData, self, 0); - else { - spBone* parent = self->bones[boneData->parent->index]; - newBone = spBone_create(boneData, self, parent); - ++childrenCounts[boneData->parent->index]; - } - self->bones[i] = newBone; - } - for (i = 0; i < self->bonesCount; ++i) { - spBoneData* boneData = self->data->bones[i]; - spBone* bone = self->bones[i]; - CONST_CAST(spBone**, bone->children) = MALLOC(spBone*, childrenCounts[boneData->index]); - } - for (i = 0; i < self->bonesCount; ++i) { - spBone* bone = self->bones[i]; - spBone* parent = bone->parent; - if (parent) - parent->children[parent->childrenCount++] = bone; - } - CONST_CAST(spBone*, self->root) = (self->bonesCount > 0 ? self->bones[0] : NULL); - - self->slotsCount = data->slotsCount; - self->slots = MALLOC(spSlot*, self->slotsCount); - for (i = 0; i < self->slotsCount; ++i) { - spSlotData *slotData = data->slots[i]; - spBone* bone = self->bones[slotData->boneData->index]; - self->slots[i] = spSlot_create(slotData, bone); - } - - self->drawOrder = MALLOC(spSlot*, self->slotsCount); - memcpy(self->drawOrder, self->slots, sizeof(spSlot*) * self->slotsCount); - - self->ikConstraintsCount = data->ikConstraintsCount; - self->ikConstraints = MALLOC(spIkConstraint*, self->ikConstraintsCount); - for (i = 0; i < self->data->ikConstraintsCount; ++i) - self->ikConstraints[i] = spIkConstraint_create(self->data->ikConstraints[i], self); - - self->transformConstraintsCount = data->transformConstraintsCount; - self->transformConstraints = MALLOC(spTransformConstraint*, self->transformConstraintsCount); - for (i = 0; i < self->data->transformConstraintsCount; ++i) - self->transformConstraints[i] = spTransformConstraint_create(self->data->transformConstraints[i], self); - - self->pathConstraintsCount = data->pathConstraintsCount; - self->pathConstraints = MALLOC(spPathConstraint*, self->pathConstraintsCount); - for (i = 0; i < self->data->pathConstraintsCount; i++) - self->pathConstraints[i] = spPathConstraint_create(self->data->pathConstraints[i], self); - - spColor_setFromFloats(&self->color, 1, 1, 1, 1); - - spSkeleton_updateCache(self); - - FREE(childrenCounts); - - return self; -} - -void spSkeleton_dispose (spSkeleton* self) { - int i; - _spSkeleton* internal = SUB_CAST(_spSkeleton, self); - - FREE(internal->updateCache); - FREE(internal->updateCacheReset); - - for (i = 0; i < self->bonesCount; ++i) - spBone_dispose(self->bones[i]); - FREE(self->bones); - - for (i = 0; i < self->slotsCount; ++i) - spSlot_dispose(self->slots[i]); - FREE(self->slots); - - for (i = 0; i < self->ikConstraintsCount; ++i) - spIkConstraint_dispose(self->ikConstraints[i]); - FREE(self->ikConstraints); - - for (i = 0; i < self->transformConstraintsCount; ++i) - spTransformConstraint_dispose(self->transformConstraints[i]); - FREE(self->transformConstraints); - - for (i = 0; i < self->pathConstraintsCount; i++) - spPathConstraint_dispose(self->pathConstraints[i]); - FREE(self->pathConstraints); - - FREE(self->drawOrder); - FREE(self); -} - -static void _addToUpdateCache(_spSkeleton* const internal, _spUpdateType type, void *object) { - _spUpdate* update; - if (internal->updateCacheCount == internal->updateCacheCapacity) { - internal->updateCacheCapacity *= 2; - internal->updateCache = (_spUpdate*)realloc(internal->updateCache, sizeof(_spUpdate) * internal->updateCacheCapacity); - } - update = internal->updateCache + internal->updateCacheCount; - update->type = type; - update->object = object; - ++internal->updateCacheCount; -} - -static void _addToUpdateCacheReset(_spSkeleton* const internal, spBone* bone) { - if (internal->updateCacheResetCount == internal->updateCacheResetCapacity) { - internal->updateCacheResetCapacity *= 2; - internal->updateCacheReset = (spBone**)realloc(internal->updateCacheReset, sizeof(spBone*) * internal->updateCacheResetCapacity); - } - internal->updateCacheReset[internal->updateCacheResetCount] = bone; - ++internal->updateCacheResetCount; -} - -static void _sortBone(_spSkeleton* const internal, spBone* bone) { - if (bone->sorted) return; - if (bone->parent) _sortBone(internal, bone->parent); - bone->sorted = 1; - _addToUpdateCache(internal, SP_UPDATE_BONE, bone); -} - -static void _sortPathConstraintAttachmentBones(_spSkeleton* const internal, spAttachment* attachment, spBone* slotBone) { - spPathAttachment* pathAttachment = (spPathAttachment*)attachment; - int* pathBones; - int pathBonesCount; - if (pathAttachment->super.super.type != SP_ATTACHMENT_PATH) return; - pathBones = pathAttachment->super.bones; - pathBonesCount = pathAttachment->super.bonesCount; - if (pathBones == 0) - _sortBone(internal, slotBone); - else { - spBone** bones = internal->super.bones; - int i = 0, n; - while (i < pathBonesCount) { - int boneCount = pathBones[i++]; - for (n = i + boneCount; i < n; i++) - _sortBone(internal, bones[pathBones[i]]); - } - } -} - -static void _sortPathConstraintAttachment(_spSkeleton* const internal, spSkin* skin, int slotIndex, spBone* slotBone) { - _Entry* entry = SUB_CAST(_spSkin, skin)->entries; - while (entry) { - if (entry->slotIndex == slotIndex) _sortPathConstraintAttachmentBones(internal, entry->attachment, slotBone); - entry = entry->next; - } -} - -static void _sortReset(spBone** bones, int bonesCount) { - int i; - for (i = 0; i < bonesCount; ++i) { - spBone* bone = bones[i]; - if (bone->sorted) _sortReset(bone->children, bone->childrenCount); - bone->sorted = 0; - } -} - -static void _sortIkConstraint (_spSkeleton* const internal, spIkConstraint* constraint) { - int /*bool*/ contains = 0; - int i; - spBone* target = constraint->target; - spBone** constrained; - spBone* parent; - _sortBone(internal, target); - - constrained = constraint->bones; - parent = constrained[0]; - _sortBone(internal, parent); - - if (constraint->bonesCount > 1) { - spBone* child = constrained[constraint->bonesCount - 1]; - contains = 0; - for (i = 0; i < internal->updateCacheCount; i++) { - _spUpdate update = internal->updateCache[i]; - if (update.object == child) { - contains = -1; - break; - } - } - if (!contains) - _addToUpdateCacheReset(internal, child); - } - - _addToUpdateCache(internal, SP_UPDATE_IK_CONSTRAINT, constraint); - - _sortReset(parent->children, parent->childrenCount); - constrained[constraint->bonesCount-1]->sorted = 1; -} - -static void _sortPathConstraint(_spSkeleton* const internal, spPathConstraint* constraint) { - spSlot* slot = constraint->target; - int slotIndex = slot->data->index; - spBone* slotBone = slot->bone; - int i, n, boneCount; - spAttachment* attachment; - spBone** constrained; - spSkeleton* skeleton = SUPER_CAST(spSkeleton, internal); - if (skeleton->skin) _sortPathConstraintAttachment(internal, skeleton->skin, slotIndex, slotBone); - if (skeleton->data->defaultSkin && skeleton->data->defaultSkin != skeleton->skin) - _sortPathConstraintAttachment(internal, skeleton->data->defaultSkin, slotIndex, slotBone); - for (i = 0, n = skeleton->data->skinsCount; i < n; i++) - _sortPathConstraintAttachment(internal, skeleton->data->skins[i], slotIndex, slotBone); - - attachment = slot->attachment; - if (attachment && attachment->type == SP_ATTACHMENT_PATH) _sortPathConstraintAttachmentBones(internal, attachment, slotBone); - - constrained = constraint->bones; - boneCount = constraint->bonesCount; - for (i = 0; i < boneCount; i++) - _sortBone(internal, constrained[i]); - - _addToUpdateCache(internal, SP_UPDATE_PATH_CONSTRAINT, constraint); - - for (i = 0; i < boneCount; i++) - _sortReset(constrained[i]->children, constrained[i]->childrenCount); - for (i = 0; i < boneCount; i++) - constrained[i]->sorted = 1; -} - -static void _sortTransformConstraint(_spSkeleton* const internal, spTransformConstraint* constraint) { - int i, boneCount; - spBone** constrained; - spBone* child; - int /*boolean*/ contains = 0; - _sortBone(internal, constraint->target); - - constrained = constraint->bones; - boneCount = constraint->bonesCount; - if (constraint->data->local) { - for (i = 0; i < boneCount; i++) { - child = constrained[i]; - _sortBone(internal, child); - contains = 0; - for (i = 0; i < internal->updateCacheCount; i++) { - _spUpdate update = internal->updateCache[i]; - if (update.object == child) { - contains = -1; - break; - } - } - if (!contains) _addToUpdateCacheReset(internal, child); - } - } else { - for (i = 0; i < boneCount; i++) - _sortBone(internal, constrained[i]); - } - - _addToUpdateCache(internal, SP_UPDATE_TRANSFORM_CONSTRAINT, constraint); - - for (i = 0; i < boneCount; i++) - _sortReset(constrained[i]->children, constrained[i]->childrenCount); - for (i = 0; i < boneCount; i++) - constrained[i]->sorted = 1; -} - -void spSkeleton_updateCache (spSkeleton* self) { - int i, ii; - spBone** bones; - spIkConstraint** ikConstraints; - spPathConstraint** pathConstraints; - spTransformConstraint** transformConstraints; - int ikCount, transformCount, pathCount, constraintCount; - _spSkeleton* internal = SUB_CAST(_spSkeleton, self); - - internal->updateCacheCapacity = self->bonesCount + self->ikConstraintsCount + self->transformConstraintsCount + self->pathConstraintsCount; - FREE(internal->updateCache); - internal->updateCache = MALLOC(_spUpdate, internal->updateCacheCapacity); - internal->updateCacheCount = 0; - - internal->updateCacheResetCapacity = self->bonesCount; - FREE(internal->updateCacheReset); - internal->updateCacheReset = MALLOC(spBone*, internal->updateCacheResetCapacity); - internal->updateCacheResetCount = 0; - - bones = self->bones; - for (i = 0; i < self->bonesCount; ++i) - bones[i]->sorted = 0; - - /* IK first, lowest hierarchy depth first. */ - ikConstraints = self->ikConstraints; - transformConstraints = self->transformConstraints; - pathConstraints = self->pathConstraints; - ikCount = self->ikConstraintsCount; transformCount = self->transformConstraintsCount; pathCount = self->pathConstraintsCount; - constraintCount = ikCount + transformCount + pathCount; - - i = 0; - continue_outer: - for (; i < constraintCount; i++) { - for (ii = 0; ii < ikCount; ii++) { - spIkConstraint* ikConstraint = ikConstraints[ii]; - if (ikConstraint->data->order == i) { - _sortIkConstraint(internal, ikConstraint); - i++; - goto continue_outer; - } - } - - for (ii = 0; ii < transformCount; ii++) { - spTransformConstraint* transformConstraint = transformConstraints[ii]; - if (transformConstraint->data->order == i) { - _sortTransformConstraint(internal, transformConstraint); - i++; - goto continue_outer; - } - } - - for (ii = 0; ii < pathCount; ii++) { - spPathConstraint* pathConstraint = pathConstraints[ii]; - if (pathConstraint->data->order == i) { - _sortPathConstraint(internal, pathConstraint); - i++; - goto continue_outer; - } - } - } - - for (i = 0; i < self->bonesCount; ++i) - _sortBone(internal, self->bones[i]); -} - -void spSkeleton_updateWorldTransform (const spSkeleton* self) { - int i; - _spSkeleton* internal = SUB_CAST(_spSkeleton, self); - spBone** updateCacheReset = internal->updateCacheReset; - for (i = 0; i < internal->updateCacheResetCount; i++) { - spBone* bone = updateCacheReset[i]; - CONST_CAST(float, bone->ax) = bone->x; - CONST_CAST(float, bone->ay) = bone->y; - CONST_CAST(float, bone->arotation) = bone->rotation; - CONST_CAST(float, bone->ascaleX) = bone->scaleX; - CONST_CAST(float, bone->ascaleY) = bone->scaleY; - CONST_CAST(float, bone->ashearX) = bone->shearX; - CONST_CAST(float, bone->ashearY) = bone->shearY; - CONST_CAST(int, bone->appliedValid) = 1; - } - - for (i = 0; i < internal->updateCacheCount; ++i) { - _spUpdate* update = internal->updateCache + i; - switch (update->type) { - case SP_UPDATE_BONE: - spBone_updateWorldTransform((spBone*)update->object); - break; - case SP_UPDATE_IK_CONSTRAINT: - spIkConstraint_apply((spIkConstraint*)update->object); - break; - case SP_UPDATE_TRANSFORM_CONSTRAINT: - spTransformConstraint_apply((spTransformConstraint*)update->object); - break; - case SP_UPDATE_PATH_CONSTRAINT: - spPathConstraint_apply((spPathConstraint*)update->object); - break; - } - } -} - -void spSkeleton_setToSetupPose (const spSkeleton* self) { - spSkeleton_setBonesToSetupPose(self); - spSkeleton_setSlotsToSetupPose(self); -} - -void spSkeleton_setBonesToSetupPose (const spSkeleton* self) { - int i; - for (i = 0; i < self->bonesCount; ++i) - spBone_setToSetupPose(self->bones[i]); - - for (i = 0; i < self->ikConstraintsCount; ++i) { - spIkConstraint* ikConstraint = self->ikConstraints[i]; - ikConstraint->bendDirection = ikConstraint->data->bendDirection; - ikConstraint->mix = ikConstraint->data->mix; - } - - for (i = 0; i < self->transformConstraintsCount; ++i) { - spTransformConstraint* constraint = self->transformConstraints[i]; - spTransformConstraintData* data = constraint->data; - constraint->rotateMix = data->rotateMix; - constraint->translateMix = data->translateMix; - constraint->scaleMix = data->scaleMix; - constraint->shearMix = data->shearMix; - } - - for (i = 0; i < self->pathConstraintsCount; ++i) { - spPathConstraint* constraint = self->pathConstraints[i]; - spPathConstraintData* data = constraint->data; - constraint->position = data->position; - constraint->spacing = data->spacing; - constraint->rotateMix = data->rotateMix; - constraint->translateMix = data->translateMix; - } -} - -void spSkeleton_setSlotsToSetupPose (const spSkeleton* self) { - int i; - memcpy(self->drawOrder, self->slots, self->slotsCount * sizeof(spSlot*)); - for (i = 0; i < self->slotsCount; ++i) - spSlot_setToSetupPose(self->slots[i]); -} - -spBone* spSkeleton_findBone (const spSkeleton* self, const char* boneName) { - int i; - for (i = 0; i < self->bonesCount; ++i) - if (strcmp(self->data->bones[i]->name, boneName) == 0) return self->bones[i]; - return 0; -} - -int spSkeleton_findBoneIndex (const spSkeleton* self, const char* boneName) { - int i; - for (i = 0; i < self->bonesCount; ++i) - if (strcmp(self->data->bones[i]->name, boneName) == 0) return i; - return -1; -} - -spSlot* spSkeleton_findSlot (const spSkeleton* self, const char* slotName) { - int i; - for (i = 0; i < self->slotsCount; ++i) - if (strcmp(self->data->slots[i]->name, slotName) == 0) return self->slots[i]; - return 0; -} - -int spSkeleton_findSlotIndex (const spSkeleton* self, const char* slotName) { - int i; - for (i = 0; i < self->slotsCount; ++i) - if (strcmp(self->data->slots[i]->name, slotName) == 0) return i; - return -1; -} - -int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) { - spSkin *skin; - if (!skinName) { - spSkeleton_setSkin(self, 0); - return 1; - } - skin = spSkeletonData_findSkin(self->data, skinName); - if (!skin) return 0; - spSkeleton_setSkin(self, skin); - return 1; -} - -void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) { - if (newSkin) { - if (self->skin) - spSkin_attachAll(newSkin, self, self->skin); - else { - /* No previous skin, attach setup pose attachments. */ - int i; - for (i = 0; i < self->slotsCount; ++i) { - spSlot* slot = self->slots[i]; - if (slot->data->attachmentName) { - spAttachment* attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName); - if (attachment) spSlot_setAttachment(slot, attachment); - } - } - } - } - CONST_CAST(spSkin*, self->skin) = newSkin; -} - -spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName) { - int slotIndex = spSkeletonData_findSlotIndex(self->data, slotName); - return spSkeleton_getAttachmentForSlotIndex(self, slotIndex, attachmentName); -} - -spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName) { - if (slotIndex == -1) return 0; - if (self->skin) { - spAttachment *attachment = spSkin_getAttachment(self->skin, slotIndex, attachmentName); - if (attachment) return attachment; - } - if (self->data->defaultSkin) { - spAttachment *attachment = spSkin_getAttachment(self->data->defaultSkin, slotIndex, attachmentName); - if (attachment) return attachment; - } - return 0; -} - -int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName) { - int i; - for (i = 0; i < self->slotsCount; ++i) { - spSlot *slot = self->slots[i]; - if (strcmp(slot->data->name, slotName) == 0) { - if (!attachmentName) - spSlot_setAttachment(slot, 0); - else { - spAttachment* attachment = spSkeleton_getAttachmentForSlotIndex(self, i, attachmentName); - if (!attachment) return 0; - spSlot_setAttachment(slot, attachment); - } - return 1; - } - } - return 0; -} - -spIkConstraint* spSkeleton_findIkConstraint (const spSkeleton* self, const char* constraintName) { - int i; - for (i = 0; i < self->ikConstraintsCount; ++i) - if (strcmp(self->ikConstraints[i]->data->name, constraintName) == 0) return self->ikConstraints[i]; - return 0; -} - -spTransformConstraint* spSkeleton_findTransformConstraint (const spSkeleton* self, const char* constraintName) { - int i; - for (i = 0; i < self->transformConstraintsCount; ++i) - if (strcmp(self->transformConstraints[i]->data->name, constraintName) == 0) return self->transformConstraints[i]; - return 0; -} - -spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self, const char* constraintName) { - int i; - for (i = 0; i < self->pathConstraintsCount; ++i) - if (strcmp(self->pathConstraints[i]->data->name, constraintName) == 0) return self->pathConstraints[i]; - return 0; -} - -void spSkeleton_update (spSkeleton* self, float deltaTime) { - self->time += deltaTime; -} diff --git a/cocos/editor-support/spine/Skeleton.cpp b/cocos/editor-support/spine/Skeleton.cpp new file mode 100644 index 00000000000..c8772d14c17 --- /dev/null +++ b/cocos/editor-support/spine/Skeleton.cpp @@ -0,0 +1,653 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace spine; + +Skeleton::Skeleton(SkeletonData *skeletonData) : + _data(skeletonData), + _skin(NULL), + _color(1, 1, 1, 1), + _time(0), + _scaleX(1), + _scaleY(1), + _x(0), + _y(0) { + _bones.ensureCapacity(_data->getBones().size()); + for (size_t i = 0; i < _data->getBones().size(); ++i) { + BoneData *data = _data->getBones()[i]; + + Bone *bone; + if (data->getParent() == NULL) { + bone = new(__FILE__, __LINE__) Bone(*data, *this, NULL); + } else { + Bone *parent = _bones[data->getParent()->getIndex()]; + bone = new(__FILE__, __LINE__) Bone(*data, *this, parent); + parent->getChildren().add(bone); + } + + _bones.add(bone); + } + + _slots.ensureCapacity(_data->getSlots().size()); + _drawOrder.ensureCapacity(_data->getSlots().size()); + for (size_t i = 0; i < _data->getSlots().size(); ++i) { + SlotData *data = _data->getSlots()[i]; + + Bone *bone = _bones[data->getBoneData().getIndex()]; + Slot *slot = new(__FILE__, __LINE__) Slot(*data, *bone); + + _slots.add(slot); + _drawOrder.add(slot); + } + + _ikConstraints.ensureCapacity(_data->getIkConstraints().size()); + for (size_t i = 0; i < _data->getIkConstraints().size(); ++i) { + IkConstraintData *data = _data->getIkConstraints()[i]; + + IkConstraint *constraint = new(__FILE__, __LINE__) IkConstraint(*data, *this); + + _ikConstraints.add(constraint); + } + + _transformConstraints.ensureCapacity(_data->getTransformConstraints().size()); + for (size_t i = 0; i < _data->getTransformConstraints().size(); ++i) { + TransformConstraintData *data = _data->getTransformConstraints()[i]; + + TransformConstraint *constraint = new(__FILE__, __LINE__) TransformConstraint(*data, *this); + + _transformConstraints.add(constraint); + } + + _pathConstraints.ensureCapacity(_data->getPathConstraints().size()); + for (size_t i = 0; i < _data->getPathConstraints().size(); ++i) { + PathConstraintData *data = _data->getPathConstraints()[i]; + + PathConstraint *constraint = new(__FILE__, __LINE__) PathConstraint(*data, *this); + + _pathConstraints.add(constraint); + } + + updateCache(); +} + +Skeleton::~Skeleton() { + ContainerUtil::cleanUpVectorOfPointers(_bones); + ContainerUtil::cleanUpVectorOfPointers(_slots); + ContainerUtil::cleanUpVectorOfPointers(_ikConstraints); + ContainerUtil::cleanUpVectorOfPointers(_transformConstraints); + ContainerUtil::cleanUpVectorOfPointers(_pathConstraints); +} + +void Skeleton::updateCache() { + _updateCache.clear(); + _updateCacheReset.clear(); + + for (size_t i = 0, n = _bones.size(); i < n; ++i) { + _bones[i]->_sorted = false; + } + + size_t ikCount = _ikConstraints.size(); + size_t transformCount = _transformConstraints.size(); + size_t pathCount = _pathConstraints.size(); + + size_t constraintCount = ikCount + transformCount + pathCount; + + size_t i = 0; + continue_outer: + for (; i < constraintCount; ++i) { + for (size_t ii = 0; ii < ikCount; ++ii) { + IkConstraint *constraint = _ikConstraints[ii]; + if (constraint->getData().getOrder() == i) { + sortIkConstraint(constraint); + i++; + goto continue_outer; + } + } + + for (size_t ii = 0; ii < transformCount; ++ii) { + TransformConstraint *constraint = _transformConstraints[ii]; + if (constraint->getData().getOrder() == (int)i) { + sortTransformConstraint(constraint); + i++; + goto continue_outer; + } + } + + for (size_t ii = 0; ii < pathCount; ++ii) { + PathConstraint *constraint = _pathConstraints[ii]; + if (constraint->getData().getOrder() == (int)i) { + sortPathConstraint(constraint); + i++; + goto continue_outer; + } + } + } + + size_t n = _bones.size(); + for (i = 0; i < n; ++i) { + sortBone(_bones[i]); + } +} + +void Skeleton::printUpdateCache() { + for (size_t i = 0; i < _updateCache.size(); i++) { + Updatable *updatable = _updateCache[i]; + if (updatable->getRTTI().isExactly(Bone::rtti)) { + printf("bone %s\n", ((Bone *) updatable)->getData().getName().buffer()); + } else if (updatable->getRTTI().isExactly(TransformConstraint::rtti)) { + printf("transform constraint %s\n", ((TransformConstraint *) updatable)->getData().getName().buffer()); + } else if (updatable->getRTTI().isExactly(IkConstraint::rtti)) { + printf("ik constraint %s\n", ((IkConstraint *) updatable)->getData().getName().buffer()); + } else if (updatable->getRTTI().isExactly(PathConstraint::rtti)) { + printf("path constraint %s\n", ((PathConstraint *) updatable)->getData().getName().buffer()); + } + } +} + +void Skeleton::updateWorldTransform() { + for (size_t i = 0, n = _updateCacheReset.size(); i < n; ++i) { + Bone *boneP = _updateCacheReset[i]; + Bone &bone = *boneP; + bone._ax = bone._x; + bone._ay = bone._y; + bone._arotation = bone._rotation; + bone._ascaleX = bone._scaleX; + bone._ascaleY = bone._scaleY; + bone._ashearX = bone._shearX; + bone._ashearY = bone._shearY; + bone._appliedValid = true; + } + + for (size_t i = 0, n = _updateCache.size(); i < n; ++i) { + _updateCache[i]->update(); + } +} + +void Skeleton::setToSetupPose() { + setBonesToSetupPose(); + setSlotsToSetupPose(); +} + +void Skeleton::setBonesToSetupPose() { + for (size_t i = 0, n = _bones.size(); i < n; ++i) { + _bones[i]->setToSetupPose(); + } + + for (size_t i = 0, n = _ikConstraints.size(); i < n; ++i) { + IkConstraint *constraintP = _ikConstraints[i]; + IkConstraint &constraint = *constraintP; + + constraint._bendDirection = constraint._data._bendDirection; + constraint._compress = constraint._data._compress; + constraint._stretch = constraint._data._stretch; + constraint._mix = constraint._data._mix; + } + + for (size_t i = 0, n = _transformConstraints.size(); i < n; ++i) { + TransformConstraint *constraintP = _transformConstraints[i]; + TransformConstraint &constraint = *constraintP; + TransformConstraintData &constraintData = constraint._data; + + constraint._rotateMix = constraintData._rotateMix; + constraint._translateMix = constraintData._translateMix; + constraint._scaleMix = constraintData._scaleMix; + constraint._shearMix = constraintData._shearMix; + } + + for (size_t i = 0, n = _pathConstraints.size(); i < n; ++i) { + PathConstraint *constraintP = _pathConstraints[i]; + PathConstraint &constraint = *constraintP; + PathConstraintData &constraintData = constraint._data; + + constraint._position = constraintData._position; + constraint._spacing = constraintData._spacing; + constraint._rotateMix = constraintData._rotateMix; + constraint._translateMix = constraintData._translateMix; + } +} + +void Skeleton::setSlotsToSetupPose() { + _drawOrder.clear(); + for (size_t i = 0, n = _slots.size(); i < n; ++i) { + _drawOrder.add(_slots[i]); + } + + for (size_t i = 0, n = _slots.size(); i < n; ++i) { + _slots[i]->setToSetupPose(); + } +} + +Bone *Skeleton::findBone(const String &boneName) { + return ContainerUtil::findWithDataName(_bones, boneName); +} + +int Skeleton::findBoneIndex(const String &boneName) { + return ContainerUtil::findIndexWithDataName(_bones, boneName); +} + +Slot *Skeleton::findSlot(const String &slotName) { + return ContainerUtil::findWithDataName(_slots, slotName); +} + +int Skeleton::findSlotIndex(const String &slotName) { + return ContainerUtil::findIndexWithDataName(_slots, slotName); +} + +void Skeleton::setSkin(const String &skinName) { + Skin *foundSkin = _data->findSkin(skinName); + + assert(foundSkin != NULL); + + setSkin(foundSkin); +} + +void Skeleton::setSkin(Skin *newSkin) { + if (newSkin != NULL) { + if (_skin != NULL) { + Skeleton &thisRef = *this; + newSkin->attachAll(thisRef, *_skin); + } else { + for (size_t i = 0, n = _slots.size(); i < n; ++i) { + Slot *slotP = _slots[i]; + Slot &slot = *slotP; + const String &name = slot._data.getAttachmentName(); + if (name.length() > 0) { + Attachment *attachment = newSkin->getAttachment(i, name); + if (attachment != NULL) { + slot.setAttachment(attachment); + } + } + } + } + } + + _skin = newSkin; +} + +Attachment *Skeleton::getAttachment(const String &slotName, const String &attachmentName) { + return getAttachment(_data->findSlotIndex(slotName), attachmentName); +} + +Attachment *Skeleton::getAttachment(int slotIndex, const String &attachmentName) { + assert(attachmentName.length() > 0); + + if (_skin != NULL) { + Attachment *attachment = _skin->getAttachment(slotIndex, attachmentName); + if (attachment != NULL) { + return attachment; + } + } + + return _data->getDefaultSkin() != NULL ? _data->getDefaultSkin()->getAttachment(slotIndex, attachmentName) : NULL; +} + +void Skeleton::setAttachment(const String &slotName, const String &attachmentName) { + assert(slotName.length() > 0); + + for (size_t i = 0, n = _slots.size(); i < n; ++i) { + Slot *slot = _slots[i]; + if (slot->_data.getName() == slotName) { + Attachment *attachment = NULL; + if (attachmentName.length() > 0) { + attachment = getAttachment(i, attachmentName); + + assert(attachment != NULL); + } + + slot->setAttachment(attachment); + + return; + } + } + + printf("Slot not found: %s", slotName.buffer()); + + assert(false); +} + +IkConstraint *Skeleton::findIkConstraint(const String &constraintName) { + assert(constraintName.length() > 0); + + for (size_t i = 0, n = _ikConstraints.size(); i < n; ++i) { + IkConstraint *ikConstraint = _ikConstraints[i]; + if (ikConstraint->_data.getName() == constraintName) { + return ikConstraint; + } + } + return NULL; +} + +TransformConstraint *Skeleton::findTransformConstraint(const String &constraintName) { + assert(constraintName.length() > 0); + + for (size_t i = 0, n = _transformConstraints.size(); i < n; ++i) { + TransformConstraint *transformConstraint = _transformConstraints[i]; + if (transformConstraint->_data.getName() == constraintName) { + return transformConstraint; + } + } + + return NULL; +} + +PathConstraint *Skeleton::findPathConstraint(const String &constraintName) { + assert(constraintName.length() > 0); + + for (size_t i = 0, n = _pathConstraints.size(); i < n; ++i) { + PathConstraint *constraint = _pathConstraints[i]; + if (constraint->_data.getName() == constraintName) { + return constraint; + } + } + + return NULL; +} + +void Skeleton::update(float delta) { + _time += delta; +} + +void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector &outVertexBuffer) { + float minX = std::numeric_limits::max(); + float minY = std::numeric_limits::max(); + float maxX = std::numeric_limits::min(); + float maxY = std::numeric_limits::min(); + + for (size_t i = 0; i < _drawOrder.size(); ++i) { + Slot *slot = _drawOrder[i]; + size_t verticesLength = 0; + Attachment *attachment = slot->getAttachment(); + + if (attachment != NULL && attachment->getRTTI().instanceOf(RegionAttachment::rtti)) { + RegionAttachment *regionAttachment = static_cast(attachment); + + verticesLength = 8; + if (outVertexBuffer.size() < 8) { + outVertexBuffer.setSize(8, 0); + } + regionAttachment->computeWorldVertices(slot->getBone(), outVertexBuffer, 0); + } else if (attachment != NULL && attachment->getRTTI().instanceOf(MeshAttachment::rtti)) { + MeshAttachment *mesh = static_cast(attachment); + + verticesLength = mesh->getWorldVerticesLength(); + if (outVertexBuffer.size() < verticesLength) { + outVertexBuffer.setSize(verticesLength, 0); + } + + mesh->computeWorldVertices(*slot, 0, verticesLength, outVertexBuffer, 0); + } + + for (size_t ii = 0; ii < verticesLength; ii += 2) { + float vx = outVertexBuffer[ii]; + float vy = outVertexBuffer[ii + 1]; + + minX = MathUtil::min(minX, vx); + minY = MathUtil::min(minY, vy); + maxX = MathUtil::max(maxX, vx); + maxY = MathUtil::max(maxY, vy); + } + } + + outX = minX; + outY = minY; + outWidth = maxX - minX; + outHeight = maxY - minY; +} + +Bone *Skeleton::getRootBone() { + return _bones.size() == 0 ? NULL : _bones[0]; +} + +SkeletonData *Skeleton::getData() { + return _data; +} + +Vector &Skeleton::getBones() { + return _bones; +} + +Vector &Skeleton::getUpdateCacheList() { + return _updateCache; +} + +Vector &Skeleton::getSlots() { + return _slots; +} + +Vector &Skeleton::getDrawOrder() { + return _drawOrder; +} + +Vector &Skeleton::getIkConstraints() { + return _ikConstraints; +} + +Vector &Skeleton::getPathConstraints() { + return _pathConstraints; +} + +Vector &Skeleton::getTransformConstraints() { + return _transformConstraints; +} + +Skin *Skeleton::getSkin() { + return _skin; +} + +Color &Skeleton::getColor() { + return _color; +} + +float Skeleton::getTime() { + return _time; +} + +void Skeleton::setTime(float inValue) { + _time = inValue; +} + +void Skeleton::setPosition(float x, float y) { + _x = x; + _y = y; +} + +float Skeleton::getX() { + return _x; +} + +void Skeleton::setX(float inValue) { + _x = inValue; +} + +float Skeleton::getY() { + return _y; +} + +void Skeleton::setY(float inValue) { + _y = inValue; +} + +float Skeleton::getScaleX() { + return _scaleX; +} + +void Skeleton::setScaleX(float inValue) { + _scaleX = inValue; +} + +float Skeleton::getScaleY() { + return _scaleY * (Bone::isYDown() ? -1 : 1); +} + +void Skeleton::setScaleY(float inValue) { + _scaleY = inValue; +} + +void Skeleton::sortIkConstraint(IkConstraint *constraint) { + Bone *target = constraint->getTarget(); + sortBone(target); + + Vector &constrained = constraint->getBones(); + Bone *parent = constrained[0]; + sortBone(parent); + + if (constrained.size() > 1) { + Bone *child = constrained[constrained.size() - 1]; + if (!_updateCache.contains(child)) _updateCacheReset.add(child); + } + + _updateCache.add(constraint); + + sortReset(parent->getChildren()); + constrained[constrained.size() - 1]->_sorted = true; +} + +void Skeleton::sortPathConstraint(PathConstraint *constraint) { + Slot *slot = constraint->getTarget(); + int slotIndex = slot->getData().getIndex(); + Bone &slotBone = slot->getBone(); + if (_skin != NULL) sortPathConstraintAttachment(_skin, slotIndex, slotBone); + if (_data->_defaultSkin != NULL && _data->_defaultSkin != _skin) + sortPathConstraintAttachment(_data->_defaultSkin, slotIndex, slotBone); + for (size_t ii = 0, nn = _data->_skins.size(); ii < nn; ii++) + sortPathConstraintAttachment(_data->_skins[ii], slotIndex, slotBone); + + Attachment *attachment = slot->getAttachment(); + if (attachment != NULL && attachment->getRTTI().instanceOf(PathAttachment::rtti)) + sortPathConstraintAttachment(attachment, slotBone); + + Vector &constrained = constraint->getBones(); + size_t boneCount = constrained.size(); + for (size_t i = 0; i < boneCount; ++i) { + sortBone(constrained[i]); + } + + _updateCache.add(constraint); + + for (size_t i = 0; i < boneCount; i++) + sortReset(constrained[i]->getChildren()); + for (size_t i = 0; i < boneCount; i++) + constrained[i]->_sorted = true; +} + +void Skeleton::sortTransformConstraint(TransformConstraint *constraint) { + sortBone(constraint->getTarget()); + + Vector &constrained = constraint->getBones(); + size_t boneCount = constrained.size(); + if (constraint->_data.isLocal()) { + for (size_t i = 0; i < boneCount; i++) { + Bone *child = constrained[i]; + sortBone(child->getParent()); + if (!_updateCache.contains(child)) _updateCacheReset.add(child); + } + } else { + for (size_t i = 0; i < boneCount; ++i) { + sortBone(constrained[i]); + } + } + + _updateCache.add(constraint); + + for (size_t i = 0; i < boneCount; ++i) + sortReset(constrained[i]->getChildren()); + for (size_t i = 0; i < boneCount; ++i) + constrained[i]->_sorted = true; +} + +void Skeleton::sortPathConstraintAttachment(Skin *skin, size_t slotIndex, Bone &slotBone) { + Skin::AttachmentMap::Entries attachments = skin->getAttachments(); + + while (attachments.hasNext()) { + Skin::AttachmentMap::Entry entry = attachments.next(); + if (entry._slotIndex == slotIndex) { + Attachment *value = entry._attachment; + sortPathConstraintAttachment(value, slotBone); + } + } +} + +void Skeleton::sortPathConstraintAttachment(Attachment *attachment, Bone &slotBone) { + if (attachment == NULL || !attachment->getRTTI().instanceOf(PathAttachment::rtti)) return; + Vector &pathBones = static_cast(attachment)->getBones(); + if (pathBones.size() == 0) + sortBone(&slotBone); + else { + for (size_t i = 0, n = pathBones.size(); i < n;) { + size_t nn = pathBones[i++]; + nn += i; + while (i < nn) { + sortBone(_bones[pathBones[i++]]); + } + } + } +} + +void Skeleton::sortBone(Bone *bone) { + if (bone->_sorted) return; + Bone *parent = bone->_parent; + if (parent != NULL) sortBone(parent); + bone->_sorted = true; + _updateCache.add(bone); +} + +void Skeleton::sortReset(Vector &bones) { + for (size_t i = 0, n = bones.size(); i < n; ++i) { + Bone *bone = bones[i]; + if (bone->_sorted) sortReset(bone->getChildren()); + bone->_sorted = false; + } +} diff --git a/cocos/editor-support/spine/Skeleton.h b/cocos/editor-support/spine/Skeleton.h index 0df9fe07662..7e33eda116d 100644 --- a/cocos/editor-support/spine/Skeleton.h +++ b/cocos/editor-support/spine/Skeleton.h @@ -1,174 +1,247 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SKELETON_H_ -#define SPINE_SKELETON_H_ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spSkeleton { - spSkeletonData* const data; - - int bonesCount; - spBone** bones; - spBone* const root; - - int slotsCount; - spSlot** slots; - spSlot** drawOrder; - - int ikConstraintsCount; - spIkConstraint** ikConstraints; - - int transformConstraintsCount; - spTransformConstraint** transformConstraints; - - int pathConstraintsCount; - spPathConstraint** pathConstraints; - - spSkin* const skin; - spColor color; - float time; - int/*bool*/flipX, flipY; - float x, y; - -#ifdef __cplusplus - spSkeleton() : - data(0), - bonesCount(0), - bones(0), - root(0), - slotsCount(0), - slots(0), - drawOrder(0), - - ikConstraintsCount(0), - ikConstraints(0), - - transformConstraintsCount(0), - transformConstraints(0), - - skin(0), - color(), - time(0), - flipX(0), - flipY(0), - x(0), y(0) { - } -#endif -} spSkeleton; - -SP_API spSkeleton* spSkeleton_create (spSkeletonData* data); -SP_API void spSkeleton_dispose (spSkeleton* self); - -/* Caches information about bones and constraints. Must be called if bones or constraints, or weighted path attachments - * are added or removed. */ -SP_API void spSkeleton_updateCache (spSkeleton* self); -SP_API void spSkeleton_updateWorldTransform (const spSkeleton* self); - -/* Sets the bones, constraints, and slots to their setup pose values. */ -SP_API void spSkeleton_setToSetupPose (const spSkeleton* self); -/* Sets the bones and constraints to their setup pose values. */ -SP_API void spSkeleton_setBonesToSetupPose (const spSkeleton* self); -SP_API void spSkeleton_setSlotsToSetupPose (const spSkeleton* self); - -/* Returns 0 if the bone was not found. */ -SP_API spBone* spSkeleton_findBone (const spSkeleton* self, const char* boneName); -/* Returns -1 if the bone was not found. */ -SP_API int spSkeleton_findBoneIndex (const spSkeleton* self, const char* boneName); - -/* Returns 0 if the slot was not found. */ -SP_API spSlot* spSkeleton_findSlot (const spSkeleton* self, const char* slotName); -/* Returns -1 if the slot was not found. */ -SP_API int spSkeleton_findSlotIndex (const spSkeleton* self, const char* slotName); - -/* Sets the skin used to look up attachments before looking in the SkeletonData defaultSkin. Attachments from the new skin are - * attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode - * attachment is attached from the new skin. - * @param skin May be 0.*/ -SP_API void spSkeleton_setSkin (spSkeleton* self, spSkin* skin); -/* Returns 0 if the skin was not found. See spSkeleton_setSkin. - * @param skinName May be 0. */ -SP_API int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName); - -/* Returns 0 if the slot or attachment was not found. */ -SP_API spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName); -/* Returns 0 if the slot or attachment was not found. */ -SP_API spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName); -/* Returns 0 if the slot or attachment was not found. - * @param attachmentName May be 0. */ -SP_API int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName); - -/* Returns 0 if the IK constraint was not found. */ -SP_API spIkConstraint* spSkeleton_findIkConstraint (const spSkeleton* self, const char* constraintName); - -/* Returns 0 if the transform constraint was not found. */ -SP_API spTransformConstraint* spSkeleton_findTransformConstraint (const spSkeleton* self, const char* constraintName); - -/* Returns 0 if the path constraint was not found. */ -SP_API spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self, const char* constraintName); - -SP_API void spSkeleton_update (spSkeleton* self, float deltaTime); - -#ifdef SPINE_SHORT_NAMES -typedef spSkeleton Skeleton; -#define Skeleton_create(...) spSkeleton_create(__VA_ARGS__) -#define Skeleton_dispose(...) spSkeleton_dispose(__VA_ARGS__) -#define Skeleton_updateWorldTransform(...) spSkeleton_updateWorldTransform(__VA_ARGS__) -#define Skeleton_setToSetupPose(...) spSkeleton_setToSetupPose(__VA_ARGS__) -#define Skeleton_setBonesToSetupPose(...) spSkeleton_setBonesToSetupPose(__VA_ARGS__) -#define Skeleton_setSlotsToSetupPose(...) spSkeleton_setSlotsToSetupPose(__VA_ARGS__) -#define Skeleton_findBone(...) spSkeleton_findBone(__VA_ARGS__) -#define Skeleton_findBoneIndex(...) spSkeleton_findBoneIndex(__VA_ARGS__) -#define Skeleton_findSlot(...) spSkeleton_findSlot(__VA_ARGS__) -#define Skeleton_findSlotIndex(...) spSkeleton_findSlotIndex(__VA_ARGS__) -#define Skeleton_setSkin(...) spSkeleton_setSkin(__VA_ARGS__) -#define Skeleton_setSkinByName(...) spSkeleton_setSkinByName(__VA_ARGS__) -#define Skeleton_getAttachmentForSlotName(...) spSkeleton_getAttachmentForSlotName(__VA_ARGS__) -#define Skeleton_getAttachmentForSlotIndex(...) spSkeleton_getAttachmentForSlotIndex(__VA_ARGS__) -#define Skeleton_setAttachment(...) spSkeleton_setAttachment(__VA_ARGS__) -#define Skeleton_update(...) spSkeleton_update(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SKELETON_H_*/ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Skeleton_h +#define Spine_Skeleton_h + +#include +#include +#include +#include +#include + +#include // std::numeric_limits + +namespace spine { +class SkeletonData; + +class Bone; + +class Updatable; + +class Slot; + +class IkConstraint; + +class PathConstraint; + +class TransformConstraint; + +class Skin; + +class Attachment; + +class SP_API Skeleton : public SpineObject { + friend class AnimationState; + + friend class SkeletonBounds; + + friend class SkeletonClipping; + + friend class AttachmentTimeline; + + friend class ColorTimeline; + + friend class DeformTimeline; + + friend class DrawOrderTimeline; + + friend class EventTimeline; + + friend class IkConstraintTimeline; + + friend class PathConstraintMixTimeline; + + friend class PathConstraintPositionTimeline; + + friend class PathConstraintSpacingTimeline; + + friend class ScaleTimeline; + + friend class ShearTimeline; + + friend class TransformConstraintTimeline; + + friend class TranslateTimeline; + + friend class TwoColorTimeline; + +public: + explicit Skeleton(SkeletonData *skeletonData); + + ~Skeleton(); + + /// Caches information about bones and constraints. Must be called if bones, constraints or weighted path attachments are added + /// or removed. + void updateCache(); + + void printUpdateCache(); + + /// Updates the world transform for each bone and applies constraints. + void updateWorldTransform(); + + /// Sets the bones, constraints, and slots to their setup pose values. + void setToSetupPose(); + + /// Sets the bones and constraints to their setup pose values. + void setBonesToSetupPose(); + + void setSlotsToSetupPose(); + + /// @return May be NULL. + Bone *findBone(const String &boneName); + + /// @return -1 if the bone was not found. + int findBoneIndex(const String &boneName); + + /// @return May be NULL. + Slot *findSlot(const String &slotName); + + /// @return -1 if the bone was not found. + int findSlotIndex(const String &slotName); + + /// Sets a skin by name (see setSkin). + void setSkin(const String &skinName); + + /// Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. + /// If there was no old skin, each slot's setup mode attachment is attached from the new skin. + /// After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling + /// See Skeleton::setSlotsToSetupPose() + /// Also, often AnimationState::apply(Skeleton&) is called before the next time the + /// skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin. + /// + /// @param newSkin May be NULL. + void setSkin(Skin *newSkin); + + /// @return May be NULL. + Attachment *getAttachment(const String &slotName, const String &attachmentName); + + /// @return May be NULL. + Attachment *getAttachment(int slotIndex, const String &attachmentName); + + /// @param attachmentName May be empty. + void setAttachment(const String &slotName, const String &attachmentName); + + /// @return May be NULL. + IkConstraint *findIkConstraint(const String &constraintName); + + /// @return May be NULL. + TransformConstraint *findTransformConstraint(const String &constraintName); + + /// @return May be NULL. + PathConstraint *findPathConstraint(const String &constraintName); + + void update(float delta); + + /// Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. + /// @param outX The horizontal distance between the skeleton origin and the left side of the AABB. + /// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB. + /// @param outWidth The width of the AABB + /// @param outHeight The height of the AABB. + /// @param outVertexBuffer Reference to hold a Vector of floats. This method will assign it with new floats as needed. + void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector &outVertexBuffer); + + Bone *getRootBone(); + + SkeletonData *getData(); + + Vector &getBones(); + + Vector &getUpdateCacheList(); + + Vector &getSlots(); + + Vector &getDrawOrder(); + + Vector &getIkConstraints(); + + Vector &getPathConstraints(); + + Vector &getTransformConstraints(); + + Skin *getSkin(); + + Color &getColor(); + + float getTime(); + + void setTime(float inValue); + + void setPosition(float x, float y); + + float getX(); + + void setX(float inValue); + + float getY(); + + void setY(float inValue); + + float getScaleX(); + + void setScaleX(float inValue); + + float getScaleY(); + + void setScaleY(float inValue); + +private: + SkeletonData *_data; + Vector _bones; + Vector _slots; + Vector _drawOrder; + Vector _ikConstraints; + Vector _transformConstraints; + Vector _pathConstraints; + Vector _updateCache; + Vector _updateCacheReset; + Skin *_skin; + Color _color; + float _time; + float _scaleX, _scaleY; + float _x, _y; + + void sortIkConstraint(IkConstraint *constraint); + + void sortPathConstraint(PathConstraint *constraint); + + void sortTransformConstraint(TransformConstraint *constraint); + + void sortPathConstraintAttachment(Skin *skin, size_t slotIndex, Bone &slotBone); + + void sortPathConstraintAttachment(Attachment *attachment, Bone &slotBone); + + void sortBone(Bone *bone); + + static void sortReset(Vector &bones); +}; +} + +#endif /* Spine_Skeleton_h */ diff --git a/cocos/editor-support/spine/SkeletonBinary.c b/cocos/editor-support/spine/SkeletonBinary.c deleted file mode 100644 index a753b48ca7a..00000000000 --- a/cocos/editor-support/spine/SkeletonBinary.c +++ /dev/null @@ -1,1095 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include "kvec.h" - -typedef struct { - const unsigned char* cursor; - const unsigned char* end; -} _dataInput; - -typedef struct { - const char* parent; - const char* skin; - int slotIndex; - spMeshAttachment* mesh; -} _spLinkedMesh; - -typedef struct { - spSkeletonBinary super; - int ownsLoader; - - int linkedMeshCount; - int linkedMeshCapacity; - _spLinkedMesh* linkedMeshes; -} _spSkeletonBinary; - -spSkeletonBinary* spSkeletonBinary_createWithLoader (spAttachmentLoader* attachmentLoader) { - spSkeletonBinary* self = SUPER(NEW(_spSkeletonBinary)); - self->scale = 1; - self->attachmentLoader = attachmentLoader; - return self; -} - -spSkeletonBinary* spSkeletonBinary_create (spAtlas* atlas) { - spAtlasAttachmentLoader* attachmentLoader = spAtlasAttachmentLoader_create(atlas); - spSkeletonBinary* self = spSkeletonBinary_createWithLoader(SUPER(attachmentLoader)); - SUB_CAST(_spSkeletonBinary, self)->ownsLoader = 1; - return self; -} - -void spSkeletonBinary_dispose (spSkeletonBinary* self) { - int i; - _spSkeletonBinary* internal = SUB_CAST(_spSkeletonBinary, self); - if (internal->ownsLoader) spAttachmentLoader_dispose(self->attachmentLoader); - for (i = 0; i < internal->linkedMeshCount; ++i) { - FREE(internal->linkedMeshes[i].parent); - FREE(internal->linkedMeshes[i].skin); - } - FREE(internal->linkedMeshes); - FREE(self->error); - FREE(self); -} - -void _spSkeletonBinary_setError (spSkeletonBinary* self, const char* value1, const char* value2) { - char message[256]; - int length; - FREE(self->error); - strcpy(message, value1); - length = (int)strlen(value1); - if (value2) strncat(message + length, value2, 255 - length); - MALLOC_STR(self->error, message); -} - -static unsigned char readByte (_dataInput* input) { - return *input->cursor++; -} - -static signed char readSByte (_dataInput* input) { - return (signed char)readByte(input); -} - -static int readBoolean (_dataInput* input) { - return readByte(input) != 0; -} - -static int readInt (_dataInput* input) { - int result = readByte(input); - result <<= 8; - result |= readByte(input); - result <<= 8; - result |= readByte(input); - result <<= 8; - result |= readByte(input); - return result; -} - -static int readVarint (_dataInput* input, int/*bool*/optimizePositive) { - unsigned char b = readByte(input); - int value = b & 0x7F; - if (b & 0x80) { - b = readByte(input); - value |= (b & 0x7F) << 7; - if (b & 0x80) { - b = readByte(input); - value |= (b & 0x7F) << 14; - if (b & 0x80) { - b = readByte(input); - value |= (b & 0x7F) << 21; - if (b & 0x80) value |= (readByte(input) & 0x7F) << 28; - } - } - } - if (!optimizePositive) value = (((unsigned int)value >> 1) ^ -(value & 1)); - return value; -} - -float readFloat (_dataInput* input) { - union { - int intValue; - float floatValue; - } intToFloat; - intToFloat.intValue = readInt(input); - return intToFloat.floatValue; -} - -char* readString (_dataInput* input) { - int length = readVarint(input, 1); - char* string; - if (length == 0) { - return 0; - } - string = MALLOC(char, length); - memcpy(string, input->cursor, length - 1); - input->cursor += length - 1; - string[length - 1] = '\0'; - return string; -} - -static void readColor (_dataInput* input, float *r, float *g, float *b, float *a) { - *r = readByte(input) / 255.0f; - *g = readByte(input) / 255.0f; - *b = readByte(input) / 255.0f; - *a = readByte(input) / 255.0f; -} - -#define ATTACHMENT_REGION 0 -#define ATTACHMENT_BOUNDING_BOX 1 -#define ATTACHMENT_MESH 2 -#define ATTACHMENT_LINKED_MESH 3 -#define ATTACHMENT_PATH 4 - -#define BLEND_MODE_NORMAL 0 -#define BLEND_MODE_ADDITIVE 1 -#define BLEND_MODE_MULTIPLY 2 -#define BLEND_MODE_SCREEN 3 - -#define CURVE_LINEAR 0 -#define CURVE_STEPPED 1 -#define CURVE_BEZIER 2 - -#define BONE_ROTATE 0 -#define BONE_TRANSLATE 1 -#define BONE_SCALE 2 -#define BONE_SHEAR 3 - -#define SLOT_ATTACHMENT 0 -#define SLOT_COLOR 1 -#define SLOT_TWO_COLOR 2 - -#define PATH_POSITION 0 -#define PATH_SPACING 1 -#define PATH_MIX 2 - -#define PATH_POSITION_FIXED 0 -#define PATH_POSITION_PERCENT 1 - -#define PATH_SPACING_LENGTH 0 -#define PATH_SPACING_FIXED 1 -#define PATH_SPACING_PERCENT 2 - -#define PATH_ROTATE_TANGENT 0 -#define PATH_ROTATE_CHAIN 1 -#define PATH_ROTATE_CHAIN_SCALE 2 - -static void readCurve (_dataInput* input, spCurveTimeline* timeline, int frameIndex) { - switch (readByte(input)) { - case CURVE_STEPPED: { - spCurveTimeline_setStepped(timeline, frameIndex); - break; - } - case CURVE_BEZIER: { - float cx1 = readFloat(input); - float cy1 = readFloat(input); - float cx2 = readFloat(input); - float cy2 = readFloat(input); - spCurveTimeline_setCurve(timeline, frameIndex, cx1, cy1, cx2, cy2); - break; - } - } -} - -static void _spSkeletonBinary_addLinkedMesh (spSkeletonBinary* self, spMeshAttachment* mesh, - const char* skin, int slotIndex, const char* parent) { - _spLinkedMesh* linkedMesh; - _spSkeletonBinary* internal = SUB_CAST(_spSkeletonBinary, self); - - if (internal->linkedMeshCount == internal->linkedMeshCapacity) { - _spLinkedMesh* linkedMeshes; - internal->linkedMeshCapacity *= 2; - if (internal->linkedMeshCapacity < 8) internal->linkedMeshCapacity = 8; - /* TODO Why not realloc? */ - linkedMeshes = MALLOC(_spLinkedMesh, internal->linkedMeshCapacity); - memcpy(linkedMeshes, internal->linkedMeshes, sizeof(_spLinkedMesh) * internal->linkedMeshCount); - FREE(internal->linkedMeshes); - internal->linkedMeshes = linkedMeshes; - } - - linkedMesh = internal->linkedMeshes + internal->linkedMeshCount++; - linkedMesh->mesh = mesh; - linkedMesh->skin = skin; - linkedMesh->slotIndex = slotIndex; - linkedMesh->parent = parent; -} - -static spAnimation* _spSkeletonBinary_readAnimation (spSkeletonBinary* self, const char* name, - _dataInput* input, spSkeletonData *skeletonData) { - kvec_t(spTimeline*) timelines; - float duration = 0; - int i, n, ii, nn, iii, nnn; - int frameIndex; - int drawOrderCount, eventCount; - spAnimation* animation; - - kv_init(timelines); - - /* Slot timelines. */ - for (i = 0, n = readVarint(input, 1); i < n; ++i) { - int slotIndex = readVarint(input, 1); - for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) { - unsigned char timelineType = readByte(input); - int frameCount = readVarint(input, 1); - switch (timelineType) { - case SLOT_ATTACHMENT: { - spAttachmentTimeline* timeline = spAttachmentTimeline_create(frameCount); - timeline->slotIndex = slotIndex; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - const char* attachmentName = readString(input); - /* TODO Avoid copying of attachmentName inside */ - spAttachmentTimeline_setFrame(timeline, frameIndex, time, attachmentName); - FREE(attachmentName); - } - kv_push(spTimeline*, timelines, SUPER(timeline)); - duration = MAX(duration, timeline->frames[frameCount - 1]); - break; - } - case SLOT_COLOR: { - spColorTimeline* timeline = spColorTimeline_create(frameCount); - timeline->slotIndex = slotIndex; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float r, g, b, a; - readColor(input, &r, &g, &b, &a); - spColorTimeline_setFrame(timeline, frameIndex, time, r, g, b, a); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * COLOR_ENTRIES]); - break; - } - case SLOT_TWO_COLOR: { - spTwoColorTimeline* timeline = spTwoColorTimeline_create(frameCount); - timeline->slotIndex = slotIndex; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float r, g, b, a; - float r2, g2, b2, a2; - readColor(input, &r, &g, &b, &a); - readColor(input, &a2, &r2, &g2, &b2); - spTwoColorTimeline_setFrame(timeline, frameIndex, time, r, g, b, a, r2, g2, b2); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * TWOCOLOR_ENTRIES]); - break; - } - default: { - int i; - for (i = 0; i < kv_size(timelines); ++i) - spTimeline_dispose(kv_A(timelines, i)); - kv_destroy(timelines); - _spSkeletonBinary_setError(self, "Invalid timeline type for a slot: ", skeletonData->slots[slotIndex]->name); - return 0; - } - } - } - } - - /* Bone timelines. */ - for (i = 0, n = readVarint(input, 1); i < n; ++i) { - int boneIndex = readVarint(input, 1); - for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) { - unsigned char timelineType = readByte(input); - int frameCount = readVarint(input, 1); - switch (timelineType) { - case BONE_ROTATE: { - spRotateTimeline *timeline = spRotateTimeline_create(frameCount); - timeline->boneIndex = boneIndex; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float degrees = readFloat(input); - spRotateTimeline_setFrame(timeline, frameIndex, time, degrees); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * ROTATE_ENTRIES]); - break; - } - case BONE_TRANSLATE: - case BONE_SCALE: - case BONE_SHEAR: { - float timelineScale = 1; - spTranslateTimeline *timeline = 0; - switch (timelineType) { - case BONE_SCALE: - timeline = spScaleTimeline_create(frameCount); - break; - case BONE_SHEAR: - timeline = spShearTimeline_create(frameCount); - break; - case BONE_TRANSLATE: - timeline = spTranslateTimeline_create(frameCount); - timelineScale = self->scale; - break; - default: - break; - } - timeline->boneIndex = boneIndex; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float x = readFloat(input) * timelineScale; - float y = readFloat(input) * timelineScale; - spTranslateTimeline_setFrame(timeline, frameIndex, time, x, y); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER_CAST(spTimeline, timeline)); - duration = MAX(duration, timeline->frames[(frameCount - 1) * TRANSLATE_ENTRIES]); - break; - } - default: { - int i; - for (i = 0; i < kv_size(timelines); ++i) - spTimeline_dispose(kv_A(timelines, i)); - kv_destroy(timelines); - _spSkeletonBinary_setError(self, "Invalid timeline type for a bone: ", skeletonData->bones[boneIndex]->name); - return 0; - } - } - } - } - - /* IK constraint timelines. */ - for (i = 0, n = readVarint(input, 1); i < n; ++i) { - int index = readVarint(input, 1); - int frameCount = readVarint(input, 1); - spIkConstraintTimeline* timeline = spIkConstraintTimeline_create(frameCount); - timeline->ikConstraintIndex = index; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float mix = readFloat(input); - signed char bendDirection = readSByte(input); - spIkConstraintTimeline_setFrame(timeline, frameIndex, time, mix, bendDirection); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * IKCONSTRAINT_ENTRIES]); - } - - /* Transform constraint timelines. */ - for (i = 0, n = readVarint(input, 1); i < n; ++i) { - int index = readVarint(input, 1); - int frameCount = readVarint(input, 1); - spTransformConstraintTimeline* timeline = spTransformConstraintTimeline_create(frameCount); - timeline->transformConstraintIndex = index; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float rotateMix = readFloat(input); - float translateMix = readFloat(input); - float scaleMix = readFloat(input); - float shearMix = readFloat(input); - spTransformConstraintTimeline_setFrame(timeline, frameIndex, time, rotateMix, translateMix, - scaleMix, shearMix); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * TRANSFORMCONSTRAINT_ENTRIES]); - } - - /* Path constraint timelines. */ - for (i = 0, n = readVarint(input, 1); i < n; ++i) { - int index = readVarint(input, 1); - spPathConstraintData* data = skeletonData->pathConstraints[index]; - for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) { - unsigned char timelineType = readByte(input); - int frameCount = readVarint(input, 1); - switch (timelineType) { - case PATH_POSITION: - case PATH_SPACING: { - spPathConstraintPositionTimeline* timeline = 0; - float timelineScale = 1; - if (timelineType == PATH_SPACING) { - timeline = (spPathConstraintPositionTimeline*)spPathConstraintSpacingTimeline_create(frameCount); - if (data->spacingMode == SP_SPACING_MODE_LENGTH || data->spacingMode == SP_SPACING_MODE_FIXED) - timelineScale = self->scale; - } else { - timeline = spPathConstraintPositionTimeline_create(frameCount); - if (data->positionMode == SP_POSITION_MODE_FIXED) - timelineScale = self->scale; - } - timeline->pathConstraintIndex = index; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float value = readFloat(input) * timelineScale; - spPathConstraintPositionTimeline_setFrame(timeline, frameIndex, time, value); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * PATHCONSTRAINTPOSITION_ENTRIES]); - break; - } - case PATH_MIX: { - spPathConstraintMixTimeline* timeline = spPathConstraintMixTimeline_create(frameCount); - timeline->pathConstraintIndex = index; - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float rotateMix = readFloat(input); - float translateMix = readFloat(input); - spPathConstraintMixTimeline_setFrame(timeline, frameIndex, time, rotateMix, translateMix); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[(frameCount - 1) * PATHCONSTRAINTMIX_ENTRIES]); - } - } - } - } - - /* Deform timelines. */ - for (i = 0, n = readVarint(input, 1); i < n; ++i) { - spSkin* skin = skeletonData->skins[readVarint(input, 1)]; - for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) { - int slotIndex = readVarint(input, 1); - for (iii = 0, nnn = readVarint(input, 1); iii < nnn; ++iii) { - float* tempDeform; - spDeformTimeline *timeline; - int weighted, deformLength; - const char* attachmentName = readString(input); - int frameCount; - - spVertexAttachment* attachment = SUB_CAST(spVertexAttachment, - spSkin_getAttachment(skin, slotIndex, attachmentName)); - if (!attachment) { - int i; - for (i = 0; i < kv_size(timelines); ++i) - spTimeline_dispose(kv_A(timelines, i)); - kv_destroy(timelines); - _spSkeletonBinary_setError(self, "Attachment not found: ", attachmentName); - FREE(attachmentName); - return 0; - } - FREE(attachmentName); - - weighted = attachment->bones != 0; - deformLength = weighted ? attachment->verticesCount / 3 * 2 : attachment->verticesCount; - tempDeform = MALLOC(float, deformLength); - - frameCount = readVarint(input, 1); - timeline = spDeformTimeline_create(frameCount, deformLength); - timeline->slotIndex = slotIndex; - timeline->attachment = SUPER(attachment); - - for (frameIndex = 0; frameIndex < frameCount; ++frameIndex) { - float time = readFloat(input); - float* deform; - int end = readVarint(input, 1); - if (!end) { - if (weighted) { - deform = tempDeform; - memset(deform, 0, sizeof(float) * deformLength); - } else - deform = attachment->vertices; - } else { - int v, start = readVarint(input, 1); - deform = tempDeform; - memset(deform, 0, sizeof(float) * start); - end += start; - if (self->scale == 1) { - for (v = start; v < end; ++v) - deform[v] = readFloat(input); - } else { - for (v = start; v < end; ++v) - deform[v] = readFloat(input) * self->scale; - } - memset(deform + v, 0, sizeof(float) * (deformLength - v)); - if (!weighted) { - float* vertices = attachment->vertices; - for (v = 0; v < deformLength; ++v) - deform[v] += vertices[v]; - } - } - spDeformTimeline_setFrame(timeline, frameIndex, time, deform); - if (frameIndex < frameCount - 1) readCurve(input, SUPER(timeline), frameIndex); - } - FREE(tempDeform); - - kv_push(spTimeline*, timelines, SUPER(SUPER(timeline))); - duration = MAX(duration, timeline->frames[frameCount - 1]); - } - } - } - - /* Draw order timeline. */ - drawOrderCount = readVarint(input, 1); - if (drawOrderCount) { - spDrawOrderTimeline* timeline = spDrawOrderTimeline_create(drawOrderCount, skeletonData->slotsCount); - for (i = 0; i < drawOrderCount; ++i) { - float time = readFloat(input); - int offsetCount = readVarint(input, 1); - int* drawOrder = MALLOC(int, skeletonData->slotsCount); - int* unchanged = MALLOC(int, skeletonData->slotsCount - offsetCount); - int originalIndex = 0, unchangedIndex = 0; - memset(drawOrder, -1, sizeof(int) * skeletonData->slotsCount); - for (ii = 0; ii < offsetCount; ++ii) { - int slotIndex = readVarint(input, 1); - /* Collect unchanged items. */ - while (originalIndex != slotIndex) - unchanged[unchangedIndex++] = originalIndex++; - /* Set changed items. */ - drawOrder[originalIndex + readVarint(input, 1)] = originalIndex; - ++originalIndex; - } - /* Collect remaining unchanged items. */ - while (originalIndex < skeletonData->slotsCount) - unchanged[unchangedIndex++] = originalIndex++; - /* Fill in unchanged items. */ - for (ii = skeletonData->slotsCount - 1; ii >= 0; ii--) - if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex]; - FREE(unchanged); - /* TODO Avoid copying of drawOrder inside */ - spDrawOrderTimeline_setFrame(timeline, i, time, drawOrder); - FREE(drawOrder); - } - kv_push(spTimeline*, timelines, SUPER(timeline)); - duration = MAX(duration, timeline->frames[drawOrderCount - 1]); - } - - /* Event timeline. */ - eventCount = readVarint(input, 1); - if (eventCount) { - spEventTimeline* timeline = spEventTimeline_create(eventCount); - for (i = 0; i < eventCount; ++i) { - float time = readFloat(input); - spEventData* eventData = skeletonData->events[readVarint(input, 1)]; - spEvent* event = spEvent_create(time, eventData); - event->intValue = readVarint(input, 0); - event->floatValue = readFloat(input); - if (readBoolean(input)) - event->stringValue = readString(input); - else - MALLOC_STR(event->stringValue, eventData->stringValue); - spEventTimeline_setFrame(timeline, i, event); - } - kv_push(spTimeline*, timelines, SUPER(timeline)); - duration = MAX(duration, timeline->frames[eventCount - 1]); - } - - kv_trim(spTimeline*, timelines); - - animation = spAnimation_create(name, 0); - FREE(animation->timelines); - animation->duration = duration; - animation->timelinesCount = kv_size(timelines); - animation->timelines = kv_array(timelines); - return animation; -} - -static float* _readFloatArray(_dataInput *input, int n, float scale) { - float* array = MALLOC(float, n); - int i; - if (scale == 1) - for (i = 0; i < n; ++i) - array[i] = readFloat(input); - else - for (i = 0; i < n; ++i) - array[i] = readFloat(input) * scale; - return array; -} - -static short* _readShortArray(_dataInput *input, int *length) { - int n = readVarint(input, 1); - short* array = MALLOC(short, n); - int i; - *length = n; - for (i = 0; i < n; ++i) { - array[i] = readByte(input) << 8; - array[i] |= readByte(input); - } - return array; -} - -static void _readVertices(spSkeletonBinary* self, _dataInput* input, spVertexAttachment* attachment, - int vertexCount) { - int i, ii; - int verticesLength = vertexCount << 1; - kvec_t(float) weights; - kvec_t(int) bones; - - attachment->worldVerticesLength = verticesLength; - - if (!readBoolean(input)) { - attachment->verticesCount = verticesLength; - attachment->vertices = _readFloatArray(input, verticesLength, self->scale); - attachment->bonesCount = 0; - attachment->bones = 0; - return; - } - - kv_init(weights); - kv_resize(float, weights, verticesLength * 3 * 3); - - kv_init(bones); - kv_resize(int, bones, verticesLength * 3); - - for (i = 0; i < vertexCount; ++i) { - int boneCount = readVarint(input, 1); - kv_push(int, bones, boneCount); - for (ii = 0; ii < boneCount; ++ii) { - kv_push(int, bones, readVarint(input, 1)); - kv_push(float, weights, readFloat(input) * self->scale); - kv_push(float, weights, readFloat(input) * self->scale); - kv_push(float, weights, readFloat(input)); - } - } - - kv_trim(float, weights); - attachment->verticesCount = kv_size(weights); - attachment->vertices = kv_array(weights); - - kv_trim(int, bones); - attachment->bonesCount = kv_size(bones); - attachment->bones = kv_array(bones); -} - -spAttachment* spSkeletonBinary_readAttachment(spSkeletonBinary* self, _dataInput* input, - spSkin* skin, int slotIndex, const char* attachmentName, spSkeletonData* skeletonData, int/*bool*/ nonessential) { - int i; - spAttachmentType type; - const char* name = readString(input); - int freeName = name != 0; - if (!name) { - freeName = 0; - name = attachmentName; - } - - type = (spAttachmentType)readByte(input); - - switch (type) { - case SP_ATTACHMENT_REGION: { - const char* path = readString(input); - spAttachment* attachment; - spRegionAttachment* region; - if (!path) MALLOC_STR(path, name); - attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path); - region = SUB_CAST(spRegionAttachment, attachment); - region->path = path; - region->rotation = readFloat(input); - region->x = readFloat(input) * self->scale; - region->y = readFloat(input) * self->scale; - region->scaleX = readFloat(input); - region->scaleY = readFloat(input); - region->width = readFloat(input) * self->scale; - region->height = readFloat(input) * self->scale; - readColor(input, ®ion->color.r, ®ion->color.g, ®ion->color.b, ®ion->color.a); - spRegionAttachment_updateOffset(region); - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - if (freeName) FREE(name); - return attachment; - } - case SP_ATTACHMENT_BOUNDING_BOX: { - int vertexCount = readVarint(input, 1); - spAttachment* attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0); - _readVertices(self, input, SUB_CAST(spVertexAttachment, attachment), vertexCount); - if (nonessential) readInt(input); /* Skip color. */ - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - if (freeName) FREE(name); - return attachment; - } - case SP_ATTACHMENT_MESH: { - int vertexCount; - spAttachment* attachment; - spMeshAttachment* mesh; - const char* path = readString(input); - if (!path) MALLOC_STR(path, name); - attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path); - mesh = SUB_CAST(spMeshAttachment, attachment); - mesh->path = path; - readColor(input, &mesh->color.r, &mesh->color.g, &mesh->color.b, &mesh->color.a); - vertexCount = readVarint(input, 1); - mesh->regionUVs = _readFloatArray(input, vertexCount << 1, 1); - mesh->triangles = (unsigned short*)_readShortArray(input, &mesh->trianglesCount); - _readVertices(self, input, SUPER(mesh), vertexCount); - spMeshAttachment_updateUVs(mesh); - mesh->hullLength = readVarint(input, 1) << 1; - if (nonessential) { - mesh->edges = (int*)_readShortArray(input, &mesh->edgesCount); - mesh->width = readFloat(input) * self->scale; - mesh->height = readFloat(input) * self->scale; - } else { - mesh->edges = 0; - mesh->width = 0; - mesh->height = 0; - } - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - if (freeName) FREE(name); - return attachment; - } - case SP_ATTACHMENT_LINKED_MESH: { - const char* skinName; - const char* parent; - spAttachment* attachment; - spMeshAttachment* mesh; - const char* path = readString(input); - if (!path) MALLOC_STR(path, name); - attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path); - mesh = SUB_CAST(spMeshAttachment, attachment); - mesh->path = path; - readColor(input, &mesh->color.r, &mesh->color.g, &mesh->color.b, &mesh->color.a); - skinName = readString(input); - parent = readString(input); - mesh->inheritDeform = readBoolean(input); - if (nonessential) { - mesh->width = readFloat(input) * self->scale; - mesh->height = readFloat(input) * self->scale; - } - _spSkeletonBinary_addLinkedMesh(self, mesh, skinName, slotIndex, parent); - if (freeName) FREE(name); - return attachment; - } - case SP_ATTACHMENT_PATH: { - spAttachment* attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0); - spPathAttachment* path = SUB_CAST(spPathAttachment, attachment); - int vertexCount = 0; - path->closed = readBoolean(input); - path->constantSpeed = readBoolean(input); - vertexCount = readVarint(input, 1); - _readVertices(self, input, SUPER(path), vertexCount); - path->lengthsLength = vertexCount / 3; - path->lengths = MALLOC(float, path->lengthsLength); - for (i = 0; i < path->lengthsLength; ++i) { - path->lengths[i] = readFloat(input) * self->scale; - } - if (nonessential) readInt(input); /* Skip color. */ - if (freeName) FREE(name); - return attachment; - } - case SP_ATTACHMENT_POINT: { - spAttachment* attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0); - spPointAttachment* point = SUB_CAST(spPointAttachment, attachment); - point->rotation = readFloat(input); - point->x = readFloat(input) * self->scale; - point->y = readFloat(input) * self->scale; - - if (nonessential) { - readColor(input, &point->color.r, &point->color.g, &point->color.b, &point->color.a); - } - return attachment; - } - case SP_ATTACHMENT_CLIPPING: { - int endSlotIndex = readVarint(input, 1); - int vertexCount = readVarint(input, 1); - spAttachment* attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0); - spClippingAttachment* clip = SUB_CAST(spClippingAttachment, attachment); - _readVertices(self, input, SUB_CAST(spVertexAttachment, attachment), vertexCount); - if (nonessential) readInt(input); /* Skip color. */ - clip->endSlot = skeletonData->slots[endSlotIndex]; - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - if (freeName) FREE(name); - return attachment; - } - } - - if (freeName) FREE(name); - return 0; -} - -spSkin* spSkeletonBinary_readSkin(spSkeletonBinary* self, _dataInput* input, - const char* skinName, spSkeletonData* skeletonData, int/*bool*/ nonessential) { - spSkin* skin; - int slotCount = readVarint(input, 1); - int i, ii, nn; - if (slotCount == 0) - return 0; - skin = spSkin_create(skinName); - for (i = 0; i < slotCount; ++i) { - int slotIndex = readVarint(input, 1); - for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) { - const char* name = readString(input); - spAttachment* attachment = spSkeletonBinary_readAttachment(self, input, skin, slotIndex, name, skeletonData, nonessential); - if (attachment) spSkin_addAttachment(skin, slotIndex, name, attachment); - FREE(name); - } - } - return skin; -} - -spSkeletonData* spSkeletonBinary_readSkeletonDataFile (spSkeletonBinary* self, const char* path) { - int length; - spSkeletonData* skeletonData; - const char* binary = _spUtil_readFile(path, &length); - if (length == 0 || !binary) { - _spSkeletonBinary_setError(self, "Unable to read skeleton file: ", path); - return 0; - } - skeletonData = spSkeletonBinary_readSkeletonData(self, (unsigned char*)binary, length); - FREE(binary); - return skeletonData; -} - -spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const unsigned char* binary, - const int length) { - int i, ii, nonessential; - spSkeletonData* skeletonData; - _spSkeletonBinary* internal = SUB_CAST(_spSkeletonBinary, self); - - _dataInput* input = NEW(_dataInput); - input->cursor = binary; - input->end = binary + length; - - FREE(self->error); - CONST_CAST(char*, self->error) = 0; - internal->linkedMeshCount = 0; - - skeletonData = spSkeletonData_create(); - - skeletonData->hash = readString(input); - if (!strlen(skeletonData->hash)) { - FREE(skeletonData->hash); - skeletonData->hash = 0; - } - - skeletonData->version = readString(input); - if (!strlen(skeletonData->version)) { - FREE(skeletonData->version); - skeletonData->version = 0; - } - - skeletonData->width = readFloat(input); - skeletonData->height = readFloat(input); - - nonessential = readBoolean(input); - - if (nonessential) { - /* Skip images path & fps */ - readFloat(input); - FREE(readString(input)); - } - - /* Bones. */ - skeletonData->bonesCount = readVarint(input, 1); - skeletonData->bones = MALLOC(spBoneData*, skeletonData->bonesCount); - for (i = 0; i < skeletonData->bonesCount; ++i) { - spBoneData* data; - int mode; - const char* name = readString(input); - spBoneData* parent = i == 0 ? 0 : skeletonData->bones[readVarint(input, 1)]; - /* TODO Avoid copying of name */ - data = spBoneData_create(i, name, parent); - FREE(name); - data->rotation = readFloat(input); - data->x = readFloat(input) * self->scale; - data->y = readFloat(input) * self->scale; - data->scaleX = readFloat(input); - data->scaleY = readFloat(input); - data->shearX = readFloat(input); - data->shearY = readFloat(input); - data->length = readFloat(input) * self->scale; - mode = readVarint(input, 1); - switch (mode) { - case 0: data->transformMode = SP_TRANSFORMMODE_NORMAL; break; - case 1: data->transformMode = SP_TRANSFORMMODE_ONLYTRANSLATION; break; - case 2: data->transformMode = SP_TRANSFORMMODE_NOROTATIONORREFLECTION; break; - case 3: data->transformMode = SP_TRANSFORMMODE_NOSCALE; break; - case 4: data->transformMode = SP_TRANSFORMMODE_NOSCALEORREFLECTION; break; - } - if (nonessential) readInt(input); /* Skip bone color. */ - skeletonData->bones[i] = data; - } - - /* Slots. */ - skeletonData->slotsCount = readVarint(input, 1); - skeletonData->slots = MALLOC(spSlotData*, skeletonData->slotsCount); - for (i = 0; i < skeletonData->slotsCount; ++i) { - int r, g, b, a; - const char* slotName = readString(input); - spBoneData* boneData = skeletonData->bones[readVarint(input, 1)]; - /* TODO Avoid copying of slotName */ - spSlotData* slotData = spSlotData_create(i, slotName, boneData); - FREE(slotName); - readColor(input, &slotData->color.r, &slotData->color.g, &slotData->color.b, &slotData->color.a); - a = readByte(input); - r = readByte(input); - g = readByte(input); - b = readByte(input); - if (!(r == 0xff && g == 0xff && b == 0xff && a == 0xff)) { - slotData->darkColor = spColor_create(); - spColor_setFromFloats(slotData->darkColor, r / 255.0f, g / 255.0f, b / 255.0f, 1); - } - slotData->attachmentName = readString(input); - slotData->blendMode = (spBlendMode)readVarint(input, 1); - skeletonData->slots[i] = slotData; - } - - /* IK constraints. */ - skeletonData->ikConstraintsCount = readVarint(input, 1); - skeletonData->ikConstraints = MALLOC(spIkConstraintData*, skeletonData->ikConstraintsCount); - for (i = 0; i < skeletonData->ikConstraintsCount; ++i) { - const char* name = readString(input); - /* TODO Avoid copying of name */ - spIkConstraintData* data = spIkConstraintData_create(name); - data->order = readVarint(input, 1); - FREE(name); - data->bonesCount = readVarint(input, 1); - data->bones = MALLOC(spBoneData*, data->bonesCount); - for (ii = 0; ii < data->bonesCount; ++ii) - data->bones[ii] = skeletonData->bones[readVarint(input, 1)]; - data->target = skeletonData->bones[readVarint(input, 1)]; - data->mix = readFloat(input); - data->bendDirection = readSByte(input); - skeletonData->ikConstraints[i] = data; - } - - /* Transform constraints. */ - skeletonData->transformConstraintsCount = readVarint(input, 1); - skeletonData->transformConstraints = MALLOC( - spTransformConstraintData*, skeletonData->transformConstraintsCount); - for (i = 0; i < skeletonData->transformConstraintsCount; ++i) { - const char* name = readString(input); - /* TODO Avoid copying of name */ - spTransformConstraintData* data = spTransformConstraintData_create(name); - data->order = readVarint(input, 1); - FREE(name); - data->bonesCount = readVarint(input, 1); - CONST_CAST(spBoneData**, data->bones) = MALLOC(spBoneData*, data->bonesCount); - for (ii = 0; ii < data->bonesCount; ++ii) - data->bones[ii] = skeletonData->bones[readVarint(input, 1)]; - data->target = skeletonData->bones[readVarint(input, 1)]; - data->local = readBoolean(input); - data->relative = readBoolean(input); - data->offsetRotation = readFloat(input); - data->offsetX = readFloat(input) * self->scale; - data->offsetY = readFloat(input) * self->scale; - data->offsetScaleX = readFloat(input); - data->offsetScaleY = readFloat(input); - data->offsetShearY = readFloat(input); - data->rotateMix = readFloat(input); - data->translateMix = readFloat(input); - data->scaleMix = readFloat(input); - data->shearMix = readFloat(input); - skeletonData->transformConstraints[i] = data; - } - - /* Path constraints */ - skeletonData->pathConstraintsCount = readVarint(input, 1); - skeletonData->pathConstraints = MALLOC(spPathConstraintData*, skeletonData->pathConstraintsCount); - for (i = 0; i < skeletonData->pathConstraintsCount; ++i) { - const char* name = readString(input); - /* TODO Avoid copying of name */ - spPathConstraintData* data = spPathConstraintData_create(name); - data->order = readVarint(input, 1); - FREE(name); - data->bonesCount = readVarint(input, 1); - CONST_CAST(spBoneData**, data->bones) = MALLOC(spBoneData*, data->bonesCount); - for (ii = 0; ii < data->bonesCount; ++ii) - data->bones[ii] = skeletonData->bones[readVarint(input, 1)]; - data->target = skeletonData->slots[readVarint(input, 1)]; - data->positionMode = (spPositionMode)readVarint(input, 1); - data->spacingMode = (spSpacingMode)readVarint(input, 1); - data->rotateMode = (spRotateMode)readVarint(input, 1); - data->offsetRotation = readFloat(input); - data->position = readFloat(input); - if (data->positionMode == SP_POSITION_MODE_FIXED) data->position *= self->scale; - data->spacing = readFloat(input); - if (data->spacingMode == SP_SPACING_MODE_LENGTH || data->spacingMode == SP_SPACING_MODE_FIXED) data->spacing *= self->scale; - data->rotateMix = readFloat(input); - data->translateMix = readFloat(input); - skeletonData->pathConstraints[i] = data; - } - - /* Default skin. */ - skeletonData->defaultSkin = spSkeletonBinary_readSkin(self, input, "default", skeletonData, nonessential); - skeletonData->skinsCount = readVarint(input, 1); - - if (skeletonData->defaultSkin) - ++skeletonData->skinsCount; - - skeletonData->skins = MALLOC(spSkin*, skeletonData->skinsCount); - - if (skeletonData->defaultSkin) - skeletonData->skins[0] = skeletonData->defaultSkin; - - /* Skins. */ - for (i = skeletonData->defaultSkin ? 1 : 0; i < skeletonData->skinsCount; ++i) { - const char* skinName = readString(input); - /* TODO Avoid copying of skinName */ - skeletonData->skins[i] = spSkeletonBinary_readSkin(self, input, skinName, skeletonData, nonessential); - FREE(skinName); - } - - /* Linked meshes. */ - for (i = 0; i < internal->linkedMeshCount; ++i) { - _spLinkedMesh* linkedMesh = internal->linkedMeshes + i; - spSkin* skin = !linkedMesh->skin ? skeletonData->defaultSkin : spSkeletonData_findSkin(skeletonData, linkedMesh->skin); - spAttachment* parent; - if (!skin) { - FREE(input); - spSkeletonData_dispose(skeletonData); - _spSkeletonBinary_setError(self, "Skin not found: ", linkedMesh->skin); - return 0; - } - parent = spSkin_getAttachment(skin, linkedMesh->slotIndex, linkedMesh->parent); - if (!parent) { - FREE(input); - spSkeletonData_dispose(skeletonData); - _spSkeletonBinary_setError(self, "Parent mesh not found: ", linkedMesh->parent); - return 0; - } - spMeshAttachment_setParentMesh(linkedMesh->mesh, SUB_CAST(spMeshAttachment, parent)); - spMeshAttachment_updateUVs(linkedMesh->mesh); - spAttachmentLoader_configureAttachment(self->attachmentLoader, SUPER(SUPER(linkedMesh->mesh))); - } - - /* Events. */ - skeletonData->eventsCount = readVarint(input, 1); - skeletonData->events = MALLOC(spEventData*, skeletonData->eventsCount); - for (i = 0; i < skeletonData->eventsCount; ++i) { - const char* name = readString(input); - /* TODO Avoid copying of skinName */ - spEventData* eventData = spEventData_create(name); - FREE(name); - eventData->intValue = readVarint(input, 0); - eventData->floatValue = readFloat(input); - eventData->stringValue = readString(input); - skeletonData->events[i] = eventData; - } - - /* Animations. */ - skeletonData->animationsCount = readVarint(input, 1); - skeletonData->animations = MALLOC(spAnimation*, skeletonData->animationsCount); - for (i = 0; i < skeletonData->animationsCount; ++i) { - const char* name = readString(input); - spAnimation* animation = _spSkeletonBinary_readAnimation(self, name, input, skeletonData); - FREE(name); - if (!animation) { - FREE(input); - spSkeletonData_dispose(skeletonData); - return 0; - } - skeletonData->animations[i] = animation; - } - - FREE(input); - return skeletonData; -} diff --git a/cocos/editor-support/spine/SkeletonBinary.cpp b/cocos/editor-support/spine/SkeletonBinary.cpp new file mode 100644 index 00000000000..521b1b271f3 --- /dev/null +++ b/cocos/editor-support/spine/SkeletonBinary.cpp @@ -0,0 +1,1053 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace spine; + +const int SkeletonBinary::BONE_ROTATE = 0; +const int SkeletonBinary::BONE_TRANSLATE = 1; +const int SkeletonBinary::BONE_SCALE = 2; +const int SkeletonBinary::BONE_SHEAR = 3; + +const int SkeletonBinary::SLOT_ATTACHMENT = 0; +const int SkeletonBinary::SLOT_COLOR = 1; +const int SkeletonBinary::SLOT_TWO_COLOR = 2; + +const int SkeletonBinary::PATH_POSITION = 0; +const int SkeletonBinary::PATH_SPACING = 1; +const int SkeletonBinary::PATH_MIX = 2; + +const int SkeletonBinary::CURVE_LINEAR = 0; +const int SkeletonBinary::CURVE_STEPPED = 1; +const int SkeletonBinary::CURVE_BEZIER = 2; + +SkeletonBinary::SkeletonBinary(Atlas *atlasArray) : _attachmentLoader( + new(__FILE__, __LINE__) AtlasAttachmentLoader(atlasArray)), _error(), _scale(1), _ownsLoader(true) { + +} + +SkeletonBinary::SkeletonBinary(AttachmentLoader *attachmentLoader) : _attachmentLoader(attachmentLoader), _error(), + _scale(1), _ownsLoader(false) { + assert(_attachmentLoader != NULL); +} + +SkeletonBinary::~SkeletonBinary() { + ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes); + _linkedMeshes.clear(); + + if (_ownsLoader) { + delete _attachmentLoader; + } +} + +SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, const int length) { + bool nonessential; + SkeletonData *skeletonData; + + DataInput *input = new(__FILE__, __LINE__) DataInput(); + input->cursor = binary; + input->end = binary + length; + + _linkedMeshes.clear(); + + skeletonData = new(__FILE__, __LINE__) SkeletonData(); + + char *skeletonData_hash = readString(input); + skeletonData->_hash.own(skeletonData_hash); + + char *skeletonData_version = readString(input); + skeletonData->_version.own(skeletonData_version); + + skeletonData->_width = readFloat(input); + skeletonData->_height = readFloat(input); + + nonessential = readBoolean(input); + + if (nonessential) { + /* Skip images path, audio path & fps */ + skeletonData->_fps = readFloat(input); + skeletonData->_imagesPath.own(readString(input)); + skeletonData->_audioPath.own(readString(input)); + } + + /* Bones. */ + int numBones = readVarint(input, true); + skeletonData->_bones.setSize(numBones, 0); + for (int i = 0; i < numBones; ++i) { + const char *name = readString(input); + BoneData *parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)]; + BoneData *data = new(__FILE__, __LINE__) BoneData(i, String(name, true), parent); + data->_rotation = readFloat(input); + data->_x = readFloat(input) * _scale; + data->_y = readFloat(input) * _scale; + data->_scaleX = readFloat(input); + data->_scaleY = readFloat(input); + data->_shearX = readFloat(input); + data->_shearY = readFloat(input); + data->_length = readFloat(input) * _scale; + data->_transformMode = static_cast(readVarint(input, true)); + if (nonessential) { + /* Skip bone color. */ + readInt(input); + } + skeletonData->_bones[i] = data; + } + + /* Slots. */ + int slotsCount = readVarint(input, true); + skeletonData->_slots.setSize(slotsCount, 0); + for (int i = 0; i < slotsCount; ++i) { + const char *slotName = readString(input); + BoneData *boneData = skeletonData->_bones[readVarint(input, true)]; + SlotData *slotData = new(__FILE__, __LINE__) SlotData(i, String(slotName, true), *boneData); + + readColor(input, slotData->getColor()); + unsigned char r = readByte(input); + unsigned char g = readByte(input); + unsigned char b = readByte(input); + unsigned char a = readByte(input); + if (!(r == 0xff && g == 0xff && b == 0xff && a == 0xff)) { + slotData->getDarkColor().set(r / 255.0f, g / 255.0f, b / 255.0f, 1); + slotData->setHasDarkColor(true); + } + slotData->_attachmentName.own(readString(input)); + slotData->_blendMode = static_cast(readVarint(input, true)); + skeletonData->_slots[i] = slotData; + } + + /* IK constraints. */ + int ikConstraintsCount = readVarint(input, true); + skeletonData->_ikConstraints.setSize(ikConstraintsCount, 0); + for (int i = 0; i < ikConstraintsCount; ++i) { + const char *name = readString(input); + IkConstraintData *data = new(__FILE__, __LINE__) IkConstraintData(String(name, true)); + data->_order = readVarint(input, true); + int bonesCount = readVarint(input, true); + data->_bones.setSize(bonesCount, 0); + for (int ii = 0; ii < bonesCount; ++ii) { + data->_bones[ii] = skeletonData->_bones[readVarint(input, true)]; + } + data->_target = skeletonData->_bones[readVarint(input, true)]; + data->_mix = readFloat(input); + data->_bendDirection = readSByte(input); + data->_compress = readBoolean(input); + data->_stretch = readBoolean(input); + data->_uniform = readBoolean(input); + skeletonData->_ikConstraints[i] = data; + } + + /* Transform constraints. */ + int transformConstraintsCount = readVarint(input, true); + skeletonData->_transformConstraints.setSize(transformConstraintsCount, 0); + for (int i = 0; i < transformConstraintsCount; ++i) { + const char *name = readString(input); + TransformConstraintData *data = new(__FILE__, __LINE__) TransformConstraintData(String(name, true)); + data->_order = readVarint(input, true); + int bonesCount = readVarint(input, true); + data->_bones.setSize(bonesCount, 0); + for (int ii = 0; ii < bonesCount; ++ii) { + data->_bones[ii] = skeletonData->_bones[readVarint(input, true)]; + } + data->_target = skeletonData->_bones[readVarint(input, true)]; + data->_local = readBoolean(input); + data->_relative = readBoolean(input); + data->_offsetRotation = readFloat(input); + data->_offsetX = readFloat(input) * _scale; + data->_offsetY = readFloat(input) * _scale; + data->_offsetScaleX = readFloat(input); + data->_offsetScaleY = readFloat(input); + data->_offsetShearY = readFloat(input); + data->_rotateMix = readFloat(input); + data->_translateMix = readFloat(input); + data->_scaleMix = readFloat(input); + data->_shearMix = readFloat(input); + skeletonData->_transformConstraints[i] = data; + } + + /* Path constraints */ + int pathConstraintsCount = readVarint(input, true); + skeletonData->_pathConstraints.setSize(pathConstraintsCount, 0); + for (int i = 0; i < pathConstraintsCount; ++i) { + const char *name = readString(input); + PathConstraintData *data = new(__FILE__, __LINE__) PathConstraintData(String(name, true)); + data->_order = readVarint(input, true); + int bonesCount = readVarint(input, true); + data->_bones.setSize(bonesCount, 0); + for (int ii = 0; ii < bonesCount; ++ii) { + data->_bones[ii] = skeletonData->_bones[readVarint(input, true)]; + } + data->_target = skeletonData->_slots[readVarint(input, true)]; + data->_positionMode = static_cast(readVarint(input, true)); + data->_spacingMode = static_cast(readVarint(input, true)); + data->_rotateMode = static_cast(readVarint(input, true)); + data->_offsetRotation = readFloat(input); + data->_position = readFloat(input); + if (data->_positionMode == PositionMode_Fixed) data->_position *= _scale; + data->_spacing = readFloat(input); + if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) + data->_spacing *= _scale; + data->_rotateMix = readFloat(input); + data->_translateMix = readFloat(input); + skeletonData->_pathConstraints[i] = data; + } + + /* Default skin. */ + skeletonData->_defaultSkin = readSkin(input, "default", skeletonData, nonessential); + int skinsCount = readVarint(input, true); + if (skeletonData->_defaultSkin) { + ++skinsCount; + } + skeletonData->_skins.setSize(skinsCount, 0); + if (skeletonData->_defaultSkin) { + skeletonData->_skins[0] = skeletonData->_defaultSkin; + } + + /* Skins. */ + for (size_t i = skeletonData->_defaultSkin ? 1 : 0; i < skeletonData->_skins.size(); ++i) { + String skinName(readString(input), true); + skeletonData->_skins[i] = readSkin(input, skinName, skeletonData, nonessential); + } + + /* Linked meshes. */ + for (int i = 0, n = _linkedMeshes.size(); i < n; ++i) { + LinkedMesh *linkedMesh = _linkedMeshes[i]; + Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin( + linkedMesh->_skin); + if (skin == NULL) { + delete input; + delete skeletonData; + setError("Skin not found: ", linkedMesh->_skin.buffer()); + return NULL; + } + Attachment *parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent); + if (parent == NULL) { + delete input; + delete skeletonData; + setError("Parent mesh not found: ", linkedMesh->_parent.buffer()); + return NULL; + } + linkedMesh->_mesh->setParentMesh(static_cast(parent)); + linkedMesh->_mesh->updateUVs(); + _attachmentLoader->configureAttachment(linkedMesh->_mesh); + } + ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes); + _linkedMeshes.clear(); + + /* Events. */ + int eventsCount = readVarint(input, true); + skeletonData->_events.setSize(eventsCount, 0); + for (int i = 0; i < eventsCount; ++i) { + const char *name = readString(input); + EventData *eventData = new(__FILE__, __LINE__) EventData(String(name, true)); + eventData->_intValue = readVarint(input, false); + eventData->_floatValue = readFloat(input); + eventData->_stringValue.own(readString(input)); + eventData->_audioPath.own(readString(input)); // skip audio path + if (!eventData->_audioPath.isEmpty()) { + eventData->_volume = readFloat(input); + eventData->_balance = readFloat(input); + } + skeletonData->_events[i] = eventData; + } + + /* Animations. */ + int animationsCount = readVarint(input, true); + skeletonData->_animations.setSize(animationsCount, 0); + for (int i = 0; i < animationsCount; ++i) { + String name(readString(input), true); + Animation *animation = readAnimation(name, input, skeletonData); + if (!animation) { + delete input; + delete skeletonData; + return NULL; + } + skeletonData->_animations[i] = animation; + } + + delete input; + return skeletonData; +} + +SkeletonData *SkeletonBinary::readSkeletonDataFile(const String &path) { + int length; + SkeletonData *skeletonData; + const char *binary = SpineExtension::readFile(path.buffer(), &length); + if (length == 0 || !binary) { + setError("Unable to read skeleton file: ", path.buffer()); + return NULL; + } + skeletonData = readSkeletonData((unsigned char *) binary, length); + SpineExtension::free(binary, __FILE__, __LINE__); + return skeletonData; +} + +void SkeletonBinary::setError(const char *value1, const char *value2) { + char message[256]; + int length; + strcpy(message, value1); + length = (int) strlen(value1); + if (value2) { + strncat(message + length, value2, 255 - length); + } + + _error = String(message); +} + +char *SkeletonBinary::readString(DataInput *input) { + int length = readVarint(input, true); + char *string; + if (length == 0) { + return NULL; + } + string = SpineExtension::alloc(length, __FILE__, __LINE__); + memcpy(string, input->cursor, length - 1); + input->cursor += length - 1; + string[length - 1] = '\0'; + return string; +} + +float SkeletonBinary::readFloat(DataInput *input) { + union { + int intValue; + float floatValue; + } intToFloat; + + intToFloat.intValue = readInt(input); + + return intToFloat.floatValue; +} + +unsigned char SkeletonBinary::readByte(DataInput *input) { + return *input->cursor++; +} + +signed char SkeletonBinary::readSByte(DataInput *input) { + return (signed char) readByte(input); +} + +bool SkeletonBinary::readBoolean(DataInput *input) { + return readByte(input) != 0; +} + +int SkeletonBinary::readInt(DataInput *input) { + int result = readByte(input); + result <<= 8; + result |= readByte(input); + result <<= 8; + result |= readByte(input); + result <<= 8; + result |= readByte(input); + return result; +} + +void SkeletonBinary::readColor(DataInput *input, Color &color) { + color.r = readByte(input) / 255.0f; + color.g = readByte(input) / 255.0f; + color.b = readByte(input) / 255.0f; + color.a = readByte(input) / 255.0f; +} + +int SkeletonBinary::readVarint(DataInput *input, bool optimizePositive) { + unsigned char b = readByte(input); + int value = b & 0x7F; + if (b & 0x80) { + b = readByte(input); + value |= (b & 0x7F) << 7; + if (b & 0x80) { + b = readByte(input); + value |= (b & 0x7F) << 14; + if (b & 0x80) { + b = readByte(input); + value |= (b & 0x7F) << 21; + if (b & 0x80) value |= (readByte(input) & 0x7F) << 28; + } + } + } + + if (!optimizePositive) { + value = (((unsigned int) value >> 1) ^ -(value & 1)); + } + + return value; +} + +Skin * +SkeletonBinary::readSkin(DataInput *input, const String &skinName, SkeletonData *skeletonData, bool nonessential) { + int slotCount = readVarint(input, true); + if (slotCount == 0) return NULL; + Skin *skin = new(__FILE__, __LINE__) Skin(skinName); + for (int i = 0; i < slotCount; ++i) { + int slotIndex = readVarint(input, true); + for (int ii = 0, nn = readVarint(input, true); ii < nn; ++ii) { + String name(readString(input), true); + Attachment *attachment = readAttachment(input, skin, slotIndex, name, skeletonData, nonessential); + if (attachment) skin->addAttachment(slotIndex, String(name), attachment); + } + } + return skin; +} + +Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slotIndex, const String &attachmentName, + SkeletonData *skeletonData, bool nonessential) { + String name(readString(input), true); + if (name.isEmpty()) name = attachmentName; + + AttachmentType type = static_cast(readByte(input)); + switch (type) { + case AttachmentType_Region: { + String path(readString(input), true); + if (path.isEmpty()) path = name; + RegionAttachment *region = _attachmentLoader->newRegionAttachment(*skin, String(name), String(path)); + region->_path = path; + region->_rotation = readFloat(input); + region->_x = readFloat(input) * _scale; + region->_y = readFloat(input) * _scale; + region->_scaleX = readFloat(input); + region->_scaleY = readFloat(input); + region->_width = readFloat(input) * _scale; + region->_height = readFloat(input) * _scale; + readColor(input, region->getColor()); + region->updateOffset(); + _attachmentLoader->configureAttachment(region); + return region; + } + case AttachmentType_Boundingbox: { + int vertexCount = readVarint(input, true); + BoundingBoxAttachment *box = _attachmentLoader->newBoundingBoxAttachment(*skin, String(name)); + readVertices(input, static_cast(box), vertexCount); + if (nonessential) { + /* Skip color. */ + readInt(input); + } + _attachmentLoader->configureAttachment(box); + return box; + } + case AttachmentType_Mesh: { + int vertexCount; + MeshAttachment *mesh; + String path(readString(input), true); + if (path.isEmpty()) path = name; + + mesh = _attachmentLoader->newMeshAttachment(*skin, String(name), String(path)); + mesh->_path = path; + readColor(input, mesh->getColor()); + vertexCount = readVarint(input, true); + readFloatArray(input, vertexCount << 1, 1, mesh->getRegionUVs()); + readShortArray(input, mesh->getTriangles()); + readVertices(input, static_cast(mesh), vertexCount); + mesh->updateUVs(); + mesh->_hullLength = readVarint(input, true) << 1; + if (nonessential) { + readShortArray(input, mesh->getEdges()); + mesh->_width = readFloat(input) * _scale; + mesh->_height = readFloat(input) * _scale; + } else { + mesh->_width = 0; + mesh->_height = 0; + } + _attachmentLoader->configureAttachment(mesh); + return mesh; + } + case AttachmentType_Linkedmesh: { + String path(readString(input), true); + if (path.isEmpty()) path = name; + + MeshAttachment *mesh = _attachmentLoader->newMeshAttachment(*skin, String(name), String(path)); + mesh->_path = path; + readColor(input, mesh->getColor()); + String skinName(readString(input), true); + String parent(readString(input), true); + mesh->_inheritDeform = readBoolean(input); + if (nonessential) { + mesh->_width = readFloat(input) * _scale; + mesh->_height = readFloat(input) * _scale; + } + + LinkedMesh *linkedMesh = new(__FILE__, __LINE__) LinkedMesh(mesh, String(skinName), slotIndex, + String(parent)); + _linkedMeshes.add(linkedMesh); + return mesh; + } + case AttachmentType_Path: { + PathAttachment *path = _attachmentLoader->newPathAttachment(*skin, String(name)); + path->_closed = readBoolean(input); + path->_constantSpeed = readBoolean(input); + int vertexCount = readVarint(input, true); + readVertices(input, static_cast(path), vertexCount); + int lengthsLength = vertexCount / 3; + path->_lengths.setSize(lengthsLength, 0); + for (int i = 0; i < lengthsLength; ++i) { + path->_lengths[i] = readFloat(input) * _scale; + } + if (nonessential) { + /* Skip color. */ + readInt(input); + } + _attachmentLoader->configureAttachment(path); + return path; + } + case AttachmentType_Point: { + PointAttachment *point = _attachmentLoader->newPointAttachment(*skin, String(name)); + point->_rotation = readFloat(input); + point->_x = readFloat(input) * _scale; + point->_y = readFloat(input) * _scale; + + if (nonessential) { + /* Skip color. */ + readInt(input); + } + _attachmentLoader->configureAttachment(point); + return point; + } + case AttachmentType_Clipping: { + int endSlotIndex = readVarint(input, true); + int vertexCount = readVarint(input, true); + ClippingAttachment *clip = _attachmentLoader->newClippingAttachment(*skin, name); + readVertices(input, static_cast(clip), vertexCount); + clip->_endSlot = skeletonData->_slots[endSlotIndex]; + if (nonessential) { + /* Skip color. */ + readInt(input); + } + _attachmentLoader->configureAttachment(clip); + return clip; + } + } + return NULL; +} + +void SkeletonBinary::readVertices(DataInput *input, VertexAttachment *attachment, int vertexCount) { + float scale = _scale; + int verticesLength = vertexCount << 1; + attachment->setWorldVerticesLength(vertexCount << 1); + + if (!readBoolean(input)) { + readFloatArray(input, verticesLength, scale, attachment->getVertices()); + return; + } + + Vector &vertices = attachment->getVertices(); + Vector &bones = attachment->getBones(); + vertices.ensureCapacity(verticesLength * 3 * 3); + bones.ensureCapacity(verticesLength * 3); + + for (int i = 0; i < vertexCount; ++i) { + int boneCount = readVarint(input, true); + bones.add(boneCount); + for (int ii = 0; ii < boneCount; ++ii) { + bones.add(readVarint(input, true)); + vertices.add(readFloat(input) * scale); + vertices.add(readFloat(input) * scale); + vertices.add(readFloat(input)); + } + } +} + +void SkeletonBinary::readFloatArray(DataInput *input, int n, float scale, Vector &array) { + array.setSize(n, 0); + + int i; + if (scale == 1) { + for (i = 0; i < n; ++i) { + array[i] = readFloat(input); + } + } else { + for (i = 0; i < n; ++i) { + array[i] = readFloat(input) * scale; + } + } +} + +void SkeletonBinary::readShortArray(DataInput *input, Vector &array) { + int n = readVarint(input, true); + array.setSize(n, 0); + + int i; + for (i = 0; i < n; ++i) { + array[i] = readByte(input) << 8; + array[i] |= readByte(input); + } +} + +Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, SkeletonData *skeletonData) { + Vector timelines; + float scale = _scale; + float duration = 0; + + // Slot timelines. + for (int i = 0, n = readVarint(input, true); i < n; ++i) { + int slotIndex = readVarint(input, true); + for (int ii = 0, nn = readVarint(input, true); ii < nn; ++ii) { + unsigned char timelineType = readByte(input); + int frameCount = readVarint(input, true); + switch (timelineType) { + case SLOT_ATTACHMENT: { + AttachmentTimeline *timeline = new(__FILE__, __LINE__) AttachmentTimeline(frameCount); + timeline->_slotIndex = slotIndex; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + String attachmentName = String(readString(input), true); + timeline->setFrame(frameIndex, time, attachmentName); + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[frameCount - 1]); + break; + } + case SLOT_COLOR: { + ColorTimeline *timeline = new(__FILE__, __LINE__) ColorTimeline(frameCount); + timeline->_slotIndex = slotIndex; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + int color = readInt(input); + float r = ((color & 0xff000000) >> 24) / 255.0f; + float g = ((color & 0x00ff0000) >> 16) / 255.0f; + float b = ((color & 0x0000ff00) >> 8) / 255.0f; + float a = ((color & 0x000000ff)) / 255.0f; + timeline->setFrame(frameIndex, time, r, g, b, a); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[(frameCount - 1) * ColorTimeline::ENTRIES]); + break; + } + case SLOT_TWO_COLOR: { + TwoColorTimeline *timeline = new(__FILE__, __LINE__) TwoColorTimeline(frameCount); + timeline->_slotIndex = slotIndex; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + int color = readInt(input); + float r = ((color & 0xff000000) >> 24) / 255.0f; + float g = ((color & 0x00ff0000) >> 16) / 255.0f; + float b = ((color & 0x0000ff00) >> 8) / 255.0f; + float a = ((color & 0x000000ff)) / 255.0f; + int color2 = readInt(input); // 0x00rrggbb + float r2 = ((color2 & 0x00ff0000) >> 16) / 255.0f; + float g2 = ((color2 & 0x0000ff00) >> 8) / 255.0f; + float b2 = ((color2 & 0x000000ff)) / 255.0f; + + timeline->setFrame(frameIndex, time, r, g, b, a, r2, g2, b2); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[(frameCount - 1) * TwoColorTimeline::ENTRIES]); + break; + } + default: { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError("Invalid timeline type for a slot: ", skeletonData->_slots[slotIndex]->_name.buffer()); + return NULL; + } + } + } + } + + // Bone timelines. + for (int i = 0, n = readVarint(input, true); i < n; ++i) { + int boneIndex = readVarint(input, true); + for (int ii = 0, nn = readVarint(input, true); ii < nn; ++ii) { + unsigned char timelineType = readByte(input); + int frameCount = readVarint(input, true); + switch (timelineType) { + case BONE_ROTATE: { + RotateTimeline *timeline = new(__FILE__, __LINE__) RotateTimeline(frameCount); + timeline->_boneIndex = boneIndex; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + float degrees = readFloat(input); + timeline->setFrame(frameIndex, time, degrees); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[(frameCount - 1) * RotateTimeline::ENTRIES]); + break; + } + case BONE_TRANSLATE: + case BONE_SCALE: + case BONE_SHEAR: { + TranslateTimeline *timeline; + float timelineScale = 1; + if (timelineType == BONE_SCALE) { + timeline = new(__FILE__, __LINE__) ScaleTimeline(frameCount); + } else if (timelineType == BONE_SHEAR) { + timeline = new(__FILE__, __LINE__) ShearTimeline(frameCount); + } else { + timeline = new(__FILE__, __LINE__) TranslateTimeline(frameCount); + timelineScale = scale; + } + timeline->_boneIndex = boneIndex; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + float x = readFloat(input) * timelineScale; + float y = readFloat(input) * timelineScale; + timeline->setFrame(frameIndex, time, x, y); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, + timeline->_frames[(frameCount - 1) * TranslateTimeline::ENTRIES]); + break; + } + default: { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError("Invalid timeline type for a bone: ", skeletonData->_bones[boneIndex]->_name.buffer()); + return NULL; + } + } + } + } + + // IK timelines. + for (int i = 0, n = readVarint(input, true); i < n; ++i) { + int index = readVarint(input, true); + int frameCount = readVarint(input, true); + IkConstraintTimeline *timeline = new(__FILE__, __LINE__) IkConstraintTimeline(frameCount); + timeline->_ikConstraintIndex = index; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + float mix = readFloat(input); + signed char bendDirection = readSByte(input); + bool compress = readBoolean(input); + bool stretch = readBoolean(input); + timeline->setFrame(frameIndex, time, mix, bendDirection, compress, stretch); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[(frameCount - 1) * IkConstraintTimeline::ENTRIES]); + } + + // Transform constraint timelines. + for (int i = 0, n = readVarint(input, true); i < n; ++i) { + int index = readVarint(input, true); + int frameCount = readVarint(input, true); + TransformConstraintTimeline *timeline = new(__FILE__, __LINE__) TransformConstraintTimeline(frameCount); + timeline->_transformConstraintIndex = index; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + float rotateMix = readFloat(input); + float translateMix = readFloat(input); + float scaleMix = readFloat(input); + float shearMix = readFloat(input); + timeline->setFrame(frameIndex, time, rotateMix, translateMix, scaleMix, shearMix); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[(frameCount - 1) * TransformConstraintTimeline::ENTRIES]); + } + + // Path constraint timelines. + for (int i = 0, n = readVarint(input, true); i < n; ++i) { + int index = readVarint(input, true); + PathConstraintData *data = skeletonData->_pathConstraints[index]; + for (int ii = 0, nn = readVarint(input, true); ii < nn; ++ii) { + int timelineType = readSByte(input); + int frameCount = readVarint(input, true); + switch (timelineType) { + case PATH_POSITION: + case PATH_SPACING: { + PathConstraintPositionTimeline *timeline; + float timelineScale = 1; + if (timelineType == PATH_SPACING) { + timeline = new(__FILE__, __LINE__) PathConstraintSpacingTimeline(frameCount); + + if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) { + timelineScale = scale; + } + } else { + timeline = new(__FILE__, __LINE__) PathConstraintPositionTimeline(frameCount); + + if (data->_positionMode == PositionMode_Fixed) { + timelineScale = scale; + } + } + timeline->_pathConstraintIndex = index; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + float value = readFloat(input) * timelineScale; + timeline->setFrame(frameIndex, time, value); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[(frameCount - 1) * + PathConstraintPositionTimeline::ENTRIES]); + break; + } + case PATH_MIX: { + PathConstraintMixTimeline *timeline = new(__FILE__, __LINE__) PathConstraintMixTimeline(frameCount); + + timeline->_pathConstraintIndex = index; + for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + float rotateMix = readFloat(input); + float translateMix = readFloat(input); + timeline->setFrame(frameIndex, time, rotateMix, translateMix); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + timelines.add(timeline); + duration = MathUtil::max(duration, + timeline->_frames[(frameCount - 1) * PathConstraintMixTimeline::ENTRIES]); + break; + } + } + } + } + + // Deform timelines. + for (int i = 0, n = readVarint(input, true); i < n; ++i) { + Skin *skin = skeletonData->_skins[readVarint(input, true)]; + for (int ii = 0, nn = readVarint(input, true); ii < nn; ++ii) { + int slotIndex = readVarint(input, true); + for (int iii = 0, nnn = readVarint(input, true); iii < nnn; iii++) { + const char *attachmentName = readString(input); + Attachment *baseAttachment = skin->getAttachment(slotIndex, String(attachmentName, true)); + + if (!baseAttachment) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError("Attachment not found: ", attachmentName); + return NULL; + } + + VertexAttachment *attachment = static_cast(baseAttachment); + + bool weighted = attachment->_bones.size() > 0; + Vector &vertices = attachment->_vertices; + size_t deformLength = weighted ? vertices.size() / 3 * 2 + : vertices.size(); + + size_t frameCount = (size_t)readVarint(input, true); + + DeformTimeline *timeline = new(__FILE__, __LINE__) DeformTimeline(frameCount); + + timeline->_slotIndex = slotIndex; + timeline->_attachment = attachment; + + for (size_t frameIndex = 0; frameIndex < frameCount; ++frameIndex) { + float time = readFloat(input); + Vector deform; + size_t end = (size_t)readVarint(input, true); + if (end == 0) { + if (weighted) { + deform.setSize(deformLength, 0); + for (size_t iiii = 0; iiii < deformLength; ++iiii) { + deform[iiii] = 0; + } + } else { + deform.clearAndAddAll(vertices); + } + } else { + deform.setSize(deformLength, 0); + size_t start = (size_t)readVarint(input, true); + end += start; + if (scale == 1) { + for (size_t v = start; v < end; ++v) { + deform[v] = readFloat(input); + } + } else { + for (size_t v = start; v < end; ++v) { + deform[v] = readFloat(input) * scale; + } + } + + if (!weighted) { + for (size_t v = 0, vn = deform.size(); v < vn; ++v) { + deform[v] += vertices[v]; + } + } + } + + timeline->setFrame(frameIndex, time, deform); + if (frameIndex < frameCount - 1) { + readCurve(input, frameIndex, timeline); + } + } + + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[frameCount - 1]); + } + } + } + + // Draw order timeline. + size_t drawOrderCount = (size_t)readVarint(input, true); + if (drawOrderCount > 0) { + DrawOrderTimeline *timeline = new(__FILE__, __LINE__) DrawOrderTimeline(drawOrderCount); + + size_t slotCount = skeletonData->_slots.size(); + for (size_t i = 0; i < drawOrderCount; ++i) { + float time = readFloat(input); + size_t offsetCount = (size_t)readVarint(input, true); + + Vector drawOrder; + drawOrder.setSize(slotCount, 0); + for (int ii = (int)slotCount - 1; ii >= 0; --ii) { + drawOrder[ii] = -1; + } + + Vector unchanged; + unchanged.setSize(slotCount - offsetCount, 0); + size_t originalIndex = 0, unchangedIndex = 0; + for (size_t ii = 0; ii < offsetCount; ++ii) { + size_t slotIndex = (size_t)readVarint(input, true); + // Collect unchanged items. + while (originalIndex != slotIndex) { + unchanged[unchangedIndex++] = originalIndex++; + } + // Set changed items. + size_t index = originalIndex; + drawOrder[index + (size_t)readVarint(input, true)] = originalIndex++; + } + + // Collect remaining unchanged items. + while (originalIndex < slotCount) { + unchanged[unchangedIndex++] = originalIndex++; + } + + // Fill in unchanged items. + for (int ii = (int)slotCount - 1; ii >= 0; --ii) { + if (drawOrder[ii] == -1) { + drawOrder[ii] = unchanged[--unchangedIndex]; + } + } + timeline->setFrame(i, time, drawOrder); + } + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[drawOrderCount - 1]); + } + + // Event timeline. + int eventCount = readVarint(input, true); + if (eventCount > 0) { + EventTimeline *timeline = new(__FILE__, __LINE__) EventTimeline(eventCount); + + for (int i = 0; i < eventCount; ++i) { + float time = readFloat(input); + EventData *eventData = skeletonData->_events[readVarint(input, true)]; + Event *event = new(__FILE__, __LINE__) Event(time, *eventData); + + event->_intValue = readVarint(input, false); + event->_floatValue = readFloat(input); + bool freeString = readBoolean(input); + const char *event_stringValue = freeString ? readString(input) : eventData->_stringValue.buffer(); + event->_stringValue = String(event_stringValue); + if (freeString) { + SpineExtension::free(event_stringValue, __FILE__, __LINE__); + } + + if (!eventData->_audioPath.isEmpty()) { + event->_volume = readFloat(input); + event->_balance = readFloat(input); + } + timeline->setFrame(i, event); + } + + timelines.add(timeline); + duration = MathUtil::max(duration, timeline->_frames[eventCount - 1]); + } + + return new(__FILE__, __LINE__) Animation(String(name), timelines, duration); +} + +void SkeletonBinary::readCurve(DataInput *input, int frameIndex, CurveTimeline *timeline) { + switch (readByte(input)) { + case CURVE_STEPPED: { + timeline->setStepped(frameIndex); + break; + } + case CURVE_BEZIER: { + float cx1 = readFloat(input); + float cy1 = readFloat(input); + float cx2 = readFloat(input); + float cy2 = readFloat(input); + timeline->setCurve(frameIndex, cx1, cy1, cx2, cy2); + break; + } + } +} diff --git a/cocos/editor-support/spine/SkeletonBinary.h b/cocos/editor-support/spine/SkeletonBinary.h index 3d96a1da9a9..a5c50824753 100644 --- a/cocos/editor-support/spine/SkeletonBinary.h +++ b/cocos/editor-support/spine/SkeletonBinary.h @@ -1,72 +1,130 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SKELETONBINARY_H_ -#define SPINE_SKELETONBINARY_H_ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct spAtlasAttachmentLoader; - -typedef struct spSkeletonBinary { - float scale; - spAttachmentLoader* attachmentLoader; - const char* const error; -} spSkeletonBinary; - -SP_API spSkeletonBinary* spSkeletonBinary_createWithLoader (spAttachmentLoader* attachmentLoader); -SP_API spSkeletonBinary* spSkeletonBinary_create (spAtlas* atlas); -SP_API void spSkeletonBinary_dispose (spSkeletonBinary* self); - -SP_API spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const unsigned char* binary, const int length); -SP_API spSkeletonData* spSkeletonBinary_readSkeletonDataFile (spSkeletonBinary* self, const char* path); - -#ifdef SPINE_SHORT_NAMES -typedef spSkeletonBinary SkeletonBinary; -#define SkeletonBinary_createWithLoader(...) spSkeletonBinary_createWithLoader(__VA_ARGS__) -#define SkeletonBinary_create(...) spSkeletonBinary_create(__VA_ARGS__) -#define SkeletonBinary_dispose(...) spSkeletonBinary_dispose(__VA_ARGS__) -#define SkeletonBinary_readSkeletonData(...) spSkeletonBinary_readSkeletonData(__VA_ARGS__) -#define SkeletonBinary_readSkeletonDataFile(...) spSkeletonBinary_readSkeletonDataFile(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SKELETONBINARY_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SkeletonBinary_h +#define Spine_SkeletonBinary_h + +#include +#include +#include +#include +#include + +namespace spine { + class SkeletonData; + class Atlas; + class AttachmentLoader; + class LinkedMesh; + class Skin; + class Attachment; + class VertexAttachment; + class Animation; + class CurveTimeline; + + class SP_API SkeletonBinary : public SpineObject { + public: + static const int BONE_ROTATE; + static const int BONE_TRANSLATE; + static const int BONE_SCALE; + static const int BONE_SHEAR; + + static const int SLOT_ATTACHMENT; + static const int SLOT_COLOR; + static const int SLOT_TWO_COLOR; + + static const int PATH_POSITION; + static const int PATH_SPACING; + static const int PATH_MIX; + + static const int CURVE_LINEAR; + static const int CURVE_STEPPED; + static const int CURVE_BEZIER; + + explicit SkeletonBinary(Atlas* atlasArray); + + explicit SkeletonBinary(AttachmentLoader* attachmentLoader); + + ~SkeletonBinary(); + + SkeletonData* readSkeletonData(const unsigned char* binary, int length); + + SkeletonData* readSkeletonDataFile(const String& path); + + void setScale(float scale) { _scale = scale; } + + String& getError() { return _error; } + + private: + struct DataInput : public SpineObject { + const unsigned char* cursor; + const unsigned char* end; + }; + + AttachmentLoader* _attachmentLoader; + Vector _linkedMeshes; + String _error; + float _scale; + const bool _ownsLoader; + + void setError(const char* value1, const char* value2); + + char* readString(DataInput* input); + + float readFloat(DataInput* input); + + unsigned char readByte(DataInput* input); + + signed char readSByte(DataInput* input); + + bool readBoolean(DataInput* input); + + int readInt(DataInput* input); + + void readColor(DataInput* input, Color& color); + + int readVarint(DataInput* input, bool optimizePositive); + + Skin* readSkin(DataInput* input, const String& skinName, SkeletonData* skeletonData, bool nonessential); + + Attachment* readAttachment(DataInput* input, Skin* skin, int slotIndex, const String& attachmentName, SkeletonData* skeletonData, bool nonessential); + + void readVertices(DataInput* input, VertexAttachment* attachment, int vertexCount); + + void readFloatArray(DataInput *input, int n, float scale, Vector& array); + + void readShortArray(DataInput *input, Vector& array); + + Animation* readAnimation(const String& name, DataInput* input, SkeletonData *skeletonData); + + void readCurve(DataInput* input, int frameIndex, CurveTimeline* timeline); + }; +} + +#endif /* Spine_SkeletonBinary_h */ diff --git a/cocos/editor-support/spine/SkeletonBounds.c b/cocos/editor-support/spine/SkeletonBounds.c deleted file mode 100644 index bb4eb40d0ca..00000000000 --- a/cocos/editor-support/spine/SkeletonBounds.c +++ /dev/null @@ -1,205 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -spPolygon* spPolygon_create (int capacity) { - spPolygon* self = NEW(spPolygon); - self->capacity = capacity; - CONST_CAST(float*, self->vertices) = MALLOC(float, capacity); - return self; -} - -void spPolygon_dispose (spPolygon* self) { - FREE(self->vertices); - FREE(self); -} - -int/*bool*/spPolygon_containsPoint (spPolygon* self, float x, float y) { - int prevIndex = self->count - 2; - int inside = 0; - int i; - for (i = 0; i < self->count; i += 2) { - float vertexY = self->vertices[i + 1]; - float prevY = self->vertices[prevIndex + 1]; - if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) { - float vertexX = self->vertices[i]; - if (vertexX + (y - vertexY) / (prevY - vertexY) * (self->vertices[prevIndex] - vertexX) < x) inside = !inside; - } - prevIndex = i; - } - return inside; -} - -int/*bool*/spPolygon_intersectsSegment (spPolygon* self, float x1, float y1, float x2, float y2) { - float width12 = x1 - x2, height12 = y1 - y2; - float det1 = x1 * y2 - y1 * x2; - float x3 = self->vertices[self->count - 2], y3 = self->vertices[self->count - 1]; - int i; - for (i = 0; i < self->count; i += 2) { - float x4 = self->vertices[i], y4 = self->vertices[i + 1]; - float det2 = x3 * y4 - y3 * x4; - float width34 = x3 - x4, height34 = y3 - y4; - float det3 = width12 * height34 - height12 * width34; - float x = (det1 * width34 - width12 * det2) / det3; - if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) { - float y = (det1 * height34 - height12 * det2) / det3; - if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return 1; - } - x3 = x4; - y3 = y4; - } - return 0; -} - -/**/ - -typedef struct { - spSkeletonBounds super; - int capacity; -} _spSkeletonBounds; - -spSkeletonBounds* spSkeletonBounds_create () { - return SUPER(NEW(_spSkeletonBounds)); -} - -void spSkeletonBounds_dispose (spSkeletonBounds* self) { - int i; - for (i = 0; i < SUB_CAST(_spSkeletonBounds, self)->capacity; ++i) - if (self->polygons[i]) spPolygon_dispose(self->polygons[i]); - FREE(self->polygons); - FREE(self->boundingBoxes); - FREE(self); -} - -void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/*bool*/updateAabb) { - int i; - - _spSkeletonBounds* internal = SUB_CAST(_spSkeletonBounds, self); - if (internal->capacity < skeleton->slotsCount) { - spPolygon** newPolygons; - - FREE(self->boundingBoxes); - self->boundingBoxes = MALLOC(spBoundingBoxAttachment*, skeleton->slotsCount); - - newPolygons = CALLOC(spPolygon*, skeleton->slotsCount); - memcpy(newPolygons, self->polygons, sizeof(spPolygon*) * internal->capacity); - FREE(self->polygons); - self->polygons = newPolygons; - - internal->capacity = skeleton->slotsCount; - } - - self->minX = (float)INT_MAX; - self->minY = (float)INT_MAX; - self->maxX = (float)INT_MIN; - self->maxY = (float)INT_MIN; - - self->count = 0; - for (i = 0; i < skeleton->slotsCount; ++i) { - spPolygon* polygon; - spBoundingBoxAttachment* boundingBox; - - spSlot* slot = skeleton->slots[i]; - spAttachment* attachment = slot->attachment; - if (!attachment || attachment->type != SP_ATTACHMENT_BOUNDING_BOX) continue; - boundingBox = (spBoundingBoxAttachment*)attachment; - self->boundingBoxes[self->count] = boundingBox; - - polygon = self->polygons[self->count]; - if (!polygon || polygon->capacity < boundingBox->super.worldVerticesLength) { - if (polygon) spPolygon_dispose(polygon); - self->polygons[self->count] = polygon = spPolygon_create(boundingBox->super.worldVerticesLength); - } - polygon->count = boundingBox->super.worldVerticesLength; - spVertexAttachment_computeWorldVertices(SUPER(boundingBox), slot, 0, polygon->count, polygon->vertices, 0, 2); - - if (updateAabb) { - int ii = 0; - for (; ii < polygon->count; ii += 2) { - float x = polygon->vertices[ii]; - float y = polygon->vertices[ii + 1]; - if (x < self->minX) self->minX = x; - if (y < self->minY) self->minY = y; - if (x > self->maxX) self->maxX = x; - if (y > self->maxY) self->maxY = y; - } - } - - self->count++; - } -} - -int/*bool*/spSkeletonBounds_aabbContainsPoint (spSkeletonBounds* self, float x, float y) { - return x >= self->minX && x <= self->maxX && y >= self->minY && y <= self->maxY; -} - -int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2) { - float m, x, y; - if ((x1 <= self->minX && x2 <= self->minX) || (y1 <= self->minY && y2 <= self->minY) || (x1 >= self->maxX && x2 >= self->maxX) - || (y1 >= self->maxY && y2 >= self->maxY)) return 0; - m = (y2 - y1) / (x2 - x1); - y = m * (self->minX - x1) + y1; - if (y > self->minY && y < self->maxY) return 1; - y = m * (self->maxX - x1) + y1; - if (y > self->minY && y < self->maxY) return 1; - x = (self->minY - y1) / m + x1; - if (x > self->minX && x < self->maxX) return 1; - x = (self->maxY - y1) / m + x1; - if (x > self->minX && x < self->maxX) return 1; - return 0; -} - -int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton (spSkeletonBounds* self, spSkeletonBounds* bounds) { - return self->minX < bounds->maxX && self->maxX > bounds->minX && self->minY < bounds->maxY && self->maxY > bounds->minY; -} - -spBoundingBoxAttachment* spSkeletonBounds_containsPoint (spSkeletonBounds* self, float x, float y) { - int i; - for (i = 0; i < self->count; ++i) - if (spPolygon_containsPoint(self->polygons[i], x, y)) return self->boundingBoxes[i]; - return 0; -} - -spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2) { - int i; - for (i = 0; i < self->count; ++i) - if (spPolygon_intersectsSegment(self->polygons[i], x1, y1, x2, y2)) return self->boundingBoxes[i]; - return 0; -} - -spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox) { - int i; - for (i = 0; i < self->count; ++i) - if (self->boundingBoxes[i] == boundingBox) return self->polygons[i]; - return 0; -} diff --git a/cocos/editor-support/spine/SkeletonBounds.cpp b/cocos/editor-support/spine/SkeletonBounds.cpp new file mode 100644 index 00000000000..5e9ed15858a --- /dev/null +++ b/cocos/editor-support/spine/SkeletonBounds.cpp @@ -0,0 +1,238 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include + +using namespace spine; + +SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) { +} + +void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) { + Vector &slots = skeleton._slots; + size_t slotCount = slots.size(); + + _boundingBoxes.clear(); + for (size_t i = 0, n = _polygons.size(); i < n; ++i) { + _polygonPool.add(_polygons[i]); + } + + _polygons.clear(); + + for (size_t i = 0; i < slotCount; i++) { + Slot *slot = slots[i]; + Attachment *attachment = slot->getAttachment(); + if (attachment == NULL || !attachment->getRTTI().instanceOf(BoundingBoxAttachment::rtti)) { + continue; + } + BoundingBoxAttachment *boundingBox = static_cast(attachment); + _boundingBoxes.add(boundingBox); + + Polygon *polygonP = NULL; + size_t poolCount = _polygonPool.size(); + if (poolCount > 0) { + polygonP = _polygonPool[poolCount - 1]; + _polygonPool.removeAt(poolCount - 1); + } else { + polygonP = new(__FILE__, __LINE__) Polygon(); + } + + _polygons.add(polygonP); + + Polygon &polygon = *polygonP; + + size_t count = boundingBox->getWorldVerticesLength(); + polygon._count = count; + if (polygon._vertices.size() < count) { + polygon._vertices.setSize(count, 0); + } + boundingBox->computeWorldVertices(*slot, polygon._vertices); + } + + if (updateAabb) { + aabbCompute(); + } else { + _minX = std::numeric_limits::min(); + _minY = std::numeric_limits::min(); + _maxX = std::numeric_limits::max(); + _maxY = std::numeric_limits::max(); + } +} + +bool SkeletonBounds::aabbcontainsPoint(float x, float y) { + return x >= _minX && x <= _maxX && y >= _minY && y <= _maxY; +} + +bool SkeletonBounds::aabbintersectsSegment(float x1, float y1, float x2, float y2) { + float minX = _minX; + float minY = _minY; + float maxX = _maxX; + float maxY = _maxY; + + if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || + (y1 >= maxY && y2 >= maxY)) { + return false; + } + + float m = (y2 - y1) / (x2 - x1); + float y = m * (minX - x1) + y1; + if (y > minY && y < maxY) { + return true; + } + y = m * (maxX - x1) + y1; + if (y > minY && y < maxY) { + return true; + } + float x = (minY - y1) / m + x1; + if (x > minX && x < maxX) { + return true; + } + x = (maxY - y1) / m + x1; + if (x > minX && x < maxX) { + return true; + } + return false; +} + +bool SkeletonBounds::aabbIntersectsSkeleton(SkeletonBounds bounds) { + return _minX < bounds._maxX && _maxX > bounds._minX && _minY < bounds._maxY && _maxY > bounds._minY; +} + +bool SkeletonBounds::containsPoint(Polygon *polygon, float x, float y) { + Vector &vertices = polygon->_vertices; + int nn = polygon->_count; + + int prevIndex = nn - 2; + bool inside = false; + for (int ii = 0; ii < nn; ii += 2) { + float vertexY = vertices[ii + 1]; + float prevY = vertices[prevIndex + 1]; + if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) { + float vertexX = vertices[ii]; + if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) { + inside = !inside; + } + } + prevIndex = ii; + } + return inside; +} + +BoundingBoxAttachment *SkeletonBounds::containsPoint(float x, float y) { + for (size_t i = 0, n = _polygons.size(); i < n; ++i) { + if (containsPoint(_polygons[i], x, y)) { + return _boundingBoxes[i]; + } + } + + return NULL; +} + +BoundingBoxAttachment *SkeletonBounds::intersectsSegment(float x1, float y1, float x2, float y2) { + for (size_t i = 0, n = _polygons.size(); i < n; ++i) { + if (intersectsSegment(_polygons[i], x1, y1, x2, y2)) { + return _boundingBoxes[i]; + } + } + return NULL; +} + +bool SkeletonBounds::intersectsSegment(Polygon *polygon, float x1, float y1, float x2, float y2) { + Vector &vertices = polygon->_vertices; + size_t nn = polygon->_count; + + float width12 = x1 - x2, height12 = y1 - y2; + float det1 = x1 * y2 - y1 * x2; + float x3 = vertices[nn - 2], y3 = vertices[nn - 1]; + for (size_t ii = 0; ii < nn; ii += 2) { + float x4 = vertices[ii], y4 = vertices[ii + 1]; + float det2 = x3 * y4 - y3 * x4; + float width34 = x3 - x4, height34 = y3 - y4; + float det3 = width12 * height34 - height12 * width34; + float x = (det1 * width34 - width12 * det2) / det3; + if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) { + float y = (det1 * height34 - height12 * det2) / det3; + if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) { + return true; + } + } + x3 = x4; + y3 = y4; + } + + return false; +} + +spine::Polygon *SkeletonBounds::getPolygon(BoundingBoxAttachment *attachment) { + int index = _boundingBoxes.indexOf(attachment); + + return index == -1 ? NULL : _polygons[index]; +} + +float SkeletonBounds::getWidth() { + return _maxX - _minX; +} + +float SkeletonBounds::getHeight() { + return _maxY - _minY; +} + +void SkeletonBounds::aabbCompute() { + float minX = std::numeric_limits::min(); + float minY = std::numeric_limits::min(); + float maxX = std::numeric_limits::max(); + float maxY = std::numeric_limits::max(); + + for (size_t i = 0, n = _polygons.size(); i < n; ++i) { + Polygon *polygon = _polygons[i]; + Vector &vertices = polygon->_vertices; + for (int ii = 0, nn = polygon->_count; ii < nn; ii += 2) { + float x = vertices[ii]; + float y = vertices[ii + 1]; + minX = MathUtil::min(minX, x); + minY = MathUtil::min(minY, y); + maxX = MathUtil::max(maxX, x); + maxY = MathUtil::max(maxY, y); + } + } + _minX = minX; + _minY = minY; + _maxX = maxX; + _maxY = maxY; +} diff --git a/cocos/editor-support/spine/SkeletonBounds.h b/cocos/editor-support/spine/SkeletonBounds.h index da435c0a703..28a1a949219 100644 --- a/cocos/editor-support/spine/SkeletonBounds.h +++ b/cocos/editor-support/spine/SkeletonBounds.h @@ -1,113 +1,108 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SKELETONBOUNDS_H_ -#define SPINE_SKELETONBOUNDS_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spPolygon { - float* const vertices; - int count; - int capacity; -} spPolygon; - -SP_API spPolygon* spPolygon_create (int capacity); -SP_API void spPolygon_dispose (spPolygon* self); - -SP_API int/*bool*/spPolygon_containsPoint (spPolygon* polygon, float x, float y); -SP_API int/*bool*/spPolygon_intersectsSegment (spPolygon* polygon, float x1, float y1, float x2, float y2); - -#ifdef SPINE_SHORT_NAMES -typedef spPolygon Polygon; -#define Polygon_create(...) spPolygon_create(__VA_ARGS__) -#define Polygon_dispose(...) spPolygon_dispose(__VA_ARGS__) -#define Polygon_containsPoint(...) spPolygon_containsPoint(__VA_ARGS__) -#define Polygon_intersectsSegment(...) spPolygon_intersectsSegment(__VA_ARGS__) -#endif - -/**/ - -typedef struct spSkeletonBounds { - int count; - spBoundingBoxAttachment** boundingBoxes; - spPolygon** polygons; - - float minX, minY, maxX, maxY; -} spSkeletonBounds; - -SP_API spSkeletonBounds* spSkeletonBounds_create (); -SP_API void spSkeletonBounds_dispose (spSkeletonBounds* self); -SP_API void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/*bool*/updateAabb); - -/** Returns true if the axis aligned bounding box contains the point. */ -SP_API int/*bool*/spSkeletonBounds_aabbContainsPoint (spSkeletonBounds* self, float x, float y); - -/** Returns true if the axis aligned bounding box intersects the line segment. */ -SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2); - -/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */ -SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton (spSkeletonBounds* self, spSkeletonBounds* bounds); - -/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more - * efficient to only call this method if spSkeletonBounds_aabbContainsPoint returns true. */ -SP_API spBoundingBoxAttachment* spSkeletonBounds_containsPoint (spSkeletonBounds* self, float x, float y); - -/** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually - * more efficient to only call this method if spSkeletonBounds_aabbIntersectsSegment returns true. */ -SP_API spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2); - -/** Returns the polygon for the specified bounding box, or null. */ -SP_API spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox); - -#ifdef SPINE_SHORT_NAMES -typedef spSkeletonBounds SkeletonBounds; -#define SkeletonBounds_create(...) spSkeletonBounds_create(__VA_ARGS__) -#define SkeletonBounds_dispose(...) spSkeletonBounds_dispose(__VA_ARGS__) -#define SkeletonBounds_update(...) spSkeletonBounds_update(__VA_ARGS__) -#define SkeletonBounds_aabbContainsPoint(...) spSkeletonBounds_aabbContainsPoint(__VA_ARGS__) -#define SkeletonBounds_aabbIntersectsSegment(...) spSkeletonBounds_aabbIntersectsSegment(__VA_ARGS__) -#define SkeletonBounds_aabbIntersectsSkeleton(...) spSkeletonBounds_aabbIntersectsSkeleton(__VA_ARGS__) -#define SkeletonBounds_containsPoint(...) spSkeletonBounds_containsPoint(__VA_ARGS__) -#define SkeletonBounds_intersectsSegment(...) spSkeletonBounds_intersectsSegment(__VA_ARGS__) -#define SkeletonBounds_getPolygon(...) spSkeletonBounds_getPolygon(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SKELETONBOUNDS_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SkeletonBounds_h +#define Spine_SkeletonBounds_h + +#include +#include + +namespace spine { + class Skeleton; + class BoundingBoxAttachment; + class Polygon; + + /// + /// Collects each BoundingBoxAttachment that is visible and computes the world vertices for its polygon. + /// The polygon vertices are provided along with convenience methods for doing hit detection. + /// + class SP_API SkeletonBounds : public SpineObject { + public: + SkeletonBounds(); + + /// + /// Clears any previous polygons, finds all visible bounding box attachments, + /// and computes the world vertices for each bounding box's polygon. + /// @param skeleton The skeleton. + /// @param updateAabb + /// If true, the axis aligned bounding box containing all the polygons is computed. + /// If false, the SkeletonBounds AABB methods will always return true. + /// + void update(Skeleton& skeleton, bool updateAabb); + + /// Returns true if the axis aligned bounding box contains the point. + bool aabbcontainsPoint(float x, float y); + + /// Returns true if the axis aligned bounding box intersects the line segment. + bool aabbintersectsSegment(float x1, float y1, float x2, float y2); + + /// Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. + bool aabbIntersectsSkeleton(SkeletonBounds bounds); + + /// Returns true if the polygon contains the point. + bool containsPoint(Polygon* polygon, float x, float y); + + /// Returns the first bounding box attachment that contains the point, or NULL. When doing many checks, it is usually more + /// efficient to only call this method if {@link #aabbcontainsPoint(float, float)} returns true. + BoundingBoxAttachment* containsPoint(float x, float y); + + /// Returns the first bounding box attachment that contains the line segment, or NULL. When doing many checks, it is usually + /// more efficient to only call this method if {@link #aabbintersectsSegment(float, float, float, float)} returns true. + BoundingBoxAttachment* intersectsSegment(float x1, float y1, float x2, float y2); + + /// Returns true if the polygon contains the line segment. + bool intersectsSegment(Polygon* polygon, float x1, float y1, float x2, float y2); + + Polygon* getPolygon(BoundingBoxAttachment* attachment); + + float getWidth(); + float getHeight(); + + private: + Vector _polygonPool; + Vector _boundingBoxes; + Vector _polygons; + float _minX, _minY, _maxX, _maxY; + + void aabbCompute(); + }; + + class Polygon : public SpineObject { + public: + Vector _vertices; + int _count; + + Polygon() : _count(0) { + _vertices.ensureCapacity(16); + } + }; +} + +#endif /* Spine_SkeletonBounds_h */ diff --git a/cocos/editor-support/spine/SkeletonClipping.c b/cocos/editor-support/spine/SkeletonClipping.c deleted file mode 100644 index a46dea73e4e..00000000000 --- a/cocos/editor-support/spine/SkeletonClipping.c +++ /dev/null @@ -1,313 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spSkeletonClipping* spSkeletonClipping_create() { - spSkeletonClipping* clipping = CALLOC(spSkeletonClipping, 1); - - clipping->triangulator = spTriangulator_create(); - clipping->clippingPolygon = spFloatArray_create(128); - clipping->clipOutput = spFloatArray_create(128); - clipping->clippedVertices = spFloatArray_create(128); - clipping->clippedUVs = spFloatArray_create(128); - clipping->clippedTriangles = spUnsignedShortArray_create(128); - clipping->scratch = spFloatArray_create(128); - - return clipping; -} - -void spSkeletonClipping_dispose(spSkeletonClipping* self) { - spTriangulator_dispose(self->triangulator); - spFloatArray_dispose(self->clippingPolygon); - spFloatArray_dispose(self->clipOutput); - spFloatArray_dispose(self->clippedVertices); - spFloatArray_dispose(self->clippedUVs); - spUnsignedShortArray_dispose(self->clippedTriangles); - spFloatArray_dispose(self->scratch); - FREE(self); -} - -static void _makeClockwise (spFloatArray* polygon) { - int i, n, lastX; - float* vertices = polygon->items; - int verticeslength = polygon->size; - - float area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x, p1y, p2x, p2y; - for (i = 0, n = verticeslength - 3; i < n; i += 2) { - p1x = vertices[i]; - p1y = vertices[i + 1]; - p2x = vertices[i + 2]; - p2y = vertices[i + 3]; - area += p1x * p2y - p2x * p1y; - } - if (area < 0) return; - - for (i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) { - float x = vertices[i], y = vertices[i + 1]; - int other = lastX - i; - vertices[i] = vertices[other]; - vertices[i + 1] = vertices[other + 1]; - vertices[other] = x; - vertices[other + 1] = y; - } -} - -int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClippingAttachment* clip) { - int i, n; - float* vertices; - if (self->clipAttachment) return 0; - self->clipAttachment = clip; - - n = clip->super.worldVerticesLength; - vertices = spFloatArray_setSize(self->clippingPolygon, n)->items; - spVertexAttachment_computeWorldVertices(SUPER(clip), slot, 0, n, vertices, 0, 2); - _makeClockwise(self->clippingPolygon); - self->clippingPolygons = spTriangulator_decompose(self->triangulator, self->clippingPolygon, spTriangulator_triangulate(self->triangulator, self->clippingPolygon)); - for (i = 0, n = self->clippingPolygons->size; i < n; i++) { - spFloatArray* polygon = self->clippingPolygons->items[i]; - _makeClockwise(polygon); - spFloatArray_add(polygon, polygon->items[0]); - spFloatArray_add(polygon, polygon->items[1]); - } - return self->clippingPolygons->size; -} - -void spSkeletonClipping_clipEnd(spSkeletonClipping* self, spSlot* slot) { - if (self->clipAttachment != 0 && self->clipAttachment->endSlot == slot->data) spSkeletonClipping_clipEnd2(self); -} - -void spSkeletonClipping_clipEnd2(spSkeletonClipping* self) { - if (!self->clipAttachment) return; - self->clipAttachment = 0; - self->clippingPolygons = 0; - spFloatArray_clear(self->clippedVertices); - spFloatArray_clear(self->clippedUVs); - spUnsignedShortArray_clear(self->clippedTriangles); - spFloatArray_clear(self->clippingPolygon); -} - -int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping* self) { - return self->clipAttachment != 0; -} - -int /*boolean*/ _clip(spSkeletonClipping* self, float x1, float y1, float x2, float y2, float x3, float y3, spFloatArray* clippingArea, spFloatArray* output) { - int i; - spFloatArray* originalOutput = output; - int clipped = 0; - float* clippingVertices; - int clippingVerticesLast; - - spFloatArray* input = 0; - if (clippingArea->size % 4 >= 2) { - input = output; - output = self->scratch; - } else - input = self->scratch; - - spFloatArray_clear(input); - spFloatArray_add(input, x1); - spFloatArray_add(input, y1); - spFloatArray_add(input, x2); - spFloatArray_add(input, y2); - spFloatArray_add(input, x3); - spFloatArray_add(input, y3); - spFloatArray_add(input, x1); - spFloatArray_add(input, y1); - spFloatArray_clear(output); - - clippingVertices = clippingArea->items; - clippingVerticesLast = clippingArea->size - 4; - for (i = 0;; i += 2) { - int ii; - spFloatArray* temp; - float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1]; - float edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3]; - float deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2; - - float* inputVertices = input->items; - int inputVerticesLength = input->size - 2, outputStart = output->size; - for (ii = 0; ii < inputVerticesLength; ii += 2) { - float inputX = inputVertices[ii], inputY = inputVertices[ii + 1]; - float inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3]; - int side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0; - if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) { - float c0, c2; - float ua; - if (side2) { - spFloatArray_add(output, inputX2); - spFloatArray_add(output, inputY2); - continue; - } - c0 = inputY2 - inputY, c2 = inputX2 - inputX; - ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY)); - spFloatArray_add(output, edgeX + (edgeX2 - edgeX) * ua); - spFloatArray_add(output, edgeY + (edgeY2 - edgeY) * ua); - } else if (side2) { - float c0 = inputY2 - inputY, c2 = inputX2 - inputX; - float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY)); - spFloatArray_add(output, edgeX + (edgeX2 - edgeX) * ua); - spFloatArray_add(output, edgeY + (edgeY2 - edgeY) * ua); - spFloatArray_add(output, inputX2); - spFloatArray_add(output, inputY2); - } - clipped = 1; - } - - if (outputStart == output->size) { - spFloatArray_clear(originalOutput); - return 1; - } - - spFloatArray_add(output, output->items[0]); - spFloatArray_add(output, output->items[1]); - - if (i == clippingVerticesLast) break; - temp = output; - output = input; - spFloatArray_clear(output); - input = temp; - } - - if (originalOutput != output) { - spFloatArray_clear(originalOutput); - spFloatArray_addAllValues(originalOutput, output->items, 0, output->size - 2); - } else - spFloatArray_setSize(originalOutput, originalOutput->size - 2); - - return clipped; -} - -void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices, int verticesLength, unsigned short* triangles, int trianglesLength, float* uvs, int stride) { - int i; - spFloatArray* clipOutput = self->clipOutput; - spFloatArray* clippedVertices = self->clippedVertices; - spFloatArray* clippedUVs = self->clippedUVs; - spUnsignedShortArray* clippedTriangles = self->clippedTriangles; - spFloatArray** polygons = self->clippingPolygons->items; - int polygonsCount = self->clippingPolygons->size; - - short index = 0; - spFloatArray_clear(clippedVertices); - spFloatArray_clear(clippedUVs); - spUnsignedShortArray_clear(clippedTriangles); - i = 0; - continue_outer: - for (; i < trianglesLength; i += 3) { - int p; - int vertexOffset = triangles[i] * stride; - float x2, y2, u2, v2, x3, y3, u3, v3; - float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1]; - float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1]; - - vertexOffset = triangles[i + 1] * stride; - x2 = vertices[vertexOffset]; y2 = vertices[vertexOffset + 1]; - u2 = uvs[vertexOffset]; v2 = uvs[vertexOffset + 1]; - - vertexOffset = triangles[i + 2] * stride; - x3 = vertices[vertexOffset]; y3 = vertices[vertexOffset + 1]; - u3 = uvs[vertexOffset]; v3 = uvs[vertexOffset + 1]; - - for (p = 0; p < polygonsCount; p++) { - int s = clippedVertices->size; - if (_clip(self, x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) { - int ii; - float d0, d1, d2, d4, d; - unsigned short* clippedTrianglesItems; - int clipOutputCount; - float* clipOutputItems; - float* clippedVerticesItems; - float* clippedUVsItems; - - int clipOutputLength = clipOutput->size; - if (clipOutputLength == 0) continue; - d0 = y2 - y3; d1 = x3 - x2; d2 = x1 - x3; d4 = y3 - y1; - d = 1 / (d0 * d2 + d1 * (y1 - y3)); - - clipOutputCount = clipOutputLength >> 1; - clipOutputItems = clipOutput->items; - clippedVerticesItems = spFloatArray_setSize(clippedVertices, s + (clipOutputCount << 1))->items; - clippedUVsItems = spFloatArray_setSize(clippedUVs, s + (clipOutputCount << 1))->items; - for (ii = 0; ii < clipOutputLength; ii += 2) { - float c0, c1, a, b, c; - float x = clipOutputItems[ii], y = clipOutputItems[ii + 1]; - clippedVerticesItems[s] = x; - clippedVerticesItems[s + 1] = y; - c0 = x - x3; c1 = y - y3; - a = (d0 * c0 + d1 * c1) * d; - b = (d4 * c0 + d2 * c1) * d; - c = 1 - a - b; - clippedUVsItems[s] = u1 * a + u2 * b + u3 * c; - clippedUVsItems[s + 1] = v1 * a + v2 * b + v3 * c; - s += 2; - } - - s = clippedTriangles->size; - clippedTrianglesItems = spUnsignedShortArray_setSize(clippedTriangles, s + 3 * (clipOutputCount - 2))->items; - clipOutputCount--; - for (ii = 1; ii < clipOutputCount; ii++) { - clippedTrianglesItems[s] = index; - clippedTrianglesItems[s + 1] = (unsigned short)(index + ii); - clippedTrianglesItems[s + 2] = (unsigned short)(index + ii + 1); - s += 3; - } - index += clipOutputCount + 1; - - } else { - unsigned short* clippedTrianglesItems; - float* clippedVerticesItems = spFloatArray_setSize(clippedVertices, s + (3 << 1))->items; - float* clippedUVsItems = spFloatArray_setSize(clippedUVs, s + (3 << 1))->items; - clippedVerticesItems[s] = x1; - clippedVerticesItems[s + 1] = y1; - clippedVerticesItems[s + 2] = x2; - clippedVerticesItems[s + 3] = y2; - clippedVerticesItems[s + 4] = x3; - clippedVerticesItems[s + 5] = y3; - - clippedUVsItems[s] = u1; - clippedUVsItems[s + 1] = v1; - clippedUVsItems[s + 2] = u2; - clippedUVsItems[s + 3] = v2; - clippedUVsItems[s + 4] = u3; - clippedUVsItems[s + 5] = v3; - - s = clippedTriangles->size; - clippedTrianglesItems = spUnsignedShortArray_setSize(clippedTriangles, s + 3)->items; - clippedTrianglesItems[s] = index; - clippedTrianglesItems[s + 1] = (unsigned short)(index + 1); - clippedTrianglesItems[s + 2] = (unsigned short)(index + 2); - index += 3; - i += 3; - goto continue_outer; - } - } - } -} diff --git a/cocos/editor-support/spine/SkeletonClipping.cpp b/cocos/editor-support/spine/SkeletonClipping.cpp new file mode 100644 index 00000000000..d86aff2f56c --- /dev/null +++ b/cocos/editor-support/spine/SkeletonClipping.cpp @@ -0,0 +1,336 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +using namespace spine; + +SkeletonClipping::SkeletonClipping() : _clipAttachment(NULL) { + _clipOutput.ensureCapacity(128); + _clippedVertices.ensureCapacity(128); + _clippedTriangles.ensureCapacity(128); + _clippedUVs.ensureCapacity(128); +} + +size_t SkeletonClipping::clipStart(Slot &slot, ClippingAttachment *clip) { + if (_clipAttachment != NULL) { + return 0; + } + + _clipAttachment = clip; + + int n = clip->getWorldVerticesLength(); + _clippingPolygon.setSize(n, 0); + clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2); + makeClockwise(_clippingPolygon); + _clippingPolygons = &_triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon)); + + for (size_t i = 0; i < _clippingPolygons->size(); ++i) { + Vector *polygonP = (*_clippingPolygons)[i]; + Vector &polygon = *polygonP; + makeClockwise(polygon); + polygon.add(polygon[0]); + polygon.add(polygon[1]); + } + + return (*_clippingPolygons).size(); +} + +void SkeletonClipping::clipEnd(Slot &slot) { + if (_clipAttachment != NULL && _clipAttachment->_endSlot == &slot._data) { + clipEnd(); + } +} + +void SkeletonClipping::clipEnd() { + if (_clipAttachment == NULL) { + return; + } + + _clipAttachment = NULL; + _clippingPolygons = NULL; + _clippedVertices.clear(); + _clippedUVs.clear(); + _clippedTriangles.clear(); + _clippingPolygon.clear(); +} + +void SkeletonClipping::clipTriangles(Vector &vertices, Vector &triangles, Vector &uvs, size_t stride) { + clipTriangles(vertices.buffer(), triangles.buffer(), triangles.size(), uvs.buffer(), stride); +} + +void SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles, + size_t trianglesLength, float *uvs, size_t stride) { + Vector &clipOutput = _clipOutput; + Vector &clippedVertices = _clippedVertices; + Vector &clippedTriangles = _clippedTriangles; + Vector *> &polygons = *_clippingPolygons; + size_t polygonsCount = (*_clippingPolygons).size(); + + size_t index = 0; + clippedVertices.clear(); + _clippedUVs.clear(); + clippedTriangles.clear(); + + size_t i = 0; + continue_outer: + for (; i < trianglesLength; i += 3) { + int vertexOffset = triangles[i] * stride; + float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1]; + float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1]; + + vertexOffset = triangles[i + 1] * stride; + float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1]; + float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1]; + + vertexOffset = triangles[i + 2] * stride; + float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1]; + float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1]; + + for (size_t p = 0; p < polygonsCount; p++) { + size_t s = clippedVertices.size(); + if (clip(x1, y1, x2, y2, x3, y3, &(*polygons[p]), &clipOutput)) { + size_t clipOutputLength = clipOutput.size(); + if (clipOutputLength == 0) { + continue; + } + float d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1; + float d = 1 / (d0 * d2 + d1 * (y1 - y3)); + + size_t clipOutputCount = clipOutputLength >> 1; + clippedVertices.setSize(s + clipOutputCount * 2, 0); + _clippedUVs.setSize(s + clipOutputCount * 2, 0); + for (size_t ii = 0; ii < clipOutputLength; ii += 2) { + float x = clipOutput[ii], y = clipOutput[ii + 1]; + clippedVertices[s] = x; + clippedVertices[s + 1] = y; + float c0 = x - x3, c1 = y - y3; + float a = (d0 * c0 + d1 * c1) * d; + float b = (d4 * c0 + d2 * c1) * d; + float c = 1 - a - b; + _clippedUVs[s] = u1 * a + u2 * b + u3 * c; + _clippedUVs[s + 1] = v1 * a + v2 * b + v3 * c; + s += 2; + } + + s = clippedTriangles.size(); + clippedTriangles.setSize(s + 3 * (clipOutputCount - 2), 0); + clipOutputCount--; + for (size_t ii = 1; ii < clipOutputCount; ii++) { + clippedTriangles[s] = (unsigned short)(index); + clippedTriangles[s + 1] = (unsigned short)(index + ii); + clippedTriangles[s + 2] = (unsigned short)(index + ii + 1); + s += 3; + } + index += clipOutputCount + 1; + } else { + clippedVertices.setSize(s + 3 * 2, 0); + _clippedUVs.setSize(s + 3 * 2, 0); + clippedVertices[s] = x1; + clippedVertices[s + 1] = y1; + clippedVertices[s + 2] = x2; + clippedVertices[s + 3] = y2; + clippedVertices[s + 4] = x3; + clippedVertices[s + 5] = y3; + + _clippedUVs[s] = u1; + _clippedUVs[s + 1] = v1; + _clippedUVs[s + 2] = u2; + _clippedUVs[s + 3] = v2; + _clippedUVs[s + 4] = u3; + _clippedUVs[s + 5] = v3; + + s = clippedTriangles.size(); + clippedTriangles.setSize(s + 3, 0); + clippedTriangles[s] = (unsigned short)index; + clippedTriangles[s + 1] = (unsigned short)(index + 1); + clippedTriangles[s + 2] = (unsigned short)(index + 2); + index += 3; + i += 3; + goto continue_outer; + } + } + } +} + +bool SkeletonClipping::isClipping() { + return _clipAttachment != NULL; +} + +Vector &SkeletonClipping::getClippedVertices() { + return _clippedVertices; +} + +Vector &SkeletonClipping::getClippedTriangles() { + return _clippedTriangles; +} + +Vector &SkeletonClipping::getClippedUVs() { + return _clippedUVs; +} + +bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector *clippingArea, + Vector *output) { + Vector *originalOutput = output; + bool clipped = false; + + // Avoid copy at the end. + Vector *input; + if (clippingArea->size() % 4 >= 2) { + input = output; + output = &_scratch; + } else { + input = &_scratch; + } + + input->clear(); + input->add(x1); + input->add(y1); + input->add(x2); + input->add(y2); + input->add(x3); + input->add(y3); + input->add(x1); + input->add(y1); + output->clear(); + + Vector &clippingVertices = *clippingArea; + size_t clippingVerticesLast = clippingArea->size() - 4; + for (size_t i = 0;; i += 2) { + float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1]; + float edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3]; + float deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2; + + Vector &inputVertices = *input; + size_t inputVerticesLength = input->size() - 2, outputStart = output->size(); + for (size_t ii = 0; ii < inputVerticesLength; ii += 2) { + float inputX = inputVertices[ii], inputY = inputVertices[ii + 1]; + float inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3]; + bool side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0; + if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) { + if (side2) { + // v1 inside, v2 inside + output->add(inputX2); + output->add(inputY2); + continue; + } + // v1 inside, v2 outside + float c0 = inputY2 - inputY, c2 = inputX2 - inputX; + float s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY); + if (MathUtil::abs(s) > 0.000001f) { + float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s; + output->add(edgeX + (edgeX2 - edgeX) * ua); + output->add(edgeY + (edgeY2 - edgeY) * ua); + } else { + output->add(edgeX); + output->add(edgeY); + } + } else if (side2) { + // v1 outside, v2 inside + float c0 = inputY2 - inputY, c2 = inputX2 - inputX; + float s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY); + if (MathUtil::abs(s) > 0.000001f) { + float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s; + output->add(edgeX + (edgeX2 - edgeX) * ua); + output->add(edgeY + (edgeY2 - edgeY) * ua); + } else { + output->add(edgeX); + output->add(edgeY); + } + output->add(inputX2); + output->add(inputY2); + } + clipped = true; + } + + if (outputStart == output->size()) { + // All edges outside. + originalOutput->clear(); + return true; + } + + output->add((*output)[0]); + output->add((*output)[1]); + + if (i == clippingVerticesLast) { + break; + } + Vector *temp = output; + output = input; + output->clear(); + input = temp; + } + + if (originalOutput != output) { + originalOutput->clear(); + for (size_t i = 0, n = output->size() - 2; i < n; ++i) { + originalOutput->add((*output)[i]); + } + } else { + originalOutput->setSize(originalOutput->size() - 2, 0); + } + + return clipped; +} + +void SkeletonClipping::makeClockwise(Vector &polygon) { + size_t verticeslength = polygon.size(); + + float area = + polygon[verticeslength - 2] * polygon[1] - polygon[0] * polygon[verticeslength - 1], p1x, p1y, p2x, p2y; + + for (size_t i = 0, n = verticeslength - 3; i < n; i += 2) { + p1x = polygon[i]; + p1y = polygon[i + 1]; + p2x = polygon[i + 2]; + p2y = polygon[i + 3]; + area += p1x * p2y - p2x * p1y; + } + + if (area < 0) { + return; + } + + for (size_t i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) { + float x = polygon[i], y = polygon[i + 1]; + int other = lastX - i; + polygon[i] = polygon[other]; + polygon[i + 1] = polygon[other + 1]; + polygon[other] = x; + polygon[other + 1] = y; + } +} diff --git a/cocos/editor-support/spine/SkeletonClipping.h b/cocos/editor-support/spine/SkeletonClipping.h index 74f21fccb79..f2b97dcfd53 100644 --- a/cocos/editor-support/spine/SkeletonClipping.h +++ b/cocos/editor-support/spine/SkeletonClipping.h @@ -28,41 +28,53 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef SPINE_SKELETONCLIPPING_H -#define SPINE_SKELETONCLIPPING_H +#ifndef Spine_SkeletonClipping_h +#define Spine_SkeletonClipping_h -#include -#include -#include -#include +#include #include -#ifdef __cplusplus -extern "C" { -#endif +namespace spine { + class Slot; + class ClippingAttachment; + + class SP_API SkeletonClipping : public SpineObject { + public: + SkeletonClipping(); -typedef struct spSkeletonClipping { - spTriangulator* triangulator; - spFloatArray* clippingPolygon; - spFloatArray* clipOutput; - spFloatArray* clippedVertices; - spFloatArray* clippedUVs; - spUnsignedShortArray* clippedTriangles; - spFloatArray* scratch; - spClippingAttachment* clipAttachment; - spArrayFloatArray* clippingPolygons; -} spSkeletonClipping; - -SP_API spSkeletonClipping* spSkeletonClipping_create(); -SP_API int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClippingAttachment* clip); -SP_API void spSkeletonClipping_clipEnd(spSkeletonClipping* self, spSlot* slot); -SP_API void spSkeletonClipping_clipEnd2(spSkeletonClipping* self); -SP_API int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping* self); -SP_API void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices, int verticesLength, unsigned short* triangles, int trianglesLength, float* uvs, int stride); -SP_API void spSkeletonClipping_dispose(spSkeletonClipping* self); - -#ifdef __cplusplus + size_t clipStart(Slot& slot, ClippingAttachment* clip); + + void clipEnd(Slot& slot); + + void clipEnd(); + + void clipTriangles(float* vertices, unsigned short* triangles, size_t trianglesLength, float* uvs, size_t stride); + + void clipTriangles(Vector& vertices, Vector& triangles, Vector& uvs, size_t stride); + + bool isClipping(); + + Vector& getClippedVertices(); + Vector& getClippedTriangles(); + Vector& getClippedUVs(); + + private: + Triangulator _triangulator; + Vector _clippingPolygon; + Vector _clipOutput; + Vector _clippedVertices; + Vector _clippedTriangles; + Vector _clippedUVs; + Vector _scratch; + ClippingAttachment* _clipAttachment; + Vector< Vector* > *_clippingPolygons; + + /** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping + * area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */ + bool clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector* clippingArea, Vector* output); + + static void makeClockwise(Vector& polygon); + }; } -#endif -#endif /* SPINE_SKELETONCLIPPING_H */ +#endif /* Spine_SkeletonClipping_h */ diff --git a/cocos/editor-support/spine/SkeletonData.c b/cocos/editor-support/spine/SkeletonData.c deleted file mode 100644 index 9db2c03067e..00000000000 --- a/cocos/editor-support/spine/SkeletonData.c +++ /dev/null @@ -1,147 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -spSkeletonData* spSkeletonData_create () { - return NEW(spSkeletonData); -} - -void spSkeletonData_dispose (spSkeletonData* self) { - int i; - for (i = 0; i < self->bonesCount; ++i) - spBoneData_dispose(self->bones[i]); - FREE(self->bones); - - for (i = 0; i < self->slotsCount; ++i) - spSlotData_dispose(self->slots[i]); - FREE(self->slots); - - for (i = 0; i < self->skinsCount; ++i) - spSkin_dispose(self->skins[i]); - FREE(self->skins); - - for (i = 0; i < self->eventsCount; ++i) - spEventData_dispose(self->events[i]); - FREE(self->events); - - for (i = 0; i < self->animationsCount; ++i) - spAnimation_dispose(self->animations[i]); - FREE(self->animations); - - for (i = 0; i < self->ikConstraintsCount; ++i) - spIkConstraintData_dispose(self->ikConstraints[i]); - FREE(self->ikConstraints); - - for (i = 0; i < self->transformConstraintsCount; ++i) - spTransformConstraintData_dispose(self->transformConstraints[i]); - FREE(self->transformConstraints); - - for (i = 0; i < self->pathConstraintsCount; i++) - spPathConstraintData_dispose(self->pathConstraints[i]); - FREE(self->pathConstraints); - - FREE(self->hash); - FREE(self->version); - - FREE(self); -} - -spBoneData* spSkeletonData_findBone (const spSkeletonData* self, const char* boneName) { - int i; - for (i = 0; i < self->bonesCount; ++i) - if (strcmp(self->bones[i]->name, boneName) == 0) return self->bones[i]; - return 0; -} - -int spSkeletonData_findBoneIndex (const spSkeletonData* self, const char* boneName) { - int i; - for (i = 0; i < self->bonesCount; ++i) - if (strcmp(self->bones[i]->name, boneName) == 0) return i; - return -1; -} - -spSlotData* spSkeletonData_findSlot (const spSkeletonData* self, const char* slotName) { - int i; - for (i = 0; i < self->slotsCount; ++i) - if (strcmp(self->slots[i]->name, slotName) == 0) return self->slots[i]; - return 0; -} - -int spSkeletonData_findSlotIndex (const spSkeletonData* self, const char* slotName) { - int i; - for (i = 0; i < self->slotsCount; ++i) - if (strcmp(self->slots[i]->name, slotName) == 0) return i; - return -1; -} - -spSkin* spSkeletonData_findSkin (const spSkeletonData* self, const char* skinName) { - int i; - for (i = 0; i < self->skinsCount; ++i) - if (strcmp(self->skins[i]->name, skinName) == 0) return self->skins[i]; - return 0; -} - -spEventData* spSkeletonData_findEvent (const spSkeletonData* self, const char* eventName) { - int i; - for (i = 0; i < self->eventsCount; ++i) - if (strcmp(self->events[i]->name, eventName) == 0) return self->events[i]; - return 0; -} - -spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName) { - int i; - for (i = 0; i < self->animationsCount; ++i) - if (strcmp(self->animations[i]->name, animationName) == 0) return self->animations[i]; - return 0; -} - -spIkConstraintData* spSkeletonData_findIkConstraint (const spSkeletonData* self, const char* constraintName) { - int i; - for (i = 0; i < self->ikConstraintsCount; ++i) - if (strcmp(self->ikConstraints[i]->name, constraintName) == 0) return self->ikConstraints[i]; - return 0; -} - -spTransformConstraintData* spSkeletonData_findTransformConstraint (const spSkeletonData* self, const char* constraintName) { - int i; - for (i = 0; i < self->transformConstraintsCount; ++i) - if (strcmp(self->transformConstraints[i]->name, constraintName) == 0) return self->transformConstraints[i]; - return 0; -} - -spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName) { - int i; - for (i = 0; i < self->pathConstraintsCount; ++i) - if (strcmp(self->pathConstraints[i]->name, constraintName) == 0) return self->pathConstraints[i]; - return 0; -} diff --git a/cocos/editor-support/spine/SkeletonData.cpp b/cocos/editor-support/spine/SkeletonData.cpp new file mode 100644 index 00000000000..e0b24a79656 --- /dev/null +++ b/cocos/editor-support/spine/SkeletonData.cpp @@ -0,0 +1,222 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace spine; + +SkeletonData::SkeletonData() : + _name(), + _defaultSkin(NULL), + _width(0), + _height(0), + _version(), + _hash(), + _fps(0), + _imagesPath() { +} + +SkeletonData::~SkeletonData() { + ContainerUtil::cleanUpVectorOfPointers(_bones); + ContainerUtil::cleanUpVectorOfPointers(_slots); + ContainerUtil::cleanUpVectorOfPointers(_skins); + + _defaultSkin = NULL; + + ContainerUtil::cleanUpVectorOfPointers(_events); + ContainerUtil::cleanUpVectorOfPointers(_animations); + ContainerUtil::cleanUpVectorOfPointers(_ikConstraints); + ContainerUtil::cleanUpVectorOfPointers(_transformConstraints); + ContainerUtil::cleanUpVectorOfPointers(_pathConstraints); +} + +BoneData *SkeletonData::findBone(const String &boneName) { + return ContainerUtil::findWithName(_bones, boneName); +} + +int SkeletonData::findBoneIndex(const String &boneName) { + return ContainerUtil::findIndexWithName(_bones, boneName); +} + +SlotData *SkeletonData::findSlot(const String &slotName) { + return ContainerUtil::findWithName(_slots, slotName); +} + +int SkeletonData::findSlotIndex(const String &slotName) { + return ContainerUtil::findIndexWithName(_slots, slotName); +} + +Skin *SkeletonData::findSkin(const String &skinName) { + return ContainerUtil::findWithName(_skins, skinName); +} + +spine::EventData *SkeletonData::findEvent(const String &eventDataName) { + return ContainerUtil::findWithName(_events, eventDataName); +} + +Animation *SkeletonData::findAnimation(const String &animationName) { + return ContainerUtil::findWithName(_animations, animationName); +} + +IkConstraintData *SkeletonData::findIkConstraint(const String &constraintName) { + return ContainerUtil::findWithName(_ikConstraints, constraintName); +} + +TransformConstraintData *SkeletonData::findTransformConstraint(const String &constraintName) { + return ContainerUtil::findWithName(_transformConstraints, constraintName); +} + +PathConstraintData *SkeletonData::findPathConstraint(const String &constraintName) { + return ContainerUtil::findWithName(_pathConstraints, constraintName); +} + +int SkeletonData::findPathConstraintIndex(const String &pathConstraintName) { + return ContainerUtil::findIndexWithName(_pathConstraints, pathConstraintName); +} + +const String &SkeletonData::getName() { + return _name; +} + +void SkeletonData::setName(const String &inValue) { + _name = inValue; +} + +Vector &SkeletonData::getBones() { + return _bones; +} + +Vector &SkeletonData::getSlots() { + return _slots; +} + +Vector &SkeletonData::getSkins() { + return _skins; +} + +Skin *SkeletonData::getDefaultSkin() { + return _defaultSkin; +} + +void SkeletonData::setDefaultSkin(Skin *inValue) { + _defaultSkin = inValue; +} + +Vector &SkeletonData::getEvents() { + return _events; +} + +Vector &SkeletonData::getAnimations() { + return _animations; +} + +Vector &SkeletonData::getIkConstraints() { + return _ikConstraints; +} + +Vector &SkeletonData::getTransformConstraints() { + return _transformConstraints; +} + +Vector &SkeletonData::getPathConstraints() { + return _pathConstraints; +} + +float SkeletonData::getWidth() { + return _width; +} + +void SkeletonData::setWidth(float inValue) { + _width = inValue; +} + +float SkeletonData::getHeight() { + return _height; +} + +void SkeletonData::setHeight(float inValue) { + _height = inValue; +} + +const String &SkeletonData::getVersion() { + return _version; +} + +void SkeletonData::setVersion(const String &inValue) { + _version = inValue; +} + +const String &SkeletonData::getHash() { + return _hash; +} + +void SkeletonData::setHash(const String &inValue) { + _hash = inValue; +} + +const String &SkeletonData::getImagesPath() { + return _imagesPath; +} + +void SkeletonData::setImagesPath(const String &inValue) { + _imagesPath = inValue; +} + + +const String &SkeletonData::getAudioPath() { + return _audioPath; +} + +void SkeletonData::setAudioPath(const String &inValue) { + _audioPath = inValue; +} + +float SkeletonData::getFps() { + return _fps; +} + +void SkeletonData::setFps(float inValue) { + _fps = inValue; +} diff --git a/cocos/editor-support/spine/SkeletonData.h b/cocos/editor-support/spine/SkeletonData.h index 5cbf3e1d415..4baf6bdb465 100644 --- a/cocos/editor-support/spine/SkeletonData.h +++ b/cocos/editor-support/spine/SkeletonData.h @@ -1,117 +1,184 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SKELETONDATA_H_ -#define SPINE_SKELETONDATA_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spSkeletonData { - const char* version; - const char* hash; - float width, height; - - int bonesCount; - spBoneData** bones; - - int slotsCount; - spSlotData** slots; - - int skinsCount; - spSkin** skins; - spSkin* defaultSkin; - - int eventsCount; - spEventData** events; - - int animationsCount; - spAnimation** animations; - - int ikConstraintsCount; - spIkConstraintData** ikConstraints; - - int transformConstraintsCount; - spTransformConstraintData** transformConstraints; - - int pathConstraintsCount; - spPathConstraintData** pathConstraints; -} spSkeletonData; - -SP_API spSkeletonData* spSkeletonData_create (); -SP_API void spSkeletonData_dispose (spSkeletonData* self); - -SP_API spBoneData* spSkeletonData_findBone (const spSkeletonData* self, const char* boneName); -SP_API int spSkeletonData_findBoneIndex (const spSkeletonData* self, const char* boneName); - -SP_API spSlotData* spSkeletonData_findSlot (const spSkeletonData* self, const char* slotName); -SP_API int spSkeletonData_findSlotIndex (const spSkeletonData* self, const char* slotName); - -SP_API spSkin* spSkeletonData_findSkin (const spSkeletonData* self, const char* skinName); - -SP_API spEventData* spSkeletonData_findEvent (const spSkeletonData* self, const char* eventName); - -SP_API spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName); - -SP_API spIkConstraintData* spSkeletonData_findIkConstraint (const spSkeletonData* self, const char* constraintName); - -SP_API spTransformConstraintData* spSkeletonData_findTransformConstraint (const spSkeletonData* self, const char* constraintName); - -SP_API spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName); - -#ifdef SPINE_SHORT_NAMES -typedef spSkeletonData SkeletonData; -#define SkeletonData_create(...) spSkeletonData_create(__VA_ARGS__) -#define SkeletonData_dispose(...) spSkeletonData_dispose(__VA_ARGS__) -#define SkeletonData_findBone(...) spSkeletonData_findBone(__VA_ARGS__) -#define SkeletonData_findBoneIndex(...) spSkeletonData_findBoneIndex(__VA_ARGS__) -#define SkeletonData_findSlot(...) spSkeletonData_findSlot(__VA_ARGS__) -#define SkeletonData_findSlotIndex(...) spSkeletonData_findSlotIndex(__VA_ARGS__) -#define SkeletonData_findSkin(...) spSkeletonData_findSkin(__VA_ARGS__) -#define SkeletonData_findEvent(...) spSkeletonData_findEvent(__VA_ARGS__) -#define SkeletonData_findAnimation(...) spSkeletonData_findAnimation(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SKELETONDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SkeletonData_h +#define Spine_SkeletonData_h + +#include +#include + +namespace spine { +class BoneData; + +class SlotData; + +class Skin; + +class EventData; + +class Animation; + +class IkConstraintData; + +class TransformConstraintData; + +class PathConstraintData; + +/// Stores the setup pose and all of the stateless data for a skeleton. +class SP_API SkeletonData : public SpineObject { + friend class SkeletonBinary; + + friend class SkeletonJson; + + friend class Skeleton; + +public: + SkeletonData(); + + ~SkeletonData(); + + /// Finds a bone by comparing each bone's name. + /// It is more efficient to cache the results of this method than to call it multiple times. + /// @return May be NULL. + BoneData *findBone(const String &boneName); + + /// @return -1 if the bone was not found. + int findBoneIndex(const String &boneName); + + /// @return May be NULL. + SlotData *findSlot(const String &slotName); + + /// @return -1 if the slot was not found. + int findSlotIndex(const String &slotName); + + /// @return May be NULL. + Skin *findSkin(const String &skinName); + + /// @return May be NULL. + spine::EventData *findEvent(const String &eventDataName); + + /// @return May be NULL. + Animation *findAnimation(const String &animationName); + + /// @return May be NULL. + IkConstraintData *findIkConstraint(const String &constraintName); + + /// @return May be NULL. + TransformConstraintData *findTransformConstraint(const String &constraintName); + + /// @return May be NULL. + PathConstraintData *findPathConstraint(const String &constraintName); + + /// @return -1 if the path constraint was not found. + int findPathConstraintIndex(const String &pathConstraintName); + + const String &getName(); + + void setName(const String &inValue); + + /// The skeleton's bones, sorted parent first. The root bone is always the first bone. + Vector &getBones(); + + Vector &getSlots(); + + /// All skins, including the default skin. + Vector &getSkins(); + + /// The skeleton's default skin. + /// By default this skin contains all attachments that were not in a skin in Spine. + /// + /// @return May be NULL. + Skin *getDefaultSkin(); + + void setDefaultSkin(Skin *inValue); + + Vector &getEvents(); + + Vector &getAnimations(); + + Vector &getIkConstraints(); + + Vector &getTransformConstraints(); + + Vector &getPathConstraints(); + + float getWidth(); + + void setWidth(float inValue); + + float getHeight(); + + void setHeight(float inValue); + + /// The Spine version used to export this data, or NULL. + const String &getVersion(); + + void setVersion(const String &inValue); + + const String &getHash(); + + void setHash(const String &inValue); + + const String &getImagesPath(); + + void setImagesPath(const String &inValue); + + const String &getAudioPath(); + + void setAudioPath(const String &inValue); + + /// The dopesheet FPS in Spine. Available only when nonessential data was exported. + float getFps(); + + void setFps(float inValue); + +private: + String _name; + Vector _bones; // Ordered parents first + Vector _slots; // Setup pose draw order. + Vector _skins; + Skin *_defaultSkin; + Vector _events; + Vector _animations; + Vector _ikConstraints; + Vector _transformConstraints; + Vector _pathConstraints; + float _width, _height; + String _version; + String _hash; + + // Nonessential. + float _fps; + String _imagesPath; + String _audioPath; +}; +} + +#endif /* Spine_SkeletonData_h */ diff --git a/cocos/editor-support/spine/SkeletonJson.c b/cocos/editor-support/spine/SkeletonJson.c deleted file mode 100644 index 7309895f175..00000000000 --- a/cocos/editor-support/spine/SkeletonJson.c +++ /dev/null @@ -1,1110 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include "Json.h" -#include -#include -#include - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -#define strdup _strdup -#endif - -typedef struct { - const char* parent; - const char* skin; - int slotIndex; - spMeshAttachment* mesh; -} _spLinkedMesh; - -typedef struct { - spSkeletonJson super; - int ownsLoader; - - int linkedMeshCount; - int linkedMeshCapacity; - _spLinkedMesh* linkedMeshes; -} _spSkeletonJson; - -spSkeletonJson* spSkeletonJson_createWithLoader (spAttachmentLoader* attachmentLoader) { - spSkeletonJson* self = SUPER(NEW(_spSkeletonJson)); - self->scale = 1; - self->attachmentLoader = attachmentLoader; - return self; -} - -spSkeletonJson* spSkeletonJson_create (spAtlas* atlas) { - spAtlasAttachmentLoader* attachmentLoader = spAtlasAttachmentLoader_create(atlas); - spSkeletonJson* self = spSkeletonJson_createWithLoader(SUPER(attachmentLoader)); - SUB_CAST(_spSkeletonJson, self)->ownsLoader = 1; - return self; -} - -void spSkeletonJson_dispose (spSkeletonJson* self) { - _spSkeletonJson* internal = SUB_CAST(_spSkeletonJson, self); - if (internal->ownsLoader) spAttachmentLoader_dispose(self->attachmentLoader); - FREE(internal->linkedMeshes); - FREE(self->error); - FREE(self); -} - -void _spSkeletonJson_setError (spSkeletonJson* self, Json* root, const char* value1, const char* value2) { - char message[256]; - int length; - FREE(self->error); - strcpy(message, value1); - length = (int)strlen(value1); - if (value2) strncat(message + length, value2, 255 - length); - MALLOC_STR(self->error, message); - if (root) Json_dispose(root); -} - -static float toColor (const char* value, int index) { - char digits[3]; - char *error; - int color; - - if (index >= strlen(value) / 2) - return -1; - value += index * 2; - - digits[0] = *value; - digits[1] = *(value + 1); - digits[2] = '\0'; - color = (int)strtoul(digits, &error, 16); - if (*error != 0) return -1; - return color / (float)255; -} - -static void readCurve (Json* frame, spCurveTimeline* timeline, int frameIndex) { - Json* curve = Json_getItem(frame, "curve"); - if (!curve) return; - if (curve->type == Json_String && strcmp(curve->valueString, "stepped") == 0) - spCurveTimeline_setStepped(timeline, frameIndex); - else if (curve->type == Json_Array) { - Json* child0 = curve->child; - Json* child1 = child0->next; - Json* child2 = child1->next; - Json* child3 = child2->next; - spCurveTimeline_setCurve(timeline, frameIndex, child0->valueFloat, child1->valueFloat, child2->valueFloat, - child3->valueFloat); - } -} - -static void _spSkeletonJson_addLinkedMesh (spSkeletonJson* self, spMeshAttachment* mesh, const char* skin, int slotIndex, - const char* parent) { - _spLinkedMesh* linkedMesh; - _spSkeletonJson* internal = SUB_CAST(_spSkeletonJson, self); - - if (internal->linkedMeshCount == internal->linkedMeshCapacity) { - _spLinkedMesh* linkedMeshes; - internal->linkedMeshCapacity *= 2; - if (internal->linkedMeshCapacity < 8) internal->linkedMeshCapacity = 8; - linkedMeshes = MALLOC(_spLinkedMesh, internal->linkedMeshCapacity); - memcpy(linkedMeshes, internal->linkedMeshes, sizeof(_spLinkedMesh) * internal->linkedMeshCount); - FREE(internal->linkedMeshes); - internal->linkedMeshes = linkedMeshes; - } - - linkedMesh = internal->linkedMeshes + internal->linkedMeshCount++; - linkedMesh->mesh = mesh; - linkedMesh->skin = skin; - linkedMesh->slotIndex = slotIndex; - linkedMesh->parent = parent; -} - -static spAnimation* _spSkeletonJson_readAnimation (spSkeletonJson* self, Json* root, spSkeletonData *skeletonData) { - int frameIndex; - spAnimation* animation; - Json* valueMap; - int timelinesCount = 0; - - Json* bones = Json_getItem(root, "bones"); - Json* slots = Json_getItem(root, "slots"); - Json* ik = Json_getItem(root, "ik"); - Json* transform = Json_getItem(root, "transform"); - Json* paths = Json_getItem(root, "paths"); - Json* deform = Json_getItem(root, "deform"); - Json* drawOrder = Json_getItem(root, "drawOrder"); - Json* events = Json_getItem(root, "events"); - Json *boneMap, *slotMap, *constraintMap; - if (!drawOrder) drawOrder = Json_getItem(root, "draworder"); - - for (boneMap = bones ? bones->child : 0; boneMap; boneMap = boneMap->next) - timelinesCount += boneMap->size; - for (slotMap = slots ? slots->child : 0; slotMap; slotMap = slotMap->next) - timelinesCount += slotMap->size; - timelinesCount += ik ? ik->size : 0; - timelinesCount += transform ? transform->size : 0; - for (constraintMap = paths ? paths->child : 0; constraintMap; constraintMap = constraintMap->next) - timelinesCount += constraintMap->size; - for (constraintMap = deform ? deform->child : 0; constraintMap; constraintMap = constraintMap->next) - for (slotMap = constraintMap->child; slotMap; slotMap = slotMap->next) - timelinesCount += slotMap->size; - if (drawOrder) ++timelinesCount; - if (events) ++timelinesCount; - - animation = spAnimation_create(root->name, timelinesCount); - animation->timelinesCount = 0; - - /* Slot timelines. */ - for (slotMap = slots ? slots->child : 0; slotMap; slotMap = slotMap->next) { - Json *timelineMap; - - int slotIndex = spSkeletonData_findSlotIndex(skeletonData, slotMap->name); - if (slotIndex == -1) { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, root, "Slot not found: ", slotMap->name); - return 0; - } - - for (timelineMap = slotMap->child; timelineMap; timelineMap = timelineMap->next) { - if (strcmp(timelineMap->name, "attachment") == 0) { - spAttachmentTimeline *timeline = spAttachmentTimeline_create(timelineMap->size); - timeline->slotIndex = slotIndex; - - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - Json* name = Json_getItem(valueMap, "name"); - spAttachmentTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), - name->type == Json_NULL ? 0 : name->valueString); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[timelineMap->size - 1]); - - } else if (strcmp(timelineMap->name, "color") == 0) { - spColorTimeline *timeline = spColorTimeline_create(timelineMap->size); - timeline->slotIndex = slotIndex; - - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - const char* s = Json_getString(valueMap, "color", 0); - spColorTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), toColor(s, 0), toColor(s, 1), toColor(s, 2), - toColor(s, 3)); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(timelineMap->size - 1) * COLOR_ENTRIES]); - - } else if (strcmp(timelineMap->name, "twoColor") == 0) { - spTwoColorTimeline *timeline = spTwoColorTimeline_create(timelineMap->size); - timeline->slotIndex = slotIndex; - - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - const char* s = Json_getString(valueMap, "light", 0); - const char* ds = Json_getString(valueMap, "dark", 0); - spTwoColorTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), toColor(s, 0), toColor(s, 1), toColor(s, 2), - toColor(s, 3), toColor(ds, 0), toColor(ds, 1), toColor(ds, 2)); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(timelineMap->size - 1) * TWOCOLOR_ENTRIES]); - - } else { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, 0, "Invalid timeline type for a slot: ", timelineMap->name); - return 0; - } - } - } - - /* Bone timelines. */ - for (boneMap = bones ? bones->child : 0; boneMap; boneMap = boneMap->next) { - Json *timelineMap; - - int boneIndex = spSkeletonData_findBoneIndex(skeletonData, boneMap->name); - if (boneIndex == -1) { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, root, "Bone not found: ", boneMap->name); - return 0; - } - - for (timelineMap = boneMap->child; timelineMap; timelineMap = timelineMap->next) { - if (strcmp(timelineMap->name, "rotate") == 0) { - spRotateTimeline *timeline = spRotateTimeline_create(timelineMap->size); - timeline->boneIndex = boneIndex; - - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spRotateTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, "angle", 0)); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(timelineMap->size - 1) * ROTATE_ENTRIES]); - - } else { - int isScale = strcmp(timelineMap->name, "scale") == 0; - int isTranslate = strcmp(timelineMap->name, "translate") == 0; - int isShear = strcmp(timelineMap->name, "shear") == 0; - if (isScale || isTranslate || isShear) { - float timelineScale = isTranslate ? self->scale: 1; - spTranslateTimeline *timeline = 0; - if (isScale) timeline = spScaleTimeline_create(timelineMap->size); - else if (isTranslate) timeline = spTranslateTimeline_create(timelineMap->size); - else if (isShear) timeline = spShearTimeline_create(timelineMap->size); - timeline->boneIndex = boneIndex; - - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spTranslateTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, "x", 0) * timelineScale, - Json_getFloat(valueMap, "y", 0) * timelineScale); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(timelineMap->size - 1) * TRANSLATE_ENTRIES]); - - } else { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, 0, "Invalid timeline type for a bone: ", timelineMap->name); - return 0; - } - } - } - } - - /* IK constraint timelines. */ - for (constraintMap = ik ? ik->child : 0; constraintMap; constraintMap = constraintMap->next) { - spIkConstraintData* constraint = spSkeletonData_findIkConstraint(skeletonData, constraintMap->name); - spIkConstraintTimeline* timeline = spIkConstraintTimeline_create(constraintMap->size); - for (frameIndex = 0; frameIndex < skeletonData->ikConstraintsCount; ++frameIndex) { - if (constraint == skeletonData->ikConstraints[frameIndex]) { - timeline->ikConstraintIndex = frameIndex; - break; - } - } - for (valueMap = constraintMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spIkConstraintTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, "mix", 1), - Json_getInt(valueMap, "bendPositive", 1) ? 1 : -1); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(constraintMap->size - 1) * IKCONSTRAINT_ENTRIES]); - } - - /* Transform constraint timelines. */ - for (constraintMap = transform ? transform->child : 0; constraintMap; constraintMap = constraintMap->next) { - spTransformConstraintData* constraint = spSkeletonData_findTransformConstraint(skeletonData, constraintMap->name); - spTransformConstraintTimeline* timeline = spTransformConstraintTimeline_create(constraintMap->size); - for (frameIndex = 0; frameIndex < skeletonData->transformConstraintsCount; ++frameIndex) { - if (constraint == skeletonData->transformConstraints[frameIndex]) { - timeline->transformConstraintIndex = frameIndex; - break; - } - } - for (valueMap = constraintMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spTransformConstraintTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, "rotateMix", 1), - Json_getFloat(valueMap, "translateMix", 1), Json_getFloat(valueMap, "scaleMix", 1), Json_getFloat(valueMap, "shearMix", 1)); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(constraintMap->size - 1) * TRANSFORMCONSTRAINT_ENTRIES]); - } - - /** Path constraint timelines. */ - for(constraintMap = paths ? paths->child : 0; constraintMap; constraintMap = constraintMap->next ) { - int constraintIndex, i; - Json* timelineMap; - - spPathConstraintData* data = spSkeletonData_findPathConstraint(skeletonData, constraintMap->name); - if (!data) { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, root, "Path constraint not found: ", constraintMap->name); - return 0; - } - for (i = 0; i < skeletonData->pathConstraintsCount; i++) { - if (skeletonData->pathConstraints[i] == data) { - constraintIndex = i; - break; - } - } - - for (timelineMap = constraintMap->child; timelineMap; timelineMap = timelineMap->next) { - const char* timelineName = timelineMap->name; - if (strcmp(timelineName, "position") == 0 || strcmp(timelineName, "spacing") == 0) { - spPathConstraintPositionTimeline* timeline; - float timelineScale = 1; - if (strcmp(timelineName, "spacing") == 0) { - timeline = (spPathConstraintPositionTimeline*)spPathConstraintSpacingTimeline_create(timelineMap->size); - if (data->spacingMode == SP_SPACING_MODE_LENGTH || data->spacingMode == SP_SPACING_MODE_FIXED) timelineScale = self->scale; - } else { - timeline = spPathConstraintPositionTimeline_create(timelineMap->size); - if (data->positionMode == SP_POSITION_MODE_FIXED) timelineScale = self->scale; - } - timeline->pathConstraintIndex = constraintIndex; - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spPathConstraintPositionTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, timelineName, 0) * timelineScale); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(timelineMap->size - 1) * PATHCONSTRAINTPOSITION_ENTRIES]); - } else if (strcmp(timelineName, "mix") == 0) { - spPathConstraintMixTimeline* timeline = spPathConstraintMixTimeline_create(timelineMap->size); - timeline->pathConstraintIndex = constraintIndex; - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spPathConstraintMixTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), - Json_getFloat(valueMap, "rotateMix", 1), Json_getFloat(valueMap, "translateMix", 1)); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[(timelineMap->size - 1) * PATHCONSTRAINTMIX_ENTRIES]); - } - } - } - - /* Deform timelines. */ - for (constraintMap = deform ? deform->child : 0; constraintMap; constraintMap = constraintMap->next) { - spSkin* skin = spSkeletonData_findSkin(skeletonData, constraintMap->name); - for (slotMap = constraintMap->child; slotMap; slotMap = slotMap->next) { - int slotIndex = spSkeletonData_findSlotIndex(skeletonData, slotMap->name); - Json* timelineMap; - for (timelineMap = slotMap->child; timelineMap; timelineMap = timelineMap->next) { - float* tempDeform; - spDeformTimeline *timeline; - int weighted, deformLength; - - spVertexAttachment* attachment = SUB_CAST(spVertexAttachment, spSkin_getAttachment(skin, slotIndex, timelineMap->name)); - if (!attachment) { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, 0, "Attachment not found: ", timelineMap->name); - return 0; - } - weighted = attachment->bones != 0; - deformLength = weighted ? attachment->verticesCount / 3 * 2 : attachment->verticesCount; - tempDeform = MALLOC(float, deformLength); - - timeline = spDeformTimeline_create(timelineMap->size, deformLength); - timeline->slotIndex = slotIndex; - timeline->attachment = SUPER(attachment); - - for (valueMap = timelineMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - Json* vertices = Json_getItem(valueMap, "vertices"); - float* deform; - if (!vertices) { - if (weighted) { - deform = tempDeform; - memset(deform, 0, sizeof(float) * deformLength); - } else - deform = attachment->vertices; - } else { - int v, start = Json_getInt(valueMap, "offset", 0); - Json* vertex; - deform = tempDeform; - memset(deform, 0, sizeof(float) * start); - if (self->scale == 1) { - for (vertex = vertices->child, v = start; vertex; vertex = vertex->next, ++v) - deform[v] = vertex->valueFloat; - } else { - for (vertex = vertices->child, v = start; vertex; vertex = vertex->next, ++v) - deform[v] = vertex->valueFloat * self->scale; - } - memset(deform + v, 0, sizeof(float) * (deformLength - v)); - if (!weighted) { - float* vertices = attachment->vertices; - for (v = 0; v < deformLength; ++v) - deform[v] += vertices[v]; - } - } - spDeformTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), deform); - readCurve(valueMap, SUPER(timeline), frameIndex); - } - FREE(tempDeform); - - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[timelineMap->size - 1]); - } - } - } - - /* Draw order timeline. */ - if (drawOrder) { - spDrawOrderTimeline* timeline = spDrawOrderTimeline_create(drawOrder->size, skeletonData->slotsCount); - for (valueMap = drawOrder->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - int ii; - int* drawOrder = 0; - Json* offsets = Json_getItem(valueMap, "offsets"); - if (offsets) { - Json* offsetMap; - int* unchanged = MALLOC(int, skeletonData->slotsCount - offsets->size); - int originalIndex = 0, unchangedIndex = 0; - - drawOrder = MALLOC(int, skeletonData->slotsCount); - for (ii = skeletonData->slotsCount - 1; ii >= 0; --ii) - drawOrder[ii] = -1; - - for (offsetMap = offsets->child; offsetMap; offsetMap = offsetMap->next) { - int slotIndex = spSkeletonData_findSlotIndex(skeletonData, Json_getString(offsetMap, "slot", 0)); - if (slotIndex == -1) { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, 0, "Slot not found: ", Json_getString(offsetMap, "slot", 0)); - return 0; - } - /* Collect unchanged items. */ - while (originalIndex != slotIndex) - unchanged[unchangedIndex++] = originalIndex++; - /* Set changed items. */ - drawOrder[originalIndex + Json_getInt(offsetMap, "offset", 0)] = originalIndex; - originalIndex++; - } - /* Collect remaining unchanged items. */ - while (originalIndex < skeletonData->slotsCount) - unchanged[unchangedIndex++] = originalIndex++; - /* Fill in unchanged items. */ - for (ii = skeletonData->slotsCount - 1; ii >= 0; ii--) - if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex]; - FREE(unchanged); - } - spDrawOrderTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), drawOrder); - FREE(drawOrder); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[drawOrder->size - 1]); - } - - /* Event timeline. */ - if (events) { - spEventTimeline* timeline = spEventTimeline_create(events->size); - for (valueMap = events->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) { - spEvent* event; - const char* stringValue; - spEventData* eventData = spSkeletonData_findEvent(skeletonData, Json_getString(valueMap, "name", 0)); - if (!eventData) { - spAnimation_dispose(animation); - _spSkeletonJson_setError(self, 0, "Event not found: ", Json_getString(valueMap, "name", 0)); - return 0; - } - event = spEvent_create(Json_getFloat(valueMap, "time", 0), eventData); - event->intValue = Json_getInt(valueMap, "int", eventData->intValue); - event->floatValue = Json_getFloat(valueMap, "float", eventData->floatValue); - stringValue = Json_getString(valueMap, "string", eventData->stringValue); - if (stringValue) MALLOC_STR(event->stringValue, stringValue); - spEventTimeline_setFrame(timeline, frameIndex, event); - } - animation->timelines[animation->timelinesCount++] = SUPER_CAST(spTimeline, timeline); - animation->duration = MAX(animation->duration, timeline->frames[events->size - 1]); - } - - return animation; -} - -static void _readVertices (spSkeletonJson* self, Json* attachmentMap, spVertexAttachment* attachment, int verticesLength) { - Json* entry; - float* vertices; - int i, n, nn, entrySize; - spFloatArray* weights; - spIntArray* bones; - - attachment->worldVerticesLength = verticesLength; - - entry = Json_getItem(attachmentMap, "vertices"); - entrySize = entry->size; - vertices = MALLOC(float, entrySize); - for (entry = entry->child, i = 0; entry; entry = entry->next, ++i) - vertices[i] = entry->valueFloat; - - if (verticesLength == entrySize) { - if (self->scale != 1) - for (i = 0; i < entrySize; ++i) - vertices[i] *= self->scale; - attachment->verticesCount = verticesLength; - attachment->vertices = vertices; - - attachment->bonesCount = 0; - attachment->bones = 0; - return; - } - - weights = spFloatArray_create(verticesLength * 3 * 3); - bones = spIntArray_create(verticesLength * 3); - - for (i = 0, n = entrySize; i < n;) { - int boneCount = (int)vertices[i++]; - spIntArray_add(bones, boneCount); - for (nn = i + boneCount * 4; i < nn; i += 4) { - spIntArray_add(bones, (int)vertices[i]); - spFloatArray_add(weights, vertices[i + 1] * self->scale); - spFloatArray_add(weights, vertices[i + 2] * self->scale); - spFloatArray_add(weights, vertices[i + 3]); - } - } - - attachment->verticesCount = weights->size; - attachment->vertices = weights->items; - FREE(weights); - attachment->bonesCount = bones->size; - attachment->bones = bones->items; - FREE(bones); - - FREE(vertices); -} - -spSkeletonData* spSkeletonJson_readSkeletonDataFile (spSkeletonJson* self, const char* path) { - int length; - spSkeletonData* skeletonData; - const char* json = _spUtil_readFile(path, &length); - if (length == 0 || !json) { - _spSkeletonJson_setError(self, 0, "Unable to read skeleton file: ", path); - return 0; - } - skeletonData = spSkeletonJson_readSkeletonData(self, json); - FREE(json); - return skeletonData; -} - -spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const char* json) { - int i, ii; - spSkeletonData* skeletonData; - Json *root, *skeleton, *bones, *boneMap, *ik, *transform, *path, *slots, *skins, *animations, *events; - _spSkeletonJson* internal = SUB_CAST(_spSkeletonJson, self); - - FREE(self->error); - CONST_CAST(char*, self->error) = 0; - internal->linkedMeshCount = 0; - - root = Json_create(json); - - if (!root) { - _spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError()); - return 0; - } - - skeletonData = spSkeletonData_create(); - - skeleton = Json_getItem(root, "skeleton"); - if (skeleton) { - MALLOC_STR(skeletonData->hash, Json_getString(skeleton, "hash", 0)); - MALLOC_STR(skeletonData->version, Json_getString(skeleton, "spine", 0)); - skeletonData->width = Json_getFloat(skeleton, "width", 0); - skeletonData->height = Json_getFloat(skeleton, "height", 0); - } - - /* Bones. */ - bones = Json_getItem(root, "bones"); - skeletonData->bones = MALLOC(spBoneData*, bones->size); - for (boneMap = bones->child, i = 0; boneMap; boneMap = boneMap->next, ++i) { - spBoneData* data; - const char* transformMode; - - spBoneData* parent = 0; - const char* parentName = Json_getString(boneMap, "parent", 0); - if (parentName) { - parent = spSkeletonData_findBone(skeletonData, parentName); - if (!parent) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Parent bone not found: ", parentName); - return 0; - } - } - - data = spBoneData_create(skeletonData->bonesCount, Json_getString(boneMap, "name", 0), parent); - data->length = Json_getFloat(boneMap, "length", 0) * self->scale; - data->x = Json_getFloat(boneMap, "x", 0) * self->scale; - data->y = Json_getFloat(boneMap, "y", 0) * self->scale; - data->rotation = Json_getFloat(boneMap, "rotation", 0); - data->scaleX = Json_getFloat(boneMap, "scaleX", 1); - data->scaleY = Json_getFloat(boneMap, "scaleY", 1); - data->shearX = Json_getFloat(boneMap, "shearX", 0); - data->shearY = Json_getFloat(boneMap, "shearY", 0); - transformMode = Json_getString(boneMap, "transform", "normal"); - data->transformMode = SP_TRANSFORMMODE_NORMAL; - if (strcmp(transformMode, "normal") == 0) - data->transformMode = SP_TRANSFORMMODE_NORMAL; - if (strcmp(transformMode, "onlyTranslation") == 0) - data->transformMode = SP_TRANSFORMMODE_ONLYTRANSLATION; - if (strcmp(transformMode, "noRotationOrReflection") == 0) - data->transformMode = SP_TRANSFORMMODE_NOROTATIONORREFLECTION; - if (strcmp(transformMode, "noScale") == 0) - data->transformMode = SP_TRANSFORMMODE_NOSCALE; - if (strcmp(transformMode, "noScaleOrReflection") == 0) - data->transformMode = SP_TRANSFORMMODE_NOSCALEORREFLECTION; - - skeletonData->bones[i] = data; - skeletonData->bonesCount++; - } - - /* Slots. */ - slots = Json_getItem(root, "slots"); - if (slots) { - Json *slotMap; - skeletonData->slotsCount = slots->size; - skeletonData->slots = MALLOC(spSlotData*, slots->size); - for (slotMap = slots->child, i = 0; slotMap; slotMap = slotMap->next, ++i) { - spSlotData* data; - const char* color; - const char* dark; - Json *item; - - const char* boneName = Json_getString(slotMap, "bone", 0); - spBoneData* boneData = spSkeletonData_findBone(skeletonData, boneName); - if (!boneData) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Slot bone not found: ", boneName); - return 0; - } - - data = spSlotData_create(i, Json_getString(slotMap, "name", 0), boneData); - - color = Json_getString(slotMap, "color", 0); - if (color) { - spColor_setFromFloats(&data->color, - toColor(color, 0), - toColor(color, 1), - toColor(color, 2), - toColor(color, 3)); - } - - dark = Json_getString(slotMap, "dark", 0); - if (dark) { - data->darkColor = spColor_create(); - spColor_setFromFloats(data->darkColor, - toColor(dark, 0), - toColor(dark, 1), - toColor(dark, 2), - toColor(dark, 3)); - } - - item = Json_getItem(slotMap, "attachment"); - if (item) spSlotData_setAttachmentName(data, item->valueString); - - item = Json_getItem(slotMap, "blend"); - if (item) { - if (strcmp(item->valueString, "additive") == 0) - data->blendMode = SP_BLEND_MODE_ADDITIVE; - else if (strcmp(item->valueString, "multiply") == 0) - data->blendMode = SP_BLEND_MODE_MULTIPLY; - else if (strcmp(item->valueString, "screen") == 0) - data->blendMode = SP_BLEND_MODE_SCREEN; - } - - skeletonData->slots[i] = data; - } - } - - /* IK constraints. */ - ik = Json_getItem(root, "ik"); - if (ik) { - Json *constraintMap; - skeletonData->ikConstraintsCount = ik->size; - skeletonData->ikConstraints = MALLOC(spIkConstraintData*, ik->size); - for (constraintMap = ik->child, i = 0; constraintMap; constraintMap = constraintMap->next, ++i) { - const char* targetName; - - spIkConstraintData* data = spIkConstraintData_create(Json_getString(constraintMap, "name", 0)); - data->order = Json_getInt(constraintMap, "order", 0); - - boneMap = Json_getItem(constraintMap, "bones"); - data->bonesCount = boneMap->size; - data->bones = MALLOC(spBoneData*, boneMap->size); - for (boneMap = boneMap->child, ii = 0; boneMap; boneMap = boneMap->next, ++ii) { - data->bones[ii] = spSkeletonData_findBone(skeletonData, boneMap->valueString); - if (!data->bones[ii]) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "IK bone not found: ", boneMap->valueString); - return 0; - } - } - - targetName = Json_getString(constraintMap, "target", 0); - data->target = spSkeletonData_findBone(skeletonData, targetName); - if (!data->target) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Target bone not found: ", targetName); - return 0; - } - - data->bendDirection = Json_getInt(constraintMap, "bendPositive", 1) ? 1 : -1; - data->mix = Json_getFloat(constraintMap, "mix", 1); - - skeletonData->ikConstraints[i] = data; - } - } - - /* Transform constraints. */ - transform = Json_getItem(root, "transform"); - if (transform) { - Json *constraintMap; - skeletonData->transformConstraintsCount = transform->size; - skeletonData->transformConstraints = MALLOC(spTransformConstraintData*, transform->size); - for (constraintMap = transform->child, i = 0; constraintMap; constraintMap = constraintMap->next, ++i) { - const char* name; - - spTransformConstraintData* data = spTransformConstraintData_create(Json_getString(constraintMap, "name", 0)); - data->order = Json_getInt(constraintMap, "order", 0); - - boneMap = Json_getItem(constraintMap, "bones"); - data->bonesCount = boneMap->size; - CONST_CAST(spBoneData**, data->bones) = MALLOC(spBoneData*, boneMap->size); - for (boneMap = boneMap->child, ii = 0; boneMap; boneMap = boneMap->next, ++ii) { - data->bones[ii] = spSkeletonData_findBone(skeletonData, boneMap->valueString); - if (!data->bones[ii]) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Transform bone not found: ", boneMap->valueString); - return 0; - } - } - - name = Json_getString(constraintMap, "target", 0); - data->target = spSkeletonData_findBone(skeletonData, name); - if (!data->target) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Target bone not found: ", name); - return 0; - } - - data->local = Json_getInt(constraintMap, "local", 0); - data->relative = Json_getInt(constraintMap, "relative", 0); - data->offsetRotation = Json_getFloat(constraintMap, "rotation", 0); - data->offsetX = Json_getFloat(constraintMap, "x", 0) * self->scale; - data->offsetY = Json_getFloat(constraintMap, "y", 0) * self->scale; - data->offsetScaleX = Json_getFloat(constraintMap, "scaleX", 0); - data->offsetScaleY = Json_getFloat(constraintMap, "scaleY", 0); - data->offsetShearY = Json_getFloat(constraintMap, "shearY", 0); - - data->rotateMix = Json_getFloat(constraintMap, "rotateMix", 1); - data->translateMix = Json_getFloat(constraintMap, "translateMix", 1); - data->scaleMix = Json_getFloat(constraintMap, "scaleMix", 1); - data->shearMix = Json_getFloat(constraintMap, "shearMix", 1); - - skeletonData->transformConstraints[i] = data; - } - } - - /* Path constraints */ - path = Json_getItem(root, "path"); - if (path) { - Json *constraintMap; - skeletonData->pathConstraintsCount = path->size; - skeletonData->pathConstraints = MALLOC(spPathConstraintData*, path->size); - for (constraintMap = path->child, i = 0; constraintMap; constraintMap = constraintMap->next, ++i) { - const char* name; - const char* item; - - spPathConstraintData* data = spPathConstraintData_create(Json_getString(constraintMap, "name", 0)); - data->order = Json_getInt(constraintMap, "order", 0); - - boneMap = Json_getItem(constraintMap, "bones"); - data->bonesCount = boneMap->size; - CONST_CAST(spBoneData**, data->bones) = MALLOC(spBoneData*, boneMap->size); - for (boneMap = boneMap->child, ii = 0; boneMap; boneMap = boneMap->next, ++ii) { - data->bones[ii] = spSkeletonData_findBone(skeletonData, boneMap->valueString); - if (!data->bones[ii]) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Path bone not found: ", boneMap->valueString); - return 0; - } - } - - name = Json_getString(constraintMap, "target", 0); - data->target = spSkeletonData_findSlot(skeletonData, name); - if (!data->target) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Target slot not found: ", name); - return 0; - } - - item = Json_getString(constraintMap, "positionMode", "percent"); - if (strcmp(item, "fixed") == 0) data->positionMode = SP_POSITION_MODE_FIXED; - else if (strcmp(item, "percent") == 0) data->positionMode = SP_POSITION_MODE_PERCENT; - - item = Json_getString(constraintMap, "spacingMode", "length"); - if (strcmp(item, "length") == 0) data->spacingMode = SP_SPACING_MODE_LENGTH; - else if (strcmp(item, "fixed") == 0) data->spacingMode = SP_SPACING_MODE_FIXED; - else if (strcmp(item, "percent") == 0) data->spacingMode = SP_SPACING_MODE_PERCENT; - - item = Json_getString(constraintMap, "rotateMode", "tangent"); - if (strcmp(item, "tangent") == 0) data->rotateMode = SP_ROTATE_MODE_TANGENT; - else if (strcmp(item, "chain") == 0) data->rotateMode = SP_ROTATE_MODE_CHAIN; - else if (strcmp(item, "chainScale") == 0) data->rotateMode = SP_ROTATE_MODE_CHAIN_SCALE; - - data->offsetRotation = Json_getFloat(constraintMap, "rotation", 0); - data->position = Json_getFloat(constraintMap, "position", 0); - if (data->positionMode == SP_POSITION_MODE_FIXED) data->position *= self->scale; - data->spacing = Json_getFloat(constraintMap, "spacing", 0); - if (data->spacingMode == SP_SPACING_MODE_LENGTH || data->spacingMode == SP_SPACING_MODE_FIXED) data->spacing *= self->scale; - data->rotateMix = Json_getFloat(constraintMap, "rotateMix", 1); - data->translateMix = Json_getFloat(constraintMap, "translateMix", 1); - - skeletonData->pathConstraints[i] = data; - } - } - - /* Skins. */ - skins = Json_getItem(root, "skins"); - if (skins) { - Json *skinMap; - skeletonData->skins = MALLOC(spSkin*, skins->size); - for (skinMap = skins->child, i = 0; skinMap; skinMap = skinMap->next, ++i) { - Json *attachmentsMap; - Json *curves; - spSkin *skin = spSkin_create(skinMap->name); - - skeletonData->skins[skeletonData->skinsCount++] = skin; - if (strcmp(skinMap->name, "default") == 0) skeletonData->defaultSkin = skin; - - for (attachmentsMap = skinMap->child; attachmentsMap; attachmentsMap = attachmentsMap->next) { - int slotIndex = spSkeletonData_findSlotIndex(skeletonData, attachmentsMap->name); - Json *attachmentMap; - - for (attachmentMap = attachmentsMap->child; attachmentMap; attachmentMap = attachmentMap->next) { - spAttachment* attachment; - const char* skinAttachmentName = attachmentMap->name; - const char* attachmentName = Json_getString(attachmentMap, "name", skinAttachmentName); - const char* path = Json_getString(attachmentMap, "path", attachmentName); - const char* color; - Json* entry; - - const char* typeString = Json_getString(attachmentMap, "type", "region"); - spAttachmentType type; - if (strcmp(typeString, "region") == 0) - type = SP_ATTACHMENT_REGION; - else if (strcmp(typeString, "mesh") == 0) - type = SP_ATTACHMENT_MESH; - else if (strcmp(typeString, "linkedmesh") == 0) - type = SP_ATTACHMENT_LINKED_MESH; - else if (strcmp(typeString, "boundingbox") == 0) - type = SP_ATTACHMENT_BOUNDING_BOX; - else if (strcmp(typeString, "path") == 0) - type = SP_ATTACHMENT_PATH; - else if (strcmp(typeString, "clipping") == 0) - type = SP_ATTACHMENT_CLIPPING; - else if (strcmp(typeString, "point") == 0) - type = SP_ATTACHMENT_POINT; - else { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, "Unknown attachment type: ", typeString); - return 0; - } - - attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, attachmentName, path); - if (!attachment) { - if (self->attachmentLoader->error1) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, root, self->attachmentLoader->error1, self->attachmentLoader->error2); - return 0; - } - continue; - } - - switch (attachment->type) { - case SP_ATTACHMENT_REGION: { - spRegionAttachment* region = SUB_CAST(spRegionAttachment, attachment); - if (path) MALLOC_STR(region->path, path); - region->x = Json_getFloat(attachmentMap, "x", 0) * self->scale; - region->y = Json_getFloat(attachmentMap, "y", 0) * self->scale; - region->scaleX = Json_getFloat(attachmentMap, "scaleX", 1); - region->scaleY = Json_getFloat(attachmentMap, "scaleY", 1); - region->rotation = Json_getFloat(attachmentMap, "rotation", 0); - region->width = Json_getFloat(attachmentMap, "width", 32) * self->scale; - region->height = Json_getFloat(attachmentMap, "height", 32) * self->scale; - - color = Json_getString(attachmentMap, "color", 0); - if (color) { - spColor_setFromFloats(®ion->color, - toColor(color, 0), - toColor(color, 1), - toColor(color, 2), - toColor(color, 3)); - } - - spRegionAttachment_updateOffset(region); - - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - break; - } - case SP_ATTACHMENT_MESH: - case SP_ATTACHMENT_LINKED_MESH: { - spMeshAttachment* mesh = SUB_CAST(spMeshAttachment, attachment); - - MALLOC_STR(mesh->path, path); - - color = Json_getString(attachmentMap, "color", 0); - if (color) { - spColor_setFromFloats(&mesh->color, - toColor(color, 0), - toColor(color, 1), - toColor(color, 2), - toColor(color, 3)); - } - - mesh->width = Json_getFloat(attachmentMap, "width", 32) * self->scale; - mesh->height = Json_getFloat(attachmentMap, "height", 32) * self->scale; - - entry = Json_getItem(attachmentMap, "parent"); - if (!entry) { - int verticesLength; - entry = Json_getItem(attachmentMap, "triangles"); - mesh->trianglesCount = entry->size; - mesh->triangles = MALLOC(unsigned short, entry->size); - for (entry = entry->child, ii = 0; entry; entry = entry->next, ++ii) - mesh->triangles[ii] = (unsigned short)entry->valueInt; - - entry = Json_getItem(attachmentMap, "uvs"); - verticesLength = entry->size; - mesh->regionUVs = MALLOC(float, verticesLength); - for (entry = entry->child, ii = 0; entry; entry = entry->next, ++ii) - mesh->regionUVs[ii] = entry->valueFloat; - - _readVertices(self, attachmentMap, SUPER(mesh), verticesLength); - - spMeshAttachment_updateUVs(mesh); - - mesh->hullLength = Json_getInt(attachmentMap, "hull", 0); - - entry = Json_getItem(attachmentMap, "edges"); - if (entry) { - mesh->edgesCount = entry->size; - mesh->edges = MALLOC(int, entry->size); - for (entry = entry->child, ii = 0; entry; entry = entry->next, ++ii) - mesh->edges[ii] = entry->valueInt; - } - - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - } else { - mesh->inheritDeform = Json_getInt(attachmentMap, "deform", 1); - _spSkeletonJson_addLinkedMesh(self, SUB_CAST(spMeshAttachment, attachment), Json_getString(attachmentMap, "skin", 0), slotIndex, - entry->valueString); - } - break; - } - case SP_ATTACHMENT_BOUNDING_BOX: { - spBoundingBoxAttachment* box = SUB_CAST(spBoundingBoxAttachment, attachment); - int vertexCount = Json_getInt(attachmentMap, "vertexCount", 0) << 1; - _readVertices(self, attachmentMap, SUPER(box), vertexCount); - box->super.verticesCount = vertexCount; - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - break; - } - case SP_ATTACHMENT_PATH: { - spPathAttachment* path = SUB_CAST(spPathAttachment, attachment); - int vertexCount = 0; - path->closed = Json_getInt(attachmentMap, "closed", 0); - path->constantSpeed = Json_getInt(attachmentMap, "constantSpeed", 1); - vertexCount = Json_getInt(attachmentMap, "vertexCount", 0); - _readVertices(self, attachmentMap, SUPER(path), vertexCount << 1); - - path->lengthsLength = vertexCount / 3; - path->lengths = MALLOC(float, path->lengthsLength); - - curves = Json_getItem(attachmentMap, "lengths"); - for (curves = curves->child, ii = 0; curves; curves = curves->next, ++ii) { - path->lengths[ii] = curves->valueFloat * self->scale; - } - break; - } - case SP_ATTACHMENT_POINT: { - spPointAttachment* point = SUB_CAST(spPointAttachment, attachment); - point->x = Json_getFloat(attachmentMap, "x", 0) * self->scale; - point->y = Json_getFloat(attachmentMap, "y", 0) * self->scale; - point->rotation = Json_getFloat(attachmentMap, "rotation", 0); - - color = Json_getString(attachmentMap, "color", 0); - if (color) { - spColor_setFromFloats(&point->color, - toColor(color, 0), - toColor(color, 1), - toColor(color, 2), - toColor(color, 3)); - } - break; - } - case SP_ATTACHMENT_CLIPPING: { - spClippingAttachment* clip = SUB_CAST(spClippingAttachment, attachment); - int vertexCount = 0; - const char* end = Json_getString(attachmentMap, "end", 0); - if (end) { - spSlotData* slot = spSkeletonData_findSlot(skeletonData, end); - clip->endSlot = slot; - } - vertexCount = Json_getInt(attachmentMap, "vertexCount", 0) << 1; - _readVertices(self, attachmentMap, SUPER(clip), vertexCount); - spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment); - break; - } - } - - spSkin_addAttachment(skin, slotIndex, skinAttachmentName, attachment); - } - } - } - } - - /* Linked meshes. */ - for (i = 0; i < internal->linkedMeshCount; i++) { - spAttachment* parent; - _spLinkedMesh* linkedMesh = internal->linkedMeshes + i; - spSkin* skin = !linkedMesh->skin ? skeletonData->defaultSkin : spSkeletonData_findSkin(skeletonData, linkedMesh->skin); - if (!skin) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, 0, "Skin not found: ", linkedMesh->skin); - return 0; - } - parent = spSkin_getAttachment(skin, linkedMesh->slotIndex, linkedMesh->parent); - if (!parent) { - spSkeletonData_dispose(skeletonData); - _spSkeletonJson_setError(self, 0, "Parent mesh not found: ", linkedMesh->parent); - return 0; - } - spMeshAttachment_setParentMesh(linkedMesh->mesh, SUB_CAST(spMeshAttachment, parent)); - spMeshAttachment_updateUVs(linkedMesh->mesh); - spAttachmentLoader_configureAttachment(self->attachmentLoader, SUPER(SUPER(linkedMesh->mesh))); - } - - /* Events. */ - events = Json_getItem(root, "events"); - if (events) { - Json *eventMap; - const char* stringValue; - skeletonData->eventsCount = events->size; - skeletonData->events = MALLOC(spEventData*, events->size); - for (eventMap = events->child, i = 0; eventMap; eventMap = eventMap->next, ++i) { - spEventData* eventData = spEventData_create(eventMap->name); - eventData->intValue = Json_getInt(eventMap, "int", 0); - eventData->floatValue = Json_getFloat(eventMap, "float", 0); - stringValue = Json_getString(eventMap, "string", 0); - if (stringValue) MALLOC_STR(eventData->stringValue, stringValue); - skeletonData->events[i] = eventData; - } - } - - /* Animations. */ - animations = Json_getItem(root, "animations"); - if (animations) { - Json *animationMap; - skeletonData->animations = MALLOC(spAnimation*, animations->size); - for (animationMap = animations->child; animationMap; animationMap = animationMap->next) { - spAnimation* animation = _spSkeletonJson_readAnimation(self, animationMap, skeletonData); - if (!animation) { - spSkeletonData_dispose(skeletonData); - return 0; - } - skeletonData->animations[skeletonData->animationsCount++] = animation; - } - } - - Json_dispose(root); - return skeletonData; -} diff --git a/cocos/editor-support/spine/SkeletonJson.cpp b/cocos/editor-support/spine/SkeletonJson.cpp new file mode 100644 index 00000000000..358dd77f49d --- /dev/null +++ b/cocos/editor-support/spine/SkeletonJson.cpp @@ -0,0 +1,1251 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) +#define strdup _strdup +#endif + +using namespace spine; + +SkeletonJson::SkeletonJson(Atlas *atlas) : _attachmentLoader(new(__FILE__, __LINE__) AtlasAttachmentLoader(atlas)), + _scale(1), _ownsLoader(true) { +} + +SkeletonJson::SkeletonJson(AttachmentLoader *attachmentLoader) : _attachmentLoader(attachmentLoader), _scale(1), + _ownsLoader(false) { + assert(_attachmentLoader != NULL); +} + +SkeletonJson::~SkeletonJson() { + ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes); + + if (_ownsLoader) { + delete _attachmentLoader; + } +} + +SkeletonData *SkeletonJson::readSkeletonDataFile(const String &path) { + int length; + SkeletonData *skeletonData; + const char *json = SpineExtension::readFile(path, &length); + if (length == 0 || !json) { + setError(NULL, "Unable to read skeleton file: ", path); + return NULL; + } + + skeletonData = readSkeletonData(json); + + SpineExtension::free(json, __FILE__, __LINE__); + + return skeletonData; +} + +SkeletonData *SkeletonJson::readSkeletonData(const char *json) { + int i, ii; + SkeletonData *skeletonData; + Json *root, *skeleton, *bones, *boneMap, *ik, *transform, *path, *slots, *skins, *animations, *events; + + _error = ""; + _linkedMeshes.clear(); + + root = new(__FILE__, __LINE__) Json(json); + + if (!root) { + setError(NULL, "Invalid skeleton JSON: ", Json::getError()); + return NULL; + } + + skeletonData = new(__FILE__, __LINE__) SkeletonData(); + + skeleton = Json::getItem(root, "skeleton"); + if (skeleton) { + skeletonData->_hash = Json::getString(skeleton, "hash", 0); + skeletonData->_version = Json::getString(skeleton, "spine", 0); + skeletonData->_width = Json::getFloat(skeleton, "width", 0); + skeletonData->_height = Json::getFloat(skeleton, "height", 0); + skeletonData->_fps = Json::getFloat(skeleton, "fps", 30); + skeletonData->_audioPath = Json::getString(skeleton, "audio", 0); + skeletonData->_imagesPath = Json::getString(skeleton, "images", 0); + } + + /* Bones. */ + bones = Json::getItem(root, "bones"); + skeletonData->_bones.setSize(bones->_size, 0); + int bonesCount = 0; + for (boneMap = bones->_child, i = 0; boneMap; boneMap = boneMap->_next, ++i) { + BoneData *data; + const char *transformMode; + + BoneData *parent = 0; + const char *parentName = Json::getString(boneMap, "parent", 0); + if (parentName) { + parent = skeletonData->findBone(parentName); + if (!parent) { + delete skeletonData; + setError(root, "Parent bone not found: ", parentName); + return NULL; + } + } + + data = new(__FILE__, __LINE__) BoneData(bonesCount, Json::getString(boneMap, "name", 0), parent); + + data->_length = Json::getFloat(boneMap, "length", 0) * _scale; + data->_x = Json::getFloat(boneMap, "x", 0) * _scale; + data->_y = Json::getFloat(boneMap, "y", 0) * _scale; + data->_rotation = Json::getFloat(boneMap, "rotation", 0); + data->_scaleX = Json::getFloat(boneMap, "scaleX", 1); + data->_scaleY = Json::getFloat(boneMap, "scaleY", 1); + data->_shearX = Json::getFloat(boneMap, "shearX", 0); + data->_shearY = Json::getFloat(boneMap, "shearY", 0); + transformMode = Json::getString(boneMap, "transform", "normal"); + data->_transformMode = TransformMode_Normal; + if (strcmp(transformMode, "normal") == 0) { + data->_transformMode = TransformMode_Normal; + } + if (strcmp(transformMode, "onlyTranslation") == 0) { + data->_transformMode = TransformMode_OnlyTranslation; + } + if (strcmp(transformMode, "noRotationOrReflection") == 0) { + data->_transformMode = TransformMode_NoRotationOrReflection; + } + if (strcmp(transformMode, "noScale") == 0) { + data->_transformMode = TransformMode_NoScale; + } + if (strcmp(transformMode, "noScaleOrReflection") == 0) { + data->_transformMode = TransformMode_NoScaleOrReflection; + } + + skeletonData->_bones[i] = data; + bonesCount++; + } + + /* Slots. */ + slots = Json::getItem(root, "slots"); + if (slots) { + Json *slotMap; + skeletonData->_slots.ensureCapacity(slots->_size); + skeletonData->_slots.setSize(slots->_size, 0); + for (slotMap = slots->_child, i = 0; slotMap; slotMap = slotMap->_next, ++i) { + SlotData *data; + const char *color; + const char *dark; + Json *item; + + const char *boneName = Json::getString(slotMap, "bone", 0); + BoneData *boneData = skeletonData->findBone(boneName); + if (!boneData) { + delete skeletonData; + setError(root, "Slot bone not found: ", boneName); + return NULL; + } + + data = new(__FILE__, __LINE__) SlotData(i, Json::getString(slotMap, "name", 0), *boneData); + + color = Json::getString(slotMap, "color", 0); + if (color) { + Color &c = data->getColor(); + c.r = toColor(color, 0); + c.g = toColor(color, 1); + c.b = toColor(color, 2); + c.a = toColor(color, 3); + } + + dark = Json::getString(slotMap, "dark", 0); + if (dark) { + Color &darkColor = data->getDarkColor(); + darkColor.r = toColor(dark, 0); + darkColor.g = toColor(dark, 1); + darkColor.b = toColor(dark, 2); + darkColor.a = 1; + data->setHasDarkColor(true); + } + + item = Json::getItem(slotMap, "attachment"); + if (item) { + data->setAttachmentName(item->_valueString); + } + + item = Json::getItem(slotMap, "blend"); + if (item) { + if (strcmp(item->_valueString, "additive") == 0) { + data->_blendMode = BlendMode_Additive; + } else if (strcmp(item->_valueString, "multiply") == 0) { + data->_blendMode = BlendMode_Multiply; + } else if (strcmp(item->_valueString, "screen") == 0) { + data->_blendMode = BlendMode_Screen; + } + } + + skeletonData->_slots[i] = data; + } + } + + /* IK constraints. */ + ik = Json::getItem(root, "ik"); + if (ik) { + Json *constraintMap; + skeletonData->_ikConstraints.ensureCapacity(ik->_size); + skeletonData->_ikConstraints.setSize(ik->_size, 0); + for (constraintMap = ik->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) { + const char *targetName; + + IkConstraintData *data = new(__FILE__, __LINE__) IkConstraintData( + Json::getString(constraintMap, "name", 0)); + + data->_order = Json::getInt(constraintMap, "order", 0); + + boneMap = Json::getItem(constraintMap, "bones"); + data->_bones.ensureCapacity(boneMap->_size); + data->_bones.setSize(boneMap->_size, 0); + for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) { + data->_bones[ii] = skeletonData->findBone(boneMap->_valueString); + if (!data->_bones[ii]) { + delete skeletonData; + setError(root, "IK bone not found: ", boneMap->_valueString); + return NULL; + } + } + + targetName = Json::getString(constraintMap, "target", 0); + data->_target = skeletonData->findBone(targetName); + if (!data->_target) { + delete skeletonData; + setError(root, "Target bone not found: ", targetName); + return NULL; + } + + data->_mix = Json::getFloat(constraintMap, "mix", 1); + data->_bendDirection = Json::getInt(constraintMap, "bendPositive", 1) ? 1 : -1; + data->_compress = Json::getInt(constraintMap, "compress", 0) ? true: false; + data->_stretch = Json::getInt(constraintMap, "stretch", 0) ? true: false; + data->_uniform = Json::getInt(constraintMap, "uniform", 0) ? true: false; + + skeletonData->_ikConstraints[i] = data; + } + } + + /* Transform constraints. */ + transform = Json::getItem(root, "transform"); + if (transform) { + Json *constraintMap; + skeletonData->_transformConstraints.ensureCapacity(transform->_size); + skeletonData->_transformConstraints.setSize(transform->_size, 0); + for (constraintMap = transform->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) { + const char *name; + + TransformConstraintData *data = new(__FILE__, __LINE__) TransformConstraintData( + Json::getString(constraintMap, "name", 0)); + + data->_order = Json::getInt(constraintMap, "order", 0); + + boneMap = Json::getItem(constraintMap, "bones"); + data->_bones.ensureCapacity(boneMap->_size); + data->_bones.setSize(boneMap->_size, 0); + for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) { + data->_bones[ii] = skeletonData->findBone(boneMap->_valueString); + if (!data->_bones[ii]) { + delete skeletonData; + setError(root, "Transform bone not found: ", boneMap->_valueString); + return NULL; + } + } + + name = Json::getString(constraintMap, "target", 0); + data->_target = skeletonData->findBone(name); + if (!data->_target) { + delete skeletonData; + setError(root, "Target bone not found: ", name); + return NULL; + } + + data->_local = Json::getInt(constraintMap, "local", 0) ? true : false; + data->_relative = Json::getInt(constraintMap, "relative", 0) ? true : false; + data->_offsetRotation = Json::getFloat(constraintMap, "rotation", 0); + data->_offsetX = Json::getFloat(constraintMap, "x", 0) * _scale; + data->_offsetY = Json::getFloat(constraintMap, "y", 0) * _scale; + data->_offsetScaleX = Json::getFloat(constraintMap, "scaleX", 0); + data->_offsetScaleY = Json::getFloat(constraintMap, "scaleY", 0); + data->_offsetShearY = Json::getFloat(constraintMap, "shearY", 0); + + data->_rotateMix = Json::getFloat(constraintMap, "rotateMix", 1); + data->_translateMix = Json::getFloat(constraintMap, "translateMix", 1); + data->_scaleMix = Json::getFloat(constraintMap, "scaleMix", 1); + data->_shearMix = Json::getFloat(constraintMap, "shearMix", 1); + + skeletonData->_transformConstraints[i] = data; + } + } + + /* Path constraints */ + path = Json::getItem(root, "path"); + if (path) { + Json *constraintMap; + skeletonData->_pathConstraints.ensureCapacity(path->_size); + skeletonData->_pathConstraints.setSize(path->_size, 0); + for (constraintMap = path->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) { + const char *name; + const char *item; + + PathConstraintData *data = new(__FILE__, __LINE__) PathConstraintData( + Json::getString(constraintMap, "name", 0)); + + data->_order = Json::getInt(constraintMap, "order", 0); + + boneMap = Json::getItem(constraintMap, "bones"); + data->_bones.ensureCapacity(boneMap->_size); + data->_bones.setSize(boneMap->_size, 0); + for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) { + data->_bones[ii] = skeletonData->findBone(boneMap->_valueString); + if (!data->_bones[ii]) { + delete skeletonData; + setError(root, "Path bone not found: ", boneMap->_valueString); + return NULL; + } + } + + name = Json::getString(constraintMap, "target", 0); + data->_target = skeletonData->findSlot(name); + if (!data->_target) { + delete skeletonData; + setError(root, "Target slot not found: ", name); + return NULL; + } + + item = Json::getString(constraintMap, "positionMode", "percent"); + if (strcmp(item, "fixed") == 0) { + data->_positionMode = PositionMode_Fixed; + } else if (strcmp(item, "percent") == 0) { + data->_positionMode = PositionMode_Percent; + } + + item = Json::getString(constraintMap, "spacingMode", "length"); + if (strcmp(item, "length") == 0) { + data->_spacingMode = SpacingMode_Length; + } else if (strcmp(item, "fixed") == 0) { + data->_spacingMode = SpacingMode_Fixed; + } else if (strcmp(item, "percent") == 0) { + data->_spacingMode = SpacingMode_Percent; + } + + item = Json::getString(constraintMap, "rotateMode", "tangent"); + if (strcmp(item, "tangent") == 0) { + data->_rotateMode = RotateMode_Tangent; + } else if (strcmp(item, "chain") == 0) { + data->_rotateMode = RotateMode_Chain; + } else if (strcmp(item, "chainScale") == 0) { + data->_rotateMode = RotateMode_ChainScale; + } + + data->_offsetRotation = Json::getFloat(constraintMap, "rotation", 0); + data->_position = Json::getFloat(constraintMap, "position", 0); + if (data->_positionMode == PositionMode_Fixed) { + data->_position *= _scale; + } + data->_spacing = Json::getFloat(constraintMap, "spacing", 0); + if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) { + data->_spacing *= _scale; + } + data->_rotateMix = Json::getFloat(constraintMap, "rotateMix", 1); + data->_translateMix = Json::getFloat(constraintMap, "translateMix", 1); + + skeletonData->_pathConstraints[i] = data; + } + } + + /* Skins. */ + skins = Json::getItem(root, "skins"); + if (skins) { + Json *skinMap; + skeletonData->_skins.ensureCapacity(skins->_size); + skeletonData->_skins.setSize(skins->_size, 0); + int skinsIndex = 0; + for (skinMap = skins->_child, i = 0; skinMap; skinMap = skinMap->_next, ++i) { + Json *attachmentsMap; + Json *curves; + + Skin *skin = new(__FILE__, __LINE__) Skin(skinMap->_name); + + skeletonData->_skins[skinsIndex++] = skin; + if (strcmp(skinMap->_name, "default") == 0) { + skeletonData->_defaultSkin = skin; + } + + for (attachmentsMap = skinMap->_child; attachmentsMap; attachmentsMap = attachmentsMap->_next) { + int slotIndex = skeletonData->findSlotIndex(attachmentsMap->_name); + Json *attachmentMap; + + for (attachmentMap = attachmentsMap->_child; attachmentMap; attachmentMap = attachmentMap->_next) { + Attachment *attachment = NULL; + const char *skinAttachmentName = attachmentMap->_name; + const char *attachmentName = Json::getString(attachmentMap, "name", skinAttachmentName); + const char *attachmentPath = Json::getString(attachmentMap, "path", attachmentName); + const char *color; + Json *entry; + + const char *typeString = Json::getString(attachmentMap, "type", "region"); + AttachmentType type; + if (strcmp(typeString, "region") == 0) { + type = AttachmentType_Region; + } else if (strcmp(typeString, "mesh") == 0) { + type = AttachmentType_Mesh; + } else if (strcmp(typeString, "linkedmesh") == 0) { + type = AttachmentType_Linkedmesh; + } else if (strcmp(typeString, "boundingbox") == 0) { + type = AttachmentType_Boundingbox; + } else if (strcmp(typeString, "path") == 0) { + type = AttachmentType_Path; + } else if (strcmp(typeString, "clipping") == 0) { + type = AttachmentType_Clipping; + } else if (strcmp(typeString, "point") == 0) { + type = AttachmentType_Point; + }else { + delete skeletonData; + setError(root, "Unknown attachment type: ", typeString); + return NULL; + } + + switch (type) { + case AttachmentType_Region: { + attachment = _attachmentLoader->newRegionAttachment(*skin, attachmentName, attachmentPath); + if (!attachment) { + delete skeletonData; + setError(root, "Error reading attachment: ", skinAttachmentName); + return NULL; + } + + RegionAttachment *region = static_cast(attachment); + region->_path = attachmentPath; + + region->_x = Json::getFloat(attachmentMap, "x", 0) * _scale; + region->_y = Json::getFloat(attachmentMap, "y", 0) * _scale; + region->_scaleX = Json::getFloat(attachmentMap, "scaleX", 1); + region->_scaleY = Json::getFloat(attachmentMap, "scaleY", 1); + region->_rotation = Json::getFloat(attachmentMap, "rotation", 0); + region->_width = Json::getFloat(attachmentMap, "width", 32) * _scale; + region->_height = Json::getFloat(attachmentMap, "height", 32) * _scale; + + color = Json::getString(attachmentMap, "color", 0); + if (color) { + region->getColor().r = toColor(color, 0); + region->getColor().g = toColor(color, 1); + region->getColor().b = toColor(color, 2); + region->getColor().a = toColor(color, 3); + } + + region->updateOffset(); + _attachmentLoader->configureAttachment(region); + break; + } + case AttachmentType_Mesh: + case AttachmentType_Linkedmesh: { + attachment = _attachmentLoader->newMeshAttachment(*skin, attachmentName, attachmentPath); + + if (!attachment) { + delete skeletonData; + setError(root, "Error reading attachment: ", skinAttachmentName); + return NULL; + } + + MeshAttachment *mesh = static_cast(attachment); + mesh->_path = attachmentPath; + + color = Json::getString(attachmentMap, "color", 0); + if (color) { + mesh->getColor().r = toColor(color, 0); + mesh->getColor().g = toColor(color, 1); + mesh->getColor().b = toColor(color, 2); + mesh->getColor().a = toColor(color, 3); + } + + mesh->_width = Json::getFloat(attachmentMap, "width", 32) * _scale; + mesh->_height = Json::getFloat(attachmentMap, "height", 32) * _scale; + + entry = Json::getItem(attachmentMap, "parent"); + if (!entry) { + int verticesLength; + entry = Json::getItem(attachmentMap, "triangles"); + mesh->_triangles.ensureCapacity(entry->_size); + mesh->_triangles.setSize(entry->_size, 0); + for (entry = entry->_child, ii = 0; entry; entry = entry->_next, ++ii) { + mesh->_triangles[ii] = (unsigned short) entry->_valueInt; + } + + entry = Json::getItem(attachmentMap, "uvs"); + verticesLength = entry->_size; + mesh->_regionUVs.ensureCapacity(verticesLength); + mesh->_regionUVs.setSize(verticesLength, 0); + for (entry = entry->_child, ii = 0; entry; entry = entry->_next, ++ii) { + mesh->_regionUVs[ii] = entry->_valueFloat; + } + + readVertices(attachmentMap, mesh, verticesLength); + + mesh->updateUVs(); + + mesh->_hullLength = Json::getInt(attachmentMap, "hull", 0); + + entry = Json::getItem(attachmentMap, "edges"); + if (entry) { + mesh->_edges.ensureCapacity(entry->_size); + mesh->_edges.setSize(entry->_size, 0); + for (entry = entry->_child, ii = 0; entry; entry = entry->_next, ++ii) { + mesh->_edges[ii] = entry->_valueInt; + } + } + _attachmentLoader->configureAttachment(mesh); + } else { + mesh->_inheritDeform = Json::getInt(attachmentMap, "deform", 1) ? true : false; + LinkedMesh *linkedMesh = new(__FILE__, __LINE__) LinkedMesh(mesh, + String(Json::getString( + attachmentMap, + "skin", 0)), + slotIndex, + String(entry->_valueString)); + _linkedMeshes.add(linkedMesh); + } + break; + } + case AttachmentType_Boundingbox: { + attachment = _attachmentLoader->newBoundingBoxAttachment(*skin, attachmentName); + + BoundingBoxAttachment *box = static_cast(attachment); + + int vertexCount = Json::getInt(attachmentMap, "vertexCount", 0) << 1; + readVertices(attachmentMap, box, vertexCount); + _attachmentLoader->configureAttachment(attachment); + break; + } + case AttachmentType_Path: { + attachment = _attachmentLoader->newPathAttachment(*skin, attachmentName); + + PathAttachment *pathAttatchment = static_cast(attachment); + + int vertexCount = 0; + pathAttatchment->_closed = Json::getInt(attachmentMap, "closed", 0) ? true : false; + pathAttatchment->_constantSpeed = Json::getInt(attachmentMap, "constantSpeed", 1) ? true : false; + vertexCount = Json::getInt(attachmentMap, "vertexCount", 0); + readVertices(attachmentMap, pathAttatchment, vertexCount << 1); + + pathAttatchment->_lengths.ensureCapacity(vertexCount / 3); + pathAttatchment->_lengths.setSize(vertexCount / 3, 0); + + curves = Json::getItem(attachmentMap, "lengths"); + for (curves = curves->_child, ii = 0; curves; curves = curves->_next, ++ii) { + pathAttatchment->_lengths[ii] = curves->_valueFloat * _scale; + } + _attachmentLoader->configureAttachment(attachment); + break; + } + case AttachmentType_Point: { + attachment = _attachmentLoader->newPointAttachment(*skin, attachmentName); + + PointAttachment *point = static_cast(attachment); + + point->_x = Json::getFloat(attachmentMap, "x", 0) * _scale; + point->_y = Json::getFloat(attachmentMap, "y", 0) * _scale; + point->_rotation = Json::getFloat(attachmentMap, "rotation", 0); + _attachmentLoader->configureAttachment(attachment); + break; + } + case AttachmentType_Clipping: { + attachment = _attachmentLoader->newClippingAttachment(*skin, attachmentName); + + ClippingAttachment *clip = static_cast(attachment); + + int vertexCount = 0; + const char *end = Json::getString(attachmentMap, "end", 0); + if (end) { + SlotData *slot = skeletonData->findSlot(end); + clip->_endSlot = slot; + } + vertexCount = Json::getInt(attachmentMap, "vertexCount", 0) << 1; + readVertices(attachmentMap, clip, vertexCount); + _attachmentLoader->configureAttachment(attachment); + break; + } + } + + skin->addAttachment(slotIndex, skinAttachmentName, attachment); + } + } + } + } + + /* Linked meshes. */ + int n = _linkedMeshes.size(); + for (i = 0; i < n; ++i) { + LinkedMesh *linkedMesh = _linkedMeshes[i]; + Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin( + linkedMesh->_skin); + if (skin == NULL) { + delete skeletonData; + setError(root, "Skin not found: ", linkedMesh->_skin.buffer()); + return NULL; + } + Attachment *parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent); + if (parent == NULL) { + delete skeletonData; + setError(root, "Parent mesh not found: ", linkedMesh->_parent.buffer()); + return NULL; + } + linkedMesh->_mesh->setParentMesh(static_cast(parent)); + linkedMesh->_mesh->updateUVs(); + _attachmentLoader->configureAttachment(linkedMesh->_mesh); + } + ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes); + _linkedMeshes.clear(); + + /* Events. */ + events = Json::getItem(root, "events"); + if (events) { + Json *eventMap; + skeletonData->_events.ensureCapacity(events->_size); + skeletonData->_events.setSize(events->_size, 0); + for (eventMap = events->_child, i = 0; eventMap; eventMap = eventMap->_next, ++i) { + EventData *eventData = new(__FILE__, __LINE__) EventData(String(eventMap->_name)); + + eventData->_intValue = Json::getInt(eventMap, "int", 0); + eventData->_floatValue = Json::getFloat(eventMap, "float", 0); + const char *stringValue = Json::getString(eventMap, "string", 0); + eventData->_stringValue = stringValue; + const char *audioPath = Json::getString(eventMap, "audio", 0); + eventData->_audioPath = audioPath; + if (audioPath) { + eventData->_volume = Json::getFloat(eventMap, "volume", 1); + eventData->_balance = Json::getFloat(eventMap, "balance", 0); + } + skeletonData->_events[i] = eventData; + } + } + + /* Animations. */ + animations = Json::getItem(root, "animations"); + if (animations) { + Json *animationMap; + skeletonData->_animations.ensureCapacity(animations->_size); + skeletonData->_animations.setSize(animations->_size, 0); + int animationsIndex = 0; + for (animationMap = animations->_child; animationMap; animationMap = animationMap->_next) { + Animation *animation = readAnimation(animationMap, skeletonData); + if (!animation) { + delete skeletonData; + delete root; + return NULL; + } + skeletonData->_animations[animationsIndex++] = animation; + } + } + + delete root; + + return skeletonData; +} + +float SkeletonJson::toColor(const char *value, size_t index) { + char digits[3]; + char *error; + int color; + + if (index >= strlen(value) / 2) { + return -1; + } + + value += index * 2; + + digits[0] = *value; + digits[1] = *(value + 1); + digits[2] = '\0'; + color = (int) strtoul(digits, &error, 16); + if (*error != 0) { + return -1; + } + + return color / (float) 255; +} + +void SkeletonJson::readCurve(Json *frame, CurveTimeline *timeline, size_t frameIndex) { + Json *curve = Json::getItem(frame, "curve"); + if (!curve) { + return; + } + if (curve->_type == Json::JSON_STRING && strcmp(curve->_valueString, "stepped") == 0) { + timeline->setStepped(frameIndex); + } else if (curve->_type == Json::JSON_ARRAY) { + Json *child0 = curve->_child; + Json *child1 = child0->_next; + Json *child2 = child1->_next; + Json *child3 = child2->_next; + timeline->setCurve(frameIndex, child0->_valueFloat, child1->_valueFloat, child2->_valueFloat, + child3->_valueFloat); + } +} + +Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) { + Vector timelines; + float duration = 0; + + size_t frameIndex; + Json *valueMap; + int timelinesCount = 0; + + Json *bones = Json::getItem(root, "bones"); + Json *slots = Json::getItem(root, "slots"); + Json *ik = Json::getItem(root, "ik"); + Json *transform = Json::getItem(root, "transform"); + Json *paths = Json::getItem(root, "paths"); + Json *deform = Json::getItem(root, "deform"); + Json *drawOrder = Json::getItem(root, "drawOrder"); + Json *events = Json::getItem(root, "events"); + Json *boneMap, *slotMap, *constraintMap; + if (!drawOrder) { + drawOrder = Json::getItem(root, "draworder"); + } + + for (boneMap = bones ? bones->_child : NULL; boneMap; boneMap = boneMap->_next) { + timelinesCount += boneMap->_size; + } + + for (slotMap = slots ? slots->_child : NULL; slotMap; slotMap = slotMap->_next) { + timelinesCount += slotMap->_size; + } + + timelinesCount += ik ? ik->_size : 0; + timelinesCount += transform ? transform->_size : 0; + + for (constraintMap = paths ? paths->_child : NULL; constraintMap; constraintMap = constraintMap->_next) { + timelinesCount += constraintMap->_size; + } + + for (constraintMap = deform ? deform->_child : NULL; constraintMap; constraintMap = constraintMap->_next) { + for (slotMap = constraintMap->_child; slotMap; slotMap = slotMap->_next) { + timelinesCount += slotMap->_size; + } + } + + if (drawOrder) { + ++timelinesCount; + } + + if (events) { + ++timelinesCount; + } + + /** Slot timelines. */ + for (slotMap = slots ? slots->_child : 0; slotMap; slotMap = slotMap->_next) { + Json *timelineMap; + + int slotIndex = skeletonData->findSlotIndex(slotMap->_name); + if (slotIndex == -1) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Slot not found: ", slotMap->_name); + return NULL; + } + + for (timelineMap = slotMap->_child; timelineMap; timelineMap = timelineMap->_next) { + if (strcmp(timelineMap->_name, "attachment") == 0) { + AttachmentTimeline *timeline = new(__FILE__, __LINE__) AttachmentTimeline(timelineMap->_size); + + timeline->_slotIndex = slotIndex; + + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + Json *name = Json::getItem(valueMap, "name"); + String attachmentName = name->_type == Json::JSON_NULL ? "" : name->_valueString; + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), attachmentName); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, timeline->_frames[timelineMap->_size - 1]); + + } else if (strcmp(timelineMap->_name, "color") == 0) { + ColorTimeline *timeline = new(__FILE__, __LINE__) ColorTimeline(timelineMap->_size); + + timeline->_slotIndex = slotIndex; + + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + const char *s = Json::getString(valueMap, "color", 0); + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), toColor(s, 0), toColor(s, 1), + toColor(s, 2), toColor(s, 3)); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, + timeline->_frames[(timelineMap->_size - 1) * ColorTimeline::ENTRIES]); + + } else if (strcmp(timelineMap->_name, "twoColor") == 0) { + TwoColorTimeline *timeline = new(__FILE__, __LINE__) TwoColorTimeline(timelineMap->_size); + + timeline->_slotIndex = slotIndex; + + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + const char *s = Json::getString(valueMap, "light", 0); + const char *ds = Json::getString(valueMap, "dark", 0); + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), toColor(s, 0), toColor(s, 1), + toColor(s, 2), + toColor(s, 3), toColor(ds, 0), toColor(ds, 1), toColor(ds, 2)); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, + timeline->_frames[(timelineMap->_size - 1) * TwoColorTimeline::ENTRIES]); + } else { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Invalid timeline type for a slot: ", timelineMap->_name); + return NULL; + } + } + } + + /** Bone timelines. */ + for (boneMap = bones ? bones->_child : 0; boneMap; boneMap = boneMap->_next) { + Json *timelineMap; + + int boneIndex = skeletonData->findBoneIndex(boneMap->_name); + if (boneIndex == -1) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Bone not found: ", boneMap->_name); + return NULL; + } + + for (timelineMap = boneMap->_child; timelineMap; timelineMap = timelineMap->_next) { + if (strcmp(timelineMap->_name, "rotate") == 0) { + RotateTimeline *timeline = new(__FILE__, __LINE__) RotateTimeline(timelineMap->_size); + + timeline->_boneIndex = boneIndex; + + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), + Json::getFloat(valueMap, "angle", 0)); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, + timeline->_frames[(timelineMap->_size - 1) * RotateTimeline::ENTRIES]); + } else { + int isScale = strcmp(timelineMap->_name, "scale") == 0; + int isTranslate = strcmp(timelineMap->_name, "translate") == 0; + int isShear = strcmp(timelineMap->_name, "shear") == 0; + if (isScale || isTranslate || isShear) { + float timelineScale = isTranslate ? _scale : 1; + TranslateTimeline *timeline = 0; + if (isScale) { + timeline = new(__FILE__, __LINE__) ScaleTimeline(timelineMap->_size); + } else if (isTranslate) { + timeline = new(__FILE__, __LINE__) TranslateTimeline(timelineMap->_size); + } else if (isShear) { + timeline = new(__FILE__, __LINE__) ShearTimeline(timelineMap->_size); + } + timeline->_boneIndex = boneIndex; + + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), + Json::getFloat(valueMap, "x", 0) * timelineScale, + Json::getFloat(valueMap, "y", 0) * timelineScale); + readCurve(valueMap, timeline, frameIndex); + } + + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, + timeline->_frames[(timelineMap->_size - 1) * TranslateTimeline::ENTRIES]); + } else { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Invalid timeline type for a bone: ", timelineMap->_name); + return NULL; + } + } + } + } + + /** IK constraint timelines. */ + for (constraintMap = ik ? ik->_child : 0; constraintMap; constraintMap = constraintMap->_next) { + IkConstraintData *constraint = skeletonData->findIkConstraint(constraintMap->_name); + IkConstraintTimeline *timeline = new(__FILE__, __LINE__) IkConstraintTimeline(constraintMap->_size); + + for (frameIndex = 0; frameIndex < skeletonData->_ikConstraints.size(); ++frameIndex) { + if (constraint == skeletonData->_ikConstraints[frameIndex]) { + timeline->_ikConstraintIndex = frameIndex; + break; + } + } + for (valueMap = constraintMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), Json::getFloat(valueMap, "mix", 1), + Json::getInt(valueMap, "bendPositive", 1) ? 1 : -1, Json::getInt(valueMap, "compress", 0) ? true : false, Json::getInt(valueMap, "stretch", 0) ? true : false); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, + timeline->_frames[(constraintMap->_size - 1) * IkConstraintTimeline::ENTRIES]); + } + + /** Transform constraint timelines. */ + for (constraintMap = transform ? transform->_child : 0; constraintMap; constraintMap = constraintMap->_next) { + TransformConstraintData *constraint = skeletonData->findTransformConstraint(constraintMap->_name); + TransformConstraintTimeline *timeline = new(__FILE__, __LINE__) TransformConstraintTimeline( + constraintMap->_size); + + for (frameIndex = 0; frameIndex < skeletonData->_transformConstraints.size(); ++frameIndex) { + if (constraint == skeletonData->_transformConstraints[frameIndex]) { + timeline->_transformConstraintIndex = frameIndex; + break; + } + } + for (valueMap = constraintMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), + Json::getFloat(valueMap, "rotateMix", 1), Json::getFloat(valueMap, "translateMix", 1), + Json::getFloat(valueMap, "scaleMix", 1), Json::getFloat(valueMap, "shearMix", 1)); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, + timeline->_frames[(constraintMap->_size - 1) * TransformConstraintTimeline::ENTRIES]); + } + + /** Path constraint timelines. */ + for (constraintMap = paths ? paths->_child : 0; constraintMap; constraintMap = constraintMap->_next) { + size_t constraintIndex = 0, i; + Json *timelineMap; + + PathConstraintData *data = skeletonData->findPathConstraint(constraintMap->_name); + if (!data) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Path constraint not found: ", constraintMap->_name); + return NULL; + } + + for (i = 0; i < skeletonData->_pathConstraints.size(); i++) { + if (skeletonData->_pathConstraints[i] == data) { + constraintIndex = i; + break; + } + } + + for (timelineMap = constraintMap->_child; timelineMap; timelineMap = timelineMap->_next) { + const char *timelineName = timelineMap->_name; + if (strcmp(timelineName, "position") == 0 || strcmp(timelineName, "spacing") == 0) { + PathConstraintPositionTimeline *timeline; + float timelineScale = 1; + if (strcmp(timelineName, "spacing") == 0) { + timeline = new(__FILE__, __LINE__) PathConstraintSpacingTimeline(timelineMap->_size); + + if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) { + timelineScale = _scale; + } + } else { + timeline = new(__FILE__, __LINE__) PathConstraintPositionTimeline(timelineMap->_size); + + if (data->_positionMode == PositionMode_Fixed) { + timelineScale = _scale; + } + } + + timeline->_pathConstraintIndex = constraintIndex; + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), + Json::getFloat(valueMap, timelineName, 0) * timelineScale); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, timeline->_frames[(timelineMap->_size - 1) * + PathConstraintPositionTimeline::ENTRIES]); + } else if (strcmp(timelineName, "mix") == 0) { + PathConstraintMixTimeline *timeline = new(__FILE__, __LINE__) PathConstraintMixTimeline( + timelineMap->_size); + timeline->_pathConstraintIndex = constraintIndex; + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), + Json::getFloat(valueMap, "rotateMix", 1), + Json::getFloat(valueMap, "translateMix", 1)); + readCurve(valueMap, timeline, frameIndex); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, timeline->_frames[(timelineMap->_size - 1) * + PathConstraintMixTimeline::ENTRIES]); + } + } + } + + /** Deform timelines. */ + for (constraintMap = deform ? deform->_child : NULL; constraintMap; constraintMap = constraintMap->_next) { + Skin *skin = skeletonData->findSkin(constraintMap->_name); + for (slotMap = constraintMap->_child; slotMap; slotMap = slotMap->_next) { + int slotIndex = skeletonData->findSlotIndex(slotMap->_name); + Json *timelineMap; + for (timelineMap = slotMap->_child; timelineMap; timelineMap = timelineMap->_next) { + DeformTimeline *timeline; + int weighted, deformLength; + + Attachment *baseAttachment = skin->getAttachment(slotIndex, timelineMap->_name); + + if (!baseAttachment) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Attachment not found: ", timelineMap->_name); + return NULL; + } + + VertexAttachment *attachment = static_cast(baseAttachment); + + weighted = attachment->_bones.size() != 0; + Vector &verts = attachment->_vertices; + deformLength = weighted ? verts.size() / 3 * 2 : verts.size(); + + timeline = new(__FILE__, __LINE__) DeformTimeline(timelineMap->_size); + + timeline->_slotIndex = slotIndex; + timeline->_attachment = attachment; + + for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + Json *vertices = Json::getItem(valueMap, "vertices"); + Vector deformed; + if (!vertices) { + if (weighted) { + deformed.setSize(deformLength, 0); + } else { + deformed.clearAndAddAll(attachment->_vertices); + } + } else { + int v, start = Json::getInt(valueMap, "offset", 0); + Json *vertex; + deformed.setSize(deformLength, 0); + if (_scale == 1) { + for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) { + deformed[v] = vertex->_valueFloat; + } + } else { + for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) { + deformed[v] = vertex->_valueFloat * _scale; + } + } + if (!weighted) { + Vector &verticesAttachment = attachment->_vertices; + for (v = 0; v < deformLength; ++v) { + deformed[v] += verticesAttachment[v]; + } + } + } + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), deformed); + readCurve(valueMap, timeline, frameIndex); + } + + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, timeline->_frames[timelineMap->_size - 1]); + } + } + } + + /** Draw order timeline. */ + if (drawOrder) { + DrawOrderTimeline *timeline = new(__FILE__, __LINE__) DrawOrderTimeline(drawOrder->_size); + + for (valueMap = drawOrder->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + int ii; + Vector drawOrder2; + Json *offsets = Json::getItem(valueMap, "offsets"); + if (offsets) { + Json *offsetMap; + Vector unchanged; + unchanged.ensureCapacity(skeletonData->_slots.size() - offsets->_size); + unchanged.setSize(skeletonData->_slots.size() - offsets->_size, 0); + size_t originalIndex = 0, unchangedIndex = 0; + + drawOrder2.ensureCapacity(skeletonData->_slots.size()); + drawOrder2.setSize(skeletonData->_slots.size(), 0); + for (ii = (int)skeletonData->_slots.size() - 1; ii >= 0; --ii) { + drawOrder2[ii] = -1; + } + + for (offsetMap = offsets->_child; offsetMap; offsetMap = offsetMap->_next) { + int slotIndex = skeletonData->findSlotIndex(Json::getString(offsetMap, "slot", 0)); + if (slotIndex == -1) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Slot not found: ", Json::getString(offsetMap, "slot", 0)); + return NULL; + } + /* Collect unchanged items. */ + while (originalIndex != (size_t)slotIndex) { + unchanged[unchangedIndex++] = originalIndex++; + } + /* Set changed items. */ + drawOrder2[originalIndex + Json::getInt(offsetMap, "offset", 0)] = originalIndex; + originalIndex++; + } + /* Collect remaining unchanged items. */ + while (originalIndex < skeletonData->_slots.size()) { + unchanged[unchangedIndex++] = originalIndex++; + } + /* Fill in unchanged items. */ + for (ii = (int)skeletonData->_slots.size() - 1; ii >= 0; ii--) { + if (drawOrder2[ii] == -1) { + drawOrder2[ii] = unchanged[--unchangedIndex]; + } + } + } + timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), drawOrder2); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, timeline->_frames[drawOrder->_size - 1]); + } + + /** Event timeline. */ + if (events) { + EventTimeline *timeline = new(__FILE__, __LINE__) EventTimeline(events->_size); + + for (valueMap = events->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) { + Event *event; + EventData *eventData = skeletonData->findEvent(Json::getString(valueMap, "name", 0)); + if (!eventData) { + ContainerUtil::cleanUpVectorOfPointers(timelines); + setError(NULL, "Event not found: ", Json::getString(valueMap, "name", 0)); + return NULL; + } + + event = new(__FILE__, __LINE__) Event(Json::getFloat(valueMap, "time", 0), *eventData); + event->_intValue = Json::getInt(valueMap, "int", eventData->_intValue); + event->_floatValue = Json::getFloat(valueMap, "float", eventData->_floatValue); + event->_stringValue = Json::getString(valueMap, "string", eventData->_stringValue.buffer()); + if (!eventData->_audioPath.isEmpty()) { + event->_volume = Json::getFloat(valueMap, "volume", 1); + event->_balance = Json::getFloat(valueMap, "balance", 0); + } + timeline->setFrame(frameIndex, event); + } + timelines.add(timeline); + timelinesCount++; + duration = MathUtil::max(duration, timeline->_frames[events->_size - 1]); + } + + return new(__FILE__, __LINE__) Animation(String(root->_name), timelines, duration); +} + +void SkeletonJson::readVertices(Json *attachmentMap, VertexAttachment *attachment, size_t verticesLength) { + Json *entry; + size_t i, n, nn, entrySize; + Vector vertices; + + attachment->setWorldVerticesLength(verticesLength); + + entry = Json::getItem(attachmentMap, "vertices"); + entrySize = entry->_size; + vertices.ensureCapacity(entrySize); + vertices.setSize(entrySize, 0); + for (entry = entry->_child, i = 0; entry; entry = entry->_next, ++i) { + vertices[i] = entry->_valueFloat; + } + + if (verticesLength == entrySize) { + if (_scale != 1) { + for (i = 0; i < entrySize; ++i) { + vertices[i] *= _scale; + } + } + + attachment->getVertices().clearAndAddAll(vertices); + return; + } + + Vertices bonesAndWeights; + bonesAndWeights._bones.ensureCapacity(verticesLength * 3); + bonesAndWeights._vertices.ensureCapacity(verticesLength * 3 * 3); + + for (i = 0, n = entrySize; i < n;) { + int boneCount = (int) vertices[i++]; + bonesAndWeights._bones.add(boneCount); + for (nn = i + boneCount * 4; i < nn; i += 4) { + bonesAndWeights._bones.add((int) vertices[i]); + bonesAndWeights._vertices.add(vertices[i + 1] * _scale); + bonesAndWeights._vertices.add(vertices[i + 2] * _scale); + bonesAndWeights._vertices.add(vertices[i + 3]); + } + } + + attachment->getVertices().clearAndAddAll(bonesAndWeights._vertices); + attachment->getBones().clearAndAddAll(bonesAndWeights._bones); +} + +void SkeletonJson::setError(Json *root, const String &value1, const String &value2) { + _error = String(value1).append(value2); + + delete root; +} diff --git a/cocos/editor-support/spine/SkeletonJson.h b/cocos/editor-support/spine/SkeletonJson.h index 96f1b86ec3a..5b07c4dff6b 100644 --- a/cocos/editor-support/spine/SkeletonJson.h +++ b/cocos/editor-support/spine/SkeletonJson.h @@ -1,73 +1,92 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SKELETONJSON_H_ -#define SPINE_SKELETONJSON_H_ - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct spAtlasAttachmentLoader; - -typedef struct spSkeletonJson { - float scale; - spAttachmentLoader* attachmentLoader; - const char* const error; -} spSkeletonJson; - -SP_API spSkeletonJson* spSkeletonJson_createWithLoader (spAttachmentLoader* attachmentLoader); -SP_API spSkeletonJson* spSkeletonJson_create (spAtlas* atlas); -SP_API void spSkeletonJson_dispose (spSkeletonJson* self); - -SP_API spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const char* json); -SP_API spSkeletonData* spSkeletonJson_readSkeletonDataFile (spSkeletonJson* self, const char* path); - -#ifdef SPINE_SHORT_NAMES -typedef spSkeletonJson SkeletonJson; -#define SkeletonJson_createWithLoader(...) spSkeletonJson_createWithLoader(__VA_ARGS__) -#define SkeletonJson_create(...) spSkeletonJson_create(__VA_ARGS__) -#define SkeletonJson_dispose(...) spSkeletonJson_dispose(__VA_ARGS__) -#define SkeletonJson_readSkeletonData(...) spSkeletonJson_readSkeletonData(__VA_ARGS__) -#define SkeletonJson_readSkeletonDataFile(...) spSkeletonJson_readSkeletonDataFile(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SKELETONJSON_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SkeletonJson_h +#define Spine_SkeletonJson_h + +#include +#include +#include + +namespace spine { +class CurveTimeline; + +class VertexAttachment; + +class Animation; + +class Json; + +class SkeletonData; + +class Atlas; + +class AttachmentLoader; + +class LinkedMesh; + +class String; + +class SP_API SkeletonJson : public SpineObject { +public: + explicit SkeletonJson(Atlas *atlas); + + explicit SkeletonJson(AttachmentLoader *attachmentLoader); + + ~SkeletonJson(); + + SkeletonData *readSkeletonDataFile(const String &path); + + SkeletonData *readSkeletonData(const char *json); + + void setScale(float scale) { _scale = scale; } + + String &getError() { return _error; } + +private: + AttachmentLoader *_attachmentLoader; + Vector _linkedMeshes; + float _scale; + const bool _ownsLoader; + String _error; + + static float toColor(const char *value, size_t index); + + static void readCurve(Json *frame, CurveTimeline *timeline, size_t frameIndex); + + Animation *readAnimation(Json *root, SkeletonData *skeletonData); + + void readVertices(Json *attachmentMap, VertexAttachment *attachment, size_t verticesLength); + + void setError(Json *root, const String &value1, const String &value2); +}; +} + +#endif /* Spine_SkeletonJson_h */ diff --git a/cocos/editor-support/spine/Skin.c b/cocos/editor-support/spine/Skin.c deleted file mode 100644 index e222babbcad..00000000000 --- a/cocos/editor-support/spine/Skin.c +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -_Entry* _Entry_create (int slotIndex, const char* name, spAttachment* attachment) { - _Entry* self = NEW(_Entry); - self->slotIndex = slotIndex; - MALLOC_STR(self->name, name); - self->attachment = attachment; - return self; -} - -void _Entry_dispose (_Entry* self) { - spAttachment_dispose(self->attachment); - FREE(self->name); - FREE(self); -} - -static _SkinHashTableEntry* _SkinHashTableEntry_create (_Entry* entry) { - _SkinHashTableEntry* self = NEW(_SkinHashTableEntry); - self->entry = entry; - return self; -} - -static void _SkinHashTableEntry_dispose (_SkinHashTableEntry* self) { - FREE(self); -} - -/**/ - -spSkin* spSkin_create (const char* name) { - spSkin* self = SUPER(NEW(_spSkin)); - MALLOC_STR(self->name, name); - return self; -} - -void spSkin_dispose (spSkin* self) { - _Entry* entry = SUB_CAST(_spSkin, self)->entries; - - while (entry) { - _Entry* nextEntry = entry->next; - _Entry_dispose(entry); - entry = nextEntry; - } - - { - _SkinHashTableEntry** currentHashtableEntry = SUB_CAST(_spSkin, self)->entriesHashTable; - int i; - - for (i = 0; i < SKIN_ENTRIES_HASH_TABLE_SIZE; ++i, ++currentHashtableEntry) { - _SkinHashTableEntry* hashtableEntry = *currentHashtableEntry; - - while (hashtableEntry) { - _SkinHashTableEntry* nextEntry = hashtableEntry->next; - _SkinHashTableEntry_dispose(hashtableEntry); - hashtableEntry = nextEntry; - } - } - } - - FREE(self->name); - FREE(self); -} - -void spSkin_addAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment) { - _Entry* newEntry = _Entry_create(slotIndex, name, attachment); - newEntry->next = SUB_CAST(_spSkin, self)->entries; - SUB_CAST(_spSkin, self)->entries = newEntry; - - { - unsigned int hashTableIndex = (unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE; - - _SkinHashTableEntry* newHashEntry = _SkinHashTableEntry_create(newEntry); - newHashEntry->next = SUB_CAST(_spSkin, self)->entriesHashTable[hashTableIndex]; - SUB_CAST(_spSkin, self)->entriesHashTable[hashTableIndex] = newHashEntry; - } -} - -spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name) { - const _SkinHashTableEntry* hashEntry = SUB_CAST(_spSkin, self)->entriesHashTable[(unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE]; - while (hashEntry) { - if (hashEntry->entry->slotIndex == slotIndex && strcmp(hashEntry->entry->name, name) == 0) return hashEntry->entry->attachment; - hashEntry = hashEntry->next; - } - return 0; -} - -const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex) { - const _Entry* entry = SUB_CAST(_spSkin, self)->entries; - int i = 0; - while (entry) { - if (entry->slotIndex == slotIndex) { - if (i == attachmentIndex) return entry->name; - i++; - } - entry = entry->next; - } - return 0; -} - -void spSkin_attachAll (const spSkin* self, spSkeleton* skeleton, const spSkin* oldSkin) { - const _Entry *entry = SUB_CAST(_spSkin, oldSkin)->entries; - while (entry) { - spSlot *slot = skeleton->slots[entry->slotIndex]; - if (slot->attachment == entry->attachment) { - spAttachment *attachment = spSkin_getAttachment(self, entry->slotIndex, entry->name); - if (attachment) spSlot_setAttachment(slot, attachment); - } - entry = entry->next; - } -} diff --git a/cocos/editor-support/spine/Skin.cpp b/cocos/editor-support/spine/Skin.cpp new file mode 100644 index 00000000000..a1be7d8b80d --- /dev/null +++ b/cocos/editor-support/spine/Skin.cpp @@ -0,0 +1,147 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include + +#include + +using namespace spine; + +Skin::AttachmentMap::AttachmentMap() { +} + +void Skin::AttachmentMap::put(size_t slotIndex, const String &attachmentName, Attachment *attachment) { + if (slotIndex >= _buckets.size()) + _buckets.setSize(slotIndex + 1, Vector()); + Vector &bucket = _buckets[slotIndex]; + int existing = findInBucket(bucket, attachmentName); + if (existing >= 0) { + bucket[existing]._attachment = attachment; + } else { + bucket.add(Entry(slotIndex, attachmentName, attachment)); + } +} + +Attachment *Skin::AttachmentMap::get(size_t slotIndex, const String &attachmentName) { + if (slotIndex >= _buckets.size()) return NULL; + int existing = findInBucket(_buckets[slotIndex], attachmentName); + return existing >= 0 ? _buckets[slotIndex][existing]._attachment : NULL; +} + +void Skin::AttachmentMap::remove(size_t slotIndex, const String &attachmentName) { + if (slotIndex >= _buckets.size()) return; + int existing = findInBucket(_buckets[slotIndex], attachmentName); + if (existing >= 0) _buckets[slotIndex].removeAt(existing); +} + +int Skin::AttachmentMap::findInBucket(Vector &bucket, const String &attachmentName) { + for (size_t i = 0; i < bucket.size(); i++) + if (bucket[i]._name == attachmentName) return i; + return -1; +} + +Skin::AttachmentMap::Entries Skin::AttachmentMap::getEntries() { + return Skin::AttachmentMap::Entries(_buckets); +} + +Skin::Skin(const String &name) : _name(name), _attachments() { + assert(_name.length() > 0); +} + +Skin::~Skin() { + Skin::AttachmentMap::Entries entries = _attachments.getEntries(); + while (entries.hasNext()) { + Skin::AttachmentMap::Entry entry = entries.next(); + delete entry._attachment; + } +} + +void Skin::addAttachment(size_t slotIndex, const String &name, Attachment *attachment) { + assert(attachment); + _attachments.put(slotIndex, name, attachment); +} + +Attachment *Skin::getAttachment(size_t slotIndex, const String &name) { + return _attachments.get(slotIndex, name); +} + +void Skin::findNamesForSlot(size_t slotIndex, Vector &names) { + Skin::AttachmentMap::Entries entries = _attachments.getEntries(); + while (entries.hasNext()) { + Skin::AttachmentMap::Entry &entry = entries.next(); + if (entry._slotIndex == slotIndex) { + names.add(entry._name); + } + } +} + +void Skin::findAttachmentsForSlot(size_t slotIndex, Vector &attachments) { + Skin::AttachmentMap::Entries entries = _attachments.getEntries(); + while (entries.hasNext()) { + Skin::AttachmentMap::Entry &entry = entries.next(); + if (entry._slotIndex == slotIndex) { + attachments.add(entry._attachment); + } + } +} + +const String &Skin::getName() { + return _name; +} + +Skin::AttachmentMap::Entries Skin::getAttachments() { + return _attachments.getEntries(); +} + +void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) { + Vector &slots = skeleton.getSlots(); + Skin::AttachmentMap::Entries entries = oldSkin.getAttachments(); + while (entries.hasNext()) { + Skin::AttachmentMap::Entry &entry = entries.next(); + int slotIndex = entry._slotIndex; + Slot *slot = slots[slotIndex]; + + if (slot->getAttachment() == entry._attachment) { + Attachment *attachment = getAttachment(slotIndex, entry._name); + if (attachment) { + slot->setAttachment(attachment); + } + } + } +} diff --git a/cocos/editor-support/spine/Skin.h b/cocos/editor-support/spine/Skin.h index 3b3f8b24934..cb0295fe3ca 100644 --- a/cocos/editor-support/spine/Skin.h +++ b/cocos/editor-support/spine/Skin.h @@ -1,105 +1,149 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SKIN_H_ -#define SPINE_SKIN_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Size of hashtable used in skin structure for fast attachment lookup. */ -#define SKIN_ENTRIES_HASH_TABLE_SIZE 100 - -struct spSkeleton; - -typedef struct spSkin { - const char* const name; - -#ifdef __cplusplus - spSkin() : - name(0) { - } -#endif -} spSkin; - -/* Private structs, needed by Skeleton */ -typedef struct _Entry _Entry; -struct _Entry { - int slotIndex; - const char* name; - spAttachment* attachment; - _Entry* next; -}; - -typedef struct _SkinHashTableEntry _SkinHashTableEntry; -struct _SkinHashTableEntry { - _Entry* entry; - _SkinHashTableEntry* next; /* list for elements with same hashes */ -}; - -typedef struct { - spSkin super; - _Entry* entries; /* entries list stored for getting attachment name by attachment index */ - _SkinHashTableEntry* entriesHashTable[SKIN_ENTRIES_HASH_TABLE_SIZE]; /* hashtable for fast attachment lookup */ -} _spSkin; - -SP_API spSkin* spSkin_create (const char* name); -SP_API void spSkin_dispose (spSkin* self); - -/* The Skin owns the attachment. */ -SP_API void spSkin_addAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment); -/* Returns 0 if the attachment was not found. */ -SP_API spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name); - -/* Returns 0 if the slot or attachment was not found. */ -SP_API const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex); - -/** Attach each attachment in this skin if the corresponding attachment in oldSkin is currently attached. */ -SP_API void spSkin_attachAll (const spSkin* self, struct spSkeleton* skeleton, const spSkin* oldspSkin); - -#ifdef SPINE_SHORT_NAMES -typedef spSkin Skin; -#define Skin_create(...) spSkin_create(__VA_ARGS__) -#define Skin_dispose(...) spSkin_dispose(__VA_ARGS__) -#define Skin_addAttachment(...) spSkin_addAttachment(__VA_ARGS__) -#define Skin_getAttachment(...) spSkin_getAttachment(__VA_ARGS__) -#define Skin_getAttachmentName(...) spSkin_getAttachmentName(__VA_ARGS__) -#define Skin_attachAll(...) spSkin_attachAll(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SKIN_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Skin_h +#define Spine_Skin_h + +#include +#include + +namespace spine { +class Attachment; + +class Skeleton; + +/// Stores attachments by slot index and attachment name. +/// See SkeletonData::getDefaultSkin, Skeleton::getSkin, and +/// http://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes Guide. +class SP_API Skin : public SpineObject { + friend class Skeleton; + +public: + class SP_API AttachmentMap : public SpineObject { + friend class Skin; + + public: + struct SP_API Entry { + size_t _slotIndex; + String _name; + Attachment *_attachment; + + Entry(size_t slotIndex, const String &name, Attachment *attachment) : + _slotIndex(slotIndex), + _name(name), + _attachment(attachment) { + } + }; + + class SP_API Entries { + friend class AttachmentMap; + + public: + bool hasNext() { + while(true) { + if (_slotIndex >= _buckets.size()) return false; + if (_bucketIndex >= _buckets[_slotIndex].size()) { + _bucketIndex = 0; + ++_slotIndex; + continue; + }; + return true; + } + } + + Entry &next() { + Entry &result = _buckets[_slotIndex][_bucketIndex]; + ++_bucketIndex; + return result; + } + + protected: + Entries(Vector< Vector > &buckets) : _buckets(buckets), _slotIndex(0), _bucketIndex(0) { + } + + private: + Vector< Vector > &_buckets; + size_t _slotIndex; + size_t _bucketIndex; + }; + + void put(size_t slotIndex, const String &attachmentName, Attachment *attachment); + + Attachment *get(size_t slotIndex, const String &attachmentName); + + void remove(size_t slotIndex, const String &attachmentName); + + Entries getEntries(); + + protected: + AttachmentMap(); + + private: + + int findInBucket(Vector &, const String &attachmentName); + + Vector > _buckets; + }; + + explicit Skin(const String &name); + + ~Skin(); + + /// Adds an attachment to the skin for the specified slot index and name. + /// If the name already exists for the slot, the previous value is replaced. + void addAttachment(size_t slotIndex, const String &name, Attachment *attachment); + + /// Returns the attachment for the specified slot index and name, or NULL. + Attachment *getAttachment(size_t slotIndex, const String &name); + + /// Finds the skin keys for a given slot. The results are added to the passed array of names. + /// @param slotIndex The target slotIndex. To find the slot index, use Skeleton::findSlotIndex or SkeletonData::findSlotIndex + /// @param names Found skin key names will be added to this array. + void findNamesForSlot(size_t slotIndex, Vector &names); + + /// Finds the attachments for a given slot. The results are added to the passed array of Attachments. + /// @param slotIndex The target slotIndex. To find the slot index, use Skeleton::findSlotIndex or SkeletonData::findSlotIndex + /// @param attachments Found Attachments will be added to this array. + void findAttachmentsForSlot(size_t slotIndex, Vector &attachments); + + const String &getName(); + + AttachmentMap::Entries getAttachments(); + +private: + const String _name; + AttachmentMap _attachments; + + /// Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached. + void attachAll(Skeleton &skeleton, Skin &oldSkin); +}; +} + +#endif /* Spine_Skin_h */ diff --git a/cocos/editor-support/spine/Slot.c b/cocos/editor-support/spine/Slot.c deleted file mode 100644 index eded60cff90..00000000000 --- a/cocos/editor-support/spine/Slot.c +++ /dev/null @@ -1,82 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -typedef struct { - spSlot super; - float attachmentTime; -} _spSlot; - -spSlot* spSlot_create (spSlotData* data, spBone* bone) { - spSlot* self = SUPER(NEW(_spSlot)); - CONST_CAST(spSlotData*, self->data) = data; - CONST_CAST(spBone*, self->bone) = bone; - spColor_setFromFloats(&self->color, 1, 1, 1, 1); - self->darkColor = data->darkColor == 0 ? 0 : spColor_create(); - spSlot_setToSetupPose(self); - return self; -} - -void spSlot_dispose (spSlot* self) { - FREE(self->attachmentVertices); - FREE(self->darkColor); - FREE(self); -} - -void spSlot_setAttachment (spSlot* self, spAttachment* attachment) { - if (attachment == self->attachment) return; - CONST_CAST(spAttachment*, self->attachment) = attachment; - SUB_CAST(_spSlot, self)->attachmentTime = self->bone->skeleton->time; - self->attachmentVerticesCount = 0; -} - -void spSlot_setAttachmentTime (spSlot* self, float time) { - SUB_CAST(_spSlot, self)->attachmentTime = self->bone->skeleton->time - time; -} - -float spSlot_getAttachmentTime (const spSlot* self) { - return self->bone->skeleton->time - SUB_CAST(_spSlot, self) ->attachmentTime; -} - -void spSlot_setToSetupPose (spSlot* self) { - spColor_setFromColor(&self->color, &self->data->color); - if (self->darkColor) spColor_setFromColor(self->darkColor, self->data->darkColor); - - if (!self->data->attachmentName) - spSlot_setAttachment(self, 0); - else { - spAttachment* attachment = spSkeleton_getAttachmentForSlotIndex( - self->bone->skeleton, self->data->index, self->data->attachmentName); - CONST_CAST(spAttachment*, self->attachment) = 0; - spSlot_setAttachment(self, attachment); - } -} diff --git a/cocos/editor-support/spine/Slot.cpp b/cocos/editor-support/spine/Slot.cpp new file mode 100644 index 00000000000..35051b59a2e --- /dev/null +++ b/cocos/editor-support/spine/Slot.cpp @@ -0,0 +1,116 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include +#include + +using namespace spine; + +Slot::Slot(SlotData &data, Bone &bone) : + _data(data), + _bone(bone), + _skeleton(bone.getSkeleton()), + _color(1, 1, 1, 1), + _darkColor(0, 0, 0, 0), + _hasDarkColor(data.hasDarkColor()), + _attachment(NULL), + _attachmentTime(0) { + setToSetupPose(); +} + +void Slot::setToSetupPose() { + _color.set(_data.getColor()); + + const String &attachmentName = _data.getAttachmentName(); + if (attachmentName.length() > 0) { + _attachment = NULL; + setAttachment(_skeleton.getAttachment(_data.getIndex(), attachmentName)); + } else { + setAttachment(NULL); + } +} + +SlotData &Slot::getData() { + return _data; +} + +Bone &Slot::getBone() { + return _bone; +} + +Skeleton &Slot::getSkeleton() { + return _skeleton; +} + +Color &Slot::getColor() { + return _color; +} + +Color &Slot::getDarkColor() { + return _darkColor; +} + +bool Slot::hasDarkColor() { + return _hasDarkColor; +} + +Attachment *Slot::getAttachment() { + return _attachment; +} + +void Slot::setAttachment(Attachment *inValue) { + if (_attachment == inValue) { + return; + } + + _attachment = inValue; + _attachmentTime = _skeleton.getTime(); + _attachmentVertices.clear(); +} + +float Slot::getAttachmentTime() { + return _skeleton.getTime() - _attachmentTime; +} + +void Slot::setAttachmentTime(float inValue) { + _attachmentTime = _skeleton.getTime() - inValue; +} + +Vector &Slot::getAttachmentVertices() { + return _attachmentVertices; +} diff --git a/cocos/editor-support/spine/Slot.h b/cocos/editor-support/spine/Slot.h index 04647689a21..b1f83c86942 100644 --- a/cocos/editor-support/spine/Slot.h +++ b/cocos/editor-support/spine/Slot.h @@ -1,93 +1,127 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SLOT_H_ -#define SPINE_SLOT_H_ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spSlot { - spSlotData* const data; - spBone* const bone; - spColor color; - spColor* darkColor; - spAttachment* const attachment; - - int attachmentVerticesCapacity; - int attachmentVerticesCount; - float* attachmentVertices; - -#ifdef __cplusplus - spSlot() : - data(0), - bone(0), - color(), - darkColor(0), - attachment(0), - attachmentVerticesCapacity(0), - attachmentVerticesCount(0), - attachmentVertices(0) { - } -#endif -} spSlot; - -SP_API spSlot* spSlot_create (spSlotData* data, spBone* bone); -SP_API void spSlot_dispose (spSlot* self); - -/* @param attachment May be 0 to clear the attachment for the slot. */ -SP_API void spSlot_setAttachment (spSlot* self, spAttachment* attachment); - -SP_API void spSlot_setAttachmentTime (spSlot* self, float time); -SP_API float spSlot_getAttachmentTime (const spSlot* self); - -SP_API void spSlot_setToSetupPose (spSlot* self); - -#ifdef SPINE_SHORT_NAMES -typedef spSlot Slot; -#define Slot_create(...) spSlot_create(__VA_ARGS__) -#define Slot_dispose(...) spSlot_dispose(__VA_ARGS__) -#define Slot_setAttachment(...) spSlot_setAttachment(__VA_ARGS__) -#define Slot_setAttachmentTime(...) spSlot_setAttachmentTime(__VA_ARGS__) -#define Slot_getAttachmentTime(...) spSlot_getAttachmentTime(__VA_ARGS__) -#define Slot_setToSetupPose(...) spSlot_setToSetupPose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SLOT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Slot_h +#define Spine_Slot_h + +#include +#include +#include + +#include + +namespace spine { +class SlotData; + +class Bone; + +class Skeleton; + +class Attachment; + +class SP_API Slot : public SpineObject { + friend class VertexAttachment; + + friend class Skeleton; + + friend class SkeletonBounds; + + friend class SkeletonClipping; + + friend class AttachmentTimeline; + + friend class ColorTimeline; + + friend class DeformTimeline; + + friend class DrawOrderTimeline; + + friend class EventTimeline; + + friend class IkConstraintTimeline; + + friend class PathConstraintMixTimeline; + + friend class PathConstraintPositionTimeline; + + friend class PathConstraintSpacingTimeline; + + friend class ScaleTimeline; + + friend class ShearTimeline; + + friend class TransformConstraintTimeline; + + friend class TranslateTimeline; + + friend class TwoColorTimeline; + +public: + Slot(SlotData &data, Bone &bone); + + void setToSetupPose(); + + SlotData &getData(); + + Bone &getBone(); + + Skeleton &getSkeleton(); + + Color &getColor(); + + Color &getDarkColor(); + + bool hasDarkColor(); + + /// May be NULL. + Attachment *getAttachment(); + + void setAttachment(Attachment *inValue); + + float getAttachmentTime(); + + void setAttachmentTime(float inValue); + + Vector &getAttachmentVertices(); + +private: + SlotData &_data; + Bone &_bone; + Skeleton &_skeleton; + Color _color; + Color _darkColor; + bool _hasDarkColor; + Attachment *_attachment; + float _attachmentTime; + Vector _attachmentVertices; +}; +} + +#endif /* Spine_Slot_h */ diff --git a/cocos/editor-support/spine/SlotData.c b/cocos/editor-support/spine/SlotData.c deleted file mode 100644 index a467c0fcb73..00000000000 --- a/cocos/editor-support/spine/SlotData.c +++ /dev/null @@ -1,56 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData) { - spSlotData* self = NEW(spSlotData); - CONST_CAST(int, self->index) = index; - MALLOC_STR(self->name, name); - CONST_CAST(spBoneData*, self->boneData) = boneData; - spColor_setFromFloats(&self->color, 1, 1, 1, 1); - return self; -} - -void spSlotData_dispose (spSlotData* self) { - FREE(self->name); - FREE(self->attachmentName); - FREE(self->darkColor); - FREE(self); -} - -void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName) { - FREE(self->attachmentName); - if (attachmentName) - MALLOC_STR(self->attachmentName, attachmentName); - else - CONST_CAST(char*, self->attachmentName) = 0; -} diff --git a/cocos/editor-support/spine/SlotData.cpp b/cocos/editor-support/spine/SlotData.cpp new file mode 100644 index 00000000000..f5b7bb51d47 --- /dev/null +++ b/cocos/editor-support/spine/SlotData.cpp @@ -0,0 +1,96 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +SlotData::SlotData(int index, const String &name, BoneData &boneData) : + _index(index), + _name(name), + _boneData(boneData), + _color(1, 1, 1, 1), + _darkColor(0, 0, 0, 0), + _hasDarkColor(false), + _attachmentName(), + _blendMode(BlendMode_Normal) { + assert(_index >= 0); + assert(_name.length() > 0); +} + +int SlotData::getIndex() { + return _index; +} + +const String &SlotData::getName() { + return _name; +} + +BoneData &SlotData::getBoneData() { + return _boneData; +} + +Color &SlotData::getColor() { + return _color; +} + +Color &SlotData::getDarkColor() { + return _darkColor; +} + +bool SlotData::hasDarkColor() { + return _hasDarkColor; +} + +void SlotData::setHasDarkColor(bool inValue) { + _hasDarkColor = inValue; +} + +const String &SlotData::getAttachmentName() { + return _attachmentName; +} + +void SlotData::setAttachmentName(const String &inValue) { + _attachmentName = inValue; +} + +BlendMode SlotData::getBlendMode() { + return _blendMode; +} + +void SlotData::setBlendMode(BlendMode inValue) { + _blendMode = inValue; +} diff --git a/cocos/editor-support/spine/SlotData.h b/cocos/editor-support/spine/SlotData.h index 1e12da61ad3..8d7691a8e83 100644 --- a/cocos/editor-support/spine/SlotData.h +++ b/cocos/editor-support/spine/SlotData.h @@ -1,90 +1,114 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SLOTDATA_H_ -#define SPINE_SLOTDATA_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - SP_BLEND_MODE_NORMAL, SP_BLEND_MODE_ADDITIVE, SP_BLEND_MODE_MULTIPLY, SP_BLEND_MODE_SCREEN -} spBlendMode; - -typedef struct spSlotData { - const int index; - const char* const name; - const spBoneData* const boneData; - const char* attachmentName; - spColor color; - spColor* darkColor; - spBlendMode blendMode; - -#ifdef __cplusplus - spSlotData() : - index(0), - name(0), - boneData(0), - attachmentName(0), - color(), - darkColor(0), - blendMode(SP_BLEND_MODE_NORMAL) { - } -#endif -} spSlotData; - -SP_API spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData); -SP_API void spSlotData_dispose (spSlotData* self); - -/* @param attachmentName May be 0 for no setup pose attachment. */ -SP_API void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName); - -#ifdef SPINE_SHORT_NAMES -typedef spBlendMode BlendMode; -#define BLEND_MODE_NORMAL SP_BLEND_MODE_NORMAL -#define BLEND_MODE_ADDITIVE SP_BLEND_MODE_ADDITIVE -#define BLEND_MODE_MULTIPLY SP_BLEND_MODE_MULTIPLY -#define BLEND_MODE_SCREEN SP_BLEND_MODE_SCREEN -typedef spSlotData SlotData; -#define SlotData_create(...) spSlotData_create(__VA_ARGS__) -#define SlotData_dispose(...) spSlotData_dispose(__VA_ARGS__) -#define SlotData_setAttachmentName(...) spSlotData_setAttachmentName(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_SLOTDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SlotData_h +#define Spine_SlotData_h + +#include +#include +#include +#include + +namespace spine { +class BoneData; + +class SP_API SlotData : public SpineObject { + friend class SkeletonBinary; + + friend class SkeletonJson; + + friend class AttachmentTimeline; + + friend class ColorTimeline; + + friend class DeformTimeline; + + friend class DrawOrderTimeline; + + friend class EventTimeline; + + friend class IkConstraintTimeline; + + friend class PathConstraintMixTimeline; + + friend class PathConstraintPositionTimeline; + + friend class PathConstraintSpacingTimeline; + + friend class ScaleTimeline; + + friend class ShearTimeline; + + friend class TransformConstraintTimeline; + + friend class TranslateTimeline; + + friend class TwoColorTimeline; + +public: + SlotData(int index, const String &name, BoneData &boneData); + + int getIndex(); + + const String &getName(); + + BoneData &getBoneData(); + + Color &getColor(); + + Color &getDarkColor(); + + bool hasDarkColor(); + + void setHasDarkColor(bool inValue); + + /// May be empty. + const String &getAttachmentName(); + + void setAttachmentName(const String &inValue); + + BlendMode getBlendMode(); + + void setBlendMode(BlendMode inValue); + +private: + const int _index; + String _name; + BoneData &_boneData; + Color _color; + Color _darkColor; + + bool _hasDarkColor; + String _attachmentName; + BlendMode _blendMode; +}; +} + +#endif /* Spine_SlotData_h */ diff --git a/cocos/editor-support/spine/SpacingMode.h b/cocos/editor-support/spine/SpacingMode.h new file mode 100644 index 00000000000..0bb5c4ebf2e --- /dev/null +++ b/cocos/editor-support/spine/SpacingMode.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SpacingMode_h +#define Spine_SpacingMode_h + +namespace spine { +enum SpacingMode { + SpacingMode_Length = 0, + SpacingMode_Fixed, + SpacingMode_Percent +}; +} + +#endif /* Spine_SpacingMode_h */ diff --git a/cocos/editor-support/spine/SpineObject.cpp b/cocos/editor-support/spine/SpineObject.cpp new file mode 100644 index 00000000000..55e1616f172 --- /dev/null +++ b/cocos/editor-support/spine/SpineObject.cpp @@ -0,0 +1,67 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include + +using namespace spine; + +void *SpineObject::operator new(size_t sz) { + return SpineExtension::calloc(sz, __FILE__, __LINE__); +} + +void *SpineObject::operator new(size_t sz, const char *file, int line) { + return SpineExtension::calloc(sz, file, line); +} + +void *SpineObject::operator new(size_t sz, void *ptr) { + SP_UNUSED(sz); + return ptr; +} + +void SpineObject::operator delete(void *p, const char *file, int line) { + SpineExtension::free(p, file, line); +} + +void SpineObject::operator delete(void *p, void *mem) { + SP_UNUSED(mem); + SpineExtension::free(p, __FILE__, __LINE__); +} + +void SpineObject::operator delete(void *p) { + SpineExtension::free(p, __FILE__, __LINE__); +} + +SpineObject::~SpineObject() { +} diff --git a/cocos/editor-support/spine/SpineObject.h b/cocos/editor-support/spine/SpineObject.h new file mode 100644 index 00000000000..20ba68ddcd7 --- /dev/null +++ b/cocos/editor-support/spine/SpineObject.h @@ -0,0 +1,60 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Object_h +#define Spine_Object_h + +#include +#include + +#include + +namespace spine { +class String; + +class SP_API SpineObject { +public: + void *operator new(size_t sz); + + void *operator new(size_t sz, const char *file, int line); + + void *operator new(size_t sz, void *ptr); + + void operator delete(void *p, const char *file, int line); + + void operator delete(void *p, void *mem); + + void operator delete(void *p); + + virtual ~SpineObject(); +}; +} + +#endif diff --git a/cocos/editor-support/spine/SpineString.h b/cocos/editor-support/spine/SpineString.h new file mode 100644 index 00000000000..d94f99cffd3 --- /dev/null +++ b/cocos/editor-support/spine/SpineString.h @@ -0,0 +1,213 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef SPINE_STRING_H +#define SPINE_STRING_H + +#include +#include + +#include +#include + +// Required for sprintf on MSVC +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + +namespace spine { +class SP_API String : public SpineObject { +public: + String() : _length(0), _buffer(NULL) { + } + + String(const char *chars, bool own = false) { + if (!chars) { + _length = 0; + _buffer = NULL; + } else { + _length = strlen(chars); + if (!own) { + _buffer = SpineExtension::calloc(_length + 1, __FILE__, __LINE__); + memcpy((void *) _buffer, chars, _length + 1); + } else { + _buffer = (char *) chars; + } + } + } + + String(const String &other) { + if (!other._buffer) { + _length = 0; + _buffer = NULL; + } else { + _length = other._length; + _buffer = SpineExtension::calloc(other._length + 1, __FILE__, __LINE__); + memcpy((void *) _buffer, other._buffer, other._length + 1); + } + } + + size_t length() const { + return _length; + } + + bool isEmpty() const { + return _length == 0; + } + + const char *buffer() const { + return _buffer; + } + + void own(const String &other) { + if (this == &other) return; + if (_buffer) { + SpineExtension::free(_buffer, __FILE__, __LINE__); + } + _length = other._length; + _buffer = other._buffer; + other._length = 0; + other._buffer = NULL; + } + + void own(const char *chars) { + if (_buffer == chars) return; + if (_buffer) { + SpineExtension::free(_buffer, __FILE__, __LINE__); + } + + if (!chars) { + _length = 0; + _buffer = NULL; + } else { + _length = strlen(chars); + _buffer = (char *) chars; + } + } + + void unown() { + _length = 0; + _buffer = NULL; + } + + String &operator=(const String &other) { + if (this == &other) return *this; + if (_buffer) { + SpineExtension::free(_buffer, __FILE__, __LINE__); + } + if (!other._buffer) { + _length = 0; + _buffer = NULL; + } else { + _length = other._length; + _buffer = SpineExtension::calloc(other._length + 1, __FILE__, __LINE__); + memcpy((void *) _buffer, other._buffer, other._length + 1); + } + return *this; + } + + String &operator=(const char *chars) { + if (_buffer == chars) return *this; + if (_buffer) { + SpineExtension::free(_buffer, __FILE__, __LINE__); + } + if (!chars) { + _length = 0; + _buffer = NULL; + } else { + _length = strlen(chars); + _buffer = SpineExtension::calloc(_length + 1, __FILE__, __LINE__); + memcpy((void *) _buffer, chars, _length + 1); + } + return *this; + } + + String &append(const char *chars) { + size_t len = strlen(chars); + size_t thisLen = _length; + _length = _length + len; + bool same = chars == _buffer; + _buffer = SpineExtension::realloc(_buffer, _length + 1, __FILE__, __LINE__); + memcpy((void *) (_buffer + thisLen), (void *) (same ? _buffer : chars), len + 1); + return *this; + } + + String &append(const String &other) { + size_t len = other.length(); + size_t thisLen = _length; + _length = _length + len; + bool same = other._buffer == _buffer; + _buffer = SpineExtension::realloc(_buffer, _length + 1, __FILE__, __LINE__); + memcpy((void *) (_buffer + thisLen), (void *) (same ? _buffer : other._buffer), len + 1); + return *this; + } + + String &append(int other) { + char str[100]; + sprintf(str, "%i", other); + append(str); + return *this; + } + + String &append(float other) { + char str[100]; + sprintf(str, "%f", other); + append(str); + return *this; + } + + friend bool operator==(const String &a, const String &b) { + if (a._buffer == b._buffer) return true; + if (a._length != b._length) return false; + if (a._buffer && b._buffer) { + return strcmp(a._buffer, b._buffer) == 0; + } else { + return false; + } + } + + friend bool operator!=(const String &a, const String &b) { + return !(a == b); + } + + ~String() { + if (_buffer) { + SpineExtension::free(_buffer, __FILE__, __LINE__); + } + } + +private: + mutable size_t _length; + mutable char *_buffer; +}; +} + + +#endif //SPINE_STRING_H diff --git a/cocos/editor-support/spine/TextureLoader.cpp b/cocos/editor-support/spine/TextureLoader.cpp new file mode 100644 index 00000000000..a00d793b313 --- /dev/null +++ b/cocos/editor-support/spine/TextureLoader.cpp @@ -0,0 +1,43 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +namespace spine { +TextureLoader::TextureLoader() { +} + +TextureLoader::~TextureLoader() { +} +} diff --git a/cocos/editor-support/spine/TextureLoader.h b/cocos/editor-support/spine/TextureLoader.h new file mode 100644 index 00000000000..eb1bc639872 --- /dev/null +++ b/cocos/editor-support/spine/TextureLoader.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TextureLoader_h +#define Spine_TextureLoader_h + +#include +#include + +namespace spine { + class AtlasPage; + + class SP_API TextureLoader : public SpineObject { + public: + TextureLoader(); + + virtual ~TextureLoader(); + + virtual void load(AtlasPage& page, const String& path) = 0; + + virtual void unload(void* texture) = 0; + }; +} + +#endif /* Spine_TextureLoader_h */ diff --git a/cocos/editor-support/spine/Timeline.cpp b/cocos/editor-support/spine/Timeline.cpp new file mode 100644 index 00000000000..4b48a6a7f6e --- /dev/null +++ b/cocos/editor-support/spine/Timeline.cpp @@ -0,0 +1,49 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +namespace spine { +RTTI_IMPL_NOPARENT(Timeline) + +Timeline::Timeline() { +} + +Timeline::~Timeline() { +} + +} diff --git a/cocos/editor-support/spine/Timeline.h b/cocos/editor-support/spine/Timeline.h new file mode 100644 index 00000000000..91621fde16e --- /dev/null +++ b/cocos/editor-support/spine/Timeline.h @@ -0,0 +1,72 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Timeline_h +#define Spine_Timeline_h + +#include +#include +#include +#include +#include + +namespace spine { +class Skeleton; + +class Event; + +class SP_API Timeline : public SpineObject { +RTTI_DECL + +public: + Timeline(); + + virtual ~Timeline(); + + /// Sets the value(s) for the specified time. + /// @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// @param lastTime lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// @param time The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// @param pEvents If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// @param alpha alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline + /// value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting + /// alpha over time, an animation can be mixed in or out. alpha can also be useful to + /// apply animations on top of each other (layered). + /// @param blend Controls how mixing is applied when alpha is than 1. + /// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + virtual void + apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, MixBlend blend, + MixDirection direction) = 0; + + virtual int getPropertyId() = 0; +}; +} + +#endif /* Spine_Timeline_h */ diff --git a/cocos/editor-support/spine/BoneData.c b/cocos/editor-support/spine/TimelineType.h similarity index 77% rename from cocos/editor-support/spine/BoneData.c rename to cocos/editor-support/spine/TimelineType.h index 5933571ed6b..0f227cecfc4 100644 --- a/cocos/editor-support/spine/BoneData.c +++ b/cocos/editor-support/spine/TimelineType.h @@ -1,48 +1,54 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent) { - spBoneData* self = NEW(spBoneData); - CONST_CAST(int, self->index) = index; - MALLOC_STR(self->name, name); - CONST_CAST(spBoneData*, self->parent) = parent; - self->scaleX = 1; - self->scaleY = 1; - self->transformMode = SP_TRANSFORMMODE_NORMAL; - return self; -} - -void spBoneData_dispose (spBoneData* self) { - FREE(self->name); - FREE(self); -} +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TimelineType_h +#define Spine_TimelineType_h + +namespace spine { +enum TimelineType { + TimelineType_Rotate = 0, + TimelineType_Translate, + TimelineType_Scale, + TimelineType_Shear, + TimelineType_Attachment, + TimelineType_Color, + TimelineType_Deform, + TimelineType_Event, + TimelineType_DrawOrder, + TimelineType_IkConstraint, + TimelineType_TransformConstraint, + TimelineType_PathConstraintPosition, + TimelineType_PathConstraintSpacing, + TimelineType_PathConstraintMix, + TimelineType_TwoColor +}; +} + +#endif /* Spine_TimelineType_h */ diff --git a/cocos/editor-support/spine/TransformConstraint.c b/cocos/editor-support/spine/TransformConstraint.c deleted file mode 100644 index 188d53e2f7c..00000000000 --- a/cocos/editor-support/spine/TransformConstraint.c +++ /dev/null @@ -1,273 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const spSkeleton* skeleton) { - int i; - spTransformConstraint* self = NEW(spTransformConstraint); - CONST_CAST(spTransformConstraintData*, self->data) = data; - self->rotateMix = data->rotateMix; - self->translateMix = data->translateMix; - self->scaleMix = data->scaleMix; - self->shearMix = data->shearMix; - self->bonesCount = data->bonesCount; - CONST_CAST(spBone**, self->bones) = MALLOC(spBone*, self->bonesCount); - for (i = 0; i < self->bonesCount; ++i) - self->bones[i] = spSkeleton_findBone(skeleton, self->data->bones[i]->name); - self->target = spSkeleton_findBone(skeleton, self->data->target->name); - return self; -} - -void spTransformConstraint_dispose (spTransformConstraint* self) { - FREE(self->bones); - FREE(self); -} - -void _spTransformConstraint_applyAbsoluteWorld (spTransformConstraint* self) { - float rotateMix = self->rotateMix, translateMix = self->translateMix, scaleMix = self->scaleMix, shearMix = self->shearMix; - spBone* target = self->target; - float ta = target->a, tb = target->b, tc = target->c, td = target->d; - float degRadReflect = ta * td - tb * tc > 0 ? DEG_RAD : -DEG_RAD; - float offsetRotation = self->data->offsetRotation * degRadReflect, offsetShearY = self->data->offsetShearY * degRadReflect; - int /*bool*/ modified; - int i; - float a, b, c, d, r, cosine, sine, x, y, s, ts, by; - for (i = 0; i < self->bonesCount; ++i) { - spBone* bone = self->bones[i]; - modified = 0; - - if (rotateMix != 0) { - a = bone->a, b = bone->b, c = bone->c, d = bone->d; - r = ATAN2(tc, ta) - ATAN2(c, a) + offsetRotation; - if (r > PI) r -= PI2; - else if (r < -PI) r += PI2; - r *= rotateMix; - cosine = COS(r); - sine = SIN(r); - CONST_CAST(float, bone->a) = cosine * a - sine * c; - CONST_CAST(float, bone->b) = cosine * b - sine * d; - CONST_CAST(float, bone->c) = sine * a + cosine * c; - CONST_CAST(float, bone->d) = sine * b + cosine * d; - modified = 1; - } - - if (translateMix != 0) { - spBone_localToWorld(target, self->data->offsetX, self->data->offsetY, &x, &y); - CONST_CAST(float, bone->worldX) += (x - bone->worldX) * translateMix; - CONST_CAST(float, bone->worldY) += (y - bone->worldY) * translateMix; - modified = 1; - } - - if (scaleMix > 0) { - s = SQRT(bone->a * bone->a + bone->c * bone->c); - ts = SQRT(ta * ta + tc * tc); - if (s > 0.00001f) s = (s + (ts - s + self->data->offsetScaleX) * scaleMix) / s; - CONST_CAST(float, bone->a) *= s; - CONST_CAST(float, bone->c) *= s; - s = SQRT(bone->b * bone->b + bone->d * bone->d); - ts = SQRT(tb * tb + td * td); - if (s > 0.00001f) s = (s + (ts - s + self->data->offsetScaleY) * scaleMix) / s; - CONST_CAST(float, bone->b) *= s; - CONST_CAST(float, bone->d) *= s; - modified = 1; - } - - if (shearMix > 0) { - b = bone->b, d = bone->d; - by = ATAN2(d, b); - r = ATAN2(td, tb) - ATAN2(tc, ta) - (by - ATAN2(bone->c, bone->a)); - s = SQRT(b * b + d * d); - if (r > PI) r -= PI2; - else if (r < -PI) r += PI2; - r = by + (r + offsetShearY) * shearMix; - CONST_CAST(float, bone->b) = COS(r) * s; - CONST_CAST(float, bone->d) = SIN(r) * s; - modified = 1; - } - - if (modified) CONST_CAST(int, bone->appliedValid) = 0; - } -} - -void _spTransformConstraint_applyRelativeWorld (spTransformConstraint* self) { - float rotateMix = self->rotateMix, translateMix = self->translateMix, scaleMix = self->scaleMix, shearMix = self->shearMix; - spBone* target = self->target; - float ta = target->a, tb = target->b, tc = target->c, td = target->d; - float degRadReflect = ta * td - tb * tc > 0 ? DEG_RAD : -DEG_RAD; - float offsetRotation = self->data->offsetRotation * degRadReflect, offsetShearY = self->data->offsetShearY * degRadReflect; - int /*bool*/ modified; - int i; - float a, b, c, d, r, cosine, sine, x, y, s; - for (i = 0; i < self->bonesCount; ++i) { - spBone* bone = self->bones[i]; - modified = 0; - - if (rotateMix != 0) { - a = bone->a, b = bone->b, c = bone->c, d = bone->d; - r = ATAN2(tc, ta) + offsetRotation; - if (r > PI) r -= PI2; - else if (r < -PI) r += PI2; - r *= rotateMix; - cosine = COS(r); - sine = SIN(r); - CONST_CAST(float, bone->a) = cosine * a - sine * c; - CONST_CAST(float, bone->b) = cosine * b - sine * d; - CONST_CAST(float, bone->c) = sine * a + cosine * c; - CONST_CAST(float, bone->d) = sine * b + cosine * d; - modified = 1; - } - - if (translateMix != 0) { - spBone_localToWorld(target, self->data->offsetX, self->data->offsetY, &x, &y); - CONST_CAST(float, bone->worldX) += (x * translateMix); - CONST_CAST(float, bone->worldY) += (y * translateMix); - modified = 1; - } - - if (scaleMix > 0) { - s = (SQRT(ta * ta + tc * tc) - 1 + self->data->offsetScaleX) * scaleMix + 1; - CONST_CAST(float, bone->a) *= s; - CONST_CAST(float, bone->c) *= s; - s = (SQRT(tb * tb + td * td) - 1 + self->data->offsetScaleY) * scaleMix + 1; - CONST_CAST(float, bone->b) *= s; - CONST_CAST(float, bone->d) *= s; - modified = 1; - } - - if (shearMix > 0) { - r = ATAN2(td, tb) - ATAN2(tc, ta); - if (r > PI) r -= PI2; - else if (r < -PI) r += PI2; - b = bone->b, d = bone->d; - r = ATAN2(d, b) + (r - PI / 2 + offsetShearY) * shearMix; - s = SQRT(b * b + d * d); - CONST_CAST(float, bone->b) = COS(r) * s; - CONST_CAST(float, bone->d) = SIN(r) * s; - modified = 1; - } - - if (modified) CONST_CAST(int, bone->appliedValid) = 0; - } -} - -void _spTransformConstraint_applyAbsoluteLocal (spTransformConstraint* self) { - float rotateMix = self->rotateMix, translateMix = self->translateMix, scaleMix = self->scaleMix, shearMix = self->shearMix; - spBone* target = self->target; - int i; - float rotation, r, x, y, scaleX, scaleY, shearY; - - if (!target->appliedValid) spBone_updateAppliedTransform(target); - for (i = 0; i < self->bonesCount; ++i) { - spBone* bone = self->bones[i]; - if (!bone->appliedValid) spBone_updateAppliedTransform(bone); - - rotation = bone->arotation; - if (rotateMix != 0) { - r = target->arotation - rotation + self->data->offsetRotation; - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; - rotation += r * rotateMix; - } - - x = bone->ax, y = bone->ay; - if (translateMix != 0) { - x += (target->ax - x + self->data->offsetX) * translateMix; - y += (target->ay - y + self->data->offsetY) * translateMix; - } - - scaleX = bone->ascaleX, scaleY = bone->ascaleY; - if (scaleMix > 0) { - if (scaleX > 0.00001) scaleX = (scaleX + (target->ascaleX - scaleX + self->data->offsetScaleX) * scaleMix) / scaleX; - if (scaleY > 0.00001) scaleY = (scaleY + (target->ascaleY - scaleY + self->data->offsetScaleY) * scaleMix) / scaleY; - } - - shearY = bone->ashearY; - if (shearMix > 0) { - r = target->ashearY - shearY + self->data->offsetShearY; - r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; - bone->shearY += r * shearMix; - } - - spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY); - } -} - -void _spTransformConstraint_applyRelativeLocal (spTransformConstraint* self) { - float rotateMix = self->rotateMix, translateMix = self->translateMix, scaleMix = self->scaleMix, shearMix = self->shearMix; - spBone* target = self->target; - int i; - float rotation, x, y, scaleX, scaleY, shearY; - - if (!target->appliedValid) spBone_updateAppliedTransform(target); - - for (i = 0; i < self->bonesCount; ++i) { - spBone* bone = self->bones[i]; - if (!bone->appliedValid) spBone_updateAppliedTransform(bone); - - rotation = bone->arotation; - if (rotateMix != 0) rotation += (target->arotation + self->data->offsetRotation) * rotateMix; - - x = bone->ax; - y = bone->ay; - if (translateMix != 0) { - x += (target->ax + self->data->offsetX) * translateMix; - y += (target->ay + self->data->offsetY) * translateMix; - } - - scaleX = bone->ascaleX; - scaleY = bone->ascaleY; - if (scaleMix > 0) { - if (scaleX > 0.00001f) scaleX *= ((target->ascaleX - 1 + self->data->offsetScaleX) * scaleMix) + 1; - if (scaleY > 0.00001f) scaleY *= ((target->ascaleY - 1 + self->data->offsetScaleY) * scaleMix) + 1; - } - - shearY = bone->ashearY; - if (shearMix > 0) shearY += (target->ashearY + self->data->offsetShearY) * shearMix; - - spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY); - } -} - -void spTransformConstraint_apply (spTransformConstraint* self) { - if (self->data->local) { - if (self->data->relative) - _spTransformConstraint_applyRelativeLocal(self); - else - _spTransformConstraint_applyAbsoluteLocal(self); - - } else { - if (self->data->relative) - _spTransformConstraint_applyRelativeWorld(self); - else - _spTransformConstraint_applyAbsoluteWorld(self); - } -} diff --git a/cocos/editor-support/spine/TransformConstraint.cpp b/cocos/editor-support/spine/TransformConstraint.cpp new file mode 100644 index 00000000000..0cc82bfc67f --- /dev/null +++ b/cocos/editor-support/spine/TransformConstraint.cpp @@ -0,0 +1,383 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include +#include + +#include + +using namespace spine; + +RTTI_IMPL(TransformConstraint, Constraint) + +TransformConstraint::TransformConstraint(TransformConstraintData &data, Skeleton &skeleton) : Constraint(), + _data(data), + _target(skeleton.findBone( + data.getTarget()->getName())), + _rotateMix( + data.getRotateMix()), + _translateMix( + data.getTranslateMix()), + _scaleMix( + data.getScaleMix()), + _shearMix( + data.getShearMix()) { + _bones.ensureCapacity(_data.getBones().size()); + for (size_t i = 0; i < _data.getBones().size(); ++i) { + BoneData *boneData = _data.getBones()[i]; + + _bones.add(skeleton.findBone(boneData->getName())); + } +} + +void TransformConstraint::apply() { + update(); +} + +void TransformConstraint::update() { + if (_data.isLocal()) { + if (_data.isRelative()) { + applyRelativeLocal(); + } else { + applyAbsoluteLocal(); + } + } else { + if (_data.isRelative()) { + applyRelativeWorld(); + } else { + applyAbsoluteWorld(); + } + } +} + +int TransformConstraint::getOrder() { + return _data.getOrder(); +} + +TransformConstraintData &TransformConstraint::getData() { + return _data; +} + +Vector &TransformConstraint::getBones() { + return _bones; +} + +Bone *TransformConstraint::getTarget() { + return _target; +} + +void TransformConstraint::setTarget(Bone *inValue) { + _target = inValue; +} + +float TransformConstraint::getRotateMix() { + return _rotateMix; +} + +void TransformConstraint::setRotateMix(float inValue) { + _rotateMix = inValue; +} + +float TransformConstraint::getTranslateMix() { + return _translateMix; +} + +void TransformConstraint::setTranslateMix(float inValue) { + _translateMix = inValue; +} + +float TransformConstraint::getScaleMix() { + return _scaleMix; +} + +void TransformConstraint::setScaleMix(float inValue) { + _scaleMix = inValue; +} + +float TransformConstraint::getShearMix() { + return _shearMix; +} + +void TransformConstraint::setShearMix(float inValue) { + _shearMix = inValue; +} + +void TransformConstraint::applyAbsoluteWorld() { + float rotateMix = _rotateMix, translateMix = _translateMix, scaleMix = _scaleMix, shearMix = _shearMix; + Bone &target = *_target; + float ta = target._a, tb = target._b, tc = target._c, td = target._d; + float degRadReflect = ta * td - tb * tc > 0 ? MathUtil::Deg_Rad : -MathUtil::Deg_Rad; + float offsetRotation = _data._offsetRotation * degRadReflect, offsetShearY = _data._offsetShearY * degRadReflect; + + for (size_t i = 0; i < _bones.size(); ++i) { + Bone *item = _bones[i]; + Bone &bone = *item; + + bool modified = false; + + if (rotateMix != 0) { + float a = bone._a, b = bone._b, c = bone._c, d = bone._d; + float r = MathUtil::atan2(tc, ta) - MathUtil::atan2(c, a) + offsetRotation; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; + } + + r *= rotateMix; + float cos = MathUtil::cos(r), sin = MathUtil::sin(r); + bone._a = cos * a - sin * c; + bone._b = cos * b - sin * d; + bone._c = sin * a + cos * c; + bone._d = sin * b + cos * d; + modified = true; + } + + if (translateMix != 0) { + float tx, ty; + target.localToWorld(_data._offsetX, _data._offsetY, tx, ty); + bone._worldX += (tx - bone._worldX) * translateMix; + bone._worldY += (ty - bone._worldY) * translateMix; + modified = true; + } + + if (scaleMix > 0) { + float s = MathUtil::sqrt(bone._a * bone._a + bone._c * bone._c); + + if (s > 0.00001f) { + s = (s + (MathUtil::sqrt(ta * ta + tc * tc) - s + _data._offsetScaleX) * scaleMix) / s; + } + bone._a *= s; + bone._c *= s; + s = MathUtil::sqrt(bone._b * bone._b + bone._d * bone._d); + + if (s > 0.00001f) { + s = (s + (MathUtil::sqrt(tb * tb + td * td) - s + _data._offsetScaleY) * scaleMix) / s; + } + bone._b *= s; + bone._d *= s; + modified = true; + } + + if (shearMix > 0) { + float b = bone._b, d = bone._d; + float by = MathUtil::atan2(d, b); + float r = MathUtil::atan2(td, tb) - MathUtil::atan2(tc, ta) - (by - MathUtil::atan2(bone._c, bone._a)); + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; + } + + r = by + (r + offsetShearY) * shearMix; + float s = MathUtil::sqrt(b * b + d * d); + bone._b = MathUtil::cos(r) * s; + bone._d = MathUtil::sin(r) * s; + modified = true; + } + + if (modified) { + bone._appliedValid = false; + } + } +} + +void TransformConstraint::applyRelativeWorld() { + float rotateMix = _rotateMix, translateMix = _translateMix, scaleMix = _scaleMix, shearMix = _shearMix; + Bone &target = *_target; + float ta = target._a, tb = target._b, tc = target._c, td = target._d; + float degRadReflect = ta * td - tb * tc > 0 ? MathUtil::Deg_Rad : -MathUtil::Deg_Rad; + float offsetRotation = _data._offsetRotation * degRadReflect, offsetShearY = _data._offsetShearY * degRadReflect; + for (size_t i = 0; i < _bones.size(); ++i) { + Bone *item = _bones[i]; + Bone &bone = *item; + + bool modified = false; + + if (rotateMix != 0) { + float a = bone._a, b = bone._b, c = bone._c, d = bone._d; + float r = MathUtil::atan2(tc, ta) + offsetRotation; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; + } + + r *= rotateMix; + float cos = MathUtil::cos(r), sin = MathUtil::sin(r); + bone._a = cos * a - sin * c; + bone._b = cos * b - sin * d; + bone._c = sin * a + cos * c; + bone._d = sin * b + cos * d; + modified = true; + } + + if (translateMix != 0) { + float tx, ty; + target.localToWorld(_data._offsetX, _data._offsetY, tx, ty); + bone._worldX += tx * translateMix; + bone._worldY += ty * translateMix; + modified = true; + } + + if (scaleMix > 0) { + float s = (MathUtil::sqrt(ta * ta + tc * tc) - 1 + _data._offsetScaleX) * scaleMix + 1; + bone._a *= s; + bone._c *= s; + s = (MathUtil::sqrt(tb * tb + td * td) - 1 + _data._offsetScaleY) * scaleMix + 1; + bone._b *= s; + bone._d *= s; + modified = true; + } + + if (shearMix > 0) { + float r = MathUtil::atan2(td, tb) - MathUtil::atan2(tc, ta); + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; + } + + float b = bone._b, d = bone._d; + r = MathUtil::atan2(d, b) + (r - MathUtil::Pi / 2 + offsetShearY) * shearMix; + float s = MathUtil::sqrt(b * b + d * d); + bone._b = MathUtil::cos(r) * s; + bone._d = MathUtil::sin(r) * s; + modified = true; + } + + if (modified) { + bone._appliedValid = false; + } + } +} + +void TransformConstraint::applyAbsoluteLocal() { + float rotateMix = _rotateMix, translateMix = _translateMix, scaleMix = _scaleMix, shearMix = _shearMix; + Bone &target = *_target; + if (!target._appliedValid) { + target.updateAppliedTransform(); + } + + for (size_t i = 0; i < _bones.size(); ++i) { + Bone *item = _bones[i]; + Bone &bone = *item; + + if (!bone._appliedValid) { + bone.updateAppliedTransform(); + } + + float rotation = bone._arotation; + if (rotateMix != 0) { + float r = target._arotation - rotation + _data._offsetRotation; + r -= (16384 - (int) (16384.499999999996 - r / 360)) * 360; + rotation += r * rotateMix; + } + + float x = bone._ax, y = bone._ay; + if (translateMix != 0) { + x += (target._ax - x + _data._offsetX) * translateMix; + y += (target._ay - y + _data._offsetY) * translateMix; + } + + float scaleX = bone._ascaleX, scaleY = bone._ascaleY; + if (scaleMix != 0) { + if (scaleX > 0.00001f) { + scaleX = (scaleX + (target._ascaleX - scaleX + _data._offsetScaleX) * scaleMix) / scaleX; + } + + if (scaleY > 0.00001f) { + scaleY = (scaleY + (target._ascaleY - scaleY + _data._offsetScaleY) * scaleMix) / scaleY; + } + } + + float shearY = bone._ashearY; + if (shearMix != 0) { + float r = target._ashearY - shearY + _data._offsetShearY; + r -= (16384 - (int) (16384.499999999996 - r / 360)) * 360; + bone._shearY += r * shearMix; + } + + bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY); + } +} + +void TransformConstraint::applyRelativeLocal() { + float rotateMix = _rotateMix, translateMix = _translateMix, scaleMix = _scaleMix, shearMix = _shearMix; + Bone &target = *_target; + if (!target._appliedValid) { + target.updateAppliedTransform(); + } + + for (size_t i = 0; i < _bones.size(); ++i) { + Bone *item = _bones[i]; + Bone &bone = *item; + + if (!bone._appliedValid) { + bone.updateAppliedTransform(); + } + + float rotation = bone._arotation; + if (rotateMix != 0) { + rotation += (target._arotation + _data._offsetRotation) * rotateMix; + } + + float x = bone._ax, y = bone._ay; + if (translateMix != 0) { + x += (target._ax + _data._offsetX) * translateMix; + y += (target._ay + _data._offsetY) * translateMix; + } + + float scaleX = bone._ascaleX, scaleY = bone._ascaleY; + if (scaleMix != 0) { + if (scaleX > 0.00001f) { + scaleX *= ((target._ascaleX - 1 + _data._offsetScaleX) * scaleMix) + 1; + } + + if (scaleY > 0.00001f) { + scaleY *= ((target._ascaleY - 1 + _data._offsetScaleY) * scaleMix) + 1; + } + } + + float shearY = bone._ashearY; + if (shearMix != 0) { + shearY += (target._ashearY + _data._offsetShearY) * shearMix; + } + + bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY); + } +} diff --git a/cocos/editor-support/spine/TransformConstraint.h b/cocos/editor-support/spine/TransformConstraint.h index 07721cf144a..3204fbaf8cb 100644 --- a/cocos/editor-support/spine/TransformConstraint.h +++ b/cocos/editor-support/spine/TransformConstraint.h @@ -1,81 +1,93 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_TRANSFORMCONSTRAINT_H_ -#define SPINE_TRANSFORMCONSTRAINT_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct spSkeleton; - -typedef struct spTransformConstraint { - spTransformConstraintData* const data; - int bonesCount; - spBone** const bones; - spBone* target; - float rotateMix, translateMix, scaleMix, shearMix; - -#ifdef __cplusplus - spTransformConstraint() : - data(0), - bonesCount(0), - bones(0), - target(0), - rotateMix(0), - translateMix(0), - scaleMix(0), - shearMix(0) { - } -#endif -} spTransformConstraint; - -SP_API spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const struct spSkeleton* skeleton); -SP_API void spTransformConstraint_dispose (spTransformConstraint* self); - -SP_API void spTransformConstraint_apply (spTransformConstraint* self); - -#ifdef SPINE_SHORT_NAMES -typedef spTransformConstraint TransformConstraint; -#define TransformConstraint_create(...) spTransformConstraint_create(__VA_ARGS__) -#define TransformConstraint_dispose(...) spTransformConstraint_dispose(__VA_ARGS__) -#define TransformConstraint_apply(...) spTransformConstraint_apply(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_TRANSFORMCONSTRAINT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TransformConstraint_h +#define Spine_TransformConstraint_h + +#include + +#include + +namespace spine { + class TransformConstraintData; + class Skeleton; + class Bone; + + class SP_API TransformConstraint : public Constraint { + friend class Skeleton; + friend class TransformConstraintTimeline; + + RTTI_DECL + + public: + TransformConstraint(TransformConstraintData& data, Skeleton& skeleton); + + void apply(); + + virtual void update(); + + virtual int getOrder(); + + TransformConstraintData& getData(); + + Vector& getBones(); + + Bone* getTarget(); + void setTarget(Bone* inValue); + + float getRotateMix(); + void setRotateMix(float inValue); + + float getTranslateMix(); + void setTranslateMix(float inValue); + + float getScaleMix(); + void setScaleMix(float inValue); + + float getShearMix(); + void setShearMix(float inValue); + + private: + TransformConstraintData& _data; + Vector _bones; + Bone* _target; + float _rotateMix, _translateMix, _scaleMix, _shearMix; + + void applyAbsoluteWorld(); + + void applyRelativeWorld(); + + void applyAbsoluteLocal(); + + void applyRelativeLocal(); + }; +} + +#endif /* Spine_TransformConstraint_h */ diff --git a/cocos/editor-support/spine/TransformConstraintData.c b/cocos/editor-support/spine/TransformConstraintData.c deleted file mode 100644 index 34064e0f85e..00000000000 --- a/cocos/editor-support/spine/TransformConstraintData.c +++ /dev/null @@ -1,44 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -spTransformConstraintData* spTransformConstraintData_create (const char* name) { - spTransformConstraintData* self = NEW(spTransformConstraintData); - MALLOC_STR(self->name, name); - return self; -} - -void spTransformConstraintData_dispose (spTransformConstraintData* self) { - FREE(self->name); - FREE(self->bones); - FREE(self); -} diff --git a/cocos/editor-support/spine/TransformConstraintData.cpp b/cocos/editor-support/spine/TransformConstraintData.cpp new file mode 100644 index 00000000000..ccb3e421115 --- /dev/null +++ b/cocos/editor-support/spine/TransformConstraintData.cpp @@ -0,0 +1,123 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +#include + +using namespace spine; +TransformConstraintData::TransformConstraintData(const String &name) : + _name(name), + _order(0), + _target(NULL), + _rotateMix(0), + _translateMix(0), + _scaleMix(0), + _shearMix(0), + _offsetRotation(0), + _offsetX(0), + _offsetY(0), + _offsetScaleX(0), + _offsetScaleY(0), + _offsetShearY(0), + _relative(false), + _local(false) { + assert(_name.length() > 0); +} + +const String &TransformConstraintData::getName() { + return _name; +} + +int TransformConstraintData::getOrder() { + return _order; +} + +Vector &TransformConstraintData::getBones() { + return _bones; +} + +BoneData *TransformConstraintData::getTarget() { + return _target; +} + +float TransformConstraintData::getRotateMix() { + return _rotateMix; +} + +float TransformConstraintData::getTranslateMix() { + return _translateMix; +} + +float TransformConstraintData::getScaleMix() { + return _scaleMix; +} + +float TransformConstraintData::getShearMix() { + return _shearMix; +} + +float TransformConstraintData::getOffsetRotation() { + return _offsetRotation; +} + +float TransformConstraintData::getOffsetX() { + return _offsetX; +} + +float TransformConstraintData::getOffsetY() { + return _offsetY; +} + +float TransformConstraintData::getOffsetScaleX() { + return _offsetScaleX; +} + +float TransformConstraintData::getOffsetScaleY() { + return _offsetScaleY; +} + +float TransformConstraintData::getOffsetShearY() { + return _offsetShearY; +} + +bool TransformConstraintData::isRelative() { + return _relative; +} + +bool TransformConstraintData::isLocal() { + return _local; +} diff --git a/cocos/editor-support/spine/TransformConstraintData.h b/cocos/editor-support/spine/TransformConstraintData.h index 8e6c33ff7df..37cc3aa6366 100644 --- a/cocos/editor-support/spine/TransformConstraintData.h +++ b/cocos/editor-support/spine/TransformConstraintData.h @@ -1,87 +1,82 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_TRANSFORMCONSTRAINTDATA_H_ -#define SPINE_TRANSFORMCONSTRAINTDATA_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spTransformConstraintData { - const char* const name; - int order; - int bonesCount; - spBoneData** const bones; - spBoneData* target; - float rotateMix, translateMix, scaleMix, shearMix; - float offsetRotation, offsetX, offsetY, offsetScaleX, offsetScaleY, offsetShearY; - int /*boolean*/ relative; - int /*boolean*/ local; - -#ifdef __cplusplus - spTransformConstraintData() : - name(0), - bonesCount(0), - bones(0), - target(0), - rotateMix(0), - translateMix(0), - scaleMix(0), - shearMix(0), - offsetRotation(0), - offsetX(0), - offsetY(0), - offsetScaleX(0), - offsetScaleY(0), - offsetShearY(0), - relative(0), - local(0) { - } -#endif -} spTransformConstraintData; - -SP_API spTransformConstraintData* spTransformConstraintData_create (const char* name); -SP_API void spTransformConstraintData_dispose (spTransformConstraintData* self); - -#ifdef SPINE_SHORT_NAMES -typedef spTransformConstraintData TransformConstraintData; -#define TransformConstraintData_create(...) spTransformConstraintData_create(__VA_ARGS__) -#define TransformConstraintData_dispose(...) spTransformConstraintData_dispose(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_TRANSFORMCONSTRAINTDATA_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TransformConstraintData_h +#define Spine_TransformConstraintData_h + +#include +#include +#include + +namespace spine { + class BoneData; + + class SP_API TransformConstraintData : public SpineObject { + friend class SkeletonBinary; + friend class SkeletonJson; + + friend class TransformConstraint; + friend class Skeleton; + friend class TransformConstraintTimeline; + + public: + explicit TransformConstraintData(const String& name); + + const String& getName(); + int getOrder(); + Vector& getBones(); + BoneData* getTarget(); + float getRotateMix(); + float getTranslateMix(); + float getScaleMix(); + float getShearMix(); + + float getOffsetRotation(); + float getOffsetX(); + float getOffsetY(); + float getOffsetScaleX(); + float getOffsetScaleY(); + float getOffsetShearY(); + + bool isRelative(); + bool isLocal(); + + private: + const String _name; + int _order; + Vector _bones; + BoneData* _target; + float _rotateMix, _translateMix, _scaleMix, _shearMix; + float _offsetRotation, _offsetX, _offsetY, _offsetScaleX, _offsetScaleY, _offsetShearY; + bool _relative, _local; + }; +} + +#endif /* Spine_TransformConstraintData_h */ diff --git a/cocos/editor-support/spine/TransformConstraintTimeline.cpp b/cocos/editor-support/spine/TransformConstraintTimeline.cpp new file mode 100644 index 00000000000..c273b372225 --- /dev/null +++ b/cocos/editor-support/spine/TransformConstraintTimeline.cpp @@ -0,0 +1,147 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(TransformConstraintTimeline, CurveTimeline) + +const int TransformConstraintTimeline::ENTRIES = 5; +const int TransformConstraintTimeline::PREV_TIME = -5; +const int TransformConstraintTimeline::PREV_ROTATE = -4; +const int TransformConstraintTimeline::PREV_TRANSLATE = -3; +const int TransformConstraintTimeline::PREV_SCALE = -2; +const int TransformConstraintTimeline::PREV_SHEAR = -1; +const int TransformConstraintTimeline::ROTATE = 1; +const int TransformConstraintTimeline::TRANSLATE = 2; +const int TransformConstraintTimeline::SCALE = 3; +const int TransformConstraintTimeline::SHEAR = 4; + +TransformConstraintTimeline::TransformConstraintTimeline(int frameCount) : CurveTimeline(frameCount), + _transformConstraintIndex(0) { + _frames.setSize(frameCount * ENTRIES, 0); +} + +void TransformConstraintTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, + float alpha, MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + TransformConstraint *constraintP = skeleton._transformConstraints[_transformConstraintIndex]; + TransformConstraint &constraint = *constraintP; + + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + constraint._rotateMix = constraint._data._rotateMix; + constraint._translateMix = constraint._data._translateMix; + constraint._scaleMix = constraint._data._scaleMix; + constraint._shearMix = constraint._data._shearMix; + return; + case MixBlend_First: + constraint._rotateMix += (constraint._data._rotateMix - constraint._rotateMix) * alpha; + constraint._translateMix += (constraint._data._translateMix - constraint._translateMix) * alpha; + constraint._scaleMix += (constraint._data._scaleMix - constraint._scaleMix) * alpha; + constraint._shearMix += (constraint._data._shearMix - constraint._shearMix) * alpha; + return; + default: + return; + } + } + + float rotate, translate, scale, shear; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + size_t i = _frames.size(); + rotate = _frames[i + PREV_ROTATE]; + translate = _frames[i + PREV_TRANSLATE]; + scale = _frames[i + PREV_SCALE]; + shear = _frames[i + PREV_SHEAR]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + rotate = _frames[frame + PREV_ROTATE]; + translate = _frames[frame + PREV_TRANSLATE]; + scale = _frames[frame + PREV_SCALE]; + shear = _frames[frame + PREV_SHEAR]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + rotate += (_frames[frame + ROTATE] - rotate) * percent; + translate += (_frames[frame + TRANSLATE] - translate) * percent; + scale += (_frames[frame + SCALE] - scale) * percent; + shear += (_frames[frame + SHEAR] - shear) * percent; + } + + if (blend == MixBlend_Setup) { + TransformConstraintData &data = constraint._data; + constraint._rotateMix = data._rotateMix + (rotate - data._rotateMix) * alpha; + constraint._translateMix = data._translateMix + (translate - data._translateMix) * alpha; + constraint._scaleMix = data._scaleMix + (scale - data._scaleMix) * alpha; + constraint._shearMix = data._shearMix + (shear - data._shearMix) * alpha; + } else { + constraint._rotateMix += (rotate - constraint._rotateMix) * alpha; + constraint._translateMix += (translate - constraint._translateMix) * alpha; + constraint._scaleMix += (scale - constraint._scaleMix) * alpha; + constraint._shearMix += (shear - constraint._shearMix) * alpha; + } +} + +int TransformConstraintTimeline::getPropertyId() { + return ((int) TimelineType_TransformConstraint << 24) + _transformConstraintIndex; +} + +void +TransformConstraintTimeline::setFrame(size_t frameIndex, float time, float rotateMix, float translateMix, float scaleMix, + float shearMix) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + ROTATE] = rotateMix; + _frames[frameIndex + TRANSLATE] = translateMix; + _frames[frameIndex + SCALE] = scaleMix; + _frames[frameIndex + SHEAR] = shearMix; +} diff --git a/cocos/editor-support/spine/Color.c b/cocos/editor-support/spine/TransformConstraintTimeline.h similarity index 60% rename from cocos/editor-support/spine/Color.c rename to cocos/editor-support/spine/TransformConstraintTimeline.h index 48ec062c25e..8d30700250a 100644 --- a/cocos/editor-support/spine/Color.c +++ b/cocos/editor-support/spine/TransformConstraintTimeline.h @@ -28,58 +28,44 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#ifndef Spine_TransformConstraintTimeline_h +#define Spine_TransformConstraintTimeline_h -spColor* spColor_create() { - return MALLOC(spColor, 1); -} - -void spColor_dispose(spColor* self) { - if (self) FREE(self); -} +#include -void spColor_setFromFloats(spColor* self, float r, float g, float b, float a) { - self->r = r; - self->g = g; - self->b = b; - self->a = a; - spColor_clamp(self); -} +namespace spine { -void spColor_setFromColor(spColor* self, spColor* otherColor) { - self->r = otherColor->r; - self->g = otherColor->g; - self->b = otherColor->b; - self->a = otherColor->a; -} + class SP_API TransformConstraintTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + static const int ENTRIES; -void spColor_addColor(spColor* self, spColor* otherColor) { - self->r += otherColor->r; - self->g += otherColor->g; - self->b += otherColor->b; - self->a += otherColor->a; - spColor_clamp(self); + explicit TransformConstraintTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + void setFrame(size_t frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix); + + private: + static const int PREV_TIME; + static const int PREV_ROTATE; + static const int PREV_TRANSLATE; + static const int PREV_SCALE; + static const int PREV_SHEAR; + static const int ROTATE; + static const int TRANSLATE; + static const int SCALE; + static const int SHEAR; + + Vector _frames; + int _transformConstraintIndex; + }; } -void spColor_addFloats(spColor* self, float r, float g, float b, float a) { - self->r += r; - self->g += g; - self->b += b; - self->a += a; - spColor_clamp(self); -} - -void spColor_clamp(spColor* self) { - if (self->r < 0) self->r = 0; - else if (self->r > 1) self->r = 1; - - if (self->g < 0) self->g = 0; - else if (self->g > 1) self->g = 1; - - if (self->b < 0) self->b = 0; - else if (self->b > 1) self->b = 1; - - if (self->a < 0) self->a = 0; - else if (self->a > 1) self->a = 1; -} +#endif /* Spine_TransformConstraintTimeline_h */ diff --git a/cocos/editor-support/spine/TransformMode.h b/cocos/editor-support/spine/TransformMode.h new file mode 100644 index 00000000000..27c4fd5c4d0 --- /dev/null +++ b/cocos/editor-support/spine/TransformMode.h @@ -0,0 +1,45 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TransformMode_h +#define Spine_TransformMode_h + +namespace spine { + enum TransformMode { + TransformMode_Normal = 0, + TransformMode_OnlyTranslation, + TransformMode_NoRotationOrReflection, + TransformMode_NoScale, + TransformMode_NoScaleOrReflection + }; +} + +#endif /* Spine_TransformMode_h */ + diff --git a/cocos/editor-support/spine/TranslateTimeline.cpp b/cocos/editor-support/spine/TranslateTimeline.cpp new file mode 100644 index 00000000000..5f1894f69fb --- /dev/null +++ b/cocos/editor-support/spine/TranslateTimeline.cpp @@ -0,0 +1,130 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(TranslateTimeline, CurveTimeline) + +const int TranslateTimeline::ENTRIES = 3; +const int TranslateTimeline::PREV_TIME = -3; +const int TranslateTimeline::PREV_X = -2; +const int TranslateTimeline::PREV_Y = -1; +const int TranslateTimeline::X = 1; +const int TranslateTimeline::Y = 2; + +TranslateTimeline::TranslateTimeline(int frameCount) : CurveTimeline(frameCount), _boneIndex(0) { + _frames.ensureCapacity(frameCount * ENTRIES); + _frames.setSize(frameCount * ENTRIES, 0); +} + +TranslateTimeline::~TranslateTimeline() { +} + +void TranslateTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + Bone *boneP = skeleton._bones[_boneIndex]; + Bone &bone = *boneP; + + if (time < _frames[0]) { + switch (blend) { + case MixBlend_Setup: + bone._x = bone._data._x; + bone._y = bone._data._y; + return; + case MixBlend_First: + bone._x += (bone._data._x - bone._x) * alpha; + bone._y += (bone._data._y - bone._y) * alpha; + default: {} + } + return; + } + + float x, y; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + x = _frames[_frames.size() + PREV_X]; + y = _frames[_frames.size() + PREV_Y]; + } else { + // Interpolate between the previous frame and the current frame. + int frame = Animation::binarySearch(_frames, time, ENTRIES); + x = _frames[frame + PREV_X]; + y = _frames[frame + PREV_Y]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + x += (_frames[frame + X] - x) * percent; + y += (_frames[frame + Y] - y) * percent; + } + + switch (blend) { + case MixBlend_Setup: + bone._x = bone._data._x + x * alpha; + bone._y = bone._data._y + y * alpha; + break; + case MixBlend_First: + case MixBlend_Replace: + bone._x += (bone._data._x + x - bone._x) * alpha; + bone._y += (bone._data._y + y - bone._y) * alpha; + break; + case MixBlend_Add: + bone._x += x * alpha; + bone._y += y * alpha; + } +} + +int TranslateTimeline::getPropertyId() { + return ((int) TimelineType_Translate << 24) + _boneIndex; +} + +void TranslateTimeline::setFrame(int frameIndex, float time, float x, float y) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + X] = x; + _frames[frameIndex + Y] = y; +} diff --git a/cocos/editor-support/spine/TranslateTimeline.h b/cocos/editor-support/spine/TranslateTimeline.h new file mode 100644 index 00000000000..b5f3a103d5e --- /dev/null +++ b/cocos/editor-support/spine/TranslateTimeline.h @@ -0,0 +1,73 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TranslateTimeline_h +#define Spine_TranslateTimeline_h + +#include + +#include +#include + +namespace spine { + + class SP_API TranslateTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + static const int ENTRIES; + + explicit TranslateTimeline(int frameCount); + + virtual ~TranslateTimeline(); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, float x, float y); + + protected: + static const int PREV_TIME; + static const int PREV_X; + static const int PREV_Y; + static const int X; + static const int Y; + + Vector _frames; + int _boneIndex; + }; +} + +#endif /* Spine_TranslateTimeline_h */ diff --git a/cocos/editor-support/spine/Triangulator.c b/cocos/editor-support/spine/Triangulator.c deleted file mode 100644 index 16b69bc9322..00000000000 --- a/cocos/editor-support/spine/Triangulator.c +++ /dev/null @@ -1,361 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include -#include - -spTriangulator* spTriangulator_create() { - spTriangulator* triangulator = CALLOC(spTriangulator, 1); - - triangulator->convexPolygons = spArrayFloatArray_create(16); - triangulator->convexPolygonsIndices = spArrayShortArray_create(16); - triangulator->indicesArray = spShortArray_create(128); - triangulator->isConcaveArray = spIntArray_create(128); - triangulator->triangles = spShortArray_create(128); - triangulator->polygonPool = spArrayFloatArray_create(16); - triangulator->polygonIndicesPool = spArrayShortArray_create(128); - - return triangulator; -} - -void spTriangulator_dispose(spTriangulator* self) { - int i; - - for (i = 0; i < self->convexPolygons->size; i++) { - spFloatArray_dispose(self->convexPolygons->items[i]); - } - spArrayFloatArray_dispose(self->convexPolygons); - - for (i = 0; i < self->convexPolygonsIndices->size; i++) { - spShortArray_dispose(self->convexPolygonsIndices->items[i]); - } - spArrayShortArray_dispose(self->convexPolygonsIndices); - - spShortArray_dispose(self->indicesArray); - spIntArray_dispose(self->isConcaveArray); - spShortArray_dispose(self->triangles); - - for (i = 0; i < self->polygonPool->size; i++) { - spFloatArray_dispose(self->polygonPool->items[i]); - } - spArrayFloatArray_dispose(self->polygonPool); - - for (i = 0; i < self->polygonIndicesPool->size; i++) { - spShortArray_dispose(self->polygonIndicesPool->items[i]); - } - spArrayShortArray_dispose(self->polygonIndicesPool); - - FREE(self); -} - -static spFloatArray* _obtainPolygon(spTriangulator* self) { - if (self->polygonPool->size == 0) return spFloatArray_create(16); - else return spArrayFloatArray_pop(self->polygonPool); -} - -static void _freePolygon(spTriangulator* self, spFloatArray* polygon) { - spArrayFloatArray_add(self->polygonPool, polygon); -} - -static void _freeAllPolygons(spTriangulator* self, spArrayFloatArray* polygons) { - int i; - for (i = 0; i < polygons->size; i++) { - _freePolygon(self, polygons->items[i]); - } -} - -static spShortArray* _obtainPolygonIndices(spTriangulator* self) { - if (self->polygonIndicesPool->size == 0) return spShortArray_create(16); - else return spArrayShortArray_pop(self->polygonIndicesPool); -} - -static void _freePolygonIndices(spTriangulator* self, spShortArray* indices) { - spArrayShortArray_add(self->polygonIndicesPool, indices); -} - -static void _freeAllPolygonIndices(spTriangulator* self, spArrayShortArray* polygonIndices) { - int i; - for (i = 0; i < polygonIndices->size; i++) { - _freePolygonIndices(self, polygonIndices->items[i]); - } -} - -static int _positiveArea(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { - return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0; -} - -static int _isConcave(int index, int vertexCount, float* vertices, short* indices) { - int previous = indices[(vertexCount + index - 1) % vertexCount] << 1; - int current = indices[index] << 1; - int next = indices[(index + 1) % vertexCount] << 1; - return !_positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], - vertices[next], - vertices[next + 1]); -} - -static int _winding (float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { - float px = p2x - p1x, py = p2y - p1y; - return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1; -} - -spShortArray* spTriangulator_triangulate(spTriangulator* self, spFloatArray* verticesArray) { - float* vertices = verticesArray->items; - int vertexCount = verticesArray->size >> 1; - int i, n, ii; - - spShortArray* indicesArray = self->indicesArray; - short* indices; - spIntArray* isConcaveArray; - int* isConcave; - spShortArray* triangles; - - spShortArray_clear(indicesArray); - indices = spShortArray_setSize(indicesArray, vertexCount)->items; - for (i = 0; i < vertexCount; i++) - indices[i] = (short)i; - - isConcaveArray = self->isConcaveArray; - isConcave = spIntArray_setSize(isConcaveArray, vertexCount)->items; - for (i = 0, n = vertexCount; i < n; ++i) - isConcave[i] = _isConcave(i, vertexCount, vertices, indices); - - triangles = self->triangles; - spShortArray_clear(triangles); - spShortArray_ensureCapacity(triangles, MAX(0, vertexCount - 2) << 2); - - while (vertexCount > 3) { - int previous = vertexCount - 1, i = 0, next = 1; - int previousIndex, nextIndex; - while (1) { - if (!isConcave[i]) { - int p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1; - float p1x = vertices[p1], p1y = vertices[p1 + 1]; - float p2x = vertices[p2], p2y = vertices[p2 + 1]; - float p3x = vertices[p3], p3y = vertices[p3 + 1]; - for (ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) { - int v; - float vx, vy; - if (!isConcave[ii]) continue; - v = indices[ii] << 1; - vx = vertices[v]; vy = vertices[v + 1]; - if (_positiveArea(p3x, p3y, p1x, p1y, vx, vy)) { - if (_positiveArea(p1x, p1y, p2x, p2y, vx, vy)) { - if (_positiveArea(p2x, p2y, p3x, p3y, vx, vy)) goto break_outer; - } - } - } - break; - } - break_outer: - - if (next == 0) { - do { - if (!isConcave[i]) break; - i--; - } while (i > 0); - break; - } - - previous = i; - i = next; - next = (next + 1) % vertexCount; - } - - spShortArray_add(triangles, indices[(vertexCount + i - 1) % vertexCount]); - spShortArray_add(triangles, indices[i]); - spShortArray_add(triangles, indices[(i + 1) % vertexCount]); - spShortArray_removeAt(indicesArray, i); - spIntArray_removeAt(isConcaveArray, i); - vertexCount--; - - previousIndex = (vertexCount + i - 1) % vertexCount; - nextIndex = i == vertexCount ? 0 : i; - isConcave[previousIndex] = _isConcave(previousIndex, vertexCount, vertices, indices); - isConcave[nextIndex] = _isConcave(nextIndex, vertexCount, vertices, indices); - } - - if (vertexCount == 3) { - spShortArray_add(triangles, indices[2]); - spShortArray_add(triangles, indices[0]); - spShortArray_add(triangles, indices[1]); - } - - return triangles; -} - -spArrayFloatArray* spTriangulator_decompose(spTriangulator* self, spFloatArray* verticesArray, spShortArray* triangles) { - float* vertices = verticesArray->items; - - spArrayFloatArray* convexPolygons = self->convexPolygons; - spArrayShortArray* convexPolygonsIndices; - spShortArray* polygonIndices; - spFloatArray* polygon; - - int fanBaseIndex, lastWinding; - short* trianglesItems; - int i, n; - - _freeAllPolygons(self, convexPolygons); - spArrayFloatArray_clear(convexPolygons); - - convexPolygonsIndices = self->convexPolygonsIndices; - _freeAllPolygonIndices(self, convexPolygonsIndices); - spArrayShortArray_clear(convexPolygonsIndices); - - polygonIndices = _obtainPolygonIndices(self); - spShortArray_clear(polygonIndices); - - polygon = _obtainPolygon(self); - spFloatArray_clear(polygon); - - fanBaseIndex = -1; lastWinding = 0; - trianglesItems = triangles->items; - for (i = 0, n = triangles->size; i < n; i += 3) { - int t1 = trianglesItems[i] << 1, t2 = trianglesItems[i + 1] << 1, t3 = trianglesItems[i + 2] << 1; - float x1 = vertices[t1], y1 = vertices[t1 + 1]; - float x2 = vertices[t2], y2 = vertices[t2 + 1]; - float x3 = vertices[t3], y3 = vertices[t3 + 1]; - - int merged = 0; - if (fanBaseIndex == t1) { - int o = polygon->size - 4; - float* p = polygon->items; - int winding1 = _winding(p[o], p[o + 1], p[o + 2], p[o + 3], x3, y3); - int winding2 = _winding(x3, y3, p[0], p[1], p[2], p[3]); - if (winding1 == lastWinding && winding2 == lastWinding) { - spFloatArray_add(polygon, x3); - spFloatArray_add(polygon, y3); - spShortArray_add(polygonIndices, t3); - merged = 1; - } - } - - if (!merged) { - if (polygon->size > 0) { - spArrayFloatArray_add(convexPolygons, polygon); - spArrayShortArray_add(convexPolygonsIndices, polygonIndices); - } else { - _freePolygon(self, polygon); - _freePolygonIndices(self, polygonIndices); - } - polygon = _obtainPolygon(self); - spFloatArray_clear(polygon); - spFloatArray_add(polygon, x1); - spFloatArray_add(polygon, y1); - spFloatArray_add(polygon, x2); - spFloatArray_add(polygon, y2); - spFloatArray_add(polygon, x3); - spFloatArray_add(polygon, y3); - polygonIndices = _obtainPolygonIndices(self); - spShortArray_clear(polygonIndices); - spShortArray_add(polygonIndices, t1); - spShortArray_add(polygonIndices, t2); - spShortArray_add(polygonIndices, t3); - lastWinding = _winding(x1, y1, x2, y2, x3, y3); - fanBaseIndex = t1; - } - } - - if (polygon->size > 0) { - spArrayFloatArray_add(convexPolygons, polygon); - spArrayShortArray_add(convexPolygonsIndices, polygonIndices); - } - - for (i = 0, n = convexPolygons->size; i < n; i++) { - int firstIndex, lastIndex; - int o; - float* p; - float prevPrevX, prevPrevY, prevX, prevY, firstX, firstY, secondX, secondY; - int winding; - int ii; - - polygonIndices = convexPolygonsIndices->items[i]; - if (polygonIndices->size == 0) continue; - firstIndex = polygonIndices->items[0]; - lastIndex = polygonIndices->items[polygonIndices->size - 1]; - - polygon = convexPolygons->items[i]; - o = polygon->size - 4; - p = polygon->items; - prevPrevX = p[o]; prevPrevY = p[o + 1]; - prevX = p[o + 2]; prevY = p[o + 3]; - firstX = p[0]; firstY = p[1]; - secondX = p[2]; secondY = p[3]; - winding = _winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY); - - for (ii = 0; ii < n; ii++) { - spShortArray* otherIndices; - int otherFirstIndex, otherSecondIndex, otherLastIndex; - spFloatArray* otherPoly; - float x3, y3; - int winding1, winding2; - - if (ii == i) continue; - otherIndices = convexPolygonsIndices->items[ii]; - if (otherIndices->size != 3) continue; - otherFirstIndex = otherIndices->items[0]; - otherSecondIndex = otherIndices->items[1]; - otherLastIndex = otherIndices->items[2]; - - otherPoly = convexPolygons->items[ii]; - x3 = otherPoly->items[otherPoly->size - 2]; y3 = otherPoly->items[otherPoly->size - 1]; - - if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue; - winding1 = _winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3); - winding2 = _winding(x3, y3, firstX, firstY, secondX, secondY); - if (winding1 == winding && winding2 == winding) { - spFloatArray_clear(otherPoly); - spShortArray_clear(otherIndices); - spFloatArray_add(polygon, x3); - spFloatArray_add(polygon, y3); - spShortArray_add(polygonIndices, otherLastIndex); - prevPrevX = prevX; - prevPrevY = prevY; - prevX = x3; - prevY = y3; - ii = 0; - } - } - } - - for (i = convexPolygons->size - 1; i >= 0; i--) { - polygon = convexPolygons->items[i]; - if (polygon->size == 0) { - spArrayFloatArray_removeAt(convexPolygons, i); - _freePolygon(self, polygon); - polygonIndices = convexPolygonsIndices->items[i]; - spArrayShortArray_removeAt(convexPolygonsIndices, i); - _freePolygonIndices(self, polygonIndices); - } - } - - return convexPolygons; -} diff --git a/cocos/editor-support/spine/Triangulator.cpp b/cocos/editor-support/spine/Triangulator.cpp new file mode 100644 index 00000000000..57daf3ca4cb --- /dev/null +++ b/cocos/editor-support/spine/Triangulator.cpp @@ -0,0 +1,302 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +using namespace spine; + +Triangulator::~Triangulator() { + ContainerUtil::cleanUpVectorOfPointers(_convexPolygons); + ContainerUtil::cleanUpVectorOfPointers(_convexPolygonsIndices); +} + +Vector &Triangulator::triangulate(Vector &vertices) { + size_t vertexCount = vertices.size() >> 1; + + Vector &indices = _indices; + indices.clear(); + indices.ensureCapacity(vertexCount); + indices.setSize(vertexCount, 0); + for (size_t i = 0; i < vertexCount; ++i) { + indices[i] = i; + } + + Vector &isConcaveArray = _isConcaveArray; + isConcaveArray.ensureCapacity(vertexCount); + isConcaveArray.setSize(vertexCount, 0); + for (size_t i = 0, n = vertexCount; i < n; ++i) { + isConcaveArray[i] = isConcave(i, vertexCount, vertices, indices); + } + + Vector &triangles = _triangles; + triangles.clear(); + triangles.ensureCapacity(MathUtil::max((int)0, (int)vertexCount - 2) << 2); + + while (vertexCount > 3) { + // Find ear tip. + size_t previous = vertexCount - 1, i = 0, next = 1; + + // outer: + while (true) { + if (!isConcaveArray[i]) { + int p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1; + float p1x = vertices[p1], p1y = vertices[p1 + 1]; + float p2x = vertices[p2], p2y = vertices[p2 + 1]; + float p3x = vertices[p3], p3y = vertices[p3 + 1]; + for (size_t ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) { + if (!isConcaveArray[ii]) { + continue; + } + + int v = indices[ii] << 1; + float &vx = vertices[v], vy = vertices[v + 1]; + if (positiveArea(p3x, p3y, p1x, p1y, vx, vy)) { + if (positiveArea(p1x, p1y, p2x, p2y, vx, vy)) { + if (positiveArea(p2x, p2y, p3x, p3y, vx, vy)) { + goto break_outer; // break outer; + } + } + } + } + break; + } + break_outer: + + if (next == 0) { + do { + if (!isConcaveArray[i]) { + break; + } + i--; + } while (i > 0); + break; + } + + previous = i; + i = next; + next = (next + 1) % vertexCount; + } + + // Cut ear tip. + triangles.add(indices[(vertexCount + i - 1) % vertexCount]); + triangles.add(indices[i]); + triangles.add(indices[(i + 1) % vertexCount]); + indices.removeAt(i); + isConcaveArray.removeAt(i); + vertexCount--; + + int previousIndex = (vertexCount + i - 1) % vertexCount; + int nextIndex = i == vertexCount ? 0 : i; + isConcaveArray[previousIndex] = isConcave(previousIndex, vertexCount, vertices, indices); + isConcaveArray[nextIndex] = isConcave(nextIndex, vertexCount, vertices, indices); + } + + if (vertexCount == 3) { + triangles.add(indices[2]); + triangles.add(indices[0]); + triangles.add(indices[1]); + } + + return triangles; +} + +Vector *> &Triangulator::decompose(Vector &vertices, Vector &triangles) { + Vector *> &convexPolygons = _convexPolygons; + for (size_t i = 0, n = convexPolygons.size(); i < n; ++i) { + _polygonPool.free(convexPolygons[i]); + } + convexPolygons.clear(); + + Vector *> &convexPolygonsIndices = _convexPolygonsIndices; + for (size_t i = 0, n = convexPolygonsIndices.size(); i < n; ++i) { + _polygonIndicesPool.free(convexPolygonsIndices[i]); + } + convexPolygonsIndices.clear(); + + Vector *polygonIndices = _polygonIndicesPool.obtain(); + polygonIndices->clear(); + + Vector *polygon = _polygonPool.obtain(); + polygon->clear(); + + // Merge subsequent triangles if they form a triangle fan. + int fanBaseIndex = -1, lastwinding = 0; + for (size_t i = 0, n = triangles.size(); i < n; i += 3) { + int t1 = triangles[i] << 1, t2 = triangles[i + 1] << 1, t3 = triangles[i + 2] << 1; + float x1 = vertices[t1], y1 = vertices[t1 + 1]; + float x2 = vertices[t2], y2 = vertices[t2 + 1]; + float x3 = vertices[t3], y3 = vertices[t3 + 1]; + + // If the base of the last triangle is the same as this triangle, check if they form a convex polygon (triangle fan). + bool merged = false; + if (fanBaseIndex == t1) { + size_t o = polygon->size() - 4; + Vector &p = *polygon; + int winding1 = winding(p[o], p[o + 1], p[o + 2], p[o + 3], x3, y3); + int winding2 = winding(x3, y3, p[0], p[1], p[2], p[3]); + if (winding1 == lastwinding && winding2 == lastwinding) { + polygon->add(x3); + polygon->add(y3); + polygonIndices->add(t3); + merged = true; + } + } + + // Otherwise make this triangle the new base. + if (!merged) { + if (polygon->size() > 0) { + convexPolygons.add(polygon); + convexPolygonsIndices.add(polygonIndices); + } else { + _polygonPool.free(polygon); + _polygonIndicesPool.free(polygonIndices); + } + + polygon = _polygonPool.obtain(); + polygon->clear(); + polygon->add(x1); + polygon->add(y1); + polygon->add(x2); + polygon->add(y2); + polygon->add(x3); + polygon->add(y3); + polygonIndices = _polygonIndicesPool.obtain(); + polygonIndices->clear(); + polygonIndices->add(t1); + polygonIndices->add(t2); + polygonIndices->add(t3); + lastwinding = winding(x1, y1, x2, y2, x3, y3); + fanBaseIndex = t1; + } + } + + if (polygon->size() > 0) { + convexPolygons.add(polygon); + convexPolygonsIndices.add(polygonIndices); + } + + // Go through the list of polygons and try to merge the remaining triangles with the found triangle fans. + for (size_t i = 0, n = convexPolygons.size(); i < n; ++i) { + polygonIndices = convexPolygonsIndices[i]; + + if (polygonIndices->size() == 0) continue; + int firstIndex = (*polygonIndices)[0]; + int lastIndex = (*polygonIndices)[polygonIndices->size() - 1]; + + polygon = convexPolygons[i]; + size_t o = polygon->size() - 4; + Vector &p = *polygon; + float prevPrevX = p[o], prevPrevY = p[o + 1]; + float prevX = p[o + 2], prevY = p[o + 3]; + float firstX = p[0], firstY = p[1]; + float secondX = p[2], secondY = p[3]; + int winding0 = winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY); + + for (size_t ii = 0; ii < n; ++ii) { + if (ii == i) { + continue; + } + + Vector *otherIndicesP = convexPolygonsIndices[ii]; + Vector &otherIndices = *otherIndicesP; + + if (otherIndices.size() != 3) { + continue; + } + + int otherFirstIndex = otherIndices[0]; + int otherSecondIndex = otherIndices[1]; + int otherLastIndex = otherIndices[2]; + + Vector *otherPolyP = convexPolygons[ii]; + Vector &otherPoly = *otherPolyP; + + float x3 = otherPoly[otherPoly.size() - 2], y3 = otherPoly[otherPoly.size() - 1]; + + if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) { + continue; + } + + int winding1 = winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3); + int winding2 = winding(x3, y3, firstX, firstY, secondX, secondY); + if (winding1 == winding0 && winding2 == winding0) { + otherPoly.clear(); + otherIndices.clear(); + polygon->add(x3); + polygon->add(y3); + polygonIndices->add(otherLastIndex); + prevPrevX = prevX; + prevPrevY = prevY; + prevX = x3; + prevY = y3; + ii = 0; + } + } + } + + // Remove empty polygons that resulted from the merge step above. + for (int i = (int)convexPolygons.size() - 1; i >= 0; --i) { + polygon = convexPolygons[i]; + if (polygon->size() == 0) { + convexPolygons.removeAt(i); + _polygonPool.free(polygon); + polygonIndices = convexPolygonsIndices[i]; + convexPolygonsIndices.removeAt(i); + _polygonIndicesPool.free(polygonIndices); + } + } + + return convexPolygons; +} + +bool Triangulator::isConcave(int index, int vertexCount, Vector &vertices, Vector &indices) { + int previous = indices[(vertexCount + index - 1) % vertexCount] << 1; + int current = indices[index] << 1; + int next = indices[(index + 1) % vertexCount] << 1; + + return !positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], + vertices[next], vertices[next + 1]); +} + +bool Triangulator::positiveArea(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { + return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0; +} + +int Triangulator::winding(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { + float px = p2x - p1x, py = p2y - p1y; + + return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1; +} diff --git a/cocos/editor-support/spine/Triangulator.h b/cocos/editor-support/spine/Triangulator.h index 69863b2f78c..da12785ceee 100644 --- a/cocos/editor-support/spine/Triangulator.h +++ b/cocos/editor-support/spine/Triangulator.h @@ -28,36 +28,38 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef SPINE_TRIANGULATOR_H -#define SPINE_TRIANGULATOR_H +#ifndef Spine_Triangulator_h +#define Spine_Triangulator_h -#include -#include +#include +#include -#ifdef __cplusplus -extern "C" { -#endif +namespace spine { +class SP_API Triangulator : public SpineObject { +public: + ~Triangulator(); -typedef struct spTriangulator { - spArrayFloatArray* convexPolygons; - spArrayShortArray* convexPolygonsIndices; + Vector &triangulate(Vector &vertices); - spShortArray* indicesArray; - spIntArray* isConcaveArray; - spShortArray* triangles; + Vector< Vector* > &decompose(Vector &vertices, Vector &triangles); - spArrayFloatArray* polygonPool; - spArrayShortArray* polygonIndicesPool; -} spTriangulator; +private: + Vector* > _convexPolygons; + Vector* > _convexPolygonsIndices; -SP_API spTriangulator* spTriangulator_create(); -SP_API spShortArray* spTriangulator_triangulate(spTriangulator* self, spFloatArray* verticesArray); -SP_API spArrayFloatArray* spTriangulator_decompose(spTriangulator* self, spFloatArray* verticesArray, spShortArray* triangles); -SP_API void spTriangulator_dispose(spTriangulator* self); + Vector _indices; + Vector _isConcaveArray; + Vector _triangles; + Pool > _polygonPool; + Pool > _polygonIndicesPool; -#ifdef __cplusplus + static bool isConcave(int index, int vertexCount, Vector &vertices, Vector &indices); + + static bool positiveArea(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y); + + static int winding(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y); +}; } -#endif -#endif /* SPINE_TRIANGULATOR_H_ */ +#endif /* Spine_Triangulator_h */ diff --git a/cocos/editor-support/spine/TwoColorTimeline.cpp b/cocos/editor-support/spine/TwoColorTimeline.cpp new file mode 100644 index 00000000000..3577f7eacb5 --- /dev/null +++ b/cocos/editor-support/spine/TwoColorTimeline.cpp @@ -0,0 +1,181 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include + +using namespace spine; + +RTTI_IMPL(TwoColorTimeline, CurveTimeline) + +const int TwoColorTimeline::ENTRIES = 8; +const int TwoColorTimeline::PREV_TIME = -8; +const int TwoColorTimeline::PREV_R = -7; +const int TwoColorTimeline::PREV_G = -6; +const int TwoColorTimeline::PREV_B = -5; +const int TwoColorTimeline::PREV_A = -4; +const int TwoColorTimeline::PREV_R2 = -3; +const int TwoColorTimeline::PREV_G2 = -2; +const int TwoColorTimeline::PREV_B2 = -1; +const int TwoColorTimeline::R = 1; +const int TwoColorTimeline::G = 2; +const int TwoColorTimeline::B = 3; +const int TwoColorTimeline::A = 4; +const int TwoColorTimeline::R2 = 5; +const int TwoColorTimeline::G2 = 6; +const int TwoColorTimeline::B2 = 7; + +TwoColorTimeline::TwoColorTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0) { + _frames.ensureCapacity(frameCount * ENTRIES); + _frames.setSize(frameCount * ENTRIES, 0); +} + +void TwoColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, + MixBlend blend, MixDirection direction) { + SP_UNUSED(lastTime); + SP_UNUSED(pEvents); + SP_UNUSED(direction); + + Slot *slotP = skeleton._slots[_slotIndex]; + Slot &slot = *slotP; + + if (time < _frames[0]) { + // Time is before first frame. + switch (blend) { + case MixBlend_Setup: + slot.getColor().set(slot.getData().getColor()); + slot.getDarkColor().set(slot.getData().getDarkColor()); + return; + case MixBlend_First: { + Color &color = slot.getColor(); + color.r += (color.r - slot._data.getColor().r) * alpha; + color.g += (color.g - slot._data.getColor().g) * alpha; + color.b += (color.b - slot._data.getColor().b) * alpha; + color.a += (color.a - slot._data.getColor().a) * alpha; + + Color &darkColor = slot.getDarkColor(); + darkColor.r += (darkColor.r - slot._data.getDarkColor().r) * alpha; + darkColor.g += (darkColor.g - slot._data.getDarkColor().g) * alpha; + darkColor.b += (darkColor.b - slot._data.getDarkColor().b) * alpha; + return; + } + default: + return; + } + } + + float r, g, b, a, r2, g2, b2; + if (time >= _frames[_frames.size() - ENTRIES]) { + // Time is after last frame. + size_t i = _frames.size(); + r = _frames[i + PREV_R]; + g = _frames[i + PREV_G]; + b = _frames[i + PREV_B]; + a = _frames[i + PREV_A]; + r2 = _frames[i + PREV_R2]; + g2 = _frames[i + PREV_G2]; + b2 = _frames[i + PREV_B2]; + } else { + // Interpolate between the previous frame and the current frame. + size_t frame = (size_t)Animation::binarySearch(_frames, time, ENTRIES); + r = _frames[frame + PREV_R]; + g = _frames[frame + PREV_G]; + b = _frames[frame + PREV_B]; + a = _frames[frame + PREV_A]; + r2 = _frames[frame + PREV_R2]; + g2 = _frames[frame + PREV_G2]; + b2 = _frames[frame + PREV_B2]; + float frameTime = _frames[frame]; + float percent = getCurvePercent(frame / ENTRIES - 1, + 1 - (time - frameTime) / (_frames[frame + PREV_TIME] - frameTime)); + + r += (_frames[frame + R] - r) * percent; + g += (_frames[frame + G] - g) * percent; + b += (_frames[frame + B] - b) * percent; + a += (_frames[frame + A] - a) * percent; + r2 += (_frames[frame + R2] - r2) * percent; + g2 += (_frames[frame + G2] - g2) * percent; + b2 += (_frames[frame + B2] - b2) * percent; + } + + if (alpha == 1) { + Color &color = slot.getColor(); + color.set(r, g, b, a); + + Color &darkColor = slot.getDarkColor(); + darkColor.set(r2, g2, b2, 1); + } else { + Color &light = slot._color; + Color &dark = slot._darkColor; + if (blend == MixBlend_Setup) { + light.set(slot._data._color); + dark.set(slot._data._darkColor); + } + light.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha); + dark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0); + } +} + +int TwoColorTimeline::getPropertyId() { + return ((int) TimelineType_TwoColor << 24) + _slotIndex; +} + +void TwoColorTimeline::setFrame(int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, + float b2) { + frameIndex *= ENTRIES; + _frames[frameIndex] = time; + _frames[frameIndex + R] = r; + _frames[frameIndex + G] = g; + _frames[frameIndex + B] = b; + _frames[frameIndex + A] = a; + _frames[frameIndex + R2] = r2; + _frames[frameIndex + G2] = g2; + _frames[frameIndex + B2] = b2; +} + +int TwoColorTimeline::getSlotIndex() { + return _slotIndex; +} + +void TwoColorTimeline::setSlotIndex(int inValue) { + assert(inValue >= 0); + _slotIndex = inValue; +} diff --git a/cocos/editor-support/spine/TwoColorTimeline.h b/cocos/editor-support/spine/TwoColorTimeline.h new file mode 100644 index 00000000000..78249043bfc --- /dev/null +++ b/cocos/editor-support/spine/TwoColorTimeline.h @@ -0,0 +1,81 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_TwoColorTimeline_h +#define Spine_TwoColorTimeline_h + +#include + +namespace spine { + + class SP_API TwoColorTimeline : public CurveTimeline { + friend class SkeletonBinary; + friend class SkeletonJson; + + RTTI_DECL + + public: + static const int ENTRIES; + + explicit TwoColorTimeline(int frameCount); + + virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector* pEvents, float alpha, MixBlend blend, MixDirection direction); + + virtual int getPropertyId(); + + /// Sets the time and value of the specified keyframe. + void setFrame(int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2); + + int getSlotIndex(); + void setSlotIndex(int inValue); + + private: + static const int PREV_TIME; + static const int PREV_R; + static const int PREV_G; + static const int PREV_B; + static const int PREV_A; + static const int PREV_R2; + static const int PREV_G2; + static const int PREV_B2; + static const int R; + static const int G; + static const int B; + static const int A; + static const int R2; + static const int G2; + static const int B2; + + Vector _frames; // time, r, g, b, a, r2, g2, b2, ... + int _slotIndex; + }; +} + +#endif /* Spine_TwoColorTimeline_h */ diff --git a/cocos/editor-support/spine/Updatable.cpp b/cocos/editor-support/spine/Updatable.cpp new file mode 100644 index 00000000000..7c52d174942 --- /dev/null +++ b/cocos/editor-support/spine/Updatable.cpp @@ -0,0 +1,45 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +using namespace spine; + +RTTI_IMPL_NOPARENT(Updatable) + +Updatable::Updatable() { +} + +Updatable::~Updatable() { +} diff --git a/cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.h b/cocos/editor-support/spine/Updatable.h similarity index 82% rename from cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.h rename to cocos/editor-support/spine/Updatable.h index b9dcf60c5a0..9c50d64e5bf 100644 --- a/cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.h +++ b/cocos/editor-support/spine/Updatable.h @@ -28,19 +28,23 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#pragma once +#ifndef Spine_Updatable_h +#define Spine_Updatable_h -#include "spine/AtlasAttachmentLoader.h" +#include +#include -extern "C" { +namespace spine { +class SP_API Updatable : public SpineObject { +RTTI_DECL -typedef struct CreatorAttachmentLoader -{ - spAttachmentLoader super; - spAtlasAttachmentLoader* atlasAttachmentLoader; -} CreatorAttachmentLoader; +public: + Updatable(); -/* The CreatorAttachmentLoader must not be disposed until after the skeleton data has been disposed. */ -CreatorAttachmentLoader* CreatorAttachmentLoader_create (spAtlas* atlas); + virtual ~Updatable(); + virtual void update() = 0; +}; } + +#endif /* Spine_Updatable_h */ diff --git a/cocos/editor-support/spine/Vector.h b/cocos/editor-support/spine/Vector.h new file mode 100644 index 00000000000..a7806c42db7 --- /dev/null +++ b/cocos/editor-support/spine/Vector.h @@ -0,0 +1,223 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Vector_h +#define Spine_Vector_h + +#include +#include +#include +#include +#include +#include + +namespace spine { +template +class SP_API Vector : public SpineObject { +public: + Vector() : _size(0), _capacity(0), _buffer(NULL) { + } + + Vector(const Vector &inVector) : _size(inVector._size), _capacity(inVector._capacity), _buffer(NULL) { + if (_capacity > 0) { + _buffer = allocate(_capacity); + for (size_t i = 0; i < _size; ++i) { + construct(_buffer + i, inVector._buffer[i]); + } + } + } + + ~Vector() { + clear(); + deallocate(_buffer); + } + + inline void clear() { + for (size_t i = 0; i < _size; ++i) { + destroy(_buffer + (_size - 1 - i)); + } + + _size = 0; + } + + inline size_t getCapacity() const { + return _capacity; + } + + inline size_t size() const { + return _size; + } + + inline void setSize(size_t newSize, const T &defaultValue) { + assert(newSize >= 0); + size_t oldSize = _size; + _size = newSize; + if (_capacity < newSize) { + _capacity = (int) (_size * 1.75f); + if (_capacity < 8) _capacity = 8; + _buffer = spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); + } + if (oldSize < _size) { + for (size_t i = oldSize; i < _size; i++) { + construct(_buffer + i, defaultValue); + } + } + } + + inline void ensureCapacity(size_t newCapacity = 0) { + if (_capacity >= newCapacity) return; + _capacity = newCapacity; + _buffer = SpineExtension::realloc(_buffer, newCapacity, __FILE__, __LINE__); + } + + inline void add(const T &inValue) { + if (_size == _capacity) { + // inValue might reference an element in this buffer + // When we reallocate, the reference becomes invalid. + // We thus need to create a defensive copy before + // reallocating. + T valueCopy = inValue; + _capacity = (int) (_size * 1.75f); + if (_capacity < 8) _capacity = 8; + _buffer = spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); + construct(_buffer + _size++, valueCopy); + } else { + construct(_buffer + _size++, inValue); + } + } + + inline void addAll(Vector &inValue) { + ensureCapacity(this->size() + inValue.size()); + for (size_t i = 0; i < inValue.size(); i++) { + add(inValue[i]); + } + } + + inline void clearAndAddAll(Vector &inValue) { + this->clear(); + this->addAll(inValue); + } + + inline void removeAt(size_t inIndex) { + assert(inIndex < _size); + + --_size; + + if (inIndex != _size) { + for (size_t i = inIndex; i < _size; ++i) { + std::swap(_buffer[i], _buffer[i + 1]); + } + } + + destroy(_buffer + _size); + } + + inline bool contains(const T &inValue) { + for (size_t i = 0; i < _size; ++i) { + if (_buffer[i] == inValue) { + return true; + } + } + + return false; + } + + inline int indexOf(const T &inValue) { + for (size_t i = 0; i < _size; ++i) { + if (_buffer[i] == inValue) { + return (int)i; + } + } + + return -1; + } + + inline T &operator[](size_t inIndex) { + assert(inIndex < _size); + + return _buffer[inIndex]; + } + + inline friend bool operator==(Vector &lhs, Vector &rhs) { + if (lhs.size() != rhs.size()) { + return false; + } + + for (size_t i = 0, n = lhs.size(); i < n; ++i) { + if (lhs[i] != rhs[i]) { + return false; + } + } + + return true; + } + + inline friend bool operator!=(Vector &lhs, Vector &rhs) { + return !(lhs == rhs); + } + + inline T *buffer() { + return _buffer; + } + +private: + size_t _size; + size_t _capacity; + T *_buffer; + + inline T *allocate(size_t n) { + assert(n > 0); + + T *ptr = SpineExtension::calloc(n, __FILE__, __LINE__); + + assert(ptr); + + return ptr; + } + + inline void deallocate(T *buffer) { + if (_buffer) { + SpineExtension::free(buffer, __FILE__, __LINE__); + } + } + + inline void construct(T *buffer, const T &val) { + new(buffer) T(val); + } + + inline void destroy(T *buffer) { + buffer->~T(); + } + + // Vector &operator=(const Vector &inVector) {}; +}; +} + +#endif /* Spine_Vector_h */ diff --git a/cocos/editor-support/spine/VertexAttachment.c b/cocos/editor-support/spine/VertexAttachment.c deleted file mode 100644 index 14087815eb6..00000000000 --- a/cocos/editor-support/spine/VertexAttachment.c +++ /dev/null @@ -1,114 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -/* FIXME this is not thread-safe */ -static int nextID = 0; - -void _spVertexAttachment_init (spVertexAttachment* attachment) { - attachment->id = (nextID++ & 65535) << 11; -} - -void _spVertexAttachment_deinit (spVertexAttachment* attachment) { - _spAttachment_deinit(SUPER(attachment)); - FREE(attachment->bones); - FREE(attachment->vertices); -} - -void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, spSlot* slot, int start, int count, float* worldVertices, int offset, int stride) { - spSkeleton* skeleton; - int deformLength; - float* deform; - float* vertices; - int* bones; - - count = offset + (count >> 1) * stride; - skeleton = slot->bone->skeleton; - deformLength = slot->attachmentVerticesCount; - deform = slot->attachmentVertices; - vertices = self->vertices; - bones = self->bones; - if (!bones) { - spBone* bone; - int v, w; - float x, y; - if (deformLength > 0) vertices = deform; - bone = slot->bone; - x = bone->worldX; - y = bone->worldY; - for (v = start, w = offset; w < count; v += 2, w += stride) { - float vx = vertices[v], vy = vertices[v + 1]; - worldVertices[w] = vx * bone->a + vy * bone->b + x; - worldVertices[w + 1] = vx * bone->c + vy * bone->d + y; - } - } else { - int v = 0, skip = 0, i; - spBone** skeletonBones; - for (i = 0; i < start; i += 2) { - int n = bones[v]; - v += n + 1; - skip += n; - } - skeletonBones = skeleton->bones; - if (deformLength == 0) { - int w, b; - for (w = offset, b = skip * 3; w < count; w += stride) { - float wx = 0, wy = 0; - int n = bones[v++]; - n += v; - for (; v < n; v++, b += 3) { - spBone* bone = skeletonBones[bones[v]]; - float vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2]; - wx += (vx * bone->a + vy * bone->b + bone->worldX) * weight; - wy += (vx * bone->c + vy * bone->d + bone->worldY) * weight; - } - worldVertices[w] = wx; - worldVertices[w + 1] = wy; - } - } else { - int w, b, f; - for (w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) { - float wx = 0, wy = 0; - int n = bones[v++]; - n += v; - for (; v < n; v++, b += 3, f += 2) { - spBone* bone = skeletonBones[bones[v]]; - float vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2]; - wx += (vx * bone->a + vy * bone->b + bone->worldX) * weight; - wy += (vx * bone->c + vy * bone->d + bone->worldY) * weight; - } - worldVertices[w] = wx; - worldVertices[w + 1] = wy; - } - } - } -} diff --git a/cocos/editor-support/spine/VertexAttachment.cpp b/cocos/editor-support/spine/VertexAttachment.cpp new file mode 100644 index 00000000000..a5d0cea02f1 --- /dev/null +++ b/cocos/editor-support/spine/VertexAttachment.cpp @@ -0,0 +1,163 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include + +#include + +#include +#include + +using namespace spine; + +RTTI_IMPL(VertexAttachment, Attachment) + +VertexAttachment::VertexAttachment(const String &name) : Attachment(name), _worldVerticesLength(0), _id(getNextID()) { +} + +VertexAttachment::~VertexAttachment() { +} + +void VertexAttachment::computeWorldVertices(Slot &slot, Vector &worldVertices) { + computeWorldVertices(slot, 0, _worldVerticesLength, worldVertices, 0); +} + +void VertexAttachment::computeWorldVertices(Slot &slot, float *worldVertices) { + computeWorldVertices(slot, 0, _worldVerticesLength, worldVertices, 0); +} + +void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t count, Vector &worldVertices, size_t offset, + size_t stride) { + computeWorldVertices(slot, start, count, worldVertices.buffer(), offset, stride); +} + +void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t count, float *worldVertices, size_t offset, + size_t stride) { + count = offset + (count >> 1) * stride; + Skeleton &skeleton = slot._bone._skeleton; + Vector *deformArray = &slot.getAttachmentVertices(); + Vector *vertices = &_vertices; + Vector &bones = _bones; + if (bones.size() == 0) { + if (deformArray->size() > 0) { + vertices = deformArray; + } + + Bone &bone = slot._bone; + float x = bone._worldX; + float y = bone._worldY; + float a = bone._a, b = bone._b, c = bone._c, d = bone._d; + for (size_t vv = start, w = offset; w < count; vv += 2, w += stride) { + float vx = (*vertices)[vv]; + float vy = (*vertices)[vv + 1]; + worldVertices[w] = vx * a + vy * b + x; + worldVertices[w + 1] = vx * c + vy * d + y; + } + return; + } + + int v = 0, skip = 0; + for (size_t i = 0; i < start; i += 2) { + int n = bones[v]; + v += n + 1; + skip += n; + } + + Vector &skeletonBones = skeleton.getBones(); + if (deformArray->size() == 0) { + for (size_t w = offset, b = skip * 3; w < count; w += stride) { + float wx = 0, wy = 0; + int n = bones[v++]; + n += v; + for (; v < n; v++, b += 3) { + Bone *boneP = skeletonBones[bones[v]]; + Bone &bone = *boneP; + float vx = (*vertices)[b]; + float vy = (*vertices)[b + 1]; + float weight = (*vertices)[b + 2]; + wx += (vx * bone._a + vy * bone._b + bone._worldX) * weight; + wy += (vx * bone._c + vy * bone._d + bone._worldY) * weight; + } + worldVertices[w] = wx; + worldVertices[w + 1] = wy; + } + } else { + for (size_t w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) { + float wx = 0, wy = 0; + int n = bones[v++]; + n += v; + for (; v < n; v++, b += 3, f += 2) { + Bone *boneP = skeletonBones[bones[v]]; + Bone &bone = *boneP; + float vx = (*vertices)[b] + (*deformArray)[f]; + float vy = (*vertices)[b + 1] + (*deformArray)[f + 1]; + float weight = (*vertices)[b + 2]; + wx += (vx * bone._a + vy * bone._b + bone._worldX) * weight; + wy += (vx * bone._c + vy * bone._d + bone._worldY) * weight; + } + worldVertices[w] = wx; + worldVertices[w + 1] = wy; + } + } +} + +bool VertexAttachment::applyDeform(VertexAttachment *sourceAttachment) { + return this == sourceAttachment; +} + +int VertexAttachment::getId() { + return _id; +} + +Vector &VertexAttachment::getBones() { + return _bones; +} + +Vector &VertexAttachment::getVertices() { + return _vertices; +} + +size_t VertexAttachment::getWorldVerticesLength() { + return _worldVerticesLength; +} + +void VertexAttachment::setWorldVerticesLength(size_t inValue) { + _worldVerticesLength = inValue; +} + +int VertexAttachment::getNextID() { + static int nextID = 0; + + return (nextID++ & 65535) << 11; +} diff --git a/cocos/editor-support/spine/VertexAttachment.h b/cocos/editor-support/spine/VertexAttachment.h index 7d232cc6e53..e1cc9d6b9f7 100644 --- a/cocos/editor-support/spine/VertexAttachment.h +++ b/cocos/editor-support/spine/VertexAttachment.h @@ -1,68 +1,91 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_VERTEXATTACHMENT_H_ -#define SPINE_VERTEXATTACHMENT_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct spVertexAttachment spVertexAttachment; -struct spVertexAttachment { - spAttachment super; - - int bonesCount; - int* bones; - - int verticesCount; - float* vertices; - - int worldVerticesLength; - - int id; -}; - -SP_API void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, spSlot* slot, int start, int count, float* worldVertices, int offset, int stride); - -#ifdef SPINE_SHORT_NAMES -typedef spVertexAttachment VertexAttachment; -#define VertexAttachment_computeWorldVertices(...) spVertexAttachment_computeWorldVertices(__VA_ARGS__) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SPINE_VERTEXATTACHMENT_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_VertexAttachment_h +#define Spine_VertexAttachment_h + +#include + +#include + +namespace spine { + class Slot; + + /// An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's vertices. + class SP_API VertexAttachment : public Attachment { + friend class SkeletonBinary; + friend class SkeletonJson; + friend class DeformTimeline; + + RTTI_DECL + + public: + explicit VertexAttachment(const String& name); + + virtual ~VertexAttachment(); + + void computeWorldVertices(Slot& slot, float* worldVertices); + void computeWorldVertices(Slot& slot, Vector& worldVertices); + + /// Transforms local vertices to world coordinates. + /// @param start The index of the first Vertices value to transform. Each vertex has 2 values, x and y. + /// @param count The number of world vertex values to output. Must be less than or equal to WorldVerticesLength - start. + /// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + count. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. + void computeWorldVertices(Slot& slot, size_t start, size_t count, float* worldVertices, size_t offset, size_t stride = 2); + void computeWorldVertices(Slot& slot, size_t start, size_t count, Vector& worldVertices, size_t offset, size_t stride = 2); + + /// @return true if a deform originally applied to the specified attachment should be applied to this attachment. + virtual bool applyDeform(VertexAttachment* sourceAttachment); + + /// Gets a unique ID for this attachment. + int getId(); + + Vector& getBones(); + + Vector& getVertices(); + + size_t getWorldVerticesLength(); + void setWorldVerticesLength(size_t inValue); + + protected: + Vector _bones; + Vector _vertices; + size_t _worldVerticesLength; + + private: + const int _id; + + static int getNextID(); + }; +} + +#endif /* Spine_VertexAttachment_h */ diff --git a/cocos/editor-support/spine/VertexEffect.c b/cocos/editor-support/spine/VertexEffect.c deleted file mode 100644 index 68d4d1f6804..00000000000 --- a/cocos/editor-support/spine/VertexEffect.c +++ /dev/null @@ -1,98 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -void _spJitterVertexEffect_begin(spVertexEffect* self, spSkeleton* skeleton) { -} - -void _spJitterVertexEffect_transform(spVertexEffect* self, float* x, float* y, float* u, float* v, spColor* light, spColor* dark) { - spJitterVertexEffect* internal = (spJitterVertexEffect*)self; - float jitterX = internal->jitterX; - float jitterY = internal->jitterY; - (*x) += _spMath_randomTriangular(-jitterX, jitterY); - (*y) += _spMath_randomTriangular(-jitterX, jitterY); -} - -void _spJitterVertexEffect_end(spVertexEffect* self) { -} - -spJitterVertexEffect* spJitterVertexEffect_create(float jitterX, float jitterY) { - spJitterVertexEffect* effect = CALLOC(spJitterVertexEffect, 1); - effect->super.begin = _spJitterVertexEffect_begin; - effect->super.transform = _spJitterVertexEffect_transform; - effect->super.end = _spJitterVertexEffect_end; - effect->jitterX = jitterX; - effect->jitterY = jitterY; - return effect; -} - -void spJitterVertexEffect_dispose(spJitterVertexEffect* effect) { - FREE(effect); -} - -void _spSwirlVertexEffect_begin(spVertexEffect* self, spSkeleton* skeleton) { - spSwirlVertexEffect* internal = (spSwirlVertexEffect*)self; - internal->worldX = skeleton->x + internal->centerX; - internal->worldY = skeleton->y + internal->centerY; -} - -void _spSwirlVertexEffect_transform(spVertexEffect* self, float* positionX, float* positionY, float* u, float* v, spColor* light, spColor* dark) { - spSwirlVertexEffect* internal = (spSwirlVertexEffect*)self; - float radAngle = internal->angle * DEG_RAD; - float x = *positionX - internal->worldX; - float y = *positionY - internal->worldY; - float dist = SQRT(x * x + y * y); - if (dist < internal->radius) { - float theta = _spMath_interpolate(_spMath_pow2_apply, 0, radAngle, (internal->radius - dist) / internal->radius); - float cosine = COS(theta); - float sine = SIN(theta); - (*positionX) = cosine * x - sine * y + internal->worldX; - (*positionY) = sine * x + cosine * y + internal->worldY; - } -} - -void _spSwirlVertexEffect_end(spVertexEffect* self) { -} - -spSwirlVertexEffect* spSwirlVertexEffect_create(float radius) { - spSwirlVertexEffect* effect = CALLOC(spSwirlVertexEffect, 1); - effect->super.begin = _spSwirlVertexEffect_begin; - effect->super.transform = _spSwirlVertexEffect_transform; - effect->super.end = _spSwirlVertexEffect_end; - effect->radius = radius; - return effect; -} - -void spSwirlVertexEffect_dispose(spSwirlVertexEffect* effect) { - FREE(effect); -} - diff --git a/cocos/editor-support/spine/VertexEffect.cpp b/cocos/editor-support/spine/VertexEffect.cpp new file mode 100644 index 00000000000..18bf150abbd --- /dev/null +++ b/cocos/editor-support/spine/VertexEffect.cpp @@ -0,0 +1,160 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + +#include +#include +#include + +using namespace spine; + +JitterVertexEffect::JitterVertexEffect(float jitterX, float jitterY): _jitterX(jitterX), _jitterY(jitterY) { +} + +void JitterVertexEffect::begin(Skeleton &skeleton) { + SP_UNUSED(skeleton); +} + +void JitterVertexEffect::transform(float &x, float &y, float &u, float &v, Color &light, Color &dark) { + SP_UNUSED(u); + SP_UNUSED(v); + SP_UNUSED(light); + SP_UNUSED(dark); + float jitterX = _jitterX; + float jitterY = _jitterY; + x += MathUtil::randomTriangular(-jitterX, jitterX); + y += MathUtil::randomTriangular(-jitterX, jitterY); +} + +void JitterVertexEffect::end() { +} + +void JitterVertexEffect::setJitterX(float jitterX) { + _jitterX = jitterX; +} + +float JitterVertexEffect::getJitterX() { + return _jitterX; +} + +void JitterVertexEffect::setJitterY(float jitterY) { + _jitterY = jitterY; +} + +float JitterVertexEffect::getJitterY() { + return _jitterY; +} + +SwirlVertexEffect::SwirlVertexEffect(float radius, Interpolation &interpolation): + _centerX(0), + _centerY(0), + _radius(radius), + _angle(0), + _worldX(0), + _worldY(0), + _interpolation(interpolation) { +} + +void SwirlVertexEffect::begin(Skeleton &skeleton) { + _worldX = skeleton.getX() + _centerX; + _worldY = skeleton.getY() + _centerY; +} + +void SwirlVertexEffect::transform(float &positionX, float &positionY, float &u, float &v, Color &light, Color &dark) { + SP_UNUSED(u); + SP_UNUSED(v); + SP_UNUSED(light); + SP_UNUSED(dark); + + float x = positionX - _worldX; + float y = positionY - _worldY; + float dist = (float)MathUtil::sqrt(x * x + y * y); + if (dist < _radius) { + float theta = _interpolation.interpolate(0, _angle, (_radius - dist) / _radius); + float cos = MathUtil::cos(theta), sin = MathUtil::sin(theta); + positionX = cos * x - sin * y + _worldX; + positionY = sin * x + cos * y + _worldY; + } +} + +void SwirlVertexEffect::end() { + +} + +void SwirlVertexEffect::setCenterX(float centerX) { + _centerX = centerX; +} + +float SwirlVertexEffect::getCenterX() { + return _centerX; +} + +void SwirlVertexEffect::setCenterY(float centerY) { + _centerY = centerY; +} + +float SwirlVertexEffect::getCenterY() { + return _centerY; +} + +void SwirlVertexEffect::setRadius(float radius) { + _radius = radius; +} + +float SwirlVertexEffect::getRadius() { + return _radius; +} + +void SwirlVertexEffect::setAngle(float angle) { + _angle = angle * MathUtil::Deg_Rad; +} + +float SwirlVertexEffect::getAngle() { + return _angle; +} + +void SwirlVertexEffect::setWorldX(float worldX) { + _worldX = worldX; +} + +float SwirlVertexEffect::getWorldX() { + return _worldX; +} + +void SwirlVertexEffect::setWorldY(float worldY) { + _worldY = worldY; +} + +float SwirlVertexEffect::getWorldY() { + return _worldY; +} diff --git a/cocos/editor-support/spine/VertexEffect.h b/cocos/editor-support/spine/VertexEffect.h index 4f670119b3c..45fffe461c9 100644 --- a/cocos/editor-support/spine/VertexEffect.h +++ b/cocos/editor-support/spine/VertexEffect.h @@ -28,58 +28,79 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef SPINE_VERTEXEFFECT_H_ -#define SPINE_VERTEXEFFECT_H_ +#ifndef Spine_VertexEffect_h +#define Spine_VertexEffect_h -#include -#include -#include +#include +#include -#ifdef __cplusplus -extern "C" { -#endif +namespace spine { -struct spVertexEffect; +class Skeleton; +class Color; -typedef void (*spVertexEffectBegin)(struct spVertexEffect *self, spSkeleton *skeleton); +class SP_API VertexEffect: public SpineObject { +public: + virtual void begin(Skeleton& skeleton) = 0; + virtual void transform(float& x, float& y, float &u, float &v, Color &light, Color &dark) = 0; + virtual void end() = 0; +}; -typedef void (*spVertexEffectTransform)(struct spVertexEffect *self, float *x, float *y, float *u, float *v, - spColor *light, spColor *dark); +class SP_API JitterVertexEffect: public VertexEffect { +public: + JitterVertexEffect(float jitterX, float jitterY); -typedef void (*spVertexEffectEnd)(struct spVertexEffect *self); + void begin(Skeleton& skeleton); + void transform(float& x, float& y, float &u, float &v, Color &light, Color &dark); + void end(); -typedef struct spVertexEffect { - spVertexEffectBegin begin; - spVertexEffectTransform transform; - spVertexEffectEnd end; -} spVertexEffect; + void setJitterX(float jitterX); + float getJitterX(); -typedef struct spJitterVertexEffect { - spVertexEffect super; - float jitterX; - float jitterY; -} spJitterVertexEffect; + void setJitterY(float jitterY); + float getJitterY(); -typedef struct spSwirlVertexEffect { - spVertexEffect super; - float centerX; - float centerY; - float radius; - float angle; - float worldX; - float worldY; -} spSwirlVertexEffect; +protected: + float _jitterX; + float _jitterY; +}; -SP_API spJitterVertexEffect *spJitterVertexEffect_create(float jitterX, float jitterY); +class SP_API SwirlVertexEffect: public VertexEffect { +public: + SwirlVertexEffect(float radius, Interpolation &interpolation); -SP_API void spJitterVertexEffect_dispose(spJitterVertexEffect *effect); + void begin(Skeleton& skeleton); + void transform(float& x, float& y, float &u, float &v, Color &light, Color &dark); + void end(); -SP_API spSwirlVertexEffect *spSwirlVertexEffect_create(float radius); + void setCenterX(float centerX); + float getCenterX(); -SP_API void spSwirlVertexEffect_dispose(spSwirlVertexEffect *effect); + void setCenterY(float centerY); + float getCenterY(); -#ifdef __cplusplus + void setRadius(float radius); + float getRadius(); + + void setAngle(float angle); + float getAngle(); + + void setWorldX(float worldX); + float getWorldX(); + + void setWorldY(float worldY); + float getWorldY(); + +protected: + float _centerX; + float _centerY; + float _radius; + float _angle; + float _worldX; + float _worldY; + + Interpolation& _interpolation; +}; } -#endif -#endif /* SPINE_VERTEX_EFFECT_H_ */ +#endif /* Spine_VertexEffect_h */ diff --git a/cocos/editor-support/spine/Vertices.h b/cocos/editor-support/spine/Vertices.h new file mode 100644 index 00000000000..90b4b39c14e --- /dev/null +++ b/cocos/editor-support/spine/Vertices.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Vertices_h +#define Spine_Vertices_h + +#include + +namespace spine { +class SP_API Vertices : public SpineObject { +public: + Vector _bones; + Vector _vertices; +}; +} + +#endif /* Spine_Vertices_h */ diff --git a/cocos/editor-support/spine/extension.c b/cocos/editor-support/spine/extension.c deleted file mode 100644 index e9937cca08b..00000000000 --- a/cocos/editor-support/spine/extension.c +++ /dev/null @@ -1,128 +0,0 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -float _spInternalRandom () { - return rand() / (float)RAND_MAX; -} - -static void* (*mallocFunc) (size_t size) = malloc; -static void* (*reallocFunc) (void* ptr, size_t size) = realloc; -static void* (*debugMallocFunc) (size_t size, const char* file, int line) = NULL; -static void (*freeFunc) (void* ptr) = free; -static float (*randomFunc) () = _spInternalRandom; - -void* _spMalloc (size_t size, const char* file, int line) { - if(debugMallocFunc) - return debugMallocFunc(size, file, line); - - return mallocFunc(size); -} -void* _spCalloc (size_t num, size_t size, const char* file, int line) { - void* ptr = _spMalloc(num * size, file, line); - if (ptr) memset(ptr, 0, num * size); - return ptr; -} -void* _spRealloc(void* ptr, size_t size) { - return reallocFunc(ptr, size); -} -void _spFree (void* ptr) { - freeFunc(ptr); -} - -float _spRandom () { - return randomFunc(); -} - -void _spSetDebugMalloc(void* (*malloc) (size_t size, const char* file, int line)) { - debugMallocFunc = malloc; -} - -void _spSetMalloc (void* (*malloc) (size_t size)) { - mallocFunc = malloc; -} - -void _spSetRealloc (void* (*realloc) (void* ptr, size_t size)) { - reallocFunc = realloc; -} - -void _spSetFree (void (*free) (void* ptr)) { - freeFunc = free; -} - -void _spSetRandom (float (*random) ()) { - randomFunc = random; -} - -char* _spReadFile (const char* path, int* length) { - char *data; - FILE *file = fopen(path, "rb"); - if (!file) return 0; - - fseek(file, 0, SEEK_END); - *length = (int)ftell(file); - fseek(file, 0, SEEK_SET); - - data = MALLOC(char, *length); - fread(data, 1, *length, file); - fclose(file); - - return data; -} - -float _spMath_random(float min, float max) { - return min + (max - min) * _spRandom(); -} - -float _spMath_randomTriangular(float min, float max) { - return _spMath_randomTriangularWith(min, max, (min + max) * 0.5f); -} - -float _spMath_randomTriangularWith(float min, float max, float mode) { - float u = _spRandom(); - float d = max - min; - if (u <= (mode - min) / d) return min + SQRT(u * d * (mode - min)); - return max - SQRT((1 - u) * d * (max - mode)); -} - -float _spMath_interpolate(float (*apply) (float a), float start, float end, float a) { - return start + (end - start) * apply(a); -} - -float _spMath_pow2_apply(float a) { - if (a <= 0.5) return POW(a * 2, 2) / 2; - return POW((a - 1) * 2, 2) / -2 + 1; -} - -float _spMath_pow2out_apply(float a) { - return POW(a - 1, 2) * -1 + 1; -} diff --git a/cocos/editor-support/spine/extension.h b/cocos/editor-support/spine/extension.h index 2d1adaee46f..95d9cd9fea1 100644 --- a/cocos/editor-support/spine/extension.h +++ b/cocos/editor-support/spine/extension.h @@ -28,293 +28,91 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -/* - Implementation notes: - - - An OOP style is used where each "class" is made up of a struct and a number of functions prefixed with the struct name. - - - struct fields that are const are readonly. Either they are set in a create function and can never be changed, or they can only - be changed by calling a function. - - - Inheritance is done using a struct field named "super" as the first field, allowing the struct to be cast to its "super class". - This works because a pointer to a struct is guaranteed to be a pointer to the first struct field. - - - Classes intended for inheritance provide init/deinit functions which subclasses must call in their create/dispose functions. - - - Polymorphism is done by a base class providing function pointers in its init function. The public API delegates to these - function pointers. - - - Subclasses do not provide a dispose function, instead the base class' dispose function should be used, which will delegate to - a dispose function pointer. - - - Classes not designed for inheritance cannot be extended because they may use an internal subclass to hide private data and don't - expose function pointers. - - - The public API hides implementation details, such as init/deinit functions. An internal API is exposed by extension.h to allow - classes to be extended. Internal functions begin with underscore (_). - - - OOP in C tends to lose type safety. Macros for casting are provided in extension.h to give context for why a cast is being done. - - - If SPINE_SHORT_NAMES is defined, the "sp" prefix for all class names is optional. - */ - -#ifndef SPINE_EXTENSION_H_ -#define SPINE_EXTENSION_H_ - -#include - -/* All allocation uses these. */ -#define MALLOC(TYPE,COUNT) ((TYPE*)_spMalloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__)) -#define CALLOC(TYPE,COUNT) ((TYPE*)_spCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__)) -#define REALLOC(PTR,TYPE,COUNT) ((TYPE*)_spRealloc(PTR, sizeof(TYPE) * (COUNT))) -#define NEW(TYPE) CALLOC(TYPE,1) - -/* Gets the direct super class. Type safe. */ -#define SUPER(VALUE) (&VALUE->super) - -/* Cast to a super class. Not type safe, use with care. Prefer SUPER() where possible. */ -#define SUPER_CAST(TYPE,VALUE) ((TYPE*)VALUE) - -/* Cast to a sub class. Not type safe, use with care. */ -#define SUB_CAST(TYPE,VALUE) ((TYPE*)VALUE) - -/* Casts away const. Can be used as an lvalue. Not type safe, use with care. */ -#define CONST_CAST(TYPE,VALUE) (*(TYPE*)&VALUE) - -/* Gets the vtable for the specified type. Not type safe, use with care. */ -#define VTABLE(TYPE,VALUE) ((_##TYPE##Vtable*)((TYPE*)VALUE)->vtable) - -/* Frees memory. Can be used on const types. */ -#define FREE(VALUE) _spFree((void*)VALUE) - -/* Allocates a new char[], assigns it to TO, and copies FROM to it. Can be used on const types. */ -#define MALLOC_STR(TO,FROM) strcpy(CONST_CAST(char*, TO) = (char*)MALLOC(char, strlen(FROM) + 1), FROM) - -#define PI 3.1415926535897932385f -#define PI2 (PI * 2) -#define DEG_RAD (PI / 180) -#define RAD_DEG (180 / PI) - -#define ABS(A) ((A) < 0? -(A): (A)) -#define SIGNUM(A) ((A) < 0? -1: (A) > 0 ? 1 : 0) - -#ifdef __STDC_VERSION__ -#define FMOD(A,B) fmodf(A, B) -#define ATAN2(A,B) atan2f(A, B) -#define SIN(A) sinf(A) -#define COS(A) cosf(A) -#define SQRT(A) sqrtf(A) -#define ACOS(A) acosf(A) -#define POW(A,B) pow(A, B) -#else -#define FMOD(A,B) (float)fmod(A, B) -#define ATAN2(A,B) (float)atan2(A, B) -#define COS(A) (float)cos(A) -#define SIN(A) (float)sin(A) -#define SQRT(A) (float)sqrt(A) -#define ACOS(A) (float)acos(A) -#define POW(A,B) (float)pow(A, B) -#endif - -#define SIN_DEG(A) SIN((A) * DEG_RAD) -#define COS_DEG(A) COS((A) * DEG_RAD) -#define CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) -#ifndef MIN -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#endif -#ifndef MAX -#define MAX(x, y) ((x) > (y) ? (x) : (y)) -#endif - -#define UNUSED(x) (void)(x) +#ifndef Spine_Extension_h +#define Spine_Extension_h #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Functions that must be implemented: - */ - -void _spAtlasPage_createTexture (spAtlasPage* self, const char* path); -void _spAtlasPage_disposeTexture (spAtlasPage* self); -char* _spUtil_readFile (const char* path, int* length); - -#ifdef SPINE_SHORT_NAMES -#define _AtlasPage_createTexture(...) _spAtlasPage_createTexture(__VA_ARGS__) -#define _AtlasPage_disposeTexture(...) _spAtlasPage_disposeTexture(__VA_ARGS__) -#define _Util_readFile(...) _spUtil_readFile(__VA_ARGS__) -#endif - -/* - * Internal API available for extension: - */ - -void* _spMalloc (size_t size, const char* file, int line); -void* _spCalloc (size_t num, size_t size, const char* file, int line); -void* _spRealloc(void* ptr, size_t size); -void _spFree (void* ptr); -float _spRandom (); - -SP_API void _spSetMalloc (void* (*_malloc) (size_t size)); -SP_API void _spSetDebugMalloc (void* (*_malloc) (size_t size, const char* file, int line)); -SP_API void _spSetRealloc(void* (*_realloc) (void* ptr, size_t size)); -SP_API void _spSetFree (void (*_free) (void* ptr)); -SP_API void _spSetRandom(float (*_random) ()); - -char* _spReadFile (const char* path, int* length); - - -/* - * Math utilities - */ -float _spMath_random(float min, float max); -float _spMath_randomTriangular(float min, float max); -float _spMath_randomTriangularWith(float min, float max, float mode); -float _spMath_interpolate(float (*apply) (float a), float start, float end, float a); -float _spMath_pow2_apply(float a); -float _spMath_pow2out_apply(float a); +#include -/**/ +#define SP_UNUSED(x) (void)(x) -typedef union _spEventQueueItem { - int type; - spTrackEntry* entry; - spEvent* event; -} _spEventQueueItem; +namespace spine { +class String; -typedef struct _spAnimationState _spAnimationState; +class SP_API SpineExtension { +public: + template + static T *alloc(size_t num, const char *file, int line) { + return (T *) getInstance()->_alloc(sizeof(T) * num, file, line); + } -typedef struct _spEventQueue { - _spAnimationState* state; - _spEventQueueItem* objects; - int objectsCount; - int objectsCapacity; - int /*boolean*/ drainDisabled; + template + static T *calloc(size_t num, const char *file, int line) { + return (T *) getInstance()->_calloc(sizeof(T) * num, file, line); + } -#ifdef __cplusplus - _spEventQueue() : - state(0), - objects(0), - objectsCount(0), - objectsCapacity(0), - drainDisabled(0) { + template + static T *realloc(T *ptr, size_t num, const char *file, int line) { + return (T *) getInstance()->_realloc(ptr, sizeof(T) * num, file, line); } -#endif -} _spEventQueue; -struct _spAnimationState { - spAnimationState super; + template + static void free(T *ptr, const char *file, int line) { + getInstance()->_free((void *) ptr, file, line); + } - int eventsCount; - spEvent** events; + static char *readFile(const String &path, int *length) { + return getInstance()->_readFile(path, length); + } - _spEventQueue* queue; + static void setInstance(SpineExtension *inSpineExtension); - int* propertyIDs; - int propertyIDsCount; - int propertyIDsCapacity; + static SpineExtension *getInstance(); - int /*boolean*/ animationsChanged; + virtual ~SpineExtension(); -#ifdef __cplusplus - _spAnimationState() : - super(), - eventsCount(0), - events(0), - queue(0), - propertyIDs(0), - propertyIDsCount(0), - propertyIDsCapacity(0), - animationsChanged(0) { - } -#endif -}; + /// Implement this function to use your own memory allocator + virtual void *_alloc(size_t size, const char *file, int line) = 0; + virtual void *_calloc(size_t size, const char *file, int line) = 0; -/**/ + virtual void *_realloc(void *ptr, size_t size, const char *file, int line) = 0; -/* configureAttachment and disposeAttachment may be 0. */ -void _spAttachmentLoader_init (spAttachmentLoader* self, - void (*dispose) (spAttachmentLoader* self), - spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, - const char* path), - void (*configureAttachment) (spAttachmentLoader* self, spAttachment*), - void (*disposeAttachment) (spAttachmentLoader* self, spAttachment*) -); -void _spAttachmentLoader_deinit (spAttachmentLoader* self); -/* Can only be called from createAttachment. */ -void _spAttachmentLoader_setError (spAttachmentLoader* self, const char* error1, const char* error2); -void _spAttachmentLoader_setUnknownTypeError (spAttachmentLoader* self, spAttachmentType type); + /// If you provide a spineAllocFunc, you should also provide a spineFreeFunc + virtual void _free(void *mem, const char *file, int line) = 0; -#ifdef SPINE_SHORT_NAMES -#define _AttachmentLoader_init(...) _spAttachmentLoader_init(__VA_ARGS__) -#define _AttachmentLoader_deinit(...) _spAttachmentLoader_deinit(__VA_ARGS__) -#define _AttachmentLoader_setError(...) _spAttachmentLoader_setError(__VA_ARGS__) -#define _AttachmentLoader_setUnknownTypeError(...) _spAttachmentLoader_setUnknownTypeError(__VA_ARGS__) -#endif + virtual char *_readFile(const String &path, int *length) = 0; -/**/ +protected: + SpineExtension(); -void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType type, -void (*dispose) (spAttachment* self)); -void _spAttachment_deinit (spAttachment* self); -void _spVertexAttachment_init (spVertexAttachment* self); -void _spVertexAttachment_deinit (spVertexAttachment* self); +private: + static SpineExtension *_instance; +}; -#ifdef SPINE_SHORT_NAMES -#define _Attachment_init(...) _spAttachment_init(__VA_ARGS__) -#define _Attachment_deinit(...) _spAttachment_deinit(__VA_ARGS__) -#define _VertexAttachment_deinit(...) _spVertexAttachment_deinit(__VA_ARGS__) -#endif +class SP_API DefaultSpineExtension : public SpineExtension { +public: + DefaultSpineExtension(); -/**/ + virtual ~DefaultSpineExtension(); -void _spTimeline_init (spTimeline* self, spTimelineType type, - void (*dispose) (spTimeline* self), - void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, - int* eventsCount, float alpha, spMixPose pose, spMixDirection direction), - int (*getPropertyId) (const spTimeline* self)); -void _spTimeline_deinit (spTimeline* self); +protected: + virtual void *_alloc(size_t size, const char *file, int line); -#ifdef SPINE_SHORT_NAMES -#define _Timeline_init(...) _spTimeline_init(__VA_ARGS__) -#define _Timeline_deinit(...) _spTimeline_deinit(__VA_ARGS__) -#endif + virtual void *_calloc(size_t size, const char *file, int line); -/**/ + virtual void *_realloc(void *ptr, size_t size, const char *file, int line); -void _spCurveTimeline_init (spCurveTimeline* self, spTimelineType type, int framesCount, - void (*dispose) (spTimeline* self), - void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction), - int (*getPropertyId) (const spTimeline* self)); -void _spCurveTimeline_deinit (spCurveTimeline* self); -int _spCurveTimeline_binarySearch (float *values, int valuesLength, float target, int step); + virtual void _free(void *mem, const char *file, int line); -#ifdef SPINE_SHORT_NAMES -#define _CurveTimeline_init(...) _spCurveTimeline_init(__VA_ARGS__) -#define _CurveTimeline_deinit(...) _spCurveTimeline_deinit(__VA_ARGS__) -#define _CurveTimeline_binarySearch(...) _spCurveTimeline_binarySearch(__VA_ARGS__) -#endif + virtual char *_readFile(const String &path, int *length); +}; -#ifdef __cplusplus +// This function is to be implemented by engine specific runtimes to provide +// the default extension for that engine. It is called the first time +// SpineExtension::getInstance() is called, when no instance has been set +// yet. +extern SpineExtension *getDefaultExtension(); } -#endif -#endif /* SPINE_EXTENSION_H_ */ +#endif /* Spine_Extension_h */ diff --git a/cocos/editor-support/spine/kvec.h b/cocos/editor-support/spine/kvec.h deleted file mode 100644 index f40e8bb95af..00000000000 --- a/cocos/editor-support/spine/kvec.h +++ /dev/null @@ -1,105 +0,0 @@ -/* The MIT License - - Copyright (c) 2008, by Attractive Chaos - - 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. -*/ - -/* - An example: - -#include "kvec.h" -int main() { - kvec_t(int) array; - kv_init(array); - kv_push(int, array, 10); // append - kv_a(int, array, 20) = 5; // dynamic - kv_A(array, 20) = 4; // static - kv_destroy(array); - return 0; -} -*/ - -/* - 2008-09-22 (0.1.0): - - * The initial version. - - 2017-19-18 (0.1.1): - - Spine Special Edition - * Made helper macros for alloc, free and memcpy, which can be overridden. - * Made these helpers point to the Spine C Runtime alloc and free functions by default - * Reimplemented kv_resize to use alloc and free instead of realloc - * Changed kv_push to use kv_resize instead of realloc - * Removed kv_pushp and kv_a macros because the weren't used - * Removed stdlib include -*/ - -#ifndef AC_KVEC_H -#define AC_KVEC_H - -#ifndef _kv_free -#define _kv_free(type, p) (FREE(p)) -#endif - -#ifndef _kv_alloc -#define _kv_alloc(type, s) ((type*)(MALLOC(type, (s)))) -#endif - -#ifndef _kv_copy -#define _kv_copy(type, d, s, n) memcpy((d), (s), sizeof(type) * (n)) -#endif - -#define kv_roundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) - -#define kvec_t(type) struct { size_t n, m; type *a; } -#define kv_init(v) ((v).n = (v).m = 0, (v).a = 0) -#define kv_destroy(v) _kv_free(type, (v).a) -#define kv_A(v, i) ((v).a[(i)]) -#define kv_array(v) ((v).a) -#define kv_pop(v) ((v).a[--(v).n]) -#define kv_size(v) ((v).n) -#define kv_max(v) ((v).m) - -#define kv_resize(type, v, s) do { \ - type* b = _kv_alloc(type, (s)); \ - if (((s) > 0) && ((v).m > 0)) \ - _kv_copy(type, b, (v).a, ((s) < (v).m)? (s) : (v).m); \ - _kv_free(type, (v).a); \ - (v).a = b; (v).m = (s); \ - } while (0) - -#define kv_trim(type, v) kv_resize(type, (v), kv_size(v)) - -#define kv_copy(type, v1, v0) do { \ - if ((v1).m < (v0).n) kv_resize(type, v1, (v0).n); \ - (v1).n = (v0).n; \ - _kv_copy(type, (v1).a, (v0).a, (v0).n); \ - } while (0) \ - -#define kv_push(type, v, x) do { \ - if ((v).n == (v).m) \ - kv_resize(type, (v), ((v).m? (v).m<<1 : 2)); \ - (v).a[(v).n++] = (x); \ - } while (0) - -#endif diff --git a/cocos/editor-support/spine/spine.h b/cocos/editor-support/spine/spine.h index 5085ed8e3c2..00ab72c4cf8 100644 --- a/cocos/editor-support/spine/spine.h +++ b/cocos/editor-support/spine/spine.h @@ -1,63 +1,114 @@ -/****************************************************************************** - * Spine Runtimes Software License v2.5 - * - * Copyright (c) 2013-2016, Esoteric Software - * All rights reserved. - * - * You are granted a perpetual, non-exclusive, non-sublicensable, and - * non-transferable license to use, install, execute, and perform the Spine - * Runtimes software and derivative works solely for personal or internal - * use. Without the written permission of Esoteric Software (see Section 2 of - * the Spine Software License Agreement), you may not (a) modify, translate, - * adapt, or develop new applications using the Spine Runtimes or otherwise - * create derivative works or improvements of the Spine Runtimes or (b) remove, - * delete, alter, or obscure any trademarks or any copyright, trademark, patent, - * or other intellectual property or proprietary rights notices on or in the - * Software, including any copy thereof. Redistributions in binary or source - * form must include this license and terms. - * - * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF - * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef SPINE_SPINE_H_ -#define SPINE_SPINE_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* SPINE_SPINE_H_ */ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef SPINE_SPINE_H_ +#define SPINE_SPINE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js index ae7494ae99b..6cfa326c934 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_spine_auto_api.js @@ -4,7 +4,6067 @@ var spine = spine || {}; /** - * @class SpineRenderer + * @class Animation + */ +spine.Animation = { + +/** + * @method getTimelines + * @return {sp.Vector} + */ +getTimelines : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method setDuration + * @param {float} arg0 + */ +setDuration : function ( +float +) +{ +}, + +/** + * @method getDuration + * @return {float} + */ +getDuration : function ( +) +{ + return 0; +}, + +}; + +/** + * @class TrackEntry + */ +spine.TrackEntry = { + +/** + * @method getNext + * @return {sp.TrackEntry} + */ +getNext : function ( +) +{ + return sp.TrackEntry; +}, + +/** + * @method getAttachmentThreshold + * @return {float} + */ +getAttachmentThreshold : function ( +) +{ + return 0; +}, + +/** + * @method setTimeScale + * @param {float} arg0 + */ +setTimeScale : function ( +float +) +{ +}, + +/** + * @method getMixDuration + * @return {float} + */ +getMixDuration : function ( +) +{ + return 0; +}, + +/** + * @method setAnimationEnd + * @param {float} arg0 + */ +setAnimationEnd : function ( +float +) +{ +}, + +/** + * @method setEventThreshold + * @param {float} arg0 + */ +setEventThreshold : function ( +float +) +{ +}, + +/** + * @method getMixingTo + * @return {sp.TrackEntry} + */ +getMixingTo : function ( +) +{ + return sp.TrackEntry; +}, + +/** + * @method setTrackEnd + * @param {float} arg0 + */ +setTrackEnd : function ( +float +) +{ +}, + +/** + * @method getMixBlend + * @return {sp.MixBlend} + */ +getMixBlend : function ( +) +{ + return 0; +}, + +/** + * @method getTrackEnd + * @return {float} + */ +getTrackEnd : function ( +) +{ + return 0; +}, + +/** + * @method setDelay + * @param {float} arg0 + */ +setDelay : function ( +float +) +{ +}, + +/** + * @method getAnimationEnd + * @return {float} + */ +getAnimationEnd : function ( +) +{ + return 0; +}, + +/** + * @method setAttachmentThreshold + * @param {float} arg0 + */ +setAttachmentThreshold : function ( +float +) +{ +}, + +/** + * @method setMixTime + * @param {float} arg0 + */ +setMixTime : function ( +float +) +{ +}, + +/** + * @method isComplete + * @return {bool} + */ +isComplete : function ( +) +{ + return false; +}, + +/** + * @method getMixingFrom + * @return {sp.TrackEntry} + */ +getMixingFrom : function ( +) +{ + return sp.TrackEntry; +}, + +/** + * @method setAlpha + * @param {float} arg0 + */ +setAlpha : function ( +float +) +{ +}, + +/** + * @method getDrawOrderThreshold + * @return {float} + */ +getDrawOrderThreshold : function ( +) +{ + return 0; +}, + +/** + * @method getMixTime + * @return {float} + */ +getMixTime : function ( +) +{ + return 0; +}, + +/** + * @method setTrackTime + * @param {float} arg0 + */ +setTrackTime : function ( +float +) +{ +}, + +/** + * @method setMixDuration + * @param {float} arg0 + */ +setMixDuration : function ( +float +) +{ +}, + +/** + * @method resetRotationDirections + */ +resetRotationDirections : function ( +) +{ +}, + +/** + * @method setHoldPrevious + * @param {bool} arg0 + */ +setHoldPrevious : function ( +bool +) +{ +}, + +/** + * @method getLoop + * @return {bool} + */ +getLoop : function ( +) +{ + return false; +}, + +/** + * @method getTrackTime + * @return {float} + */ +getTrackTime : function ( +) +{ + return 0; +}, + +/** + * @method getAnimationStart + * @return {float} + */ +getAnimationStart : function ( +) +{ + return 0; +}, + +/** + * @method getAnimationLast + * @return {float} + */ +getAnimationLast : function ( +) +{ + return 0; +}, + +/** + * @method setAnimationStart + * @param {float} arg0 + */ +setAnimationStart : function ( +float +) +{ +}, + +/** + * @method setLoop + * @param {bool} arg0 + */ +setLoop : function ( +bool +) +{ +}, + +/** + * @method getTrackIndex + * @return {int} + */ +getTrackIndex : function ( +) +{ + return 0; +}, + +/** + * @method getTimeScale + * @return {float} + */ +getTimeScale : function ( +) +{ + return 0; +}, + +/** + * @method getDelay + * @return {float} + */ +getDelay : function ( +) +{ + return 0; +}, + +/** + * @method getAnimation + * @return {sp.Animation} + */ +getAnimation : function ( +) +{ + return sp.Animation; +}, + +/** + * @method getHoldPrevious + * @return {bool} + */ +getHoldPrevious : function ( +) +{ + return false; +}, + +/** + * @method getAnimationTime + * @return {float} + */ +getAnimationTime : function ( +) +{ + return 0; +}, + +/** + * @method getEventThreshold + * @return {float} + */ +getEventThreshold : function ( +) +{ + return 0; +}, + +/** + * @method setDrawOrderThreshold + * @param {float} arg0 + */ +setDrawOrderThreshold : function ( +float +) +{ +}, + +/** + * @method setAnimationLast + * @param {float} arg0 + */ +setAnimationLast : function ( +float +) +{ +}, + +/** + * @method getAlpha + * @return {float} + */ +getAlpha : function ( +) +{ + return 0; +}, + +/** + * @method setMixBlend + * @param {sp.MixBlend} arg0 + */ +setMixBlend : function ( +mixblend +) +{ +}, + +}; + +/** + * @class AnimationState + */ +spine.AnimationState = { + +/** + * @method getData + * @return {sp.AnimationStateData} + */ +getData : function ( +) +{ + return sp.AnimationStateData; +}, + +/** + * @method addAnimation +* @param {unsigned int|unsigned int} int +* @param {sp.Animation|sp.String} animation +* @param {bool|bool} bool +* @param {float|float} float +* @return {sp.TrackEntry|sp.TrackEntry} +*/ +addAnimation : function( +int, +str, +bool, +float +) +{ + return sp.TrackEntry; +}, + +/** + * @method setEmptyAnimations + * @param {float} arg0 + */ +setEmptyAnimations : function ( +float +) +{ +}, + +/** + * @method getCurrent + * @param {unsigned int} arg0 + * @return {sp.TrackEntry} + */ +getCurrent : function ( +int +) +{ + return sp.TrackEntry; +}, + +/** + * @method enableQueue + */ +enableQueue : function ( +) +{ +}, + +/** + * @method clearTracks + */ +clearTracks : function ( +) +{ +}, + +/** + * @method update + * @param {float} arg0 + */ +update : function ( +float +) +{ +}, + +/** + * @method disableQueue + */ +disableQueue : function ( +) +{ +}, + +/** + * @method setEmptyAnimation + * @param {unsigned int} arg0 + * @param {float} arg1 + * @return {sp.TrackEntry} + */ +setEmptyAnimation : function ( +int, +float +) +{ + return sp.TrackEntry; +}, + +/** + * @method setTimeScale + * @param {float} arg0 + */ +setTimeScale : function ( +float +) +{ +}, + +/** + * @method getTracks + * @return {sp.Vector} + */ +getTracks : function ( +) +{ + return sp.Vector; +}, + +/** + * @method clearTrack + * @param {unsigned int} arg0 + */ +clearTrack : function ( +int +) +{ +}, + +/** + * @method setAnimation +* @param {unsigned int|unsigned int} int +* @param {sp.Animation|sp.String} animation +* @param {bool|bool} bool +* @return {sp.TrackEntry|sp.TrackEntry} +*/ +setAnimation : function( +int, +str, +bool +) +{ + return sp.TrackEntry; +}, + +/** + * @method addEmptyAnimation + * @param {unsigned int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @return {sp.TrackEntry} + */ +addEmptyAnimation : function ( +int, +float, +float +) +{ + return sp.TrackEntry; +}, + +/** + * @method getTimeScale + * @return {float} + */ +getTimeScale : function ( +) +{ + return 0; +}, + +}; + +/** + * @class AnimationStateData + */ +spine.AnimationStateData = { + +/** + * @method getMix + * @param {sp.Animation} arg0 + * @param {sp.Animation} arg1 + * @return {float} + */ +getMix : function ( +animation, +animation +) +{ + return 0; +}, + +/** + * @method getDefaultMix + * @return {float} + */ +getDefaultMix : function ( +) +{ + return 0; +}, + +/** + * @method setMix +* @param {sp.Animation|sp.String} animation +* @param {sp.Animation|sp.String} animation +* @param {float|float} float +*/ +setMix : function( +str, +str, +float +) +{ +}, + +/** + * @method setDefaultMix + * @param {float} arg0 + */ +setDefaultMix : function ( +float +) +{ +}, + +/** + * @method getSkeletonData + * @return {sp.SkeletonData} + */ +getSkeletonData : function ( +) +{ + return sp.SkeletonData; +}, + +}; + +/** + * @class Attachment + */ +spine.Attachment = { + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +}; + +/** + * @class Timeline + */ +spine.Timeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +}; + +/** + * @class AttachmentTimeline + */ +spine.AttachmentTimeline = { + +/** + * @method getAttachmentNames + * @return {sp.Vector} + */ +getAttachmentNames : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setSlotIndex + * @param {unsigned int} arg0 + */ +setSlotIndex : function ( +int +) +{ +}, + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {sp.String} arg2 + */ +setFrame : function ( +int, +float, +str +) +{ +}, + +/** + * @method getSlotIndex + * @return {unsigned int} + */ +getSlotIndex : function ( +) +{ + return 0; +}, + +/** + * @method getFrameCount + * @return {unsigned int} + */ +getFrameCount : function ( +) +{ + return 0; +}, + +/** + * @method getFrames + * @return {sp.Vector} + */ +getFrames : function ( +) +{ + return sp.Vector; +}, + +}; + +/** + * @class Bone + */ +spine.Bone = { + +/** + * @method setD + * @param {float} arg0 + */ +setD : function ( +float +) +{ +}, + +/** + * @method setAppliedRotation + * @param {float} arg0 + */ +setAppliedRotation : function ( +float +) +{ +}, + +/** + * @method setAScaleY + * @param {float} arg0 + */ +setAScaleY : function ( +float +) +{ +}, + +/** + * @method setAScaleX + * @param {float} arg0 + */ +setAScaleX : function ( +float +) +{ +}, + +/** + * @method getB + * @return {float} + */ +getB : function ( +) +{ + return 0; +}, + +/** + * @method getC + * @return {float} + */ +getC : function ( +) +{ + return 0; +}, + +/** + * @method getD + * @return {float} + */ +getD : function ( +) +{ + return 0; +}, + +/** + * @method getWorldScaleY + * @return {float} + */ +getWorldScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getX + * @return {float} + */ +getX : function ( +) +{ + return 0; +}, + +/** + * @method getY + * @return {float} + */ +getY : function ( +) +{ + return 0; +}, + +/** + * @method getChildren + * @return {sp.Vector} + */ +getChildren : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setWorldX + * @param {float} arg0 + */ +setWorldX : function ( +float +) +{ +}, + +/** + * @method setAppliedValid + * @param {bool} arg0 + */ +setAppliedValid : function ( +bool +) +{ +}, + +/** + * @method getRotation + * @return {float} + */ +getRotation : function ( +) +{ + return 0; +}, + +/** + * @method getAShearX + * @return {float} + */ +getAShearX : function ( +) +{ + return 0; +}, + +/** + * @method getAShearY + * @return {float} + */ +getAShearY : function ( +) +{ + return 0; +}, + +/** + * @method getWorldRotationY + * @return {float} + */ +getWorldRotationY : function ( +) +{ + return 0; +}, + +/** + * @method isAppliedValid + * @return {bool} + */ +isAppliedValid : function ( +) +{ + return false; +}, + +/** + * @method getScaleY + * @return {float} + */ +getScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getScaleX + * @return {float} + */ +getScaleX : function ( +) +{ + return 0; +}, + +/** + * @method setToSetupPose + */ +setToSetupPose : function ( +) +{ +}, + +/** + * @method getWorldToLocalRotationX + * @return {float} + */ +getWorldToLocalRotationX : function ( +) +{ + return 0; +}, + +/** + * @method getWorldToLocalRotationY + * @return {float} + */ +getWorldToLocalRotationY : function ( +) +{ + return 0; +}, + +/** + * @method getAScaleX + * @return {float} + */ +getAScaleX : function ( +) +{ + return 0; +}, + +/** + * @method getA + * @return {float} + */ +getA : function ( +) +{ + return 0; +}, + +/** + * @method setRotation + * @param {float} arg0 + */ +setRotation : function ( +float +) +{ +}, + +/** + * @method getAX + * @return {float} + */ +getAX : function ( +) +{ + return 0; +}, + +/** + * @method getData + * @return {sp.BoneData} + */ +getData : function ( +) +{ + return sp.BoneData; +}, + +/** + * @method setShearX + * @param {float} arg0 + */ +setShearX : function ( +float +) +{ +}, + +/** + * @method setShearY + * @param {float} arg0 + */ +setShearY : function ( +float +) +{ +}, + +/** + * @method setScaleY + * @param {float} arg0 + */ +setScaleY : function ( +float +) +{ +}, + +/** + * @method setScaleX + * @param {float} arg0 + */ +setScaleX : function ( +float +) +{ +}, + +/** + * @method setA + * @param {float} arg0 + */ +setA : function ( +float +) +{ +}, + +/** + * @method setB + * @param {float} arg0 + */ +setB : function ( +float +) +{ +}, + +/** + * @method getAScaleY + * @return {float} + */ +getAScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getWorldScaleX + * @return {float} + */ +getWorldScaleX : function ( +) +{ + return 0; +}, + +/** + * @method getWorldRotationX + * @return {float} + */ +getWorldRotationX : function ( +) +{ + return 0; +}, + +/** + * @method getShearX + * @return {float} + */ +getShearX : function ( +) +{ + return 0; +}, + +/** + * @method update + */ +update : function ( +) +{ +}, + +/** + * @method getShearY + * @return {float} + */ +getShearY : function ( +) +{ + return 0; +}, + +/** + * @method setAShearX + * @param {float} arg0 + */ +setAShearX : function ( +float +) +{ +}, + +/** + * @method setAShearY + * @param {float} arg0 + */ +setAShearY : function ( +float +) +{ +}, + +/** + * @method setC + * @param {float} arg0 + */ +setC : function ( +float +) +{ +}, + +/** + * @method setWorldY + * @param {float} arg0 + */ +setWorldY : function ( +float +) +{ +}, + +/** + * @method setX + * @param {float} arg0 + */ +setX : function ( +float +) +{ +}, + +/** + * @method setY + * @param {float} arg0 + */ +setY : function ( +float +) +{ +}, + +/** + * @method setAX + * @param {float} arg0 + */ +setAX : function ( +float +) +{ +}, + +/** + * @method setAY + * @param {float} arg0 + */ +setAY : function ( +float +) +{ +}, + +/** + * @method getAY + * @return {float} + */ +getAY : function ( +) +{ + return 0; +}, + +/** + * @method rotateWorld + * @param {float} arg0 + */ +rotateWorld : function ( +float +) +{ +}, + +/** + * @method getParent + * @return {sp.Bone} + */ +getParent : function ( +) +{ + return sp.Bone; +}, + +/** + * @method getAppliedRotation + * @return {float} + */ +getAppliedRotation : function ( +) +{ + return 0; +}, + +/** + * @method updateWorldTransform +* @param {float} float +* @param {float} float +* @param {float} float +* @param {float} float +* @param {float} float +* @param {float} float +* @param {float} float +*/ +updateWorldTransform : function( +float, +float, +float, +float, +float, +float, +float +) +{ +}, + +/** + * @method getWorldY + * @return {float} + */ +getWorldY : function ( +) +{ + return 0; +}, + +/** + * @method getWorldX + * @return {float} + */ +getWorldX : function ( +) +{ + return 0; +}, + +/** + * @method getSkeleton + * @return {sp.Skeleton} + */ +getSkeleton : function ( +) +{ + return sp.Skeleton; +}, + +/** + * @method isYDown + * @return {bool} + */ +isYDown : function ( +) +{ + return false; +}, + +/** + * @method setYDown + * @param {bool} arg0 + */ +setYDown : function ( +bool +) +{ +}, + +}; + +/** + * @class BoneData + */ +spine.BoneData = { + +/** + * @method getIndex + * @return {int} + */ +getIndex : function ( +) +{ + return 0; +}, + +/** + * @method setShearX + * @param {float} arg0 + */ +setShearX : function ( +float +) +{ +}, + +/** + * @method setScaleY + * @param {float} arg0 + */ +setScaleY : function ( +float +) +{ +}, + +/** + * @method setScaleX + * @param {float} arg0 + */ +setScaleX : function ( +float +) +{ +}, + +/** + * @method getParent + * @return {sp.BoneData} + */ +getParent : function ( +) +{ + return sp.BoneData; +}, + +/** + * @method getScaleY + * @return {float} + */ +getScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getScaleX + * @return {float} + */ +getScaleX : function ( +) +{ + return 0; +}, + +/** + * @method getLength + * @return {float} + */ +getLength : function ( +) +{ + return 0; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method getShearX + * @return {float} + */ +getShearX : function ( +) +{ + return 0; +}, + +/** + * @method getShearY + * @return {float} + */ +getShearY : function ( +) +{ + return 0; +}, + +/** + * @method setY + * @param {float} arg0 + */ +setY : function ( +float +) +{ +}, + +/** + * @method getX + * @return {float} + */ +getX : function ( +) +{ + return 0; +}, + +/** + * @method getY + * @return {float} + */ +getY : function ( +) +{ + return 0; +}, + +/** + * @method getRotation + * @return {float} + */ +getRotation : function ( +) +{ + return 0; +}, + +/** + * @method getTransformMode + * @return {sp.TransformMode} + */ +getTransformMode : function ( +) +{ + return 0; +}, + +/** + * @method setRotation + * @param {float} arg0 + */ +setRotation : function ( +float +) +{ +}, + +/** + * @method setX + * @param {float} arg0 + */ +setX : function ( +float +) +{ +}, + +/** + * @method setLength + * @param {float} arg0 + */ +setLength : function ( +float +) +{ +}, + +/** + * @method setShearY + * @param {float} arg0 + */ +setShearY : function ( +float +) +{ +}, + +/** + * @method setTransformMode + * @param {sp.TransformMode} arg0 + */ +setTransformMode : function ( +transformmode +) +{ +}, + +}; + +/** + * @class VertexAttachment + */ +spine.VertexAttachment = { + +/** + * @method getVertices + * @return {sp.Vector} + */ +getVertices : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getId + * @return {int} + */ +getId : function ( +) +{ + return 0; +}, + +/** + * @method getWorldVerticesLength + * @return {unsigned int} + */ +getWorldVerticesLength : function ( +) +{ + return 0; +}, + +/** + * @method applyDeform + * @param {sp.VertexAttachment} arg0 + * @return {bool} + */ +applyDeform : function ( +vertexattachment +) +{ + return false; +}, + +/** + * @method setWorldVerticesLength + * @param {unsigned int} arg0 + */ +setWorldVerticesLength : function ( +int +) +{ +}, + +}; + +/** + * @class BoundingBoxAttachment + */ +spine.BoundingBoxAttachment = { + +}; + +/** + * @class ClippingAttachment + */ +spine.ClippingAttachment = { + +/** + * @method setEndSlot + * @param {sp.SlotData} arg0 + */ +setEndSlot : function ( +slotdata +) +{ +}, + +/** + * @method getEndSlot + * @return {sp.SlotData} + */ +getEndSlot : function ( +) +{ + return sp.SlotData; +}, + +}; + +/** + * @class Color + */ +spine.Color = { + +/** + * @method clamp + * @return {sp.Color} + */ +clamp : function ( +) +{ + return sp.Color; +}, + +}; + +/** + * @class CurveTimeline + */ +spine.CurveTimeline = { + +/** + * @method setCurve + * @param {unsigned int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + * @param {float} arg4 + */ +setCurve : function ( +int, +float, +float, +float, +float +) +{ +}, + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setLinear + * @param {unsigned int} arg0 + */ +setLinear : function ( +int +) +{ +}, + +/** + * @method getFrameCount + * @return {unsigned int} + */ +getFrameCount : function ( +) +{ + return 0; +}, + +/** + * @method setStepped + * @param {unsigned int} arg0 + */ +setStepped : function ( +int +) +{ +}, + +/** + * @method getCurvePercent + * @param {unsigned int} arg0 + * @param {float} arg1 + * @return {float} + */ +getCurvePercent : function ( +int, +float +) +{ + return 0; +}, + +/** + * @method getCurveType + * @param {unsigned int} arg0 + * @return {float} + */ +getCurveType : function ( +int +) +{ + return 0; +}, + +}; + +/** + * @class ColorTimeline + */ +spine.ColorTimeline = { + +/** + * @method setSlotIndex + * @param {int} arg0 + */ +setSlotIndex : function ( +int +) +{ +}, + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + * @param {float} arg4 + * @param {float} arg5 + */ +setFrame : function ( +int, +float, +float, +float, +float, +float +) +{ +}, + +/** + * @method getSlotIndex + * @return {int} + */ +getSlotIndex : function ( +) +{ + return 0; +}, + +/** + * @method getFrames + * @return {sp.Vector} + */ +getFrames : function ( +) +{ + return sp.Vector; +}, + +}; + +/** + * @class DeformTimeline + */ +spine.DeformTimeline = { + +/** + * @method setSlotIndex + * @param {int} arg0 + */ +setSlotIndex : function ( +int +) +{ +}, + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method getSlotIndex + * @return {int} + */ +getSlotIndex : function ( +) +{ + return 0; +}, + +/** + * @method getAttachment + * @return {sp.VertexAttachment} + */ +getAttachment : function ( +) +{ + return sp.VertexAttachment; +}, + +/** + * @method setAttachment + * @param {sp.VertexAttachment} arg0 + */ +setAttachment : function ( +vertexattachment +) +{ +}, + +/** + * @method getFrames + * @return {sp.Vector} + */ +getFrames : function ( +) +{ + return sp.Vector; +}, + +}; + +/** + * @class DrawOrderTimeline + */ +spine.DrawOrderTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method getFrameCount + * @return {unsigned int} + */ +getFrameCount : function ( +) +{ + return 0; +}, + +/** + * @method getFrames + * @return {sp.Vector} + */ +getFrames : function ( +) +{ + return sp.Vector; +}, + +}; + +/** + * @class Event + */ +spine.Event = { + +/** + * @method getFloatValue + * @return {float} + */ +getFloatValue : function ( +) +{ + return 0; +}, + +/** + * @method getIntValue + * @return {int} + */ +getIntValue : function ( +) +{ + return 0; +}, + +/** + * @method getStringValue + * @return {sp.String} + */ +getStringValue : function ( +) +{ + return sp.String; +}, + +/** + * @method getTime + * @return {float} + */ +getTime : function ( +) +{ + return 0; +}, + +/** + * @method getBalance + * @return {float} + */ +getBalance : function ( +) +{ + return 0; +}, + +/** + * @method setFloatValue + * @param {float} arg0 + */ +setFloatValue : function ( +float +) +{ +}, + +/** + * @method setIntValue + * @param {int} arg0 + */ +setIntValue : function ( +int +) +{ +}, + +/** + * @method getVolume + * @return {float} + */ +getVolume : function ( +) +{ + return 0; +}, + +/** + * @method setBalance + * @param {float} arg0 + */ +setBalance : function ( +float +) +{ +}, + +/** + * @method getData + * @return {sp.EventData} + */ +getData : function ( +) +{ + return sp.EventData; +}, + +/** + * @method setStringValue + * @param {sp.String} arg0 + */ +setStringValue : function ( +str +) +{ +}, + +/** + * @method setVolume + * @param {float} arg0 + */ +setVolume : function ( +float +) +{ +}, + +}; + +/** + * @class EventData + */ +spine.EventData = { + +/** + * @method getAudioPath + * @return {sp.String} + */ +getAudioPath : function ( +) +{ + return sp.String; +}, + +/** + * @method getIntValue + * @return {int} + */ +getIntValue : function ( +) +{ + return 0; +}, + +/** + * @method getStringValue + * @return {sp.String} + */ +getStringValue : function ( +) +{ + return sp.String; +}, + +/** + * @method getFloatValue + * @return {float} + */ +getFloatValue : function ( +) +{ + return 0; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method setFloatValue + * @param {float} arg0 + */ +setFloatValue : function ( +float +) +{ +}, + +/** + * @method setIntValue + * @param {int} arg0 + */ +setIntValue : function ( +int +) +{ +}, + +/** + * @method getVolume + * @return {float} + */ +getVolume : function ( +) +{ + return 0; +}, + +/** + * @method setBalance + * @param {float} arg0 + */ +setBalance : function ( +float +) +{ +}, + +/** + * @method setVolume + * @param {float} arg0 + */ +setVolume : function ( +float +) +{ +}, + +/** + * @method setStringValue + * @param {sp.String} arg0 + */ +setStringValue : function ( +str +) +{ +}, + +/** + * @method getBalance + * @return {float} + */ +getBalance : function ( +) +{ + return 0; +}, + +/** + * @method setAudioPath + * @param {sp.String} arg0 + */ +setAudioPath : function ( +str +) +{ +}, + +}; + +/** + * @class EventTimeline + */ +spine.EventTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {unsigned int} arg0 + * @param {sp.Event} arg1 + */ +setFrame : function ( +int, +event +) +{ +}, + +/** + * @method getFrameCount + * @return {unsigned int} + */ +getFrameCount : function ( +) +{ + return 0; +}, + +/** + * @method getFrames + * @return {sp.Vector} + */ +getFrames : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getEvents + * @return {sp.Vector} + */ +getEvents : function ( +) +{ + return sp.Vector; +}, + +}; + +/** + * @class IkConstraint + */ +spine.IkConstraint = { + +/** + * @method getMix + * @return {float} + */ +getMix : function ( +) +{ + return 0; +}, + +/** + * @method getStretch + * @return {bool} + */ +getStretch : function ( +) +{ + return false; +}, + +/** + * @method getCompress + * @return {bool} + */ +getCompress : function ( +) +{ + return false; +}, + +/** + * @method setStretch + * @param {bool} arg0 + */ +setStretch : function ( +bool +) +{ +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setTarget + * @param {sp.Bone} arg0 + */ +setTarget : function ( +bone +) +{ +}, + +/** + * @method setBendDirection + * @param {int} arg0 + */ +setBendDirection : function ( +int +) +{ +}, + +/** + * @method update + */ +update : function ( +) +{ +}, + +/** + * @method getTarget + * @return {sp.Bone} + */ +getTarget : function ( +) +{ + return sp.Bone; +}, + +/** + * @method setCompress + * @param {bool} arg0 + */ +setCompress : function ( +bool +) +{ +}, + +/** + * @method getBendDirection + * @return {int} + */ +getBendDirection : function ( +) +{ + return 0; +}, + +/** + * @method getOrder + * @return {int} + */ +getOrder : function ( +) +{ + return 0; +}, + +/** + * @method setMix + * @param {float} arg0 + */ +setMix : function ( +float +) +{ +}, + +/** + * @method getData + * @return {sp.IkConstraintData} + */ +getData : function ( +) +{ + return sp.IkConstraintData; +}, + +}; + +/** + * @class IkConstraintData + */ +spine.IkConstraintData = { + +/** + * @method getMix + * @return {float} + */ +getMix : function ( +) +{ + return 0; +}, + +/** + * @method getBendDirection + * @return {int} + */ +getBendDirection : function ( +) +{ + return 0; +}, + +/** + * @method setUniform + * @param {bool} arg0 + */ +setUniform : function ( +bool +) +{ +}, + +/** + * @method setStretch + * @param {bool} arg0 + */ +setStretch : function ( +bool +) +{ +}, + +/** + * @method getUniform + * @return {bool} + */ +getUniform : function ( +) +{ + return false; +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method getTarget + * @return {sp.BoneData} + */ +getTarget : function ( +) +{ + return sp.BoneData; +}, + +/** + * @method setCompress + * @param {bool} arg0 + */ +setCompress : function ( +bool +) +{ +}, + +/** + * @method setOrder + * @param {unsigned int} arg0 + */ +setOrder : function ( +int +) +{ +}, + +/** + * @method getOrder + * @return {unsigned int} + */ +getOrder : function ( +) +{ + return 0; +}, + +/** + * @method getStretch + * @return {bool} + */ +getStretch : function ( +) +{ + return false; +}, + +/** + * @method setBendDirection + * @param {int} arg0 + */ +setBendDirection : function ( +int +) +{ +}, + +/** + * @method setMix + * @param {float} arg0 + */ +setMix : function ( +float +) +{ +}, + +/** + * @method getCompress + * @return {bool} + */ +getCompress : function ( +) +{ + return false; +}, + +/** + * @method setTarget + * @param {sp.BoneData} arg0 + */ +setTarget : function ( +bonedata +) +{ +}, + +}; + +/** + * @class IkConstraintTimeline + */ +spine.IkConstraintTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {int} arg3 + * @param {bool} arg4 + * @param {bool} arg5 + */ +setFrame : function ( +int, +float, +float, +int, +bool, +bool +) +{ +}, + +}; + +/** + * @class MeshAttachment + */ +spine.MeshAttachment = { + +/** + * @method setRegionOriginalHeight + * @param {float} arg0 + */ +setRegionOriginalHeight : function ( +float +) +{ +}, + +/** + * @method setRegionOffsetY + * @param {float} arg0 + */ +setRegionOffsetY : function ( +float +) +{ +}, + +/** + * @method setRegionOffsetX + * @param {float} arg0 + */ +setRegionOffsetX : function ( +float +) +{ +}, + +/** + * @method setInheritDeform + * @param {bool} arg0 + */ +setInheritDeform : function ( +bool +) +{ +}, + +/** + * @method getRegionOriginalWidth + * @return {float} + */ +getRegionOriginalWidth : function ( +) +{ + return 0; +}, + +/** + * @method getWidth + * @return {float} + */ +getWidth : function ( +) +{ + return 0; +}, + +/** + * @method setParentMesh + * @param {sp.MeshAttachment} arg0 + */ +setParentMesh : function ( +meshattachment +) +{ +}, + +/** + * @method setWidth + * @param {float} arg0 + */ +setWidth : function ( +float +) +{ +}, + +/** + * @method setRegionRotate + * @param {bool} arg0 + */ +setRegionRotate : function ( +bool +) +{ +}, + +/** + * @method getUVs + * @return {sp.Vector} + */ +getUVs : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getRegionHeight + * @return {float} + */ +getRegionHeight : function ( +) +{ + return 0; +}, + +/** + * @method getRegionU2 + * @return {float} + */ +getRegionU2 : function ( +) +{ + return 0; +}, + +/** + * @method getHeight + * @return {float} + */ +getHeight : function ( +) +{ + return 0; +}, + +/** + * @method getPath + * @return {sp.String} + */ +getPath : function ( +) +{ + return sp.String; +}, + +/** + * @method setRegionV2 + * @param {float} arg0 + */ +setRegionV2 : function ( +float +) +{ +}, + +/** + * @method setRegionWidth + * @param {float} arg0 + */ +setRegionWidth : function ( +float +) +{ +}, + +/** + * @method setRegionV + * @param {float} arg0 + */ +setRegionV : function ( +float +) +{ +}, + +/** + * @method setPath + * @param {sp.String} arg0 + */ +setPath : function ( +str +) +{ +}, + +/** + * @method setRegionU + * @param {float} arg0 + */ +setRegionU : function ( +float +) +{ +}, + +/** + * @method applyDeform + * @param {sp.VertexAttachment} arg0 + * @return {bool} + */ +applyDeform : function ( +vertexattachment +) +{ + return false; +}, + +/** + * @method setHullLength + * @param {int} arg0 + */ +setHullLength : function ( +int +) +{ +}, + +/** + * @method getColor + * @return {sp.Color} + */ +getColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method getRegionOriginalHeight + * @return {float} + */ +getRegionOriginalHeight : function ( +) +{ + return 0; +}, + +/** + * @method getEdges + * @return {sp.Vector} + */ +getEdges : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getRegionUVs + * @return {sp.Vector} + */ +getRegionUVs : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getRegionV2 + * @return {float} + */ +getRegionV2 : function ( +) +{ + return 0; +}, + +/** + * @method getRegionWidth + * @return {float} + */ +getRegionWidth : function ( +) +{ + return 0; +}, + +/** + * @method setHeight + * @param {float} arg0 + */ +setHeight : function ( +float +) +{ +}, + +/** + * @method setRegionOriginalWidth + * @param {float} arg0 + */ +setRegionOriginalWidth : function ( +float +) +{ +}, + +/** + * @method updateUVs + */ +updateUVs : function ( +) +{ +}, + +/** + * @method getInheritDeform + * @return {bool} + */ +getInheritDeform : function ( +) +{ + return false; +}, + +/** + * @method setRegionU2 + * @param {float} arg0 + */ +setRegionU2 : function ( +float +) +{ +}, + +/** + * @method getHullLength + * @return {int} + */ +getHullLength : function ( +) +{ + return 0; +}, + +/** + * @method setRegionHeight + * @param {float} arg0 + */ +setRegionHeight : function ( +float +) +{ +}, + +/** + * @method getTriangles + * @return {sp.Vector} + */ +getTriangles : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getRegionOffsetY + * @return {float} + */ +getRegionOffsetY : function ( +) +{ + return 0; +}, + +/** + * @method getRegionOffsetX + * @return {float} + */ +getRegionOffsetX : function ( +) +{ + return 0; +}, + +/** + * @method getRegionV + * @return {float} + */ +getRegionV : function ( +) +{ + return 0; +}, + +/** + * @method getRegionRotate + * @return {bool} + */ +getRegionRotate : function ( +) +{ + return false; +}, + +/** + * @method getParentMesh + * @return {sp.MeshAttachment} + */ +getParentMesh : function ( +) +{ + return sp.MeshAttachment; +}, + +/** + * @method getRegionU + * @return {float} + */ +getRegionU : function ( +) +{ + return 0; +}, + +}; + +/** + * @class PathAttachment + */ +spine.PathAttachment = { + +/** + * @method isConstantSpeed + * @return {bool} + */ +isConstantSpeed : function ( +) +{ + return false; +}, + +/** + * @method isClosed + * @return {bool} + */ +isClosed : function ( +) +{ + return false; +}, + +/** + * @method setConstantSpeed + * @param {bool} arg0 + */ +setConstantSpeed : function ( +bool +) +{ +}, + +/** + * @method setClosed + * @param {bool} arg0 + */ +setClosed : function ( +bool +) +{ +}, + +/** + * @method getLengths + * @return {sp.Vector} + */ +getLengths : function ( +) +{ + return sp.Vector; +}, + +}; + +/** + * @class PathConstraint + */ +spine.PathConstraint = { + +/** + * @method setSpacing + * @param {float} arg0 + */ +setSpacing : function ( +float +) +{ +}, + +/** + * @method setRotateMix + * @param {float} arg0 + */ +setRotateMix : function ( +float +) +{ +}, + +/** + * @method getRotateMix + * @return {float} + */ +getRotateMix : function ( +) +{ + return 0; +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setTarget + * @param {sp.Slot} arg0 + */ +setTarget : function ( +slot +) +{ +}, + +/** + * @method getTranslateMix + * @return {float} + */ +getTranslateMix : function ( +) +{ + return 0; +}, + +/** + * @method update + */ +update : function ( +) +{ +}, + +/** + * @method getTarget + * @return {sp.Slot} + */ +getTarget : function ( +) +{ + return sp.Slot; +}, + +/** + * @method getSpacing + * @return {float} + */ +getSpacing : function ( +) +{ + return 0; +}, + +/** + * @method getOrder + * @return {int} + */ +getOrder : function ( +) +{ + return 0; +}, + +/** + * @method apply + */ +apply : function ( +) +{ +}, + +/** + * @method setPosition + * @param {float} arg0 + */ +setPosition : function ( +float +) +{ +}, + +/** + * @method getData + * @return {sp.PathConstraintData} + */ +getData : function ( +) +{ + return sp.PathConstraintData; +}, + +/** + * @method getPosition + * @return {float} + */ +getPosition : function ( +) +{ + return 0; +}, + +/** + * @method setTranslateMix + * @param {float} arg0 + */ +setTranslateMix : function ( +float +) +{ +}, + +}; + +/** + * @class PathConstraintData + */ +spine.PathConstraintData = { + +/** + * @method getOffsetRotation + * @return {float} + */ +getOffsetRotation : function ( +) +{ + return 0; +}, + +/** + * @method getPositionMode + * @return {sp.PositionMode} + */ +getPositionMode : function ( +) +{ + return 0; +}, + +/** + * @method getTarget + * @return {sp.SlotData} + */ +getTarget : function ( +) +{ + return sp.SlotData; +}, + +/** + * @method getSpacingMode + * @return {sp.SpacingMode} + */ +getSpacingMode : function ( +) +{ + return 0; +}, + +/** + * @method setSpacing + * @param {float} arg0 + */ +setSpacing : function ( +float +) +{ +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method getOrder + * @return {int} + */ +getOrder : function ( +) +{ + return 0; +}, + +/** + * @method setRotateMode + * @param {sp.RotateMode} arg0 + */ +setRotateMode : function ( +rotatemode +) +{ +}, + +/** + * @method setRotateMix + * @param {float} arg0 + */ +setRotateMix : function ( +float +) +{ +}, + +/** + * @method getRotateMix + * @return {float} + */ +getRotateMix : function ( +) +{ + return 0; +}, + +/** + * @method setTarget + * @param {sp.SlotData} arg0 + */ +setTarget : function ( +slotdata +) +{ +}, + +/** + * @method getTranslateMix + * @return {float} + */ +getTranslateMix : function ( +) +{ + return 0; +}, + +/** + * @method getSpacing + * @return {float} + */ +getSpacing : function ( +) +{ + return 0; +}, + +/** + * @method setOffsetRotation + * @param {float} arg0 + */ +setOffsetRotation : function ( +float +) +{ +}, + +/** + * @method setOrder + * @param {int} arg0 + */ +setOrder : function ( +int +) +{ +}, + +/** + * @method getRotateMode + * @return {sp.RotateMode} + */ +getRotateMode : function ( +) +{ + return 0; +}, + +/** + * @method setPosition + * @param {float} arg0 + */ +setPosition : function ( +float +) +{ +}, + +/** + * @method getPosition + * @return {float} + */ +getPosition : function ( +) +{ + return 0; +}, + +/** + * @method setSpacingMode + * @param {sp.SpacingMode} arg0 + */ +setSpacingMode : function ( +spacingmode +) +{ +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setPositionMode + * @param {sp.PositionMode} arg0 + */ +setPositionMode : function ( +positionmode +) +{ +}, + +/** + * @method setTranslateMix + * @param {float} arg0 + */ +setTranslateMix : function ( +float +) +{ +}, + +}; + +/** + * @class PathConstraintMixTimeline + */ +spine.PathConstraintMixTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +}; + +/** + * @class PathConstraintPositionTimeline + */ +spine.PathConstraintPositionTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {float} arg2 + */ +setFrame : function ( +int, +float, +float +) +{ +}, + +}; + +/** + * @class PathConstraintSpacingTimeline + */ +spine.PathConstraintSpacingTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +}; + +/** + * @class PointAttachment + */ +spine.PointAttachment = { + +/** + * @method getX + * @return {float} + */ +getX : function ( +) +{ + return 0; +}, + +/** + * @method getY + * @return {float} + */ +getY : function ( +) +{ + return 0; +}, + +/** + * @method getRotation + * @return {float} + */ +getRotation : function ( +) +{ + return 0; +}, + +/** + * @method setRotation + * @param {float} arg0 + */ +setRotation : function ( +float +) +{ +}, + +/** + * @method setX + * @param {float} arg0 + */ +setX : function ( +float +) +{ +}, + +/** + * @method setY + * @param {float} arg0 + */ +setY : function ( +float +) +{ +}, + +}; + +/** + * @class RegionAttachment + */ +spine.RegionAttachment = { + +/** + * @method setRegionOriginalHeight + * @param {float} arg0 + */ +setRegionOriginalHeight : function ( +float +) +{ +}, + +/** + * @method setRegionOffsetY + * @param {float} arg0 + */ +setRegionOffsetY : function ( +float +) +{ +}, + +/** + * @method setRegionOffsetX + * @param {float} arg0 + */ +setRegionOffsetX : function ( +float +) +{ +}, + +/** + * @method getRegionOriginalWidth + * @return {float} + */ +getRegionOriginalWidth : function ( +) +{ + return 0; +}, + +/** + * @method setUVs + * @param {float} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + * @param {bool} arg4 + */ +setUVs : function ( +float, +float, +float, +float, +bool +) +{ +}, + +/** + * @method getWidth + * @return {float} + */ +getWidth : function ( +) +{ + return 0; +}, + +/** + * @method getY + * @return {float} + */ +getY : function ( +) +{ + return 0; +}, + +/** + * @method getRotation + * @return {float} + */ +getRotation : function ( +) +{ + return 0; +}, + +/** + * @method setWidth + * @param {float} arg0 + */ +setWidth : function ( +float +) +{ +}, + +/** + * @method setRegionWidth + * @param {float} arg0 + */ +setRegionWidth : function ( +float +) +{ +}, + +/** + * @method getUVs + * @return {sp.Vector} + */ +getUVs : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getRegionHeight + * @return {float} + */ +getRegionHeight : function ( +) +{ + return 0; +}, + +/** + * @method getScaleY + * @return {float} + */ +getScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getScaleX + * @return {float} + */ +getScaleX : function ( +) +{ + return 0; +}, + +/** + * @method getHeight + * @return {float} + */ +getHeight : function ( +) +{ + return 0; +}, + +/** + * @method getPath + * @return {sp.String} + */ +getPath : function ( +) +{ + return sp.String; +}, + +/** + * @method setRotation + * @param {float} arg0 + */ +setRotation : function ( +float +) +{ +}, + +/** + * @method setPath + * @param {sp.String} arg0 + */ +setPath : function ( +str +) +{ +}, + +/** + * @method getRegionWidth + * @return {float} + */ +getRegionWidth : function ( +) +{ + return 0; +}, + +/** + * @method setScaleY + * @param {float} arg0 + */ +setScaleY : function ( +float +) +{ +}, + +/** + * @method setScaleX + * @param {float} arg0 + */ +setScaleX : function ( +float +) +{ +}, + +/** + * @method setRegionOriginalWidth + * @param {float} arg0 + */ +setRegionOriginalWidth : function ( +float +) +{ +}, + +/** + * @method getColor + * @return {sp.Color} + */ +getColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method setX + * @param {float} arg0 + */ +setX : function ( +float +) +{ +}, + +/** + * @method setY + * @param {float} arg0 + */ +setY : function ( +float +) +{ +}, + +/** + * @method setHeight + * @param {float} arg0 + */ +setHeight : function ( +float +) +{ +}, + +/** + * @method getX + * @return {float} + */ +getX : function ( +) +{ + return 0; +}, + +/** + * @method getOffset + * @return {sp.Vector} + */ +getOffset : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setRegionHeight + * @param {float} arg0 + */ +setRegionHeight : function ( +float +) +{ +}, + +/** + * @method updateOffset + */ +updateOffset : function ( +) +{ +}, + +/** + * @method getRegionOriginalHeight + * @return {float} + */ +getRegionOriginalHeight : function ( +) +{ + return 0; +}, + +/** + * @method getRegionOffsetY + * @return {float} + */ +getRegionOffsetY : function ( +) +{ + return 0; +}, + +/** + * @method getRegionOffsetX + * @return {float} + */ +getRegionOffsetX : function ( +) +{ + return 0; +}, + +}; + +/** + * @class RotateTimeline + */ +spine.RotateTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {float} arg2 + */ +setFrame : function ( +int, +float, +float +) +{ +}, + +/** + * @method getFrames + * @return {sp.Vector} + */ +getFrames : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setBoneIndex + * @param {int} arg0 + */ +setBoneIndex : function ( +int +) +{ +}, + +/** + * @method getBoneIndex + * @return {int} + */ +getBoneIndex : function ( +) +{ + return 0; +}, + +}; + +/** + * @class TranslateTimeline + */ +spine.TranslateTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + */ +setFrame : function ( +int, +float, +float, +float +) +{ +}, + +}; + +/** + * @class ScaleTimeline + */ +spine.ScaleTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +}; + +/** + * @class ShearTimeline + */ +spine.ShearTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +}; + +/** + * @class Skeleton + */ +spine.Skeleton = { + +/** + * @method setToSetupPose + */ +setToSetupPose : function ( +) +{ +}, + +/** + * @method getSkin + * @return {sp.Skin} + */ +getSkin : function ( +) +{ + return sp.Skin; +}, + +/** + * @method getX + * @return {float} + */ +getX : function ( +) +{ + return 0; +}, + +/** + * @method findTransformConstraint + * @param {sp.String} arg0 + * @return {sp.TransformConstraint} + */ +findTransformConstraint : function ( +str +) +{ + return sp.TransformConstraint; +}, + +/** + * @method setAttachment + * @param {sp.String} arg0 + * @param {sp.String} arg1 + */ +setAttachment : function ( +str, +str +) +{ +}, + +/** + * @method findIkConstraint + * @param {sp.String} arg0 + * @return {sp.IkConstraint} + */ +findIkConstraint : function ( +str +) +{ + return sp.IkConstraint; +}, + +/** + * @method setBonesToSetupPose + */ +setBonesToSetupPose : function ( +) +{ +}, + +/** + * @method getScaleY + * @return {float} + */ +getScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getScaleX + * @return {float} + */ +getScaleX : function ( +) +{ + return 0; +}, + +/** + * @method findBoneIndex + * @param {sp.String} arg0 + * @return {int} + */ +findBoneIndex : function ( +str +) +{ + return 0; +}, + +/** + * @method setSlotsToSetupPose + */ +setSlotsToSetupPose : function ( +) +{ +}, + +/** + * @method getDrawOrder + * @return {sp.Vector} + */ +getDrawOrder : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getTime + * @return {float} + */ +getTime : function ( +) +{ + return 0; +}, + +/** + * @method getColor + * @return {sp.Color} + */ +getColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method getIkConstraints + * @return {sp.Vector} + */ +getIkConstraints : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getData + * @return {sp.SkeletonData} + */ +getData : function ( +) +{ + return sp.SkeletonData; +}, + +/** + * @method getUpdateCacheList + * @return {sp.Vector} + */ +getUpdateCacheList : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setScaleY + * @param {float} arg0 + */ +setScaleY : function ( +float +) +{ +}, + +/** + * @method setScaleX + * @param {float} arg0 + */ +setScaleX : function ( +float +) +{ +}, + +/** + * @method getPathConstraints + * @return {sp.Vector} + */ +getPathConstraints : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getSlots + * @return {sp.Vector} + */ +getSlots : function ( +) +{ + return sp.Vector; +}, + +/** + * @method printUpdateCache + */ +printUpdateCache : function ( +) +{ +}, + +/** + * @method update + * @param {float} arg0 + */ +update : function ( +float +) +{ +}, + +/** + * @method getAttachment +* @param {int|sp.String} int +* @param {sp.String|sp.String} str +* @return {sp.Attachment|sp.Attachment} +*/ +getAttachment : function( +str, +str +) +{ + return sp.Attachment; +}, + +/** + * @method setTime + * @param {float} arg0 + */ +setTime : function ( +float +) +{ +}, + +/** + * @method setPosition + * @param {float} arg0 + * @param {float} arg1 + */ +setPosition : function ( +float, +float +) +{ +}, + +/** + * @method setX + * @param {float} arg0 + */ +setX : function ( +float +) +{ +}, + +/** + * @method setY + * @param {float} arg0 + */ +setY : function ( +float +) +{ +}, + +/** + * @method findBone + * @param {sp.String} arg0 + * @return {sp.Bone} + */ +findBone : function ( +str +) +{ + return sp.Bone; +}, + +/** + * @method getY + * @return {float} + */ +getY : function ( +) +{ + return 0; +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getRootBone + * @return {sp.Bone} + */ +getRootBone : function ( +) +{ + return sp.Bone; +}, + +/** + * @method updateCache + */ +updateCache : function ( +) +{ +}, + +/** + * @method findSlotIndex + * @param {sp.String} arg0 + * @return {int} + */ +findSlotIndex : function ( +str +) +{ + return 0; +}, + +/** + * @method getTransformConstraints + * @return {sp.Vector} + */ +getTransformConstraints : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setSkin +* @param {sp.Skin|sp.String} skin +*/ +setSkin : function( +str +) +{ +}, + +/** + * @method findSlot + * @param {sp.String} arg0 + * @return {sp.Slot} + */ +findSlot : function ( +str +) +{ + return sp.Slot; +}, + +/** + * @method updateWorldTransform + */ +updateWorldTransform : function ( +) +{ +}, + +/** + * @method findPathConstraint + * @param {sp.String} arg0 + * @return {sp.PathConstraint} + */ +findPathConstraint : function ( +str +) +{ + return sp.PathConstraint; +}, + +}; + +/** + * @class SkeletonBounds + */ +spine.SkeletonBounds = { + +/** + * @method getHeight + * @return {float} + */ +getHeight : function ( +) +{ + return 0; +}, + +/** + * @method aabbintersectsSegment + * @param {float} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + * @return {bool} + */ +aabbintersectsSegment : function ( +float, +float, +float, +float +) +{ + return false; +}, + +/** + * @method getWidth + * @return {float} + */ +getWidth : function ( +) +{ + return 0; +}, + +/** + * @method aabbcontainsPoint + * @param {float} arg0 + * @param {float} arg1 + * @return {bool} + */ +aabbcontainsPoint : function ( +float, +float +) +{ + return false; +}, + +/** + * @method intersectsSegment +* @param {sp.Polygon|float} polygon +* @param {float|float} float +* @param {float|float} float +* @param {float|float} float +* @param {float} float +* @return {bool|sp.BoundingBoxAttachment} +*/ +intersectsSegment : function( +polygon, +float, +float, +float, +float +) +{ + return false; +}, + +/** + * @method containsPoint +* @param {float|sp.Polygon} float +* @param {float|float} float +* @param {float} float +* @return {sp.BoundingBoxAttachment|bool} +*/ +containsPoint : function( +polygon, +float, +float +) +{ + return false; +}, + +/** + * @method getPolygon + * @param {sp.BoundingBoxAttachment} arg0 + * @return {sp.Polygon} + */ +getPolygon : function ( +boundingboxattachment +) +{ + return sp.Polygon; +}, + +}; + +/** + * @class Polygon + */ +spine.Polygon = { + +}; + +/** + * @class SkeletonData + */ +spine.SkeletonData = { + +/** + * @method findEvent + * @param {sp.String} arg0 + * @return {sp.EventData} + */ +findEvent : function ( +str +) +{ + return sp.EventData; +}, + +/** + * @method findAnimation + * @param {sp.String} arg0 + * @return {sp.Animation} + */ +findAnimation : function ( +str +) +{ + return sp.Animation; +}, + +/** + * @method getWidth + * @return {float} + */ +getWidth : function ( +) +{ + return 0; +}, + +/** + * @method findTransformConstraint + * @param {sp.String} arg0 + * @return {sp.TransformConstraintData} + */ +findTransformConstraint : function ( +str +) +{ + return sp.TransformConstraintData; +}, + +/** + * @method setFps + * @param {float} arg0 + */ +setFps : function ( +float +) +{ +}, + +/** + * @method findIkConstraint + * @param {sp.String} arg0 + * @return {sp.IkConstraintData} + */ +findIkConstraint : function ( +str +) +{ + return sp.IkConstraintData; +}, + +/** + * @method getFps + * @return {float} + */ +getFps : function ( +) +{ + return 0; +}, + +/** + * @method getSkins + * @return {sp.Vector} + */ +getSkins : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setWidth + * @param {float} arg0 + */ +setWidth : function ( +float +) +{ +}, + +/** + * @method setVersion + * @param {sp.String} arg0 + */ +setVersion : function ( +str +) +{ +}, + +/** + * @method setHash + * @param {sp.String} arg0 + */ +setHash : function ( +str +) +{ +}, + +/** + * @method findBoneIndex + * @param {sp.String} arg0 + * @return {int} + */ +findBoneIndex : function ( +str +) +{ + return 0; +}, + +/** + * @method getDefaultSkin + * @return {sp.Skin} + */ +getDefaultSkin : function ( +) +{ + return sp.Skin; +}, + +/** + * @method getHeight + * @return {float} + */ +getHeight : function ( +) +{ + return 0; +}, + +/** + * @method setDefaultSkin + * @param {sp.Skin} arg0 + */ +setDefaultSkin : function ( +skin +) +{ +}, + +/** + * @method getHash + * @return {sp.String} + */ +getHash : function ( +) +{ + return sp.String; +}, + +/** + * @method getAnimations + * @return {sp.Vector} + */ +getAnimations : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setImagesPath + * @param {sp.String} arg0 + */ +setImagesPath : function ( +str +) +{ +}, + +/** + * @method getIkConstraints + * @return {sp.Vector} + */ +getIkConstraints : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getImagesPath + * @return {sp.String} + */ +getImagesPath : function ( +) +{ + return sp.String; +}, + +/** + * @method getEvents + * @return {sp.Vector} + */ +getEvents : function ( +) +{ + return sp.Vector; +}, + +/** + * @method findBone + * @param {sp.String} arg0 + * @return {sp.BoneData} + */ +findBone : function ( +str +) +{ + return sp.BoneData; +}, + +/** + * @method setName + * @param {sp.String} arg0 + */ +setName : function ( +str +) +{ +}, + +/** + * @method getPathConstraints + * @return {sp.Vector} + */ +getPathConstraints : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getAudioPath + * @return {sp.String} + */ +getAudioPath : function ( +) +{ + return sp.String; +}, + +/** + * @method getVersion + * @return {sp.String} + */ +getVersion : function ( +) +{ + return sp.String; +}, + +/** + * @method setHeight + * @param {float} arg0 + */ +setHeight : function ( +float +) +{ +}, + +/** + * @method getSlots + * @return {sp.Vector} + */ +getSlots : function ( +) +{ + return sp.Vector; +}, + +/** + * @method findSkin + * @param {sp.String} arg0 + * @return {sp.Skin} + */ +findSkin : function ( +str +) +{ + return sp.Skin; +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method findPathConstraintIndex + * @param {sp.String} arg0 + * @return {int} + */ +findPathConstraintIndex : function ( +str +) +{ + return 0; +}, + +/** + * @method findSlotIndex + * @param {sp.String} arg0 + * @return {int} + */ +findSlotIndex : function ( +str +) +{ + return 0; +}, + +/** + * @method getTransformConstraints + * @return {sp.Vector} + */ +getTransformConstraints : function ( +) +{ + return sp.Vector; +}, + +/** + * @method findSlot + * @param {sp.String} arg0 + * @return {sp.SlotData} + */ +findSlot : function ( +str +) +{ + return sp.SlotData; +}, + +/** + * @method setAudioPath + * @param {sp.String} arg0 + */ +setAudioPath : function ( +str +) +{ +}, + +/** + * @method findPathConstraint + * @param {sp.String} arg0 + * @return {sp.PathConstraintData} + */ +findPathConstraint : function ( +str +) +{ + return sp.PathConstraintData; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +}; + +/** + * @class Skin + */ +spine.Skin = { + +/** + * @method findNamesForSlot + * @param {unsigned int} arg0 + * @param {sp.Vector} arg1 + */ +findNamesForSlot : function ( +int, +array +) +{ +}, + +/** + * @method addAttachment + * @param {unsigned int} arg0 + * @param {sp.String} arg1 + * @param {sp.Attachment} arg2 + */ +addAttachment : function ( +int, +str, +attachment +) +{ +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method getAttachment + * @param {unsigned int} arg0 + * @param {sp.String} arg1 + * @return {sp.Attachment} + */ +getAttachment : function ( +int, +str +) +{ + return sp.Attachment; +}, + +/** + * @method findAttachmentsForSlot + * @param {unsigned int} arg0 + * @param {sp.Vector} arg1 + */ +findAttachmentsForSlot : function ( +int, +array +) +{ +}, + +}; + +/** + * @class Slot + */ +spine.Slot = { + +/** + * @method getBone + * @return {sp.Bone} + */ +getBone : function ( +) +{ + return sp.Bone; +}, + +/** + * @method setAttachmentTime + * @param {float} arg0 + */ +setAttachmentTime : function ( +float +) +{ +}, + +/** + * @method getDarkColor + * @return {sp.Color} + */ +getDarkColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method getColor + * @return {sp.Color} + */ +getColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method setToSetupPose + */ +setToSetupPose : function ( +) +{ +}, + +/** + * @method getAttachment + * @return {sp.Attachment} + */ +getAttachment : function ( +) +{ + return sp.Attachment; +}, + +/** + * @method getAttachmentTime + * @return {float} + */ +getAttachmentTime : function ( +) +{ + return 0; +}, + +/** + * @method setAttachment + * @param {sp.Attachment} arg0 + */ +setAttachment : function ( +attachment +) +{ +}, + +/** + * @method getAttachmentVertices + * @return {sp.Vector} + */ +getAttachmentVertices : function ( +) +{ + return sp.Vector; +}, + +/** + * @method hasDarkColor + * @return {bool} + */ +hasDarkColor : function ( +) +{ + return false; +}, + +/** + * @method getSkeleton + * @return {sp.Skeleton} + */ +getSkeleton : function ( +) +{ + return sp.Skeleton; +}, + +/** + * @method getData + * @return {sp.SlotData} + */ +getData : function ( +) +{ + return sp.SlotData; +}, + +}; + +/** + * @class SlotData + */ +spine.SlotData = { + +/** + * @method getIndex + * @return {int} + */ +getIndex : function ( +) +{ + return 0; +}, + +/** + * @method getDarkColor + * @return {sp.Color} + */ +getDarkColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method getAttachmentName + * @return {sp.String} + */ +getAttachmentName : function ( +) +{ + return sp.String; +}, + +/** + * @method getColor + * @return {sp.Color} + */ +getColor : function ( +) +{ + return sp.Color; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method setBlendMode + * @param {sp.BlendMode} arg0 + */ +setBlendMode : function ( +blendmode +) +{ +}, + +/** + * @method getBlendMode + * @return {sp.BlendMode} + */ +getBlendMode : function ( +) +{ + return 0; +}, + +/** + * @method hasDarkColor + * @return {bool} + */ +hasDarkColor : function ( +) +{ + return false; +}, + +/** + * @method setHasDarkColor + * @param {bool} arg0 + */ +setHasDarkColor : function ( +bool +) +{ +}, + +/** + * @method setAttachmentName + * @param {sp.String} arg0 + */ +setAttachmentName : function ( +str +) +{ +}, + +/** + * @method getBoneData + * @return {sp.BoneData} + */ +getBoneData : function ( +) +{ + return sp.BoneData; +}, + +}; + +/** + * @class TransformConstraint + */ +spine.TransformConstraint = { + +/** + * @method getScaleMix + * @return {float} + */ +getScaleMix : function ( +) +{ + return 0; +}, + +/** + * @method setRotateMix + * @param {float} arg0 + */ +setRotateMix : function ( +float +) +{ +}, + +/** + * @method getRotateMix + * @return {float} + */ +getRotateMix : function ( +) +{ + return 0; +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method setTarget + * @param {sp.Bone} arg0 + */ +setTarget : function ( +bone +) +{ +}, + +/** + * @method getTranslateMix + * @return {float} + */ +getTranslateMix : function ( +) +{ + return 0; +}, + +/** + * @method setShearMix + * @param {float} arg0 + */ +setShearMix : function ( +float +) +{ +}, + +/** + * @method update + */ +update : function ( +) +{ +}, + +/** + * @method getTarget + * @return {sp.Bone} + */ +getTarget : function ( +) +{ + return sp.Bone; +}, + +/** + * @method setScaleMix + * @param {float} arg0 + */ +setScaleMix : function ( +float +) +{ +}, + +/** + * @method getOrder + * @return {int} + */ +getOrder : function ( +) +{ + return 0; +}, + +/** + * @method getShearMix + * @return {float} + */ +getShearMix : function ( +) +{ + return 0; +}, + +/** + * @method apply + */ +apply : function ( +) +{ +}, + +/** + * @method getData + * @return {sp.TransformConstraintData} + */ +getData : function ( +) +{ + return sp.TransformConstraintData; +}, + +/** + * @method setTranslateMix + * @param {float} arg0 + */ +setTranslateMix : function ( +float +) +{ +}, + +}; + +/** + * @class TransformConstraintData + */ +spine.TransformConstraintData = { + +/** + * @method getOffsetRotation + * @return {float} + */ +getOffsetRotation : function ( +) +{ + return 0; +}, + +/** + * @method getRotateMix + * @return {float} + */ +getRotateMix : function ( +) +{ + return 0; +}, + +/** + * @method isLocal + * @return {bool} + */ +isLocal : function ( +) +{ + return false; +}, + +/** + * @method getBones + * @return {sp.Vector} + */ +getBones : function ( +) +{ + return sp.Vector; +}, + +/** + * @method getName + * @return {sp.String} + */ +getName : function ( +) +{ + return sp.String; +}, + +/** + * @method getTranslateMix + * @return {float} + */ +getTranslateMix : function ( +) +{ + return 0; +}, + +/** + * @method getTarget + * @return {sp.BoneData} + */ +getTarget : function ( +) +{ + return sp.BoneData; +}, + +/** + * @method getOffsetScaleX + * @return {float} + */ +getOffsetScaleX : function ( +) +{ + return 0; +}, + +/** + * @method getOffsetScaleY + * @return {float} + */ +getOffsetScaleY : function ( +) +{ + return 0; +}, + +/** + * @method getOffsetShearY + * @return {float} + */ +getOffsetShearY : function ( +) +{ + return 0; +}, + +/** + * @method getOrder + * @return {int} + */ +getOrder : function ( +) +{ + return 0; +}, + +/** + * @method getOffsetX + * @return {float} + */ +getOffsetX : function ( +) +{ + return 0; +}, + +/** + * @method getShearMix + * @return {float} + */ +getShearMix : function ( +) +{ + return 0; +}, + +/** + * @method getOffsetY + * @return {float} + */ +getOffsetY : function ( +) +{ + return 0; +}, + +/** + * @method getScaleMix + * @return {float} + */ +getScaleMix : function ( +) +{ + return 0; +}, + +/** + * @method isRelative + * @return {bool} + */ +isRelative : function ( +) +{ + return false; +}, + +}; + +/** + * @class TransformConstraintTimeline + */ +spine.TransformConstraintTimeline = { + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {unsigned int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + * @param {float} arg4 + * @param {float} arg5 + */ +setFrame : function ( +int, +float, +float, +float, +float, +float +) +{ +}, + +}; + +/** + * @class TwoColorTimeline + */ +spine.TwoColorTimeline = { + +/** + * @method setSlotIndex + * @param {int} arg0 + */ +setSlotIndex : function ( +int +) +{ +}, + +/** + * @method getPropertyId + * @return {int} + */ +getPropertyId : function ( +) +{ + return 0; +}, + +/** + * @method setFrame + * @param {int} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 + * @param {float} arg4 + * @param {float} arg5 + * @param {float} arg6 + * @param {float} arg7 + * @param {float} arg8 + */ +setFrame : function ( +int, +float, +float, +float, +float, +float, +float, +float, +float +) +{ +}, + +/** + * @method getSlotIndex + * @return {int} + */ +getSlotIndex : function ( +) +{ + return 0; +}, + +}; + +/** + * @class VertexEffect + */ +spine.VertexEffect = { + +}; + +/** + * @class JitterVertexEffect + */ +spine.JitterVertexEffect = { + +/** + * @method setJitterX + * @param {float} arg0 + */ +setJitterX : function ( +float +) +{ +}, + +/** + * @method setJitterY + * @param {float} arg0 + */ +setJitterY : function ( +float +) +{ +}, + +/** + * @method getJitterX + * @return {float} + */ +getJitterX : function ( +) +{ + return 0; +}, + +/** + * @method getJitterY + * @return {float} + */ +getJitterY : function ( +) +{ + return 0; +}, + +}; + +/** + * @class SwirlVertexEffect + */ +spine.SwirlVertexEffect = { + +/** + * @method setRadius + * @param {float} arg0 + */ +setRadius : function ( +float +) +{ +}, + +/** + * @method getAngle + * @return {float} + */ +getAngle : function ( +) +{ + return 0; +}, + +/** + * @method getCenterY + * @return {float} + */ +getCenterY : function ( +) +{ + return 0; +}, + +/** + * @method getCenterX + * @return {float} + */ +getCenterX : function ( +) +{ + return 0; +}, + +/** + * @method setAngle + * @param {float} arg0 + */ +setAngle : function ( +float +) +{ +}, + +/** + * @method setWorldX + * @param {float} arg0 + */ +setWorldX : function ( +float +) +{ +}, + +/** + * @method setWorldY + * @param {float} arg0 + */ +setWorldY : function ( +float +) +{ +}, + +/** + * @method getWorldY + * @return {float} + */ +getWorldY : function ( +) +{ + return 0; +}, + +/** + * @method getWorldX + * @return {float} + */ +getWorldX : function ( +) +{ + return 0; +}, + +/** + * @method setCenterY + * @param {float} arg0 + */ +setCenterY : function ( +float +) +{ +}, + +/** + * @method setCenterX + * @param {float} arg0 + */ +setCenterX : function ( +float +) +{ +}, + +/** + * @method getRadius + * @return {float} + */ +getRadius : function ( +) +{ + return 0; +}, + +}; + +/** + * @class VertexEffectDelegate + */ +spine.VertexEffectDelegate = { + +/** + * @method getEffectType + * @return {String} + */ +getEffectType : function ( +) +{ + return ; +}, + +/** + * @method initSwirlWithPowOut + * @param {float} arg0 + * @param {int} arg1 + * @return {sp.SwirlVertexEffect} + */ +initSwirlWithPowOut : function ( +float, +int +) +{ + return sp.SwirlVertexEffect; +}, + +/** + * @method initSwirlWithPow + * @param {float} arg0 + * @param {int} arg1 + * @return {sp.SwirlVertexEffect} + */ +initSwirlWithPow : function ( +float, +int +) +{ + return sp.SwirlVertexEffect; +}, + +/** + * @method initJitter + * @param {float} arg0 + * @param {float} arg1 + * @return {sp.JitterVertexEffect} + */ +initJitter : function ( +float, +float +) +{ + return sp.JitterVertexEffect; +}, + +/** + * @method getSwirlVertexEffect + * @return {sp.SwirlVertexEffect} + */ +getSwirlVertexEffect : function ( +) +{ + return sp.SwirlVertexEffect; +}, + +/** + * @method getVertexEffect + * @return {sp.VertexEffect} + */ +getVertexEffect : function ( +) +{ + return sp.VertexEffect; +}, + +/** + * @method getJitterVertexEffect + * @return {sp.JitterVertexEffect} + */ +getJitterVertexEffect : function ( +) +{ + return sp.JitterVertexEffect; +}, + +/** + * @method clear + */ +clear : function ( +) +{ +}, + +/** + * @method VertexEffectDelegate + * @constructor + */ +VertexEffectDelegate : function ( +) +{ +}, + +}; + +/** + * @class SkeletonRenderer */ spine.Skeleton = { @@ -28,6 +6088,26 @@ float { }, +/** + * @method initWithUUID + * @param {String} arg0 + */ +initWithUUID : function ( +str +) +{ +}, + +/** + * @method setOpacityModifyRGB + * @param {bool} arg0 + */ +setOpacityModifyRGB : function ( +bool +) +{ +}, + /** * @method paused * @param {bool} arg0 @@ -61,9 +6141,9 @@ setBonesToSetupPose : function ( }, /** - * @method setSlotsToSetupPose + * @method onEnable */ -setSlotsToSetupPose : function ( +onEnable : function ( ) { }, @@ -109,12 +6189,12 @@ bool /** * @method initWithJsonFile * @param {String|String} str -* @param {String|spAtlas} str +* @param {String|sp.Atlas} str * @param {float|float} float */ initWithJsonFile : function( str, -spatlas, +atlas, float ) { @@ -129,11 +6209,9 @@ setToSetupPose : function ( }, /** - * @method setOpacityModifyRGB - * @param {bool} arg0 + * @method setSlotsToSetupPose */ -setOpacityModifyRGB : function ( -bool +setSlotsToSetupPose : function ( ) { }, @@ -141,31 +6219,41 @@ bool /** * @method initWithBinaryFile * @param {String|String} str -* @param {String|spAtlas} str +* @param {String|sp.Atlas} str * @param {float|float} float */ initWithBinaryFile : function( str, -spatlas, +atlas, float ) { }, /** - * @method onEnable + * @method initWithSkeleton + * @param {sp.Skeleton} arg0 + * @param {bool} arg1 + * @param {bool} arg2 + * @param {bool} arg3 */ -onEnable : function ( +initWithSkeleton : function ( +skeleton, +bool, +bool, +bool ) { }, /** - * @method beginSchedule + * @method getBoundingBox + * @return {rect_object} */ -beginSchedule : function ( +getBoundingBox : function ( ) { + return cc.Rect; }, /** @@ -179,17 +6267,15 @@ getDebugData : function ( }, /** - * @method initWithSkeleton - * @param {spSkeleton} arg0 - * @param {bool} arg1 - * @param {bool} arg2 + * @method findBone + * @param {String} arg0 + * @return {sp.Bone} */ -initWithSkeleton : function ( -spskeleton, -bool, -bool +findBone : function ( +str ) { + return sp.Bone; }, /** @@ -206,22 +6292,30 @@ float * @method getAttachment * @param {String} arg0 * @param {String} arg1 - * @return {spAttachment} + * @return {sp.Attachment} */ getAttachment : function ( str, str ) { - return spAttachment; + return sp.Attachment; }, /** - * @method initWithUUID - * @param {String} arg0 + * @method setDebugMeshEnabled + * @param {bool} arg0 */ -initWithUUID : function ( -str +setDebugMeshEnabled : function ( +bool +) +{ +}, + +/** + * @method beginSchedule + */ +beginSchedule : function ( ) { }, @@ -287,25 +6381,23 @@ color4b /** * @method setSkin * @param {char|String} char -* @return {bool|bool} */ setSkin : function( str ) { - return false; }, /** * @method findSlot * @param {String} arg0 - * @return {spSlot} + * @return {sp.Slot} */ findSlot : function ( str ) { - return spSlot; + return sp.Slot; }, /** @@ -318,37 +6410,37 @@ updateWorldTransform : function ( /** * @method getSkeleton - * @return {spSkeleton} + * @return {sp.Skeleton} */ getSkeleton : function ( ) { - return spSkeleton; + return sp.Skeleton; }, /** - * @method findBone - * @param {String} arg0 - * @return {spBone} + * @method setVertexEffectDelegate + * @param {sp.VertexEffectDelegate} arg0 */ -findBone : function ( -str +setVertexEffectDelegate : function ( +vertexeffectdelegate ) { - return spBone; }, /** - * @method SpineRenderer + * @method SkeletonRenderer * @constructor -* @param {spSkeleton|spSkeletonData|String|String} spskeleton -* @param {bool|bool|spAtlas|String} bool +* @param {sp.Skeleton|sp.SkeletonData|String|String} skeleton +* @param {bool|bool|sp.Atlas|String} bool * @param {bool|float|float} bool +* @param {bool} bool */ -SpineRenderer : function( -str, -str, -float +SkeletonRenderer : function( +skeleton, +bool, +bool, +bool ) { }, @@ -356,16 +6448,16 @@ float }; /** - * @class SpineAnimation + * @class SkeletonAnimation */ -spine.SpineAnimation = { +spine.SkeletonAnimation = { /** * @method setAnimation * @param {int} arg0 * @param {String} arg1 * @param {bool} arg2 - * @return {spTrackEntry} + * @return {sp.TrackEntry} */ setAnimation : function ( int, @@ -373,19 +6465,19 @@ str, bool ) { - return spTrackEntry; + return sp.TrackEntry; }, /** * @method findAnimation * @param {String} arg0 - * @return {spAnimation} + * @return {sp.Animation} */ findAnimation : function ( str ) { - return spAnimation; + return sp.Animation; }, /** @@ -407,7 +6499,7 @@ float * @param {int} arg0 * @param {float} arg1 * @param {float} arg2 - * @return {spTrackEntry} + * @return {sp.TrackEntry} */ addEmptyAnimation : function ( int, @@ -415,7 +6507,7 @@ float, float ) { - return spTrackEntry; + return sp.TrackEntry; }, /** @@ -430,10 +6522,10 @@ func /** * @method setAnimationStateData - * @param {spAnimationStateData} arg0 + * @param {sp.AnimationStateData} arg0 */ setAnimationStateData : function ( -spanimationstatedata +animationstatedata ) { }, @@ -450,12 +6542,12 @@ func /** * @method getState - * @return {spAnimationState} + * @return {sp.AnimationState} */ getState : function ( ) { - return spAnimationState; + return sp.AnimationState; }, /** @@ -470,12 +6562,12 @@ func /** * @method getCurrent - * @return {spTrackEntry} + * @return {sp.TrackEntry} */ getCurrent : function ( ) { - return spTrackEntry; + return sp.TrackEntry; }, /** @@ -492,14 +6584,14 @@ func * @method setEmptyAnimation * @param {int} arg0 * @param {float} arg1 - * @return {spTrackEntry} + * @return {sp.TrackEntry} */ setEmptyAnimation : function ( int, float ) { - return spTrackEntry; + return sp.TrackEntry; }, /** @@ -526,7 +6618,7 @@ func * @param {String} arg1 * @param {bool} arg2 * @param {float} arg3 - * @return {spTrackEntry} + * @return {sp.TrackEntry} */ addAnimation : function ( int, @@ -535,7 +6627,7 @@ bool, float ) { - return spTrackEntry; + return sp.TrackEntry; }, /** @@ -569,43 +6661,43 @@ func /** * @method createWithBinaryFile * @param {String|String} str -* @param {String|spAtlas} str +* @param {String|sp.Atlas} str * @param {float|float} float -* @return {sp.SpineAnimation|sp.SpineAnimation} +* @return {sp.SkeletonAnimation|sp.SkeletonAnimation} */ createWithBinaryFile : function( str, -spatlas, +atlas, float ) { - return sp.SpineAnimation; + return sp.SkeletonAnimation; }, /** * @method create - * @return {sp.SpineAnimation} + * @return {sp.SkeletonAnimation} */ create : function ( ) { - return sp.SpineAnimation; + return sp.SkeletonAnimation; }, /** * @method createWithJsonFile * @param {String|String} str -* @param {String|spAtlas} str +* @param {String|sp.Atlas} str * @param {float|float} float -* @return {sp.SpineAnimation|sp.SpineAnimation} +* @return {sp.SkeletonAnimation|sp.SkeletonAnimation} */ createWithJsonFile : function( str, -spatlas, +atlas, float ) { - return sp.SpineAnimation; + return sp.SkeletonAnimation; }, /** @@ -619,16 +6711,10 @@ float }, /** - * @method SpineAnimation + * @method SkeletonAnimation * @constructor -* @param {spSkeletonData|String|String} spskeletondata -* @param {bool|spAtlas|String} bool -* @param {float|float} float -*/ -SpineAnimation : function( -str, -str, -float + */ +SkeletonAnimation : function ( ) { }, diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp index 80ff08d4748..8f3edccf475 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp @@ -4,71 +4,12300 @@ #include "scripting/js-bindings/manual/jsb_global.h" #include "spine-creator-support/spine-cocos2dx.h" -se::Object* __jsb_spine_SpineRenderer_proto = nullptr; -se::Class* __jsb_spine_SpineRenderer_class = nullptr; +se::Object* __jsb_spine_Animation_proto = nullptr; +se::Class* __jsb_spine_Animation_class = nullptr; -static bool js_cocos2dx_spine_SpineRenderer_setUseTint(se::State& s) +static bool js_cocos2dx_spine_Animation_getTimelines(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setUseTint : Invalid Native Object"); + spine::Animation* cobj = (spine::Animation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Animation_getTimelines : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getTimelines(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Animation_getTimelines : 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_Animation_getTimelines) + +static bool js_cocos2dx_spine_Animation_getName(se::State& s) +{ + spine::Animation* cobj = (spine::Animation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Animation_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Animation_getName : 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_Animation_getName) + +static bool js_cocos2dx_spine_Animation_setDuration(se::State& s) +{ + spine::Animation* cobj = (spine::Animation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Animation_setDuration : 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_Animation_setDuration : Error processing arguments"); + cobj->setDuration(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_Animation_setDuration) + +static bool js_cocos2dx_spine_Animation_getDuration(se::State& s) +{ + spine::Animation* cobj = (spine::Animation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Animation_getDuration : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getDuration(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Animation_getDuration : 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_Animation_getDuration) + + + + +bool js_register_cocos2dx_spine_Animation(se::Object* obj) +{ + auto cls = se::Class::create("Animation", obj, nullptr, nullptr); + + cls->defineFunction("getTimelines", _SE(js_cocos2dx_spine_Animation_getTimelines)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_Animation_getName)); + cls->defineFunction("setDuration", _SE(js_cocos2dx_spine_Animation_setDuration)); + cls->defineFunction("getDuration", _SE(js_cocos2dx_spine_Animation_getDuration)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Animation_proto = cls->getProto(); + __jsb_spine_Animation_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_TrackEntry_proto = nullptr; +se::Class* __jsb_spine_TrackEntry_class = nullptr; + +static bool js_cocos2dx_spine_TrackEntry_getNext(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getNext : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::TrackEntry* result = cobj->getNext(); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getNext : 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_TrackEntry_getNext) + +static bool js_cocos2dx_spine_TrackEntry_getAttachmentThreshold(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAttachmentThreshold : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAttachmentThreshold(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getAttachmentThreshold : 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_TrackEntry_getAttachmentThreshold) + +static bool js_cocos2dx_spine_TrackEntry_setTimeScale(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_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_TrackEntry_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_TrackEntry_setTimeScale) + +static bool js_cocos2dx_spine_TrackEntry_getMixDuration(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getMixDuration : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getMixDuration(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getMixDuration : 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_TrackEntry_getMixDuration) + +static bool js_cocos2dx_spine_TrackEntry_setAnimationEnd(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setAnimationEnd : 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_TrackEntry_setAnimationEnd : Error processing arguments"); + cobj->setAnimationEnd(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_TrackEntry_setAnimationEnd) + +static bool js_cocos2dx_spine_TrackEntry_setEventThreshold(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setEventThreshold : 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_TrackEntry_setEventThreshold : Error processing arguments"); + cobj->setEventThreshold(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_TrackEntry_setEventThreshold) + +static bool js_cocos2dx_spine_TrackEntry_getMixingTo(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getMixingTo : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::TrackEntry* result = cobj->getMixingTo(); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getMixingTo : 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_TrackEntry_getMixingTo) + +static bool js_cocos2dx_spine_TrackEntry_setTrackEnd(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setTrackEnd : 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_TrackEntry_setTrackEnd : Error processing arguments"); + cobj->setTrackEnd(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_TrackEntry_setTrackEnd) + +static bool js_cocos2dx_spine_TrackEntry_getMixBlend(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getMixBlend : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = (unsigned int)cobj->getMixBlend(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getMixBlend : 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_TrackEntry_getMixBlend) + +static bool js_cocos2dx_spine_TrackEntry_getTrackEnd(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getTrackEnd : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTrackEnd(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getTrackEnd : 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_TrackEntry_getTrackEnd) + +static bool js_cocos2dx_spine_TrackEntry_setDelay(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setDelay : 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_TrackEntry_setDelay : Error processing arguments"); + cobj->setDelay(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_TrackEntry_setDelay) + +static bool js_cocos2dx_spine_TrackEntry_getAnimationEnd(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAnimationEnd : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAnimationEnd(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getAnimationEnd : 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_TrackEntry_getAnimationEnd) + +static bool js_cocos2dx_spine_TrackEntry_setAttachmentThreshold(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setAttachmentThreshold : 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_TrackEntry_setAttachmentThreshold : Error processing arguments"); + cobj->setAttachmentThreshold(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_TrackEntry_setAttachmentThreshold) + +static bool js_cocos2dx_spine_TrackEntry_setMixTime(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setMixTime : 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_TrackEntry_setMixTime : Error processing arguments"); + cobj->setMixTime(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_TrackEntry_setMixTime) + +static bool js_cocos2dx_spine_TrackEntry_isComplete(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_isComplete : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isComplete(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_isComplete : 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_TrackEntry_isComplete) + +static bool js_cocos2dx_spine_TrackEntry_getMixingFrom(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getMixingFrom : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::TrackEntry* result = cobj->getMixingFrom(); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getMixingFrom : 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_TrackEntry_getMixingFrom) + +static bool js_cocos2dx_spine_TrackEntry_setAlpha(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setAlpha : 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_TrackEntry_setAlpha : Error processing arguments"); + cobj->setAlpha(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_TrackEntry_setAlpha) + +static bool js_cocos2dx_spine_TrackEntry_getDrawOrderThreshold(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getDrawOrderThreshold : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getDrawOrderThreshold(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getDrawOrderThreshold : 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_TrackEntry_getDrawOrderThreshold) + +static bool js_cocos2dx_spine_TrackEntry_getMixTime(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getMixTime : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getMixTime(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getMixTime : 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_TrackEntry_getMixTime) + +static bool js_cocos2dx_spine_TrackEntry_setTrackTime(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setTrackTime : 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_TrackEntry_setTrackTime : Error processing arguments"); + cobj->setTrackTime(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_TrackEntry_setTrackTime) + +static bool js_cocos2dx_spine_TrackEntry_setMixDuration(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setMixDuration : 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_TrackEntry_setMixDuration : Error processing arguments"); + cobj->setMixDuration(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_TrackEntry_setMixDuration) + +static bool js_cocos2dx_spine_TrackEntry_resetRotationDirections(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_resetRotationDirections : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->resetRotationDirections(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_TrackEntry_resetRotationDirections) + +static bool js_cocos2dx_spine_TrackEntry_setHoldPrevious(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setHoldPrevious : 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_TrackEntry_setHoldPrevious : Error processing arguments"); + cobj->setHoldPrevious(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_TrackEntry_setHoldPrevious) + +static bool js_cocos2dx_spine_TrackEntry_getLoop(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getLoop : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getLoop(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getLoop : 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_TrackEntry_getLoop) + +static bool js_cocos2dx_spine_TrackEntry_getTrackTime(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getTrackTime : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTrackTime(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getTrackTime : 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_TrackEntry_getTrackTime) + +static bool js_cocos2dx_spine_TrackEntry_getAnimationStart(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAnimationStart : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAnimationStart(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getAnimationStart : 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_TrackEntry_getAnimationStart) + +static bool js_cocos2dx_spine_TrackEntry_getAnimationLast(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAnimationLast : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAnimationLast(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getAnimationLast : 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_TrackEntry_getAnimationLast) + +static bool js_cocos2dx_spine_TrackEntry_setAnimationStart(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setAnimationStart : 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_TrackEntry_setAnimationStart : Error processing arguments"); + cobj->setAnimationStart(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_TrackEntry_setAnimationStart) + +static bool js_cocos2dx_spine_TrackEntry_setLoop(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setLoop : 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_TrackEntry_setLoop : Error processing arguments"); + cobj->setLoop(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_TrackEntry_setLoop) + +static bool js_cocos2dx_spine_TrackEntry_getTrackIndex(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getTrackIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getTrackIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getTrackIndex : 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_TrackEntry_getTrackIndex) + +static bool js_cocos2dx_spine_TrackEntry_getTimeScale(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_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_TrackEntry_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_TrackEntry_getTimeScale) + +static bool js_cocos2dx_spine_TrackEntry_getDelay(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getDelay : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getDelay(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getDelay : 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_TrackEntry_getDelay) + +static bool js_cocos2dx_spine_TrackEntry_getAnimation(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Animation* result = cobj->getAnimation(); + ok &= native_ptr_to_rooted_seval((spine::Animation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_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_spine_TrackEntry_getAnimation) + +static bool js_cocos2dx_spine_TrackEntry_getHoldPrevious(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getHoldPrevious : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getHoldPrevious(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getHoldPrevious : 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_TrackEntry_getHoldPrevious) + +static bool js_cocos2dx_spine_TrackEntry_getAnimationTime(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAnimationTime : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAnimationTime(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getAnimationTime : 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_TrackEntry_getAnimationTime) + +static bool js_cocos2dx_spine_TrackEntry_getEventThreshold(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getEventThreshold : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getEventThreshold(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getEventThreshold : 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_TrackEntry_getEventThreshold) + +static bool js_cocos2dx_spine_TrackEntry_setDrawOrderThreshold(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setDrawOrderThreshold : 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_TrackEntry_setDrawOrderThreshold : Error processing arguments"); + cobj->setDrawOrderThreshold(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_TrackEntry_setDrawOrderThreshold) + +static bool js_cocos2dx_spine_TrackEntry_setAnimationLast(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setAnimationLast : 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_TrackEntry_setAnimationLast : Error processing arguments"); + cobj->setAnimationLast(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_TrackEntry_setAnimationLast) + +static bool js_cocos2dx_spine_TrackEntry_getAlpha(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_getAlpha : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAlpha(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_getAlpha : 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_TrackEntry_getAlpha) + +static bool js_cocos2dx_spine_TrackEntry_setMixBlend(se::State& s) +{ + spine::TrackEntry* cobj = (spine::TrackEntry*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TrackEntry_setMixBlend : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::MixBlend arg0; + ok &= seval_to_uint32(args[0], (uint32_t*)&arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TrackEntry_setMixBlend : Error processing arguments"); + cobj->setMixBlend(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_TrackEntry_setMixBlend) + + + + +bool js_register_cocos2dx_spine_TrackEntry(se::Object* obj) +{ + auto cls = se::Class::create("TrackEntry", obj, nullptr, nullptr); + + cls->defineFunction("getNext", _SE(js_cocos2dx_spine_TrackEntry_getNext)); + cls->defineFunction("getAttachmentThreshold", _SE(js_cocos2dx_spine_TrackEntry_getAttachmentThreshold)); + cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_TrackEntry_setTimeScale)); + cls->defineFunction("getMixDuration", _SE(js_cocos2dx_spine_TrackEntry_getMixDuration)); + cls->defineFunction("setAnimationEnd", _SE(js_cocos2dx_spine_TrackEntry_setAnimationEnd)); + cls->defineFunction("setEventThreshold", _SE(js_cocos2dx_spine_TrackEntry_setEventThreshold)); + cls->defineFunction("getMixingTo", _SE(js_cocos2dx_spine_TrackEntry_getMixingTo)); + cls->defineFunction("setTrackEnd", _SE(js_cocos2dx_spine_TrackEntry_setTrackEnd)); + cls->defineFunction("getMixBlend", _SE(js_cocos2dx_spine_TrackEntry_getMixBlend)); + cls->defineFunction("getTrackEnd", _SE(js_cocos2dx_spine_TrackEntry_getTrackEnd)); + cls->defineFunction("setDelay", _SE(js_cocos2dx_spine_TrackEntry_setDelay)); + cls->defineFunction("getAnimationEnd", _SE(js_cocos2dx_spine_TrackEntry_getAnimationEnd)); + cls->defineFunction("setAttachmentThreshold", _SE(js_cocos2dx_spine_TrackEntry_setAttachmentThreshold)); + cls->defineFunction("setMixTime", _SE(js_cocos2dx_spine_TrackEntry_setMixTime)); + cls->defineFunction("isComplete", _SE(js_cocos2dx_spine_TrackEntry_isComplete)); + cls->defineFunction("getMixingFrom", _SE(js_cocos2dx_spine_TrackEntry_getMixingFrom)); + cls->defineFunction("setAlpha", _SE(js_cocos2dx_spine_TrackEntry_setAlpha)); + cls->defineFunction("getDrawOrderThreshold", _SE(js_cocos2dx_spine_TrackEntry_getDrawOrderThreshold)); + cls->defineFunction("getMixTime", _SE(js_cocos2dx_spine_TrackEntry_getMixTime)); + cls->defineFunction("setTrackTime", _SE(js_cocos2dx_spine_TrackEntry_setTrackTime)); + cls->defineFunction("setMixDuration", _SE(js_cocos2dx_spine_TrackEntry_setMixDuration)); + cls->defineFunction("resetRotationDirections", _SE(js_cocos2dx_spine_TrackEntry_resetRotationDirections)); + cls->defineFunction("setHoldPrevious", _SE(js_cocos2dx_spine_TrackEntry_setHoldPrevious)); + cls->defineFunction("getLoop", _SE(js_cocos2dx_spine_TrackEntry_getLoop)); + cls->defineFunction("getTrackTime", _SE(js_cocos2dx_spine_TrackEntry_getTrackTime)); + cls->defineFunction("getAnimationStart", _SE(js_cocos2dx_spine_TrackEntry_getAnimationStart)); + cls->defineFunction("getAnimationLast", _SE(js_cocos2dx_spine_TrackEntry_getAnimationLast)); + cls->defineFunction("setAnimationStart", _SE(js_cocos2dx_spine_TrackEntry_setAnimationStart)); + cls->defineFunction("setLoop", _SE(js_cocos2dx_spine_TrackEntry_setLoop)); + cls->defineFunction("getTrackIndex", _SE(js_cocos2dx_spine_TrackEntry_getTrackIndex)); + cls->defineFunction("getTimeScale", _SE(js_cocos2dx_spine_TrackEntry_getTimeScale)); + cls->defineFunction("getDelay", _SE(js_cocos2dx_spine_TrackEntry_getDelay)); + cls->defineFunction("getAnimation", _SE(js_cocos2dx_spine_TrackEntry_getAnimation)); + cls->defineFunction("getHoldPrevious", _SE(js_cocos2dx_spine_TrackEntry_getHoldPrevious)); + cls->defineFunction("getAnimationTime", _SE(js_cocos2dx_spine_TrackEntry_getAnimationTime)); + cls->defineFunction("getEventThreshold", _SE(js_cocos2dx_spine_TrackEntry_getEventThreshold)); + cls->defineFunction("setDrawOrderThreshold", _SE(js_cocos2dx_spine_TrackEntry_setDrawOrderThreshold)); + cls->defineFunction("setAnimationLast", _SE(js_cocos2dx_spine_TrackEntry_setAnimationLast)); + cls->defineFunction("getAlpha", _SE(js_cocos2dx_spine_TrackEntry_getAlpha)); + cls->defineFunction("setMixBlend", _SE(js_cocos2dx_spine_TrackEntry_setMixBlend)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_TrackEntry_proto = cls->getProto(); + __jsb_spine_TrackEntry_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_AnimationState_proto = nullptr; +se::Class* __jsb_spine_AnimationState_class = nullptr; + +static bool js_cocos2dx_spine_AnimationState_getData(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::AnimationStateData* result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::AnimationStateData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_getData : 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_AnimationState_getData) + +static bool js_cocos2dx_spine_AnimationState_addAnimation(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_AnimationState_addAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 4) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + if (!ok) { ok = true; break; } + spine::Animation* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); + if (!ok) { ok = true; break; } + bool arg2; + ok &= seval_to_boolean(args[2], &arg2); + float arg3 = 0; + ok &= seval_to_float(args[3], &arg3); + if (!ok) { ok = true; break; } + spine::TrackEntry* result = cobj->addAnimation(arg0, arg1, arg2, arg3); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_addAnimation : Error processing arguments"); + return true; + } + } while(false); + + do { + if (argc == 4) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + if (!ok) { ok = true; break; } + spine::String arg1; + arg1 = args[1].toStringForce().c_str(); + if (!ok) { ok = true; break; } + bool arg2; + ok &= seval_to_boolean(args[2], &arg2); + float arg3 = 0; + ok &= seval_to_float(args[3], &arg3); + if (!ok) { ok = true; break; } + spine::TrackEntry* result = cobj->addAnimation(arg0, arg1, arg2, arg3); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_addAnimation : 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_AnimationState_addAnimation) + +static bool js_cocos2dx_spine_AnimationState_setEmptyAnimations(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_setEmptyAnimations : 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_AnimationState_setEmptyAnimations : Error processing arguments"); + cobj->setEmptyAnimations(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_AnimationState_setEmptyAnimations) + +static bool js_cocos2dx_spine_AnimationState_getCurrent(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_getCurrent : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_getCurrent : Error processing arguments"); + spine::TrackEntry* result = cobj->getCurrent(arg0); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_getCurrent : 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_AnimationState_getCurrent) + +static bool js_cocos2dx_spine_AnimationState_enableQueue(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_enableQueue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->enableQueue(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_AnimationState_enableQueue) + +static bool js_cocos2dx_spine_AnimationState_clearTracks(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_clearTracks : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->clearTracks(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_AnimationState_clearTracks) + +static bool js_cocos2dx_spine_AnimationState_update(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_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_AnimationState_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_AnimationState_update) + +static bool js_cocos2dx_spine_AnimationState_disableQueue(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_disableQueue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->disableQueue(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_AnimationState_disableQueue) + +static bool js_cocos2dx_spine_AnimationState_setEmptyAnimation(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_setEmptyAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + size_t arg0 = 0; + float arg1 = 0; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_setEmptyAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->setEmptyAnimation(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_setEmptyAnimation : 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_AnimationState_setEmptyAnimation) + +static bool js_cocos2dx_spine_AnimationState_setTimeScale(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_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_AnimationState_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_AnimationState_setTimeScale) + +static bool js_cocos2dx_spine_AnimationState_getTracks(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_getTracks : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getTracks(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_getTracks : 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_AnimationState_getTracks) + +static bool js_cocos2dx_spine_AnimationState_clearTrack(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_clearTrack : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_clearTrack : Error processing arguments"); + cobj->clearTrack(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_AnimationState_clearTrack) + +static bool js_cocos2dx_spine_AnimationState_setAnimation(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_AnimationState_setAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 3) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + if (!ok) { ok = true; break; } + spine::Animation* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); + if (!ok) { ok = true; break; } + bool arg2; + ok &= seval_to_boolean(args[2], &arg2); + spine::TrackEntry* result = cobj->setAnimation(arg0, arg1, arg2); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_setAnimation : Error processing arguments"); + return true; + } + } while(false); + + do { + if (argc == 3) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + if (!ok) { ok = true; break; } + spine::String arg1; + arg1 = args[1].toStringForce().c_str(); + if (!ok) { ok = true; break; } + bool arg2; + ok &= seval_to_boolean(args[2], &arg2); + spine::TrackEntry* result = cobj->setAnimation(arg0, arg1, arg2); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_setAnimation : 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_AnimationState_setAnimation) + +static bool js_cocos2dx_spine_AnimationState_addEmptyAnimation(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_addEmptyAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + size_t arg0 = 0; + float arg1 = 0; + float arg2 = 0; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_addEmptyAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->addEmptyAnimation(arg0, arg1, arg2); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationState_addEmptyAnimation : 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_spine_AnimationState_addEmptyAnimation) + +static bool js_cocos2dx_spine_AnimationState_getTimeScale(se::State& s) +{ + spine::AnimationState* cobj = (spine::AnimationState*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationState_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_AnimationState_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_AnimationState_getTimeScale) + + + + +bool js_register_cocos2dx_spine_AnimationState(se::Object* obj) +{ + auto cls = se::Class::create("AnimationState", obj, nullptr, nullptr); + + cls->defineFunction("getData", _SE(js_cocos2dx_spine_AnimationState_getData)); + cls->defineFunction("addAnimation", _SE(js_cocos2dx_spine_AnimationState_addAnimation)); + cls->defineFunction("setEmptyAnimations", _SE(js_cocos2dx_spine_AnimationState_setEmptyAnimations)); + cls->defineFunction("getCurrent", _SE(js_cocos2dx_spine_AnimationState_getCurrent)); + cls->defineFunction("enableQueue", _SE(js_cocos2dx_spine_AnimationState_enableQueue)); + cls->defineFunction("clearTracks", _SE(js_cocos2dx_spine_AnimationState_clearTracks)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_AnimationState_update)); + cls->defineFunction("disableQueue", _SE(js_cocos2dx_spine_AnimationState_disableQueue)); + cls->defineFunction("setEmptyAnimation", _SE(js_cocos2dx_spine_AnimationState_setEmptyAnimation)); + cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_AnimationState_setTimeScale)); + cls->defineFunction("getTracks", _SE(js_cocos2dx_spine_AnimationState_getTracks)); + cls->defineFunction("clearTrack", _SE(js_cocos2dx_spine_AnimationState_clearTrack)); + cls->defineFunction("setAnimation", _SE(js_cocos2dx_spine_AnimationState_setAnimation)); + cls->defineFunction("addEmptyAnimation", _SE(js_cocos2dx_spine_AnimationState_addEmptyAnimation)); + cls->defineFunction("getTimeScale", _SE(js_cocos2dx_spine_AnimationState_getTimeScale)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_AnimationState_proto = cls->getProto(); + __jsb_spine_AnimationState_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_AnimationStateData_proto = nullptr; +se::Class* __jsb_spine_AnimationStateData_class = nullptr; + +static bool js_cocos2dx_spine_AnimationStateData_getMix(se::State& s) +{ + spine::AnimationStateData* cobj = (spine::AnimationStateData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationStateData_getMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + spine::Animation* arg0 = nullptr; + spine::Animation* arg1 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + ok &= seval_to_native_ptr(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationStateData_getMix : Error processing arguments"); + float result = cobj->getMix(arg0, arg1); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationStateData_getMix : 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_AnimationStateData_getMix) + +static bool js_cocos2dx_spine_AnimationStateData_getDefaultMix(se::State& s) +{ + spine::AnimationStateData* cobj = (spine::AnimationStateData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationStateData_getDefaultMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getDefaultMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationStateData_getDefaultMix : 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_AnimationStateData_getDefaultMix) + +static bool js_cocos2dx_spine_AnimationStateData_setMix(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::AnimationStateData* cobj = (spine::AnimationStateData*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_AnimationStateData_setMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 3) { + spine::Animation* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + spine::Animation* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); + if (!ok) { ok = true; break; } + float arg2 = 0; + ok &= seval_to_float(args[2], &arg2); + if (!ok) { ok = true; break; } + cobj->setMix(arg0, arg1, arg2); + return true; + } + } while(false); + + do { + if (argc == 3) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + if (!ok) { ok = true; break; } + spine::String arg1; + arg1 = args[1].toStringForce().c_str(); + if (!ok) { ok = true; break; } + float arg2 = 0; + ok &= seval_to_float(args[2], &arg2); + if (!ok) { ok = true; break; } + cobj->setMix(arg0, arg1, arg2); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_AnimationStateData_setMix) + +static bool js_cocos2dx_spine_AnimationStateData_setDefaultMix(se::State& s) +{ + spine::AnimationStateData* cobj = (spine::AnimationStateData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationStateData_setDefaultMix : 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_AnimationStateData_setDefaultMix : Error processing arguments"); + cobj->setDefaultMix(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_AnimationStateData_setDefaultMix) + +static bool js_cocos2dx_spine_AnimationStateData_getSkeletonData(se::State& s) +{ + spine::AnimationStateData* cobj = (spine::AnimationStateData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AnimationStateData_getSkeletonData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SkeletonData* result = cobj->getSkeletonData(); + ok &= native_ptr_to_rooted_seval((spine::SkeletonData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AnimationStateData_getSkeletonData : 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_AnimationStateData_getSkeletonData) + + + + +bool js_register_cocos2dx_spine_AnimationStateData(se::Object* obj) +{ + auto cls = se::Class::create("AnimationStateData", obj, nullptr, nullptr); + + cls->defineFunction("getMix", _SE(js_cocos2dx_spine_AnimationStateData_getMix)); + cls->defineFunction("getDefaultMix", _SE(js_cocos2dx_spine_AnimationStateData_getDefaultMix)); + cls->defineFunction("setMix", _SE(js_cocos2dx_spine_AnimationStateData_setMix)); + cls->defineFunction("setDefaultMix", _SE(js_cocos2dx_spine_AnimationStateData_setDefaultMix)); + cls->defineFunction("getSkeletonData", _SE(js_cocos2dx_spine_AnimationStateData_getSkeletonData)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_AnimationStateData_proto = cls->getProto(); + __jsb_spine_AnimationStateData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Attachment_proto = nullptr; +se::Class* __jsb_spine_Attachment_class = nullptr; + +static bool js_cocos2dx_spine_Attachment_getName(se::State& s) +{ + spine::Attachment* cobj = (spine::Attachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Attachment_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Attachment_getName : 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_Attachment_getName) + + + + +bool js_register_cocos2dx_spine_Attachment(se::Object* obj) +{ + auto cls = se::Class::create("Attachment", obj, nullptr, nullptr); + + cls->defineFunction("getName", _SE(js_cocos2dx_spine_Attachment_getName)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Attachment_proto = cls->getProto(); + __jsb_spine_Attachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Timeline_proto = nullptr; +se::Class* __jsb_spine_Timeline_class = nullptr; + +static bool js_cocos2dx_spine_Timeline_getPropertyId(se::State& s) +{ + spine::Timeline* cobj = (spine::Timeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Timeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Timeline_getPropertyId : 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_Timeline_getPropertyId) + + + + +bool js_register_cocos2dx_spine_Timeline(se::Object* obj) +{ + auto cls = se::Class::create("Timeline", obj, nullptr, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_Timeline_getPropertyId)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Timeline_proto = cls->getProto(); + __jsb_spine_Timeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_AttachmentTimeline_proto = nullptr; +se::Class* __jsb_spine_AttachmentTimeline_class = nullptr; + +static bool js_cocos2dx_spine_AttachmentTimeline_getAttachmentNames(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_getAttachmentNames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::Vector& result = cobj->getAttachmentNames(); + ok &= spine_Vector_String_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_getAttachmentNames : 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_AttachmentTimeline_getAttachmentNames) + +static bool js_cocos2dx_spine_AttachmentTimeline_setSlotIndex(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_setSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_setSlotIndex : Error processing arguments"); + cobj->setSlotIndex(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_AttachmentTimeline_setSlotIndex) + +static bool js_cocos2dx_spine_AttachmentTimeline_getPropertyId(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_getPropertyId : 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_AttachmentTimeline_getPropertyId) + +static bool js_cocos2dx_spine_AttachmentTimeline_setFrame(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + int arg0 = 0; + float arg1 = 0; + spine::String arg2; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + arg2 = args[2].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_setFrame : Error processing arguments"); + cobj->setFrame(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_AttachmentTimeline_setFrame) + +static bool js_cocos2dx_spine_AttachmentTimeline_getSlotIndex(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_getSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getSlotIndex(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_getSlotIndex : 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_AttachmentTimeline_getSlotIndex) + +static bool js_cocos2dx_spine_AttachmentTimeline_getFrameCount(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_getFrameCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getFrameCount(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_getFrameCount : 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_AttachmentTimeline_getFrameCount) + +static bool js_cocos2dx_spine_AttachmentTimeline_getFrames(se::State& s) +{ + spine::AttachmentTimeline* cobj = (spine::AttachmentTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_AttachmentTimeline_getFrames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::Vector& result = cobj->getFrames(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_AttachmentTimeline_getFrames : 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_AttachmentTimeline_getFrames) + + +extern se::Object* __jsb_spine_Timeline_proto; + + +bool js_register_cocos2dx_spine_AttachmentTimeline(se::Object* obj) +{ + auto cls = se::Class::create("AttachmentTimeline", obj, __jsb_spine_Timeline_proto, nullptr); + + cls->defineFunction("getAttachmentNames", _SE(js_cocos2dx_spine_AttachmentTimeline_getAttachmentNames)); + cls->defineFunction("setSlotIndex", _SE(js_cocos2dx_spine_AttachmentTimeline_setSlotIndex)); + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_AttachmentTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_AttachmentTimeline_setFrame)); + cls->defineFunction("getSlotIndex", _SE(js_cocos2dx_spine_AttachmentTimeline_getSlotIndex)); + cls->defineFunction("getFrameCount", _SE(js_cocos2dx_spine_AttachmentTimeline_getFrameCount)); + cls->defineFunction("getFrames", _SE(js_cocos2dx_spine_AttachmentTimeline_getFrames)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_AttachmentTimeline_proto = cls->getProto(); + __jsb_spine_AttachmentTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Bone_proto = nullptr; +se::Class* __jsb_spine_Bone_class = nullptr; + +static bool js_cocos2dx_spine_Bone_setD(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setD : 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_Bone_setD : Error processing arguments"); + cobj->setD(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_Bone_setD) + +static bool js_cocos2dx_spine_Bone_setAppliedRotation(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAppliedRotation : 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_Bone_setAppliedRotation : Error processing arguments"); + cobj->setAppliedRotation(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_Bone_setAppliedRotation) + +static bool js_cocos2dx_spine_Bone_setAScaleY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAScaleY : 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_Bone_setAScaleY : Error processing arguments"); + cobj->setAScaleY(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_Bone_setAScaleY) + +static bool js_cocos2dx_spine_Bone_setAScaleX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAScaleX : 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_Bone_setAScaleX : Error processing arguments"); + cobj->setAScaleX(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_Bone_setAScaleX) + +static bool js_cocos2dx_spine_Bone_getB(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getB(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getB : 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_Bone_getB) + +static bool js_cocos2dx_spine_Bone_getC(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getC : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getC(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getC : 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_Bone_getC) + +static bool js_cocos2dx_spine_Bone_getD(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getD : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getD(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getD : 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_Bone_getD) + +static bool js_cocos2dx_spine_Bone_getWorldScaleY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldScaleY : 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_Bone_getWorldScaleY) + +static bool js_cocos2dx_spine_Bone_getX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getX : 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_Bone_getX) + +static bool js_cocos2dx_spine_Bone_getY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getY : 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_Bone_getY) + +static bool js_cocos2dx_spine_Bone_getChildren(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getChildren : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getChildren(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getChildren : 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_Bone_getChildren) + +static bool js_cocos2dx_spine_Bone_setWorldX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setWorldX : 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_Bone_setWorldX : Error processing arguments"); + cobj->setWorldX(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_Bone_setWorldX) + +static bool js_cocos2dx_spine_Bone_setAppliedValid(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAppliedValid : 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_Bone_setAppliedValid : Error processing arguments"); + cobj->setAppliedValid(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_Bone_setAppliedValid) + +static bool js_cocos2dx_spine_Bone_getRotation(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getRotation : 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_Bone_getRotation) + +static bool js_cocos2dx_spine_Bone_getAShearX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAShearX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAShearX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAShearX : 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_Bone_getAShearX) + +static bool js_cocos2dx_spine_Bone_getAShearY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAShearY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAShearY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAShearY : 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_Bone_getAShearY) + +static bool js_cocos2dx_spine_Bone_getWorldRotationY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldRotationY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldRotationY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldRotationY : 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_Bone_getWorldRotationY) + +static bool js_cocos2dx_spine_Bone_isAppliedValid(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_isAppliedValid : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isAppliedValid(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_isAppliedValid : 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_Bone_isAppliedValid) + +static bool js_cocos2dx_spine_Bone_getScaleY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getScaleY : 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_Bone_getScaleY) + +static bool js_cocos2dx_spine_Bone_getScaleX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getScaleX : 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_Bone_getScaleX) + +static bool js_cocos2dx_spine_Bone_setToSetupPose(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setToSetupPose : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->setToSetupPose(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Bone_setToSetupPose) + +static bool js_cocos2dx_spine_Bone_getWorldToLocalRotationX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldToLocalRotationX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldToLocalRotationX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldToLocalRotationX : 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_Bone_getWorldToLocalRotationX) + +static bool js_cocos2dx_spine_Bone_getWorldToLocalRotationY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldToLocalRotationY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldToLocalRotationY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldToLocalRotationY : 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_Bone_getWorldToLocalRotationY) + +static bool js_cocos2dx_spine_Bone_getAScaleX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAScaleX : 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_Bone_getAScaleX) + +static bool js_cocos2dx_spine_Bone_getA(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getA : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getA(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getA : 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_Bone_getA) + +static bool js_cocos2dx_spine_Bone_setRotation(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setRotation : 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_Bone_setRotation : Error processing arguments"); + cobj->setRotation(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_Bone_setRotation) + +static bool js_cocos2dx_spine_Bone_getAX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAX : 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_Bone_getAX) + +static bool js_cocos2dx_spine_Bone_getData(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::BoneData& result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::BoneData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getData : 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_Bone_getData) + +static bool js_cocos2dx_spine_Bone_setShearX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setShearX : 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_Bone_setShearX : Error processing arguments"); + cobj->setShearX(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_Bone_setShearX) + +static bool js_cocos2dx_spine_Bone_setShearY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setShearY : 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_Bone_setShearY : Error processing arguments"); + cobj->setShearY(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_Bone_setShearY) + +static bool js_cocos2dx_spine_Bone_setScaleY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setScaleY : 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_Bone_setScaleY : Error processing arguments"); + cobj->setScaleY(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_Bone_setScaleY) + +static bool js_cocos2dx_spine_Bone_setScaleX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setScaleX : 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_Bone_setScaleX : Error processing arguments"); + cobj->setScaleX(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_Bone_setScaleX) + +static bool js_cocos2dx_spine_Bone_setA(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setA : 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_Bone_setA : Error processing arguments"); + cobj->setA(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_Bone_setA) + +static bool js_cocos2dx_spine_Bone_setB(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setB : 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_Bone_setB : Error processing arguments"); + cobj->setB(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_Bone_setB) + +static bool js_cocos2dx_spine_Bone_getAScaleY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAScaleY : 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_Bone_getAScaleY) + +static bool js_cocos2dx_spine_Bone_getWorldScaleX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldScaleX : 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_Bone_getWorldScaleX) + +static bool js_cocos2dx_spine_Bone_getWorldRotationX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldRotationX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldRotationX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldRotationX : 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_Bone_getWorldRotationX) + +static bool js_cocos2dx_spine_Bone_getShearX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getShearX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getShearX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getShearX : 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_Bone_getShearX) + +static bool js_cocos2dx_spine_Bone_update(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_update : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->update(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Bone_update) + +static bool js_cocos2dx_spine_Bone_getShearY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getShearY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getShearY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getShearY : 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_Bone_getShearY) + +static bool js_cocos2dx_spine_Bone_setAShearX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAShearX : 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_Bone_setAShearX : Error processing arguments"); + cobj->setAShearX(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_Bone_setAShearX) + +static bool js_cocos2dx_spine_Bone_setAShearY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAShearY : 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_Bone_setAShearY : Error processing arguments"); + cobj->setAShearY(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_Bone_setAShearY) + +static bool js_cocos2dx_spine_Bone_setC(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setC : 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_Bone_setC : Error processing arguments"); + cobj->setC(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_Bone_setC) + +static bool js_cocos2dx_spine_Bone_setWorldY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setWorldY : 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_Bone_setWorldY : Error processing arguments"); + cobj->setWorldY(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_Bone_setWorldY) + +static bool js_cocos2dx_spine_Bone_setX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setX : 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_Bone_setX : Error processing arguments"); + cobj->setX(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_Bone_setX) + +static bool js_cocos2dx_spine_Bone_setY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setY : 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_Bone_setY : Error processing arguments"); + cobj->setY(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_Bone_setY) + +static bool js_cocos2dx_spine_Bone_setAX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAX : 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_Bone_setAX : Error processing arguments"); + cobj->setAX(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_Bone_setAX) + +static bool js_cocos2dx_spine_Bone_setAY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_setAY : 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_Bone_setAY : Error processing arguments"); + cobj->setAY(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_Bone_setAY) + +static bool js_cocos2dx_spine_Bone_getAY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAY : 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_Bone_getAY) + +static bool js_cocos2dx_spine_Bone_rotateWorld(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_rotateWorld : 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_Bone_rotateWorld : Error processing arguments"); + cobj->rotateWorld(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_Bone_rotateWorld) + +static bool js_cocos2dx_spine_Bone_getParent(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getParent : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Bone* result = cobj->getParent(); + ok &= native_ptr_to_rooted_seval((spine::Bone*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getParent : 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_Bone_getParent) + +static bool js_cocos2dx_spine_Bone_getAppliedRotation(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getAppliedRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAppliedRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getAppliedRotation : 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_Bone_getAppliedRotation) + +static bool js_cocos2dx_spine_Bone_updateWorldTransform(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_Bone_updateWorldTransform : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 7) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + if (!ok) { ok = true; break; } + float arg1 = 0; + ok &= seval_to_float(args[1], &arg1); + if (!ok) { ok = true; break; } + float arg2 = 0; + ok &= seval_to_float(args[2], &arg2); + if (!ok) { ok = true; break; } + float arg3 = 0; + ok &= seval_to_float(args[3], &arg3); + if (!ok) { ok = true; break; } + float arg4 = 0; + ok &= seval_to_float(args[4], &arg4); + if (!ok) { ok = true; break; } + float arg5 = 0; + ok &= seval_to_float(args[5], &arg5); + if (!ok) { ok = true; break; } + float arg6 = 0; + ok &= seval_to_float(args[6], &arg6); + if (!ok) { ok = true; break; } + cobj->updateWorldTransform(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return true; + } + } while(false); + + do { + if (argc == 0) { + cobj->updateWorldTransform(); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Bone_updateWorldTransform) + +static bool js_cocos2dx_spine_Bone_getWorldY(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldY : 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_Bone_getWorldY) + +static bool js_cocos2dx_spine_Bone_getWorldX(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_getWorldX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_getWorldX : 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_Bone_getWorldX) + +static bool js_cocos2dx_spine_Bone_getSkeleton(se::State& s) +{ + spine::Bone* cobj = (spine::Bone*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Bone_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_Bone_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_Bone_getSkeleton) + +static bool js_cocos2dx_spine_Bone_isYDown(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = spine::Bone::isYDown(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Bone_isYDown : 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_Bone_isYDown) + +static bool js_cocos2dx_spine_Bone_setYDown(se::State& s) +{ + 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_Bone_setYDown : Error processing arguments"); + spine::Bone::setYDown(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_Bone_setYDown) + + + + +bool js_register_cocos2dx_spine_Bone(se::Object* obj) +{ + auto cls = se::Class::create("Bone", obj, nullptr, nullptr); + + cls->defineFunction("setD", _SE(js_cocos2dx_spine_Bone_setD)); + cls->defineFunction("setAppliedRotation", _SE(js_cocos2dx_spine_Bone_setAppliedRotation)); + cls->defineFunction("setAScaleY", _SE(js_cocos2dx_spine_Bone_setAScaleY)); + cls->defineFunction("setAScaleX", _SE(js_cocos2dx_spine_Bone_setAScaleX)); + cls->defineFunction("getB", _SE(js_cocos2dx_spine_Bone_getB)); + cls->defineFunction("getC", _SE(js_cocos2dx_spine_Bone_getC)); + cls->defineFunction("getD", _SE(js_cocos2dx_spine_Bone_getD)); + cls->defineFunction("getWorldScaleY", _SE(js_cocos2dx_spine_Bone_getWorldScaleY)); + cls->defineFunction("getX", _SE(js_cocos2dx_spine_Bone_getX)); + cls->defineFunction("getY", _SE(js_cocos2dx_spine_Bone_getY)); + cls->defineFunction("getChildren", _SE(js_cocos2dx_spine_Bone_getChildren)); + cls->defineFunction("setWorldX", _SE(js_cocos2dx_spine_Bone_setWorldX)); + cls->defineFunction("setAppliedValid", _SE(js_cocos2dx_spine_Bone_setAppliedValid)); + cls->defineFunction("getRotation", _SE(js_cocos2dx_spine_Bone_getRotation)); + cls->defineFunction("getAShearX", _SE(js_cocos2dx_spine_Bone_getAShearX)); + cls->defineFunction("getAShearY", _SE(js_cocos2dx_spine_Bone_getAShearY)); + cls->defineFunction("getWorldRotationY", _SE(js_cocos2dx_spine_Bone_getWorldRotationY)); + cls->defineFunction("isAppliedValid", _SE(js_cocos2dx_spine_Bone_isAppliedValid)); + cls->defineFunction("getScaleY", _SE(js_cocos2dx_spine_Bone_getScaleY)); + cls->defineFunction("getScaleX", _SE(js_cocos2dx_spine_Bone_getScaleX)); + cls->defineFunction("setToSetupPose", _SE(js_cocos2dx_spine_Bone_setToSetupPose)); + cls->defineFunction("getWorldToLocalRotationX", _SE(js_cocos2dx_spine_Bone_getWorldToLocalRotationX)); + cls->defineFunction("getWorldToLocalRotationY", _SE(js_cocos2dx_spine_Bone_getWorldToLocalRotationY)); + cls->defineFunction("getAScaleX", _SE(js_cocos2dx_spine_Bone_getAScaleX)); + cls->defineFunction("getA", _SE(js_cocos2dx_spine_Bone_getA)); + cls->defineFunction("setRotation", _SE(js_cocos2dx_spine_Bone_setRotation)); + cls->defineFunction("getAX", _SE(js_cocos2dx_spine_Bone_getAX)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_Bone_getData)); + cls->defineFunction("setShearX", _SE(js_cocos2dx_spine_Bone_setShearX)); + cls->defineFunction("setShearY", _SE(js_cocos2dx_spine_Bone_setShearY)); + cls->defineFunction("setScaleY", _SE(js_cocos2dx_spine_Bone_setScaleY)); + cls->defineFunction("setScaleX", _SE(js_cocos2dx_spine_Bone_setScaleX)); + cls->defineFunction("setA", _SE(js_cocos2dx_spine_Bone_setA)); + cls->defineFunction("setB", _SE(js_cocos2dx_spine_Bone_setB)); + cls->defineFunction("getAScaleY", _SE(js_cocos2dx_spine_Bone_getAScaleY)); + cls->defineFunction("getWorldScaleX", _SE(js_cocos2dx_spine_Bone_getWorldScaleX)); + cls->defineFunction("getWorldRotationX", _SE(js_cocos2dx_spine_Bone_getWorldRotationX)); + cls->defineFunction("getShearX", _SE(js_cocos2dx_spine_Bone_getShearX)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_Bone_update)); + cls->defineFunction("getShearY", _SE(js_cocos2dx_spine_Bone_getShearY)); + cls->defineFunction("setAShearX", _SE(js_cocos2dx_spine_Bone_setAShearX)); + cls->defineFunction("setAShearY", _SE(js_cocos2dx_spine_Bone_setAShearY)); + cls->defineFunction("setC", _SE(js_cocos2dx_spine_Bone_setC)); + cls->defineFunction("setWorldY", _SE(js_cocos2dx_spine_Bone_setWorldY)); + cls->defineFunction("setX", _SE(js_cocos2dx_spine_Bone_setX)); + cls->defineFunction("setY", _SE(js_cocos2dx_spine_Bone_setY)); + cls->defineFunction("setAX", _SE(js_cocos2dx_spine_Bone_setAX)); + cls->defineFunction("setAY", _SE(js_cocos2dx_spine_Bone_setAY)); + cls->defineFunction("getAY", _SE(js_cocos2dx_spine_Bone_getAY)); + cls->defineFunction("rotateWorld", _SE(js_cocos2dx_spine_Bone_rotateWorld)); + cls->defineFunction("getParent", _SE(js_cocos2dx_spine_Bone_getParent)); + cls->defineFunction("getAppliedRotation", _SE(js_cocos2dx_spine_Bone_getAppliedRotation)); + cls->defineFunction("updateWorldTransform", _SE(js_cocos2dx_spine_Bone_updateWorldTransform)); + cls->defineFunction("getWorldY", _SE(js_cocos2dx_spine_Bone_getWorldY)); + cls->defineFunction("getWorldX", _SE(js_cocos2dx_spine_Bone_getWorldX)); + cls->defineFunction("getSkeleton", _SE(js_cocos2dx_spine_Bone_getSkeleton)); + cls->defineStaticFunction("isYDown", _SE(js_cocos2dx_spine_Bone_isYDown)); + cls->defineStaticFunction("setYDown", _SE(js_cocos2dx_spine_Bone_setYDown)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Bone_proto = cls->getProto(); + __jsb_spine_Bone_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_BoneData_proto = nullptr; +se::Class* __jsb_spine_BoneData_class = nullptr; + +static bool js_cocos2dx_spine_BoneData_getIndex(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getIndex : 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_BoneData_getIndex) + +static bool js_cocos2dx_spine_BoneData_setShearX(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setShearX : 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_BoneData_setShearX : Error processing arguments"); + cobj->setShearX(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_BoneData_setShearX) + +static bool js_cocos2dx_spine_BoneData_setScaleY(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setScaleY : 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_BoneData_setScaleY : Error processing arguments"); + cobj->setScaleY(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_BoneData_setScaleY) + +static bool js_cocos2dx_spine_BoneData_setScaleX(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setScaleX : 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_BoneData_setScaleX : Error processing arguments"); + cobj->setScaleX(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_BoneData_setScaleX) + +static bool js_cocos2dx_spine_BoneData_getParent(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getParent : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::BoneData* result = cobj->getParent(); + ok &= native_ptr_to_rooted_seval((spine::BoneData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getParent : 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_BoneData_getParent) + +static bool js_cocos2dx_spine_BoneData_getScaleY(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getScaleY : 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_BoneData_getScaleY) + +static bool js_cocos2dx_spine_BoneData_getScaleX(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getScaleX : 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_BoneData_getScaleX) + +static bool js_cocos2dx_spine_BoneData_getLength(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getLength : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getLength(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getLength : 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_BoneData_getLength) + +static bool js_cocos2dx_spine_BoneData_getName(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getName : 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_BoneData_getName) + +static bool js_cocos2dx_spine_BoneData_getShearX(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getShearX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getShearX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getShearX : 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_BoneData_getShearX) + +static bool js_cocos2dx_spine_BoneData_getShearY(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getShearY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getShearY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getShearY : 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_BoneData_getShearY) + +static bool js_cocos2dx_spine_BoneData_setY(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setY : 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_BoneData_setY : Error processing arguments"); + cobj->setY(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_BoneData_setY) + +static bool js_cocos2dx_spine_BoneData_getX(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getX : 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_BoneData_getX) + +static bool js_cocos2dx_spine_BoneData_getY(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getY : 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_BoneData_getY) + +static bool js_cocos2dx_spine_BoneData_getRotation(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getRotation : 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_BoneData_getRotation) + +static bool js_cocos2dx_spine_BoneData_getTransformMode(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_getTransformMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = (unsigned int)cobj->getTransformMode(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_getTransformMode : 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_BoneData_getTransformMode) + +static bool js_cocos2dx_spine_BoneData_setRotation(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setRotation : 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_BoneData_setRotation : Error processing arguments"); + cobj->setRotation(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_BoneData_setRotation) + +static bool js_cocos2dx_spine_BoneData_setX(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setX : 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_BoneData_setX : Error processing arguments"); + cobj->setX(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_BoneData_setX) + +static bool js_cocos2dx_spine_BoneData_setLength(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setLength : 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_BoneData_setLength : Error processing arguments"); + cobj->setLength(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_BoneData_setLength) + +static bool js_cocos2dx_spine_BoneData_setShearY(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setShearY : 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_BoneData_setShearY : Error processing arguments"); + cobj->setShearY(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_BoneData_setShearY) + +static bool js_cocos2dx_spine_BoneData_setTransformMode(se::State& s) +{ + spine::BoneData* cobj = (spine::BoneData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_BoneData_setTransformMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::TransformMode arg0; + ok &= seval_to_uint32(args[0], (uint32_t*)&arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_BoneData_setTransformMode : Error processing arguments"); + cobj->setTransformMode(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_BoneData_setTransformMode) + + + + +bool js_register_cocos2dx_spine_BoneData(se::Object* obj) +{ + auto cls = se::Class::create("BoneData", obj, nullptr, nullptr); + + cls->defineFunction("getIndex", _SE(js_cocos2dx_spine_BoneData_getIndex)); + cls->defineFunction("setShearX", _SE(js_cocos2dx_spine_BoneData_setShearX)); + cls->defineFunction("setScaleY", _SE(js_cocos2dx_spine_BoneData_setScaleY)); + cls->defineFunction("setScaleX", _SE(js_cocos2dx_spine_BoneData_setScaleX)); + cls->defineFunction("getParent", _SE(js_cocos2dx_spine_BoneData_getParent)); + cls->defineFunction("getScaleY", _SE(js_cocos2dx_spine_BoneData_getScaleY)); + cls->defineFunction("getScaleX", _SE(js_cocos2dx_spine_BoneData_getScaleX)); + cls->defineFunction("getLength", _SE(js_cocos2dx_spine_BoneData_getLength)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_BoneData_getName)); + cls->defineFunction("getShearX", _SE(js_cocos2dx_spine_BoneData_getShearX)); + cls->defineFunction("getShearY", _SE(js_cocos2dx_spine_BoneData_getShearY)); + cls->defineFunction("setY", _SE(js_cocos2dx_spine_BoneData_setY)); + cls->defineFunction("getX", _SE(js_cocos2dx_spine_BoneData_getX)); + cls->defineFunction("getY", _SE(js_cocos2dx_spine_BoneData_getY)); + cls->defineFunction("getRotation", _SE(js_cocos2dx_spine_BoneData_getRotation)); + cls->defineFunction("getTransformMode", _SE(js_cocos2dx_spine_BoneData_getTransformMode)); + cls->defineFunction("setRotation", _SE(js_cocos2dx_spine_BoneData_setRotation)); + cls->defineFunction("setX", _SE(js_cocos2dx_spine_BoneData_setX)); + cls->defineFunction("setLength", _SE(js_cocos2dx_spine_BoneData_setLength)); + cls->defineFunction("setShearY", _SE(js_cocos2dx_spine_BoneData_setShearY)); + cls->defineFunction("setTransformMode", _SE(js_cocos2dx_spine_BoneData_setTransformMode)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_BoneData_proto = cls->getProto(); + __jsb_spine_BoneData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_VertexAttachment_proto = nullptr; +se::Class* __jsb_spine_VertexAttachment_class = nullptr; + +static bool js_cocos2dx_spine_VertexAttachment_getVertices(se::State& s) +{ + spine::VertexAttachment* cobj = (spine::VertexAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexAttachment_getVertices : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getVertices(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexAttachment_getVertices : 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_VertexAttachment_getVertices) + +static bool js_cocos2dx_spine_VertexAttachment_getId(se::State& s) +{ + spine::VertexAttachment* cobj = (spine::VertexAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexAttachment_getId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexAttachment_getId : 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_VertexAttachment_getId) + +static bool js_cocos2dx_spine_VertexAttachment_getWorldVerticesLength(se::State& s) +{ + spine::VertexAttachment* cobj = (spine::VertexAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexAttachment_getWorldVerticesLength : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getWorldVerticesLength(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexAttachment_getWorldVerticesLength : 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_VertexAttachment_getWorldVerticesLength) + +static bool js_cocos2dx_spine_VertexAttachment_applyDeform(se::State& s) +{ + spine::VertexAttachment* cobj = (spine::VertexAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexAttachment_applyDeform : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::VertexAttachment* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexAttachment_applyDeform : Error processing arguments"); + bool result = cobj->applyDeform(arg0); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexAttachment_applyDeform : 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_VertexAttachment_applyDeform) + +static bool js_cocos2dx_spine_VertexAttachment_setWorldVerticesLength(se::State& s) +{ + spine::VertexAttachment* cobj = (spine::VertexAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexAttachment_setWorldVerticesLength : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexAttachment_setWorldVerticesLength : Error processing arguments"); + cobj->setWorldVerticesLength(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_VertexAttachment_setWorldVerticesLength) + + +extern se::Object* __jsb_spine_Attachment_proto; + + +bool js_register_cocos2dx_spine_VertexAttachment(se::Object* obj) +{ + auto cls = se::Class::create("VertexAttachment", obj, __jsb_spine_Attachment_proto, nullptr); + + cls->defineFunction("getVertices", _SE(js_cocos2dx_spine_VertexAttachment_getVertices)); + cls->defineFunction("getId", _SE(js_cocos2dx_spine_VertexAttachment_getId)); + cls->defineFunction("getWorldVerticesLength", _SE(js_cocos2dx_spine_VertexAttachment_getWorldVerticesLength)); + cls->defineFunction("applyDeform", _SE(js_cocos2dx_spine_VertexAttachment_applyDeform)); + cls->defineFunction("setWorldVerticesLength", _SE(js_cocos2dx_spine_VertexAttachment_setWorldVerticesLength)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_VertexAttachment_proto = cls->getProto(); + __jsb_spine_VertexAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_BoundingBoxAttachment_proto = nullptr; +se::Class* __jsb_spine_BoundingBoxAttachment_class = nullptr; + + +extern se::Object* __jsb_spine_VertexAttachment_proto; + + +bool js_register_cocos2dx_spine_BoundingBoxAttachment(se::Object* obj) +{ + auto cls = se::Class::create("BoundingBoxAttachment", obj, __jsb_spine_VertexAttachment_proto, nullptr); + + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_BoundingBoxAttachment_proto = cls->getProto(); + __jsb_spine_BoundingBoxAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_ClippingAttachment_proto = nullptr; +se::Class* __jsb_spine_ClippingAttachment_class = nullptr; + +static bool js_cocos2dx_spine_ClippingAttachment_setEndSlot(se::State& s) +{ + spine::ClippingAttachment* cobj = (spine::ClippingAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ClippingAttachment_setEndSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::SlotData* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ClippingAttachment_setEndSlot : Error processing arguments"); + cobj->setEndSlot(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_ClippingAttachment_setEndSlot) + +static bool js_cocos2dx_spine_ClippingAttachment_getEndSlot(se::State& s) +{ + spine::ClippingAttachment* cobj = (spine::ClippingAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ClippingAttachment_getEndSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SlotData* result = cobj->getEndSlot(); + ok &= native_ptr_to_rooted_seval((spine::SlotData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ClippingAttachment_getEndSlot : 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_ClippingAttachment_getEndSlot) + + +extern se::Object* __jsb_spine_VertexAttachment_proto; + + +bool js_register_cocos2dx_spine_ClippingAttachment(se::Object* obj) +{ + auto cls = se::Class::create("ClippingAttachment", obj, __jsb_spine_VertexAttachment_proto, nullptr); + + cls->defineFunction("setEndSlot", _SE(js_cocos2dx_spine_ClippingAttachment_setEndSlot)); + cls->defineFunction("getEndSlot", _SE(js_cocos2dx_spine_ClippingAttachment_getEndSlot)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_ClippingAttachment_proto = cls->getProto(); + __jsb_spine_ClippingAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Color_proto = nullptr; +se::Class* __jsb_spine_Color_class = nullptr; + +static bool js_cocos2dx_spine_Color_clamp(se::State& s) +{ + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_clamp : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->clamp(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Color_clamp : 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_Color_clamp) + +static bool js_cocos2dx_spine_Color_get_r(se::State& s) +{ + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_get_r : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= float_to_seval(cobj->r, &jsret); + s.rval() = jsret; + return true; +} +SE_BIND_PROP_GET(js_cocos2dx_spine_Color_get_r) + +static bool js_cocos2dx_spine_Color_set_r(se::State& s) +{ + const auto& args = s.args(); + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_set_r : Invalid Native Object"); + + CC_UNUSED bool ok = true; + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Color_set_r : Error processing new value"); + cobj->r = arg0; + return true; +} +SE_BIND_PROP_SET(js_cocos2dx_spine_Color_set_r) + +static bool js_cocos2dx_spine_Color_get_g(se::State& s) +{ + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_get_g : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= float_to_seval(cobj->g, &jsret); + s.rval() = jsret; + return true; +} +SE_BIND_PROP_GET(js_cocos2dx_spine_Color_get_g) + +static bool js_cocos2dx_spine_Color_set_g(se::State& s) +{ + const auto& args = s.args(); + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_set_g : Invalid Native Object"); + + CC_UNUSED bool ok = true; + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Color_set_g : Error processing new value"); + cobj->g = arg0; + return true; +} +SE_BIND_PROP_SET(js_cocos2dx_spine_Color_set_g) + +static bool js_cocos2dx_spine_Color_get_b(se::State& s) +{ + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_get_b : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= float_to_seval(cobj->b, &jsret); + s.rval() = jsret; + return true; +} +SE_BIND_PROP_GET(js_cocos2dx_spine_Color_get_b) + +static bool js_cocos2dx_spine_Color_set_b(se::State& s) +{ + const auto& args = s.args(); + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_set_b : Invalid Native Object"); + + CC_UNUSED bool ok = true; + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Color_set_b : Error processing new value"); + cobj->b = arg0; + return true; +} +SE_BIND_PROP_SET(js_cocos2dx_spine_Color_set_b) + +static bool js_cocos2dx_spine_Color_get_a(se::State& s) +{ + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_get_a : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= float_to_seval(cobj->a, &jsret); + s.rval() = jsret; + return true; +} +SE_BIND_PROP_GET(js_cocos2dx_spine_Color_get_a) + +static bool js_cocos2dx_spine_Color_set_a(se::State& s) +{ + const auto& args = s.args(); + spine::Color* cobj = (spine::Color*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Color_set_a : Invalid Native Object"); + + CC_UNUSED bool ok = true; + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Color_set_a : Error processing new value"); + cobj->a = arg0; + return true; +} +SE_BIND_PROP_SET(js_cocos2dx_spine_Color_set_a) + + + + +bool js_register_cocos2dx_spine_Color(se::Object* obj) +{ + auto cls = se::Class::create("Color", obj, nullptr, nullptr); + + cls->defineProperty("r", _SE(js_cocos2dx_spine_Color_get_r), _SE(js_cocos2dx_spine_Color_set_r)); + cls->defineProperty("g", _SE(js_cocos2dx_spine_Color_get_g), _SE(js_cocos2dx_spine_Color_set_g)); + cls->defineProperty("b", _SE(js_cocos2dx_spine_Color_get_b), _SE(js_cocos2dx_spine_Color_set_b)); + cls->defineProperty("a", _SE(js_cocos2dx_spine_Color_get_a), _SE(js_cocos2dx_spine_Color_set_a)); + cls->defineFunction("clamp", _SE(js_cocos2dx_spine_Color_clamp)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Color_proto = cls->getProto(); + __jsb_spine_Color_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_CurveTimeline_proto = nullptr; +se::Class* __jsb_spine_CurveTimeline_class = nullptr; + +static bool js_cocos2dx_spine_CurveTimeline_setCurve(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_setCurve : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 5) { + size_t arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + float arg4 = 0; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + ok &= seval_to_float(args[4], &arg4); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_setCurve : Error processing arguments"); + cobj->setCurve(arg0, arg1, arg2, arg3, arg4); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 5); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_CurveTimeline_setCurve) + +static bool js_cocos2dx_spine_CurveTimeline_getPropertyId(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_getPropertyId : 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_CurveTimeline_getPropertyId) + +static bool js_cocos2dx_spine_CurveTimeline_setLinear(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_setLinear : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_setLinear : Error processing arguments"); + cobj->setLinear(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_CurveTimeline_setLinear) + +static bool js_cocos2dx_spine_CurveTimeline_getFrameCount(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_getFrameCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getFrameCount(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_getFrameCount : 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_CurveTimeline_getFrameCount) + +static bool js_cocos2dx_spine_CurveTimeline_setStepped(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_setStepped : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_setStepped : Error processing arguments"); + cobj->setStepped(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_CurveTimeline_setStepped) + +static bool js_cocos2dx_spine_CurveTimeline_getCurvePercent(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_getCurvePercent : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + size_t arg0 = 0; + float arg1 = 0; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_getCurvePercent : Error processing arguments"); + float result = cobj->getCurvePercent(arg0, arg1); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_getCurvePercent : 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_CurveTimeline_getCurvePercent) + +static bool js_cocos2dx_spine_CurveTimeline_getCurveType(se::State& s) +{ + spine::CurveTimeline* cobj = (spine::CurveTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_CurveTimeline_getCurveType : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_getCurveType : Error processing arguments"); + float result = cobj->getCurveType(arg0); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_CurveTimeline_getCurveType : 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_CurveTimeline_getCurveType) + + +extern se::Object* __jsb_spine_Timeline_proto; + + +bool js_register_cocos2dx_spine_CurveTimeline(se::Object* obj) +{ + auto cls = se::Class::create("CurveTimeline", obj, __jsb_spine_Timeline_proto, nullptr); + + cls->defineFunction("setCurve", _SE(js_cocos2dx_spine_CurveTimeline_setCurve)); + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_CurveTimeline_getPropertyId)); + cls->defineFunction("setLinear", _SE(js_cocos2dx_spine_CurveTimeline_setLinear)); + cls->defineFunction("getFrameCount", _SE(js_cocos2dx_spine_CurveTimeline_getFrameCount)); + cls->defineFunction("setStepped", _SE(js_cocos2dx_spine_CurveTimeline_setStepped)); + cls->defineFunction("getCurvePercent", _SE(js_cocos2dx_spine_CurveTimeline_getCurvePercent)); + cls->defineFunction("getCurveType", _SE(js_cocos2dx_spine_CurveTimeline_getCurveType)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_CurveTimeline_proto = cls->getProto(); + __jsb_spine_CurveTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_ColorTimeline_proto = nullptr; +se::Class* __jsb_spine_ColorTimeline_class = nullptr; + +static bool js_cocos2dx_spine_ColorTimeline_setSlotIndex(se::State& s) +{ + spine::ColorTimeline* cobj = (spine::ColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ColorTimeline_setSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ColorTimeline_setSlotIndex : Error processing arguments"); + cobj->setSlotIndex(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_ColorTimeline_setSlotIndex) + +static bool js_cocos2dx_spine_ColorTimeline_getPropertyId(se::State& s) +{ + spine::ColorTimeline* cobj = (spine::ColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ColorTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ColorTimeline_getPropertyId : 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_ColorTimeline_getPropertyId) + +static bool js_cocos2dx_spine_ColorTimeline_setFrame(se::State& s) +{ + spine::ColorTimeline* cobj = (spine::ColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ColorTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + int arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + float arg4 = 0; + float arg5 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + ok &= seval_to_float(args[4], &arg4); + ok &= seval_to_float(args[5], &arg5); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ColorTimeline_setFrame : Error processing arguments"); + cobj->setFrame(arg0, arg1, arg2, arg3, arg4, arg5); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_ColorTimeline_setFrame) + +static bool js_cocos2dx_spine_ColorTimeline_getSlotIndex(se::State& s) +{ + spine::ColorTimeline* cobj = (spine::ColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ColorTimeline_getSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getSlotIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ColorTimeline_getSlotIndex : 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_ColorTimeline_getSlotIndex) + +static bool js_cocos2dx_spine_ColorTimeline_getFrames(se::State& s) +{ + spine::ColorTimeline* cobj = (spine::ColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ColorTimeline_getFrames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getFrames(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ColorTimeline_getFrames : 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_ColorTimeline_getFrames) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_ColorTimeline(se::Object* obj) +{ + auto cls = se::Class::create("ColorTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("setSlotIndex", _SE(js_cocos2dx_spine_ColorTimeline_setSlotIndex)); + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_ColorTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_ColorTimeline_setFrame)); + cls->defineFunction("getSlotIndex", _SE(js_cocos2dx_spine_ColorTimeline_getSlotIndex)); + cls->defineFunction("getFrames", _SE(js_cocos2dx_spine_ColorTimeline_getFrames)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_ColorTimeline_proto = cls->getProto(); + __jsb_spine_ColorTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_DeformTimeline_proto = nullptr; +se::Class* __jsb_spine_DeformTimeline_class = nullptr; + +static bool js_cocos2dx_spine_DeformTimeline_setSlotIndex(se::State& s) +{ + spine::DeformTimeline* cobj = (spine::DeformTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DeformTimeline_setSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DeformTimeline_setSlotIndex : Error processing arguments"); + cobj->setSlotIndex(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_DeformTimeline_setSlotIndex) + +static bool js_cocos2dx_spine_DeformTimeline_getPropertyId(se::State& s) +{ + spine::DeformTimeline* cobj = (spine::DeformTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DeformTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DeformTimeline_getPropertyId : 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_DeformTimeline_getPropertyId) + +static bool js_cocos2dx_spine_DeformTimeline_getSlotIndex(se::State& s) +{ + spine::DeformTimeline* cobj = (spine::DeformTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DeformTimeline_getSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getSlotIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DeformTimeline_getSlotIndex : 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_DeformTimeline_getSlotIndex) + +static bool js_cocos2dx_spine_DeformTimeline_getAttachment(se::State& s) +{ + spine::DeformTimeline* cobj = (spine::DeformTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DeformTimeline_getAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::VertexAttachment* result = cobj->getAttachment(); + ok &= native_ptr_to_rooted_seval((spine::VertexAttachment*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DeformTimeline_getAttachment : 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_DeformTimeline_getAttachment) + +static bool js_cocos2dx_spine_DeformTimeline_setAttachment(se::State& s) +{ + spine::DeformTimeline* cobj = (spine::DeformTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DeformTimeline_setAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::VertexAttachment* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DeformTimeline_setAttachment : Error processing arguments"); + cobj->setAttachment(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_DeformTimeline_setAttachment) + +static bool js_cocos2dx_spine_DeformTimeline_getFrames(se::State& s) +{ + spine::DeformTimeline* cobj = (spine::DeformTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DeformTimeline_getFrames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getFrames(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DeformTimeline_getFrames : 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_DeformTimeline_getFrames) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_DeformTimeline(se::Object* obj) +{ + auto cls = se::Class::create("DeformTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("setSlotIndex", _SE(js_cocos2dx_spine_DeformTimeline_setSlotIndex)); + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_DeformTimeline_getPropertyId)); + cls->defineFunction("getSlotIndex", _SE(js_cocos2dx_spine_DeformTimeline_getSlotIndex)); + cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_DeformTimeline_getAttachment)); + cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_DeformTimeline_setAttachment)); + cls->defineFunction("getFrames", _SE(js_cocos2dx_spine_DeformTimeline_getFrames)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_DeformTimeline_proto = cls->getProto(); + __jsb_spine_DeformTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_DrawOrderTimeline_proto = nullptr; +se::Class* __jsb_spine_DrawOrderTimeline_class = nullptr; + +static bool js_cocos2dx_spine_DrawOrderTimeline_getPropertyId(se::State& s) +{ + spine::DrawOrderTimeline* cobj = (spine::DrawOrderTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DrawOrderTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DrawOrderTimeline_getPropertyId : 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_DrawOrderTimeline_getPropertyId) + +static bool js_cocos2dx_spine_DrawOrderTimeline_getFrameCount(se::State& s) +{ + spine::DrawOrderTimeline* cobj = (spine::DrawOrderTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DrawOrderTimeline_getFrameCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getFrameCount(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DrawOrderTimeline_getFrameCount : 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_DrawOrderTimeline_getFrameCount) + +static bool js_cocos2dx_spine_DrawOrderTimeline_getFrames(se::State& s) +{ + spine::DrawOrderTimeline* cobj = (spine::DrawOrderTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_DrawOrderTimeline_getFrames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getFrames(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_DrawOrderTimeline_getFrames : 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_DrawOrderTimeline_getFrames) + + +extern se::Object* __jsb_spine_Timeline_proto; + + +bool js_register_cocos2dx_spine_DrawOrderTimeline(se::Object* obj) +{ + auto cls = se::Class::create("DrawOrderTimeline", obj, __jsb_spine_Timeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_DrawOrderTimeline_getPropertyId)); + cls->defineFunction("getFrameCount", _SE(js_cocos2dx_spine_DrawOrderTimeline_getFrameCount)); + cls->defineFunction("getFrames", _SE(js_cocos2dx_spine_DrawOrderTimeline_getFrames)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_DrawOrderTimeline_proto = cls->getProto(); + __jsb_spine_DrawOrderTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Event_proto = nullptr; +se::Class* __jsb_spine_Event_class = nullptr; + +static bool js_cocos2dx_spine_Event_getFloatValue(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getFloatValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getFloatValue(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getFloatValue : 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_Event_getFloatValue) + +static bool js_cocos2dx_spine_Event_getIntValue(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getIntValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getIntValue(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getIntValue : 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_Event_getIntValue) + +static bool js_cocos2dx_spine_Event_getStringValue(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getStringValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getStringValue(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getStringValue : 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_Event_getStringValue) + +static bool js_cocos2dx_spine_Event_getTime(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getTime : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTime(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getTime : 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_Event_getTime) + +static bool js_cocos2dx_spine_Event_getBalance(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getBalance : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getBalance(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getBalance : 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_Event_getBalance) + +static bool js_cocos2dx_spine_Event_setFloatValue(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_setFloatValue : 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_Event_setFloatValue : Error processing arguments"); + cobj->setFloatValue(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_Event_setFloatValue) + +static bool js_cocos2dx_spine_Event_setIntValue(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_setIntValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_setIntValue : Error processing arguments"); + cobj->setIntValue(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_Event_setIntValue) + +static bool js_cocos2dx_spine_Event_getVolume(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getVolume : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getVolume(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getVolume : 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_Event_getVolume) + +static bool js_cocos2dx_spine_Event_setBalance(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_setBalance : 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_Event_setBalance : Error processing arguments"); + cobj->setBalance(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_Event_setBalance) + +static bool js_cocos2dx_spine_Event_getData(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::EventData& result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::EventData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_getData : 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_Event_getData) + +static bool js_cocos2dx_spine_Event_setStringValue(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_setStringValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Event_setStringValue : Error processing arguments"); + cobj->setStringValue(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_Event_setStringValue) + +static bool js_cocos2dx_spine_Event_setVolume(se::State& s) +{ + spine::Event* cobj = (spine::Event*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Event_setVolume : 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_Event_setVolume : Error processing arguments"); + cobj->setVolume(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_Event_setVolume) + + + + +bool js_register_cocos2dx_spine_Event(se::Object* obj) +{ + auto cls = se::Class::create("Event", obj, nullptr, nullptr); + + cls->defineFunction("getFloatValue", _SE(js_cocos2dx_spine_Event_getFloatValue)); + cls->defineFunction("getIntValue", _SE(js_cocos2dx_spine_Event_getIntValue)); + cls->defineFunction("getStringValue", _SE(js_cocos2dx_spine_Event_getStringValue)); + cls->defineFunction("getTime", _SE(js_cocos2dx_spine_Event_getTime)); + cls->defineFunction("getBalance", _SE(js_cocos2dx_spine_Event_getBalance)); + cls->defineFunction("setFloatValue", _SE(js_cocos2dx_spine_Event_setFloatValue)); + cls->defineFunction("setIntValue", _SE(js_cocos2dx_spine_Event_setIntValue)); + cls->defineFunction("getVolume", _SE(js_cocos2dx_spine_Event_getVolume)); + cls->defineFunction("setBalance", _SE(js_cocos2dx_spine_Event_setBalance)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_Event_getData)); + cls->defineFunction("setStringValue", _SE(js_cocos2dx_spine_Event_setStringValue)); + cls->defineFunction("setVolume", _SE(js_cocos2dx_spine_Event_setVolume)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Event_proto = cls->getProto(); + __jsb_spine_Event_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_EventData_proto = nullptr; +se::Class* __jsb_spine_EventData_class = nullptr; + +static bool js_cocos2dx_spine_EventData_getAudioPath(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getAudioPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getAudioPath(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getAudioPath : 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_EventData_getAudioPath) + +static bool js_cocos2dx_spine_EventData_getIntValue(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getIntValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getIntValue(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getIntValue : 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_EventData_getIntValue) + +static bool js_cocos2dx_spine_EventData_getStringValue(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getStringValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getStringValue(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getStringValue : 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_EventData_getStringValue) + +static bool js_cocos2dx_spine_EventData_getFloatValue(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getFloatValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getFloatValue(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getFloatValue : 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_EventData_getFloatValue) + +static bool js_cocos2dx_spine_EventData_getName(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getName : 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_EventData_getName) + +static bool js_cocos2dx_spine_EventData_setFloatValue(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_setFloatValue : 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_EventData_setFloatValue : Error processing arguments"); + cobj->setFloatValue(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_EventData_setFloatValue) + +static bool js_cocos2dx_spine_EventData_setIntValue(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_setIntValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_setIntValue : Error processing arguments"); + cobj->setIntValue(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_EventData_setIntValue) + +static bool js_cocos2dx_spine_EventData_getVolume(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getVolume : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getVolume(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getVolume : 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_EventData_getVolume) + +static bool js_cocos2dx_spine_EventData_setBalance(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_setBalance : 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_EventData_setBalance : Error processing arguments"); + cobj->setBalance(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_EventData_setBalance) + +static bool js_cocos2dx_spine_EventData_setVolume(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_setVolume : 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_EventData_setVolume : Error processing arguments"); + cobj->setVolume(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_EventData_setVolume) + +static bool js_cocos2dx_spine_EventData_setStringValue(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_setStringValue : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_setStringValue : Error processing arguments"); + cobj->setStringValue(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_EventData_setStringValue) + +static bool js_cocos2dx_spine_EventData_getBalance(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_getBalance : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getBalance(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_getBalance : 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_EventData_getBalance) + +static bool js_cocos2dx_spine_EventData_setAudioPath(se::State& s) +{ + spine::EventData* cobj = (spine::EventData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventData_setAudioPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventData_setAudioPath : Error processing arguments"); + cobj->setAudioPath(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_EventData_setAudioPath) + + + + +bool js_register_cocos2dx_spine_EventData(se::Object* obj) +{ + auto cls = se::Class::create("EventData", obj, nullptr, nullptr); + + cls->defineFunction("getAudioPath", _SE(js_cocos2dx_spine_EventData_getAudioPath)); + cls->defineFunction("getIntValue", _SE(js_cocos2dx_spine_EventData_getIntValue)); + cls->defineFunction("getStringValue", _SE(js_cocos2dx_spine_EventData_getStringValue)); + cls->defineFunction("getFloatValue", _SE(js_cocos2dx_spine_EventData_getFloatValue)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_EventData_getName)); + cls->defineFunction("setFloatValue", _SE(js_cocos2dx_spine_EventData_setFloatValue)); + cls->defineFunction("setIntValue", _SE(js_cocos2dx_spine_EventData_setIntValue)); + cls->defineFunction("getVolume", _SE(js_cocos2dx_spine_EventData_getVolume)); + cls->defineFunction("setBalance", _SE(js_cocos2dx_spine_EventData_setBalance)); + cls->defineFunction("setVolume", _SE(js_cocos2dx_spine_EventData_setVolume)); + cls->defineFunction("setStringValue", _SE(js_cocos2dx_spine_EventData_setStringValue)); + cls->defineFunction("getBalance", _SE(js_cocos2dx_spine_EventData_getBalance)); + cls->defineFunction("setAudioPath", _SE(js_cocos2dx_spine_EventData_setAudioPath)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_EventData_proto = cls->getProto(); + __jsb_spine_EventData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_EventTimeline_proto = nullptr; +se::Class* __jsb_spine_EventTimeline_class = nullptr; + +static bool js_cocos2dx_spine_EventTimeline_getPropertyId(se::State& s) +{ + spine::EventTimeline* cobj = (spine::EventTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventTimeline_getPropertyId : 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_EventTimeline_getPropertyId) + +static bool js_cocos2dx_spine_EventTimeline_setFrame(se::State& s) +{ + spine::EventTimeline* cobj = (spine::EventTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + size_t arg0 = 0; + spine::Event* arg1 = nullptr; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_native_ptr(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventTimeline_setFrame : Error processing arguments"); + cobj->setFrame(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_EventTimeline_setFrame) + +static bool js_cocos2dx_spine_EventTimeline_getFrameCount(se::State& s) +{ + spine::EventTimeline* cobj = (spine::EventTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventTimeline_getFrameCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getFrameCount(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventTimeline_getFrameCount : 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_EventTimeline_getFrameCount) + +static bool js_cocos2dx_spine_EventTimeline_getFrames(se::State& s) +{ + spine::EventTimeline* cobj = (spine::EventTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventTimeline_getFrames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector result = cobj->getFrames(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventTimeline_getFrames : 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_EventTimeline_getFrames) + +static bool js_cocos2dx_spine_EventTimeline_getEvents(se::State& s) +{ + spine::EventTimeline* cobj = (spine::EventTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_EventTimeline_getEvents : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getEvents(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_EventTimeline_getEvents : 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_EventTimeline_getEvents) + + +extern se::Object* __jsb_spine_Timeline_proto; + + +bool js_register_cocos2dx_spine_EventTimeline(se::Object* obj) +{ + auto cls = se::Class::create("EventTimeline", obj, __jsb_spine_Timeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_EventTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_EventTimeline_setFrame)); + cls->defineFunction("getFrameCount", _SE(js_cocos2dx_spine_EventTimeline_getFrameCount)); + cls->defineFunction("getFrames", _SE(js_cocos2dx_spine_EventTimeline_getFrames)); + cls->defineFunction("getEvents", _SE(js_cocos2dx_spine_EventTimeline_getEvents)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_EventTimeline_proto = cls->getProto(); + __jsb_spine_EventTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_IkConstraint_proto = nullptr; +se::Class* __jsb_spine_IkConstraint_class = nullptr; + +static bool js_cocos2dx_spine_IkConstraint_getMix(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getMix : 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_IkConstraint_getMix) + +static bool js_cocos2dx_spine_IkConstraint_getStretch(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getStretch : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getStretch(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getStretch : 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_IkConstraint_getStretch) + +static bool js_cocos2dx_spine_IkConstraint_getCompress(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getCompress : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getCompress(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getCompress : 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_IkConstraint_getCompress) + +static bool js_cocos2dx_spine_IkConstraint_setStretch(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_setStretch : 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_IkConstraint_setStretch : Error processing arguments"); + cobj->setStretch(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_IkConstraint_setStretch) + +static bool js_cocos2dx_spine_IkConstraint_getBones(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getBones : 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_IkConstraint_getBones) + +static bool js_cocos2dx_spine_IkConstraint_setTarget(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_setTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::Bone* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_setTarget : Error processing arguments"); + cobj->setTarget(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_IkConstraint_setTarget) + +static bool js_cocos2dx_spine_IkConstraint_setBendDirection(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_setBendDirection : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_setBendDirection : Error processing arguments"); + cobj->setBendDirection(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_IkConstraint_setBendDirection) + +static bool js_cocos2dx_spine_IkConstraint_update(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_update : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->update(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_IkConstraint_update) + +static bool js_cocos2dx_spine_IkConstraint_getTarget(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Bone* result = cobj->getTarget(); + ok &= native_ptr_to_rooted_seval((spine::Bone*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getTarget : 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_IkConstraint_getTarget) + +static bool js_cocos2dx_spine_IkConstraint_setCompress(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_setCompress : 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_IkConstraint_setCompress : Error processing arguments"); + cobj->setCompress(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_IkConstraint_setCompress) + +static bool js_cocos2dx_spine_IkConstraint_getBendDirection(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getBendDirection : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getBendDirection(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getBendDirection : 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_IkConstraint_getBendDirection) + +static bool js_cocos2dx_spine_IkConstraint_getOrder(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getOrder(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getOrder : 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_IkConstraint_getOrder) + +static bool js_cocos2dx_spine_IkConstraint_setMix(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_setMix : 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_IkConstraint_setMix : Error processing arguments"); + cobj->setMix(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_IkConstraint_setMix) + +static bool js_cocos2dx_spine_IkConstraint_getData(se::State& s) +{ + spine::IkConstraint* cobj = (spine::IkConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraint_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::IkConstraintData& result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::IkConstraintData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraint_getData : 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_IkConstraint_getData) + + + + +bool js_register_cocos2dx_spine_IkConstraint(se::Object* obj) +{ + auto cls = se::Class::create("IkConstraint", obj, nullptr, nullptr); + + cls->defineFunction("getMix", _SE(js_cocos2dx_spine_IkConstraint_getMix)); + cls->defineFunction("getStretch", _SE(js_cocos2dx_spine_IkConstraint_getStretch)); + cls->defineFunction("getCompress", _SE(js_cocos2dx_spine_IkConstraint_getCompress)); + cls->defineFunction("setStretch", _SE(js_cocos2dx_spine_IkConstraint_setStretch)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_IkConstraint_getBones)); + cls->defineFunction("setTarget", _SE(js_cocos2dx_spine_IkConstraint_setTarget)); + cls->defineFunction("setBendDirection", _SE(js_cocos2dx_spine_IkConstraint_setBendDirection)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_IkConstraint_update)); + cls->defineFunction("getTarget", _SE(js_cocos2dx_spine_IkConstraint_getTarget)); + cls->defineFunction("setCompress", _SE(js_cocos2dx_spine_IkConstraint_setCompress)); + cls->defineFunction("getBendDirection", _SE(js_cocos2dx_spine_IkConstraint_getBendDirection)); + cls->defineFunction("getOrder", _SE(js_cocos2dx_spine_IkConstraint_getOrder)); + cls->defineFunction("setMix", _SE(js_cocos2dx_spine_IkConstraint_setMix)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_IkConstraint_getData)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_IkConstraint_proto = cls->getProto(); + __jsb_spine_IkConstraint_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_IkConstraintData_proto = nullptr; +se::Class* __jsb_spine_IkConstraintData_class = nullptr; + +static bool js_cocos2dx_spine_IkConstraintData_getMix(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getMix : 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_IkConstraintData_getMix) + +static bool js_cocos2dx_spine_IkConstraintData_getBendDirection(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getBendDirection : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getBendDirection(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getBendDirection : 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_IkConstraintData_getBendDirection) + +static bool js_cocos2dx_spine_IkConstraintData_setUniform(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setUniform : 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_IkConstraintData_setUniform : Error processing arguments"); + cobj->setUniform(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_IkConstraintData_setUniform) + +static bool js_cocos2dx_spine_IkConstraintData_setStretch(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setStretch : 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_IkConstraintData_setStretch : Error processing arguments"); + cobj->setStretch(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_IkConstraintData_setStretch) + +static bool js_cocos2dx_spine_IkConstraintData_getUniform(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getUniform : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getUniform(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getUniform : 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_IkConstraintData_getUniform) + +static bool js_cocos2dx_spine_IkConstraintData_getBones(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getBones : 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_IkConstraintData_getBones) + +static bool js_cocos2dx_spine_IkConstraintData_getName(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getName : 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_IkConstraintData_getName) + +static bool js_cocos2dx_spine_IkConstraintData_getTarget(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::BoneData* result = cobj->getTarget(); + ok &= native_ptr_to_rooted_seval((spine::BoneData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getTarget : 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_IkConstraintData_getTarget) + +static bool js_cocos2dx_spine_IkConstraintData_setCompress(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setCompress : 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_IkConstraintData_setCompress : Error processing arguments"); + cobj->setCompress(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_IkConstraintData_setCompress) + +static bool js_cocos2dx_spine_IkConstraintData_setOrder(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_setOrder : Error processing arguments"); + cobj->setOrder(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_IkConstraintData_setOrder) + +static bool js_cocos2dx_spine_IkConstraintData_getOrder(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + size_t result = cobj->getOrder(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getOrder : 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_IkConstraintData_getOrder) + +static bool js_cocos2dx_spine_IkConstraintData_getStretch(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getStretch : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getStretch(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getStretch : 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_IkConstraintData_getStretch) + +static bool js_cocos2dx_spine_IkConstraintData_setBendDirection(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setBendDirection : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_setBendDirection : Error processing arguments"); + cobj->setBendDirection(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_IkConstraintData_setBendDirection) + +static bool js_cocos2dx_spine_IkConstraintData_setMix(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setMix : 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_IkConstraintData_setMix : Error processing arguments"); + cobj->setMix(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_IkConstraintData_setMix) + +static bool js_cocos2dx_spine_IkConstraintData_getCompress(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_getCompress : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getCompress(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_getCompress : 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_IkConstraintData_getCompress) + +static bool js_cocos2dx_spine_IkConstraintData_setTarget(se::State& s) +{ + spine::IkConstraintData* cobj = (spine::IkConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintData_setTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::BoneData* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintData_setTarget : Error processing arguments"); + cobj->setTarget(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_IkConstraintData_setTarget) + + + + +bool js_register_cocos2dx_spine_IkConstraintData(se::Object* obj) +{ + auto cls = se::Class::create("IkConstraintData", obj, nullptr, nullptr); + + cls->defineFunction("getMix", _SE(js_cocos2dx_spine_IkConstraintData_getMix)); + cls->defineFunction("getBendDirection", _SE(js_cocos2dx_spine_IkConstraintData_getBendDirection)); + cls->defineFunction("setUniform", _SE(js_cocos2dx_spine_IkConstraintData_setUniform)); + cls->defineFunction("setStretch", _SE(js_cocos2dx_spine_IkConstraintData_setStretch)); + cls->defineFunction("getUniform", _SE(js_cocos2dx_spine_IkConstraintData_getUniform)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_IkConstraintData_getBones)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_IkConstraintData_getName)); + cls->defineFunction("getTarget", _SE(js_cocos2dx_spine_IkConstraintData_getTarget)); + cls->defineFunction("setCompress", _SE(js_cocos2dx_spine_IkConstraintData_setCompress)); + cls->defineFunction("setOrder", _SE(js_cocos2dx_spine_IkConstraintData_setOrder)); + cls->defineFunction("getOrder", _SE(js_cocos2dx_spine_IkConstraintData_getOrder)); + cls->defineFunction("getStretch", _SE(js_cocos2dx_spine_IkConstraintData_getStretch)); + cls->defineFunction("setBendDirection", _SE(js_cocos2dx_spine_IkConstraintData_setBendDirection)); + cls->defineFunction("setMix", _SE(js_cocos2dx_spine_IkConstraintData_setMix)); + cls->defineFunction("getCompress", _SE(js_cocos2dx_spine_IkConstraintData_getCompress)); + cls->defineFunction("setTarget", _SE(js_cocos2dx_spine_IkConstraintData_setTarget)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_IkConstraintData_proto = cls->getProto(); + __jsb_spine_IkConstraintData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_IkConstraintTimeline_proto = nullptr; +se::Class* __jsb_spine_IkConstraintTimeline_class = nullptr; + +static bool js_cocos2dx_spine_IkConstraintTimeline_getPropertyId(se::State& s) +{ + spine::IkConstraintTimeline* cobj = (spine::IkConstraintTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintTimeline_getPropertyId : 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_IkConstraintTimeline_getPropertyId) + +static bool js_cocos2dx_spine_IkConstraintTimeline_setFrame(se::State& s) +{ + spine::IkConstraintTimeline* cobj = (spine::IkConstraintTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_IkConstraintTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + int arg0 = 0; + float arg1 = 0; + float arg2 = 0; + int arg3 = 0; + bool arg4; + bool arg5; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + do { int32_t tmp = 0; ok &= seval_to_int32(args[3], &tmp); arg3 = (int)tmp; } while(false); + ok &= seval_to_boolean(args[4], &arg4); + ok &= seval_to_boolean(args[5], &arg5); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_IkConstraintTimeline_setFrame : Error processing arguments"); + cobj->setFrame(arg0, arg1, arg2, arg3, arg4, arg5); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_IkConstraintTimeline_setFrame) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_IkConstraintTimeline(se::Object* obj) +{ + auto cls = se::Class::create("IkConstraintTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_IkConstraintTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_IkConstraintTimeline_setFrame)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_IkConstraintTimeline_proto = cls->getProto(); + __jsb_spine_IkConstraintTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_MeshAttachment_proto = nullptr; +se::Class* __jsb_spine_MeshAttachment_class = nullptr; + +static bool js_cocos2dx_spine_MeshAttachment_setRegionOriginalHeight(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionOriginalHeight : 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_MeshAttachment_setRegionOriginalHeight : Error processing arguments"); + cobj->setRegionOriginalHeight(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_MeshAttachment_setRegionOriginalHeight) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionOffsetY(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionOffsetY : 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_MeshAttachment_setRegionOffsetY : Error processing arguments"); + cobj->setRegionOffsetY(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_MeshAttachment_setRegionOffsetY) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionOffsetX(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionOffsetX : 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_MeshAttachment_setRegionOffsetX : Error processing arguments"); + cobj->setRegionOffsetX(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_MeshAttachment_setRegionOffsetX) + +static bool js_cocos2dx_spine_MeshAttachment_setInheritDeform(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setInheritDeform : 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_MeshAttachment_setInheritDeform : Error processing arguments"); + cobj->setInheritDeform(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_MeshAttachment_setInheritDeform) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOriginalWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth : 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_MeshAttachment_getRegionOriginalWidth) + +static bool js_cocos2dx_spine_MeshAttachment_getWidth(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getWidth : 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_MeshAttachment_getWidth) + +static bool js_cocos2dx_spine_MeshAttachment_setParentMesh(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setParentMesh : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::MeshAttachment* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_setParentMesh : Error processing arguments"); + cobj->setParentMesh(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_MeshAttachment_setParentMesh) + +static bool js_cocos2dx_spine_MeshAttachment_setWidth(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setWidth : 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_MeshAttachment_setWidth : Error processing arguments"); + cobj->setWidth(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_MeshAttachment_setWidth) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionRotate(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionRotate : 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_MeshAttachment_setRegionRotate : Error processing arguments"); + cobj->setRegionRotate(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_MeshAttachment_setRegionRotate) + +static bool js_cocos2dx_spine_MeshAttachment_getUVs(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getUVs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getUVs(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getUVs : 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_MeshAttachment_getUVs) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionHeight(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionHeight : 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_MeshAttachment_getRegionHeight) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionU2(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionU2 : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionU2(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionU2 : 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_MeshAttachment_getRegionU2) + +static bool js_cocos2dx_spine_MeshAttachment_getHeight(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getHeight : 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_MeshAttachment_getHeight) + +static bool js_cocos2dx_spine_MeshAttachment_getPath(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getPath(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getPath : 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_MeshAttachment_getPath) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionV2(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionV2 : 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_MeshAttachment_setRegionV2 : Error processing arguments"); + cobj->setRegionV2(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_MeshAttachment_setRegionV2) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionWidth(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionWidth : 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_MeshAttachment_setRegionWidth : Error processing arguments"); + cobj->setRegionWidth(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_MeshAttachment_setRegionWidth) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionV(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionV : 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_MeshAttachment_setRegionV : Error processing arguments"); + cobj->setRegionV(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_MeshAttachment_setRegionV) + +static bool js_cocos2dx_spine_MeshAttachment_setPath(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_setPath : Error processing arguments"); + cobj->setPath(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_MeshAttachment_setPath) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionU(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionU : 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_MeshAttachment_setRegionU : Error processing arguments"); + cobj->setRegionU(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_MeshAttachment_setRegionU) + +static bool js_cocos2dx_spine_MeshAttachment_applyDeform(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_applyDeform : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::VertexAttachment* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_applyDeform : Error processing arguments"); + bool result = cobj->applyDeform(arg0); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_applyDeform : 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_MeshAttachment_applyDeform) + +static bool js_cocos2dx_spine_MeshAttachment_setHullLength(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setHullLength : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_setHullLength : Error processing arguments"); + cobj->setHullLength(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_MeshAttachment_setHullLength) + +static bool js_cocos2dx_spine_MeshAttachment_getColor(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getColor : 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_MeshAttachment_getColor) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionOriginalHeight(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionOriginalHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOriginalHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionOriginalHeight : 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_MeshAttachment_getRegionOriginalHeight) + +static bool js_cocos2dx_spine_MeshAttachment_getEdges(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getEdges : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getEdges(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getEdges : 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_MeshAttachment_getEdges) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionUVs(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionUVs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getRegionUVs(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionUVs : 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_MeshAttachment_getRegionUVs) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionV2(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionV2 : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionV2(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionV2 : 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_MeshAttachment_getRegionV2) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionWidth(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionWidth : 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_MeshAttachment_getRegionWidth) + +static bool js_cocos2dx_spine_MeshAttachment_setHeight(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setHeight : 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_MeshAttachment_setHeight : Error processing arguments"); + cobj->setHeight(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_MeshAttachment_setHeight) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionOriginalWidth(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionOriginalWidth : 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_MeshAttachment_setRegionOriginalWidth : Error processing arguments"); + cobj->setRegionOriginalWidth(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_MeshAttachment_setRegionOriginalWidth) + +static bool js_cocos2dx_spine_MeshAttachment_updateUVs(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_updateUVs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->updateUVs(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_updateUVs) + +static bool js_cocos2dx_spine_MeshAttachment_getInheritDeform(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getInheritDeform : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getInheritDeform(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getInheritDeform : 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_MeshAttachment_getInheritDeform) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionU2(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionU2 : 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_MeshAttachment_setRegionU2 : Error processing arguments"); + cobj->setRegionU2(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_MeshAttachment_setRegionU2) + +static bool js_cocos2dx_spine_MeshAttachment_getHullLength(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getHullLength : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getHullLength(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getHullLength : 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_MeshAttachment_getHullLength) + +static bool js_cocos2dx_spine_MeshAttachment_setRegionHeight(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionHeight : 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_MeshAttachment_setRegionHeight : Error processing arguments"); + cobj->setRegionHeight(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_MeshAttachment_setRegionHeight) + +static bool js_cocos2dx_spine_MeshAttachment_getTriangles(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getTriangles : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getTriangles(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getTriangles : 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_MeshAttachment_getTriangles) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionOffsetY(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionOffsetY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOffsetY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionOffsetY : 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_MeshAttachment_getRegionOffsetY) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionOffsetX(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionOffsetX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOffsetX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionOffsetX : 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_MeshAttachment_getRegionOffsetX) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionV(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionV : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionV(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionV : 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_MeshAttachment_getRegionV) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionRotate(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionRotate : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->getRegionRotate(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionRotate : 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_MeshAttachment_getRegionRotate) + +static bool js_cocos2dx_spine_MeshAttachment_getParentMesh(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getParentMesh : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::MeshAttachment* result = cobj->getParentMesh(); + ok &= native_ptr_to_rooted_seval((spine::MeshAttachment*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getParentMesh : 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_MeshAttachment_getParentMesh) + +static bool js_cocos2dx_spine_MeshAttachment_getRegionU(se::State& s) +{ + spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionU : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionU(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionU : 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_MeshAttachment_getRegionU) + + +extern se::Object* __jsb_spine_VertexAttachment_proto; + + +bool js_register_cocos2dx_spine_MeshAttachment(se::Object* obj) +{ + auto cls = se::Class::create("MeshAttachment", obj, __jsb_spine_VertexAttachment_proto, nullptr); + + cls->defineFunction("setRegionOriginalHeight", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOriginalHeight)); + cls->defineFunction("setRegionOffsetY", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOffsetY)); + cls->defineFunction("setRegionOffsetX", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOffsetX)); + cls->defineFunction("setInheritDeform", _SE(js_cocos2dx_spine_MeshAttachment_setInheritDeform)); + cls->defineFunction("getRegionOriginalWidth", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth)); + cls->defineFunction("getWidth", _SE(js_cocos2dx_spine_MeshAttachment_getWidth)); + cls->defineFunction("setParentMesh", _SE(js_cocos2dx_spine_MeshAttachment_setParentMesh)); + cls->defineFunction("setWidth", _SE(js_cocos2dx_spine_MeshAttachment_setWidth)); + cls->defineFunction("setRegionRotate", _SE(js_cocos2dx_spine_MeshAttachment_setRegionRotate)); + cls->defineFunction("getUVs", _SE(js_cocos2dx_spine_MeshAttachment_getUVs)); + cls->defineFunction("getRegionHeight", _SE(js_cocos2dx_spine_MeshAttachment_getRegionHeight)); + cls->defineFunction("getRegionU2", _SE(js_cocos2dx_spine_MeshAttachment_getRegionU2)); + cls->defineFunction("getHeight", _SE(js_cocos2dx_spine_MeshAttachment_getHeight)); + cls->defineFunction("getPath", _SE(js_cocos2dx_spine_MeshAttachment_getPath)); + cls->defineFunction("setRegionV2", _SE(js_cocos2dx_spine_MeshAttachment_setRegionV2)); + cls->defineFunction("setRegionWidth", _SE(js_cocos2dx_spine_MeshAttachment_setRegionWidth)); + cls->defineFunction("setRegionV", _SE(js_cocos2dx_spine_MeshAttachment_setRegionV)); + cls->defineFunction("setPath", _SE(js_cocos2dx_spine_MeshAttachment_setPath)); + cls->defineFunction("setRegionU", _SE(js_cocos2dx_spine_MeshAttachment_setRegionU)); + cls->defineFunction("applyDeform", _SE(js_cocos2dx_spine_MeshAttachment_applyDeform)); + cls->defineFunction("setHullLength", _SE(js_cocos2dx_spine_MeshAttachment_setHullLength)); + cls->defineFunction("getColor", _SE(js_cocos2dx_spine_MeshAttachment_getColor)); + cls->defineFunction("getRegionOriginalHeight", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOriginalHeight)); + cls->defineFunction("getEdges", _SE(js_cocos2dx_spine_MeshAttachment_getEdges)); + cls->defineFunction("getRegionUVs", _SE(js_cocos2dx_spine_MeshAttachment_getRegionUVs)); + cls->defineFunction("getRegionV2", _SE(js_cocos2dx_spine_MeshAttachment_getRegionV2)); + cls->defineFunction("getRegionWidth", _SE(js_cocos2dx_spine_MeshAttachment_getRegionWidth)); + cls->defineFunction("setHeight", _SE(js_cocos2dx_spine_MeshAttachment_setHeight)); + cls->defineFunction("setRegionOriginalWidth", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOriginalWidth)); + cls->defineFunction("updateUVs", _SE(js_cocos2dx_spine_MeshAttachment_updateUVs)); + cls->defineFunction("getInheritDeform", _SE(js_cocos2dx_spine_MeshAttachment_getInheritDeform)); + cls->defineFunction("setRegionU2", _SE(js_cocos2dx_spine_MeshAttachment_setRegionU2)); + cls->defineFunction("getHullLength", _SE(js_cocos2dx_spine_MeshAttachment_getHullLength)); + cls->defineFunction("setRegionHeight", _SE(js_cocos2dx_spine_MeshAttachment_setRegionHeight)); + cls->defineFunction("getTriangles", _SE(js_cocos2dx_spine_MeshAttachment_getTriangles)); + cls->defineFunction("getRegionOffsetY", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOffsetY)); + cls->defineFunction("getRegionOffsetX", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOffsetX)); + cls->defineFunction("getRegionV", _SE(js_cocos2dx_spine_MeshAttachment_getRegionV)); + cls->defineFunction("getRegionRotate", _SE(js_cocos2dx_spine_MeshAttachment_getRegionRotate)); + cls->defineFunction("getParentMesh", _SE(js_cocos2dx_spine_MeshAttachment_getParentMesh)); + cls->defineFunction("getRegionU", _SE(js_cocos2dx_spine_MeshAttachment_getRegionU)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_MeshAttachment_proto = cls->getProto(); + __jsb_spine_MeshAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PathAttachment_proto = nullptr; +se::Class* __jsb_spine_PathAttachment_class = nullptr; + +static bool js_cocos2dx_spine_PathAttachment_isConstantSpeed(se::State& s) +{ + spine::PathAttachment* cobj = (spine::PathAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathAttachment_isConstantSpeed : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isConstantSpeed(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathAttachment_isConstantSpeed : 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_PathAttachment_isConstantSpeed) + +static bool js_cocos2dx_spine_PathAttachment_isClosed(se::State& s) +{ + spine::PathAttachment* cobj = (spine::PathAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathAttachment_isClosed : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isClosed(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathAttachment_isClosed : 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_PathAttachment_isClosed) + +static bool js_cocos2dx_spine_PathAttachment_setConstantSpeed(se::State& s) +{ + spine::PathAttachment* cobj = (spine::PathAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathAttachment_setConstantSpeed : 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_PathAttachment_setConstantSpeed : Error processing arguments"); + cobj->setConstantSpeed(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_PathAttachment_setConstantSpeed) + +static bool js_cocos2dx_spine_PathAttachment_setClosed(se::State& s) +{ + spine::PathAttachment* cobj = (spine::PathAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathAttachment_setClosed : 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_PathAttachment_setClosed : Error processing arguments"); + cobj->setClosed(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_PathAttachment_setClosed) + +static bool js_cocos2dx_spine_PathAttachment_getLengths(se::State& s) +{ + spine::PathAttachment* cobj = (spine::PathAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathAttachment_getLengths : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getLengths(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathAttachment_getLengths : 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_PathAttachment_getLengths) + + +extern se::Object* __jsb_spine_VertexAttachment_proto; + + +bool js_register_cocos2dx_spine_PathAttachment(se::Object* obj) +{ + auto cls = se::Class::create("PathAttachment", obj, __jsb_spine_VertexAttachment_proto, nullptr); + + cls->defineFunction("isConstantSpeed", _SE(js_cocos2dx_spine_PathAttachment_isConstantSpeed)); + cls->defineFunction("isClosed", _SE(js_cocos2dx_spine_PathAttachment_isClosed)); + cls->defineFunction("setConstantSpeed", _SE(js_cocos2dx_spine_PathAttachment_setConstantSpeed)); + cls->defineFunction("setClosed", _SE(js_cocos2dx_spine_PathAttachment_setClosed)); + cls->defineFunction("getLengths", _SE(js_cocos2dx_spine_PathAttachment_getLengths)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PathAttachment_proto = cls->getProto(); + __jsb_spine_PathAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PathConstraint_proto = nullptr; +se::Class* __jsb_spine_PathConstraint_class = nullptr; + +static bool js_cocos2dx_spine_PathConstraint_setSpacing(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_setSpacing : 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_PathConstraint_setSpacing : Error processing arguments"); + cobj->setSpacing(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_PathConstraint_setSpacing) + +static bool js_cocos2dx_spine_PathConstraint_setRotateMix(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_setRotateMix : 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_PathConstraint_setRotateMix : Error processing arguments"); + cobj->setRotateMix(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_PathConstraint_setRotateMix) + +static bool js_cocos2dx_spine_PathConstraint_getRotateMix(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getRotateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getRotateMix : 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_PathConstraint_getRotateMix) + +static bool js_cocos2dx_spine_PathConstraint_getBones(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getBones : 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_PathConstraint_getBones) + +static bool js_cocos2dx_spine_PathConstraint_setTarget(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_setTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::Slot* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_setTarget : Error processing arguments"); + cobj->setTarget(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_PathConstraint_setTarget) + +static bool js_cocos2dx_spine_PathConstraint_getTranslateMix(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getTranslateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTranslateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getTranslateMix : 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_PathConstraint_getTranslateMix) + +static bool js_cocos2dx_spine_PathConstraint_update(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_update : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->update(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_PathConstraint_update) + +static bool js_cocos2dx_spine_PathConstraint_getTarget(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Slot* result = cobj->getTarget(); + ok &= native_ptr_to_rooted_seval((spine::Slot*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getTarget : 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_PathConstraint_getTarget) + +static bool js_cocos2dx_spine_PathConstraint_getSpacing(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getSpacing : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getSpacing(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getSpacing : 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_PathConstraint_getSpacing) + +static bool js_cocos2dx_spine_PathConstraint_getOrder(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getOrder(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getOrder : 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_PathConstraint_getOrder) + +static bool js_cocos2dx_spine_PathConstraint_apply(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_apply : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->apply(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_PathConstraint_apply) + +static bool js_cocos2dx_spine_PathConstraint_setPosition(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_setPosition : 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_PathConstraint_setPosition : Error processing arguments"); + cobj->setPosition(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_PathConstraint_setPosition) + +static bool js_cocos2dx_spine_PathConstraint_getData(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::PathConstraintData& result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::PathConstraintData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getData : 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_PathConstraint_getData) + +static bool js_cocos2dx_spine_PathConstraint_getPosition(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_getPosition : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getPosition(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraint_getPosition : 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_PathConstraint_getPosition) + +static bool js_cocos2dx_spine_PathConstraint_setTranslateMix(se::State& s) +{ + spine::PathConstraint* cobj = (spine::PathConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraint_setTranslateMix : 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_PathConstraint_setTranslateMix : Error processing arguments"); + cobj->setTranslateMix(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_PathConstraint_setTranslateMix) + + + + +bool js_register_cocos2dx_spine_PathConstraint(se::Object* obj) +{ + auto cls = se::Class::create("PathConstraint", obj, nullptr, nullptr); + + cls->defineFunction("setSpacing", _SE(js_cocos2dx_spine_PathConstraint_setSpacing)); + cls->defineFunction("setRotateMix", _SE(js_cocos2dx_spine_PathConstraint_setRotateMix)); + cls->defineFunction("getRotateMix", _SE(js_cocos2dx_spine_PathConstraint_getRotateMix)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_PathConstraint_getBones)); + cls->defineFunction("setTarget", _SE(js_cocos2dx_spine_PathConstraint_setTarget)); + cls->defineFunction("getTranslateMix", _SE(js_cocos2dx_spine_PathConstraint_getTranslateMix)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_PathConstraint_update)); + cls->defineFunction("getTarget", _SE(js_cocos2dx_spine_PathConstraint_getTarget)); + cls->defineFunction("getSpacing", _SE(js_cocos2dx_spine_PathConstraint_getSpacing)); + cls->defineFunction("getOrder", _SE(js_cocos2dx_spine_PathConstraint_getOrder)); + cls->defineFunction("apply", _SE(js_cocos2dx_spine_PathConstraint_apply)); + cls->defineFunction("setPosition", _SE(js_cocos2dx_spine_PathConstraint_setPosition)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_PathConstraint_getData)); + cls->defineFunction("getPosition", _SE(js_cocos2dx_spine_PathConstraint_getPosition)); + cls->defineFunction("setTranslateMix", _SE(js_cocos2dx_spine_PathConstraint_setTranslateMix)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PathConstraint_proto = cls->getProto(); + __jsb_spine_PathConstraint_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PathConstraintData_proto = nullptr; +se::Class* __jsb_spine_PathConstraintData_class = nullptr; + +static bool js_cocos2dx_spine_PathConstraintData_getOffsetRotation(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getOffsetRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getOffsetRotation : 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_PathConstraintData_getOffsetRotation) + +static bool js_cocos2dx_spine_PathConstraintData_getPositionMode(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getPositionMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = (unsigned int)cobj->getPositionMode(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getPositionMode : 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_PathConstraintData_getPositionMode) + +static bool js_cocos2dx_spine_PathConstraintData_getTarget(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SlotData* result = cobj->getTarget(); + ok &= native_ptr_to_rooted_seval((spine::SlotData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getTarget : 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_PathConstraintData_getTarget) + +static bool js_cocos2dx_spine_PathConstraintData_getSpacingMode(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getSpacingMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = (unsigned int)cobj->getSpacingMode(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getSpacingMode : 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_PathConstraintData_getSpacingMode) + +static bool js_cocos2dx_spine_PathConstraintData_setSpacing(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setSpacing : 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_PathConstraintData_setSpacing : Error processing arguments"); + cobj->setSpacing(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_PathConstraintData_setSpacing) + +static bool js_cocos2dx_spine_PathConstraintData_getName(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getName : 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_PathConstraintData_getName) + +static bool js_cocos2dx_spine_PathConstraintData_getOrder(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getOrder(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getOrder : 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_PathConstraintData_getOrder) + +static bool js_cocos2dx_spine_PathConstraintData_setRotateMode(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setRotateMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::RotateMode arg0; + ok &= seval_to_uint32(args[0], (uint32_t*)&arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_setRotateMode : Error processing arguments"); + cobj->setRotateMode(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_PathConstraintData_setRotateMode) + +static bool js_cocos2dx_spine_PathConstraintData_setRotateMix(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setRotateMix : 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_PathConstraintData_setRotateMix : Error processing arguments"); + cobj->setRotateMix(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_PathConstraintData_setRotateMix) + +static bool js_cocos2dx_spine_PathConstraintData_getRotateMix(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getRotateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getRotateMix : 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_PathConstraintData_getRotateMix) + +static bool js_cocos2dx_spine_PathConstraintData_setTarget(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::SlotData* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_setTarget : Error processing arguments"); + cobj->setTarget(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_PathConstraintData_setTarget) + +static bool js_cocos2dx_spine_PathConstraintData_getTranslateMix(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getTranslateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTranslateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getTranslateMix : 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_PathConstraintData_getTranslateMix) + +static bool js_cocos2dx_spine_PathConstraintData_getSpacing(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getSpacing : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getSpacing(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getSpacing : 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_PathConstraintData_getSpacing) + +static bool js_cocos2dx_spine_PathConstraintData_setOffsetRotation(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setOffsetRotation : 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_PathConstraintData_setOffsetRotation : Error processing arguments"); + cobj->setOffsetRotation(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_PathConstraintData_setOffsetRotation) + +static bool js_cocos2dx_spine_PathConstraintData_setOrder(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_setOrder : Error processing arguments"); + cobj->setOrder(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_PathConstraintData_setOrder) + +static bool js_cocos2dx_spine_PathConstraintData_getRotateMode(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getRotateMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = (unsigned int)cobj->getRotateMode(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getRotateMode : 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_PathConstraintData_getRotateMode) + +static bool js_cocos2dx_spine_PathConstraintData_setPosition(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setPosition : 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_PathConstraintData_setPosition : Error processing arguments"); + cobj->setPosition(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_PathConstraintData_setPosition) + +static bool js_cocos2dx_spine_PathConstraintData_getPosition(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getPosition : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getPosition(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getPosition : 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_PathConstraintData_getPosition) + +static bool js_cocos2dx_spine_PathConstraintData_setSpacingMode(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setSpacingMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::SpacingMode arg0; + ok &= seval_to_uint32(args[0], (uint32_t*)&arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_setSpacingMode : Error processing arguments"); + cobj->setSpacingMode(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_PathConstraintData_setSpacingMode) + +static bool js_cocos2dx_spine_PathConstraintData_getBones(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_getBones : 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_PathConstraintData_getBones) + +static bool js_cocos2dx_spine_PathConstraintData_setPositionMode(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setPositionMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::PositionMode arg0; + ok &= seval_to_uint32(args[0], (uint32_t*)&arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintData_setPositionMode : Error processing arguments"); + cobj->setPositionMode(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_PathConstraintData_setPositionMode) + +static bool js_cocos2dx_spine_PathConstraintData_setTranslateMix(se::State& s) +{ + spine::PathConstraintData* cobj = (spine::PathConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintData_setTranslateMix : 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_PathConstraintData_setTranslateMix : Error processing arguments"); + cobj->setTranslateMix(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_PathConstraintData_setTranslateMix) + + + + +bool js_register_cocos2dx_spine_PathConstraintData(se::Object* obj) +{ + auto cls = se::Class::create("PathConstraintData", obj, nullptr, nullptr); + + cls->defineFunction("getOffsetRotation", _SE(js_cocos2dx_spine_PathConstraintData_getOffsetRotation)); + cls->defineFunction("getPositionMode", _SE(js_cocos2dx_spine_PathConstraintData_getPositionMode)); + cls->defineFunction("getTarget", _SE(js_cocos2dx_spine_PathConstraintData_getTarget)); + cls->defineFunction("getSpacingMode", _SE(js_cocos2dx_spine_PathConstraintData_getSpacingMode)); + cls->defineFunction("setSpacing", _SE(js_cocos2dx_spine_PathConstraintData_setSpacing)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_PathConstraintData_getName)); + cls->defineFunction("getOrder", _SE(js_cocos2dx_spine_PathConstraintData_getOrder)); + cls->defineFunction("setRotateMode", _SE(js_cocos2dx_spine_PathConstraintData_setRotateMode)); + cls->defineFunction("setRotateMix", _SE(js_cocos2dx_spine_PathConstraintData_setRotateMix)); + cls->defineFunction("getRotateMix", _SE(js_cocos2dx_spine_PathConstraintData_getRotateMix)); + cls->defineFunction("setTarget", _SE(js_cocos2dx_spine_PathConstraintData_setTarget)); + cls->defineFunction("getTranslateMix", _SE(js_cocos2dx_spine_PathConstraintData_getTranslateMix)); + cls->defineFunction("getSpacing", _SE(js_cocos2dx_spine_PathConstraintData_getSpacing)); + cls->defineFunction("setOffsetRotation", _SE(js_cocos2dx_spine_PathConstraintData_setOffsetRotation)); + cls->defineFunction("setOrder", _SE(js_cocos2dx_spine_PathConstraintData_setOrder)); + cls->defineFunction("getRotateMode", _SE(js_cocos2dx_spine_PathConstraintData_getRotateMode)); + cls->defineFunction("setPosition", _SE(js_cocos2dx_spine_PathConstraintData_setPosition)); + cls->defineFunction("getPosition", _SE(js_cocos2dx_spine_PathConstraintData_getPosition)); + cls->defineFunction("setSpacingMode", _SE(js_cocos2dx_spine_PathConstraintData_setSpacingMode)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_PathConstraintData_getBones)); + cls->defineFunction("setPositionMode", _SE(js_cocos2dx_spine_PathConstraintData_setPositionMode)); + cls->defineFunction("setTranslateMix", _SE(js_cocos2dx_spine_PathConstraintData_setTranslateMix)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PathConstraintData_proto = cls->getProto(); + __jsb_spine_PathConstraintData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PathConstraintMixTimeline_proto = nullptr; +se::Class* __jsb_spine_PathConstraintMixTimeline_class = nullptr; + +static bool js_cocos2dx_spine_PathConstraintMixTimeline_getPropertyId(se::State& s) +{ + spine::PathConstraintMixTimeline* cobj = (spine::PathConstraintMixTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintMixTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintMixTimeline_getPropertyId : 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_PathConstraintMixTimeline_getPropertyId) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_PathConstraintMixTimeline(se::Object* obj) +{ + auto cls = se::Class::create("PathConstraintMixTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_PathConstraintMixTimeline_getPropertyId)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PathConstraintMixTimeline_proto = cls->getProto(); + __jsb_spine_PathConstraintMixTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PathConstraintPositionTimeline_proto = nullptr; +se::Class* __jsb_spine_PathConstraintPositionTimeline_class = nullptr; + +static bool js_cocos2dx_spine_PathConstraintPositionTimeline_getPropertyId(se::State& s) +{ + spine::PathConstraintPositionTimeline* cobj = (spine::PathConstraintPositionTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintPositionTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintPositionTimeline_getPropertyId : 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_PathConstraintPositionTimeline_getPropertyId) + +static bool js_cocos2dx_spine_PathConstraintPositionTimeline_setFrame(se::State& s) +{ + spine::PathConstraintPositionTimeline* cobj = (spine::PathConstraintPositionTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintPositionTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + int arg0 = 0; + float arg1 = 0; + float arg2 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintPositionTimeline_setFrame : Error processing arguments"); + cobj->setFrame(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_PathConstraintPositionTimeline_setFrame) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_PathConstraintPositionTimeline(se::Object* obj) +{ + auto cls = se::Class::create("PathConstraintPositionTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_PathConstraintPositionTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_PathConstraintPositionTimeline_setFrame)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PathConstraintPositionTimeline_proto = cls->getProto(); + __jsb_spine_PathConstraintPositionTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PathConstraintSpacingTimeline_proto = nullptr; +se::Class* __jsb_spine_PathConstraintSpacingTimeline_class = nullptr; + +static bool js_cocos2dx_spine_PathConstraintSpacingTimeline_getPropertyId(se::State& s) +{ + spine::PathConstraintSpacingTimeline* cobj = (spine::PathConstraintSpacingTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PathConstraintSpacingTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PathConstraintSpacingTimeline_getPropertyId : 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_PathConstraintSpacingTimeline_getPropertyId) + + +extern se::Object* __jsb_spine_PathConstraintPositionTimeline_proto; + + +bool js_register_cocos2dx_spine_PathConstraintSpacingTimeline(se::Object* obj) +{ + auto cls = se::Class::create("PathConstraintSpacingTimeline", obj, __jsb_spine_PathConstraintPositionTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_PathConstraintSpacingTimeline_getPropertyId)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PathConstraintSpacingTimeline_proto = cls->getProto(); + __jsb_spine_PathConstraintSpacingTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_PointAttachment_proto = nullptr; +se::Class* __jsb_spine_PointAttachment_class = nullptr; + +static bool js_cocos2dx_spine_PointAttachment_getX(se::State& s) +{ + spine::PointAttachment* cobj = (spine::PointAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PointAttachment_getX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PointAttachment_getX : 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_PointAttachment_getX) + +static bool js_cocos2dx_spine_PointAttachment_getY(se::State& s) +{ + spine::PointAttachment* cobj = (spine::PointAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PointAttachment_getY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PointAttachment_getY : 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_PointAttachment_getY) + +static bool js_cocos2dx_spine_PointAttachment_getRotation(se::State& s) +{ + spine::PointAttachment* cobj = (spine::PointAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PointAttachment_getRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_PointAttachment_getRotation : 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_PointAttachment_getRotation) + +static bool js_cocos2dx_spine_PointAttachment_setRotation(se::State& s) +{ + spine::PointAttachment* cobj = (spine::PointAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PointAttachment_setRotation : 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_PointAttachment_setRotation : Error processing arguments"); + cobj->setRotation(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_PointAttachment_setRotation) + +static bool js_cocos2dx_spine_PointAttachment_setX(se::State& s) +{ + spine::PointAttachment* cobj = (spine::PointAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PointAttachment_setX : 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_PointAttachment_setX : Error processing arguments"); + cobj->setX(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_PointAttachment_setX) + +static bool js_cocos2dx_spine_PointAttachment_setY(se::State& s) +{ + spine::PointAttachment* cobj = (spine::PointAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_PointAttachment_setY : 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_PointAttachment_setY : Error processing arguments"); + cobj->setY(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_PointAttachment_setY) + + +extern se::Object* __jsb_spine_Attachment_proto; + + +bool js_register_cocos2dx_spine_PointAttachment(se::Object* obj) +{ + auto cls = se::Class::create("PointAttachment", obj, __jsb_spine_Attachment_proto, nullptr); + + cls->defineFunction("getX", _SE(js_cocos2dx_spine_PointAttachment_getX)); + cls->defineFunction("getY", _SE(js_cocos2dx_spine_PointAttachment_getY)); + cls->defineFunction("getRotation", _SE(js_cocos2dx_spine_PointAttachment_getRotation)); + cls->defineFunction("setRotation", _SE(js_cocos2dx_spine_PointAttachment_setRotation)); + cls->defineFunction("setX", _SE(js_cocos2dx_spine_PointAttachment_setX)); + cls->defineFunction("setY", _SE(js_cocos2dx_spine_PointAttachment_setY)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_PointAttachment_proto = cls->getProto(); + __jsb_spine_PointAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_RegionAttachment_proto = nullptr; +se::Class* __jsb_spine_RegionAttachment_class = nullptr; + +static bool js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight : 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_RegionAttachment_setRegionOriginalHeight : Error processing arguments"); + cobj->setRegionOriginalHeight(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_RegionAttachment_setRegionOriginalHeight) + +static bool js_cocos2dx_spine_RegionAttachment_setRegionOffsetY(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionOffsetY : 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_RegionAttachment_setRegionOffsetY : Error processing arguments"); + cobj->setRegionOffsetY(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_RegionAttachment_setRegionOffsetY) + +static bool js_cocos2dx_spine_RegionAttachment_setRegionOffsetX(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionOffsetX : 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_RegionAttachment_setRegionOffsetX : Error processing arguments"); + cobj->setRegionOffsetX(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_RegionAttachment_setRegionOffsetX) + +static bool js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOriginalWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth : 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_RegionAttachment_getRegionOriginalWidth) + +static bool js_cocos2dx_spine_RegionAttachment_setUVs(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setUVs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 5) { + float arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + bool arg4; + ok &= seval_to_float(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + ok &= seval_to_boolean(args[4], &arg4); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_setUVs : Error processing arguments"); + cobj->setUVs(arg0, arg1, arg2, arg3, arg4); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 5); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setUVs) + +static bool js_cocos2dx_spine_RegionAttachment_getWidth(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getWidth : 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_RegionAttachment_getWidth) + +static bool js_cocos2dx_spine_RegionAttachment_getY(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getY : 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_RegionAttachment_getY) + +static bool js_cocos2dx_spine_RegionAttachment_getRotation(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRotation : 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_RegionAttachment_getRotation) + +static bool js_cocos2dx_spine_RegionAttachment_setWidth(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setWidth : 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_RegionAttachment_setWidth : Error processing arguments"); + cobj->setWidth(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_RegionAttachment_setWidth) + +static bool js_cocos2dx_spine_RegionAttachment_setRegionWidth(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionWidth : 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_RegionAttachment_setRegionWidth : Error processing arguments"); + cobj->setRegionWidth(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_RegionAttachment_setRegionWidth) + +static bool js_cocos2dx_spine_RegionAttachment_getUVs(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getUVs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getUVs(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getUVs : 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_RegionAttachment_getUVs) + +static bool js_cocos2dx_spine_RegionAttachment_getRegionHeight(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionHeight : 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_RegionAttachment_getRegionHeight) + +static bool js_cocos2dx_spine_RegionAttachment_getScaleY(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getScaleY : 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_RegionAttachment_getScaleY) + +static bool js_cocos2dx_spine_RegionAttachment_getScaleX(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getScaleX : 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_RegionAttachment_getScaleX) + +static bool js_cocos2dx_spine_RegionAttachment_getHeight(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getHeight : 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_RegionAttachment_getHeight) + +static bool js_cocos2dx_spine_RegionAttachment_getPath(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getPath(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getPath : 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_RegionAttachment_getPath) + +static bool js_cocos2dx_spine_RegionAttachment_setRotation(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRotation : 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_RegionAttachment_setRotation : Error processing arguments"); + cobj->setRotation(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_RegionAttachment_setRotation) + +static bool js_cocos2dx_spine_RegionAttachment_setPath(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_setPath : Error processing arguments"); + cobj->setPath(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_RegionAttachment_setPath) + +static bool js_cocos2dx_spine_RegionAttachment_getRegionWidth(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionWidth : 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_RegionAttachment_getRegionWidth) + +static bool js_cocos2dx_spine_RegionAttachment_setScaleY(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setScaleY : 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_RegionAttachment_setScaleY : Error processing arguments"); + cobj->setScaleY(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_RegionAttachment_setScaleY) + +static bool js_cocos2dx_spine_RegionAttachment_setScaleX(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setScaleX : 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_RegionAttachment_setScaleX : Error processing arguments"); + cobj->setScaleX(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_RegionAttachment_setScaleX) + +static bool js_cocos2dx_spine_RegionAttachment_setRegionOriginalWidth(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionOriginalWidth : 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_RegionAttachment_setRegionOriginalWidth : Error processing arguments"); + cobj->setRegionOriginalWidth(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_RegionAttachment_setRegionOriginalWidth) + +static bool js_cocos2dx_spine_RegionAttachment_getColor(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getColor : 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_RegionAttachment_getColor) + +static bool js_cocos2dx_spine_RegionAttachment_setX(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setX : 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_RegionAttachment_setX : Error processing arguments"); + cobj->setX(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_RegionAttachment_setX) + +static bool js_cocos2dx_spine_RegionAttachment_setY(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setY : 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_RegionAttachment_setY : Error processing arguments"); + cobj->setY(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_RegionAttachment_setY) + +static bool js_cocos2dx_spine_RegionAttachment_setHeight(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setHeight : 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_RegionAttachment_setHeight : Error processing arguments"); + cobj->setHeight(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_RegionAttachment_setHeight) + +static bool js_cocos2dx_spine_RegionAttachment_getX(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getX : 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_RegionAttachment_getX) + +static bool js_cocos2dx_spine_RegionAttachment_getOffset(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getOffset : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getOffset(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getOffset : 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_RegionAttachment_getOffset) + +static bool js_cocos2dx_spine_RegionAttachment_setRegionHeight(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionHeight : 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_RegionAttachment_setRegionHeight : Error processing arguments"); + cobj->setRegionHeight(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_RegionAttachment_setRegionHeight) + +static bool js_cocos2dx_spine_RegionAttachment_updateOffset(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_updateOffset : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->updateOffset(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_updateOffset) + +static bool js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOriginalHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight : 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_RegionAttachment_getRegionOriginalHeight) + +static bool js_cocos2dx_spine_RegionAttachment_getRegionOffsetY(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionOffsetY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOffsetY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionOffsetY : 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_RegionAttachment_getRegionOffsetY) + +static bool js_cocos2dx_spine_RegionAttachment_getRegionOffsetX(se::State& s) +{ + spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionOffsetX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRegionOffsetX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionOffsetX : 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_RegionAttachment_getRegionOffsetX) + + +extern se::Object* __jsb_spine_Attachment_proto; + + +bool js_register_cocos2dx_spine_RegionAttachment(se::Object* obj) +{ + auto cls = se::Class::create("RegionAttachment", obj, __jsb_spine_Attachment_proto, nullptr); + + cls->defineFunction("setRegionOriginalHeight", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight)); + cls->defineFunction("setRegionOffsetY", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOffsetY)); + cls->defineFunction("setRegionOffsetX", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOffsetX)); + cls->defineFunction("getRegionOriginalWidth", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth)); + cls->defineFunction("setUVs", _SE(js_cocos2dx_spine_RegionAttachment_setUVs)); + cls->defineFunction("getWidth", _SE(js_cocos2dx_spine_RegionAttachment_getWidth)); + cls->defineFunction("getY", _SE(js_cocos2dx_spine_RegionAttachment_getY)); + cls->defineFunction("getRotation", _SE(js_cocos2dx_spine_RegionAttachment_getRotation)); + cls->defineFunction("setWidth", _SE(js_cocos2dx_spine_RegionAttachment_setWidth)); + cls->defineFunction("setRegionWidth", _SE(js_cocos2dx_spine_RegionAttachment_setRegionWidth)); + cls->defineFunction("getUVs", _SE(js_cocos2dx_spine_RegionAttachment_getUVs)); + cls->defineFunction("getRegionHeight", _SE(js_cocos2dx_spine_RegionAttachment_getRegionHeight)); + cls->defineFunction("getScaleY", _SE(js_cocos2dx_spine_RegionAttachment_getScaleY)); + cls->defineFunction("getScaleX", _SE(js_cocos2dx_spine_RegionAttachment_getScaleX)); + cls->defineFunction("getHeight", _SE(js_cocos2dx_spine_RegionAttachment_getHeight)); + cls->defineFunction("getPath", _SE(js_cocos2dx_spine_RegionAttachment_getPath)); + cls->defineFunction("setRotation", _SE(js_cocos2dx_spine_RegionAttachment_setRotation)); + cls->defineFunction("setPath", _SE(js_cocos2dx_spine_RegionAttachment_setPath)); + cls->defineFunction("getRegionWidth", _SE(js_cocos2dx_spine_RegionAttachment_getRegionWidth)); + cls->defineFunction("setScaleY", _SE(js_cocos2dx_spine_RegionAttachment_setScaleY)); + cls->defineFunction("setScaleX", _SE(js_cocos2dx_spine_RegionAttachment_setScaleX)); + cls->defineFunction("setRegionOriginalWidth", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOriginalWidth)); + cls->defineFunction("getColor", _SE(js_cocos2dx_spine_RegionAttachment_getColor)); + cls->defineFunction("setX", _SE(js_cocos2dx_spine_RegionAttachment_setX)); + cls->defineFunction("setY", _SE(js_cocos2dx_spine_RegionAttachment_setY)); + cls->defineFunction("setHeight", _SE(js_cocos2dx_spine_RegionAttachment_setHeight)); + cls->defineFunction("getX", _SE(js_cocos2dx_spine_RegionAttachment_getX)); + cls->defineFunction("getOffset", _SE(js_cocos2dx_spine_RegionAttachment_getOffset)); + cls->defineFunction("setRegionHeight", _SE(js_cocos2dx_spine_RegionAttachment_setRegionHeight)); + cls->defineFunction("updateOffset", _SE(js_cocos2dx_spine_RegionAttachment_updateOffset)); + cls->defineFunction("getRegionOriginalHeight", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight)); + cls->defineFunction("getRegionOffsetY", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOffsetY)); + cls->defineFunction("getRegionOffsetX", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOffsetX)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_RegionAttachment_proto = cls->getProto(); + __jsb_spine_RegionAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_RotateTimeline_proto = nullptr; +se::Class* __jsb_spine_RotateTimeline_class = nullptr; + +static bool js_cocos2dx_spine_RotateTimeline_getPropertyId(se::State& s) +{ + spine::RotateTimeline* cobj = (spine::RotateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RotateTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RotateTimeline_getPropertyId : 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_RotateTimeline_getPropertyId) + +static bool js_cocos2dx_spine_RotateTimeline_setFrame(se::State& s) +{ + spine::RotateTimeline* cobj = (spine::RotateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RotateTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + int arg0 = 0; + float arg1 = 0; + float arg2 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RotateTimeline_setFrame : Error processing arguments"); + cobj->setFrame(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_RotateTimeline_setFrame) + +static bool js_cocos2dx_spine_RotateTimeline_getFrames(se::State& s) +{ + spine::RotateTimeline* cobj = (spine::RotateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RotateTimeline_getFrames : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getFrames(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RotateTimeline_getFrames : 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_RotateTimeline_getFrames) + +static bool js_cocos2dx_spine_RotateTimeline_setBoneIndex(se::State& s) +{ + spine::RotateTimeline* cobj = (spine::RotateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RotateTimeline_setBoneIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RotateTimeline_setBoneIndex : Error processing arguments"); + cobj->setBoneIndex(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_RotateTimeline_setBoneIndex) + +static bool js_cocos2dx_spine_RotateTimeline_getBoneIndex(se::State& s) +{ + spine::RotateTimeline* cobj = (spine::RotateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RotateTimeline_getBoneIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getBoneIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RotateTimeline_getBoneIndex : 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_RotateTimeline_getBoneIndex) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_RotateTimeline(se::Object* obj) +{ + auto cls = se::Class::create("RotateTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_RotateTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_RotateTimeline_setFrame)); + cls->defineFunction("getFrames", _SE(js_cocos2dx_spine_RotateTimeline_getFrames)); + cls->defineFunction("setBoneIndex", _SE(js_cocos2dx_spine_RotateTimeline_setBoneIndex)); + cls->defineFunction("getBoneIndex", _SE(js_cocos2dx_spine_RotateTimeline_getBoneIndex)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_RotateTimeline_proto = cls->getProto(); + __jsb_spine_RotateTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_TranslateTimeline_proto = nullptr; +se::Class* __jsb_spine_TranslateTimeline_class = nullptr; + +static bool js_cocos2dx_spine_TranslateTimeline_getPropertyId(se::State& s) +{ + spine::TranslateTimeline* cobj = (spine::TranslateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TranslateTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TranslateTimeline_getPropertyId : 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_TranslateTimeline_getPropertyId) + +static bool js_cocos2dx_spine_TranslateTimeline_setFrame(se::State& s) +{ + spine::TranslateTimeline* cobj = (spine::TranslateTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TranslateTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 4) { + int arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TranslateTimeline_setFrame : Error processing arguments"); + cobj->setFrame(arg0, arg1, arg2, arg3); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_TranslateTimeline_setFrame) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_TranslateTimeline(se::Object* obj) +{ + auto cls = se::Class::create("TranslateTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_TranslateTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_TranslateTimeline_setFrame)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_TranslateTimeline_proto = cls->getProto(); + __jsb_spine_TranslateTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_ScaleTimeline_proto = nullptr; +se::Class* __jsb_spine_ScaleTimeline_class = nullptr; + +static bool js_cocos2dx_spine_ScaleTimeline_getPropertyId(se::State& s) +{ + spine::ScaleTimeline* cobj = (spine::ScaleTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ScaleTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ScaleTimeline_getPropertyId : 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_ScaleTimeline_getPropertyId) + + +extern se::Object* __jsb_spine_TranslateTimeline_proto; + + +bool js_register_cocos2dx_spine_ScaleTimeline(se::Object* obj) +{ + auto cls = se::Class::create("ScaleTimeline", obj, __jsb_spine_TranslateTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_ScaleTimeline_getPropertyId)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_ScaleTimeline_proto = cls->getProto(); + __jsb_spine_ScaleTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_ShearTimeline_proto = nullptr; +se::Class* __jsb_spine_ShearTimeline_class = nullptr; + +static bool js_cocos2dx_spine_ShearTimeline_getPropertyId(se::State& s) +{ + spine::ShearTimeline* cobj = (spine::ShearTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_ShearTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_ShearTimeline_getPropertyId : 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_ShearTimeline_getPropertyId) + + +extern se::Object* __jsb_spine_TranslateTimeline_proto; + + +bool js_register_cocos2dx_spine_ShearTimeline(se::Object* obj) +{ + auto cls = se::Class::create("ShearTimeline", obj, __jsb_spine_TranslateTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_ShearTimeline_getPropertyId)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_ShearTimeline_proto = cls->getProto(); + __jsb_spine_ShearTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Skeleton_proto = nullptr; +se::Class* __jsb_spine_Skeleton_class = nullptr; + +static bool js_cocos2dx_spine_Skeleton_setToSetupPose(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setToSetupPose : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->setToSetupPose(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Skeleton_setToSetupPose) + +static bool js_cocos2dx_spine_Skeleton_getSkin(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getSkin : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Skin* result = cobj->getSkin(); + ok &= native_ptr_to_rooted_seval((spine::Skin*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getSkin : 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_Skeleton_getSkin) + +static bool js_cocos2dx_spine_Skeleton_getX(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getX : 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_Skeleton_getX) + +static bool js_cocos2dx_spine_Skeleton_findTransformConstraint(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findTransformConstraint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findTransformConstraint : Error processing arguments"); + spine::TransformConstraint* result = cobj->findTransformConstraint(arg0); + ok &= native_ptr_to_rooted_seval((spine::TransformConstraint*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findTransformConstraint : 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_Skeleton_findTransformConstraint) + +static bool js_cocos2dx_spine_Skeleton_setAttachment(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + spine::String arg0; + spine::String arg1; + arg0 = args[0].toStringForce().c_str(); + arg1 = args[1].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_setAttachment : Error processing arguments"); + cobj->setAttachment(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_Skeleton_setAttachment) + +static bool js_cocos2dx_spine_Skeleton_findIkConstraint(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findIkConstraint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findIkConstraint : Error processing arguments"); + spine::IkConstraint* result = cobj->findIkConstraint(arg0); + ok &= native_ptr_to_rooted_seval((spine::IkConstraint*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findIkConstraint : 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_Skeleton_findIkConstraint) + +static bool js_cocos2dx_spine_Skeleton_setBonesToSetupPose(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setBonesToSetupPose : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->setBonesToSetupPose(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Skeleton_setBonesToSetupPose) + +static bool js_cocos2dx_spine_Skeleton_getScaleY(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getScaleY : 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_Skeleton_getScaleY) + +static bool js_cocos2dx_spine_Skeleton_getScaleX(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getScaleX : 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_Skeleton_getScaleX) + +static bool js_cocos2dx_spine_Skeleton_findBoneIndex(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findBoneIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findBoneIndex : Error processing arguments"); + int result = cobj->findBoneIndex(arg0); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findBoneIndex : 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_Skeleton_findBoneIndex) + +static bool js_cocos2dx_spine_Skeleton_setSlotsToSetupPose(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setSlotsToSetupPose : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->setSlotsToSetupPose(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Skeleton_setSlotsToSetupPose) + +static bool js_cocos2dx_spine_Skeleton_getDrawOrder(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getDrawOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getDrawOrder(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getDrawOrder : 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_Skeleton_getDrawOrder) + +static bool js_cocos2dx_spine_Skeleton_getTime(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getTime : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTime(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getTime : 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_Skeleton_getTime) + +static bool js_cocos2dx_spine_Skeleton_getColor(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getColor : 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_Skeleton_getColor) + +static bool js_cocos2dx_spine_Skeleton_getIkConstraints(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getIkConstraints : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getIkConstraints(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getIkConstraints : 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_Skeleton_getIkConstraints) + +static bool js_cocos2dx_spine_Skeleton_getData(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SkeletonData* result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::SkeletonData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getData : 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_Skeleton_getData) + +static bool js_cocos2dx_spine_Skeleton_getUpdateCacheList(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getUpdateCacheList : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getUpdateCacheList(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getUpdateCacheList : 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_Skeleton_getUpdateCacheList) + +static bool js_cocos2dx_spine_Skeleton_setScaleY(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setScaleY : 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_Skeleton_setScaleY : Error processing arguments"); + cobj->setScaleY(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_Skeleton_setScaleY) + +static bool js_cocos2dx_spine_Skeleton_setScaleX(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setScaleX : 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_Skeleton_setScaleX : Error processing arguments"); + cobj->setScaleX(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_Skeleton_setScaleX) + +static bool js_cocos2dx_spine_Skeleton_getPathConstraints(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getPathConstraints : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getPathConstraints(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getPathConstraints : 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_Skeleton_getPathConstraints) + +static bool js_cocos2dx_spine_Skeleton_getSlots(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getSlots : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getSlots(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getSlots : 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_Skeleton_getSlots) + +static bool js_cocos2dx_spine_Skeleton_printUpdateCache(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_printUpdateCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->printUpdateCache(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Skeleton_printUpdateCache) + +static bool js_cocos2dx_spine_Skeleton_update(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_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_Skeleton_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_Skeleton_update) + +static bool js_cocos2dx_spine_Skeleton_getAttachment(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_Skeleton_getAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 2) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + if (!ok) { ok = true; break; } + spine::String arg1; + arg1 = args[1].toStringForce().c_str(); + if (!ok) { ok = true; break; } + 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_Skeleton_getAttachment : Error processing arguments"); + return true; + } + } while(false); + + do { + if (argc == 2) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + if (!ok) { ok = true; break; } + spine::String arg1; + arg1 = args[1].toStringForce().c_str(); + if (!ok) { ok = true; break; } + 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_Skeleton_getAttachment : 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_Skeleton_getAttachment) + +static bool js_cocos2dx_spine_Skeleton_setTime(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setTime : 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_Skeleton_setTime : Error processing arguments"); + cobj->setTime(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_Skeleton_setTime) + +static bool js_cocos2dx_spine_Skeleton_setPosition(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setPosition : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + float arg0 = 0; + float arg1 = 0; + ok &= seval_to_float(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_setPosition : Error processing arguments"); + cobj->setPosition(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_Skeleton_setPosition) + +static bool js_cocos2dx_spine_Skeleton_setX(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setX : 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_Skeleton_setX : Error processing arguments"); + cobj->setX(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_Skeleton_setX) + +static bool js_cocos2dx_spine_Skeleton_setY(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_setY : 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_Skeleton_setY : Error processing arguments"); + cobj->setY(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_Skeleton_setY) + +static bool js_cocos2dx_spine_Skeleton_findBone(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findBone : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_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_Skeleton_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_Skeleton_findBone) + +static bool js_cocos2dx_spine_Skeleton_getY(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getY : 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_Skeleton_getY) + +static bool js_cocos2dx_spine_Skeleton_getBones(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getBones : 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_Skeleton_getBones) + +static bool js_cocos2dx_spine_Skeleton_getRootBone(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getRootBone : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Bone* result = cobj->getRootBone(); + ok &= native_ptr_to_rooted_seval((spine::Bone*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getRootBone : 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_Skeleton_getRootBone) + +static bool js_cocos2dx_spine_Skeleton_updateCache(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_updateCache : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->updateCache(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Skeleton_updateCache) + +static bool js_cocos2dx_spine_Skeleton_findSlotIndex(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findSlotIndex : Error processing arguments"); + int result = cobj->findSlotIndex(arg0); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findSlotIndex : 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_Skeleton_findSlotIndex) + +static bool js_cocos2dx_spine_Skeleton_getTransformConstraints(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_getTransformConstraints : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getTransformConstraints(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_getTransformConstraints : 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_Skeleton_getTransformConstraints) + +static bool js_cocos2dx_spine_Skeleton_setSkin(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_Skeleton_setSkin : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 1) { + spine::Skin* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + cobj->setSkin(arg0); + return true; + } + } while(false); + + do { + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + 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_Skeleton_setSkin) + +static bool js_cocos2dx_spine_Skeleton_findSlot(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_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_Skeleton_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_Skeleton_findSlot) + +static bool js_cocos2dx_spine_Skeleton_updateWorldTransform(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_updateWorldTransform : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->updateWorldTransform(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Skeleton_updateWorldTransform) + +static bool js_cocos2dx_spine_Skeleton_findPathConstraint(se::State& s) +{ + spine::Skeleton* cobj = (spine::Skeleton*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skeleton_findPathConstraint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findPathConstraint : Error processing arguments"); + spine::PathConstraint* result = cobj->findPathConstraint(arg0); + ok &= native_ptr_to_rooted_seval((spine::PathConstraint*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skeleton_findPathConstraint : 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_Skeleton_findPathConstraint) + + + + +bool js_register_cocos2dx_spine_Skeleton(se::Object* obj) +{ + auto cls = se::Class::create("Skeleton", obj, nullptr, nullptr); + + cls->defineFunction("setToSetupPose", _SE(js_cocos2dx_spine_Skeleton_setToSetupPose)); + cls->defineFunction("getSkin", _SE(js_cocos2dx_spine_Skeleton_getSkin)); + cls->defineFunction("getX", _SE(js_cocos2dx_spine_Skeleton_getX)); + cls->defineFunction("findTransformConstraint", _SE(js_cocos2dx_spine_Skeleton_findTransformConstraint)); + cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_Skeleton_setAttachment)); + cls->defineFunction("findIkConstraint", _SE(js_cocos2dx_spine_Skeleton_findIkConstraint)); + cls->defineFunction("setBonesToSetupPose", _SE(js_cocos2dx_spine_Skeleton_setBonesToSetupPose)); + cls->defineFunction("getScaleY", _SE(js_cocos2dx_spine_Skeleton_getScaleY)); + cls->defineFunction("getScaleX", _SE(js_cocos2dx_spine_Skeleton_getScaleX)); + cls->defineFunction("findBoneIndex", _SE(js_cocos2dx_spine_Skeleton_findBoneIndex)); + cls->defineFunction("setSlotsToSetupPose", _SE(js_cocos2dx_spine_Skeleton_setSlotsToSetupPose)); + cls->defineFunction("getDrawOrder", _SE(js_cocos2dx_spine_Skeleton_getDrawOrder)); + cls->defineFunction("getTime", _SE(js_cocos2dx_spine_Skeleton_getTime)); + cls->defineFunction("getColor", _SE(js_cocos2dx_spine_Skeleton_getColor)); + cls->defineFunction("getIkConstraints", _SE(js_cocos2dx_spine_Skeleton_getIkConstraints)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_Skeleton_getData)); + cls->defineFunction("getUpdateCacheList", _SE(js_cocos2dx_spine_Skeleton_getUpdateCacheList)); + cls->defineFunction("setScaleY", _SE(js_cocos2dx_spine_Skeleton_setScaleY)); + cls->defineFunction("setScaleX", _SE(js_cocos2dx_spine_Skeleton_setScaleX)); + cls->defineFunction("getPathConstraints", _SE(js_cocos2dx_spine_Skeleton_getPathConstraints)); + cls->defineFunction("getSlots", _SE(js_cocos2dx_spine_Skeleton_getSlots)); + cls->defineFunction("printUpdateCache", _SE(js_cocos2dx_spine_Skeleton_printUpdateCache)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_Skeleton_update)); + cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_Skeleton_getAttachment)); + cls->defineFunction("setTime", _SE(js_cocos2dx_spine_Skeleton_setTime)); + cls->defineFunction("setPosition", _SE(js_cocos2dx_spine_Skeleton_setPosition)); + cls->defineFunction("setX", _SE(js_cocos2dx_spine_Skeleton_setX)); + cls->defineFunction("setY", _SE(js_cocos2dx_spine_Skeleton_setY)); + cls->defineFunction("findBone", _SE(js_cocos2dx_spine_Skeleton_findBone)); + cls->defineFunction("getY", _SE(js_cocos2dx_spine_Skeleton_getY)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_Skeleton_getBones)); + cls->defineFunction("getRootBone", _SE(js_cocos2dx_spine_Skeleton_getRootBone)); + cls->defineFunction("updateCache", _SE(js_cocos2dx_spine_Skeleton_updateCache)); + cls->defineFunction("findSlotIndex", _SE(js_cocos2dx_spine_Skeleton_findSlotIndex)); + cls->defineFunction("getTransformConstraints", _SE(js_cocos2dx_spine_Skeleton_getTransformConstraints)); + cls->defineFunction("setSkin", _SE(js_cocos2dx_spine_Skeleton_setSkin)); + cls->defineFunction("findSlot", _SE(js_cocos2dx_spine_Skeleton_findSlot)); + cls->defineFunction("updateWorldTransform", _SE(js_cocos2dx_spine_Skeleton_updateWorldTransform)); + cls->defineFunction("findPathConstraint", _SE(js_cocos2dx_spine_Skeleton_findPathConstraint)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Skeleton_proto = cls->getProto(); + __jsb_spine_Skeleton_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_SkeletonBounds_proto = nullptr; +se::Class* __jsb_spine_SkeletonBounds_class = nullptr; + +static bool js_cocos2dx_spine_SkeletonBounds_getHeight(se::State& s) +{ + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonBounds_getHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_getHeight : 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_SkeletonBounds_getHeight) + +static bool js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment(se::State& s) +{ + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 4) { + float arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + ok &= seval_to_float(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment : Error processing arguments"); + bool result = cobj->aabbintersectsSegment(arg0, arg1, arg2, arg3); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment : Error processing arguments"); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment) + +static bool js_cocos2dx_spine_SkeletonBounds_getWidth(se::State& s) +{ + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonBounds_getWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_getWidth : 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_SkeletonBounds_getWidth) + +static bool js_cocos2dx_spine_SkeletonBounds_aabbcontainsPoint(se::State& s) +{ + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonBounds_aabbcontainsPoint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + float arg0 = 0; + float arg1 = 0; + ok &= seval_to_float(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_aabbcontainsPoint : Error processing arguments"); + bool result = cobj->aabbcontainsPoint(arg0, arg1); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_aabbcontainsPoint : 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_SkeletonBounds_aabbcontainsPoint) + +static bool js_cocos2dx_spine_SkeletonBounds_intersectsSegment(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonBounds_intersectsSegment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 5) { + spine::Polygon* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + float arg1 = 0; + ok &= seval_to_float(args[1], &arg1); + if (!ok) { ok = true; break; } + float arg2 = 0; + ok &= seval_to_float(args[2], &arg2); + if (!ok) { ok = true; break; } + float arg3 = 0; + ok &= seval_to_float(args[3], &arg3); + if (!ok) { ok = true; break; } + float arg4 = 0; + ok &= seval_to_float(args[4], &arg4); + if (!ok) { ok = true; break; } + bool result = cobj->intersectsSegment(arg0, arg1, arg2, arg3, arg4); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_intersectsSegment : Error processing arguments"); + return true; + } + } while(false); + + do { + if (argc == 4) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + if (!ok) { ok = true; break; } + float arg1 = 0; + ok &= seval_to_float(args[1], &arg1); + if (!ok) { ok = true; break; } + float arg2 = 0; + ok &= seval_to_float(args[2], &arg2); + if (!ok) { ok = true; break; } + float arg3 = 0; + ok &= seval_to_float(args[3], &arg3); + if (!ok) { ok = true; break; } + spine::BoundingBoxAttachment* result = cobj->intersectsSegment(arg0, arg1, arg2, arg3); + ok &= native_ptr_to_rooted_seval((spine::BoundingBoxAttachment*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_intersectsSegment : 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_SkeletonBounds_intersectsSegment) + +static bool js_cocos2dx_spine_SkeletonBounds_containsPoint(se::State& s) +{ + CC_UNUSED bool ok = true; + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonBounds_containsPoint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 2) { + float arg0 = 0; + ok &= seval_to_float(args[0], &arg0); + if (!ok) { ok = true; break; } + float arg1 = 0; + ok &= seval_to_float(args[1], &arg1); + if (!ok) { ok = true; break; } + spine::BoundingBoxAttachment* result = cobj->containsPoint(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::BoundingBoxAttachment*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_containsPoint : Error processing arguments"); + return true; + } + } while(false); + + do { + if (argc == 3) { + spine::Polygon* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + float arg1 = 0; + ok &= seval_to_float(args[1], &arg1); + if (!ok) { ok = true; break; } + float arg2 = 0; + ok &= seval_to_float(args[2], &arg2); + if (!ok) { ok = true; break; } + bool result = cobj->containsPoint(arg0, arg1, arg2); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_containsPoint : 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_SkeletonBounds_containsPoint) + +static bool js_cocos2dx_spine_SkeletonBounds_getPolygon(se::State& s) +{ + spine::SkeletonBounds* cobj = (spine::SkeletonBounds*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonBounds_getPolygon : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::BoundingBoxAttachment* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_getPolygon : Error processing arguments"); + spine::Polygon* result = cobj->getPolygon(arg0); + ok &= native_ptr_to_rooted_seval((spine::Polygon*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonBounds_getPolygon : 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_SkeletonBounds_getPolygon) + + + + +bool js_register_cocos2dx_spine_SkeletonBounds(se::Object* obj) +{ + auto cls = se::Class::create("SkeletonBounds", obj, nullptr, nullptr); + + cls->defineFunction("getHeight", _SE(js_cocos2dx_spine_SkeletonBounds_getHeight)); + cls->defineFunction("aabbintersectsSegment", _SE(js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment)); + cls->defineFunction("getWidth", _SE(js_cocos2dx_spine_SkeletonBounds_getWidth)); + cls->defineFunction("aabbcontainsPoint", _SE(js_cocos2dx_spine_SkeletonBounds_aabbcontainsPoint)); + cls->defineFunction("intersectsSegment", _SE(js_cocos2dx_spine_SkeletonBounds_intersectsSegment)); + cls->defineFunction("containsPoint", _SE(js_cocos2dx_spine_SkeletonBounds_containsPoint)); + cls->defineFunction("getPolygon", _SE(js_cocos2dx_spine_SkeletonBounds_getPolygon)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_SkeletonBounds_proto = cls->getProto(); + __jsb_spine_SkeletonBounds_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Polygon_proto = nullptr; +se::Class* __jsb_spine_Polygon_class = nullptr; + + + + +bool js_register_cocos2dx_spine_Polygon(se::Object* obj) +{ + auto cls = se::Class::create("Polygon", obj, nullptr, nullptr); + + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Polygon_proto = cls->getProto(); + __jsb_spine_Polygon_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_SkeletonData_proto = nullptr; +se::Class* __jsb_spine_SkeletonData_class = nullptr; + +static bool js_cocos2dx_spine_SkeletonData_findEvent(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findEvent : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findEvent : Error processing arguments"); + spine::EventData* result = cobj->findEvent(arg0); + ok &= native_ptr_to_rooted_seval((spine::EventData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findEvent : 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_SkeletonData_findEvent) + +static bool js_cocos2dx_spine_SkeletonData_findAnimation(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findAnimation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_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_SkeletonData_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_SkeletonData_findAnimation) + +static bool js_cocos2dx_spine_SkeletonData_getWidth(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getWidth : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWidth(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getWidth : 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_SkeletonData_getWidth) + +static bool js_cocos2dx_spine_SkeletonData_findTransformConstraint(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findTransformConstraint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findTransformConstraint : Error processing arguments"); + spine::TransformConstraintData* result = cobj->findTransformConstraint(arg0); + ok &= native_ptr_to_rooted_seval((spine::TransformConstraintData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findTransformConstraint : 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_SkeletonData_findTransformConstraint) + +static bool js_cocos2dx_spine_SkeletonData_setFps(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setFps : 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_SkeletonData_setFps : Error processing arguments"); + cobj->setFps(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_SkeletonData_setFps) + +static bool js_cocos2dx_spine_SkeletonData_findIkConstraint(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findIkConstraint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findIkConstraint : Error processing arguments"); + spine::IkConstraintData* result = cobj->findIkConstraint(arg0); + ok &= native_ptr_to_rooted_seval((spine::IkConstraintData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findIkConstraint : 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_SkeletonData_findIkConstraint) + +static bool js_cocos2dx_spine_SkeletonData_getFps(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getFps : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getFps(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getFps : 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_SkeletonData_getFps) + +static bool js_cocos2dx_spine_SkeletonData_getSkins(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getSkins : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getSkins(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getSkins : 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_SkeletonData_getSkins) + +static bool js_cocos2dx_spine_SkeletonData_setWidth(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setWidth : 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_SkeletonData_setWidth : Error processing arguments"); + cobj->setWidth(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_SkeletonData_setWidth) + +static bool js_cocos2dx_spine_SkeletonData_setVersion(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setVersion : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_setVersion : Error processing arguments"); + cobj->setVersion(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_SkeletonData_setVersion) + +static bool js_cocos2dx_spine_SkeletonData_setHash(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setHash : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_setHash : Error processing arguments"); + cobj->setHash(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_SkeletonData_setHash) + +static bool js_cocos2dx_spine_SkeletonData_findBoneIndex(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findBoneIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findBoneIndex : Error processing arguments"); + int result = cobj->findBoneIndex(arg0); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findBoneIndex : 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_SkeletonData_findBoneIndex) + +static bool js_cocos2dx_spine_SkeletonData_getDefaultSkin(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getDefaultSkin : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Skin* result = cobj->getDefaultSkin(); + ok &= native_ptr_to_rooted_seval((spine::Skin*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getDefaultSkin : 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_SkeletonData_getDefaultSkin) + +static bool js_cocos2dx_spine_SkeletonData_getHeight(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getHeight(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getHeight : 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_SkeletonData_getHeight) + +static bool js_cocos2dx_spine_SkeletonData_setDefaultSkin(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setDefaultSkin : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::Skin* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_setDefaultSkin : Error processing arguments"); + cobj->setDefaultSkin(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_SkeletonData_setDefaultSkin) + +static bool js_cocos2dx_spine_SkeletonData_getHash(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getHash : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getHash(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getHash : 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_SkeletonData_getHash) + +static bool js_cocos2dx_spine_SkeletonData_getAnimations(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getAnimations : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getAnimations(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getAnimations : 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_SkeletonData_getAnimations) + +static bool js_cocos2dx_spine_SkeletonData_setImagesPath(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setImagesPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_setImagesPath : Error processing arguments"); + cobj->setImagesPath(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_SkeletonData_setImagesPath) + +static bool js_cocos2dx_spine_SkeletonData_getIkConstraints(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getIkConstraints : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getIkConstraints(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getIkConstraints : 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_SkeletonData_getIkConstraints) + +static bool js_cocos2dx_spine_SkeletonData_getImagesPath(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getImagesPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getImagesPath(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getImagesPath : 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_SkeletonData_getImagesPath) + +static bool js_cocos2dx_spine_SkeletonData_getEvents(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getEvents : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getEvents(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getEvents : 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_SkeletonData_getEvents) + +static bool js_cocos2dx_spine_SkeletonData_findBone(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findBone : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findBone : Error processing arguments"); + spine::BoneData* result = cobj->findBone(arg0); + ok &= native_ptr_to_rooted_seval((spine::BoneData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_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_SkeletonData_findBone) + +static bool js_cocos2dx_spine_SkeletonData_setName(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_setName : Error processing arguments"); + cobj->setName(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_SkeletonData_setName) + +static bool js_cocos2dx_spine_SkeletonData_getPathConstraints(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getPathConstraints : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getPathConstraints(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getPathConstraints : 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_SkeletonData_getPathConstraints) + +static bool js_cocos2dx_spine_SkeletonData_getAudioPath(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getAudioPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getAudioPath(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getAudioPath : 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_SkeletonData_getAudioPath) + +static bool js_cocos2dx_spine_SkeletonData_getVersion(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getVersion : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getVersion(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getVersion : 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_SkeletonData_getVersion) + +static bool js_cocos2dx_spine_SkeletonData_setHeight(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setHeight : 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_SkeletonData_setHeight : Error processing arguments"); + cobj->setHeight(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_SkeletonData_setHeight) + +static bool js_cocos2dx_spine_SkeletonData_getSlots(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getSlots : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getSlots(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getSlots : 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_SkeletonData_getSlots) + +static bool js_cocos2dx_spine_SkeletonData_findSkin(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findSkin : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findSkin : Error processing arguments"); + spine::Skin* result = cobj->findSkin(arg0); + ok &= native_ptr_to_rooted_seval((spine::Skin*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findSkin : 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_SkeletonData_findSkin) + +static bool js_cocos2dx_spine_SkeletonData_getBones(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getBones : 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_SkeletonData_getBones) + +static bool js_cocos2dx_spine_SkeletonData_findPathConstraintIndex(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findPathConstraintIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findPathConstraintIndex : Error processing arguments"); + int result = cobj->findPathConstraintIndex(arg0); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findPathConstraintIndex : 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_SkeletonData_findPathConstraintIndex) + +static bool js_cocos2dx_spine_SkeletonData_findSlotIndex(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findSlotIndex : Error processing arguments"); + int result = cobj->findSlotIndex(arg0); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findSlotIndex : 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_SkeletonData_findSlotIndex) + +static bool js_cocos2dx_spine_SkeletonData_getTransformConstraints(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getTransformConstraints : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getTransformConstraints(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getTransformConstraints : 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_SkeletonData_getTransformConstraints) + +static bool js_cocos2dx_spine_SkeletonData_findSlot(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findSlot : Error processing arguments"); + spine::SlotData* result = cobj->findSlot(arg0); + ok &= native_ptr_to_rooted_seval((spine::SlotData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_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_SkeletonData_findSlot) + +static bool js_cocos2dx_spine_SkeletonData_setAudioPath(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_setAudioPath : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_setAudioPath : Error processing arguments"); + cobj->setAudioPath(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_SkeletonData_setAudioPath) + +static bool js_cocos2dx_spine_SkeletonData_findPathConstraint(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_findPathConstraint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findPathConstraint : Error processing arguments"); + spine::PathConstraintData* result = cobj->findPathConstraint(arg0); + ok &= native_ptr_to_rooted_seval((spine::PathConstraintData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_findPathConstraint : 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_SkeletonData_findPathConstraint) + +static bool js_cocos2dx_spine_SkeletonData_getName(se::State& s) +{ + spine::SkeletonData* cobj = (spine::SkeletonData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonData_getName : 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_SkeletonData_getName) + + + + +bool js_register_cocos2dx_spine_SkeletonData(se::Object* obj) +{ + auto cls = se::Class::create("SkeletonData", obj, nullptr, nullptr); + + cls->defineFunction("findEvent", _SE(js_cocos2dx_spine_SkeletonData_findEvent)); + cls->defineFunction("findAnimation", _SE(js_cocos2dx_spine_SkeletonData_findAnimation)); + cls->defineFunction("getWidth", _SE(js_cocos2dx_spine_SkeletonData_getWidth)); + cls->defineFunction("findTransformConstraint", _SE(js_cocos2dx_spine_SkeletonData_findTransformConstraint)); + cls->defineFunction("setFps", _SE(js_cocos2dx_spine_SkeletonData_setFps)); + cls->defineFunction("findIkConstraint", _SE(js_cocos2dx_spine_SkeletonData_findIkConstraint)); + cls->defineFunction("getFps", _SE(js_cocos2dx_spine_SkeletonData_getFps)); + cls->defineFunction("getSkins", _SE(js_cocos2dx_spine_SkeletonData_getSkins)); + cls->defineFunction("setWidth", _SE(js_cocos2dx_spine_SkeletonData_setWidth)); + cls->defineFunction("setVersion", _SE(js_cocos2dx_spine_SkeletonData_setVersion)); + cls->defineFunction("setHash", _SE(js_cocos2dx_spine_SkeletonData_setHash)); + cls->defineFunction("findBoneIndex", _SE(js_cocos2dx_spine_SkeletonData_findBoneIndex)); + cls->defineFunction("getDefaultSkin", _SE(js_cocos2dx_spine_SkeletonData_getDefaultSkin)); + cls->defineFunction("getHeight", _SE(js_cocos2dx_spine_SkeletonData_getHeight)); + cls->defineFunction("setDefaultSkin", _SE(js_cocos2dx_spine_SkeletonData_setDefaultSkin)); + cls->defineFunction("getHash", _SE(js_cocos2dx_spine_SkeletonData_getHash)); + cls->defineFunction("getAnimations", _SE(js_cocos2dx_spine_SkeletonData_getAnimations)); + cls->defineFunction("setImagesPath", _SE(js_cocos2dx_spine_SkeletonData_setImagesPath)); + cls->defineFunction("getIkConstraints", _SE(js_cocos2dx_spine_SkeletonData_getIkConstraints)); + cls->defineFunction("getImagesPath", _SE(js_cocos2dx_spine_SkeletonData_getImagesPath)); + cls->defineFunction("getEvents", _SE(js_cocos2dx_spine_SkeletonData_getEvents)); + cls->defineFunction("findBone", _SE(js_cocos2dx_spine_SkeletonData_findBone)); + cls->defineFunction("setName", _SE(js_cocos2dx_spine_SkeletonData_setName)); + cls->defineFunction("getPathConstraints", _SE(js_cocos2dx_spine_SkeletonData_getPathConstraints)); + cls->defineFunction("getAudioPath", _SE(js_cocos2dx_spine_SkeletonData_getAudioPath)); + cls->defineFunction("getVersion", _SE(js_cocos2dx_spine_SkeletonData_getVersion)); + cls->defineFunction("setHeight", _SE(js_cocos2dx_spine_SkeletonData_setHeight)); + cls->defineFunction("getSlots", _SE(js_cocos2dx_spine_SkeletonData_getSlots)); + cls->defineFunction("findSkin", _SE(js_cocos2dx_spine_SkeletonData_findSkin)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_SkeletonData_getBones)); + cls->defineFunction("findPathConstraintIndex", _SE(js_cocos2dx_spine_SkeletonData_findPathConstraintIndex)); + cls->defineFunction("findSlotIndex", _SE(js_cocos2dx_spine_SkeletonData_findSlotIndex)); + cls->defineFunction("getTransformConstraints", _SE(js_cocos2dx_spine_SkeletonData_getTransformConstraints)); + cls->defineFunction("findSlot", _SE(js_cocos2dx_spine_SkeletonData_findSlot)); + cls->defineFunction("setAudioPath", _SE(js_cocos2dx_spine_SkeletonData_setAudioPath)); + cls->defineFunction("findPathConstraint", _SE(js_cocos2dx_spine_SkeletonData_findPathConstraint)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_SkeletonData_getName)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_SkeletonData_proto = cls->getProto(); + __jsb_spine_SkeletonData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Skin_proto = nullptr; +se::Class* __jsb_spine_Skin_class = nullptr; + +static bool js_cocos2dx_spine_Skin_findNamesForSlot(se::State& s) +{ + spine::Skin* cobj = (spine::Skin*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skin_findNamesForSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + size_t arg0 = 0; + spine::Vector arg1; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_spine_Vector_String(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skin_findNamesForSlot : Error processing arguments"); + cobj->findNamesForSlot(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_Skin_findNamesForSlot) + +static bool js_cocos2dx_spine_Skin_addAttachment(se::State& s) +{ + spine::Skin* cobj = (spine::Skin*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skin_addAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + size_t arg0 = 0; + spine::String arg1; + spine::Attachment* arg2 = nullptr; + ok &= seval_to_size(args[0], &arg0); + arg1 = args[1].toStringForce().c_str(); + ok &= seval_to_native_ptr(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skin_addAttachment : Error processing arguments"); + cobj->addAttachment(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_Skin_addAttachment) + +static bool js_cocos2dx_spine_Skin_getName(se::State& s) +{ + spine::Skin* cobj = (spine::Skin*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skin_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skin_getName : 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_Skin_getName) + +static bool js_cocos2dx_spine_Skin_getAttachment(se::State& s) +{ + spine::Skin* cobj = (spine::Skin*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skin_getAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + size_t arg0 = 0; + spine::String arg1; + ok &= seval_to_size(args[0], &arg0); + arg1 = args[1].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skin_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_Skin_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_Skin_getAttachment) + +static bool js_cocos2dx_spine_Skin_findAttachmentsForSlot(se::State& s) +{ + spine::Skin* cobj = (spine::Skin*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Skin_findAttachmentsForSlot : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + size_t arg0 = 0; + spine::Vector arg1; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_spine_Vector_T_ptr(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Skin_findAttachmentsForSlot : Error processing arguments"); + cobj->findAttachmentsForSlot(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_Skin_findAttachmentsForSlot) + + + + +bool js_register_cocos2dx_spine_Skin(se::Object* obj) +{ + auto cls = se::Class::create("Skin", obj, nullptr, nullptr); + + cls->defineFunction("findNamesForSlot", _SE(js_cocos2dx_spine_Skin_findNamesForSlot)); + cls->defineFunction("addAttachment", _SE(js_cocos2dx_spine_Skin_addAttachment)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_Skin_getName)); + cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_Skin_getAttachment)); + cls->defineFunction("findAttachmentsForSlot", _SE(js_cocos2dx_spine_Skin_findAttachmentsForSlot)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Skin_proto = cls->getProto(); + __jsb_spine_Skin_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_Slot_proto = nullptr; +se::Class* __jsb_spine_Slot_class = nullptr; + +static bool js_cocos2dx_spine_Slot_getBone(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getBone : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Bone& result = cobj->getBone(); + ok &= native_ptr_to_rooted_seval((spine::Bone*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getBone : 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_Slot_getBone) + +static bool js_cocos2dx_spine_Slot_setAttachmentTime(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_setAttachmentTime : 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_Slot_setAttachmentTime : Error processing arguments"); + cobj->setAttachmentTime(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_Slot_setAttachmentTime) + +static bool js_cocos2dx_spine_Slot_getDarkColor(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getDarkColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getDarkColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getDarkColor : 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_Slot_getDarkColor) + +static bool js_cocos2dx_spine_Slot_getColor(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getColor : 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_Slot_getColor) + +static bool js_cocos2dx_spine_Slot_setToSetupPose(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_setToSetupPose : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->setToSetupPose(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_Slot_setToSetupPose) + +static bool js_cocos2dx_spine_Slot_getAttachment(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Attachment* result = cobj->getAttachment(); + ok &= native_ptr_to_rooted_seval((spine::Attachment*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getAttachment : 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_Slot_getAttachment) + +static bool js_cocos2dx_spine_Slot_getAttachmentTime(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getAttachmentTime : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAttachmentTime(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getAttachmentTime : 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_Slot_getAttachmentTime) + +static bool js_cocos2dx_spine_Slot_setAttachment(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_setAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::Attachment* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_setAttachment : Error processing arguments"); + cobj->setAttachment(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_Slot_setAttachment) + +static bool js_cocos2dx_spine_Slot_getAttachmentVertices(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getAttachmentVertices : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getAttachmentVertices(); + ok &= spine_Vector_T_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getAttachmentVertices : 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_Slot_getAttachmentVertices) + +static bool js_cocos2dx_spine_Slot_hasDarkColor(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_hasDarkColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->hasDarkColor(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_hasDarkColor : 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_Slot_hasDarkColor) + +static bool js_cocos2dx_spine_Slot_getSkeleton(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_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_Slot_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_Slot_getSkeleton) + +static bool js_cocos2dx_spine_Slot_getData(se::State& s) +{ + spine::Slot* cobj = (spine::Slot*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_Slot_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SlotData& result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::SlotData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_Slot_getData : 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_Slot_getData) + + + + +bool js_register_cocos2dx_spine_Slot(se::Object* obj) +{ + auto cls = se::Class::create("Slot", obj, nullptr, nullptr); + + cls->defineFunction("getBone", _SE(js_cocos2dx_spine_Slot_getBone)); + cls->defineFunction("setAttachmentTime", _SE(js_cocos2dx_spine_Slot_setAttachmentTime)); + cls->defineFunction("getDarkColor", _SE(js_cocos2dx_spine_Slot_getDarkColor)); + cls->defineFunction("getColor", _SE(js_cocos2dx_spine_Slot_getColor)); + cls->defineFunction("setToSetupPose", _SE(js_cocos2dx_spine_Slot_setToSetupPose)); + cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_Slot_getAttachment)); + cls->defineFunction("getAttachmentTime", _SE(js_cocos2dx_spine_Slot_getAttachmentTime)); + cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_Slot_setAttachment)); + cls->defineFunction("getAttachmentVertices", _SE(js_cocos2dx_spine_Slot_getAttachmentVertices)); + cls->defineFunction("hasDarkColor", _SE(js_cocos2dx_spine_Slot_hasDarkColor)); + cls->defineFunction("getSkeleton", _SE(js_cocos2dx_spine_Slot_getSkeleton)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_Slot_getData)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_Slot_proto = cls->getProto(); + __jsb_spine_Slot_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_SlotData_proto = nullptr; +se::Class* __jsb_spine_SlotData_class = nullptr; + +static bool js_cocos2dx_spine_SlotData_getIndex(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getIndex : 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_SlotData_getIndex) + +static bool js_cocos2dx_spine_SlotData_getDarkColor(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getDarkColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getDarkColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getDarkColor : 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_SlotData_getDarkColor) + +static bool js_cocos2dx_spine_SlotData_getAttachmentName(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getAttachmentName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getAttachmentName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getAttachmentName : 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_SlotData_getAttachmentName) + +static bool js_cocos2dx_spine_SlotData_getColor(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Color& result = cobj->getColor(); + ok &= native_ptr_to_rooted_seval((spine::Color*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getColor : 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_SlotData_getColor) + +static bool js_cocos2dx_spine_SlotData_getName(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getName : 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_SlotData_getName) + +static bool js_cocos2dx_spine_SlotData_setBlendMode(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_setBlendMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::BlendMode arg0; + ok &= seval_to_uint32(args[0], (uint32_t*)&arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_setBlendMode : Error processing arguments"); + cobj->setBlendMode(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_SlotData_setBlendMode) + +static bool js_cocos2dx_spine_SlotData_getBlendMode(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getBlendMode : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = (unsigned int)cobj->getBlendMode(); + ok &= uint32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getBlendMode : 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_SlotData_getBlendMode) + +static bool js_cocos2dx_spine_SlotData_hasDarkColor(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_hasDarkColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->hasDarkColor(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_hasDarkColor : 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_SlotData_hasDarkColor) + +static bool js_cocos2dx_spine_SlotData_setHasDarkColor(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_setHasDarkColor : 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_SlotData_setHasDarkColor : Error processing arguments"); + cobj->setHasDarkColor(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_SlotData_setHasDarkColor) + +static bool js_cocos2dx_spine_SlotData_setAttachmentName(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_setAttachmentName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::String arg0; + arg0 = args[0].toStringForce().c_str(); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_setAttachmentName : Error processing arguments"); + cobj->setAttachmentName(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_SlotData_setAttachmentName) + +static bool js_cocos2dx_spine_SlotData_getBoneData(se::State& s) +{ + spine::SlotData* cobj = (spine::SlotData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SlotData_getBoneData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::BoneData& result = cobj->getBoneData(); + ok &= native_ptr_to_rooted_seval((spine::BoneData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SlotData_getBoneData : 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_SlotData_getBoneData) + + + + +bool js_register_cocos2dx_spine_SlotData(se::Object* obj) +{ + auto cls = se::Class::create("SlotData", obj, nullptr, nullptr); + + cls->defineFunction("getIndex", _SE(js_cocos2dx_spine_SlotData_getIndex)); + cls->defineFunction("getDarkColor", _SE(js_cocos2dx_spine_SlotData_getDarkColor)); + cls->defineFunction("getAttachmentName", _SE(js_cocos2dx_spine_SlotData_getAttachmentName)); + cls->defineFunction("getColor", _SE(js_cocos2dx_spine_SlotData_getColor)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_SlotData_getName)); + cls->defineFunction("setBlendMode", _SE(js_cocos2dx_spine_SlotData_setBlendMode)); + cls->defineFunction("getBlendMode", _SE(js_cocos2dx_spine_SlotData_getBlendMode)); + cls->defineFunction("hasDarkColor", _SE(js_cocos2dx_spine_SlotData_hasDarkColor)); + cls->defineFunction("setHasDarkColor", _SE(js_cocos2dx_spine_SlotData_setHasDarkColor)); + cls->defineFunction("setAttachmentName", _SE(js_cocos2dx_spine_SlotData_setAttachmentName)); + cls->defineFunction("getBoneData", _SE(js_cocos2dx_spine_SlotData_getBoneData)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_SlotData_proto = cls->getProto(); + __jsb_spine_SlotData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_TransformConstraint_proto = nullptr; +se::Class* __jsb_spine_TransformConstraint_class = nullptr; + +static bool js_cocos2dx_spine_TransformConstraint_getScaleMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getScaleMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getScaleMix : 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_TransformConstraint_getScaleMix) + +static bool js_cocos2dx_spine_TransformConstraint_setRotateMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_setRotateMix : 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_TransformConstraint_setRotateMix : Error processing arguments"); + cobj->setRotateMix(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_TransformConstraint_setRotateMix) + +static bool js_cocos2dx_spine_TransformConstraint_getRotateMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getRotateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getRotateMix : 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_TransformConstraint_getRotateMix) + +static bool js_cocos2dx_spine_TransformConstraint_getBones(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getBones : 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_TransformConstraint_getBones) + +static bool js_cocos2dx_spine_TransformConstraint_setTarget(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_setTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::Bone* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_setTarget : Error processing arguments"); + cobj->setTarget(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_TransformConstraint_setTarget) + +static bool js_cocos2dx_spine_TransformConstraint_getTranslateMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getTranslateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTranslateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getTranslateMix : 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_TransformConstraint_getTranslateMix) + +static bool js_cocos2dx_spine_TransformConstraint_setShearMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_setShearMix : 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_TransformConstraint_setShearMix : Error processing arguments"); + cobj->setShearMix(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_TransformConstraint_setShearMix) + +static bool js_cocos2dx_spine_TransformConstraint_update(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_update : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->update(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_TransformConstraint_update) + +static bool js_cocos2dx_spine_TransformConstraint_getTarget(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Bone* result = cobj->getTarget(); + ok &= native_ptr_to_rooted_seval((spine::Bone*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getTarget : 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_TransformConstraint_getTarget) + +static bool js_cocos2dx_spine_TransformConstraint_setScaleMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_setScaleMix : 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_TransformConstraint_setScaleMix : Error processing arguments"); + cobj->setScaleMix(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_TransformConstraint_setScaleMix) + +static bool js_cocos2dx_spine_TransformConstraint_getOrder(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getOrder(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getOrder : 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_TransformConstraint_getOrder) + +static bool js_cocos2dx_spine_TransformConstraint_getShearMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getShearMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getShearMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getShearMix : 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_TransformConstraint_getShearMix) + +static bool js_cocos2dx_spine_TransformConstraint_apply(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_apply : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->apply(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_TransformConstraint_apply) + +static bool js_cocos2dx_spine_TransformConstraint_getData(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_getData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::TransformConstraintData& result = cobj->getData(); + ok &= native_ptr_to_rooted_seval((spine::TransformConstraintData*)&result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraint_getData : 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_TransformConstraint_getData) + +static bool js_cocos2dx_spine_TransformConstraint_setTranslateMix(se::State& s) +{ + spine::TransformConstraint* cobj = (spine::TransformConstraint*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraint_setTranslateMix : 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_TransformConstraint_setTranslateMix : Error processing arguments"); + cobj->setTranslateMix(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_TransformConstraint_setTranslateMix) + + + + +bool js_register_cocos2dx_spine_TransformConstraint(se::Object* obj) +{ + auto cls = se::Class::create("TransformConstraint", obj, nullptr, nullptr); + + cls->defineFunction("getScaleMix", _SE(js_cocos2dx_spine_TransformConstraint_getScaleMix)); + cls->defineFunction("setRotateMix", _SE(js_cocos2dx_spine_TransformConstraint_setRotateMix)); + cls->defineFunction("getRotateMix", _SE(js_cocos2dx_spine_TransformConstraint_getRotateMix)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_TransformConstraint_getBones)); + cls->defineFunction("setTarget", _SE(js_cocos2dx_spine_TransformConstraint_setTarget)); + cls->defineFunction("getTranslateMix", _SE(js_cocos2dx_spine_TransformConstraint_getTranslateMix)); + cls->defineFunction("setShearMix", _SE(js_cocos2dx_spine_TransformConstraint_setShearMix)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_TransformConstraint_update)); + cls->defineFunction("getTarget", _SE(js_cocos2dx_spine_TransformConstraint_getTarget)); + cls->defineFunction("setScaleMix", _SE(js_cocos2dx_spine_TransformConstraint_setScaleMix)); + cls->defineFunction("getOrder", _SE(js_cocos2dx_spine_TransformConstraint_getOrder)); + cls->defineFunction("getShearMix", _SE(js_cocos2dx_spine_TransformConstraint_getShearMix)); + cls->defineFunction("apply", _SE(js_cocos2dx_spine_TransformConstraint_apply)); + cls->defineFunction("getData", _SE(js_cocos2dx_spine_TransformConstraint_getData)); + cls->defineFunction("setTranslateMix", _SE(js_cocos2dx_spine_TransformConstraint_setTranslateMix)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_TransformConstraint_proto = cls->getProto(); + __jsb_spine_TransformConstraint_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_TransformConstraintData_proto = nullptr; +se::Class* __jsb_spine_TransformConstraintData_class = nullptr; + +static bool js_cocos2dx_spine_TransformConstraintData_getOffsetRotation(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetRotation : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetRotation(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetRotation : 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_TransformConstraintData_getOffsetRotation) + +static bool js_cocos2dx_spine_TransformConstraintData_getRotateMix(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getRotateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRotateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getRotateMix : 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_TransformConstraintData_getRotateMix) + +static bool js_cocos2dx_spine_TransformConstraintData_isLocal(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_isLocal : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isLocal(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_isLocal : 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_TransformConstraintData_isLocal) + +static bool js_cocos2dx_spine_TransformConstraintData_getBones(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getBones : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::Vector& result = cobj->getBones(); + ok &= spine_Vector_T_ptr_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getBones : 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_TransformConstraintData_getBones) + +static bool js_cocos2dx_spine_TransformConstraintData_getName(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const spine::String& result = cobj->getName(); + s.rval().setString(result.buffer()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getName : 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_TransformConstraintData_getName) + +static bool js_cocos2dx_spine_TransformConstraintData_getTranslateMix(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getTranslateMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getTranslateMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getTranslateMix : 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_TransformConstraintData_getTranslateMix) + +static bool js_cocos2dx_spine_TransformConstraintData_getTarget(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getTarget : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::BoneData* result = cobj->getTarget(); + ok &= native_ptr_to_rooted_seval((spine::BoneData*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getTarget : 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_TransformConstraintData_getTarget) + +static bool js_cocos2dx_spine_TransformConstraintData_getOffsetScaleX(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetScaleX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetScaleX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetScaleX : 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_TransformConstraintData_getOffsetScaleX) + +static bool js_cocos2dx_spine_TransformConstraintData_getOffsetScaleY(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetScaleY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetScaleY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetScaleY : 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_TransformConstraintData_getOffsetScaleY) + +static bool js_cocos2dx_spine_TransformConstraintData_getOffsetShearY(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetShearY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetShearY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetShearY : 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_TransformConstraintData_getOffsetShearY) + +static bool js_cocos2dx_spine_TransformConstraintData_getOrder(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOrder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getOrder(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOrder : 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_TransformConstraintData_getOrder) + +static bool js_cocos2dx_spine_TransformConstraintData_getOffsetX(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetX : 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_TransformConstraintData_getOffsetX) + +static bool js_cocos2dx_spine_TransformConstraintData_getShearMix(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getShearMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getShearMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getShearMix : 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_TransformConstraintData_getShearMix) + +static bool js_cocos2dx_spine_TransformConstraintData_getOffsetY(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getOffsetY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getOffsetY : 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_TransformConstraintData_getOffsetY) + +static bool js_cocos2dx_spine_TransformConstraintData_getScaleMix(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_getScaleMix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getScaleMix(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_getScaleMix : 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_TransformConstraintData_getScaleMix) + +static bool js_cocos2dx_spine_TransformConstraintData_isRelative(se::State& s) +{ + spine::TransformConstraintData* cobj = (spine::TransformConstraintData*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintData_isRelative : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isRelative(); + ok &= boolean_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintData_isRelative : 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_TransformConstraintData_isRelative) + + + + +bool js_register_cocos2dx_spine_TransformConstraintData(se::Object* obj) +{ + auto cls = se::Class::create("TransformConstraintData", obj, nullptr, nullptr); + + cls->defineFunction("getOffsetRotation", _SE(js_cocos2dx_spine_TransformConstraintData_getOffsetRotation)); + cls->defineFunction("getRotateMix", _SE(js_cocos2dx_spine_TransformConstraintData_getRotateMix)); + cls->defineFunction("isLocal", _SE(js_cocos2dx_spine_TransformConstraintData_isLocal)); + cls->defineFunction("getBones", _SE(js_cocos2dx_spine_TransformConstraintData_getBones)); + cls->defineFunction("getName", _SE(js_cocos2dx_spine_TransformConstraintData_getName)); + cls->defineFunction("getTranslateMix", _SE(js_cocos2dx_spine_TransformConstraintData_getTranslateMix)); + cls->defineFunction("getTarget", _SE(js_cocos2dx_spine_TransformConstraintData_getTarget)); + cls->defineFunction("getOffsetScaleX", _SE(js_cocos2dx_spine_TransformConstraintData_getOffsetScaleX)); + cls->defineFunction("getOffsetScaleY", _SE(js_cocos2dx_spine_TransformConstraintData_getOffsetScaleY)); + cls->defineFunction("getOffsetShearY", _SE(js_cocos2dx_spine_TransformConstraintData_getOffsetShearY)); + cls->defineFunction("getOrder", _SE(js_cocos2dx_spine_TransformConstraintData_getOrder)); + cls->defineFunction("getOffsetX", _SE(js_cocos2dx_spine_TransformConstraintData_getOffsetX)); + cls->defineFunction("getShearMix", _SE(js_cocos2dx_spine_TransformConstraintData_getShearMix)); + cls->defineFunction("getOffsetY", _SE(js_cocos2dx_spine_TransformConstraintData_getOffsetY)); + cls->defineFunction("getScaleMix", _SE(js_cocos2dx_spine_TransformConstraintData_getScaleMix)); + cls->defineFunction("isRelative", _SE(js_cocos2dx_spine_TransformConstraintData_isRelative)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_TransformConstraintData_proto = cls->getProto(); + __jsb_spine_TransformConstraintData_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_TransformConstraintTimeline_proto = nullptr; +se::Class* __jsb_spine_TransformConstraintTimeline_class = nullptr; + +static bool js_cocos2dx_spine_TransformConstraintTimeline_getPropertyId(se::State& s) +{ + spine::TransformConstraintTimeline* cobj = (spine::TransformConstraintTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintTimeline_getPropertyId : 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_TransformConstraintTimeline_getPropertyId) + +static bool js_cocos2dx_spine_TransformConstraintTimeline_setFrame(se::State& s) +{ + spine::TransformConstraintTimeline* cobj = (spine::TransformConstraintTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TransformConstraintTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + size_t arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + float arg4 = 0; + float arg5 = 0; + ok &= seval_to_size(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + ok &= seval_to_float(args[4], &arg4); + ok &= seval_to_float(args[5], &arg5); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TransformConstraintTimeline_setFrame : Error processing arguments"); + cobj->setFrame(arg0, arg1, arg2, arg3, arg4, arg5); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_TransformConstraintTimeline_setFrame) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_TransformConstraintTimeline(se::Object* obj) +{ + auto cls = se::Class::create("TransformConstraintTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_TransformConstraintTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_TransformConstraintTimeline_setFrame)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_TransformConstraintTimeline_proto = cls->getProto(); + __jsb_spine_TransformConstraintTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_TwoColorTimeline_proto = nullptr; +se::Class* __jsb_spine_TwoColorTimeline_class = nullptr; + +static bool js_cocos2dx_spine_TwoColorTimeline_setSlotIndex(se::State& s) +{ + spine::TwoColorTimeline* cobj = (spine::TwoColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TwoColorTimeline_setSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + int arg0 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TwoColorTimeline_setSlotIndex : Error processing arguments"); + cobj->setSlotIndex(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_TwoColorTimeline_setSlotIndex) + +static bool js_cocos2dx_spine_TwoColorTimeline_getPropertyId(se::State& s) +{ + spine::TwoColorTimeline* cobj = (spine::TwoColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TwoColorTimeline_getPropertyId : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getPropertyId(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TwoColorTimeline_getPropertyId : 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_TwoColorTimeline_getPropertyId) + +static bool js_cocos2dx_spine_TwoColorTimeline_setFrame(se::State& s) +{ + spine::TwoColorTimeline* cobj = (spine::TwoColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TwoColorTimeline_setFrame : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 9) { + int arg0 = 0; + float arg1 = 0; + float arg2 = 0; + float arg3 = 0; + float arg4 = 0; + float arg5 = 0; + float arg6 = 0; + float arg7 = 0; + float arg8 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); + ok &= seval_to_float(args[1], &arg1); + ok &= seval_to_float(args[2], &arg2); + ok &= seval_to_float(args[3], &arg3); + ok &= seval_to_float(args[4], &arg4); + ok &= seval_to_float(args[5], &arg5); + ok &= seval_to_float(args[6], &arg6); + ok &= seval_to_float(args[7], &arg7); + ok &= seval_to_float(args[8], &arg8); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TwoColorTimeline_setFrame : Error processing arguments"); + cobj->setFrame(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 9); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_TwoColorTimeline_setFrame) + +static bool js_cocos2dx_spine_TwoColorTimeline_getSlotIndex(se::State& s) +{ + spine::TwoColorTimeline* cobj = (spine::TwoColorTimeline*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_TwoColorTimeline_getSlotIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = cobj->getSlotIndex(); + ok &= int32_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_TwoColorTimeline_getSlotIndex : 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_TwoColorTimeline_getSlotIndex) + + +extern se::Object* __jsb_spine_CurveTimeline_proto; + + +bool js_register_cocos2dx_spine_TwoColorTimeline(se::Object* obj) +{ + auto cls = se::Class::create("TwoColorTimeline", obj, __jsb_spine_CurveTimeline_proto, nullptr); + + cls->defineFunction("setSlotIndex", _SE(js_cocos2dx_spine_TwoColorTimeline_setSlotIndex)); + cls->defineFunction("getPropertyId", _SE(js_cocos2dx_spine_TwoColorTimeline_getPropertyId)); + cls->defineFunction("setFrame", _SE(js_cocos2dx_spine_TwoColorTimeline_setFrame)); + cls->defineFunction("getSlotIndex", _SE(js_cocos2dx_spine_TwoColorTimeline_getSlotIndex)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_TwoColorTimeline_proto = cls->getProto(); + __jsb_spine_TwoColorTimeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_VertexEffect_proto = nullptr; +se::Class* __jsb_spine_VertexEffect_class = nullptr; + + + + +bool js_register_cocos2dx_spine_VertexEffect(se::Object* obj) +{ + auto cls = se::Class::create("VertexEffect", obj, nullptr, nullptr); + + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_VertexEffect_proto = cls->getProto(); + __jsb_spine_VertexEffect_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_JitterVertexEffect_proto = nullptr; +se::Class* __jsb_spine_JitterVertexEffect_class = nullptr; + +static bool js_cocos2dx_spine_JitterVertexEffect_setJitterX(se::State& s) +{ + spine::JitterVertexEffect* cobj = (spine::JitterVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_JitterVertexEffect_setJitterX : 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_JitterVertexEffect_setJitterX : Error processing arguments"); + cobj->setJitterX(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_JitterVertexEffect_setJitterX) + +static bool js_cocos2dx_spine_JitterVertexEffect_setJitterY(se::State& s) +{ + spine::JitterVertexEffect* cobj = (spine::JitterVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_JitterVertexEffect_setJitterY : 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_JitterVertexEffect_setJitterY : Error processing arguments"); + cobj->setJitterY(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_JitterVertexEffect_setJitterY) + +static bool js_cocos2dx_spine_JitterVertexEffect_getJitterX(se::State& s) +{ + spine::JitterVertexEffect* cobj = (spine::JitterVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_JitterVertexEffect_getJitterX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getJitterX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_JitterVertexEffect_getJitterX : 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_JitterVertexEffect_getJitterX) + +static bool js_cocos2dx_spine_JitterVertexEffect_getJitterY(se::State& s) +{ + spine::JitterVertexEffect* cobj = (spine::JitterVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_JitterVertexEffect_getJitterY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getJitterY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_JitterVertexEffect_getJitterY : 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_JitterVertexEffect_getJitterY) + + +extern se::Object* __jsb_spine_VertexEffect_proto; + + +bool js_register_cocos2dx_spine_JitterVertexEffect(se::Object* obj) +{ + auto cls = se::Class::create("JitterVertexEffect", obj, __jsb_spine_VertexEffect_proto, nullptr); + + cls->defineFunction("setJitterX", _SE(js_cocos2dx_spine_JitterVertexEffect_setJitterX)); + cls->defineFunction("setJitterY", _SE(js_cocos2dx_spine_JitterVertexEffect_setJitterY)); + cls->defineFunction("getJitterX", _SE(js_cocos2dx_spine_JitterVertexEffect_getJitterX)); + cls->defineFunction("getJitterY", _SE(js_cocos2dx_spine_JitterVertexEffect_getJitterY)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_JitterVertexEffect_proto = cls->getProto(); + __jsb_spine_JitterVertexEffect_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_SwirlVertexEffect_proto = nullptr; +se::Class* __jsb_spine_SwirlVertexEffect_class = nullptr; + +static bool js_cocos2dx_spine_SwirlVertexEffect_setRadius(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_setRadius : 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_SwirlVertexEffect_setRadius : Error processing arguments"); + cobj->setRadius(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_SwirlVertexEffect_setRadius) + +static bool js_cocos2dx_spine_SwirlVertexEffect_getAngle(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_getAngle : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getAngle(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SwirlVertexEffect_getAngle : 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_SwirlVertexEffect_getAngle) + +static bool js_cocos2dx_spine_SwirlVertexEffect_getCenterY(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_getCenterY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getCenterY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SwirlVertexEffect_getCenterY : 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_SwirlVertexEffect_getCenterY) + +static bool js_cocos2dx_spine_SwirlVertexEffect_getCenterX(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_getCenterX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getCenterX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SwirlVertexEffect_getCenterX : 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_SwirlVertexEffect_getCenterX) + +static bool js_cocos2dx_spine_SwirlVertexEffect_setAngle(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_setAngle : 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_SwirlVertexEffect_setAngle : Error processing arguments"); + cobj->setAngle(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_SwirlVertexEffect_setAngle) + +static bool js_cocos2dx_spine_SwirlVertexEffect_setWorldX(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_setWorldX : 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_SwirlVertexEffect_setWorldX : Error processing arguments"); + cobj->setWorldX(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_SwirlVertexEffect_setWorldX) + +static bool js_cocos2dx_spine_SwirlVertexEffect_setWorldY(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_setWorldY : 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_SwirlVertexEffect_setWorldY : Error processing arguments"); + cobj->setWorldY(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_SwirlVertexEffect_setWorldY) + +static bool js_cocos2dx_spine_SwirlVertexEffect_getWorldY(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_getWorldY : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldY(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SwirlVertexEffect_getWorldY : 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_SwirlVertexEffect_getWorldY) + +static bool js_cocos2dx_spine_SwirlVertexEffect_getWorldX(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_getWorldX : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getWorldX(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SwirlVertexEffect_getWorldX : 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_SwirlVertexEffect_getWorldX) + +static bool js_cocos2dx_spine_SwirlVertexEffect_setCenterY(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_setCenterY : 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_SwirlVertexEffect_setCenterY : Error processing arguments"); + cobj->setCenterY(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_SwirlVertexEffect_setCenterY) + +static bool js_cocos2dx_spine_SwirlVertexEffect_setCenterX(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_setCenterX : 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_SwirlVertexEffect_setCenterX : Error processing arguments"); + cobj->setCenterX(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_SwirlVertexEffect_setCenterX) + +static bool js_cocos2dx_spine_SwirlVertexEffect_getRadius(se::State& s) +{ + spine::SwirlVertexEffect* cobj = (spine::SwirlVertexEffect*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SwirlVertexEffect_getRadius : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getRadius(); + ok &= float_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SwirlVertexEffect_getRadius : 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_SwirlVertexEffect_getRadius) + + +extern se::Object* __jsb_spine_VertexEffect_proto; + + +bool js_register_cocos2dx_spine_SwirlVertexEffect(se::Object* obj) +{ + auto cls = se::Class::create("SwirlVertexEffect", obj, __jsb_spine_VertexEffect_proto, nullptr); + + cls->defineFunction("setRadius", _SE(js_cocos2dx_spine_SwirlVertexEffect_setRadius)); + cls->defineFunction("getAngle", _SE(js_cocos2dx_spine_SwirlVertexEffect_getAngle)); + cls->defineFunction("getCenterY", _SE(js_cocos2dx_spine_SwirlVertexEffect_getCenterY)); + cls->defineFunction("getCenterX", _SE(js_cocos2dx_spine_SwirlVertexEffect_getCenterX)); + cls->defineFunction("setAngle", _SE(js_cocos2dx_spine_SwirlVertexEffect_setAngle)); + cls->defineFunction("setWorldX", _SE(js_cocos2dx_spine_SwirlVertexEffect_setWorldX)); + cls->defineFunction("setWorldY", _SE(js_cocos2dx_spine_SwirlVertexEffect_setWorldY)); + cls->defineFunction("getWorldY", _SE(js_cocos2dx_spine_SwirlVertexEffect_getWorldY)); + cls->defineFunction("getWorldX", _SE(js_cocos2dx_spine_SwirlVertexEffect_getWorldX)); + cls->defineFunction("setCenterY", _SE(js_cocos2dx_spine_SwirlVertexEffect_setCenterY)); + cls->defineFunction("setCenterX", _SE(js_cocos2dx_spine_SwirlVertexEffect_setCenterX)); + cls->defineFunction("getRadius", _SE(js_cocos2dx_spine_SwirlVertexEffect_getRadius)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_SwirlVertexEffect_proto = cls->getProto(); + __jsb_spine_SwirlVertexEffect_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_VertexEffectDelegate_proto = nullptr; +se::Class* __jsb_spine_VertexEffectDelegate_class = nullptr; + +static bool js_cocos2dx_spine_VertexEffectDelegate_getEffectType(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_getEffectType : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::string& result = cobj->getEffectType(); + ok &= std_string_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_getEffectType : 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_VertexEffectDelegate_getEffectType) + +static bool js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPowOut(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPowOut : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + float arg0 = 0; + int arg1 = 0; + ok &= seval_to_float(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_spine_VertexEffectDelegate_initSwirlWithPowOut : Error processing arguments"); + spine::SwirlVertexEffect* result = cobj->initSwirlWithPowOut(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::SwirlVertexEffect*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPowOut : 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_VertexEffectDelegate_initSwirlWithPowOut) + +static bool js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPow(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPow : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + float arg0 = 0; + int arg1 = 0; + ok &= seval_to_float(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_spine_VertexEffectDelegate_initSwirlWithPow : Error processing arguments"); + spine::SwirlVertexEffect* result = cobj->initSwirlWithPow(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::SwirlVertexEffect*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPow : 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_VertexEffectDelegate_initSwirlWithPow) + +static bool js_cocos2dx_spine_VertexEffectDelegate_initJitter(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_initJitter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + float arg0 = 0; + float arg1 = 0; + ok &= seval_to_float(args[0], &arg0); + ok &= seval_to_float(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_initJitter : Error processing arguments"); + spine::JitterVertexEffect* result = cobj->initJitter(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::JitterVertexEffect*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_initJitter : 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_VertexEffectDelegate_initJitter) + +static bool js_cocos2dx_spine_VertexEffectDelegate_getSwirlVertexEffect(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_getSwirlVertexEffect : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::SwirlVertexEffect* result = cobj->getSwirlVertexEffect(); + ok &= native_ptr_to_rooted_seval((spine::SwirlVertexEffect*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_getSwirlVertexEffect : 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_VertexEffectDelegate_getSwirlVertexEffect) + +static bool js_cocos2dx_spine_VertexEffectDelegate_getVertexEffect(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_getVertexEffect : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::VertexEffect* result = cobj->getVertexEffect(); + ok &= native_ptr_to_rooted_seval((spine::VertexEffect*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_getVertexEffect : 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_VertexEffectDelegate_getVertexEffect) + +static bool js_cocos2dx_spine_VertexEffectDelegate_getJitterVertexEffect(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_getJitterVertexEffect : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + spine::JitterVertexEffect* result = cobj->getJitterVertexEffect(); + ok &= native_ptr_to_rooted_seval((spine::JitterVertexEffect*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_VertexEffectDelegate_getJitterVertexEffect : 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_VertexEffectDelegate_getJitterVertexEffect) + +static bool js_cocos2dx_spine_VertexEffectDelegate_clear(se::State& s) +{ + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_VertexEffectDelegate_clear : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->clear(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_cocos2dx_spine_VertexEffectDelegate_clear) + +SE_DECLARE_FINALIZE_FUNC(js_spine_VertexEffectDelegate_finalize) + +static bool js_cocos2dx_spine_VertexEffectDelegate_constructor(se::State& s) +{ + spine::VertexEffectDelegate* cobj = new (std::nothrow) spine::VertexEffectDelegate(); + s.thisObject()->setPrivateData(cobj); + return true; +} +SE_BIND_CTOR(js_cocos2dx_spine_VertexEffectDelegate_constructor, __jsb_spine_VertexEffectDelegate_class, js_spine_VertexEffectDelegate_finalize) + + + + +static bool js_spine_VertexEffectDelegate_finalize(se::State& s) +{ + CCLOGINFO("jsbindings: finalizing JS object %p (spine::VertexEffectDelegate)", s.nativeThisObject()); + spine::VertexEffectDelegate* cobj = (spine::VertexEffectDelegate*)s.nativeThisObject(); + cobj->release(); + return true; +} +SE_BIND_FINALIZE_FUNC(js_spine_VertexEffectDelegate_finalize) + +bool js_register_cocos2dx_spine_VertexEffectDelegate(se::Object* obj) +{ + auto cls = se::Class::create("VertexEffectDelegate", obj, nullptr, _SE(js_cocos2dx_spine_VertexEffectDelegate_constructor)); + + cls->defineFunction("getEffectType", _SE(js_cocos2dx_spine_VertexEffectDelegate_getEffectType)); + cls->defineFunction("initSwirlWithPowOut", _SE(js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPowOut)); + cls->defineFunction("initSwirlWithPow", _SE(js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPow)); + cls->defineFunction("initJitter", _SE(js_cocos2dx_spine_VertexEffectDelegate_initJitter)); + cls->defineFunction("getSwirlVertexEffect", _SE(js_cocos2dx_spine_VertexEffectDelegate_getSwirlVertexEffect)); + cls->defineFunction("getVertexEffect", _SE(js_cocos2dx_spine_VertexEffectDelegate_getVertexEffect)); + cls->defineFunction("getJitterVertexEffect", _SE(js_cocos2dx_spine_VertexEffectDelegate_getJitterVertexEffect)); + cls->defineFunction("clear", _SE(js_cocos2dx_spine_VertexEffectDelegate_clear)); + cls->defineFinalizeFunction(_SE(js_spine_VertexEffectDelegate_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_spine_VertexEffectDelegate_proto = cls->getProto(); + __jsb_spine_VertexEffectDelegate_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} + +se::Object* __jsb_spine_SkeletonRenderer_proto = nullptr; +se::Class* __jsb_spine_SkeletonRenderer_class = nullptr; + +static bool js_cocos2dx_spine_SkeletonRenderer_setUseTint(se::State& s) +{ + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setUseTint : 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_SpineRenderer_setUseTint : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setUseTint : Error processing arguments"); cobj->setUseTint(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_SpineRenderer_setUseTint) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setUseTint) -static bool js_cocos2dx_spine_SpineRenderer_setTimeScale(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setTimeScale(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setTimeScale : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_setTimeScale : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_setTimeScale) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setTimeScale) + +static bool js_cocos2dx_spine_SkeletonRenderer_initWithUUID(se::State& s) +{ + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_initWithUUID : 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_SkeletonRenderer_initWithUUID : Error processing arguments"); + cobj->initWithUUID(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_SkeletonRenderer_initWithUUID) -static bool js_cocos2dx_spine_SpineRenderer_paused(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_paused : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_paused : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SkeletonRenderer_setOpacityModifyRGB) + +static bool js_cocos2dx_spine_SkeletonRenderer_paused(se::State& s) +{ + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SkeletonRenderer_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_SpineRenderer_paused) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_paused) -static bool js_cocos2dx_spine_SpineRenderer_setAttachment(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(se::State& s) { CC_UNUSED bool ok = true; - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SpineRenderer_setAttachment : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); do { @@ -81,7 +12310,7 @@ static bool js_cocos2dx_spine_SpineRenderer_setAttachment(se::State& s) 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_SpineRenderer_setAttachment : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : Error processing arguments"); return true; } } while(false); @@ -96,7 +12325,7 @@ static bool js_cocos2dx_spine_SpineRenderer_setAttachment(se::State& s) 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_SpineRenderer_setAttachment : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : Error processing arguments"); return true; } } while(false); @@ -104,12 +12333,12 @@ static bool js_cocos2dx_spine_SpineRenderer_setAttachment(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_setAttachment) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setAttachment) -static bool js_cocos2dx_spine_SpineRenderer_setBonesToSetupPose(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setBonesToSetupPose : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -119,45 +12348,45 @@ static bool js_cocos2dx_spine_SpineRenderer_setBonesToSetupPose(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_setBonesToSetupPose) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose) -static bool js_cocos2dx_spine_SpineRenderer_setSlotsToSetupPose(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_onEnable(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setSlotsToSetupPose : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_onEnable : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { - cobj->setSlotsToSetupPose(); + 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_SpineRenderer_setSlotsToSetupPose) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_onEnable) -static bool js_cocos2dx_spine_SpineRenderer_getRenderInfoOffset(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_getRenderInfoOffset(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_getRenderInfoOffset : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_getRenderInfoOffset : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { se_object_ptr result = cobj->getRenderInfoOffset(); s.rval().setObject(result); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_getRenderInfoOffset : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_getRenderInfoOffset : 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_SpineRenderer_getRenderInfoOffset) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_getRenderInfoOffset) -static bool js_cocos2dx_spine_SpineRenderer_stopSchedule(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_stopSchedule(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_stopSchedule : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_stopSchedule : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -167,50 +12396,50 @@ static bool js_cocos2dx_spine_SpineRenderer_stopSchedule(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_stopSchedule) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_stopSchedule) -static bool js_cocos2dx_spine_SpineRenderer_isOpacityModifyRGB(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_isOpacityModifyRGB : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_isOpacityModifyRGB : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_isOpacityModifyRGB) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB) -static bool js_cocos2dx_spine_SpineRenderer_setDebugSlotsEnabled(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setDebugSlotsEnabled : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled : 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_SpineRenderer_setDebugSlotsEnabled : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled : Error processing arguments"); cobj->setDebugSlotsEnabled(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_SpineRenderer_setDebugSlotsEnabled) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled) -static bool js_cocos2dx_spine_SpineRenderer_initWithJsonFile(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_initWithJsonFile(se::State& s) { CC_UNUSED bool ok = true; - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SpineRenderer_initWithJsonFile : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonRenderer_initWithJsonFile : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); do { @@ -247,9 +12476,8 @@ static bool js_cocos2dx_spine_SpineRenderer_initWithJsonFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } cobj->initWithJsonFile(arg0, arg1); return true; @@ -261,9 +12489,8 @@ static bool js_cocos2dx_spine_SpineRenderer_initWithJsonFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } float arg2 = 0; ok &= seval_to_float(args[2], &arg2); @@ -276,12 +12503,12 @@ static bool js_cocos2dx_spine_SpineRenderer_initWithJsonFile(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_initWithJsonFile) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithJsonFile) -static bool js_cocos2dx_spine_SpineRenderer_setToSetupPose(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setToSetupPose(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setToSetupPose : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setToSetupPose : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -291,32 +12518,28 @@ static bool js_cocos2dx_spine_SpineRenderer_setToSetupPose(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_setToSetupPose) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setToSetupPose) -static bool js_cocos2dx_spine_SpineRenderer_setOpacityModifyRGB(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setOpacityModifyRGB : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose : 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_SpineRenderer_setOpacityModifyRGB : Error processing arguments"); - cobj->setOpacityModifyRGB(arg0); + if (argc == 0) { + cobj->setSlotsToSetupPose(); return true; } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_setOpacityModifyRGB) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose) -static bool js_cocos2dx_spine_SpineRenderer_initWithBinaryFile(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_initWithBinaryFile(se::State& s) { CC_UNUSED bool ok = true; - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SpineRenderer_initWithBinaryFile : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonRenderer_initWithBinaryFile : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); do { @@ -353,9 +12576,8 @@ static bool js_cocos2dx_spine_SpineRenderer_initWithBinaryFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } cobj->initWithBinaryFile(arg0, arg1); return true; @@ -367,9 +12589,8 @@ static bool js_cocos2dx_spine_SpineRenderer_initWithBinaryFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } float arg2 = 0; ok &= seval_to_float(args[2], &arg2); @@ -382,121 +12603,140 @@ static bool js_cocos2dx_spine_SpineRenderer_initWithBinaryFile(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_initWithBinaryFile) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithBinaryFile) -static bool js_cocos2dx_spine_SpineRenderer_onEnable(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_onEnable : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); - if (argc == 0) { - cobj->onEnable(); + CC_UNUSED bool ok = true; + if (argc == 1) { + spine::Skeleton* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton : Error processing arguments"); + cobj->initWithSkeleton(arg0); return true; } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + if (argc == 2) { + spine::Skeleton* arg0 = nullptr; + bool arg1; + ok &= seval_to_native_ptr(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton : Error processing arguments"); + cobj->initWithSkeleton(arg0, arg1); + return true; + } + if (argc == 3) { + spine::Skeleton* arg0 = nullptr; + bool arg1; + bool arg2; + ok &= seval_to_native_ptr(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + ok &= seval_to_boolean(args[2], &arg2); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton : Error processing arguments"); + cobj->initWithSkeleton(arg0, arg1, arg2); + return true; + } + if (argc == 4) { + spine::Skeleton* arg0 = nullptr; + bool arg1; + bool arg2; + bool arg3; + ok &= seval_to_native_ptr(args[0], &arg0); + ok &= seval_to_boolean(args[1], &arg1); + ok &= seval_to_boolean(args[2], &arg2); + ok &= seval_to_boolean(args[3], &arg3); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton : Error processing arguments"); + cobj->initWithSkeleton(arg0, arg1, arg2, arg3); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_onEnable) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton) -static bool js_cocos2dx_spine_SpineRenderer_beginSchedule(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_getBoundingBox(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_beginSchedule : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_getBoundingBox : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc == 0) { - cobj->beginSchedule(); + cocos2d::Rect result = cobj->getBoundingBox(); + ok &= Rect_to_seval(result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_getBoundingBox : 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_SpineRenderer_beginSchedule) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_getBoundingBox) -static bool js_cocos2dx_spine_SpineRenderer_getDebugData(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_getDebugData(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_getDebugData : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_getDebugData : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { se_object_ptr result = cobj->getDebugData(); s.rval().setObject(result); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_getDebugData : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_getDebugData : 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_SpineRenderer_getDebugData) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_getDebugData) -static bool js_cocos2dx_spine_SpineRenderer_initWithSkeleton(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_findBone(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_initWithSkeleton : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_findBone : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - spSkeleton* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeleton* - ok = false; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_initWithSkeleton : Error processing arguments"); - cobj->initWithSkeleton(arg0); - return true; - } - if (argc == 2) { - spSkeleton* arg0 = nullptr; - bool arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeleton* - ok = false; - ok &= seval_to_boolean(args[1], &arg1); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_initWithSkeleton : Error processing arguments"); - cobj->initWithSkeleton(arg0, arg1); - return true; - } - if (argc == 3) { - spSkeleton* arg0 = nullptr; - bool arg1; - bool arg2; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeleton* - ok = false; - ok &= seval_to_boolean(args[1], &arg1); - ok &= seval_to_boolean(args[2], &arg2); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_initWithSkeleton : Error processing arguments"); - cobj->initWithSkeleton(arg0, arg1, arg2); + std::string arg0; + ok &= seval_to_std_string(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SkeletonRenderer_findBone : Error processing arguments"); return true; } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_initWithSkeleton) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_findBone) -static bool js_cocos2dx_spine_SpineRenderer_update(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_update(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_update : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_update : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_update) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_update) -static bool js_cocos2dx_spine_SpineRenderer_getAttachment(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_getAttachment(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_getAttachment : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_getAttachment : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -505,40 +12745,55 @@ static bool js_cocos2dx_spine_SpineRenderer_getAttachment(se::State& s) 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_SpineRenderer_getAttachment : Error processing arguments"); - spAttachment* result = cobj->getAttachment(arg0, arg1); - ok &= spattachment_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_getAttachment : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SkeletonRenderer_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_SpineRenderer_getAttachment) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_getAttachment) -static bool js_cocos2dx_spine_SpineRenderer_initWithUUID(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setDebugMeshEnabled(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_initWithUUID : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugMeshEnabled : 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_SpineRenderer_initWithUUID : Error processing arguments"); - cobj->initWithUUID(arg0); + bool arg0; + ok &= seval_to_boolean(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugMeshEnabled : Error processing arguments"); + cobj->setDebugMeshEnabled(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_SpineRenderer_initWithUUID) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setDebugMeshEnabled) + +static bool js_cocos2dx_spine_SkeletonRenderer_beginSchedule(se::State& s) +{ + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SkeletonRenderer_beginSchedule) -static bool js_cocos2dx_spine_SpineRenderer_initialize(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_initialize(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_initialize : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_initialize : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -548,49 +12803,49 @@ static bool js_cocos2dx_spine_SpineRenderer_initialize(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_initialize) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_initialize) -static bool js_cocos2dx_spine_SpineRenderer_setDebugBonesEnabled(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setDebugBonesEnabled : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled : 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_SpineRenderer_setDebugBonesEnabled : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled : Error processing arguments"); cobj->setDebugBonesEnabled(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_SpineRenderer_setDebugBonesEnabled) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled) -static bool js_cocos2dx_spine_SpineRenderer_getTimeScale(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_getTimeScale(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_getTimeScale : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_getTimeScale : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_getTimeScale) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_getTimeScale) -static bool js_cocos2dx_spine_SpineRenderer_setSlotsRange(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setSlotsRange(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setSlotsRange : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setSlotsRange : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -599,19 +12854,19 @@ static bool js_cocos2dx_spine_SpineRenderer_setSlotsRange(se::State& s) int arg1 = 0; do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); do { int32_t tmp = 0; ok &= seval_to_int32(args[1], &tmp); arg1 = (int)tmp; } while(false); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_setSlotsRange : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setSlotsRange : Error processing arguments"); cobj->setSlotsRange(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_SpineRenderer_setSlotsRange) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setSlotsRange) -static bool js_cocos2dx_spine_SpineRenderer_onDisable(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_onDisable(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_onDisable : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_onDisable : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -621,32 +12876,32 @@ static bool js_cocos2dx_spine_SpineRenderer_onDisable(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_onDisable) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_onDisable) -static bool js_cocos2dx_spine_SpineRenderer_setColor(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setColor(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_setColor : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_setColor : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_setColor) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setColor) -static bool js_cocos2dx_spine_SpineRenderer_setSkin(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setSkin(se::State& s) { CC_UNUSED bool ok = true; - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SpineRenderer_setSkin : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2( cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setSkin : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); do { @@ -654,9 +12909,7 @@ static bool js_cocos2dx_spine_SpineRenderer_setSkin(se::State& s) 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; } - bool result = cobj->setSkin(arg0); - ok &= boolean_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_setSkin : Error processing arguments"); + cobj->setSkin(arg0); return true; } } while(false); @@ -666,9 +12919,7 @@ static bool js_cocos2dx_spine_SpineRenderer_setSkin(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - bool result = cobj->setSkin(arg0); - ok &= boolean_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_setSkin : Error processing arguments"); + cobj->setSkin(arg0); return true; } } while(false); @@ -676,33 +12927,33 @@ static bool js_cocos2dx_spine_SpineRenderer_setSkin(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_setSkin) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setSkin) -static bool js_cocos2dx_spine_SpineRenderer_findSlot(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_findSlot(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_findSlot : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_findSlot : Error processing arguments"); - spSlot* result = cobj->findSlot(arg0); - ok &= spslot_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_findSlot : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SkeletonRenderer_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_SpineRenderer_findSlot) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_findSlot) -static bool js_cocos2dx_spine_SpineRenderer_updateWorldTransform(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_updateWorldTransform : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -712,84 +12963,95 @@ static bool js_cocos2dx_spine_SpineRenderer_updateWorldTransform(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineRenderer_updateWorldTransform) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform) -static bool js_cocos2dx_spine_SpineRenderer_getSkeleton(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_getSkeleton(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_getSkeleton : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_getSkeleton : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - spSkeleton* result = cobj->getSkeleton(); - ok &= spskeleton_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_getSkeleton : Error processing arguments"); + spine::Skeleton* result = cobj->getSkeleton(); + ok &= native_ptr_to_rooted_seval((spine::Skeleton*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_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_SpineRenderer_getSkeleton) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_getSkeleton) -static bool js_cocos2dx_spine_SpineRenderer_findBone(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_setVertexEffectDelegate(se::State& s) { - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineRenderer_findBone : Invalid Native Object"); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setVertexEffectDelegate : 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_SpineRenderer_findBone : Error processing arguments"); - spBone* result = cobj->findBone(arg0); - ok &= spbone_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineRenderer_findBone : Error processing arguments"); + spine::VertexEffectDelegate* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setVertexEffectDelegate : Error processing arguments"); + cobj->setVertexEffectDelegate(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_SpineRenderer_findBone) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setVertexEffectDelegate) -SE_DECLARE_FINALIZE_FUNC(js_spine_SpineRenderer_finalize) +SE_DECLARE_FINALIZE_FUNC(js_spine_SkeletonRenderer_finalize) -static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) +static bool js_cocos2dx_spine_SkeletonRenderer_constructor(se::State& s) { CC_UNUSED bool ok = true; const auto& args = s.args(); size_t argc = args.size(); do { if (argc == 1) { - spSkeleton* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeleton* - ok = false; + spine::Skeleton* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0); s.thisObject()->setPrivateData(cobj); return true; } } while(false); do { if (argc == 2) { - spSkeleton* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeleton* - ok = false; + spine::Skeleton* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); if (!ok) { ok = true; break; } bool arg1; ok &= seval_to_boolean(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); s.thisObject()->setPrivateData(cobj); return true; } } while(false); do { if (argc == 3) { - spSkeleton* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeleton* - ok = false; + spine::Skeleton* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + bool arg1; + ok &= seval_to_boolean(args[1], &arg1); + if (!ok) { ok = true; break; } + bool arg2; + ok &= seval_to_boolean(args[2], &arg2); + if (!ok) { ok = true; break; } + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); + s.thisObject()->setPrivateData(cobj); + return true; + } + } while(false); + do { + if (argc == 4) { + spine::Skeleton* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); if (!ok) { ok = true; break; } bool arg1; ok &= seval_to_boolean(args[1], &arg1); @@ -797,39 +13059,40 @@ static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) bool arg2; ok &= seval_to_boolean(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1, arg2); + bool arg3; + ok &= seval_to_boolean(args[3], &arg3); + if (!ok) { ok = true; break; } + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2, arg3); s.thisObject()->setPrivateData(cobj); return true; } } while(false); do { if (argc == 0) { - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(); s.thisObject()->setPrivateData(cobj); return true; } } while(false); do { if (argc == 1) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; + spine::SkeletonData* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0); s.thisObject()->setPrivateData(cobj); return true; } } while(false); do { if (argc == 2) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; + spine::SkeletonData* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); if (!ok) { ok = true; break; } bool arg1; ok &= seval_to_boolean(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); s.thisObject()->setPrivateData(cobj); return true; } @@ -839,11 +13102,10 @@ static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); s.thisObject()->setPrivateData(cobj); return true; } @@ -853,14 +13115,13 @@ static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } float arg2 = 0; ok &= seval_to_float(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1, arg2); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); s.thisObject()->setPrivateData(cobj); return true; } @@ -873,7 +13134,7 @@ static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) std::string arg1; ok &= seval_to_std_string(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1); s.thisObject()->setPrivateData(cobj); return true; } @@ -889,7 +13150,7 @@ static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) float arg2 = 0; ok &= seval_to_float(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineRenderer* cobj = new (std::nothrow) spine::SpineRenderer(arg0, arg1, arg2); + spine::SkeletonRenderer* cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); s.thisObject()->setPrivateData(cobj); return true; } @@ -897,74 +13158,77 @@ static bool js_cocos2dx_spine_SpineRenderer_constructor(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_CTOR(js_cocos2dx_spine_SpineRenderer_constructor, __jsb_spine_SpineRenderer_class, js_spine_SpineRenderer_finalize) +SE_BIND_CTOR(js_cocos2dx_spine_SkeletonRenderer_constructor, __jsb_spine_SkeletonRenderer_class, js_spine_SkeletonRenderer_finalize) -static bool js_spine_SpineRenderer_finalize(se::State& s) +static bool js_spine_SkeletonRenderer_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (spine::SpineRenderer)", s.nativeThisObject()); - spine::SpineRenderer* cobj = (spine::SpineRenderer*)s.nativeThisObject(); + CCLOGINFO("jsbindings: finalizing JS object %p (spine::SkeletonRenderer)", s.nativeThisObject()); + spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject(); cobj->release(); return true; } -SE_BIND_FINALIZE_FUNC(js_spine_SpineRenderer_finalize) - -bool js_register_cocos2dx_spine_SpineRenderer(se::Object* obj) -{ - auto cls = se::Class::create("Skeleton", obj, nullptr, _SE(js_cocos2dx_spine_SpineRenderer_constructor)); - - cls->defineFunction("setUseTint", _SE(js_cocos2dx_spine_SpineRenderer_setUseTint)); - cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_SpineRenderer_setTimeScale)); - cls->defineFunction("paused", _SE(js_cocos2dx_spine_SpineRenderer_paused)); - cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_SpineRenderer_setAttachment)); - cls->defineFunction("setBonesToSetupPose", _SE(js_cocos2dx_spine_SpineRenderer_setBonesToSetupPose)); - cls->defineFunction("setSlotsToSetupPose", _SE(js_cocos2dx_spine_SpineRenderer_setSlotsToSetupPose)); - cls->defineFunction("getRenderInfoOffset", _SE(js_cocos2dx_spine_SpineRenderer_getRenderInfoOffset)); - cls->defineFunction("stopSchedule", _SE(js_cocos2dx_spine_SpineRenderer_stopSchedule)); - cls->defineFunction("isOpacityModifyRGB", _SE(js_cocos2dx_spine_SpineRenderer_isOpacityModifyRGB)); - cls->defineFunction("setDebugSlotsEnabled", _SE(js_cocos2dx_spine_SpineRenderer_setDebugSlotsEnabled)); - cls->defineFunction("initWithJsonFile", _SE(js_cocos2dx_spine_SpineRenderer_initWithJsonFile)); - cls->defineFunction("setToSetupPose", _SE(js_cocos2dx_spine_SpineRenderer_setToSetupPose)); - cls->defineFunction("setOpacityModifyRGB", _SE(js_cocos2dx_spine_SpineRenderer_setOpacityModifyRGB)); - cls->defineFunction("initWithBinaryFile", _SE(js_cocos2dx_spine_SpineRenderer_initWithBinaryFile)); - cls->defineFunction("onEnable", _SE(js_cocos2dx_spine_SpineRenderer_onEnable)); - cls->defineFunction("beginSchedule", _SE(js_cocos2dx_spine_SpineRenderer_beginSchedule)); - cls->defineFunction("getDebugData", _SE(js_cocos2dx_spine_SpineRenderer_getDebugData)); - cls->defineFunction("initWithSkeleton", _SE(js_cocos2dx_spine_SpineRenderer_initWithSkeleton)); - cls->defineFunction("update", _SE(js_cocos2dx_spine_SpineRenderer_update)); - cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_SpineRenderer_getAttachment)); - cls->defineFunction("initWithUUID", _SE(js_cocos2dx_spine_SpineRenderer_initWithUUID)); - cls->defineFunction("initialize", _SE(js_cocos2dx_spine_SpineRenderer_initialize)); - cls->defineFunction("setDebugBonesEnabled", _SE(js_cocos2dx_spine_SpineRenderer_setDebugBonesEnabled)); - cls->defineFunction("getTimeScale", _SE(js_cocos2dx_spine_SpineRenderer_getTimeScale)); - cls->defineFunction("setSlotsRange", _SE(js_cocos2dx_spine_SpineRenderer_setSlotsRange)); - cls->defineFunction("onDisable", _SE(js_cocos2dx_spine_SpineRenderer_onDisable)); - cls->defineFunction("setColor", _SE(js_cocos2dx_spine_SpineRenderer_setColor)); - cls->defineFunction("setSkin", _SE(js_cocos2dx_spine_SpineRenderer_setSkin)); - cls->defineFunction("findSlot", _SE(js_cocos2dx_spine_SpineRenderer_findSlot)); - cls->defineFunction("updateWorldTransform", _SE(js_cocos2dx_spine_SpineRenderer_updateWorldTransform)); - cls->defineFunction("getSkeleton", _SE(js_cocos2dx_spine_SpineRenderer_getSkeleton)); - cls->defineFunction("findBone", _SE(js_cocos2dx_spine_SpineRenderer_findBone)); - cls->defineFinalizeFunction(_SE(js_spine_SpineRenderer_finalize)); +SE_BIND_FINALIZE_FUNC(js_spine_SkeletonRenderer_finalize) + +bool js_register_cocos2dx_spine_SkeletonRenderer(se::Object* obj) +{ + auto cls = se::Class::create("Skeleton", obj, nullptr, _SE(js_cocos2dx_spine_SkeletonRenderer_constructor)); + + cls->defineFunction("setUseTint", _SE(js_cocos2dx_spine_SkeletonRenderer_setUseTint)); + cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_SkeletonRenderer_setTimeScale)); + cls->defineFunction("initWithUUID", _SE(js_cocos2dx_spine_SkeletonRenderer_initWithUUID)); + cls->defineFunction("setOpacityModifyRGB", _SE(js_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB)); + cls->defineFunction("paused", _SE(js_cocos2dx_spine_SkeletonRenderer_paused)); + cls->defineFunction("setAttachment", _SE(js_cocos2dx_spine_SkeletonRenderer_setAttachment)); + cls->defineFunction("setBonesToSetupPose", _SE(js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose)); + cls->defineFunction("onEnable", _SE(js_cocos2dx_spine_SkeletonRenderer_onEnable)); + cls->defineFunction("getRenderInfoOffset", _SE(js_cocos2dx_spine_SkeletonRenderer_getRenderInfoOffset)); + cls->defineFunction("stopSchedule", _SE(js_cocos2dx_spine_SkeletonRenderer_stopSchedule)); + cls->defineFunction("isOpacityModifyRGB", _SE(js_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB)); + cls->defineFunction("setDebugSlotsEnabled", _SE(js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled)); + cls->defineFunction("initWithJsonFile", _SE(js_cocos2dx_spine_SkeletonRenderer_initWithJsonFile)); + cls->defineFunction("setToSetupPose", _SE(js_cocos2dx_spine_SkeletonRenderer_setToSetupPose)); + cls->defineFunction("setSlotsToSetupPose", _SE(js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose)); + cls->defineFunction("initWithBinaryFile", _SE(js_cocos2dx_spine_SkeletonRenderer_initWithBinaryFile)); + cls->defineFunction("initWithSkeleton", _SE(js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton)); + cls->defineFunction("getBoundingBox", _SE(js_cocos2dx_spine_SkeletonRenderer_getBoundingBox)); + cls->defineFunction("getDebugData", _SE(js_cocos2dx_spine_SkeletonRenderer_getDebugData)); + cls->defineFunction("findBone", _SE(js_cocos2dx_spine_SkeletonRenderer_findBone)); + cls->defineFunction("update", _SE(js_cocos2dx_spine_SkeletonRenderer_update)); + cls->defineFunction("getAttachment", _SE(js_cocos2dx_spine_SkeletonRenderer_getAttachment)); + cls->defineFunction("setDebugMeshEnabled", _SE(js_cocos2dx_spine_SkeletonRenderer_setDebugMeshEnabled)); + cls->defineFunction("beginSchedule", _SE(js_cocos2dx_spine_SkeletonRenderer_beginSchedule)); + cls->defineFunction("initialize", _SE(js_cocos2dx_spine_SkeletonRenderer_initialize)); + cls->defineFunction("setDebugBonesEnabled", _SE(js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled)); + cls->defineFunction("getTimeScale", _SE(js_cocos2dx_spine_SkeletonRenderer_getTimeScale)); + cls->defineFunction("setSlotsRange", _SE(js_cocos2dx_spine_SkeletonRenderer_setSlotsRange)); + cls->defineFunction("onDisable", _SE(js_cocos2dx_spine_SkeletonRenderer_onDisable)); + cls->defineFunction("setColor", _SE(js_cocos2dx_spine_SkeletonRenderer_setColor)); + cls->defineFunction("setSkin", _SE(js_cocos2dx_spine_SkeletonRenderer_setSkin)); + cls->defineFunction("findSlot", _SE(js_cocos2dx_spine_SkeletonRenderer_findSlot)); + cls->defineFunction("updateWorldTransform", _SE(js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform)); + cls->defineFunction("getSkeleton", _SE(js_cocos2dx_spine_SkeletonRenderer_getSkeleton)); + cls->defineFunction("setVertexEffectDelegate", _SE(js_cocos2dx_spine_SkeletonRenderer_setVertexEffectDelegate)); + cls->defineFinalizeFunction(_SE(js_spine_SkeletonRenderer_finalize)); cls->install(); - JSBClassType::registerClass(cls); + JSBClassType::registerClass(cls); - __jsb_spine_SpineRenderer_proto = cls->getProto(); - __jsb_spine_SpineRenderer_class = cls; + __jsb_spine_SkeletonRenderer_proto = cls->getProto(); + __jsb_spine_SkeletonRenderer_class = cls; se::ScriptEngine::getInstance()->clearException(); return true; } -se::Object* __jsb_spine_SpineAnimation_proto = nullptr; -se::Class* __jsb_spine_SpineAnimation_class = nullptr; +se::Object* __jsb_spine_SkeletonAnimation_proto = nullptr; +se::Class* __jsb_spine_SkeletonAnimation_class = nullptr; -static bool js_cocos2dx_spine_SpineAnimation_setAnimation(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setAnimation(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setAnimation : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setAnimation : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -975,42 +13239,42 @@ static bool js_cocos2dx_spine_SpineAnimation_setAnimation(se::State& s) do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); ok &= seval_to_std_string(args[1], &arg1); ok &= seval_to_boolean(args[2], &arg2); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setAnimation : Error processing arguments"); - spTrackEntry* result = cobj->setAnimation(arg0, arg1, arg2); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->setAnimation(arg0, arg1, arg2); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setAnimation : 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_spine_SpineAnimation_setAnimation) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setAnimation) -static bool js_cocos2dx_spine_SpineAnimation_findAnimation(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_findAnimation(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_findAnimation : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_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_SpineAnimation_findAnimation : Error processing arguments"); - spAnimation* result = cobj->findAnimation(arg0); - ok &= spanimation_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_findAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_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_SkeletonAnimation_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_SpineAnimation_findAnimation) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_findAnimation) -static bool js_cocos2dx_spine_SpineAnimation_setMix(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setMix(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setMix : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setMix : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -1021,19 +13285,19 @@ static bool js_cocos2dx_spine_SpineAnimation_setMix(se::State& s) ok &= seval_to_std_string(args[0], &arg0); ok &= seval_to_std_string(args[1], &arg1); ok &= seval_to_float(args[2], &arg2); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setMix : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setMix : Error processing arguments"); cobj->setMix(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_SpineAnimation_setMix) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setMix) -static bool js_cocos2dx_spine_SpineAnimation_addEmptyAnimation(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_addEmptyAnimation : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -1042,10 +13306,10 @@ static bool js_cocos2dx_spine_SpineAnimation_addEmptyAnimation(se::State& s) float arg1 = 0; do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); ok &= seval_to_float(args[1], &arg1); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addEmptyAnimation : Error processing arguments"); - spTrackEntry* result = cobj->addEmptyAnimation(arg0, arg1); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addEmptyAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->addEmptyAnimation(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation : Error processing arguments"); return true; } if (argc == 3) { @@ -1055,40 +13319,40 @@ static bool js_cocos2dx_spine_SpineAnimation_addEmptyAnimation(se::State& s) do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); ok &= seval_to_float(args[1], &arg1); ok &= seval_to_float(args[2], &arg2); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addEmptyAnimation : Error processing arguments"); - spTrackEntry* result = cobj->addEmptyAnimation(arg0, arg1, arg2); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addEmptyAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->addEmptyAnimation(arg0, arg1, arg2); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation : 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_spine_SpineAnimation_addEmptyAnimation) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation) -static bool js_cocos2dx_spine_SpineAnimation_setDisposeListener(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setDisposeListener(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setDisposeListener : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setDisposeListener : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - std::function arg0; + 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 = [=](spTrackEntry* larg0) -> void { + auto lambda = [=](spine::TrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; CC_UNUSED bool ok = true; se::ValueArray args; args.resize(1); - ok &= sptrackentry_to_seval(larg0, &args[0]); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)larg0, &args[0]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; se::Object* funcObj = jsFunc.toObject(); @@ -1105,58 +13369,57 @@ static bool js_cocos2dx_spine_SpineAnimation_setDisposeListener(se::State& s) } } while(false) ; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setDisposeListener : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setDisposeListener : Error processing arguments"); cobj->setDisposeListener(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_SpineAnimation_setDisposeListener) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setDisposeListener) -static bool js_cocos2dx_spine_SpineAnimation_setAnimationStateData(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setAnimationStateData : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - spAnimationStateData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAnimationStateData* - ok = false; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setAnimationStateData : Error processing arguments"); + spine::AnimationStateData* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData : Error processing arguments"); cobj->setAnimationStateData(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_SpineAnimation_setAnimationStateData) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData) -static bool js_cocos2dx_spine_SpineAnimation_setEndListener(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setEndListener(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setEndListener : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_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; + 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 = [=](spTrackEntry* larg0) -> void { + auto lambda = [=](spine::TrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; CC_UNUSED bool ok = true; se::ValueArray args; args.resize(1); - ok &= sptrackentry_to_seval(larg0, &args[0]); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)larg0, &args[0]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; se::Object* funcObj = jsFunc.toObject(); @@ -1173,56 +13436,56 @@ static bool js_cocos2dx_spine_SpineAnimation_setEndListener(se::State& s) } } while(false) ; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setEndListener : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_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_SpineAnimation_setEndListener) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEndListener) -static bool js_cocos2dx_spine_SpineAnimation_getState(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_getState(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_getState : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_getState : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - spAnimationState* result = cobj->getState(); - ok &= spanimationstate_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_getState : Error processing arguments"); + spine::AnimationState* result = cobj->getState(); + ok &= native_ptr_to_rooted_seval((spine::AnimationState*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_getState : 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_SpineAnimation_getState) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_getState) -static bool js_cocos2dx_spine_SpineAnimation_setCompleteListener(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setCompleteListener : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_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; + 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 = [=](spTrackEntry* larg0) -> void { + auto lambda = [=](spine::TrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; CC_UNUSED bool ok = true; se::ValueArray args; args.resize(1); - ok &= sptrackentry_to_seval(larg0, &args[0]); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)larg0, &args[0]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; se::Object* funcObj = jsFunc.toObject(); @@ -1239,66 +13502,66 @@ static bool js_cocos2dx_spine_SpineAnimation_setCompleteListener(se::State& s) } } while(false) ; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setCompleteListener : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_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_SpineAnimation_setCompleteListener) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setCompleteListener) -static bool js_cocos2dx_spine_SpineAnimation_getCurrent(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_getCurrent(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_getCurrent : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_getCurrent : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - spTrackEntry* result = cobj->getCurrent(); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_getCurrent : Error processing arguments"); + spine::TrackEntry* result = cobj->getCurrent(); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_getCurrent : Error processing arguments"); return true; } if (argc == 1) { int arg0 = 0; do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_getCurrent : Error processing arguments"); - spTrackEntry* result = cobj->getCurrent(arg0); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_getCurrent : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_getCurrent : Error processing arguments"); + spine::TrackEntry* result = cobj->getCurrent(arg0); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_getCurrent : 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_SpineAnimation_getCurrent) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_getCurrent) -static bool js_cocos2dx_spine_SpineAnimation_setEventListener(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setEventListener : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setEventListener : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - std::function arg0; + 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 = [=](spTrackEntry* larg0, spEvent* larg1) -> void { + auto lambda = [=](spine::TrackEntry* larg0, spine::Event* larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; CC_UNUSED bool ok = true; se::ValueArray args; args.resize(2); - ok &= sptrackentry_to_seval(larg0, &args[0]); - ok &= spevent_to_seval(larg1, &args[1]); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)larg0, &args[0]); + ok &= native_ptr_to_rooted_seval((spine::Event*)larg1, &args[1]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; se::Object* funcObj = jsFunc.toObject(); @@ -1315,19 +13578,19 @@ static bool js_cocos2dx_spine_SpineAnimation_setEventListener(se::State& s) } } while(false) ; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setEventListener : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setEventListener : Error processing arguments"); cobj->setEventListener(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_SpineAnimation_setEventListener) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEventListener) -static bool js_cocos2dx_spine_SpineAnimation_setEmptyAnimation(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setEmptyAnimation : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -1336,21 +13599,21 @@ static bool js_cocos2dx_spine_SpineAnimation_setEmptyAnimation(se::State& s) float arg1 = 0; do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); ok &= seval_to_float(args[1], &arg1); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setEmptyAnimation : Error processing arguments"); - spTrackEntry* result = cobj->setEmptyAnimation(arg0, arg1); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setEmptyAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->setEmptyAnimation(arg0, arg1); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation : 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_SpineAnimation_setEmptyAnimation) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation) -static bool js_cocos2dx_spine_SpineAnimation_clearTrack(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_clearTrack : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -1361,38 +13624,38 @@ static bool js_cocos2dx_spine_SpineAnimation_clearTrack(se::State& s) if (argc == 1) { int arg0 = 0; do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_clearTrack : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : Error processing arguments"); cobj->clearTrack(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_SpineAnimation_clearTrack) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_clearTrack) -static bool js_cocos2dx_spine_SpineAnimation_setInterruptListener(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setInterruptListener(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setInterruptListener : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setInterruptListener : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - std::function arg0; + 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 = [=](spTrackEntry* larg0) -> void { + auto lambda = [=](spine::TrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; CC_UNUSED bool ok = true; se::ValueArray args; args.resize(1); - ok &= sptrackentry_to_seval(larg0, &args[0]); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)larg0, &args[0]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; se::Object* funcObj = jsFunc.toObject(); @@ -1409,19 +13672,19 @@ static bool js_cocos2dx_spine_SpineAnimation_setInterruptListener(se::State& s) } } while(false) ; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setInterruptListener : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setInterruptListener : Error processing arguments"); cobj->setInterruptListener(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_SpineAnimation_setInterruptListener) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setInterruptListener) -static bool js_cocos2dx_spine_SpineAnimation_addAnimation(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_addAnimation(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_addAnimation : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_addAnimation : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; @@ -1432,10 +13695,10 @@ static bool js_cocos2dx_spine_SpineAnimation_addAnimation(se::State& s) do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false); ok &= seval_to_std_string(args[1], &arg1); ok &= seval_to_boolean(args[2], &arg2); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addAnimation : Error processing arguments"); - spTrackEntry* result = cobj->addAnimation(arg0, arg1, arg2); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->addAnimation(arg0, arg1, arg2); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addAnimation : Error processing arguments"); return true; } if (argc == 4) { @@ -1447,40 +13710,40 @@ static bool js_cocos2dx_spine_SpineAnimation_addAnimation(se::State& s) ok &= seval_to_std_string(args[1], &arg1); ok &= seval_to_boolean(args[2], &arg2); ok &= seval_to_float(args[3], &arg3); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addAnimation : Error processing arguments"); - spTrackEntry* result = cobj->addAnimation(arg0, arg1, arg2, arg3); - ok &= sptrackentry_to_seval(result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_addAnimation : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addAnimation : Error processing arguments"); + spine::TrackEntry* result = cobj->addAnimation(arg0, arg1, arg2, arg3); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_addAnimation : Error processing arguments"); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineAnimation_addAnimation) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_addAnimation) -static bool js_cocos2dx_spine_SpineAnimation_setEmptyAnimations(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimations(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setEmptyAnimations : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimations : 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_SpineAnimation_setEmptyAnimations : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimations : Error processing arguments"); cobj->setEmptyAnimations(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_SpineAnimation_setEmptyAnimations) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimations) -static bool js_cocos2dx_spine_SpineAnimation_clearTracks(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_clearTracks(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_clearTracks : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_clearTracks : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -1490,31 +13753,31 @@ static bool js_cocos2dx_spine_SpineAnimation_clearTracks(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineAnimation_clearTracks) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_clearTracks) -static bool js_cocos2dx_spine_SpineAnimation_setStartListener(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setStartListener(se::State& s) { - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SpineAnimation_setStartListener : Invalid Native Object"); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonAnimation_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; + 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 = [=](spTrackEntry* larg0) -> void { + auto lambda = [=](spine::TrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; CC_UNUSED bool ok = true; se::ValueArray args; args.resize(1); - ok &= sptrackentry_to_seval(larg0, &args[0]); + ok &= native_ptr_to_rooted_seval((spine::TrackEntry*)larg0, &args[0]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; se::Object* funcObj = jsFunc.toObject(); @@ -1531,16 +13794,16 @@ static bool js_cocos2dx_spine_SpineAnimation_setStartListener(se::State& s) } } while(false) ; - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setStartListener : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_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_SpineAnimation_setStartListener) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setStartListener) -static bool js_cocos2dx_spine_SpineAnimation_createWithBinaryFile(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile(se::State& s) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -1553,9 +13816,9 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithBinaryFile(se::State& s) std::string arg1; ok &= seval_to_std_string(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithBinaryFile(arg0, arg1); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithBinaryFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithBinaryFile(arg0, arg1); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments"); return true; } } while (false); @@ -1570,9 +13833,9 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithBinaryFile(se::State& s) float arg2 = 0; ok &= seval_to_float(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithBinaryFile(arg0, arg1, arg2); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithBinaryFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithBinaryFile(arg0, arg1, arg2); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments"); return true; } } while (false); @@ -1581,13 +13844,12 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithBinaryFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithBinaryFile(arg0, arg1); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithBinaryFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithBinaryFile(arg0, arg1); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments"); return true; } } while (false); @@ -1596,33 +13858,32 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithBinaryFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } float arg2 = 0; ok &= seval_to_float(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithBinaryFile(arg0, arg1, arg2); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithBinaryFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithBinaryFile(arg0, arg1, arg2); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile : 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_SpineAnimation_createWithBinaryFile) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile) -static bool js_cocos2dx_spine_SpineAnimation_create(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_create(se::State& s) { const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - auto result = spine::SpineAnimation::create(); + auto result = spine::SkeletonAnimation::create(); result->retain(); - auto obj = se::Object::createObjectWithClass(__jsb_spine_SpineAnimation_class); + auto obj = se::Object::createObjectWithClass(__jsb_spine_SkeletonAnimation_class); obj->setPrivateData(result); s.rval().setObject(obj); return true; @@ -1630,9 +13891,9 @@ static bool js_cocos2dx_spine_SpineAnimation_create(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_cocos2dx_spine_SpineAnimation_create) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_create) -static bool js_cocos2dx_spine_SpineAnimation_createWithJsonFile(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile(se::State& s) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -1645,9 +13906,9 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithJsonFile(se::State& s) std::string arg1; ok &= seval_to_std_string(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithJsonFile(arg0, arg1); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithJsonFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithJsonFile(arg0, arg1); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile : Error processing arguments"); return true; } } while (false); @@ -1662,9 +13923,9 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithJsonFile(se::State& s) float arg2 = 0; ok &= seval_to_float(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithJsonFile(arg0, arg1, arg2); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithJsonFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithJsonFile(arg0, arg1, arg2); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile : Error processing arguments"); return true; } } while (false); @@ -1673,13 +13934,12 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithJsonFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithJsonFile(arg0, arg1); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithJsonFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithJsonFile(arg0, arg1); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile : Error processing arguments"); return true; } } while (false); @@ -1688,25 +13948,24 @@ static bool js_cocos2dx_spine_SpineAnimation_createWithJsonFile(se::State& s) std::string arg0; ok &= seval_to_std_string(args[0], &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; + spine::Atlas* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); if (!ok) { ok = true; break; } float arg2 = 0; ok &= seval_to_float(args[2], &arg2); if (!ok) { ok = true; break; } - spine::SpineAnimation* result = spine::SpineAnimation::createWithJsonFile(arg0, arg1, arg2); - ok &= native_ptr_to_seval((spine::SpineAnimation*)result, &s.rval()); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_createWithJsonFile : Error processing arguments"); + spine::SkeletonAnimation* result = spine::SkeletonAnimation::createWithJsonFile(arg0, arg1, arg2); + ok &= native_ptr_to_seval((spine::SkeletonAnimation*)result, &s.rval()); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile : 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_SpineAnimation_createWithJsonFile) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile) -static bool js_cocos2dx_spine_SpineAnimation_setGlobalTimeScale(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_setGlobalTimeScale(se::State& s) { const auto& args = s.args(); size_t argc = args.size(); @@ -1714,272 +13973,82 @@ static bool js_cocos2dx_spine_SpineAnimation_setGlobalTimeScale(se::State& s) if (argc == 1) { float arg0 = 0; ok &= seval_to_float(args[0], &arg0); - SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SpineAnimation_setGlobalTimeScale : Error processing arguments"); - spine::SpineAnimation::setGlobalTimeScale(arg0); + SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonAnimation_setGlobalTimeScale : Error processing arguments"); + spine::SkeletonAnimation::setGlobalTimeScale(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_SpineAnimation_setGlobalTimeScale) +SE_BIND_FUNC(js_cocos2dx_spine_SkeletonAnimation_setGlobalTimeScale) -SE_DECLARE_FINALIZE_FUNC(js_spine_SpineAnimation_finalize) +SE_DECLARE_FINALIZE_FUNC(js_spine_SkeletonAnimation_finalize) -static bool js_cocos2dx_spine_SpineAnimation_constructor(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_constructor(se::State& s) { - CC_UNUSED bool ok = true; - const auto& args = s.args(); - size_t argc = args.size(); - do { - if (argc == 1) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 2) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; - if (!ok) { ok = true; break; } - bool arg1; - ok &= seval_to_boolean(args[1], &arg1); - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 0) { - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 2) { - std::string arg0; - ok &= seval_to_std_string(args[0], &arg0); - if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 3) { - std::string arg0; - ok &= seval_to_std_string(args[0], &arg0); - if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; - if (!ok) { ok = true; break; } - float arg2 = 0; - ok &= seval_to_float(args[2], &arg2); - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1, arg2); - s.thisObject()->setPrivateData(cobj); - 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; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 3) { - 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; } - float arg2 = 0; - ok &= seval_to_float(args[2], &arg2); - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1, arg2); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; + spine::SkeletonAnimation* cobj = new (std::nothrow) spine::SkeletonAnimation(); + s.thisObject()->setPrivateData(cobj); + return true; } -SE_BIND_CTOR(js_cocos2dx_spine_SpineAnimation_constructor, __jsb_spine_SpineAnimation_class, js_spine_SpineAnimation_finalize) - -SE_DECLARE_FINALIZE_FUNC(js_spine_SpineAnimation_finalize) +SE_BIND_CTOR(js_cocos2dx_spine_SkeletonAnimation_constructor, __jsb_spine_SkeletonAnimation_class, js_spine_SkeletonAnimation_finalize) -static bool js_cocos2dx_spine_SpineAnimation_ctor(se::State& s) +static bool js_cocos2dx_spine_SkeletonAnimation_ctor(se::State& s) { - CC_UNUSED bool ok = true; - const auto& args = s.args(); - size_t argc = args.size(); - do { - if (argc == 1) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 2) { - spSkeletonData* arg0 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* - ok = false; - if (!ok) { ok = true; break; } - bool arg1; - ok &= seval_to_boolean(args[1], &arg1); - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 0) { - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 2) { - std::string arg0; - ok &= seval_to_std_string(args[0], &arg0); - if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 3) { - std::string arg0; - ok &= seval_to_std_string(args[0], &arg0); - if (!ok) { ok = true; break; } - spAtlas* arg1 = nullptr; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; - if (!ok) { ok = true; break; } - float arg2 = 0; - ok &= seval_to_float(args[2], &arg2); - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1, arg2); - s.thisObject()->setPrivateData(cobj); - 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; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - do { - if (argc == 3) { - 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; } - float arg2 = 0; - ok &= seval_to_float(args[2], &arg2); - if (!ok) { ok = true; break; } - spine::SpineAnimation* cobj = new (std::nothrow) spine::SpineAnimation(arg0, arg1, arg2); - s.thisObject()->setPrivateData(cobj); - return true; - } - } while(false); - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; + spine::SkeletonAnimation* cobj = new (std::nothrow) spine::SkeletonAnimation(); + s.thisObject()->setPrivateData(cobj); + return true; } -SE_BIND_SUB_CLS_CTOR(js_cocos2dx_spine_SpineAnimation_ctor, __jsb_spine_SpineAnimation_class, js_spine_SpineAnimation_finalize) +SE_BIND_SUB_CLS_CTOR(js_cocos2dx_spine_SkeletonAnimation_ctor, __jsb_spine_SkeletonAnimation_class, js_spine_SkeletonAnimation_finalize) -extern se::Object* __jsb_spine_SpineRenderer_proto; +extern se::Object* __jsb_spine_SkeletonRenderer_proto; -static bool js_spine_SpineAnimation_finalize(se::State& s) +static bool js_spine_SkeletonAnimation_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (spine::SpineAnimation)", s.nativeThisObject()); - spine::SpineAnimation* cobj = (spine::SpineAnimation*)s.nativeThisObject(); + CCLOGINFO("jsbindings: finalizing JS object %p (spine::SkeletonAnimation)", s.nativeThisObject()); + spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation*)s.nativeThisObject(); cobj->release(); return true; } -SE_BIND_FINALIZE_FUNC(js_spine_SpineAnimation_finalize) - -bool js_register_cocos2dx_spine_SpineAnimation(se::Object* obj) -{ - auto cls = se::Class::create("SpineAnimation", obj, __jsb_spine_SpineRenderer_proto, _SE(js_cocos2dx_spine_SpineAnimation_constructor)); - - cls->defineFunction("setAnimation", _SE(js_cocos2dx_spine_SpineAnimation_setAnimation)); - cls->defineFunction("findAnimation", _SE(js_cocos2dx_spine_SpineAnimation_findAnimation)); - cls->defineFunction("setMix", _SE(js_cocos2dx_spine_SpineAnimation_setMix)); - cls->defineFunction("addEmptyAnimation", _SE(js_cocos2dx_spine_SpineAnimation_addEmptyAnimation)); - cls->defineFunction("setDisposeListener", _SE(js_cocos2dx_spine_SpineAnimation_setDisposeListener)); - cls->defineFunction("setAnimationStateData", _SE(js_cocos2dx_spine_SpineAnimation_setAnimationStateData)); - cls->defineFunction("setEndListener", _SE(js_cocos2dx_spine_SpineAnimation_setEndListener)); - cls->defineFunction("getState", _SE(js_cocos2dx_spine_SpineAnimation_getState)); - cls->defineFunction("setCompleteListenerNative", _SE(js_cocos2dx_spine_SpineAnimation_setCompleteListener)); - cls->defineFunction("getCurrent", _SE(js_cocos2dx_spine_SpineAnimation_getCurrent)); - cls->defineFunction("setEventListener", _SE(js_cocos2dx_spine_SpineAnimation_setEventListener)); - cls->defineFunction("setEmptyAnimation", _SE(js_cocos2dx_spine_SpineAnimation_setEmptyAnimation)); - cls->defineFunction("clearTrack", _SE(js_cocos2dx_spine_SpineAnimation_clearTrack)); - cls->defineFunction("setInterruptListener", _SE(js_cocos2dx_spine_SpineAnimation_setInterruptListener)); - cls->defineFunction("addAnimation", _SE(js_cocos2dx_spine_SpineAnimation_addAnimation)); - cls->defineFunction("setEmptyAnimations", _SE(js_cocos2dx_spine_SpineAnimation_setEmptyAnimations)); - cls->defineFunction("clearTracks", _SE(js_cocos2dx_spine_SpineAnimation_clearTracks)); - cls->defineFunction("setStartListener", _SE(js_cocos2dx_spine_SpineAnimation_setStartListener)); - cls->defineFunction("ctor", _SE(js_cocos2dx_spine_SpineAnimation_ctor)); - cls->defineStaticFunction("createWithBinaryFile", _SE(js_cocos2dx_spine_SpineAnimation_createWithBinaryFile)); - cls->defineStaticFunction("create", _SE(js_cocos2dx_spine_SpineAnimation_create)); - cls->defineStaticFunction("createWithJsonFile", _SE(js_cocos2dx_spine_SpineAnimation_createWithJsonFile)); - cls->defineStaticFunction("setGlobalTimeScale", _SE(js_cocos2dx_spine_SpineAnimation_setGlobalTimeScale)); - cls->defineFinalizeFunction(_SE(js_spine_SpineAnimation_finalize)); +SE_BIND_FINALIZE_FUNC(js_spine_SkeletonAnimation_finalize) + +bool js_register_cocos2dx_spine_SkeletonAnimation(se::Object* obj) +{ + auto cls = se::Class::create("SkeletonAnimation", obj, __jsb_spine_SkeletonRenderer_proto, _SE(js_cocos2dx_spine_SkeletonAnimation_constructor)); + + cls->defineFunction("setAnimation", _SE(js_cocos2dx_spine_SkeletonAnimation_setAnimation)); + cls->defineFunction("findAnimation", _SE(js_cocos2dx_spine_SkeletonAnimation_findAnimation)); + cls->defineFunction("setMix", _SE(js_cocos2dx_spine_SkeletonAnimation_setMix)); + cls->defineFunction("addEmptyAnimation", _SE(js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation)); + cls->defineFunction("setDisposeListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setDisposeListener)); + cls->defineFunction("setAnimationStateData", _SE(js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData)); + cls->defineFunction("setEndListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setEndListener)); + cls->defineFunction("getState", _SE(js_cocos2dx_spine_SkeletonAnimation_getState)); + cls->defineFunction("setCompleteListenerNative", _SE(js_cocos2dx_spine_SkeletonAnimation_setCompleteListener)); + cls->defineFunction("getCurrent", _SE(js_cocos2dx_spine_SkeletonAnimation_getCurrent)); + cls->defineFunction("setEventListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setEventListener)); + cls->defineFunction("setEmptyAnimation", _SE(js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation)); + cls->defineFunction("clearTrack", _SE(js_cocos2dx_spine_SkeletonAnimation_clearTrack)); + cls->defineFunction("setInterruptListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setInterruptListener)); + cls->defineFunction("addAnimation", _SE(js_cocos2dx_spine_SkeletonAnimation_addAnimation)); + cls->defineFunction("setEmptyAnimations", _SE(js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimations)); + cls->defineFunction("clearTracks", _SE(js_cocos2dx_spine_SkeletonAnimation_clearTracks)); + cls->defineFunction("setStartListener", _SE(js_cocos2dx_spine_SkeletonAnimation_setStartListener)); + cls->defineFunction("ctor", _SE(js_cocos2dx_spine_SkeletonAnimation_ctor)); + cls->defineStaticFunction("createWithBinaryFile", _SE(js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile)); + cls->defineStaticFunction("create", _SE(js_cocos2dx_spine_SkeletonAnimation_create)); + cls->defineStaticFunction("createWithJsonFile", _SE(js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile)); + cls->defineStaticFunction("setGlobalTimeScale", _SE(js_cocos2dx_spine_SkeletonAnimation_setGlobalTimeScale)); + cls->defineFinalizeFunction(_SE(js_spine_SkeletonAnimation_finalize)); cls->install(); - JSBClassType::registerClass(cls); + JSBClassType::registerClass(cls); - __jsb_spine_SpineAnimation_proto = cls->getProto(); - __jsb_spine_SpineAnimation_class = cls; + __jsb_spine_SkeletonAnimation_proto = cls->getProto(); + __jsb_spine_SkeletonAnimation_class = cls; - jsb_set_extend_property("spine", "SpineAnimation"); + jsb_set_extend_property("spine", "SkeletonAnimation"); se::ScriptEngine::getInstance()->clearException(); return true; } @@ -1996,8 +14065,59 @@ bool register_all_cocos2dx_spine(se::Object* obj) } se::Object* ns = nsVal.toObject(); - js_register_cocos2dx_spine_SpineRenderer(ns); - js_register_cocos2dx_spine_SpineAnimation(ns); + js_register_cocos2dx_spine_Slot(ns); + js_register_cocos2dx_spine_Timeline(ns); + js_register_cocos2dx_spine_CurveTimeline(ns); + js_register_cocos2dx_spine_TranslateTimeline(ns); + js_register_cocos2dx_spine_ShearTimeline(ns); + js_register_cocos2dx_spine_Polygon(ns); + js_register_cocos2dx_spine_Attachment(ns); + js_register_cocos2dx_spine_VertexAttachment(ns); + js_register_cocos2dx_spine_VertexEffect(ns); + js_register_cocos2dx_spine_JitterVertexEffect(ns); + js_register_cocos2dx_spine_IkConstraintTimeline(ns); + js_register_cocos2dx_spine_SkeletonRenderer(ns); + js_register_cocos2dx_spine_Animation(ns); + js_register_cocos2dx_spine_MeshAttachment(ns); + js_register_cocos2dx_spine_AttachmentTimeline(ns); + js_register_cocos2dx_spine_PathConstraintMixTimeline(ns); + js_register_cocos2dx_spine_PathConstraintPositionTimeline(ns); + js_register_cocos2dx_spine_PathConstraintSpacingTimeline(ns); + js_register_cocos2dx_spine_SkeletonAnimation(ns); + js_register_cocos2dx_spine_IkConstraintData(ns); + js_register_cocos2dx_spine_SwirlVertexEffect(ns); + js_register_cocos2dx_spine_AnimationStateData(ns); + js_register_cocos2dx_spine_PointAttachment(ns); + js_register_cocos2dx_spine_AnimationState(ns); + js_register_cocos2dx_spine_TrackEntry(ns); + js_register_cocos2dx_spine_BoneData(ns); + js_register_cocos2dx_spine_ScaleTimeline(ns); + js_register_cocos2dx_spine_SkeletonData(ns); + js_register_cocos2dx_spine_PathAttachment(ns); + js_register_cocos2dx_spine_TransformConstraint(ns); + js_register_cocos2dx_spine_BoundingBoxAttachment(ns); + js_register_cocos2dx_spine_ClippingAttachment(ns); + js_register_cocos2dx_spine_DeformTimeline(ns); + js_register_cocos2dx_spine_SkeletonBounds(ns); + js_register_cocos2dx_spine_TransformConstraintData(ns); + js_register_cocos2dx_spine_ColorTimeline(ns); + js_register_cocos2dx_spine_PathConstraint(ns); + js_register_cocos2dx_spine_TransformConstraintTimeline(ns); + js_register_cocos2dx_spine_Bone(ns); + js_register_cocos2dx_spine_EventTimeline(ns); + js_register_cocos2dx_spine_Skeleton(ns); + js_register_cocos2dx_spine_TwoColorTimeline(ns); + js_register_cocos2dx_spine_Color(ns); + js_register_cocos2dx_spine_DrawOrderTimeline(ns); + js_register_cocos2dx_spine_RegionAttachment(ns); + js_register_cocos2dx_spine_IkConstraint(ns); + js_register_cocos2dx_spine_RotateTimeline(ns); + js_register_cocos2dx_spine_SlotData(ns); + js_register_cocos2dx_spine_Skin(ns); + js_register_cocos2dx_spine_VertexEffectDelegate(ns); + js_register_cocos2dx_spine_EventData(ns); + js_register_cocos2dx_spine_Event(ns); + js_register_cocos2dx_spine_PathConstraintData(ns); return true; } diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp index 269e04af406..c81f1254012 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp @@ -4,72 +4,932 @@ #include "cocos/scripting/js-bindings/jswrapper/SeApi.h" -extern se::Object* __jsb_spine_SpineRenderer_proto; -extern se::Class* __jsb_spine_SpineRenderer_class; - -bool js_register_spine_SpineRenderer(se::Object* obj); -bool register_all_cocos2dx_spine(se::Object* obj); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setUseTint); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setTimeScale); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_paused); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setAttachment); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setBonesToSetupPose); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setSlotsToSetupPose); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_getRenderInfoOffset); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_stopSchedule); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_isOpacityModifyRGB); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setDebugSlotsEnabled); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_initWithJsonFile); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setToSetupPose); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setOpacityModifyRGB); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_initWithBinaryFile); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_onEnable); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_beginSchedule); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_getDebugData); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_initWithSkeleton); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_update); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_getAttachment); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_initWithUUID); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_initialize); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setDebugBonesEnabled); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_getTimeScale); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setSlotsRange); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_onDisable); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setColor); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_setSkin); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_findSlot); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_updateWorldTransform); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_getSkeleton); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_findBone); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineRenderer_SpineRenderer); - -extern se::Object* __jsb_spine_SpineAnimation_proto; -extern se::Class* __jsb_spine_SpineAnimation_class; - -bool js_register_spine_SpineAnimation(se::Object* obj); -bool register_all_cocos2dx_spine(se::Object* obj); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setAnimation); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_findAnimation); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setMix); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_addEmptyAnimation); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setDisposeListener); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setAnimationStateData); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setEndListener); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_getState); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setCompleteListener); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_getCurrent); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setEventListener); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setEmptyAnimation); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_clearTrack); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setInterruptListener); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_addAnimation); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setEmptyAnimations); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_clearTracks); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setStartListener); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_createWithBinaryFile); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_create); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_createWithJsonFile); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_setGlobalTimeScale); -SE_DECLARE_FUNC(js_cocos2dx_spine_SpineAnimation_SpineAnimation); +extern se::Object* __jsb_spine_Animation_proto; +extern se::Class* __jsb_spine_Animation_class; + +bool js_register_spine_Animation(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Animation_getTimelines); +SE_DECLARE_FUNC(js_cocos2dx_spine_Animation_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_Animation_setDuration); +SE_DECLARE_FUNC(js_cocos2dx_spine_Animation_getDuration); + +extern se::Object* __jsb_spine_TrackEntry_proto; +extern se::Class* __jsb_spine_TrackEntry_class; + +bool js_register_spine_TrackEntry(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getNext); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAttachmentThreshold); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getMixDuration); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setAnimationEnd); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setEventThreshold); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getMixingTo); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setTrackEnd); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getMixBlend); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getTrackEnd); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setDelay); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAnimationEnd); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setAttachmentThreshold); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setMixTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_isComplete); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getMixingFrom); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setAlpha); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getDrawOrderThreshold); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getMixTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setTrackTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setMixDuration); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_resetRotationDirections); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setHoldPrevious); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getLoop); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getTrackTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAnimationStart); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAnimationLast); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setAnimationStart); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setLoop); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getTrackIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getDelay); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getHoldPrevious); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAnimationTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getEventThreshold); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setDrawOrderThreshold); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setAnimationLast); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_getAlpha); +SE_DECLARE_FUNC(js_cocos2dx_spine_TrackEntry_setMixBlend); + +extern se::Object* __jsb_spine_AnimationState_proto; +extern se::Class* __jsb_spine_AnimationState_class; + +bool js_register_spine_AnimationState(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_getData); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_addAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_setEmptyAnimations); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_getCurrent); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_enableQueue); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_clearTracks); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_disableQueue); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_setEmptyAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_setTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_getTracks); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_clearTrack); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_setAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_addEmptyAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationState_getTimeScale); + +extern se::Object* __jsb_spine_AnimationStateData_proto; +extern se::Class* __jsb_spine_AnimationStateData_class; + +bool js_register_spine_AnimationStateData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationStateData_getMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationStateData_getDefaultMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationStateData_setMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationStateData_setDefaultMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_AnimationStateData_getSkeletonData); + +extern se::Object* __jsb_spine_Attachment_proto; +extern se::Class* __jsb_spine_Attachment_class; + +bool js_register_spine_Attachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Attachment_getName); + +extern se::Object* __jsb_spine_Timeline_proto; +extern se::Class* __jsb_spine_Timeline_class; + +bool js_register_spine_Timeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Timeline_getPropertyId); + +extern se::Object* __jsb_spine_AttachmentTimeline_proto; +extern se::Class* __jsb_spine_AttachmentTimeline_class; + +bool js_register_spine_AttachmentTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_getAttachmentNames); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_setSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_setFrame); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_getSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_getFrameCount); +SE_DECLARE_FUNC(js_cocos2dx_spine_AttachmentTimeline_getFrames); + +extern se::Object* __jsb_spine_Bone_proto; +extern se::Class* __jsb_spine_Bone_class; + +bool js_register_spine_Bone(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setD); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAppliedRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getB); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getC); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getD); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getChildren); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setWorldX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAppliedValid); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAShearX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldRotationY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_isAppliedValid); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldToLocalRotationX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldToLocalRotationY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getA); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getData); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setShearX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setA); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setB); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldRotationX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getShearX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAShearX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setC); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setWorldY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setAY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_rotateWorld); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getParent); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getAppliedRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_updateWorldTransform); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getWorldX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_getSkeleton); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_isYDown); +SE_DECLARE_FUNC(js_cocos2dx_spine_Bone_setYDown); + +extern se::Object* __jsb_spine_BoneData_proto; +extern se::Class* __jsb_spine_BoneData_class; + +bool js_register_spine_BoneData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setShearX); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getParent); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getLength); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getShearX); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setY); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getX); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getY); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_getTransformMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setX); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setLength); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_BoneData_setTransformMode); + +extern se::Object* __jsb_spine_VertexAttachment_proto; +extern se::Class* __jsb_spine_VertexAttachment_class; + +bool js_register_spine_VertexAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexAttachment_getVertices); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexAttachment_getId); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexAttachment_getWorldVerticesLength); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexAttachment_applyDeform); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexAttachment_setWorldVerticesLength); + +extern se::Object* __jsb_spine_BoundingBoxAttachment_proto; +extern se::Class* __jsb_spine_BoundingBoxAttachment_class; + +bool js_register_spine_BoundingBoxAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); + +extern se::Object* __jsb_spine_ClippingAttachment_proto; +extern se::Class* __jsb_spine_ClippingAttachment_class; + +bool js_register_spine_ClippingAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_ClippingAttachment_setEndSlot); +SE_DECLARE_FUNC(js_cocos2dx_spine_ClippingAttachment_getEndSlot); + +extern se::Object* __jsb_spine_Color_proto; +extern se::Class* __jsb_spine_Color_class; + +bool js_register_spine_Color(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Color_clamp); + +extern se::Object* __jsb_spine_CurveTimeline_proto; +extern se::Class* __jsb_spine_CurveTimeline_class; + +bool js_register_spine_CurveTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_setCurve); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_setLinear); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_getFrameCount); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_setStepped); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_getCurvePercent); +SE_DECLARE_FUNC(js_cocos2dx_spine_CurveTimeline_getCurveType); + +extern se::Object* __jsb_spine_ColorTimeline_proto; +extern se::Class* __jsb_spine_ColorTimeline_class; + +bool js_register_spine_ColorTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_ColorTimeline_setSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_ColorTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_ColorTimeline_setFrame); +SE_DECLARE_FUNC(js_cocos2dx_spine_ColorTimeline_getSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_ColorTimeline_getFrames); + +extern se::Object* __jsb_spine_DeformTimeline_proto; +extern se::Class* __jsb_spine_DeformTimeline_class; + +bool js_register_spine_DeformTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_DeformTimeline_setSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_DeformTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_DeformTimeline_getSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_DeformTimeline_getAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_DeformTimeline_setAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_DeformTimeline_getFrames); + +extern se::Object* __jsb_spine_DrawOrderTimeline_proto; +extern se::Class* __jsb_spine_DrawOrderTimeline_class; + +bool js_register_spine_DrawOrderTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_DrawOrderTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_DrawOrderTimeline_getFrameCount); +SE_DECLARE_FUNC(js_cocos2dx_spine_DrawOrderTimeline_getFrames); + +extern se::Object* __jsb_spine_Event_proto; +extern se::Class* __jsb_spine_Event_class; + +bool js_register_spine_Event(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getFloatValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getIntValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getStringValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getBalance); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_setFloatValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_setIntValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getVolume); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_setBalance); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_getData); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_setStringValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_Event_setVolume); + +extern se::Object* __jsb_spine_EventData_proto; +extern se::Class* __jsb_spine_EventData_class; + +bool js_register_spine_EventData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getAudioPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getIntValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getStringValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getFloatValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_setFloatValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_setIntValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getVolume); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_setBalance); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_setVolume); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_setStringValue); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_getBalance); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventData_setAudioPath); + +extern se::Object* __jsb_spine_EventTimeline_proto; +extern se::Class* __jsb_spine_EventTimeline_class; + +bool js_register_spine_EventTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventTimeline_setFrame); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventTimeline_getFrameCount); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventTimeline_getFrames); +SE_DECLARE_FUNC(js_cocos2dx_spine_EventTimeline_getEvents); + +extern se::Object* __jsb_spine_IkConstraint_proto; +extern se::Class* __jsb_spine_IkConstraint_class; + +bool js_register_spine_IkConstraint(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getStretch); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getCompress); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_setStretch); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_setTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_setBendDirection); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_setCompress); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getBendDirection); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_setMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraint_getData); + +extern se::Object* __jsb_spine_IkConstraintData_proto; +extern se::Class* __jsb_spine_IkConstraintData_class; + +bool js_register_spine_IkConstraintData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getBendDirection); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setUniform); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setStretch); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getUniform); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setCompress); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getStretch); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setBendDirection); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_getCompress); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintData_setTarget); + +extern se::Object* __jsb_spine_IkConstraintTimeline_proto; +extern se::Class* __jsb_spine_IkConstraintTimeline_class; + +bool js_register_spine_IkConstraintTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_IkConstraintTimeline_setFrame); + +extern se::Object* __jsb_spine_MeshAttachment_proto; +extern se::Class* __jsb_spine_MeshAttachment_class; + +bool js_register_spine_MeshAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOriginalHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOffsetY); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOffsetX); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setInheritDeform); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setParentMesh); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionRotate); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getUVs); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionU2); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionV2); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionV); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionU); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_applyDeform); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setHullLength); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOriginalHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getEdges); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionUVs); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionV2); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOriginalWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_updateUVs); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getInheritDeform); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionU2); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getHullLength); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getTriangles); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOffsetY); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOffsetX); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionV); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionRotate); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getParentMesh); +SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionU); + +extern se::Object* __jsb_spine_PathAttachment_proto; +extern se::Class* __jsb_spine_PathAttachment_class; + +bool js_register_spine_PathAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathAttachment_isConstantSpeed); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathAttachment_isClosed); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathAttachment_setConstantSpeed); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathAttachment_setClosed); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathAttachment_getLengths); + +extern se::Object* __jsb_spine_PathConstraint_proto; +extern se::Class* __jsb_spine_PathConstraint_class; + +bool js_register_spine_PathConstraint(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_setSpacing); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_setRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_setTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getTranslateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getSpacing); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_apply); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_setPosition); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getData); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_getPosition); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraint_setTranslateMix); + +extern se::Object* __jsb_spine_PathConstraintData_proto; +extern se::Class* __jsb_spine_PathConstraintData_class; + +bool js_register_spine_PathConstraintData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getOffsetRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getPositionMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getSpacingMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setSpacing); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setRotateMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getTranslateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getSpacing); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setOffsetRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getRotateMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setPosition); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getPosition); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setSpacingMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setPositionMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintData_setTranslateMix); + +extern se::Object* __jsb_spine_PathConstraintMixTimeline_proto; +extern se::Class* __jsb_spine_PathConstraintMixTimeline_class; + +bool js_register_spine_PathConstraintMixTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintMixTimeline_getPropertyId); + +extern se::Object* __jsb_spine_PathConstraintPositionTimeline_proto; +extern se::Class* __jsb_spine_PathConstraintPositionTimeline_class; + +bool js_register_spine_PathConstraintPositionTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintPositionTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintPositionTimeline_setFrame); + +extern se::Object* __jsb_spine_PathConstraintSpacingTimeline_proto; +extern se::Class* __jsb_spine_PathConstraintSpacingTimeline_class; + +bool js_register_spine_PathConstraintSpacingTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PathConstraintSpacingTimeline_getPropertyId); + +extern se::Object* __jsb_spine_PointAttachment_proto; +extern se::Class* __jsb_spine_PointAttachment_class; + +bool js_register_spine_PointAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_PointAttachment_getX); +SE_DECLARE_FUNC(js_cocos2dx_spine_PointAttachment_getY); +SE_DECLARE_FUNC(js_cocos2dx_spine_PointAttachment_getRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_PointAttachment_setRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_PointAttachment_setX); +SE_DECLARE_FUNC(js_cocos2dx_spine_PointAttachment_setY); + +extern se::Object* __jsb_spine_RegionAttachment_proto; +extern se::Class* __jsb_spine_RegionAttachment_class; + +bool js_register_spine_RegionAttachment(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOffsetY); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOffsetX); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setUVs); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getY); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getUVs); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOriginalWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setX); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setY); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getX); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getOffset); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_updateOffset); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOffsetY); +SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOffsetX); + +extern se::Object* __jsb_spine_RotateTimeline_proto; +extern se::Class* __jsb_spine_RotateTimeline_class; + +bool js_register_spine_RotateTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_RotateTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_RotateTimeline_setFrame); +SE_DECLARE_FUNC(js_cocos2dx_spine_RotateTimeline_getFrames); +SE_DECLARE_FUNC(js_cocos2dx_spine_RotateTimeline_setBoneIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_RotateTimeline_getBoneIndex); + +extern se::Object* __jsb_spine_TranslateTimeline_proto; +extern se::Class* __jsb_spine_TranslateTimeline_class; + +bool js_register_spine_TranslateTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_TranslateTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_TranslateTimeline_setFrame); + +extern se::Object* __jsb_spine_ScaleTimeline_proto; +extern se::Class* __jsb_spine_ScaleTimeline_class; + +bool js_register_spine_ScaleTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_ScaleTimeline_getPropertyId); + +extern se::Object* __jsb_spine_ShearTimeline_proto; +extern se::Class* __jsb_spine_ShearTimeline_class; + +bool js_register_spine_ShearTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_ShearTimeline_getPropertyId); + +extern se::Object* __jsb_spine_Skeleton_proto; +extern se::Class* __jsb_spine_Skeleton_class; + +bool js_register_spine_Skeleton(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findTransformConstraint); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findIkConstraint); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setBonesToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findBoneIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setSlotsToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getDrawOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getIkConstraints); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getData); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getUpdateCacheList); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getPathConstraints); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getSlots); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_printUpdateCache); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setPosition); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setX); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findBone); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getY); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getRootBone); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_updateCache); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_getTransformConstraints); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_setSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findSlot); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_updateWorldTransform); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skeleton_findPathConstraint); + +extern se::Object* __jsb_spine_SkeletonBounds_proto; +extern se::Class* __jsb_spine_SkeletonBounds_class; + +bool js_register_spine_SkeletonBounds(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_getHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_aabbintersectsSegment); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_getWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_aabbcontainsPoint); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_intersectsSegment); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_containsPoint); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonBounds_getPolygon); + +extern se::Object* __jsb_spine_Polygon_proto; +extern se::Class* __jsb_spine_Polygon_class; + +bool js_register_spine_Polygon(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); + +extern se::Object* __jsb_spine_SkeletonData_proto; +extern se::Class* __jsb_spine_SkeletonData_class; + +bool js_register_spine_SkeletonData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findEvent); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findTransformConstraint); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setFps); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findIkConstraint); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getFps); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getSkins); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setWidth); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setVersion); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setHash); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findBoneIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getDefaultSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setDefaultSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getHash); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getAnimations); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setImagesPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getIkConstraints); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getImagesPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getEvents); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findBone); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setName); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getPathConstraints); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getAudioPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getVersion); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setHeight); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getSlots); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findPathConstraintIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getTransformConstraints); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findSlot); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_setAudioPath); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_findPathConstraint); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonData_getName); + +extern se::Object* __jsb_spine_Skin_proto; +extern se::Class* __jsb_spine_Skin_class; + +bool js_register_spine_Skin(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skin_findNamesForSlot); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skin_addAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skin_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skin_getAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_Skin_findAttachmentsForSlot); + +extern se::Object* __jsb_spine_Slot_proto; +extern se::Class* __jsb_spine_Slot_class; + +bool js_register_spine_Slot(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getBone); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_setAttachmentTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getDarkColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_setToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getAttachmentTime); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_setAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getAttachmentVertices); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_hasDarkColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getSkeleton); +SE_DECLARE_FUNC(js_cocos2dx_spine_Slot_getData); + +extern se::Object* __jsb_spine_SlotData_proto; +extern se::Class* __jsb_spine_SlotData_class; + +bool js_register_spine_SlotData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getDarkColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getAttachmentName); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_setBlendMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getBlendMode); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_hasDarkColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_setHasDarkColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_setAttachmentName); +SE_DECLARE_FUNC(js_cocos2dx_spine_SlotData_getBoneData); + +extern se::Object* __jsb_spine_TransformConstraint_proto; +extern se::Class* __jsb_spine_TransformConstraint_class; + +bool js_register_spine_TransformConstraint(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getScaleMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_setRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_setTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getTranslateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_setShearMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_setScaleMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getShearMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_apply); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_getData); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraint_setTranslateMix); + +extern se::Object* __jsb_spine_TransformConstraintData_proto; +extern se::Class* __jsb_spine_TransformConstraintData_class; + +bool js_register_spine_TransformConstraintData(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOffsetRotation); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getRotateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_isLocal); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getBones); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getName); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getTranslateMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getTarget); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOffsetScaleX); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOffsetScaleY); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOffsetShearY); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOrder); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOffsetX); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getShearMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getOffsetY); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_getScaleMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintData_isRelative); + +extern se::Object* __jsb_spine_TransformConstraintTimeline_proto; +extern se::Class* __jsb_spine_TransformConstraintTimeline_class; + +bool js_register_spine_TransformConstraintTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_TransformConstraintTimeline_setFrame); + +extern se::Object* __jsb_spine_TwoColorTimeline_proto; +extern se::Class* __jsb_spine_TwoColorTimeline_class; + +bool js_register_spine_TwoColorTimeline(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_TwoColorTimeline_setSlotIndex); +SE_DECLARE_FUNC(js_cocos2dx_spine_TwoColorTimeline_getPropertyId); +SE_DECLARE_FUNC(js_cocos2dx_spine_TwoColorTimeline_setFrame); +SE_DECLARE_FUNC(js_cocos2dx_spine_TwoColorTimeline_getSlotIndex); + +extern se::Object* __jsb_spine_VertexEffect_proto; +extern se::Class* __jsb_spine_VertexEffect_class; + +bool js_register_spine_VertexEffect(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); + +extern se::Object* __jsb_spine_JitterVertexEffect_proto; +extern se::Class* __jsb_spine_JitterVertexEffect_class; + +bool js_register_spine_JitterVertexEffect(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_JitterVertexEffect_setJitterX); +SE_DECLARE_FUNC(js_cocos2dx_spine_JitterVertexEffect_setJitterY); +SE_DECLARE_FUNC(js_cocos2dx_spine_JitterVertexEffect_getJitterX); +SE_DECLARE_FUNC(js_cocos2dx_spine_JitterVertexEffect_getJitterY); + +extern se::Object* __jsb_spine_SwirlVertexEffect_proto; +extern se::Class* __jsb_spine_SwirlVertexEffect_class; + +bool js_register_spine_SwirlVertexEffect(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_setRadius); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_getAngle); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_getCenterY); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_getCenterX); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_setAngle); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_setWorldX); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_setWorldY); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_getWorldY); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_getWorldX); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_setCenterY); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_setCenterX); +SE_DECLARE_FUNC(js_cocos2dx_spine_SwirlVertexEffect_getRadius); + +extern se::Object* __jsb_spine_VertexEffectDelegate_proto; +extern se::Class* __jsb_spine_VertexEffectDelegate_class; + +bool js_register_spine_VertexEffectDelegate(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_getEffectType); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPowOut); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_initSwirlWithPow); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_initJitter); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_getSwirlVertexEffect); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_getVertexEffect); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_getJitterVertexEffect); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_clear); +SE_DECLARE_FUNC(js_cocos2dx_spine_VertexEffectDelegate_VertexEffectDelegate); + +extern se::Object* __jsb_spine_SkeletonRenderer_proto; +extern se::Class* __jsb_spine_SkeletonRenderer_class; + +bool js_register_spine_SkeletonRenderer(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setUseTint); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithUUID); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_paused); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_onEnable); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_getRenderInfoOffset); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_stopSchedule); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithJsonFile); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithBinaryFile); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithSkeleton); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_getBoundingBox); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_getDebugData); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_findBone); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_update); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_getAttachment); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setDebugMeshEnabled); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_beginSchedule); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initialize); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_getTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setSlotsRange); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_onDisable); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setColor); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setSkin); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_findSlot); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_getSkeleton); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setVertexEffectDelegate); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_SkeletonRenderer); + +extern se::Object* __jsb_spine_SkeletonAnimation_proto; +extern se::Class* __jsb_spine_SkeletonAnimation_class; + +bool js_register_spine_SkeletonAnimation(se::Object* obj); +bool register_all_cocos2dx_spine(se::Object* obj); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_findAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setMix); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_addEmptyAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setDisposeListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setAnimationStateData); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEndListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_getState); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setCompleteListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_getCurrent); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEventListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_clearTrack); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setInterruptListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_addAnimation); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setEmptyAnimations); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_clearTracks); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setStartListener); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_createWithBinaryFile); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_create); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_createWithJsonFile); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_setGlobalTimeScale); +SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonAnimation_SkeletonAnimation); #endif //#if USE_SPINE > 0 diff --git a/cocos/scripting/js-bindings/manual/jsb_classtype.hpp b/cocos/scripting/js-bindings/manual/jsb_classtype.hpp index 54366dc9aa3..88815255f7d 100644 --- a/cocos/scripting/js-bindings/manual/jsb_classtype.hpp +++ b/cocos/scripting/js-bindings/manual/jsb_classtype.hpp @@ -44,7 +44,7 @@ class JSBClassType } template - static se::Class* findClass(T* nativeObj) + static se::Class* findClass(const T* nativeObj) { bool found = false; std::string typeName = typeid(*nativeObj).name(); diff --git a/cocos/scripting/js-bindings/manual/jsb_conversions.cpp b/cocos/scripting/js-bindings/manual/jsb_conversions.cpp index 51a44a11f4d..af687b67877 100644 --- a/cocos/scripting/js-bindings/manual/jsb_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/jsb_conversions.cpp @@ -2034,18 +2034,18 @@ bool Size_to_seval(const cocos2d::Size& v, se::Value* ret) return true; } -//bool Rect_to_seval(const cocos2d::Rect& v, se::Value* ret) -//{ -// assert(ret != nullptr); -// se::HandleObject obj(se::Object::createPlainObject()); -// obj->setProperty("x", se::Value(v.origin.x)); -// obj->setProperty("y", se::Value(v.origin.y)); -// obj->setProperty("width", se::Value(v.size.width)); -// obj->setProperty("height", se::Value(v.size.height)); -// ret->setObject(obj); -// -// return true; -//} +bool Rect_to_seval(const cocos2d::Rect& v, se::Value* ret) +{ + assert(ret != nullptr); + se::HandleObject obj(se::Object::createPlainObject()); + obj->setProperty("x", se::Value(v.origin.x)); + obj->setProperty("y", se::Value(v.origin.y)); + obj->setProperty("width", se::Value(v.size.width)); + obj->setProperty("height", se::Value(v.size.height)); + ret->setObject(obj); + + return true; +} bool Color3B_to_seval(const cocos2d::Color3B& v, se::Value* ret) { @@ -2804,301 +2804,60 @@ bool std_vector_RenderTarget_to_seval(const std::vectorsetNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - obj->setProperty("name", se::Value(v->name)); - obj->setProperty("intValue", se::Value(v->intValue)); - obj->setProperty("floatValue", se::Value(v->floatValue)); - obj->setProperty("stringValue", se::Value(v->stringValue)); - ret->setObject(obj); - - return true; -} - -bool spevent_to_seval(const spEvent* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - se::Value dataVal; - SE_PRECONDITION3(speventdata_to_seval(v->data, &dataVal), false, ret->setUndefined()); - obj->setProperty("data", dataVal); - obj->setProperty("time", se::Value(v->time)); - obj->setProperty("intValue", se::Value(v->intValue)); - obj->setProperty("floatValue", se::Value(v->floatValue)); - obj->setProperty("stringValue", se::Value(v->stringValue)); - ret->setObject(obj); - - return true; -} - -bool spbonedata_to_seval(const spBoneData* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - // root haven't parent - se::Value parentVal; - if (0 != strcmp(v->name, "root") && v->parent) - { - SE_PRECONDITION3(spbonedata_to_seval(v->parent, &parentVal), false, ret->setUndefined()); - } - - obj->setProperty("index", se::Value(v->index)); - obj->setProperty("name", se::Value(v->name)); - obj->setProperty("parent", parentVal); - obj->setProperty("length", se::Value(v->length)); - obj->setProperty("x", se::Value(v->x)); - obj->setProperty("y", se::Value(v->y)); - obj->setProperty("rotation", se::Value(v->rotation)); - obj->setProperty("scaleX", se::Value(v->scaleX)); - obj->setProperty("scaleY", se::Value(v->scaleY)); - obj->setProperty("shearX", se::Value(v->shearX)); - obj->setProperty("shearY", se::Value(v->shearY)); - obj->setProperty("transformMode", se::Value(v->transformMode)); - - ret->setObject(obj); - - return true; -} - -bool spbone_to_seval(const spBone* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - // root haven't parent - se::Value parentVal; - if (0 != strcmp(v->data->name, "root") && v->parent) - { - SE_PRECONDITION3(spbone_to_seval(v->parent, &parentVal), false, ret->setUndefined()); - } - - se::Value data; - SE_PRECONDITION3(spbonedata_to_seval(v->data, &data), false, ret->setUndefined()); - - obj->setProperty("data", data); - obj->setProperty("parent", parentVal); - obj->setProperty("x", se::Value(v->x)); - obj->setProperty("y", se::Value(v->y)); - obj->setProperty("rotation", se::Value(v->rotation)); - obj->setProperty("scaleX", se::Value(v->scaleX)); - obj->setProperty("scaleY", se::Value(v->scaleY)); - obj->setProperty("shearX", se::Value(v->shearX)); - obj->setProperty("shearY", se::Value(v->shearY)); - obj->setProperty("m00", se::Value(v->a)); - obj->setProperty("m01", se::Value(v->b)); - obj->setProperty("m10", se::Value(v->c)); - obj->setProperty("m11", se::Value(v->d)); - obj->setProperty("worldX", se::Value(v->worldX)); - obj->setProperty("worldY", se::Value(v->worldY)); - - ret->setObject(obj); - - return true; -} -bool spskeleton_to_seval(const spSkeleton* v, se::Value* ret) +bool seval_to_spine_Vector_String(const se::Value& v, spine::Vector* ret) { assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - obj->setProperty("x", se::Value(v->x)); - obj->setProperty("y", se::Value(v->y)); - obj->setProperty("flipX", se::Value(v->flipX)); - obj->setProperty("flipY", se::Value(v->flipY)); - obj->setProperty("time", se::Value(v->time)); - obj->setProperty("boneCount", se::Value(v->bonesCount)); - obj->setProperty("slotCount", se::Value(v->slotsCount)); - - ret->setObject(obj); - return true; -} - -bool spattachment_to_seval(const spAttachment* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - obj->setProperty("name", se::Value(v->name)); - obj->setProperty("type", se::Value((int32_t)v->type)); - - ret->setObject(obj); - return true; -} - -bool spslotdata_to_seval(const spSlotData* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - se::Value boneData; - SE_PRECONDITION3(spbonedata_to_seval(v->boneData, &boneData), false, ret->setUndefined()); - - obj->setProperty("name", se::Value(v->name)); - obj->setProperty("attachmentName", se::Value(v->attachmentName)); - obj->setProperty("r", se::Value(v->color.r)); - obj->setProperty("g", se::Value(v->color.g)); - obj->setProperty("b", se::Value(v->color.b)); - obj->setProperty("a", se::Value(v->color.a)); - if (v->darkColor) - { - obj->setProperty("dr", se::Value(v->darkColor->r)); - obj->setProperty("dg", se::Value(v->darkColor->g)); - obj->setProperty("db", se::Value(v->darkColor->b)); - obj->setProperty("da", se::Value(v->darkColor->a)); - } - obj->setProperty("blendMode", se::Value((int32_t)v->blendMode)); - obj->setProperty("boneData", boneData); - - ret->setObject(obj); - return true; -} - -bool spslot_to_seval(const spSlot* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) - { - ret->setNull(); - return true; - } - - se::HandleObject obj(se::Object::createPlainObject()); - - se::Value bone; - SE_PRECONDITION3(spbone_to_seval(v->bone, &bone), false, ret->setUndefined()); - - se::Value attachment; - SE_PRECONDITION3(spattachment_to_seval(v->attachment, &attachment), false, ret->setUndefined()); - - se::Value data; - SE_PRECONDITION3(spslotdata_to_seval(v->data, &data), false, ret->setUndefined()); - - obj->setProperty("r", se::Value(v->color.r)); - obj->setProperty("g", se::Value(v->color.g)); - obj->setProperty("b", se::Value(v->color.b)); - obj->setProperty("a", se::Value(v->color.a)); - if (v->darkColor) - { - obj->setProperty("dr", se::Value(v->darkColor->r)); - obj->setProperty("dg", se::Value(v->darkColor->g)); - obj->setProperty("db", se::Value(v->darkColor->b)); - obj->setProperty("da", se::Value(v->darkColor->a)); - } - obj->setProperty("bone", bone); - obj->setProperty("attachment", attachment); - obj->setProperty("data", data); - - ret->setObject(obj); - - return true; -} - -bool sptimeline_to_seval(const spTimeline* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) + assert(v.isObject()); + se::Object* obj = v.toObject(); + assert(obj->isArray()); + + bool ok = true; + uint32_t len = 0; + ok = obj->getArrayLength(&len); + if (!ok) { - ret->setNull(); - return true; + ret->clear(); + return false; } - - se::HandleObject obj(se::Object::createPlainObject()); - - obj->setProperty("type", se::Value((int32_t)v->type)); - - ret->setObject(obj); - return true; -} - -bool spanimationstate_to_seval(const spAnimationState* v, se::Value* ret) -{ - assert(ret != nullptr); - if (v == nullptr) + + se::Value tmp; + for (uint32_t i = 0; i < len; ++i) { - ret->setNull(); - return true; + ok = obj->getArrayElement(i, &tmp); + if (!ok || !tmp.isObject()) + { + ret->clear(); + return false; + } + + const char* str = tmp.toString().c_str(); + ret->add(str); } - - se::HandleObject obj(se::Object::createPlainObject()); - - obj->setProperty("timeScale", se::Value(v->timeScale)); - obj->setProperty("trackCount", se::Value(v->tracksCount)); - - ret->setObject(obj); + return true; } -bool spanimation_to_seval(const spAnimation* v, se::Value* ret) +bool spine_Vector_String_to_seval(const spine::Vector& v, se::Value* ret) { assert(ret != nullptr); - if (v == nullptr) + se::HandleObject obj(se::Object::createArrayObject(v.size())); + bool ok = true; + + spine::Vector tmpv = v; + for (uint32_t i = 0, count = (uint32_t)tmpv.size(); i < count; i++) { - ret->setNull(); - return true; + if (!obj->setArrayElement(i, se::Value(tmpv[i].buffer()))) + { + ok = false; + ret->setUndefined(); + break; + } } - - se::HandleObject obj(se::Object::createPlainObject()); - - se::Value timelines; - SE_PRECONDITION3(sptimeline_to_seval(*v->timelines, &timelines), false, ret->setUndefined()); - - obj->setProperty("name", se::Value(v->name)); - obj->setProperty("duration", se::Value(v->duration)); - obj->setProperty("timelineCount", se::Value(v->timelinesCount)); - obj->setProperty("timelines", timelines); - + + if (ok) ret->setObject(obj); - return true; -} - -bool sptrackentry_to_seval(const spTrackEntry* v, se::Value* ret) -{ - return native_ptr_to_rooted_seval((spTrackEntry*)v, ret); + + return ok; } #endif diff --git a/cocos/scripting/js-bindings/manual/jsb_conversions.hpp b/cocos/scripting/js-bindings/manual/jsb_conversions.hpp index 9d8011301f7..ad4f744f315 100644 --- a/cocos/scripting/js-bindings/manual/jsb_conversions.hpp +++ b/cocos/scripting/js-bindings/manual/jsb_conversions.hpp @@ -274,7 +274,7 @@ bool Vec3_to_seval(const cocos2d::Vec3& v, se::Value* ret); bool Vec4_to_seval(const cocos2d::Vec4& v, se::Value* ret); bool Mat4_to_seval(const cocos2d::Mat4& v, se::Value* ret); bool Size_to_seval(const cocos2d::Size& v, se::Value* ret); -//bool Rect_to_seval(const cocos2d::Rect& v, se::Value* ret); +bool Rect_to_seval(const cocos2d::Rect& v, se::Value* ret); bool Color3B_to_seval(const cocos2d::Color3B& v, se::Value* ret); bool Color4B_to_seval(const cocos2d::Color4B& v, se::Value* ret); bool Color3F_to_seval(const cocos2d::Color3F& v, se::Value* ret); @@ -347,7 +347,7 @@ bool native_ptr_to_seval(typename std::enable_if -bool native_ptr_to_rooted_seval(typename std::enable_if::value,T>::type* v, se::Value* ret, bool* isReturnCachedValue = nullptr) +bool native_ptr_to_rooted_seval(const typename std::enable_if::value,T>::type* v, se::Value* ret, bool* isReturnCachedValue = nullptr) { assert(ret != nullptr); if (v == nullptr) @@ -357,14 +357,14 @@ bool native_ptr_to_rooted_seval(typename std::enable_if(v); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); obj->root(); - obj->setPrivateData(v); + obj->setPrivateData((void*)v); if (isReturnCachedValue != nullptr) { @@ -584,18 +584,91 @@ bool Vector_to_seval(const cocos2d::Vector& v, se::Value* ret) // Spine conversions #if USE_SPINE -bool speventdata_to_seval(const spEventData* v, se::Value* ret); -bool spevent_to_seval(const spEvent* v, se::Value* ret); -bool spbonedata_to_seval(const spBoneData* v, se::Value* ret); -bool spbone_to_seval(const spBone* v, se::Value* ret); -bool spskeleton_to_seval(const spSkeleton* v, se::Value* ret); -bool spattachment_to_seval(const spAttachment* v, se::Value* ret); -bool spslotdata_to_seval(const spSlotData* v, se::Value* ret); -bool spslot_to_seval(const spSlot* v, se::Value* ret); -bool sptimeline_to_seval(const spTimeline* v, se::Value* ret); -bool spanimationstate_to_seval(const spAnimationState* v, se::Value* ret); -bool spanimation_to_seval(const spAnimation* v, se::Value* ret); -bool sptrackentry_to_seval(const spTrackEntry* v, se::Value* ret); + +template +bool spine_Vector_T_to_seval(const spine::Vector& v, se::Value* ret) +{ + assert(ret != nullptr); + se::HandleObject obj(se::Object::createArrayObject(v.size())); + bool ok = true; + + spine::Vector tmpv = v; + for (uint32_t i = 0, count = (uint32_t)tmpv.size(); i < count; i++) + { + if (!obj->setArrayElement(i, se::Value(tmpv[i]))) + { + ok = false; + ret->setUndefined(); + break; + } + } + + if (ok) + ret->setObject(obj); + + return ok; +} + +template +bool spine_Vector_T_ptr_to_seval(const spine::Vector& v, se::Value* ret) +{ + assert(ret != nullptr); + se::HandleObject obj(se::Object::createArrayObject(v.size())); + bool ok = true; + + spine::Vector tmpv = v; + for (uint32_t i = 0, count = (uint32_t)tmpv.size(); i < count; i++) + { + se::Value tmp; + ok = native_ptr_to_rooted_seval(tmpv[i], &tmp); + if (!ok || !obj->setArrayElement(i, tmp)) + { + ok = false; + ret->setUndefined(); + break; + } + } + + if (ok) ret->setObject(obj); + return ok; +} + +template +bool seval_to_spine_Vector_T_ptr(const se::Value& v, spine::Vector* ret) +{ + assert(ret != nullptr); + assert(v.isObject()); + se::Object* obj = v.toObject(); + assert(obj->isArray()); + + bool ok = true; + uint32_t len = 0; + ok = obj->getArrayLength(&len); + if (!ok) + { + ret->clear(); + return false; + } + + se::Value tmp; + for (uint32_t i = 0; i < len; ++i) + { + ok = obj->getArrayElement(i, &tmp); + if (!ok || !tmp.isObject()) + { + ret->clear(); + return false; + } + + T* nativeObj = (T*)tmp.toObject()->getPrivateData(); + ret->add(nativeObj); + } + + return true; +} + +bool seval_to_spine_Vector_String(const se::Value& v, spine::Vector* ret); +bool spine_Vector_String_to_seval(const spine::Vector& v, se::Value* ret); #endif // diff --git a/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp b/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp index 643b7f86ace..512b0e5f5e6 100644 --- a/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp +++ b/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp @@ -44,344 +44,16 @@ #include "middleware-adapter.h" #include "spine-creator-support/SkeletonDataMgr.h" -#include "spine-creator-support/SpineRenderer.h" +#include "spine-creator-support/SkeletonRenderer.h" #include "spine-creator-support/spine-cocos2dx.h" -#include "spine-creator-support/CreatorAttachmentLoader.h" -#include "spine/extension.h" #include "cocos2d.h" #include "cocos/editor-support/spine/spine.h" +#include "cocos/editor-support/spine-creator-support/spine-cocos2dx.h" using namespace cocos2d; -// TrackEntry registration - -se::Class* __jsb_spine_TrackEntry_class = nullptr; -se::Object* __jsb_spine_TrackEntry_proto = nullptr; - -static bool jsb_spine_TrackEntry_finalize(se::State& s) -{ - CCLOGINFO("jsbindings: finalizing JS object %p (spTrackEntry)", s.nativeThisObject()); - return true; -} -SE_BIND_FINALIZE_FUNC(jsb_spine_TrackEntry_finalize) - -static bool jsb_spine_TrackEntry_constructor(se::State& s) -{ - assert(false); - return true; -} -SE_BIND_CTOR(jsb_spine_TrackEntry_constructor, __jsb_spine_TrackEntry_class, jsb_spine_TrackEntry_finalize) - -static bool jsb_spine_TrackEntry_get_mixingFrom(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - if (cobj->mixingFrom) - { - bool ok = sptrackentry_to_seval(cobj->mixingFrom, &s.rval()); - SE_PRECONDITION2(ok, false, "Converting track entry failed!"); - return true; - } - s.rval().setNull(); - return true; -} -SE_BIND_FUNC(jsb_spine_TrackEntry_get_mixingFrom) - -static bool jsb_spine_TrackEntry_get_next(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - if (cobj->next) - { - bool ok = sptrackentry_to_seval(cobj->next, &s.rval()); - SE_PRECONDITION2(ok, false, "Converting track entry failed!"); - return true; - } - s.rval().setNull(); - return true; -} -SE_BIND_FUNC(jsb_spine_TrackEntry_get_next) - -static bool jsb_spine_TrackEntry_get_trackIndex(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setInt32(cobj->trackIndex); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_trackIndex) - -static bool jsb_spine_TrackEntry_get_loop(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setInt32(cobj->loop); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_loop) - -static bool jsb_spine_TrackEntry_get_eventThreshold(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->eventThreshold); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_eventThreshold) - -static bool jsb_spine_TrackEntry_get_attachmentThreshold(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->attachmentThreshold); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_attachmentThreshold) - -static bool jsb_spine_TrackEntry_get_drawOrderThreshold(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->drawOrderThreshold); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_drawOrderThreshold) - -static bool jsb_spine_TrackEntry_get_animationStart(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->animationStart); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_animationStart) - -static bool jsb_spine_TrackEntry_get_animationEnd(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->animationEnd); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_animationEnd) - -static bool jsb_spine_TrackEntry_get_animationLast(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->animationLast); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_animationLast) - -static bool jsb_spine_TrackEntry_get_nextAnimationLast(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->nextAnimationLast); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_nextAnimationLast) - -static bool jsb_spine_TrackEntry_get_delay(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->delay); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_delay) - -static bool jsb_spine_TrackEntry_get_trackTime(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->trackTime); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_trackTime) - -static bool jsb_spine_TrackEntry_get_trackLast(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->trackLast); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_trackLast) - -static bool jsb_spine_TrackEntry_get_nextTrackLast(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->nextTrackLast); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_nextTrackLast) - -static bool jsb_spine_TrackEntry_get_trackEnd(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->trackEnd); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_trackEnd) - -static bool jsb_spine_TrackEntry_get_timeScale(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->timeScale); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_timeScale) - -static bool jsb_spine_TrackEntry_get_alpha(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->alpha); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_alpha) - -static bool jsb_spine_TrackEntry_get_mixTime(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->mixTime); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_mixTime) - -static bool jsb_spine_TrackEntry_get_mixDuration(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->mixDuration); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_mixDuration) - -static bool jsb_spine_TrackEntry_get_mixAlpha(se::State& s) -{ - s.rval().setFloat(0); - CCLOGWARN("spTrackEntry's mixAlpha property is discard!!!!!!"); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_mixAlpha) - -static bool jsb_spine_TrackEntry_get_timelinesFirstCount(se::State& s) -{ - s.rval().setInt32(0); - CCLOGWARN("spTrackEntry's timelinesFirstCount property is discard!!!!!!"); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_timelinesFirstCount) - -static bool jsb_spine_TrackEntry_get_interruptAlpha(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->interruptAlpha); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_interruptAlpha) - -static bool jsb_spine_TrackEntry_get_totalAlpha(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setFloat(cobj->totalAlpha); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_totalAlpha) - -static bool jsb_spine_TrackEntry_get_timelinesRotationCount(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - s.rval().setInt32(cobj->timelinesRotationCount); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_timelinesRotationCount) - -static bool jsb_spine_TrackEntry_get_animation(se::State& s) -{ - spTrackEntry* cobj = (spTrackEntry*) s.nativeThisObject(); - - SE_PRECONDITION2(spanimation_to_seval(cobj->animation, &s.rval()), false, "Converting spAnimation failed!"); - return true; -} -SE_BIND_PROP_GET(jsb_spine_TrackEntry_get_animation) - -static bool js_register_spine_TrackEntry(se::Object* obj) -{ - se::Class* cls = se::Class::create("TrackEntry", obj, nullptr, _SE(jsb_spine_TrackEntry_constructor)); - cls->defineFunction("mixingFrom", _SE(jsb_spine_TrackEntry_get_mixingFrom)); - cls->defineFunction("next", _SE(jsb_spine_TrackEntry_get_next)); - - cls->defineProperty("delay", _SE(jsb_spine_TrackEntry_get_delay), nullptr); - cls->defineProperty("trackIndex", _SE(jsb_spine_TrackEntry_get_trackIndex), nullptr); - cls->defineProperty("loop", _SE(jsb_spine_TrackEntry_get_loop), nullptr); - cls->defineProperty("eventThreshold", _SE(jsb_spine_TrackEntry_get_eventThreshold), nullptr); - cls->defineProperty("attachmentThreshold", _SE(jsb_spine_TrackEntry_get_attachmentThreshold), nullptr); - cls->defineProperty("drawOrderThreshold", _SE(jsb_spine_TrackEntry_get_drawOrderThreshold), nullptr); - cls->defineProperty("animationStart", _SE(jsb_spine_TrackEntry_get_animationStart), nullptr); - cls->defineProperty("animationEnd", _SE(jsb_spine_TrackEntry_get_animationEnd), nullptr); - cls->defineProperty("animationLast", _SE(jsb_spine_TrackEntry_get_animationLast), nullptr); - cls->defineProperty("nextAnimationLast", _SE(jsb_spine_TrackEntry_get_nextAnimationLast), nullptr); - cls->defineProperty("trackTime", _SE(jsb_spine_TrackEntry_get_trackTime), nullptr); - cls->defineProperty("trackLast", _SE(jsb_spine_TrackEntry_get_trackLast), nullptr); - cls->defineProperty("nextTrackLast", _SE(jsb_spine_TrackEntry_get_nextTrackLast), nullptr); - cls->defineProperty("trackEnd", _SE(jsb_spine_TrackEntry_get_trackEnd), nullptr); - cls->defineProperty("timeScale", _SE(jsb_spine_TrackEntry_get_timeScale), nullptr); - cls->defineProperty("alpha", _SE(jsb_spine_TrackEntry_get_alpha), nullptr); - cls->defineProperty("mixTime", _SE(jsb_spine_TrackEntry_get_mixTime), nullptr); - cls->defineProperty("mixDuration", _SE(jsb_spine_TrackEntry_get_mixDuration), nullptr); - cls->defineProperty("mixAlpha", _SE(jsb_spine_TrackEntry_get_mixAlpha), nullptr); - cls->defineProperty("interruptAlpha", _SE(jsb_spine_TrackEntry_get_interruptAlpha), nullptr); - cls->defineProperty("totalAlpha", _SE(jsb_spine_TrackEntry_get_totalAlpha), nullptr); - cls->defineProperty("timelinesFirstCount", _SE(jsb_spine_TrackEntry_get_timelinesFirstCount), nullptr); - cls->defineProperty("timelinesRotationCount", _SE(jsb_spine_TrackEntry_get_timelinesRotationCount), nullptr); - cls->defineProperty("animation", _SE(jsb_spine_TrackEntry_get_animation), nullptr); - - cls->defineFinalizeFunction(_SE(jsb_spine_TrackEntry_finalize)); - cls->install(); - - JSBClassType::registerClass(cls); - __jsb_spine_TrackEntry_class = cls; - __jsb_spine_TrackEntry_proto = cls->getProto(); - - spTrackEntry_setDisposeCallback([](spTrackEntry* entry){ - se::Object* seObj = nullptr; - - auto iter = se::NativePtrToObjectMap::find(entry); - if (iter != se::NativePtrToObjectMap::end()) - { - // Save se::Object pointer for being used in cleanup method. - seObj = iter->second; - // Unmap native and js object since native object was destroyed. - // Otherwise, it may trigger 'assertion' in se::Object::setPrivateData later - // since native obj is already released and the new native object may be assigned with - // the same address. - se::NativePtrToObjectMap::erase(iter); - } - else - { - return; - } - - auto cleanup = [seObj](){ - - auto se = se::ScriptEngine::getInstance(); - if (!se->isValid() || se->isInCleanup()) - return; - - se::AutoHandleScope hs; - se->clearException(); - - // The mapping of native object & se::Object was cleared in above code. - // The private data (native object) may be a different object associated with other se::Object. - // Therefore, don't clear the mapping again. - seObj->clearPrivateData(false); - seObj->unroot(); - seObj->decRef(); - }; - - if (!se::ScriptEngine::getInstance()->isGarbageCollecting()) - { - cleanup(); - } - else - { - CleanupTask::pushTaskToAutoReleasePool(cleanup); - } - }); - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - +static spine::Cocos2dTextureLoader textureLoader; static cocos2d::Map* _preloadedAtlasTextures = nullptr; static middleware::Texture2D* _getPreloadedAtlasTexture(const char* path) { @@ -428,21 +100,32 @@ static bool js_register_spine_initSkeletonData (se::State& s) _preloadedAtlasTextures = &textures; spine::spAtlasPage_setCustomTextureLoader(_getPreloadedAtlasTexture); - - spAtlas* atlas = spAtlas_create(atlasText.c_str(), (int)atlasText.size(), "", nullptr); - CCASSERT(atlas, "Error creating atlas."); + + spine::Atlas* atlas = new (__FILE__, __LINE__) spine::Atlas(atlasText.c_str(), (int)atlasText.size(), "", &textureLoader); _preloadedAtlasTextures = nullptr; spine::spAtlasPage_setCustomTextureLoader(nullptr); - spAttachmentLoader* attachmentLoader = SUPER(CreatorAttachmentLoader_create(atlas)); - spSkeletonJson* json = spSkeletonJson_createWithLoader(attachmentLoader); - json->scale = scale; - spSkeletonData* skeletonData = spSkeletonJson_readSkeletonData(json, skeletonDataFile.c_str()); - CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data."); - spSkeletonJson_dispose(json); - - mgr->setSkeletonData(uuid, skeletonData, atlas, attachmentLoader); + spine::AttachmentLoader* attachmentLoader = new (__FILE__, __LINE__) spine::Cocos2dAtlasAttachmentLoader(atlas); + spine::SkeletonJson* json = new (__FILE__, __LINE__) spine::SkeletonJson(attachmentLoader); + json->setScale(scale); + spine::SkeletonData* skeletonData = json->readSkeletonData(skeletonDataFile.c_str()); + CCASSERT(skeletonData, !json->getError().isEmpty() ? json->getError().buffer() : "Error reading skeleton data."); + delete json; + + if (skeletonData) { + mgr->setSkeletonData(uuid, skeletonData, atlas, attachmentLoader); + native_ptr_to_rooted_seval((spine::SkeletonData*)skeletonData, &s.rval()); + } else { + if (atlas) { + delete atlas; + atlas = nullptr; + } + if (attachmentLoader) { + delete attachmentLoader; + attachmentLoader = nullptr; + } + } return true; } SE_BIND_FUNC(js_register_spine_initSkeletonData) @@ -480,7 +163,7 @@ static bool js_register_spine_initSkeletonRenderer(se::State& s) } bool ok = false; - spine::SpineRenderer* node = nullptr; + spine::SkeletonRenderer* node = nullptr; ok = seval_to_native_ptr(args[0], &node); SE_PRECONDITION2(ok, false, "js_register_spine_initSkeletonData: Converting SpineRenderer failed!"); @@ -512,7 +195,55 @@ bool register_all_spine_manual(se::Object* obj) ns->defineFunction("initSkeletonRenderer", _SE(js_register_spine_initSkeletonRenderer)); ns->defineFunction("initSkeletonData", _SE(js_register_spine_initSkeletonData)); ns->defineFunction("disposeSkeletonData", _SE(js_register_spine_disposeSkeletonData)); - js_register_spine_TrackEntry(ns); + + spine::setSpineObjectDisposeCallback([](void* spineObj){ + se::Object* seObj = nullptr; + + auto iter = se::NativePtrToObjectMap::find(spineObj); + if (iter != se::NativePtrToObjectMap::end()) + { + // Save se::Object pointer for being used in cleanup method. + seObj = iter->second; + // Unmap native and js object since native object was destroyed. + // Otherwise, it may trigger 'assertion' in se::Object::setPrivateData later + // since native obj is already released and the new native object may be assigned with + // the same address. + se::NativePtrToObjectMap::erase(iter); + } + else + { + return; + } + + auto cleanup = [seObj](){ + + auto se = se::ScriptEngine::getInstance(); + if (!se->isValid() || se->isInCleanup()) + return; + + se::AutoHandleScope hs; + se->clearException(); + + // The mapping of native object & se::Object was cleared in above code. + // The private data (native object) may be a different object associated with other se::Object. + // Therefore, don't clear the mapping again. + seObj->clearPrivateData(false); + seObj->unroot(); + seObj->decRef(); + }; + + if (!se::ScriptEngine::getInstance()->isGarbageCollecting()) + { + cleanup(); + } + else + { + CleanupTask::pushTaskToAutoReleasePool(cleanup); + } + }); + + se::ScriptEngine::getInstance()->clearException(); + return true; } diff --git a/licenses/LICENSE_spine.txt b/licenses/LICENSE_spine.txt index daceab94a4c..4501a611fdc 100644 --- a/licenses/LICENSE_spine.txt +++ b/licenses/LICENSE_spine.txt @@ -1,27 +1,26 @@ -Spine Runtimes Software License v2.5 +Spine Runtimes License Agreement +Last updated May 1, 2019. Replaces all prior versions. -Copyright (c) 2013-2016, Esoteric Software -All rights reserved. +Copyright (c) 2013-2019, Esoteric Software LLC -You are granted a perpetual, non-exclusive, non-sublicensable, and -non-transferable license to use, install, execute, and perform the Spine -Runtimes software and derivative works solely for personal or internal -use. Without the written permission of Esoteric Software (see Section 2 of -the Spine Software License Agreement), you may not (a) modify, translate, -adapt, or develop new applications using the Spine Runtimes or otherwise -create derivative works or improvements of the Spine Runtimes or (b) remove, -delete, alter, or obscure any trademarks or any copyright, trademark, patent, -or other intellectual property or proprietary rights notices on or in the -Software, including any copy thereof. Redistributions in binary or source -form must include this license and terms. +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 -THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF -USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +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. \ No newline at end of file diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 59b636665c5..cea7b3a36eb 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -244,96 +244,157 @@ "cocos/editor-support/middleware-adapter.h", "cocos/editor-support/spine-creator-support/AttachmentVertices.cpp", "cocos/editor-support/spine-creator-support/AttachmentVertices.h", - "cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.cpp", - "cocos/editor-support/spine-creator-support/CreatorAttachmentLoader.h", + "cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp", + "cocos/editor-support/spine-creator-support/SkeletonAnimation.h", "cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp", "cocos/editor-support/spine-creator-support/SkeletonDataMgr.h", - "cocos/editor-support/spine-creator-support/SpineAnimation.cpp", - "cocos/editor-support/spine-creator-support/SpineAnimation.h", - "cocos/editor-support/spine-creator-support/SpineRenderer.cpp", - "cocos/editor-support/spine-creator-support/SpineRenderer.h", + "cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp", + "cocos/editor-support/spine-creator-support/SkeletonRenderer.h", + "cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp", + "cocos/editor-support/spine-creator-support/VertexEffectDelegate.h", "cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp", "cocos/editor-support/spine-creator-support/spine-cocos2dx.h", - "cocos/editor-support/spine/Animation.c", + "cocos/editor-support/spine/Animation.cpp", "cocos/editor-support/spine/Animation.h", - "cocos/editor-support/spine/AnimationState.c", + "cocos/editor-support/spine/AnimationState.cpp", "cocos/editor-support/spine/AnimationState.h", - "cocos/editor-support/spine/AnimationStateData.c", + "cocos/editor-support/spine/AnimationStateData.cpp", "cocos/editor-support/spine/AnimationStateData.h", - "cocos/editor-support/spine/Array.c", - "cocos/editor-support/spine/Array.h", - "cocos/editor-support/spine/Atlas.c", + "cocos/editor-support/spine/Atlas.cpp", "cocos/editor-support/spine/Atlas.h", - "cocos/editor-support/spine/AtlasAttachmentLoader.c", + "cocos/editor-support/spine/AtlasAttachmentLoader.cpp", "cocos/editor-support/spine/AtlasAttachmentLoader.h", - "cocos/editor-support/spine/Attachment.c", + "cocos/editor-support/spine/Attachment.cpp", "cocos/editor-support/spine/Attachment.h", - "cocos/editor-support/spine/AttachmentLoader.c", + "cocos/editor-support/spine/AttachmentLoader.cpp", "cocos/editor-support/spine/AttachmentLoader.h", - "cocos/editor-support/spine/Bone.c", + "cocos/editor-support/spine/AttachmentTimeline.cpp", + "cocos/editor-support/spine/AttachmentTimeline.h", + "cocos/editor-support/spine/AttachmentType.h", + "cocos/editor-support/spine/BlendMode.h", + "cocos/editor-support/spine/Bone.cpp", "cocos/editor-support/spine/Bone.h", - "cocos/editor-support/spine/BoneData.c", + "cocos/editor-support/spine/BoneData.cpp", "cocos/editor-support/spine/BoneData.h", - "cocos/editor-support/spine/BoundingBoxAttachment.c", + "cocos/editor-support/spine/BoundingBoxAttachment.cpp", "cocos/editor-support/spine/BoundingBoxAttachment.h", - "cocos/editor-support/spine/ClippingAttachment.c", + "cocos/editor-support/spine/ClippingAttachment.cpp", "cocos/editor-support/spine/ClippingAttachment.h", - "cocos/editor-support/spine/Color.c", "cocos/editor-support/spine/Color.h", - "cocos/editor-support/spine/Event.c", + "cocos/editor-support/spine/ColorTimeline.cpp", + "cocos/editor-support/spine/ColorTimeline.h", + "cocos/editor-support/spine/Constraint.cpp", + "cocos/editor-support/spine/Constraint.h", + "cocos/editor-support/spine/ContainerUtil.h", + "cocos/editor-support/spine/CurveTimeline.cpp", + "cocos/editor-support/spine/CurveTimeline.h", + "cocos/editor-support/spine/Debug.h", + "cocos/editor-support/spine/DeformTimeline.cpp", + "cocos/editor-support/spine/DeformTimeline.h", + "cocos/editor-support/spine/DrawOrderTimeline.cpp", + "cocos/editor-support/spine/DrawOrderTimeline.h", + "cocos/editor-support/spine/Event.cpp", "cocos/editor-support/spine/Event.h", - "cocos/editor-support/spine/EventData.c", + "cocos/editor-support/spine/EventData.cpp", "cocos/editor-support/spine/EventData.h", - "cocos/editor-support/spine/IkConstraint.c", + "cocos/editor-support/spine/EventTimeline.cpp", + "cocos/editor-support/spine/EventTimeline.h", + "cocos/editor-support/spine/Extension.cpp", + "cocos/editor-support/spine/HasRendererObject.h", + "cocos/editor-support/spine/HashMap.h", + "cocos/editor-support/spine/IkConstraint.cpp", "cocos/editor-support/spine/IkConstraint.h", - "cocos/editor-support/spine/IkConstraintData.c", + "cocos/editor-support/spine/IkConstraintData.cpp", "cocos/editor-support/spine/IkConstraintData.h", - "cocos/editor-support/spine/Json.c", + "cocos/editor-support/spine/IkConstraintTimeline.cpp", + "cocos/editor-support/spine/IkConstraintTimeline.h", + "cocos/editor-support/spine/Json.cpp", "cocos/editor-support/spine/Json.h", - "cocos/editor-support/spine/MeshAttachment.c", + "cocos/editor-support/spine/LinkedMesh.cpp", + "cocos/editor-support/spine/LinkedMesh.h", + "cocos/editor-support/spine/MathUtil.cpp", + "cocos/editor-support/spine/MathUtil.h", + "cocos/editor-support/spine/MeshAttachment.cpp", "cocos/editor-support/spine/MeshAttachment.h", - "cocos/editor-support/spine/PathAttachment.c", + "cocos/editor-support/spine/MixBlend.h", + "cocos/editor-support/spine/MixDirection.h", + "cocos/editor-support/spine/PathAttachment.cpp", "cocos/editor-support/spine/PathAttachment.h", - "cocos/editor-support/spine/PathConstraint.c", + "cocos/editor-support/spine/PathConstraint.cpp", "cocos/editor-support/spine/PathConstraint.h", - "cocos/editor-support/spine/PathConstraintData.c", + "cocos/editor-support/spine/PathConstraintData.cpp", "cocos/editor-support/spine/PathConstraintData.h", - "cocos/editor-support/spine/PointAttachment.c", + "cocos/editor-support/spine/PathConstraintMixTimeline.cpp", + "cocos/editor-support/spine/PathConstraintMixTimeline.h", + "cocos/editor-support/spine/PathConstraintPositionTimeline.cpp", + "cocos/editor-support/spine/PathConstraintPositionTimeline.h", + "cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp", + "cocos/editor-support/spine/PathConstraintSpacingTimeline.h", + "cocos/editor-support/spine/PointAttachment.cpp", "cocos/editor-support/spine/PointAttachment.h", - "cocos/editor-support/spine/RegionAttachment.c", + "cocos/editor-support/spine/Pool.h", + "cocos/editor-support/spine/PositionMode.h", + "cocos/editor-support/spine/RTTI.cpp", + "cocos/editor-support/spine/RTTI.h", + "cocos/editor-support/spine/RegionAttachment.cpp", "cocos/editor-support/spine/RegionAttachment.h", - "cocos/editor-support/spine/Skeleton.c", + "cocos/editor-support/spine/RotateMode.h", + "cocos/editor-support/spine/RotateTimeline.cpp", + "cocos/editor-support/spine/RotateTimeline.h", + "cocos/editor-support/spine/ScaleTimeline.cpp", + "cocos/editor-support/spine/ScaleTimeline.h", + "cocos/editor-support/spine/ShearTimeline.cpp", + "cocos/editor-support/spine/ShearTimeline.h", + "cocos/editor-support/spine/Skeleton.cpp", "cocos/editor-support/spine/Skeleton.h", - "cocos/editor-support/spine/SkeletonBinary.c", + "cocos/editor-support/spine/SkeletonBinary.cpp", "cocos/editor-support/spine/SkeletonBinary.h", - "cocos/editor-support/spine/SkeletonBounds.c", + "cocos/editor-support/spine/SkeletonBounds.cpp", "cocos/editor-support/spine/SkeletonBounds.h", - "cocos/editor-support/spine/SkeletonClipping.c", + "cocos/editor-support/spine/SkeletonClipping.cpp", "cocos/editor-support/spine/SkeletonClipping.h", - "cocos/editor-support/spine/SkeletonData.c", + "cocos/editor-support/spine/SkeletonData.cpp", "cocos/editor-support/spine/SkeletonData.h", - "cocos/editor-support/spine/SkeletonJson.c", + "cocos/editor-support/spine/SkeletonJson.cpp", "cocos/editor-support/spine/SkeletonJson.h", - "cocos/editor-support/spine/Skin.c", + "cocos/editor-support/spine/Skin.cpp", "cocos/editor-support/spine/Skin.h", - "cocos/editor-support/spine/Slot.c", + "cocos/editor-support/spine/Slot.cpp", "cocos/editor-support/spine/Slot.h", - "cocos/editor-support/spine/SlotData.c", + "cocos/editor-support/spine/SlotData.cpp", "cocos/editor-support/spine/SlotData.h", - "cocos/editor-support/spine/TransformConstraint.c", + "cocos/editor-support/spine/SpacingMode.h", + "cocos/editor-support/spine/SpineObject.cpp", + "cocos/editor-support/spine/SpineObject.h", + "cocos/editor-support/spine/SpineString.h", + "cocos/editor-support/spine/TextureLoader.cpp", + "cocos/editor-support/spine/TextureLoader.h", + "cocos/editor-support/spine/Timeline.cpp", + "cocos/editor-support/spine/Timeline.h", + "cocos/editor-support/spine/TimelineType.h", + "cocos/editor-support/spine/TransformConstraint.cpp", "cocos/editor-support/spine/TransformConstraint.h", - "cocos/editor-support/spine/TransformConstraintData.c", + "cocos/editor-support/spine/TransformConstraintData.cpp", "cocos/editor-support/spine/TransformConstraintData.h", - "cocos/editor-support/spine/Triangulator.c", + "cocos/editor-support/spine/TransformConstraintTimeline.cpp", + "cocos/editor-support/spine/TransformConstraintTimeline.h", + "cocos/editor-support/spine/TransformMode.h", + "cocos/editor-support/spine/TranslateTimeline.cpp", + "cocos/editor-support/spine/TranslateTimeline.h", + "cocos/editor-support/spine/Triangulator.cpp", "cocos/editor-support/spine/Triangulator.h", - "cocos/editor-support/spine/VertexAttachment.c", + "cocos/editor-support/spine/TwoColorTimeline.cpp", + "cocos/editor-support/spine/TwoColorTimeline.h", + "cocos/editor-support/spine/Updatable.cpp", + "cocos/editor-support/spine/Updatable.h", + "cocos/editor-support/spine/Vector.h", + "cocos/editor-support/spine/VertexAttachment.cpp", "cocos/editor-support/spine/VertexAttachment.h", - "cocos/editor-support/spine/VertexEffect.c", + "cocos/editor-support/spine/VertexEffect.cpp", "cocos/editor-support/spine/VertexEffect.h", + "cocos/editor-support/spine/Vertices.h", "cocos/editor-support/spine/dll.h", - "cocos/editor-support/spine/extension.c", "cocos/editor-support/spine/extension.h", - "cocos/editor-support/spine/kvec.h", "cocos/editor-support/spine/spine.h", "cocos/math/CCGeometry.cpp", "cocos/math/CCGeometry.h", diff --git a/tools/bindings-generator b/tools/bindings-generator index 3cc2c05f513..08835337941 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 3cc2c05f513a1210d336e84b653732bd3ff5285d +Subproject commit 0883533794159690dfd06a37bb13332b9ee3f658 diff --git a/tools/tojs/cocos2dx_spine.ini b/tools/tojs/cocos2dx_spine.ini index 3aafd0a9cf3..9ab2776a81b 100644 --- a/tools/tojs/cocos2dx_spine.ini +++ b/tools/tojs/cocos2dx_spine.ini @@ -24,23 +24,65 @@ headers = %(cocosdir)s/cocos/editor-support/spine-creator-support/spine-cocos2dx replace_headers = spine-cocos2dx.h::spine-creator-support/spine-cocos2dx.h -classes = SpineRenderer SpineAnimation - -classes_need_extend = SpineAnimation - -skip = SpineRenderer::[create createWithData initWithData createWithSkeleton createWithFile], - SpineAnimation::[createWithData onTrackEntryEvent onAnimationStateEvent setTrackStartListener setTrackEndListener setTrackInterruptListener setTrackDisposeListener setTrackCompleteListener setTrackEventListener] +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 + +classes_need_extend = SkeletonAnimation + +skip = SkeletonRenderer::[create createWithData initWithData createWithSkeleton createWithFile], + SkeletonAnimation::[createWithData onTrackEntryEvent onAnimationStateEvent setTrackStartListener setTrackEndListener setTrackInterruptListener setTrackDisposeListener setTrackCompleteListener setTrackEventListener], + Animation::[apply], + TrackEntry::[setListener], + AnimationState::[apply setListener], + Attachment::[getRTTI], + AttachmentTimeline::[apply getRTTI], + BoundingBoxAttachment::[getRTTI], + Bone::[worldToLocal localToWorld getRTTI], + ClippingAttachment::[getRTTI], + Color::[set add], + ColorTimeline::[apply getRTTI], + CurveTimeline::[apply getRTTI], + DeformTimeline::[apply setFrame getVertices getRTTI], + DrawOrderTimeline::[apply setFrame getDrawOrders getRTTI], + EventTimeline::[apply getRTTI], + IkConstraint::[apply getRTTI], + IkConstraintTimeline::[apply getRTTI], + MeshAttachment::[getRTTI], + PathAttachment::[getRTTI], + PathConstraint::[getRTTI], + PathConstraintMixTimeline::[apply getRTTI], + PathConstraintPositionTimeline::[apply getRTTI], + PathConstraintSpacingTimeline::[apply getRTTI], + PointAttachment::[computeWorldPosition getRTTI computeWorldRotation], + RegionAttachment::[computeWorldVertices getRTTI], + RotateTimeline::[apply getRTTI], + ScaleTimeline::[apply getRTTI], + ShearTimeline::[apply getRTTI], + Skeleton::[getBounds], + Skin::[getAttachments], + SkeletonBounds::[update aabbIntersectsSkeleton], + Timeline::[apply getRTTI], + TransformConstraint::[getRTTI], + TransformConstraintTimeline::[apply getRTTI], + TranslateTimeline::[apply getRTTI], + TwoColorTimeline::[apply getRTTI], + VertexEffect::[begin transform end], + JitterVertexEffect::[begin transform end], + SwirlVertexEffect::[begin transform end], + VertexAttachment::[computeWorldVertices getBones getRTTI] + +field = Color::[r g b a] remove_prefix = classes_have_no_parents = -base_classes_to_skip = Ref IMiddleware +base_classes_to_skip = Ref IMiddleware SpineObject HasRendererObject Updatable Constraint -abstract_classes = +abstract_classes = 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 SlotData SkeletonBounds SkeletonData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect -rename_functions = SpineAnimation::[createWithFile=create setCompleteListener=setCompleteListenerNative setTrackCompleteListener=setTrackCompleteListenerNative], - SpineRenderer::[createWithFile=create] +rename_functions = SkeletonAnimation::[createWithFile=create setCompleteListener=setCompleteListenerNative setTrackCompleteListener=setTrackCompleteListenerNative], + SkeletonRenderer::[createWithFile=create] -rename_classes = SpineRenderer::Skeleton +rename_classes = SkeletonRenderer::Skeleton +classes_owned_by_cpp = 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 SlotData SkeletonBounds SkeletonData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect \ No newline at end of file