mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-12-09 04:50:29 +08:00
Merge branch 'next' of https://github.com/JannisX11/blockbench into next
This commit is contained in:
commit
f26ecc2295
@ -2,7 +2,7 @@ const LastVersion = localStorage.getItem('last_version') || localStorage.getItem
|
||||
|
||||
const Blockbench = {
|
||||
isWeb: !isApp,
|
||||
isMobile: window.innerWidth <= 960 || window.innerHeight <= 500,
|
||||
isMobile: (window.innerWidth <= 960 || window.innerHeight <= 500) && 'ontouchend' in document,
|
||||
isLandscape: window.innerWidth > window.innerHeight,
|
||||
isTouch: 'ontouchend' in document,
|
||||
get isPWA() {
|
||||
|
@ -602,11 +602,21 @@ var codec = new Codec('collada', {
|
||||
if (!animators[track.group_uuid]) animators[track.group_uuid] = {}
|
||||
if (!animators[track.group_uuid][track.channel]) {
|
||||
animators[track.group_uuid][track.channel] = {
|
||||
animations_added: [],
|
||||
times: [],
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
compiled_animations.forEach((anim_obj, anim_i) => {
|
||||
if (anim_obj.duration < 0.01) return;
|
||||
|
||||
anim_obj.tracks.forEach(track => {
|
||||
|
||||
let track_channel = animators[track.group_uuid][track.channel];
|
||||
track_channel.times.push(...track.times.map(t => t + time_offset));
|
||||
track_channel.animations_added.push(anim_i);
|
||||
|
||||
if (track.channel == 'rotation') {
|
||||
if (!track_channel.values) track_channel.values = {};
|
||||
@ -623,6 +633,29 @@ var codec = new Codec('collada', {
|
||||
}
|
||||
})
|
||||
|
||||
for (let uuid in animators) {
|
||||
for (let channel in animators[uuid]) {
|
||||
let track_channel = animators[uuid][channel];
|
||||
if (track_channel.animations_added.includes(anim_i)) {
|
||||
continue;
|
||||
} else {
|
||||
track_channel.times.push(time_offset, time_offset+anim_obj.duration);
|
||||
|
||||
if (channel == 'rotation') {
|
||||
if (!track_channel.values) track_channel.values = {};
|
||||
['X', 'Y', 'Z'].forEach((axis, axis_i) => {
|
||||
if (!track_channel.values[axis]) track_channel.values[axis] = [];
|
||||
track_channel.values[axis].push(0, 0);
|
||||
})
|
||||
} else {
|
||||
if (!track_channel.values) track_channel.values = [];
|
||||
let v = channel == 'scale' ? 1 : 0;
|
||||
track_channel.values.push(v, v, v, v, v, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let animation_clip_tag = {
|
||||
type: 'animation_clip',
|
||||
attributes: {
|
||||
|
Loading…
Reference in New Issue
Block a user