Skip to content

Commit

Permalink
v2.7.11
Browse files Browse the repository at this point in the history
- Fixed actor prototypeToken image not being referenced.
- Fixed audioFiles and tile images in [Monk's Active Tile Triggers](https://foundryvtt.com/packages/monks-active-tiles) not being referenced.
  - Thanks Beneos of https://beneos-battlemaps.com/ for the above reports.
  • Loading branch information
sneat authored Feb 4, 2024
1 parent 7a2e188 commit 6331510
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v2.7.11

- Fixed actor prototypeToken image not being referenced.
- Fixed audioFiles and tile images in [Monk's Active Tile Triggers](https://foundryvtt.com/packages/monks-active-tiles) not being referenced.
- Thanks Beneos of https://beneos-battlemaps.com/ for the above reports.

## v2.7.10

- Migrate "mime" package to a local source to avoid issues with the CDN being offline/having a build error.
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "scene-packer",
"title": "Library: Scene Packer",
"description": "A module to assist with Scene and Adventure packing and unpacking.",
"version": "2.7.10",
"version": "2.7.11",
"library": "true",
"manifestPlusVersion": "1.2.0",
"minimumCoreVersion": "0.8.6",
Expand Down
20 changes: 19 additions & 1 deletion scripts/asset-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ export default class AssetReport extends FormApplication {
SceneForeground: 'scene-foreground',
SceneNoteIcon: 'scene-note-icon',
SceneTileImage: 'scene-tile-image',
SceneTileActiveImage: 'scene-tile-monks-active-tile-image',
SceneTileActiveSound: 'scene-tile-monks-active-tile-sound',
SceneDrawingImage: 'scene-drawing-texture',
SceneTokenImage: 'scene-token-image',
SceneTokenEffectIcon: 'scene-token-effect-icon',
Expand Down Expand Up @@ -763,6 +765,22 @@ export default class AssetReport extends FormApplication {
if (img) {
this.CheckAsset(scene.id, AssetReport.Sources.Scene, img, AssetReport.Locations.SceneTileImage);
}

const activeTileActions = getProperty(tile, 'flags.monks-active-tiles.actions') || [];
for (const action of activeTileActions) {
const audioFile = action.data?.audiofile;
if (audioFile) {
this.CheckAsset(scene.id, AssetReport.Sources.Scene, audioFile, AssetReport.Locations.SceneTileActiveSound);
}
}

const activeTileImages = getProperty(tile, 'flags.monks-active-tiles.files') || [];
for (const image of activeTileImages) {
const imagePath = image.name;
if (imagePath) {
this.CheckAsset(scene.id, AssetReport.Sources.Scene, imagePath, AssetReport.Locations.SceneTileActiveImage);
}
}
});

drawings.forEach(drawing => {
Expand Down Expand Up @@ -850,7 +868,7 @@ export default class AssetReport extends FormApplication {
this.CheckAsset(actor.id, AssetReport.Sources.Actor, actorData.img, AssetReport.Locations.ActorImage);
}

const tokenImage = CONSTANTS.IsV10orNewer() ? actor.token?.img : actor.token?.img || actorData?.token?.img;
const tokenImage = CONSTANTS.IsV10orNewer() ? (actor.prototypeToken?.texture?.src ?? actor.token?.img) : (actor.token?.img ?? actorData?.token?.img);
if (tokenImage) {
this.CheckAsset(actor.id, AssetReport.Sources.Actor, tokenImage, AssetReport.Locations.ActorTokenImage);
}
Expand Down
21 changes: 17 additions & 4 deletions scripts/assets/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,30 @@ export async function ExtractActorAssets(actor) {
});
}

const tokenImage = actor.token?.img || actorData?.token?.img;
if (tokenImage) {
const prototypeTokenImage = actor.prototypeToken?.texture?.src;
if (prototypeTokenImage) {
await data.AddAsset({
id: actor.id,
key: 'token.img',
key: 'prototypeToken.texture.src',
parentID: actor.id,
parentType: actor.documentName,
documentType: actor.documentName,
location: AssetReport.Locations.ActorTokenImage,
asset: tokenImage,
asset: prototypeTokenImage,
});
} else {
const tokenImage = actor.token?.img ?? actorData?.token?.img;
if (tokenImage) {
await data.AddAsset({
id: actor.id,
key: 'token.img',
parentID: actor.id,
parentType: actor.documentName,
documentType: actor.documentName,
location: AssetReport.Locations.ActorTokenImage,
asset: tokenImage,
});
}
}

const items = [];
Expand Down
21 changes: 17 additions & 4 deletions scripts/assets/journal.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,30 @@ export async function ExtractQuickEncounterAssets(journal) {
data.AddAssetData(await ExtractActorAssets(actor));

for (const token of extractedActor.savedTokensData || []) {
const tokenImage = token?.img;
if (tokenImage) {
const tokenTexture = token.texture?.src;
if (tokenTexture) {
await data.AddAsset({
id: actor.id,
key: 'token.img',
key: 'texture.src',
parentID: actor.id,
parentType: actor.documentName,
documentType: actor.documentName,
location: AssetReport.Locations.ActorTokenImage,
asset: tokenImage,
asset: tokenTexture,
});
} else {
const tokenImage = token?.img;
if (tokenImage) {
await data.AddAsset({
id: actor.id,
key: 'token.img',
parentID: actor.id,
parentType: actor.documentName,
documentType: actor.documentName,
location: AssetReport.Locations.ActorTokenImage,
asset: tokenImage,
});
}
}
}
}
Expand Down
34 changes: 33 additions & 1 deletion scripts/assets/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function ExtractSceneAssets(scene) {

for (const tile of tiles) {
const tileData = CONSTANTS.IsV10orNewer() ? tile : tile?.data;
const img = tileData?.img || tile?.img;
const img = tileData?.img || tileData?.img;
if (img) {
await data.AddAsset({
id: tile.id,
Expand All @@ -131,6 +131,38 @@ export async function ExtractSceneAssets(scene) {
asset: tileData.texture.src,
});
}

const activeTileActions = getProperty(tileData, 'flags.monks-active-tiles.actions') || [];
for (const action of activeTileActions) {
const audioFile = action.data?.audiofile;
if (audioFile) {
await data.AddAsset({
id: tile.id,
key: 'monks-active-tile.audiofile',
parentID: scene.id,
parentType: scene.documentName,
documentType: tile.documentName || 'Tile',
location: AssetReport.Locations.SceneTileActiveSound,
asset: audioFile,
});
}
}

const activeTileImages = getProperty(tileData, 'flags.monks-active-tiles.files') || [];
for (const image of activeTileImages) {
const imagePath = image.name;
if (imagePath) {
await data.AddAsset({
id: tile.id,
key: 'monks-active-tile.image',
parentID: scene.id,
parentType: scene.documentName,
documentType: tile.documentName || 'Tile',
location: AssetReport.Locations.SceneTileActiveImage,
asset: imagePath,
});
}
}
}

for (const drawing of drawings) {
Expand Down

0 comments on commit 6331510

Please sign in to comment.