Skip to content

Commit 0290d8b

Browse files
committed
Merge remote-tracking branch 'cocos/develop' into CCBRename
2 parents 1ff91a9 + 1d25152 commit 0290d8b

File tree

10 files changed

+93
-55
lines changed

10 files changed

+93
-55
lines changed

Rakefile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ def get_template_files
3232
end
3333
end
3434

35+
def call_xctool command
36+
reporter = "-reporter pretty"
37+
38+
if ENV["CIRCLE_CI"]
39+
reporter = "-reporter plain -reporter junit:test_results.xml"
40+
end
41+
42+
sh "xctool #{reporter} #{command}"
43+
end
44+
3545
def get_artifact_name
3646
return @artifact_name if @artifact_name
3747
branch = `git rev-parse --abbrev-ref HEAD`.chomp
@@ -92,7 +102,9 @@ file "Generated/Version.txt" => "Generated" do |task|
92102
version_info["version"] = DEFAULT_SB_VERSION
93103
version_info["revision"] = ENV["REVISION"] || `git rev-parse --short=10 HEAD`.chomp
94104

95-
File.open("Generated/Version.txt","w") << JSON.pretty_generate(version_info)
105+
f = File.open("Generated/Version.txt","w")
106+
f.write JSON.pretty_generate(version_info)
107+
f.close
96108
end
97109

98110
file "Generated/cocos2d_version.txt" => 'SpriteBuilder/libs/cocos2d-iphone/VERSION' do |task|
@@ -115,28 +127,28 @@ namespace :build do
115127
end
116128

117129
task :tests => [:generated,:build_requirements] do
118-
sh "xctool -configuration Testing build-tests"
130+
call_xctool "-configuration Testing build-tests"
119131
end
120132
end
121133

122134
task :default => "build:generated"
123135

124136
desc "Run SpriteBuilder unit tests"
125137
task :test => ["build:tests", :build_requirements] do
126-
sh "xctool -configuration Testing run-tests"
138+
call_xctool "-configuration Testing run-tests"
127139
end
128140

129141
namespace :package do
130142
desc "Create SpriteBuilder.app + zip app and symbols"
131143
task :app do
132-
sh "xctool TARGET_BUILD_DIR=#{BUILD_DIR} CONFIGURATION_BUILD_DIR=#{BUILD_DIR} VERSION=#{DEFAULT_SB_VERSION} -configuration Release build"
144+
call_xctool "TARGET_BUILD_DIR=#{BUILD_DIR} CONFIGURATION_BUILD_DIR=#{BUILD_DIR} VERSION=#{DEFAULT_SB_VERSION} -configuration Release build"
133145
app, symbols = "NONE"
134146

135147
built_files = `find . -name SpriteBuilder.app`.chomp.split "\n"
136148

137149
app = built_files.max {|a,b| File.mtime(a) <=> File.mtime(b)}
138150
symbols = "#{app}.dSYM"
139-
versioned_app_name = "#{DEFAULT_PRODUCT_NAME}-#{ENV["VERSION"]}.app"
151+
versioned_app_name = "#{DEFAULT_PRODUCT_NAME}-#{DEFAULT_SB_VERSION}.app"
140152

141153
unless File.exists? app and File.exists? symbols
142154
fail "Built products don't exist at #{app} and #{symbols}"
@@ -152,7 +164,7 @@ namespace :package do
152164

153165
desc "Create SpriteBuilder.xcarchive and zip"
154166
task :archive do
155-
sh "xctool TARGET_BUILD_DIR=#{BUILD_DIR} VERSION='#{DEFAULT_SB_VERSION}' -configuration Release archive -archivePath #{BUILD_DIR}/SpriteBuilder"
167+
call_xctool "TARGET_BUILD_DIR=#{BUILD_DIR} VERSION='#{DEFAULT_SB_VERSION}' -configuration Release archive -archivePath #{BUILD_DIR}/SpriteBuilder"
156168

157169
Dir.chdir BUILD_DIR do
158170
sh "zip -r SpriteBuilder.xcarchive.zip SpriteBuilder.xcarchive"
@@ -163,10 +175,10 @@ end
163175
desc "Build SpriteBuilder distribution"
164176
task :package => [:clobber, BUILD_DIR, :build_requirements] do
165177

166-
#force generation of a new Version.txt with commandline value
178+
#force generation of a new Version.txt
167179
Rake::Task["build:generated"].invoke
168-
169180
Rake::Task["package:app"].invoke
181+
170182
Rake::Task["clean"].invoke
171183
Rake::Task["package:archive"].invoke
172184

SpriteBuilder/ccBuilder/CCNode+NodeInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ NSString * kAnimationOfPhysicsWarning;
9191
- (void) loadCustomPropertiesFromSerialization:(id)ser;
9292
- (void) loadCustomPropertyValuesFromSerialization:(id)ser;
9393
- (BOOL) shouldDisableProperty:(NSString*) prop;
94+
- (BOOL)shouldDisableKeyframe:(NSString*) prop;
9495

