kopia lustrzana https://github.com/backface/turtlestitch
persist temporary costumes that aren't in the wardrobe
e.g. generated graphics, maps, paste-upspull/89/head
rodzic
5d152c1973
commit
abc03499b8
|
@ -6,6 +6,7 @@
|
|||
* new "rgba" option in "(aspect) AT (location)" sensing reporter, returns a 4-item list of values from 0-255 (same is pixels from a costume)
|
||||
* "temporary?" attribute is now programmatically settable (in the SET->my... block)
|
||||
* **Notable Changes:**
|
||||
* generated costumes that are not in the wardrobe are not made persistent in the project (saved & restored)
|
||||
* **Notable Fixes:**
|
||||
* fixed tainted audio context for auto-playing projects when the user interacts, thanks, Bernat!
|
||||
* **Translation Updates:**
|
||||
|
@ -18,6 +19,7 @@
|
|||
* blocks, threads: made "temporary?" attribute for clones settable (in the SET->my... block)
|
||||
* objects: made the "paste on" block avaible in the "pen" palette
|
||||
* fix for tainted audio context when the user interacts with an auto-playing project
|
||||
* store: persist temporary costumes that aren't in the wardrobe (e.g. generated graphics, maps, paste-ups)
|
||||
* German translation update
|
||||
* Galician translation update, thanks, Miguel!
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<script type="text/javascript" src="src/video.js?version=2019-06-27"></script>
|
||||
<script type="text/javascript" src="src/maps.js?version=2019-06-27"></script>
|
||||
<script type="text/javascript" src="src/xml.js?version=2019-06-27"></script>
|
||||
<script type="text/javascript" src="src/store.js?version=2019-06-27"></script>
|
||||
<script type="text/javascript" src="src/store.js?version=2019-08-07"></script>
|
||||
<script type="text/javascript" src="src/locale.js?version=2019-08-07"></script>
|
||||
<script type="text/javascript" src="src/cloud.js?version=2019-07-17"></script>
|
||||
<script type="text/javascript" src="src/sha512.js?version=2019-06-27"></script>
|
||||
|
|
37
src/store.js
37
src/store.js
|
@ -61,7 +61,7 @@ normalizeCanvas, contains*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.store = '2019-June-02';
|
||||
modules.store = '2019-August-07';
|
||||
|
||||
|
||||
// XML_Serializer ///////////////////////////////////////////////////////
|
||||
|
@ -255,7 +255,7 @@ SnapSerializer.uber = XML_Serializer.prototype;
|
|||
|
||||
// SnapSerializer constants:
|
||||
|
||||
SnapSerializer.prototype.app = 'Snap! 5.0, http://snap.berkeley.edu';
|
||||
SnapSerializer.prototype.app = 'Snap! 5.1, http://snap.berkeley.edu';
|
||||
|
||||
SnapSerializer.prototype.thumbnailSize = new Point(160, 120);
|
||||
|
||||
|
@ -772,7 +772,9 @@ SnapSerializer.prototype.loadMediaModel = function (xmlNode) {
|
|||
SnapSerializer.prototype.loadObject = function (object, model) {
|
||||
// private
|
||||
var blocks = model.require('blocks'),
|
||||
dispatches = model.childNamed('dispatches');
|
||||
dispatches = model.childNamed('dispatches'),
|
||||
node,
|
||||
costume;
|
||||
|
||||
// load the instrument
|
||||
if (model.attributes.instrument) {
|
||||
|
@ -782,6 +784,20 @@ SnapSerializer.prototype.loadObject = function (object, model) {
|
|||
this.loadInheritanceInfo(object, model);
|
||||
this.loadNestingInfo(object, model);
|
||||
|
||||
// load the costume that's not in the wardrobe, if any
|
||||
node = model.childNamed('costume');
|
||||
if (node) {
|
||||
costume = this.loadValue(node, object);
|
||||
if (costume.loaded) {
|
||||
object.wearCostume(costume, true);
|
||||
} else {
|
||||
costume.loaded = function () {
|
||||
object.wearCostume(costume, true);
|
||||
this.loaded = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// load costumes unless they're inherited
|
||||
if (!(object.inheritanceInfo &&
|
||||
(object.inheritanceInfo.delegated instanceof Array) &&
|
||||
|
@ -1669,6 +1685,7 @@ StageMorph.prototype.toXML = function (serializer) {
|
|||
true
|
||||
),
|
||||
thumbdata,
|
||||
costumeIdx = this.getCostumeIdx(),
|
||||
ide = this.parentThatIsA(IDE_Morph);
|
||||
|
||||
// catch cross-origin tainting exception when using SVG costumes
|
||||
|
@ -1711,6 +1728,7 @@ StageMorph.prototype.toXML = function (serializer) {
|
|||
'sublistIDs="@" ' +
|
||||
'scheduled="@" ~>' +
|
||||
'<pentrails>$</pentrails>' +
|
||||
'%' + // current costume, if it's not in the wardrobe
|
||||
'<costumes>%</costumes>' +
|
||||
'<sounds>%</sounds>' +
|
||||
'<variables>%</variables>' +
|
||||
|
@ -1731,7 +1749,7 @@ StageMorph.prototype.toXML = function (serializer) {
|
|||
this.name,
|
||||
StageMorph.prototype.dimensions.x,
|
||||
StageMorph.prototype.dimensions.y,
|
||||
this.getCostumeIdx(),
|
||||
costumeIdx,
|
||||
this.color.r,
|
||||
this.color.g,
|
||||
this.color.b,
|
||||
|
@ -1749,6 +1767,10 @@ StageMorph.prototype.toXML = function (serializer) {
|
|||
this.enableSublistIDs,
|
||||
StageMorph.prototype.frameRate !== 0,
|
||||
normalizeCanvas(this.trailsCanvas, true).toDataURL('image/png'),
|
||||
|
||||
// current costume, if it's not in the wardrobe
|
||||
!costumeIdx && this.costume ? serializer.store(this.costume) : '',
|
||||
|
||||
serializer.store(this.costumes, this.name + '_cst'),
|
||||
serializer.store(this.sounds, this.name + '_snd'),
|
||||
serializer.store(this.variables),
|
||||
|
@ -1771,6 +1793,7 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
|||
var stage = this.parentThatIsA(StageMorph),
|
||||
ide = stage ? stage.parentThatIsA(IDE_Morph) : null,
|
||||
idx = ide ? ide.sprites.asArray().indexOf(this) + 1 : 0,
|
||||
costumeIdx = this.getCostumeIdx(),
|
||||
noCostumes = this.inheritsAttribute('costumes'),
|
||||
noSounds = this.inheritsAttribute('sounds'),
|
||||
noScripts = this.inheritsAttribute('scripts');
|
||||
|
@ -1788,6 +1811,7 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
|||
' costume="@" color="@,@,@,@" pen="@" ~>' +
|
||||
'%' + // inheritance info
|
||||
'%' + // nesting info
|
||||
'%' + // current costume
|
||||
(noCostumes ? '%' : '<costumes>%</costumes>') +
|
||||
(noSounds ? '%' : '<sounds>%</sounds>') +
|
||||
'<blocks>%</blocks>' +
|
||||
|
@ -1808,7 +1832,7 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
|||
' instrument="' + parseInt(this.instrument) + '" ' : '',
|
||||
this.isDraggable,
|
||||
this.isVisible ? '' : ' hidden="true"',
|
||||
this.getCostumeIdx(),
|
||||
costumeIdx,
|
||||
this.color.r,
|
||||
this.color.g,
|
||||
this.color.b,
|
||||
|
@ -1840,6 +1864,9 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
|||
+ '"/>'
|
||||
: '',
|
||||
|
||||
// current costume, if it's not in the wardrobe
|
||||
!costumeIdx && this.costume ? serializer.store(this.costume) : '',
|
||||
|
||||
noCostumes ? '' : serializer.store(this.costumes, this.name + '_cst'),
|
||||
noSounds ? '' : serializer.store(this.sounds, this.name + '_snd'),
|
||||
!this.customBlocks ? '' : serializer.store(this.customBlocks),
|
||||
|
|
Ładowanie…
Reference in New Issue