diff --git a/SpriteBuilder/SpriteBuilder Tests/CCAnimation_Tests.m b/SpriteBuilder/SpriteBuilder Tests/CCAnimation_Tests.m new file mode 100644 index 000000000..192527cd9 --- /dev/null +++ b/SpriteBuilder/SpriteBuilder Tests/CCAnimation_Tests.m @@ -0,0 +1,390 @@ +// +// CCAnimation_Tests.m +// SpriteBuilder +// +// Created by John Twigg on 6/9/14. +// +// + +#import +#import "cocos2d.h" +#import "CCBXCocos2diPhone.h" +#import "PlugInManager.h" +#import "PlugInExport.h" +#import "CCBReader.h" +#import "CCAnimationManager.h" +#import "CCAnimationManager_Private.h" +#import "CCBSequence.h" + +#define IS_NEAR(a,b,accuracy) (fabsf(a - b) < kAccuracy) + + +@implementation CCAnimationManager (Test) + +-(CCBSequence*)runningSequence +{ + return _runningSequence; +} + +@end + +typedef void (^CallbackBlock) (); +@interface CCAnimationDelegateTester : NSObject +{ + CallbackBlock _sequenceFinished; +} + + +@end + + + + +@implementation CCAnimationDelegateTester +{ + NSMutableDictionary * methodBlocks; + +} + +-(void)setSequenceFinishedCallback:(CallbackBlock)sequenceFinished +{ + _sequenceFinished = [sequenceFinished copy]; +} + +-(void)registerMethod:(NSString*)callback block:(CallbackBlock)block +{ + if(methodBlocks == nil) + { + methodBlocks = [NSMutableDictionary dictionary]; + } + + methodBlocks[callback] = [block copy]; +} + +void dynamicMethodIMP(CCAnimationDelegateTester * self, SEL _cmd) +{ + NSString * selectorName = NSStringFromSelector(_cmd); + if(self->methodBlocks[selectorName]) + { + CallbackBlock block =self->methodBlocks[selectorName]; + block(); + } +} + ++(BOOL)resolveInstanceMethod:(SEL)sel +{ + if(![super resolveInstanceMethod:sel]) + { + class_addMethod([self class], sel, (IMP) dynamicMethodIMP, "v@:"); + return YES; + } + + + return YES; +} + + +- (void) completedAnimationSequenceNamed:(NSString*)name +{ + if(_sequenceFinished) + _sequenceFinished(); +} + +@end + +@interface CCAnimation_Tests : XCTestCase + +@end + +@implementation CCAnimation_Tests + +-(NSData*)readCCB:(NSString*)srcFileName +{ + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *path = [bundle pathForResource:srcFileName ofType:@"ccb"]; + NSDictionary * doc = [NSDictionary dictionaryWithContentsOfFile:path]; + + PlugInExport *plugIn = [[PlugInManager sharedManager] plugInExportForExtension:@"ccbi"]; + NSData *data = [plugIn exportDocument:doc]; + return data; +} + +- (void)setUp +{ + [super setUp]; + + + + + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown +{ + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + + + +- (void)testAnimationSync1 +{ + + CCAnimationDelegateTester * callbackTest = [[CCAnimationDelegateTester alloc] init]; + + + + NSData * animData = [self readCCB:@"AnimationTest1"]; + XCTAssertNotNil(animData, @"Can't find ccb File"); + + CCBReader * reader = [CCBReader reader]; + CCNode * rootNode = [reader loadWithData:animData owner:callbackTest]; + + CCNode * node0 = rootNode.children[0]; + CCNode * node1 = rootNode.children[1]; + CCNode * node2 = rootNode.children[2]; + + + XCTAssertTrue([node0.name isEqualToString:@"node0"]); + XCTAssertTrue([node1.name isEqualToString:@"node1"]); + XCTAssertTrue([node2.name isEqualToString:@"node2"]); + + + const float kDelta = 0.1f;//100ms; + const CGFloat kAccuracy = 0.01f; + const CGFloat kTranslation = 500.0f; + + + float totalElapsed = 0.0f; + __block float currentAnimElapsed = 0.0f; + + CCBSequence * seq = rootNode.animationManager.sequences[0]; + + [rootNode.animationManager setCompletedAnimationCallbackBlock:^(CCAnimationManager * manager) { + XCTAssertTrue(fabsf(currentAnimElapsed - seq.duration) < kAccuracy, @"The animation should have taken 4 seconds. Possible divergenc."); + + currentAnimElapsed = 0.0f; + }]; + + while(totalElapsed <= seq.duration * 20) + { + [rootNode.animationManager update:kDelta]; + + totalElapsed += kDelta; + currentAnimElapsed += kDelta; + + float timeIntoSeq = rootNode.animationManager.runningSequence.time; + + //This animation specifcally see's all three nodes translate after three seconds back to the root pos. + if(timeIntoSeq >= 3.0f) + { + //All final translations go from x=500 -> x=0 over 1 second. + float perentageIntroSyncedTranlation = 1.0f - (seq.duration - timeIntoSeq); + float desiredXCoord = (1.0f - perentageIntroSyncedTranlation) * kTranslation; + + XCTAssertTrue(fabsf(node0.position.x - node1.position.x) < kAccuracy, @"They should all equal each other"); + XCTAssertTrue(fabsf(node0.position.x - node2.position.x) < kAccuracy, @"They should all equal each other"); + XCTAssertTrue(fabsf(node0.position.x - desiredXCoord) < kAccuracy, @"They should all equal each desiredXCoord. Possible divergenc. XPos:%0.2f DesiredPos:%0.2f totalElapsed:%0.2f", node0.position.x,desiredXCoord, totalElapsed); + + } + } +} + +-(void)testAnimationCallback1 +{ + + CCAnimationDelegateTester * callbackTest = [[CCAnimationDelegateTester alloc] init]; + + NSData * animData = [self readCCB:@"AnimationTest1"]; + XCTAssertNotNil(animData, @"Can't find ccb File"); + + CCBReader * reader = [CCBReader reader]; + CCNode * rootNode = [reader loadWithData:animData owner:callbackTest]; + + CCBSequence * seq = rootNode.animationManager.sequences[0]; + rootNode.animationManager.delegate = callbackTest; + + const float kDelta = 0.1f;//100ms; + const CGFloat kAccuracy = 0.01f; + const CGFloat kTranslation = 500.0f; + + float totalElapsed = 0.0f; + __block float currentAnimElapsed = 0.0f; + + [callbackTest setSequenceFinishedCallback:^{ + currentAnimElapsed = 0.0f; + }]; + + [callbackTest registerMethod:@"onMiddleOfAnimation" block:^{ + XCTAssertTrue(fabsf(currentAnimElapsed - seq.duration /2.0f) < kAccuracy, @"Not in the middle of the sequence"); + }]; + + __block BOOL endCallbackWasCalled = NO; + [callbackTest registerMethod:@"onEndOfAnim1" block:^{ + XCTAssertTrue(fabsf(currentAnimElapsed) < kAccuracy, @"Should be at the end of the frame, however its been looped so its Zero."); + endCallbackWasCalled = YES; + }]; + + + while(totalElapsed <= seq.duration * 20) + { + [rootNode.animationManager update:kDelta]; + + totalElapsed += kDelta; + currentAnimElapsed += kDelta; + + } + + XCTAssert(endCallbackWasCalled, @"Should be called"); + +} + + +//This test file "AnimationTest2.ccb" has two animations. T1 and T2. +//The test ensures that when T1 ends, we launch T2 with a tween of 100ms. +-(void)testAnimationTween1 +{ + + CCAnimationDelegateTester * callbackTest = [[CCAnimationDelegateTester alloc] init]; + + NSData * animData = [self readCCB:@"AnimationTest2"]; + XCTAssertNotNil(animData, @"Can't find ccb File"); + + CCBReader * reader = [CCBReader reader]; + CCNode * rootNode = [reader loadWithData:animData owner:callbackTest]; + CCNode * node0 = rootNode.children[0]; + + XCTAssertTrue([node0.name isEqualToString:@"node0"]); + + CCBSequence * seq = rootNode.animationManager.sequences[0]; + rootNode.animationManager.delegate = callbackTest; + + const float kDelta = 0.1f;//100ms; + const CGFloat kAccuracy = 0.01f; + const CGFloat kXTranslation = 500.0f; + const CGFloat kYTranslation = 200.0f; + const CGFloat kTween = 1.0f; + + float totalElapsed = 0.0f; + __block BOOL firstTime = YES; + __block float currentAnimElapsed = 0.0f; + __block BOOL playingDefaultAnimToggle = YES; + + [callbackTest setSequenceFinishedCallback:^{ + + //When the animation finished, Toggle over to the next T1/T2 animation. + firstTime = NO; + playingDefaultAnimToggle = !playingDefaultAnimToggle; + [rootNode.animationManager runAnimationsForSequenceNamed:playingDefaultAnimToggle ? @"T1" : @"T2" tweenDuration:kTween]; + + //Reset clock. + currentAnimElapsed = 0.0f; + }]; + + // + + typedef void (^ValidateAnimation) (float timeIntoAnimation); + + ValidateAnimation validationAnimBlock =^(float timeIntoAnimation) + { + //We're in T1 + tween. Ensure valid + //Also, always skip frame 0. + + if(timeIntoAnimation < 0.0f || IS_NEAR(timeIntoAnimation,0.0f,kAccuracy)) + { + return; + } + else if(timeIntoAnimation < 1.0f || IS_NEAR(timeIntoAnimation,1.0f,kAccuracy)) + { + + float percentage = (timeIntoAnimation - kDelta); + float xCoord = kXTranslation * (percentage); + XCTAssertEqualWithAccuracy(node0.position.x, xCoord, kAccuracy, @"They should all equal each other"); + } + else if(timeIntoAnimation < 3.0f || IS_NEAR(timeIntoAnimation,3.0f,kAccuracy)) + { + int break_here = 1; + + XCTAssertEqualWithAccuracy(node0.position.x, kXTranslation, kAccuracy, @"Error: timeIntoAnim:%0.2f", timeIntoAnimation); + } + else if(timeIntoAnimation < 4.0f || IS_NEAR(timeIntoAnimation,4.0f,kAccuracy)) + { + + float percentage = (timeIntoAnimation - 3.0f); + float xCoord = kXTranslation * (1.0f - percentage); + XCTAssertEqualWithAccuracy(node0.position.x, xCoord, kAccuracy, @"They should all equal each other"); + } + + }; + + bool alreadyDone = NO; + + while(totalElapsed <= (seq.duration + kTween) * 20) + { + totalElapsed += kDelta; + currentAnimElapsed += kDelta; + + [rootNode.animationManager update:kDelta]; + + if(firstTime) + { + validationAnimBlock(currentAnimElapsed); + continue; + } + + + + + if(!playingDefaultAnimToggle) + { + //Playing T2 animation. + + //In tween and greather that the first frame, as the first frame stutters. + if(currentAnimElapsed < kTween || IS_NEAR(currentAnimElapsed, kTween,kAccuracy)) + { + //Skip first frame as it halts for one frme. + if(currentAnimElapsed < kDelta) + continue; + + + //All final translations go from y=200 -> y=0 + float percentage = (currentAnimElapsed - kDelta)/ kTween; + float yCoord = kYTranslation * (1.0f - percentage); + + XCTAssertEqualWithAccuracy(node0.position.y, yCoord, kAccuracy, @"They should all equal each other"); + } + else + { + float timeIntoAnimation = currentAnimElapsed - kTween; + validationAnimBlock(timeIntoAnimation); + } + + } + else //Playing T1 animation. + { + //Ensure tween from T2(end) -> T1(start) + if(currentAnimElapsed < kTween) + { + //Skip first frame as it halts for one frme. + if(currentAnimElapsed < kDelta) + continue; + + //Should interpolate from y= 0 -> y = 200; + float percentage = (currentAnimElapsed - kDelta)/ kTween; + float yCoord = kYTranslation * (percentage); + + XCTAssertEqualWithAccuracy(node0.position.y, yCoord, kAccuracy, @"They should all equal each other"); + } + else + { + float timeIntoAnimation = currentAnimElapsed - kTween; + validationAnimBlock(timeIntoAnimation); + } + } + } + + +} + + +@end diff --git "a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/Icon\r" "b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/Icon\r" new file mode 100644 index 000000000..e69de29bb diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb new file mode 100644 index 000000000..a5bf0988d --- /dev/null +++ b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb @@ -0,0 +1,841 @@ + + + + + SequencerJoints + + hidden + + locked + + + UUID + 8 + centeredOrigin + + currentResolution + 0 + currentSequenceId + 0 + docDimensionsType + 0 + fileType + CocosBuilder + fileVersion + 4 + gridspaceHeight + 64 + gridspaceWidth + 64 + guides + + joints + + jsControlled + + nodeGraph + + UUID + 1 + baseClass + CCNode + children + + + UUID + 4 + animatedProperties + + 0 + + position + + keyframes + + + easing + + type + 1 + + name + position + time + 0.0 + type + 3 + value + + 0.0 + 0.0 + + + + easing + + type + 1 + + name + position + time + 1 + type + 3 + value + + 500 + 0.0 + + + + easing + + type + 1 + + name + position + time + 3 + type + 3 + value + + 500 + 0.0 + + + + easing + + type + 1 + + name + position + time + 4 + type + 3 + value + + 0.0 + 0.0 + + + + name + position + type + 3 + + + + baseClass + CCNodeColor + children + + customClass + + displayName + node0 + memberVarAssignmentName + + memberVarAssignmentType + 1 + properties + + + name + name + type + StringSimple + value + node0 + + + baseValue + + 0.0 + 0.0 + + name + position + type + Position + value + + 0.0 + 0.0 + 0 + 0 + 0 + + + + name + contentSize + type + Size + value + + 50 + 50 + 0 + 0 + + + + name + anchorPoint + type + Point + value + + 0.0 + 0.0 + + + + name + scale + type + ScaleLock + value + + 1 + 1 + + 0 + + + + name + color + type + Color3 + value + + 0.98594826459884644 + 0.0 + 0.026950567960739136 + 1 + + + + name + opacity + type + Float + value + 1 + + + seqExpanded + + + + UUID + 5 + animatedProperties + + 0 + + color + + keyframes + + + easing + + type + 1 + + name + color + time + 0.0 + type + 6 + value + + 0.99210119247436523 + 0.60418778657913208 + 0.034307416528463364 + 1 + + + + name + color + type + 6 + + position + + keyframes + + + easing + + type + 1 + + name + position + time + 1 + type + 3 + value + + 0.0 + 50 + + + + easing + + type + 1 + + name + position + time + 2 + type + 3 + value + + 500 + 50 + + + + easing + + type + 1 + + name + position + time + 3 + type + 3 + value + + 500 + 50 + + + + easing + + type + 1 + + name + position + time + 4 + type + 3 + value + + 0.0 + 50 + + + + name + position + type + 3 + + + + baseClass + CCNodeColor + children + + customClass + + displayName + node1 + memberVarAssignmentName + + memberVarAssignmentType + 1 + properties + + + name + name + type + StringSimple + value + node1 + + + baseValue + + 0.0 + 50 + + name + position + type + Position + value + + 0.0 + 50 + 0 + 0 + 0 + + + + name + contentSize + type + Size + value + + 50 + 50 + 0 + 0 + + + + name + anchorPoint + type + Point + value + + 0.0 + 0.0 + + + + name + scale + type + ScaleLock + value + + 1 + 1 + + 0 + + + + baseValue + + 0.99210119247436523 + 0.60418778657913208 + 0.034307416528463364 + 1 + + name + color + type + Color3 + value + + 0.99210119247436523 + 0.60418778657913208 + 0.034307416528463364 + 1 + + + + name + opacity + type + Float + value + 1 + + + seqExpanded + + + + UUID + 6 + animatedProperties + + 0 + + position + + keyframes + + + easing + + type + 1 + + name + position + time + 2 + type + 3 + value + + 0.0 + 100 + + + + easing + + type + 1 + + name + position + time + 3 + type + 3 + value + + 500 + 100 + + + + easing + + type + 1 + + name + position + time + 4 + type + 3 + value + + 0.0 + 100 + + + + name + position + type + 3 + + + + baseClass + CCNodeColor + children + + customClass + + displayName + node2 + memberVarAssignmentName + + memberVarAssignmentType + 1 + properties + + + name + name + type + StringSimple + value + node2 + + + baseValue + + 0.0 + 100 + + name + position + type + Position + value + + 0.0 + 100 + 0 + 0 + 0 + + + + name + contentSize + type + Size + value + + 50 + 50 + 0 + 0 + + + + name + anchorPoint + type + Point + value + + 0.0 + 0.0 + + + + name + scale + type + ScaleLock + value + + 1 + 1 + + 0 + + + + name + color + type + Color3 + value + + 0.60930913686752319 + 1 + 0.033254645764827728 + 1 + + + + name + opacity + type + Float + value + 1 + + + seqExpanded + + + + customClass + + displayName + CCNode + memberVarAssignmentName + + memberVarAssignmentType + 1 + properties + + + name + name + type + StringSimple + value + + + + name + position + type + Position + value + + 0.0 + 0.0 + 0 + 0 + 0 + + + + name + contentSize + type + Size + value + + 1 + 1 + 2 + 2 + + + + name + anchorPoint + type + Point + value + + 0.0 + 0.0 + + + + name + scale + type + ScaleLock + value + + 1 + 1 + + 0 + + + + + notes + + resolutions + + + centeredOrigin + + ext + phone + height + 320 + name + Phone Landscape + scale + 1 + width + 568 + + + centeredOrigin + + ext + tablet phonehd + height + 384 + name + Tablet Landscape + scale + 2 + width + 512 + + + centeredOrigin + + ext + phone + height + 320 + name + Phone Landscape (short) + scale + 1 + width + 480 + + + sequences + + + autoPlay + + callbackChannel + + keyframes + + + easing + + type + 0 + + time + 2 + type + 12 + value + + onMiddleOfAnimation + 2 + + + + easing + + type + 0 + + time + 4 + type + 12 + value + + onEndOfAnim1 + 2 + + + + type + 11 + + chainedSequenceId + 0 + length + 4 + name + Default Timeline + offset + 0.0 + position + 4 + resolution + 30 + scale + 75.125 + sequenceId + 0 + soundChannel + + isExpanded + + keyframes + + type + 10 + + + + stageBorder + 0 + stageColor + 0 + + diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb.ppng b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb.ppng new file mode 100644 index 000000000..78631d9e5 Binary files /dev/null and b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb.ppng differ diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb new file mode 100644 index 000000000..c64ea941f --- /dev/null +++ b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb @@ -0,0 +1,590 @@ + + + + + SequencerJoints + + hidden + + locked + + + UUID + 8 + centeredOrigin + + currentResolution + 0 + currentSequenceId + 2 + docDimensionsType + 0 + fileType + CocosBuilder + fileVersion + 4 + gridspaceHeight + 64 + gridspaceWidth + 64 + guides + + joints + + jsControlled + + nodeGraph + + UUID + 1 + baseClass + CCNode + children + + + UUID + 4 + animatedProperties + + 1 + + position + + keyframes + + + easing + + type + 1 + + name + position + time + 0.0 + type + 3 + value + + 0.0 + 200 + + + + easing + + type + 1 + + name + position + time + 1 + type + 3 + value + + 500 + 200 + + + + easing + + type + 1 + + name + position + time + 3 + type + 3 + value + + 500 + 200 + + + + easing + + type + 1 + + name + position + time + 4 + type + 3 + value + + 0.0 + 200 + + + + name + position + type + 3 + + + 2 + + position + + keyframes + + + easing + + type + 1 + + name + position + time + 0.0 + type + 3 + value + + 0.0 + 0.0 + + + + easing + + type + 1 + + name + position + time + 1 + type + 3 + value + + 500 + 0.0 + + + + easing + + type + 1 + + name + position + time + 3 + type + 3 + value + + 500 + 0.0 + + + + easing + + type + 1 + + name + position + time + 4 + type + 3 + value + + 0.0 + 0.0 + + + + name + position + type + 3 + + + + baseClass + CCNodeColor + children + + customClass + + displayName + node0 + memberVarAssignmentName + + memberVarAssignmentType + 1 + properties + + + name + name + type + StringSimple + value + node0 + + + baseValue + + 0.0 + 0.0 + + name + position + type + Position + value + + 0.0 + 0.0 + 0 + 0 + 0 + + + + name + contentSize + type + Size + value + + 50 + 50 + 0 + 0 + + + + name + anchorPoint + type + Point + value + + 0.0 + 0.0 + + + + name + scale + type + ScaleLock + value + + 1 + 1 + + 0 + + + + name + color + type + Color3 + value + + 0.98594826459884644 + 0.0 + 0.026950567960739136 + 1 + + + + name + opacity + type + Float + value + 1 + + + selected + + seqExpanded + + + + customClass + + displayName + CCNode + memberVarAssignmentName + + memberVarAssignmentType + 1 + properties + + + name + name + type + StringSimple + value + + + + name + position + type + Position + value + + 0.0 + 0.0 + 0 + 0 + 0 + + + + name + contentSize + type + Size + value + + 1 + 1 + 2 + 2 + + + + name + anchorPoint + type + Point + value + + 0.0 + 0.0 + + + + name + scale + type + ScaleLock + value + + 1 + 1 + + 0 + + + + + notes + + resolutions + + + centeredOrigin + + ext + phone + height + 320 + name + Phone Landscape + scale + 1 + width + 568 + + + centeredOrigin + + ext + tablet phonehd + height + 384 + name + Tablet Landscape + scale + 2 + width + 512 + + + centeredOrigin + + ext + phone + height + 320 + name + Phone Landscape (short) + scale + 1 + width + 480 + + + sequences + + + autoPlay + + callbackChannel + + keyframes + + + easing + + type + 0 + + time + 2 + type + 12 + value + + onMiddleOfAnimation + 2 + + + + easing + + type + 0 + + time + 4 + type + 12 + value + + onEndOfAnim1 + 2 + + + + type + 11 + + chainedSequenceId + -1 + length + 4 + name + T1 + offset + 0.0 + position + 4 + resolution + 30 + scale + 75.125 + sequenceId + 1 + soundChannel + + isExpanded + + keyframes + + type + 10 + + + + autoPlay + + callbackChannel + + keyframes + + + easing + + type + 0 + + time + 2 + type + 12 + value + + onMiddleOfAnimation + 2 + + + + easing + + type + 0 + + time + 4 + type + 12 + value + + onEndOfAnim1 + 2 + + + + type + 11 + + chainedSequenceId + -1 + length + 4 + name + T2 + offset + 0.0 + position + 0.0 + resolution + 30 + scale + 75.125 + sequenceId + 2 + soundChannel + + isExpanded + + keyframes + + type + 10 + + + + stageBorder + 0 + stageColor + 0 + + diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb.ppng b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb.ppng new file mode 100644 index 000000000..09108a248 Binary files /dev/null and b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb.ppng differ diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/MainScene.ccb.ppng b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/MainScene.ccb.ppng new file mode 100644 index 000000000..d8f590ed9 Binary files /dev/null and b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/MainScene.ccb.ppng differ diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/Strings.ccbLang b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/Strings.ccbLang new file mode 100644 index 000000000..d182ca545 --- /dev/null +++ b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/Strings.ccbLang @@ -0,0 +1,16 @@ + + + + + activeLanguages + + en + + fileType + SpriteBuilderTranslations + fileVersion + 1 + translations + + + diff --git a/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilderTestProject.ccbproj b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilderTestProject.ccbproj new file mode 100644 index 000000000..1648d9903 --- /dev/null +++ b/SpriteBuilder/SpriteBuilder Tests/SpriteBuilderTestProject.spritebuilder/SpriteBuilderTestProject.ccbproj @@ -0,0 +1,96 @@ + + + + + cocos2dUpdateIgnoredVersions + + defaultOrientation + 0 + designTarget + 0 + deviceOrientationLandscapeLeft + + deviceOrientationLandscapeRight + + deviceOrientationPortrait + + deviceOrientationUpsideDown + + deviceScaling + 0 + engine + 0 + exporter + ccbi + fileType + CocosBuilderProject + fileVersion + 1 + flattenPaths + + needRepublish + + onlyPublishCCBs + + publishAudioQuality_android + 4 + publishAudioQuality_ios + 4 + publishDirectory + Source/Resources/Published-iOS + publishDirectoryAndroid + Source/Resources/Published-Android + publishEnabledAndroid + + publishEnablediPhone + + publishEnvironment + 0 + publishResolution_android_phone + + publishResolution_android_phonehd + + publishResolution_android_tablet + + publishResolution_android_tablethd + + publishResolution_ios_phone + + publishResolution_ios_phonehd + + publishResolution_ios_tablet + + publishResolution_ios_tablethd + + publishToZipFile + + resourceAutoScaleFactor + 4 + resourcePaths + + + path + SpriteBuilder Resources + + + resourceProperties + + + + previewFolderHidden + + + Sprites + + ccbResources + + previewFolderHidden + + + + versionStr + Version: 0.9 +GitHub: 551c4795b8 + + + diff --git a/SpriteBuilder/SpriteBuilder.xcodeproj/project.pbxproj b/SpriteBuilder/SpriteBuilder.xcodeproj/project.pbxproj index 6e204a782..abb7c5040 100644 --- a/SpriteBuilder/SpriteBuilder.xcodeproj/project.pbxproj +++ b/SpriteBuilder/SpriteBuilder.xcodeproj/project.pbxproj @@ -125,6 +125,7 @@ 8392007018ED91BC00B6C429 /* Cocos2dUpdater+Errors.m in Sources */ = {isa = PBXBuildFile; fileRef = 8392006E18ED91BC00B6C429 /* Cocos2dUpdater+Errors.m */; }; 83DC65EA18D898D50028EF72 /* SBUserDefaultsKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 83DC65E918D898D50028EF72 /* SBUserDefaultsKeys.m */; }; 83F8673418D1DCEA007441E4 /* SBErrors.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F8673318D1DCEA007441E4 /* SBErrors.m */; }; + 9203805B19465679000A8816 /* CCAnimation_Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9203805A19465679000A8816 /* CCAnimation_Tests.m */; }; 92154AC718A5531800BD215C /* CCBPProperties.plist in Resources */ = {isa = PBXBuildFile; fileRef = 92154ABF18A5531800BD215C /* CCBPProperties.plist */; }; 92154AC918A5531800BD215C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 92154AC218A5531800BD215C /* InfoPlist.strings */; }; 92154ACA18A5531800BD215C /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 92154AC418A5531800BD215C /* Icon.png */; }; @@ -172,6 +173,8 @@ 921EEB2418ADB7EA00D864C2 /* GeometryUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 921EEB2318ADB7EA00D864C2 /* GeometryUtil.m */; }; 921EEB2918ADE43700D864C2 /* InspectorNodeReference.xib in Resources */ = {isa = PBXBuildFile; fileRef = 921EEB2818ADE43700D864C2 /* InspectorNodeReference.xib */; }; 921EEB2C18ADE5C600D864C2 /* InspectorNodeReference.m in Sources */ = {isa = PBXBuildFile; fileRef = 921EEB2B18ADE5C600D864C2 /* InspectorNodeReference.m */; }; + 922CC396194676B600B34854 /* AnimationTest1.ccb in Resources */ = {isa = PBXBuildFile; fileRef = 922CC395194676B600B34854 /* AnimationTest1.ccb */; }; + 922CC3981946873A00B34854 /* AnimationTest2.ccb in Resources */ = {isa = PBXBuildFile; fileRef = 922CC3971946873A00B34854 /* AnimationTest2.ccb */; }; 922E8EF718BFE47A008E1764 /* InspectorFloatCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 922E8EF518BFE47A008E1764 /* InspectorFloatCheck.m */; }; 922E8EF818BFE47A008E1764 /* InspectorFloatCheck.xib in Resources */ = {isa = PBXBuildFile; fileRef = 922E8EF618BFE47A008E1764 /* InspectorFloatCheck.xib */; }; 922E8EFE18C13666008E1764 /* OutletDrawWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 922E8EFD18C13666008E1764 /* OutletDrawWindow.m */; }; @@ -832,6 +835,13 @@ remoteGlobalIDString = E01E663C121CA00A001A484F; remoteInfo = cocos2d; }; + 9203806019465955000A8816 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7789ABB5133AA82000CEFCC7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E398C02114FB81A30078E771; + remoteInfo = "Cocos2D iPhone"; + }; 92154AE118A5567400BD215C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 7789ABB5133AA82000CEFCC7 /* Project object */; @@ -1299,6 +1309,7 @@ 83DC65E918D898D50028EF72 /* SBUserDefaultsKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBUserDefaultsKeys.m; sourceTree = ""; }; 83F8673218D1DCEA007441E4 /* SBErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBErrors.h; sourceTree = ""; }; 83F8673318D1DCEA007441E4 /* SBErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBErrors.m; sourceTree = ""; }; + 9203805A19465679000A8816 /* CCAnimation_Tests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCAnimation_Tests.m; sourceTree = ""; }; 92101C2C1891F1BB0004F93B /* CCBPublishDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCBPublishDelegate.h; sourceTree = ""; }; 92154ABD18A5531800BD215C /* CCBPhysicsPivotJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBPhysicsPivotJoint.h; sourceTree = ""; }; 92154ABE18A5531800BD215C /* CCBPhysicsPivotJoint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCBPhysicsPivotJoint.m; sourceTree = ""; }; @@ -1350,6 +1361,8 @@ 921EEB2818ADE43700D864C2 /* InspectorNodeReference.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InspectorNodeReference.xib; sourceTree = ""; }; 921EEB2A18ADE5C600D864C2 /* InspectorNodeReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorNodeReference.h; sourceTree = ""; }; 921EEB2B18ADE5C600D864C2 /* InspectorNodeReference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectorNodeReference.m; sourceTree = ""; }; + 922CC395194676B600B34854 /* AnimationTest1.ccb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = AnimationTest1.ccb; path = "SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest1.ccb"; sourceTree = ""; }; + 922CC3971946873A00B34854 /* AnimationTest2.ccb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = AnimationTest2.ccb; path = "SpriteBuilderTestProject.spritebuilder/SpriteBuilder Resources/AnimationTest2.ccb"; sourceTree = ""; }; 922E8EF418BFE47A008E1764 /* InspectorFloatCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFloatCheck.h; sourceTree = ""; }; 922E8EF518BFE47A008E1764 /* InspectorFloatCheck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectorFloatCheck.m; sourceTree = ""; }; 922E8EF618BFE47A008E1764 /* InspectorFloatCheck.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InspectorFloatCheck.xib; sourceTree = ""; }; @@ -3279,6 +3292,8 @@ 833A5C4D192B48CB001837B3 /* SpriteBuilder Tests */ = { isa = PBXGroup; children = ( + 922CC3941946769B00B34854 /* Resources */, + 9203805A19465679000A8816 /* CCAnimation_Tests.m */, 833A5C5B192B4981001837B3 /* CCBReader_Tests.m */, 833A5C4E192B48CB001837B3 /* Supporting Files */, ); @@ -3352,6 +3367,15 @@ name = "Supporting Files"; sourceTree = ""; }; + 922CC3941946769B00B34854 /* Resources */ = { + isa = PBXGroup; + children = ( + 922CC3971946873A00B34854 /* AnimationTest2.ccb */, + 922CC395194676B600B34854 /* AnimationTest1.ccb */, + ); + name = Resources; + sourceTree = ""; + }; 926D13E718B57E1500582959 /* CCPhysicsPinJoint */ = { isa = PBXGroup; children = ( @@ -4695,6 +4719,7 @@ buildRules = ( ); dependencies = ( + 9203806119465955000A8816 /* PBXTargetDependency */, 833A5C60192B4F00001837B3 /* PBXTargetDependency */, 833A5C57192B48CB001837B3 /* PBXTargetDependency */, ); @@ -5646,7 +5671,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 922CC3981946873A00B34854 /* AnimationTest2.ccb in Resources */, 833A5C52192B48CB001837B3 /* InfoPlist.strings in Resources */, + 922CC396194676B600B34854 /* AnimationTest1.ccb in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6198,6 +6225,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9203805B19465679000A8816 /* CCAnimation_Tests.m in Sources */, 833A5C5C192B4981001837B3 /* CCBReader_Tests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -6444,6 +6472,11 @@ name = cocos2d; targetProxy = 833A5C5F192B4F00001837B3 /* PBXContainerItemProxy */; }; + 9203806119465955000A8816 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E398C02114FB81A30078E771 /* Cocos2D iPhone */; + targetProxy = 9203806019465955000A8816 /* PBXContainerItemProxy */; + }; 92154AE218A5567400BD215C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 92154ACF18A5560B00BD215C /* CCPhysicsPivotJoint */; diff --git a/SpriteBuilder/ccBuilder/CCBPublisher.m b/SpriteBuilder/ccBuilder/CCBPublisher.m index 511082c88..362aab9e6 100644 --- a/SpriteBuilder/ccBuilder/CCBPublisher.m +++ b/SpriteBuilder/ccBuilder/CCBPublisher.m @@ -631,7 +631,10 @@ - (void)removeOldPublishDirIfCacheCleaned - (void)postProcessPublishedPNGFilesWithOptiPNG { - + if ([_projectSettings isPublishEnvironmentDebug]) + { + return; + } NSString *pathToOptiPNG = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"optipng"]; if (!pathToOptiPNG) diff --git a/SpriteBuilder/libs/cocos2d-iphone b/SpriteBuilder/libs/cocos2d-iphone index 590c4049f..ac77f9954 160000 --- a/SpriteBuilder/libs/cocos2d-iphone +++ b/SpriteBuilder/libs/cocos2d-iphone @@ -1 +1 @@ -Subproject commit 590c4049f847fc1213c76ea1f93e75794925c345 +Subproject commit ac77f99543752b7333949e5c08011f398744491e