kopia lustrzana https://github.com/backface/turtlestitch
tweaks to saving shared resources
rodzic
ebc08a1f73
commit
acfd0629fe
|
@ -5139,7 +5139,9 @@ SpriteMorph.prototype.setExemplar = function (another) {
|
||||||
ide.flushBlocksCache('variables');
|
ide.flushBlocksCache('variables');
|
||||||
ide.refreshPalette();
|
ide.refreshPalette();
|
||||||
}
|
}
|
||||||
another.cachedSpecimens = null;
|
if (another) {
|
||||||
|
another.cachedSpecimens = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SpriteMorph.prototype.allExemplars = function () {
|
SpriteMorph.prototype.allExemplars = function () {
|
||||||
|
|
27
store.js
27
store.js
|
@ -730,8 +730,17 @@ SnapSerializer.prototype.loadObject = function (object, model) {
|
||||||
dispatches = model.childNamed('dispatches');
|
dispatches = model.childNamed('dispatches');
|
||||||
this.loadInheritanceInfo(object, model);
|
this.loadInheritanceInfo(object, model);
|
||||||
this.loadNestingInfo(object, model);
|
this.loadNestingInfo(object, model);
|
||||||
this.loadCostumes(object, model);
|
|
||||||
|
// loads costumes unless they're inherited
|
||||||
|
if (object.inheritanceInfo &&
|
||||||
|
(object.inheritanceInfo.delegated instanceof Array) &&
|
||||||
|
contains(object.inheritanceInfo.delegated, 'costumes')) {
|
||||||
|
} else {
|
||||||
|
this.loadCostumes(object, model);
|
||||||
|
}
|
||||||
|
|
||||||
this.loadSounds(object, model);
|
this.loadSounds(object, model);
|
||||||
|
|
||||||
this.loadCustomBlocks(object, blocks);
|
this.loadCustomBlocks(object, blocks);
|
||||||
if (dispatches) {
|
if (dispatches) {
|
||||||
this.loadCustomBlocks(object, dispatches, false, true);
|
this.loadCustomBlocks(object, dispatches, false, true);
|
||||||
|
@ -1616,6 +1625,8 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
||||||
var stage = this.parentThatIsA(StageMorph),
|
var stage = this.parentThatIsA(StageMorph),
|
||||||
ide = stage ? stage.parentThatIsA(IDE_Morph) : null,
|
ide = stage ? stage.parentThatIsA(IDE_Morph) : null,
|
||||||
idx = ide ? ide.sprites.asArray().indexOf(this) + 1 : 0,
|
idx = ide ? ide.sprites.asArray().indexOf(this) + 1 : 0,
|
||||||
|
noCostumes = this.inheritsAttribute('costumes'),
|
||||||
|
noSounds = this.inheritsAttribute('sounds'),
|
||||||
noScripts = this.inheritsAttribute('scripts');
|
noScripts = this.inheritsAttribute('scripts');
|
||||||
|
|
||||||
return serializer.format(
|
return serializer.format(
|
||||||
|
@ -1628,8 +1639,8 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
||||||
' costume="@" color="@,@,@" pen="@" ~>' +
|
' costume="@" color="@,@,@" pen="@" ~>' +
|
||||||
'%' + // inheritance info
|
'%' + // inheritance info
|
||||||
'%' + // nesting info
|
'%' + // nesting info
|
||||||
'<costumes>%</costumes>' +
|
(noCostumes ? '%' : '<costumes>%</costumes>') +
|
||||||
'<sounds>%</sounds>' +
|
(noSounds ? '%' : '<sounds>%</sounds>') +
|
||||||
'<blocks>%</blocks>' +
|
'<blocks>%</blocks>' +
|
||||||
'<variables>%</variables>' +
|
'<variables>%</variables>' +
|
||||||
(this.exemplar ? '<dispatches>%</dispatches>' : '%') +
|
(this.exemplar ? '<dispatches>%</dispatches>' : '%') +
|
||||||
|
@ -1675,13 +1686,11 @@ SpriteMorph.prototype.toXML = function (serializer) {
|
||||||
+ '"/>'
|
+ '"/>'
|
||||||
: '',
|
: '',
|
||||||
|
|
||||||
serializer.store(this.costumes, this.name + '_cst'),
|
noCostumes ? '' : serializer.store(this.costumes, this.name + '_cst'),
|
||||||
serializer.store(this.sounds, this.name + '_snd'),
|
noSounds ? '' : serializer.store(this.sounds, this.name + '_snd'),
|
||||||
!this.customBlocks ?
|
!this.customBlocks ? '' : serializer.store(this.customBlocks),
|
||||||
'' : serializer.store(this.customBlocks),
|
|
||||||
serializer.store(this.variables),
|
serializer.store(this.variables),
|
||||||
this.exemplar ?
|
this.exemplar ? serializer.store(this.inheritedMethods()) : '',
|
||||||
serializer.store(this.inheritedMethods()) : '',
|
|
||||||
noScripts ? '' : serializer.store(this.scripts)
|
noScripts ? '' : serializer.store(this.scripts)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue