< Scratch File Format (1.4)(Redirected from Scratch File Format/User-class Objects)
This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
- This is part of a technical description of the file format.
User-class objects are Objects which can change their attributes between Scratch versions — such as stage and Sprite. For example, the attribute for "lists" was only added in a later version.
Structure
classID
: one byte describing the type of object.version
: the version of the object, used to determine the value and type of the fields.length
: how many fields the object has (as this may change between versions).fields
: length number of fields (Inline Values and Object References).
Technical details
In Scratch's Squeak source code, each User-class Object implements the instance methods storeFieldsOn:
, initFromFieldsFrom:version:
, and fieldsVersion
(found under the object i/o
category). Inspecting these methods shows what fields on these objects are serialised.
(When the serialization format of an object is changed, the methods storeFieldsOn:
and initFromFieldsFrom:version:
are changed, and the version number returned by objStreamVersion is increased by one.)
Each User-class object can have a maximum of 255 fields.
List of User-class Objects
Some of the classes inherit from others. All Morphs inherit the properties of a Morph, for example. Inherited/superclass fields are serialised to the file before subclass fields.
100 Morph
bounds
,owner
,submorphs
,color
,flags
,properties
Base class for most UserObjects.
101 BorderedMorph
inherits Morph
borderWidth
,borderColor
102 RectangleMorph
inherits BorderedMorph
103 EllipseMorph
inherits BorderedMorph
104 AlignmentMorph
inherits RectangleMorph
orientation
,centering
,hResizing
,vResizing
,inset
105 StringMorph
inherits Morph
font with size
,emphasis
,contents
106 UpdatingStringMorph
inherits StringMorph
107 SimpleSliderMorph
inherits BorderedMorph
slider
,value
,setValueSelector
,sliderShadow
,sliderColor
,descending
,model
,target
,actionSelector
,arguments
,actWhen
108 SimpleButtonMorph
inherits RectangleMorph
target
,actionSelector
,arguments
,actWhen
109 SampledSound
envelopes
,scaledVol
,initialCount
,samples
,originalSamplingRate
,samplesSize
,scaledIncrement
,scaledInitialIndex
110 ImageMorph
inherits Morph
form
,transparency
111 SketchMorph
inherits Morph
originalForm
,rotationCenter
,rotationDegrees
,rotationStyle
,scalePoint
,offsetWhenRotated
Scratch-specific classes
ScriptableScratchMorph
inherits Morph
objName
,vars
,blocksBin
,isClone
,media
,costume
Contains methods for scripting.
123 SensorBoardMorph
inherits Morph
unknown
124 ScratchSpriteMorph
inherits ScriptableScratchMorph
visibility
,scalePoint
,rotationDegrees
,rotationStyle
,volume
,tempoBPM
,draggable
,sceneStates
,lists
A Sprite object.
125 ScratchStageMorph
inherits ScriptableScratchMorph
zoom
,hPan
,vPan
,obsoleteSavedState
,sprites
,volume
,tempoBPM
,sceneStates
,lists
The project stage. Sprites are stored as an attribute. The stage is the root object of the Object Table in Sprite files and project file contents.
140 ChoiceArgMorph
inherits Morph
Unused.
141 ColorArgMorph
inherits Morph
Unused.
142 ExpressionArgMorph
inherits Morph
Unused.
145 SpriteArgMorph
inherits Morph
Unused.
147 BlockMorph
inherits Morph
isSpecialForm
,oldColor
Unused.
148 CommandBlockMorph
inherits BlockMorph
commandSpec
,argMorphs
,titleMorph
,receiver
,selector
,isReporter
,isTimed
,wantsName
,wantsPossession
Unused.
149 CBlockMorph
inherits Morph
Unused.
151 HatBlockMorph
inherits Morph
Unused.
153 ScratchScriptsMorph
inherits BorderedMorph
Unused.
154 ScratchSliderMorph
inherits Morph
Unused.
155 WatcherMorph
inherits AlignmentMorph
titleMorph
,readout
,readoutFrame
,scratchSlider
,watcher
,isSpriteSpecific
,unused
,sliderMin
,sliderMax
,isLarge
A variable watcher.
157 SetterBlockMorph
inherits Morph
Unused.
158 EventHatMorph
inherits Morph
Unused.
160 VariableBlockMorph
inherits CommandBlockMorph
isBoolean
Unused.
ScratchMedia
mediaName
162 ImageMedia
inherits ScratchMedia
form
,rotationCenter
,textBox
,jpegBytes
,compositeForm
163 MovieMedia
inherits ScratchMedia
fileName
,fade
,fadeColor
,zoom
,hPan
,vPan
,msecsPerFrame
,currentFrame
,moviePlaying
Unused.
164 SoundMedia
inherits ScratchMedia
originalSound
,volume
,balance
,compressedSampleRate
,compressedBitsPerSample
,compressedData
165 KeyEventHatMorph
inherits Morph
Unused.
166 BooleanArgMorph
inherits Morph
Unused.
167 EventTitleMorph
inherits Morph
Unused.
168 MouseClickEventHatMorph
inherits Morph
Unused.
169 ExpressionArgMorphWithMenu
inherits Morph
Unused.
170 ReporterBlockMorph
inherits Morph
Unused.
171 MultilineStringMorph
inherits Morph
Unused.
172 ToggleButton
inherits SimpleButtonMorph
Unused.
173 WatcherReadoutFrameMorph
inherits BorderedMorph
Unused.
174 WatcherSliderMorph
inherits SimpleSliderMorph
Unused.
175 ScratchListMorph
inherits BorderedMorph
listName
,cellMorphs
,target
A List object. List items are found in the cellMorphs
attribute.
176 ScrollingStringMorph
inherits Morph
Unused.
Files | |
Structure |
Object Table • Inline Values • Objects • Fixed-format Objects • User-class Objects |
Contents |