Skip to content

Commit

Permalink
check for qualified name in sprite editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kimprice committed Dec 5, 2023
1 parent f2a5482 commit 2a8490a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pxtblocks/fields/field_sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ namespace pxtblockly {

const bmp = text ? pxt.sprite.imageLiteralToBitmap(text) : new pxt.sprite.Bitmap(this.params.initWidth, this.params.initHeight);

let data: pxt.sprite.BitmapData;

if (!bmp) {
this.isGreyBlock = true;
this.valueText = text;
return undefined;
// check for qualified name
const images = project.getGalleryAssets(pxt.AssetType.Image).filter(asset => asset.id === text);
const img = images.length && images[0];
if (!img) {
this.isGreyBlock = true;
this.valueText = text;
return undefined;
} else {
data = img.bitmap;
}
}

const data = bmp.data();
if (!data) data = bmp.data();

const newAsset: pxt.ProjectImage = {
internalID: -1,
Expand Down

0 comments on commit 2a8490a

Please sign in to comment.