diff --git a/spine-cocos2d-objc/src/spine/SkeletonRenderer.m b/spine-cocos2d-objc/src/spine/SkeletonRenderer.m index 80d9512af..8d4ca6382 100644 --- a/spine-cocos2d-objc/src/spine/SkeletonRenderer.m +++ b/spine-cocos2d-objc/src/spine/SkeletonRenderer.m @@ -195,6 +195,7 @@ static bool handlerQueued = false; for (int i = 0, n = _skeleton->slotsCount; i < n; i++) { spSlot* slot = _skeleton->drawOrder[i]; if (!slot->attachment) continue; + if (!slot->bone->active) continue; CCTexture *texture = 0; switch (slot->attachment->type) { case SP_ATTACHMENT_REGION: { @@ -398,6 +399,7 @@ static bool handlerQueued = false; CGPoint points[4]; for (int i = 0, n = _skeleton->slotsCount; i < n; i++) { spSlot* slot = _skeleton->drawOrder[i]; + if (!slot->bone->active) continue; if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment_computeWorldVertices(attachment, slot->bone, _worldVertices, 0, 2); @@ -412,6 +414,7 @@ static bool handlerQueued = false; // Bone lengths. for (int i = 0, n = _skeleton->bonesCount; i < n; i++) { spBone *bone = _skeleton->bones[i]; + if (!bone->active) continue; float x = bone->data->length * bone->a + bone->worldX; float y = bone->data->length * bone->c + bone->worldY; [_drawNode drawSegmentFrom:ccp(bone->worldX, bone->worldY) to: ccp(x, y)radius:2 color:[CCColor redColor]]; @@ -420,6 +423,7 @@ static bool handlerQueued = false; // Bone origins. for (int i = 0, n = _skeleton->bonesCount; i < n; i++) { spBone *bone = _skeleton->bones[i]; + if (!bone->active) continue; [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor greenColor]]; if (i == 0) [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor blueColor]]; } diff --git a/spine-cocos2dx/example/proj.ios_mac/spine-cocos2d-x.xcodeproj/project.pbxproj b/spine-cocos2dx/example/proj.ios_mac/spine-cocos2d-x.xcodeproj/project.pbxproj index f11db218d..1d3c32538 100644 --- a/spine-cocos2dx/example/proj.ios_mac/spine-cocos2d-x.xcodeproj/project.pbxproj +++ b/spine-cocos2dx/example/proj.ios_mac/spine-cocos2d-x.xcodeproj/project.pbxproj @@ -75,7 +75,6 @@ 763104DD20BC1B5E00927A1E /* Triangulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A020BC1B5600927A1E /* Triangulator.cpp */; }; 763104DE20BC1B5E00927A1E /* Skeleton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A120BC1B5600927A1E /* Skeleton.cpp */; }; 763104DF20BC1B5E00927A1E /* AttachmentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A220BC1B5600927A1E /* AttachmentLoader.cpp */; }; - 763104E020BC1B5E00927A1E /* Constraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A320BC1B5600927A1E /* Constraint.cpp */; }; 763104E120BC1B5E00927A1E /* AttachmentTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A420BC1B5600927A1E /* AttachmentTimeline.cpp */; }; 763104E220BC1B5E00927A1E /* Updatable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A520BC1B5600927A1E /* Updatable.cpp */; }; 763104E320BC1B5E00927A1E /* RegionAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A620BC1B5700927A1E /* RegionAttachment.cpp */; }; @@ -120,7 +119,6 @@ 763105A820BC1B9700927A1E /* BoundingBoxAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104AB20BC1B5700927A1E /* BoundingBoxAttachment.cpp */; }; 763105A920BC1B9700927A1E /* ClippingAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A720BC1B5700927A1E /* ClippingAttachment.cpp */; }; 763105AA20BC1B9700927A1E /* ColorTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7631049620BC1B5500927A1E /* ColorTimeline.cpp */; }; - 763105AB20BC1B9700927A1E /* Constraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A320BC1B5600927A1E /* Constraint.cpp */; }; 763105AC20BC1B9700927A1E /* CurveTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7631048920BC1B5400927A1E /* CurveTimeline.cpp */; }; 763105AD20BC1B9700927A1E /* DeformTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104BE20BC1B5D00927A1E /* DeformTimeline.cpp */; }; 763105AE20BC1B9700927A1E /* DrawOrderTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7631048A20BC1B5400927A1E /* DrawOrderTimeline.cpp */; }; @@ -168,6 +166,8 @@ 763105D820BC1B9700927A1E /* Updatable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104A520BC1B5600927A1E /* Updatable.cpp */; }; 763105D920BC1B9700927A1E /* VertexAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7631049220BC1B5500927A1E /* VertexAttachment.cpp */; }; 763105DA20BC1B9700927A1E /* VertexEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 763104AE20BC1B5800927A1E /* VertexEffect.cpp */; }; + 76798D1D22A95AB400F77964 /* ConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76798D1C22A95AB300F77964 /* ConstraintData.cpp */; }; + 76798D1E22A95AEF00F77964 /* ConstraintData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76798D1C22A95AB300F77964 /* ConstraintData.cpp */; }; 76A45BDE1E64396800745AA1 /* SkeletonTwoColorBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76A45BDC1E64396800745AA1 /* SkeletonTwoColorBatch.cpp */; }; 76A45BDF1E64396800745AA1 /* SkeletonTwoColorBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76A45BDC1E64396800745AA1 /* SkeletonTwoColorBatch.cpp */; }; 76AAA3C01D180F7C00C54FCB /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B31D180F7C00C54FCB /* AppDelegate.cpp */; }; @@ -332,7 +332,6 @@ 763104A020BC1B5600927A1E /* Triangulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Triangulator.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/Triangulator.cpp"; sourceTree = ""; }; 763104A120BC1B5600927A1E /* Skeleton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Skeleton.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/Skeleton.cpp"; sourceTree = ""; }; 763104A220BC1B5600927A1E /* AttachmentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttachmentLoader.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp"; sourceTree = ""; }; - 763104A320BC1B5600927A1E /* Constraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Constraint.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/Constraint.cpp"; sourceTree = ""; }; 763104A420BC1B5600927A1E /* AttachmentTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttachmentTimeline.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp"; sourceTree = ""; }; 763104A520BC1B5600927A1E /* Updatable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Updatable.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/Updatable.cpp"; sourceTree = ""; }; 763104A620BC1B5700927A1E /* RegionAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegionAttachment.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp"; sourceTree = ""; }; @@ -364,6 +363,7 @@ 763104C020BC1B5E00927A1E /* SkeletonBounds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonBounds.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp"; sourceTree = ""; }; 763104C120BC1B5E00927A1E /* ShearTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ShearTimeline.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp"; sourceTree = ""; }; 763104C220BC1B5E00927A1E /* TranslateTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TranslateTimeline.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp"; sourceTree = ""; }; + 76798D1C22A95AB300F77964 /* ConstraintData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConstraintData.cpp; path = "../../../spine-cpp/spine-cpp/src/spine/ConstraintData.cpp"; sourceTree = ""; }; 76A45BDC1E64396800745AA1 /* SkeletonTwoColorBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonTwoColorBatch.cpp; path = ../../src/spine/SkeletonTwoColorBatch.cpp; sourceTree = ""; }; 76A45BDD1E64396800745AA1 /* SkeletonTwoColorBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonTwoColorBatch.h; path = ../../src/spine/SkeletonTwoColorBatch.h; sourceTree = ""; }; 76AAA3B31D180F7C00C54FCB /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; @@ -611,6 +611,7 @@ 76AAA3B21D180F7300C54FCB /* spine */ = { isa = PBXGroup; children = ( + 76798D1C22A95AB300F77964 /* ConstraintData.cpp */, 763104B620BC1B5C00927A1E /* Animation.cpp */, 7631049B20BC1B5600927A1E /* AnimationState.cpp */, 763104AF20BC1B5800927A1E /* AnimationStateData.cpp */, @@ -624,7 +625,6 @@ 763104AB20BC1B5700927A1E /* BoundingBoxAttachment.cpp */, 763104A720BC1B5700927A1E /* ClippingAttachment.cpp */, 7631049620BC1B5500927A1E /* ColorTimeline.cpp */, - 763104A320BC1B5600927A1E /* Constraint.cpp */, 7631048920BC1B5400927A1E /* CurveTimeline.cpp */, 763104BE20BC1B5D00927A1E /* DeformTimeline.cpp */, 7631048A20BC1B5400927A1E /* DrawOrderTimeline.cpp */, @@ -841,7 +841,6 @@ 76AAA40C1D18106000C54FCB /* AttachmentVertices.cpp in Sources */, 76D1BFE02029E35200A0272D /* SkeletonRendererSeparatorExample.cpp in Sources */, 763104EF20BC1B5E00927A1E /* IkConstraintTimeline.cpp in Sources */, - 763104E020BC1B5E00927A1E /* Constraint.cpp in Sources */, 763104D820BC1B5E00927A1E /* AnimationState.cpp in Sources */, 763104EE20BC1B5E00927A1E /* SkeletonClipping.cpp in Sources */, 763104E420BC1B5E00927A1E /* ClippingAttachment.cpp in Sources */, @@ -880,6 +879,7 @@ 763104D120BC1B5E00927A1E /* MathUtil.cpp in Sources */, 763104DD20BC1B5E00927A1E /* Triangulator.cpp in Sources */, 763104F320BC1B5E00927A1E /* Animation.cpp in Sources */, + 76798D1D22A95AB400F77964 /* ConstraintData.cpp in Sources */, 76AAA40E1D18106000C54FCB /* SkeletonAnimation.cpp in Sources */, 76AAA4111D18106000C54FCB /* spine-cocos2dx.cpp in Sources */, 763104FC20BC1B5E00927A1E /* PathConstraintData.cpp in Sources */, @@ -920,6 +920,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 76798D1E22A95AEF00F77964 /* ConstraintData.cpp in Sources */, 7631059E20BC1B9700927A1E /* Animation.cpp in Sources */, 7631059F20BC1B9700927A1E /* AnimationState.cpp in Sources */, 763105A020BC1B9700927A1E /* AnimationStateData.cpp in Sources */, @@ -933,7 +934,6 @@ 763105A820BC1B9700927A1E /* BoundingBoxAttachment.cpp in Sources */, 763105A920BC1B9700927A1E /* ClippingAttachment.cpp in Sources */, 763105AA20BC1B9700927A1E /* ColorTimeline.cpp in Sources */, - 763105AB20BC1B9700927A1E /* Constraint.cpp in Sources */, 763105AC20BC1B9700927A1E /* CurveTimeline.cpp in Sources */, 763105AD20BC1B9700927A1E /* DeformTimeline.cpp in Sources */, 763105AE20BC1B9700927A1E /* DrawOrderTimeline.cpp in Sources */, diff --git a/spine-cocos2dx/src/spine/SkeletonRenderer.cpp b/spine-cocos2dx/src/spine/SkeletonRenderer.cpp index fa47900b8..818a70682 100644 --- a/spine-cocos2dx/src/spine/SkeletonRenderer.cpp +++ b/spine-cocos2dx/src/spine/SkeletonRenderer.cpp @@ -305,7 +305,7 @@ namespace spine { } // Early exit if slot is invisible - if (slot->getColor().a == 0) { + if (slot->getColor().a == 0 || !slot->getBone().isActive()) { _clipper->clipEnd(*slot); continue; } @@ -695,6 +695,7 @@ namespace spine { V3F_C4B_T2F_Quad quad; for (int i = 0, n = _skeleton->getSlots().size(); i < n; i++) { Slot* slot = _skeleton->getDrawOrder()[i]; + if (!slot->getBone().isActive()) continue; if (!slot->getAttachment() || !slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) continue; RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment(); attachment->computeWorldVertices(slot->getBone(), worldVertices, 0, 2); @@ -710,6 +711,7 @@ namespace spine { glLineWidth(2); for (int i = 0, n = _skeleton->getBones().size(); i < n; i++) { Bone *bone = _skeleton->getBones()[i]; + if (!bone->isActive()) continue; float x = bone->getData().getLength() * bone->getA() + bone->getWorldX(); float y = bone->getData().getLength() * bone->getC() + bone->getWorldY(); drawNode->drawLine(Vec2(bone->getWorldX(), bone->getWorldY()), Vec2(x, y), Color4F::RED); @@ -718,6 +720,7 @@ namespace spine { auto color = Color4F::BLUE; // Root bone is blue. for (int i = 0, n = _skeleton->getBones().size(); i < n; i++) { Bone *bone = _skeleton->getBones()[i]; + if (!bone->isActive()) continue; drawNode->drawPoint(Vec2(bone->getWorldX(), bone->getWorldY()), 4, color); if (i == 0) color = Color4F::GREEN; } @@ -728,6 +731,7 @@ namespace spine { glLineWidth(1); for (int i = 0, n = _skeleton->getSlots().size(); i < n; ++i) { Slot* slot = _skeleton->getDrawOrder()[i]; + if (!slot->getBone().isActive()) continue; if (!slot->getAttachment() || !slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) continue; MeshAttachment* attachment = (MeshAttachment*)slot->getAttachment(); ensureWorldVerticesCapacity(attachment->getWorldVerticesLength()); @@ -754,6 +758,7 @@ namespace spine { for (int i = 0; i < _skeleton->getSlots().size(); ++i) { Slot* slot = _skeleton->getSlots()[i]; if (!slot->getAttachment()) continue; + if (!slot->getBone().isActive()) continue; int verticesCount; if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) { RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment();