Add bedrock attachable preview support for nested binding

Add new globals
Fix error in bbmodel merging
This commit is contained in:
JannisX11 2023-12-13 14:21:26 +01:00
parent 6ab3c53e56
commit 08d86dfd79
3 changed files with 18 additions and 6 deletions

View File

@ -2136,8 +2136,13 @@ BARS.defineActions(function() {
let player_skin_setup = false;
function updateBase(mode) {
let root_has_binding = Outliner.root.find(g => g instanceof Group && g.bedrock_binding)
if (mode == 'attachable_first') {
Project.model_3d.position.set(-20, 21, 0);
if (root_has_binding) {
Project.model_3d.position.set(-20, 21, 0);
} else {
Project.model_3d.position.set(-8, 6, -18);
}
Project.model_3d.rotation.set(
Math.degToRad(-95),
Math.degToRad(45),
@ -2151,8 +2156,13 @@ BARS.defineActions(function() {
if (mode == 'attachable_third') {
let angle = Math.degToRad(15);
let arm_offset = Reusable.vec1.set(1, -31, 1).applyAxisAngle(Reusable.vec2.set(1, 0, 0), angle);
Project.model_3d.position.set(5, 22, 0).add(arm_offset);
if (root_has_binding) {
let arm_offset = Reusable.vec1.set(1, -31, 1).applyAxisAngle(Reusable.vec2.set(1, 0, 0), angle);
Project.model_3d.position.set(5, 22, 0).add(arm_offset);
} else {
let arm_offset = Reusable.vec1.set(1, -7, 1).applyAxisAngle(Reusable.vec2.set(1, 0, 0), angle);
Project.model_3d.position.set(5, 22, 0).add(arm_offset);
}
Project.model_3d.rotation.set(angle, 0, 0);
player_preview_model.enable()

View File

@ -66,3 +66,5 @@ Blockbench.DisplaySlot = DisplaySlot;
Blockbench.Reusable = Reusable;
Blockbench.Texture = Texture;
Blockbench.TextureLayer = TextureLayer;
Blockbench.SharedActions = SharedActions;

View File

@ -598,10 +598,10 @@ var codec = new Codec('project', {
ani.uuid = guid();
}
if (base_ani.animators) {
for (let key in animators) {
for (let key in base_ani.animators) {
if (uuid_map[key]) {
animators[uuid_map[key]] = animators[key];
delete animators[key];
base_ani.animators[uuid_map[key]] = base_ani.animators[key];
delete base_ani.animators[key];
}
}
}