stop all scripts for a sprite when shadowing or inheriting its scripts

also refresh inherited scripts of specimens in these cases
upd4.1
Jens Mönig 2017-06-21 07:51:47 +02:00
rodzic 3809c327df
commit 6a5be3776d
2 zmienionych plików z 17 dodań i 4 usunięć

Wyświetl plik

@ -3450,6 +3450,10 @@ Fixes:
* threads, blocks, ide: make sure to stop active processes when deleting a block
* objects: migrate experimental “wardrobe” reporters to the new “my costumes” reporter
170621
------
* objects: stop all scripts for a sprite when shadowing or inheriting its scripts
Features:
* polymorphic sprite-local custom blocks

Wyświetl plik

@ -82,7 +82,7 @@ SpeechBubbleMorph, RingMorph, isNil, FileReader, TableDialogMorph,
BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, localize,
TableMorph, TableFrameMorph, normalizeCanvas, BooleanSlotMorph, HandleMorph*/
modules.objects = '2017-June-20';
modules.objects = '2017-June-21';
var SpriteMorph;
var StageMorph;
@ -5205,12 +5205,18 @@ SpriteMorph.prototype.shadowAttribute = function (aName) {
});
this.costumes = wardrobe;
} else if (aName === 'scripts') {
ide.stage.threads.stopAllForReceiver(this);
this.scripts = this.exemplar.scripts.fullCopy();
if (ide && (contains(ide.currentSprite.allExemplars(), this))) {
ide.createSpriteEditor();
ide.fixLayout('selectSprite');
this.scripts.fixMultiArgs();
}
this.specimens().forEach(function (obj) {
if (obj.inheritsAttribute('scripts')) {
obj.refreshInheritedAttribute('scripts');
}
});
} else if (ide) {
ide.flushBlocksCache(); // optimization: specify category if known
ide.refreshPalette();
@ -5255,9 +5261,12 @@ SpriteMorph.prototype.refreshInheritedAttribute = function (aName) {
case 'scripts':
this.scripts = this.exemplar.scripts;
ide = this.parentThatIsA(IDE_Morph);
if (ide && (contains(ide.currentSprite.allExemplars(), this))) {
ide.createSpriteEditor();
ide.fixLayout('selectSprite');
if (ide) {
ide.stage.threads.stopAllForReceiver(this);
if (contains(ide.currentSprite.allExemplars(), this)) {
ide.createSpriteEditor();
ide.fixLayout('selectSprite');
}
}
this.specimens().forEach(function (sprite) {
if (sprite.inheritsAttribute('scripts')) {