9596
- (void) setUsesFlashSkew:(BOOL)seqExpanded;
9697
- (BOOL) usesFlashSkew;

SpriteBuilder/ccBuilder/CCNode+NodeInfo.m

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ - (SequencerKeyframe*) addDefaultKeyframeForProperty:(NSString*)name atTime:(flo
248248
}
249249

250250
// Do not add keyframes for disabled properties
251-
if ([self shouldDisableProperty:name])
251+
if ([self shouldDisableProperty:name] || [self shouldDisableKeyframe:name])
252252
return nil;
253253

254254
// Create keyframe
@@ -851,7 +851,7 @@ - (void) loadCustomPropertyValuesFromSerialization:(id)ser
851851
- (BOOL) shouldDisableProperty:(NSString*) prop
852852
{
853853
// Disable properties on root node
854-
if (self == [CocosScene cocosScene].rootNode || self.nodePhysicsBody.dynamic)
854+
if (self == [CocosScene cocosScene].rootNode)
855855
{
856856
if ([prop isEqualToString:@"position"]) return YES;
857857
else if ([prop isEqualToString:@"scale"]) return YES;
@@ -879,7 +879,19 @@ - (BOOL) shouldDisableProperty:(NSString*) prop
879879
return NO;
880880
}
881881

882-
882+
- (BOOL)shouldDisableKeyframe:(NSString*) prop
883+
{
884+
// Disable properties on root node
885+
if (self.nodePhysicsBody.dynamic)
886+
{
887+
if ([prop isEqualToString:@"position"]) return YES;
888+
else if ([prop isEqualToString:@"scale"]) return YES;
889+
else if ([prop isEqualToString:@"rotation"]) return YES;
890+
else if ([prop isEqualToString:@"skew"]) return YES;
891+
}
892+
893+
return NO;
894+
}
883895

884896
- (GLKMatrix4) startMatrix;
885897
{

SpriteBuilder/ccBuilder/InspectorPropertyPaneBuilder.m

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -202,40 +202,6 @@ - (void)loadPropertyEditorNibWithType:(NSString *)type inspectorValue:(Inspector
202202
}
203203
}
204204

205-
- (BOOL)isDisabledProperty:(NSString *)name animatable:(BOOL)animatable
206-
{
207-
// Only animatable properties can be disabled
208-
if (!animatable)
209-
{
210-
return NO;
211-
}
212-
213-
SequencerSequence *sequence = _sequenceHandler.currentSequence;
214-
SequencerNodeProperty *sequencerNodeProperty = [_node sequenceNodeProperty:name sequenceId:sequence.sequenceId];
215-
216-
// Do not disable if animation hasn't been enabled
217-
if (!sequencerNodeProperty)
218-
{
219-
return NO;
220-
}
221-
222-
// Disable visiblilty if there are keyframes
223-
if (sequencerNodeProperty.keyframes.count > 0 && [name isEqualToString:@"visible"])
224-
{
225-
return YES;
226-
}
227-
228-
// Do not disable if we are currently at a keyframe
229-
if ([sequencerNodeProperty hasKeyframeAtTime:sequence.timelinePosition])
230-
{
231-
return NO;
232-
}
233-
234-
// Between keyframes - disable
235-
return YES;
236-
}
237-
238-
239205
- (void)resetKeyViewLoop
240206
{
241207
NSString *privateFunction = [NSString stringWithFormat:@"%@%@%@", @"_setDefault", @"KeyView", @"Loop"];
@@ -319,10 +285,6 @@ - (void)addProperties:(PlugInNode *)plugIn
319285
}
320286

321287
BOOL readOnly = [propInfo[@"readOnly"] boolValue];
322-
if ([self isDisabledProperty:name animatable:animated])
323-
{
324-
readOnly = YES;
325-
}
326288

327289
// Handle Flash skews
328290
BOOL usesFlashSkew = [_node usesFlashSkew];

SpriteBuilder/ccBuilder/InspectorValue.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,47 @@ -(BOOL)readOnly
8787
if([selection shouldDisableProperty:propertyName])
8888
return YES;
8989

90+
if([self isDisabledProperty])
91+
return YES;
92+
9093
return readOnly;
9194
}
9295

