Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tokenmagic/module/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,14 @@ Hooks.once('init', () => {
canvas.stage.on('mousemove', (event) => {
const { x: mx, y: my } = event.data.getLocalPosition(canvas.templates);
for (const template of canvas.templates.placeables) {
// A template whose _draw aborted (e.g. legacy scene data carried
// over from a system that no longer creates MeasuredTemplates, or
// a missing/failing texture) leaves `template.template` and the
// grid highlight layer undefined. Skip those rather than crash
// the pointermove pipeline.
if (!template.template) continue;
const hl = canvas.interface.grid.getHighlightLayer(template.highlightId);
if (!hl) continue;
const opacity = template.document.getFlag('tokenmagic', 'templateData')?.opacity ?? 1;
if (template.texture && template.texture !== '') {
const { x: cx, y: cy } = template.center;
Expand Down
7 changes: 5 additions & 2 deletions tokenmagic/module/tokenmagic.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,11 @@ export function TokenMagic() {
if (placeableType === PlaceableType.TEMPLATE) {
let updateData = placeable.document.getFlag('tokenmagic', 'templateData');
if (!(updateData == null)) {
placeable.document.tmfxTextureAlpha = placeable._TMFXgetSprite().alpha = updateData.opacity;
placeable.document.tmfxTint = updateData.tint;
const sprite = placeable._TMFXgetSprite();
if (sprite) {
placeable.document.tmfxTextureAlpha = sprite.alpha = updateData.opacity;
placeable.document.tmfxTint = updateData.tint;
}
}
} else if (placeableType === PlaceableType.REGION) {
const sprite = placeable._TMFXgetSprite();
Expand Down