Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
300 lines (253 sloc) 8.97 KB

CocosBuilder - CCB File Format

This is a description of the CocosBuilder save file format. It is also used internally in CocosBuilder and is used by export plug-ins. Published files are (by default) saved in the CCBi file format.

Structure

CCB files are simple Plist-files with a ccb extension. To dissect a CCB file in Xcode, simple rename the extension to .plist and open it with Xcode.

Document (top level)

The root node in a CCB file is a dictionary. It contains the following properties.

KeyTypeComment
fileTypeStringMust be CocosBuilder
fileVersionNumberMust be 4
stageWidthNumberThe width of the stage in points
stageHeightNumberThe height of the stage in points
centeredOriginBooleanYes if the stage origin is centered, no if it is bottom left
exportPlugInStringOptional, the extension of the export plug-in last used
exportPathStringOptional, the full path to the file last published
nodeGraphDictionaryNode (as defined below)
guidesArrayArray of Guide (as defined below)
notesArrayArray of Note (as defined below)
resolutionsArrayArray of ResolutionSetting (as defined below)
currentResolutionNumberIndex of the currently selected resolution setting
sequencesArrayArray of Sequence (as defined below)
currentSequenceIdNumberId of the currently selected sequence

Node

Represents a CCNode or a sub class of a CCNode.

KeyTypeComment
baseClassStringName of base class plug-in used, e.g. CCNode or CCSprite
customClassStringName of super class defined in editor, e.g. HelloCocosBuilder
memberVarAssignmentNameStringName of member var this node is assigned to
memberVarAssignmentTypeNumber0 = don't assign, 1 = assign to root node, 2 = assign to owner
propertiesArrayArray of Property (as defined below), this defines all properties that are assigned to the node
childrenArrayArray of Node, list of all children's of this node
selectedNumberTrue if node is selected
seqExpandedNumberTrue if node is expanded, so that animatable properties are visible
displayNameStringName used for displaying the node
animatedPropertiesDictionaryKeys are String representations of sequence ids, values are AnimatedProperties (as defined below)

Guide

Represents a guide in the canvas area.

KeyTypeComment
orientationNumberThe orientation of the guide, 0 = horizontal, 1 = vertical
positionNumberPosition of the guide in pixels

Note

Represents a sticky note in the canvas area.

KeyTypeComment
textStringThe text on the sticky note (can be left out)
widthNumberWidth of sticky note in pixels
heightNumberHeight of sticky note in pixels
xPosNumberx position of the note in pixels
yPosNumbery position of the note in pixels

ResolutionSetting

Represents a resolution setting.

KeyTypeComment
nameStringThe name of the resolution setting
widthNumberWidth in points of the resolution
heightNumberHeight in points of the resolution
extStringExtensions separated by space for use with the resolution
scaleNumberResolution scale factor
centeredOriginNumberHas centered origin

Sequence

Represents information about a timeline.

KeyTypeComment
scaleNumberThe scale currently used for displaying the sequence
offsetNumberOffset by current horizontal scroll
lengthNumberLength of sequence (in seconds)
resolutionNumberResolution of timeline (should be 30)
nameStringName of the sequence
sequenceIdNumberId number of the sequence
chainedSequenceIdNumberId number of the sequence to be played after this one, -1 if none is selected
autoPlayNumberTrue if this sequence should be automatically played when the ccbi file is loaded

Property

Represents a property of a Node. Too see how different properties are serialized, please see Property Types.

KeyTypeComment
typeStringName of the type of property, property types are described below
nameStringName of the property, e.g. contentSize or position
valuen/aDifferent property types are serialized in different ways
platformStringOptional, can be iOS or Mac. Set if a property is only supported for a specific platform

AnimatedProperties

Represents the animated properties of a node, for a specific sequence. Keys are the name of the properties and values are SequenceNodeProperty (as defined below).

SequenceNodeProperty

Represents an animated property for a specific node and sequence.

KeyTypeComment
nameStringName of property
typeNumberType of the property (as described in Animated Properties)
keyframesStringArray of Keyframe (as described below)

Keyframe

Represents a keyframe.

KeyTypeComment
valueObjectSerialization of a value (as describe in Animated Properties)
typeNumberType of the property (as described in Animated Properties)
nameStringName of property
timeNumberThe time of the keyframe (in seconds)
easingDictionaryKeyframeEasing (as described below)

KeyframeEasing

Represents the easing of a keyframe (from the associated keyframe to the following).

KeyTypeComment
typeNumber0 = Instant, 1 = Linear, 2 = CubicIn, 3 = CubicOut, 4 = CubicInOut, 5 = ElasticIn, 6 = ElasticOut, 7 = ElasticInOut, 8 = BounceIn, 9 = BounceOut, 10 = BounceInOut, 11 = BackIn, 12 = BackOut, 13 = BackInOut
optNumberOptions for the easing. Only saved for cubic (rate value) and elastic (period value) easings