96+
- (BOOL)isDisabledProperty
97+
{
98+
BOOL animatable = [selection.plugIn isAnimatableProperty:propertyName node:selection];
99+
100+
// Only animatable properties can be disabled
101+
if (!animatable)
102+
{
103+
return NO;
104+
}
105+
106+
SequencerSequence *sequence = [SequencerHandler sharedHandler].currentSequence;
107+
SequencerNodeProperty *sequencerNodeProperty = [selection sequenceNodeProperty:propertyName sequenceId:sequence.sequenceId];
108+
109+
// Do not disable if animation hasn't been enabled
110+
if (!sequencerNodeProperty)
111+
{
112+
return NO;
113+
}
114+
115+
// Disable visiblilty if there are keyframes
116+
if (sequencerNodeProperty.keyframes.count > 0 && [propertyName isEqualToString:@"visible"])
117+
{
118+
return YES;
119+
}
120+
121+
// Do not disable if we are currently at a keyframe
122+
if ([sequencerNodeProperty hasKeyframeAtTime:sequence.timelinePosition])
123+
{
124+
return NO;
125+
}
126+
127+
// Between keyframes - disable
128+
return YES;
129+
}
130+
93131
- (void) updateAffectedProperties
94132
{
95133
if (affectsProperties)

SpriteBuilder/ccBuilder/NodePhysicsBody.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#import "AppDelegate.h"
2727
#import "PolyDecomposition.h"
2828
#import "NSArray+Query.h"
29+
#import "SequencerHandler.h"
2930

3031
#define kCCBPhysicsMinimumDefaultCircleRadius 16
3132

@@ -41,7 +42,11 @@ - (id) initWithNode:(CCNode*) node
4142

4243
[self setupDefaultPolygonForNode:node];
4344

44-
_dynamic = !node.hasKeyframes;
45+
_dynamic = !([node hasKeyframesForProperty:@"position"] ||
46+
[node hasKeyframesForProperty:@"scale"] ||
47+
[node hasKeyframesForProperty:@"rotation"] ||
48+
[node hasKeyframesForProperty:@"skew"]);
49+
4550
_affectedByGravity = YES;
4651
_allowsRotation = YES;
4752

@@ -295,6 +300,8 @@ - (void) setDynamic:(BOOL)dynamic
295300
{
296301
[[AppDelegate appDelegate] saveUndoStateWillChangeProperty:@"*P*dynamic"];
297302
_dynamic = dynamic;
303+
304+
[[SequencerHandler sharedHandler] redrawTimeline];
298305
}
299306

300307
- (void) setAffectedByGravity:(BOOL)affectedByGravity

SpriteBuilder/ccBuilder/PhysicsHandler.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#import "CCBGLView.h"
4444
#import "InspectorController.h"
4545
#import "SBPasteboardTypes.h"
46+
#import "SequencerHandler.h"
4647

4748
#define kCCBPhysicsHandleRadius 5
4849
#define kCCBPhysicsLineSegmFuzz 5
@@ -94,14 +95,17 @@ - (void) setSelectedNodePhysicsEnabled:(BOOL)enabled
9495

9596
// Update physics body
9697
self.selectedNodePhysicsBody = [AppDelegate appDelegate].selectedNode.nodePhysicsBody;
98+
99+
// Refresh Timeline
100+
[[SequencerHandler sharedHandler] redrawTimeline];
97101
}
98102

99103
- (BOOL) selectedNodePhysicsEnabled
100104
{
101105
return [AppDelegate appDelegate].selectedNode.nodePhysicsBody != nil;
102106
}
103107

104-
-(BOOL)selectedNodeHasKeyframes
108+
- (BOOL)selectedNodeHasKeyframes
105109
{
106110
if([AppDelegate appDelegate].selectedNode==nil) return FALSE;
107111

@@ -110,7 +114,6 @@ -(BOOL)selectedNodeHasKeyframes
110114
[[AppDelegate appDelegate].selectedNode hasKeyframesForProperty:@"rotation"] ||
111115
[[AppDelegate appDelegate].selectedNode hasKeyframesForProperty:@"skew"]) {
112116

113-
[[AppDelegate appDelegate].selectedNode.physicsBody setType:CCPhysicsBodyTypeStatic];
114117
return TRUE;
115118
}
116119

SpriteBuilder/ccBuilder/SequencerHandler.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,8 @@ - (BOOL) canInsertKeyframeNamed:(NSString*)prop
16131613

16141614
return !(!node
16151615
|| !prop
1616-
|| [node shouldDisableProperty:prop])
1616+
|| [node shouldDisableProperty:prop]
1617+
|| [node shouldDisableKeyframe:prop])
16171618
&& [[node.plugIn animatablePropertiesForNode:node] containsObject:prop];
16181619

16191620
}

SpriteBuilder/ccBuilder/SequencerStructureCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ - (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
100100
SequencerNodeProperty* seqNodeProp = [node sequenceNodeProperty:prop sequenceId:seq.sequenceId];
101101
BOOL hasKeyframes = ([seqNodeProp.keyframes count] > 0);
102102

103-
if ([node shouldDisableProperty:prop])
103+
if ([node shouldDisableProperty:prop] || [node shouldDisableKeyframe:prop])
104104
{
105105
[attrib setObject:textColorDisabled forKey:NSForegroundColorAttributeName];
106106
}

circle.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ checkout:
55
test:
66
override:
77
- rake test
8-
8+
post:
9+
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
10+
- cp test_results.xml $CIRCLE_TEST_REPORTS/junit/
911
deployment:
1012
develop:
1113
branch: develop

0 commit comments

Comments
 (0)