From Test-Scratch-Wiki

< Eng:Scratch File Format (1.4)(Redirected from Eng:Scratch File Format/User-class Objects)

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.

Morphic-related

100 Morph

bounds, owner, submorphs, color, flags, properties

Base class for most UserObjects.

101 BorderedMorph

inherits [[Eng:#100_Morph|Morph]]

borderWidth, borderColor

102 RectangleMorph

inherits [[Eng:#101_BorderedMorph|BorderedMorph]]

103 EllipseMorph

inherits [[Eng:#101_BorderedMorph|BorderedMorph]]

104 AlignmentMorph

inherits [[Eng:#102_RectangleMorph|RectangleMorph]]

orientation, centering, hResizing, vResizing, inset

105 StringMorph

inherits [[Eng:#100_Morph|Morph]]

font with size, emphasis, contents

106 UpdatingStringMorph

inherits [[Eng:#105_StringMorph|StringMorph]]

107 SimpleSliderMorph

inherits [[Eng:#101_BorderedMorph|BorderedMorph]]

slider, value, setValueSelector, sliderShadow, sliderColor, descending, model, target, actionSelector, arguments, actWhen

108 SimpleButtonMorph

inherits [[Eng:#102_RectangleMorph|RectangleMorph]]

target, actionSelector, arguments, actWhen

109 SampledSound

envelopes, scaledVol, initialCount, samples, originalSamplingRate, samplesSize, scaledIncrement, scaledInitialIndex

110 ImageMorph

inherits [[Eng:#100_Morph|Morph]]

form, transparency

111 SketchMorph

inherits [[Eng:#100_Morph|Morph]]

originalForm, rotationCenter, rotationDegrees, rotationStyle, scalePoint, offsetWhenRotated

Scratch-specific classes

ScriptableScratchMorph

inherits [[Eng:#100_Morph|Morph]]

objName, vars, blocksBin, isClone, media, costume

Contains methods for scripting.

123 SensorBoardMorph

inherits [[Eng:#100_Morph|Morph]]

unknown

Has a single extra field — I have no idea what it does. Maybe somebody with a sensor board could check this?

124 ScratchSpriteMorph

inherits [[Eng:#ScriptableScratchMorph|ScriptableScratchMorph]]

visibility, scalePoint, rotationDegrees, rotationStyle, volume, tempoBPM, draggable, sceneStates, lists

A Sprite object.

125 ScratchStageMorph

inherits [[Eng:#ScriptableScratchMorph|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 [[Eng:#100_Morph|Morph]]

Unused.

141 ColorArgMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

142 ExpressionArgMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

145 SpriteArgMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

147 BlockMorph

inherits [[Eng:#100_Morph|Morph]]

isSpecialForm, oldColor

Unused.

148 CommandBlockMorph

inherits [[Eng:#147_BlockMorph|BlockMorph]]

commandSpec, argMorphs, titleMorph, receiver, selector, isReporter, isTimed, wantsName, wantsPossession

Unused.

149 CBlockMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

151 HatBlockMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

153 ScratchScriptsMorph

inherits [[Eng:#101_BorderedMorph|BorderedMorph]]

Unused.

154 ScratchSliderMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

155 WatcherMorph

inherits [[Eng:#104_AlignmentMorph|AlignmentMorph]]

titleMorph, readout, readoutFrame, scratchSlider, watcher, isSpriteSpecific, unused, sliderMin, sliderMax, isLarge

A variable watcher.

157 SetterBlockMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

158 EventHatMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

160 VariableBlockMorph

inherits [[Eng:#148_CommandBlockMorph|CommandBlockMorph]]

isBoolean

Unused.

ScratchMedia

mediaName

162 ImageMedia

inherits [[Eng:#ScratchMedia|ScratchMedia]]

form, rotationCenter, textBox, jpegBytes, compositeForm

163 MovieMedia

inherits [[Eng:#ScratchMedia|ScratchMedia]]

fileName, fade, fadeColor, zoom, hPan, vPan, msecsPerFrame, currentFrame, moviePlaying

Unused.

164 SoundMedia

inherits [[Eng:#ScratchMedia|ScratchMedia]]

originalSound, volume, balance, compressedSampleRate, compressedBitsPerSample, compressedData

165 KeyEventHatMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

166 BooleanArgMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

167 EventTitleMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

168 MouseClickEventHatMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

169 ExpressionArgMorphWithMenu

inherits [[Eng:#100_Morph|Morph]]

Unused.

170 ReporterBlockMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

171 MultilineStringMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.

172 ToggleButton

inherits [[Eng:#108_SimpleButtonMorph|SimpleButtonMorph]]

Unused.

173 WatcherReadoutFrameMorph

inherits [[Eng:#101_BorderedMorph|BorderedMorph]]

Unused.

174 WatcherSliderMorph

inherits [[Eng:#107_SimpleSliderMorph|SimpleSliderMorph]]

Unused.

175 ScratchListMorph

inherits [[Eng:#101_BorderedMorph|BorderedMorph]]

listName, cellMorphs, target

A List object. List items are found in the cellMorphs attribute.

176 ScrollingStringMorph

inherits [[Eng:#100_Morph|Morph]]

Unused.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.