kopia lustrzana https://github.com/backface/turtlestitch
export and import nested sprites
rodzic
b451a08812
commit
bef0e7a790
2
gui.js
2
gui.js
|
@ -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="'
|
||||
|
|
|
@ -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
|
||||
|
|
21
store.js
21
store.js
|
@ -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 = {};
|
||||
|
|
Ładowanie…
Reference in New Issue