Skip to content

X3. CCB File Format

fyf edited this page Aug 21, 2014 · 1 revision

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.

Key Type Comment
fileType String Must be CocosBuilder
fileVersion Number Must be 4
stageWidth Number The width of the stage in points
stageHeight Number The height of the stage in points
centeredOrigin Boolean Yes if the stage origin is centered, no if it is bottom left
exportPlugIn String Optional, the extension of the export plug-in last used
exportPath String Optional, the full path to the file last published
nodeGraph Dictionary Node (as defined below)
guides Array Array of Guide (as defined below)
notes Array Array of Note (as defined below)
resolutions Array Array of ResolutionSetting (as defined below)
currentResolution Number Index of the currently selected resolution setting
sequences Array Array of Sequence (as defined below)
currentSequenceId Number Id of the currently selected sequence

Node

Represents a CCNode or a sub class of a CCNode.

Key Type Comment
baseClass String Name of base class plug-in used, e.g. CCNode or CCSprite
customClass String Name of super class defined in editor, e.g. HelloCocosBuilder
memberVarAssignmentName String Name of member var this node is assigned to
memberVarAssignmentType Number 0 = don't assign, 1 = assign to root node, 2 = assign to owner
properties Array Array of Property (as defined below), this defines all properties that are assigned to the node
children Array Array of Node, list of all children's of this node
selected Number True if node is selected
seqExpanded Number True if node is expanded, so that animatable properties are visible
displayName String Name used for displaying the node
animatedProperties Dictionary Keys are String representations of sequence ids, values are AnimatedProperties (as defined below)

Guide

Represents a guide in the canvas area.

Key Type Comment
orientation Number The orientation of the guide, 0 = horizontal, 1 = vertical
position Number Position of the guide in pixels

Note

Represents a sticky note in the canvas area.

Key Type Comment
text String The text on the sticky note (can be left out)
width Number Width of sticky note in pixels
height Number Height of sticky note in pixels
xPos Number x position of the note in pixels
yPos Number y position of the note in pixels

ResolutionSetting

Represents a resolution setting.

Key Type Comment
name String The name of the resolution setting
width Number Width in points of the resolution
height Number Height in points of the resolution
ext String Extensions separated by space for use with the resolution
scale Number Resolution scale factor
centeredOrigin Number Has centered origin

Sequence

Represents information about a timeline.

Key Type Comment
scale Number The scale currently used for displaying the sequence
offset Number Offset by current horizontal scroll
length Number Length of sequence (in seconds)
resolution Number Resolution of timeline (should be 30)
name String Name of the sequence
sequenceId Number Id number of the sequence
chainedSequenceId Number Id number of the sequence to be played after this one, -1 if none is selected
autoPlay Number True 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.

Key Type Comment
type String Name of the type of property, property types are described below
name String Name of the property, e.g. contentSize or position
value n/a Different property types are serialized in different ways
platform String Optional, 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.

Key Type Comment
name String Name of property
type Number Type of the property (as described in Animated Properties)
keyframes String Array of Keyframe (as described below)

Keyframe

Represents a keyframe.

Key Type Comment
value Object Serialization of a value (as describe in Animated Properties)
type Number Type of the property (as described in Animated Properties)
name String Name of property
time Number The time of the keyframe (in seconds)
easing Dictionary KeyframeEasing (as described below)

KeyframeEasing

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

Key Type Comment
type Number 0 = 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
opt Number Options for the easing. Only saved for cubic (rate value) and elastic (period value) easings