tweaks and improvements
This commit is contained in:
@@ -107,7 +107,7 @@ test('animation menu orders import and creation actions and has no deprecated sp
|
||||
const menu = h.menus.find((entry) => entry.id === 'animationdirector_anims');
|
||||
assert.deepEqual(Array.from(menu.children, (action) => action.name), [
|
||||
'Automatically Import Animation', 'Manual Import', 'Actor Preferences',
|
||||
'Replace Actor Model', 'Block Requirements', 'Item Props', 'Sound Library...', 'Create Animation Definition', 'Export Animations',
|
||||
'Replace Actor Model', 'Block Requirements', 'Item Props', 'NoN Sound Library', 'Create Animation Definition', 'Export Animations',
|
||||
]);
|
||||
assert.deepEqual(Array.from(menu.children[1].children, (action) => action.name), [
|
||||
'Import Actor', 'Import Animation', 'Import Animation Definition', 'Pack Folders',
|
||||
@@ -171,6 +171,31 @@ test('import prefills generator fields, builds guides and retains fields without
|
||||
assert.equal(h.errors.length, 0);
|
||||
});
|
||||
|
||||
test('importing an animdef replaces saved fields instead of retaining old settings', () => {
|
||||
const h = harness();
|
||||
h.project.multiactor_animdef_animators = 'Old author';
|
||||
h.project.animationdirector_animdef_definitions = JSON.stringify({ test: {
|
||||
display_name: 'Old', weight: 8, content_tags: ['old'], addon_data: { old: true },
|
||||
actors: [{ label: 'player', entity_types: ['minecraft:player'] }, { label: 'wolf', entity_types: ['minecraft:wolf'] }],
|
||||
stages: [{ stage: 1, non_peak: true }, { stage: 2 }],
|
||||
}, other: { display_name: 'Unchanged' } });
|
||||
const replacement = { display_name: 'Replacement',
|
||||
actors: [{ label: 'player', entity_types: ['minecraft:player'] }, { label: 'wolf', entity_types: ['minecraft:wolf'] }],
|
||||
stages: [{ stage: 1 }, { stage: 2, non_peak: true }],
|
||||
};
|
||||
h.applyAnimationDefinitionImport({ id: 'test' }, importAnalysis(), replacement);
|
||||
const saved = h.getSavedAnimdef('test');
|
||||
assert.equal(saved.display_name, 'Replacement');
|
||||
assert.equal(saved.weight, undefined);
|
||||
assert.equal(saved.content_tags, undefined);
|
||||
assert.equal(saved.addon_data, undefined);
|
||||
assert.equal(h.getSavedAnimdef('other').display_name, 'Unchanged');
|
||||
const dialog = h.dialogs.at(-1);
|
||||
assert.equal(dialog.form.stub_stage_1_peaked.value, false);
|
||||
assert.equal(dialog.form.stub_stage_2_peaked.value, true);
|
||||
assert.equal(dialog.form.animators.value, '');
|
||||
});
|
||||
|
||||
test('import maps explicit labels before positional fallbacks and updates actor references', () => {
|
||||
const h = harness();
|
||||
const source = { actors: [{ label: 'wolf', injector: 'V', injects_into: 'bottom' },
|
||||
|
||||
Reference in New Issue
Block a user