allow wardrobe-less costumes to be shared among several sprites

e.g. when inheriting the "costume #" attribute
pull/89/head
jmoenig 2019-08-08 11:01:42 +02:00
rodzic 9641e5a460
commit cb1232c548
3 zmienionych plików z 23 dodań i 11 usunięć

Wyświetl plik

@ -13,6 +13,9 @@
* German
* Galician, thanks, Miguel!
### 2019-08-08
* store: allow wardrobe-less costumes to be shared among several sprites (e.g. when inheriting the "costume #" attribute)
### 2019-08-07
* new dev version
* blocks, threads: added "r-g-b-a" option to (aspect) AT (location) reporter in the sensing category

Wyświetl plik

@ -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-08-07"></script>
<script type="text/javascript" src="src/store.js?version=2019-08-08"></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>

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2019-August-07';
modules.store = '2019-August-08';
// XML_Serializer ///////////////////////////////////////////////////////
@ -785,16 +785,21 @@ SnapSerializer.prototype.loadObject = function (object, model) {
this.loadNestingInfo(object, model);
// load the costume that's not in the wardrobe, if any
node = model.childNamed('costume');
node = model.childNamed('wear');
if (node) {
costume = this.loadValue(node, object);
if (costume.loaded) {
object.wearCostume(costume, true);
node = node.childNamed('costume') || node.childNamed('ref');
if (!node) {
console.log(object.name + ': missing costume to wear');
} else {
costume.loaded = function () {
costume = this.loadValue(node, object);
if (costume.loaded) {
object.wearCostume(costume, true);
this.loaded = true;
};
} else {
costume.loaded = function () {
object.wearCostume(costume, true);
this.loaded = true;
};
}
}
}
@ -1769,7 +1774,9 @@ StageMorph.prototype.toXML = function (serializer) {
normalizeCanvas(this.trailsCanvas, true).toDataURL('image/png'),
// current costume, if it's not in the wardrobe
!costumeIdx && this.costume ? serializer.store(this.costume) : '',
!costumeIdx && this.costume ?
'<wear>' + serializer.store(this.costume) + '</wear>'
: '',
serializer.store(this.costumes, this.name + '_cst'),
serializer.store(this.sounds, this.name + '_snd'),
@ -1865,7 +1872,9 @@ SpriteMorph.prototype.toXML = function (serializer) {
: '',
// current costume, if it's not in the wardrobe
!costumeIdx && this.costume ? serializer.store(this.costume) : '',
!costumeIdx && this.costume ?
'<wear>' + serializer.store(this.costume) + '</wear>'
: '',
noCostumes ? '' : serializer.store(this.costumes, this.name + '_cst'),
noSounds ? '' : serializer.store(this.sounds, this.name + '_snd'),