Skip to content

Commit 8cb74a5

Browse files
committed
Version bump
- fixes for 3d model loading and exporting
1 parent c568acf commit 8cb74a5

File tree

4 files changed

+39
-24
lines changed

4 files changed

+39
-24
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.7.10
2+
3+
- Fixed modifications via `MassEdit.spawnPreset` hook being overridden for virtual 3D model presets
4+
- Fixed 3D Virtual model export to compendium producing invalid presets
5+
16
# 2.7.9
27

38
- 3D model `Auto Center` is now enabled by default when spawning presets

multi-token-edit/module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"id": "multi-token-edit",
33
"title": "Baileywiki Mass Edit",
44
"description": "Search and edit multiple placeables at the same time.",
5-
"version": "2.7.9",
6-
"download": "https://github.com/Aedif/multi-token-edit/releases/download/2.7.9/multi-token-edit.zip",
5+
"version": "2.7.10",
6+
"download": "https://github.com/Aedif/multi-token-edit/releases/download/2.7.10/multi-token-edit.zip",
77
"url": "https://github.com/Aedif/multi-token-edit",
88
"manifest": "https://github.com/Aedif/multi-token-edit/releases/latest/download/module.json",
99
"authors": [

multi-token-edit/scripts/presets/containerAppV2.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ import { PresetConfig } from './editApp.js';
1414
export async function registerPresetHandlebarPartials() {
1515
await foundry.applications.handlebars.getTemplate(
1616
`modules/${MODULE_ID}/templates/preset/container/partials/preset.hbs`,
17-
'me-preset'
17+
'me-preset',
1818
);
1919
await foundry.applications.handlebars.getTemplate(
2020
`modules/${MODULE_ID}/templates/preset/container/partials/folder.hbs`,
21-
'me-preset-folder'
21+
'me-preset-folder',
2222
);
2323
await foundry.applications.handlebars.getTemplate(
2424
`modules/${MODULE_ID}/templates/preset/container/partials/presetsContent.hbs`,
25-
'me-presets-content'
25+
'me-presets-content',
2626
);
2727
await foundry.applications.handlebars.getTemplate(
2828
`modules/${MODULE_ID}/templates/preset/container/partials/presetsTopList.hbs`,
29-
'me-preset-list'
29+
'me-preset-list',
3030
);
3131

3232
// Conditional rendering helper
@@ -55,7 +55,7 @@ export async function registerPresetHandlebarPartials() {
5555
}
5656

5757
export class PresetContainerV2 extends foundry.applications.api.HandlebarsApplicationMixin(
58-
foundry.applications.api.ApplicationV2
58+
foundry.applications.api.ApplicationV2,
5959
) {
6060
static _oldPositions = {};
6161

@@ -722,6 +722,10 @@ export class PresetContainerV2 extends foundry.applications.api.HandlebarsApplic
722722
return p;
723723
});
724724

725+
for (const p of presets) {
726+
if (p.virtual) await p.load({ force: true });
727+
}
728+
725729
await PresetStorage.createDocuments(presets, pack);
726730

727731
if (selected.length) this.render(true);
@@ -870,7 +874,7 @@ export class PresetContainerV2 extends foundry.applications.api.HandlebarsApplic
870874
`<video width="${320 * ratio}" height="${240 * ratio}" autoplay loop><source src="${src}" type="video/${src
871875
.split('.')
872876
.pop()
873-
.toLowerCase()}"></video>`
877+
.toLowerCase()}"></video>`,
874878
);
875879
}
876880
}
@@ -912,7 +916,7 @@ export class PresetContainerV2 extends foundry.applications.api.HandlebarsApplic
912916
),
913917
draggable: folder.pack === PresetStorage.workingPack,
914918
browser: true,
915-
}
919+
},
916920
);
917921
folderElement.replaceWith(content);
918922
}
@@ -941,7 +945,7 @@ export class PresetContainerV2 extends foundry.applications.api.HandlebarsApplic
941945
createEnabled,
942946
externalTrees,
943947
browser,
944-
}
948+
},
945949
);
946950
$(this.form).find('.item-list').html(content);
947951
}
@@ -953,7 +957,7 @@ export class PresetContainerV2 extends foundry.applications.api.HandlebarsApplic
953957
label: item.attributes.name,
954958
type: 'uuid',
955959
id: item.dataset.uuid,
956-
})
960+
}),
957961
);
958962
}
959963

multi-token-edit/scripts/presets/preset.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -383,20 +383,26 @@ export class VirtualFilePreset extends Preset {
383383
const modelBB = new game.Levels3DPreview.THREE.Box3().setFromObject(object3d.model);
384384
const depth = (modelBB.max.y - modelBB.min.y) * canvas.grid.size ?? 0.05;
385385

386-
data.flags = {
387-
'levels-3d-preview': {
388-
model3d: src,
389-
autoGround: true,
390-
autoCenter: true,
391-
cameraCollision: false,
392-
castShadow: true,
393-
collision: true,
394-
color: '#ffffff',
395-
dynaMesh: 'default',
396-
sight: true,
397-
depth,
386+
foundry.utils.mergeObject(
387+
data,
388+
{
389+
flags: {
390+
'levels-3d-preview': {
391+
model3d: src,
392+
autoGround: true,
393+
autoCenter: true,
394+
cameraCollision: false,
395+
castShadow: true,
396+
collision: true,
397+
color: '#ffffff',
398+
dynaMesh: 'default',
399+
sight: true,
400+
depth,
401+
},
402+
},
398403
},
399-
};
404+
{ overwrite: false },
405+
);
400406

401407
data.width = canvas.grid.size * (modelBB.max.x - modelBB.min.x);
402408
data.height = canvas.grid.size * (modelBB.max.z - modelBB.min.z);

0 commit comments

Comments
 (0)