made block vars transient for block libraries

upd4.1
Jens Mönig 2017-10-04 16:23:41 +02:00
rodzic 385ca6f891
commit bbc16d1328
3 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -108,7 +108,7 @@ BooleanSlotMorph, XML_Serializer*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.byob = '2017-September-26'; modules.byob = '2017-October-04';
// Declarations // Declarations
@ -3755,7 +3755,7 @@ BlockExportDialogMorph.prototype.selectNone = function () {
// BlockExportDialogMorph ops // BlockExportDialogMorph ops
BlockExportDialogMorph.prototype.exportBlocks = function () { BlockExportDialogMorph.prototype.exportBlocks = function () {
var str = this.serializer.serialize(this.blocks), var str = this.serializer.serialize(this.blocks, true), // for library
ide = this.world().children[0]; ide = this.world().children[0];
if (this.blocks.length > 0) { if (this.blocks.length > 0) {

Wyświetl plik

@ -3676,6 +3676,7 @@ Fixes:
171004 171004
------ ------
* Objects: limited sprites' direction and coordinates to finite numbers * Objects: limited sprites' direction and coordinates to finite numbers
* Store, BYOB: made block vars transient for block libraries
v4.1 Features: v4.1 Features:
@ -3726,3 +3727,4 @@ Fixes:
* fixed occasional empty drop-down menu items named “close” * fixed occasional empty drop-down menu items named “close”
* fixed some typos * fixed some typos
* limited sprites' direction and coordinates to finite numbers * limited sprites' direction and coordinates to finite numbers
* made block vars transient for block libraries

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.store = '2017-September-28'; modules.store = '2017-October-04';
// XML_Serializer /////////////////////////////////////////////////////// // XML_Serializer ///////////////////////////////////////////////////////
@ -79,6 +79,7 @@ function XML_Serializer() {
this.contents = []; this.contents = [];
this.media = []; this.media = [];
this.isCollectingMedia = false; this.isCollectingMedia = false;
this.isExportingBlocksLibrary = false;
} }
// XML_Serializer preferences settings: // XML_Serializer preferences settings:
@ -90,11 +91,12 @@ XML_Serializer.prototype.version = 1; // increment on structural change
// XML_Serializer accessing: // XML_Serializer accessing:
XML_Serializer.prototype.serialize = function (object) { XML_Serializer.prototype.serialize = function (object, forBlocksLibrary) {
// public: answer an XML string representing the given object // public: answer an XML string representing the given object
var xml; var xml;
this.flush(); // in case an error occurred in an earlier attempt this.flush(); // in case an error occurred in an earlier attempt
this.flushMedia(); this.flushMedia();
this.isExportingBlocksLibrary = forBlocksLibrary;
xml = this.store(object); xml = this.store(object);
this.flush(); this.flush();
return xml; return xml;
@ -187,6 +189,7 @@ XML_Serializer.prototype.flushMedia = function () {
}); });
} }
this.media = []; this.media = [];
this.isExportingBlocksLibrary = false;
}; };
// XML_Serializer formatting: // XML_Serializer formatting:
@ -1925,7 +1928,9 @@ CustomCommandBlockMorph.prototype.toBlockXML = function (serializer) {
this.isGlobal ? this.isGlobal ?
'' : serializer.format(' scope="@"', scope), '' : serializer.format(' scope="@"', scope),
serializer.store(this.inputs()), serializer.store(this.inputs()),
this.isGlobal && this.definition.variableNames.length ? this.isGlobal &&
this.definition.variableNames.length &&
!serializer.isExportingBlocksLibrary ?
'<variables>' + '<variables>' +
this.variables.toXML(serializer) + this.variables.toXML(serializer) +
'</variables>' '</variables>'