export and import nested sprites

pull/3/merge
jmoenig 2014-07-29 12:03:06 +02:00
rodzic b451a08812
commit bef0e7a790
3 zmienionych plików z 22 dodań i 2 usunięć

2
gui.js
Wyświetl plik

@ -2850,7 +2850,7 @@ IDE_Morph.prototype.exportGlobalBlocks = function () {
};
IDE_Morph.prototype.exportSprite = function (sprite) {
var str = this.serializer.serialize(sprite);
var str = this.serializer.serialize(sprite.allParts());
window.open('data:text/xml,<sprites app="'
+ this.serializer.app
+ '" version="'

Wyświetl plik

@ -2243,3 +2243,4 @@ ______
------
* fixed #526, thanks, Bernat, for reporting it!
* Objects, GUI: duplicate and clone nested sprites
* GUI, Store: export and import nested sprites

Wyświetl plik

@ -61,7 +61,7 @@ SyntaxElementMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2014-Jun-04';
modules.store = '2014-July-29';
// XML_Serializer ///////////////////////////////////////////////////////
@ -618,6 +618,25 @@ SnapSerializer.prototype.loadSprites = function (xmlString, ide) {
sprite.gotoXY(+model.attributes.x || 0, +model.attributes.y || 0);
myself.loadObject(sprite, model);
});
// restore nesting associations
project.stage.children.forEach(function (sprite) {
var anchor;
if (sprite.nestingInfo) { // only sprites may have nesting info
anchor = project.sprites[sprite.nestingInfo.anchor];
if (anchor) {
anchor.attachPart(sprite);
}
sprite.rotatesWithAnchor = (sprite.nestingInfo.synch === 'true');
}
});
project.stage.children.forEach(function (sprite) {
if (sprite.nestingInfo) { // only sprites may have nesting info
sprite.nestingScale = +(sprite.nestingInfo.scale || sprite.scale);
delete sprite.nestingInfo;
}
});
this.objects = {};
this.project = {};
this.mediaDict = {};