tweaks
This commit is contained in:
@@ -42,7 +42,7 @@ function harness() {
|
||||
fromDataURL(url) { this.source = url; return this; }
|
||||
add() { Texture.all.push(this); return this; }
|
||||
}
|
||||
const context = { Buffer, requireNativeModule: require, Group, Cube, Texture, console,
|
||||
const context = { Buffer, requireNativeModule: require, Group, Cube, Texture, console, Format: { id: 'geckolib_model' },
|
||||
setTimeout(callback) { callback(); },
|
||||
Undo: { initEdit() {}, finishEdit() {}, cancelEdit() {} },
|
||||
Project: { texture_width: 64, texture_height: 64, box_uv: true },
|
||||
@@ -69,6 +69,26 @@ test('growing the project UV canvas preserves other actors and converts box UVs'
|
||||
assert.deepEqual(Array.from(actor1.faces.north.uv), [0, 0, 64, 16], 'Repeated refreshes must not rescale UVs');
|
||||
});
|
||||
|
||||
test('non-GeckoLib projects keep UVs, canvas dimensions and box UV mode while still assigning textures', () => {
|
||||
for (const format of ['optifine_entity', 'optifine_part', 'bedrock', 'free', 'java_block']) {
|
||||
const h = harness(), cube = new h.Cube('actor1_body', true);
|
||||
h.context.Format.id = format;
|
||||
const before = JSON.stringify(cube.faces.north.uv);
|
||||
const texture = new h.Texture({ name: 'custom.png', uv_width: 128, uv_height: 128 });
|
||||
texture.add();
|
||||
assert.equal(h.expandProjectUvs(128, 128), false);
|
||||
assert.equal(h.normalizeActorUvs(1, 128, 128), false);
|
||||
h.scaleCubeUvs(cube, 2, 2);
|
||||
h.applyActorTexturePreview(1, 'custom.png');
|
||||
assert.equal(JSON.stringify(cube.faces.north.uv), before);
|
||||
assert.equal(cube.faces.north.texture, texture.uuid);
|
||||
assert.equal(cube.box_uv, true);
|
||||
assert.equal(h.context.Project.texture_width, 64);
|
||||
assert.equal(h.context.Project.texture_height, 64);
|
||||
assert.equal(h.context.Project.animationdirector_actor_uv_basis, undefined);
|
||||
}
|
||||
});
|
||||
|
||||
test('assigning a manually imported texture to an actor normalizes only that actor once', () => {
|
||||
const h = harness(), selected = new h.Cube('actor1_body'), other = new h.Cube('actor2_body');
|
||||
h.normalizeActorUvs(1, 64, 64); h.normalizeActorUvs(2, 64, 64);
|
||||
|
||||
Reference in New Issue
Block a user