mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Fix little jumps in gimbal controls
Reverse keyframes now reverses data point order Creating keyframes now selects channel in grapher Fix issue with pre-post keyframes not exporting a correct time Show "center pivot" button in animation mode
This commit is contained in:
parent
a0ac1ad989
commit
cfad0975bd
@ -169,7 +169,7 @@ class Animation {
|
||||
for (var channel in Animator.possible_channels) {
|
||||
if (channels[channel]) {
|
||||
let timecodes = Object.keys(channels[channel])
|
||||
if (timecodes.length === 1) {
|
||||
if (timecodes.length === 1 && animator.keyframes[0].data_points.length == 1) {
|
||||
bone_tag[channel] = channels[channel][timecodes[0]]
|
||||
if (channel == 'scale' &&
|
||||
channels[channel][timecodes[0]] instanceof Array &&
|
||||
|
@ -223,11 +223,11 @@ class Keyframe {
|
||||
if (this.data_points.length == 1 && this.interpolation == 'linear') {
|
||||
return this.getArray();
|
||||
} else {
|
||||
return {
|
||||
return new oneLiner({
|
||||
lerp_mode: this.interpolation != 'linear' ? this.interpolation : undefined,
|
||||
pre: this.getArray(0),
|
||||
post: this.getArray(1),
|
||||
lerp_mode: this.interpolation != 'linear' ? this.interpolation : undefined,
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (this.channel == 'timeline') {
|
||||
let scripts = [];
|
||||
@ -294,13 +294,15 @@ class Keyframe {
|
||||
if (Timeline.selected.length == 1 && Timeline.selected[0].animator.selected == false) {
|
||||
Timeline.selected[0].animator.select()
|
||||
}
|
||||
this.selected = true
|
||||
TickUpdates.keyframe_selection = true;
|
||||
|
||||
if (this.transform) Timeline.vue.graph_editor_channel = this.channel;
|
||||
|
||||
var select_tool = true;
|
||||
Timeline.selected.forEach(kf => {
|
||||
if (kf.channel != scope.channel) select_tool = false;
|
||||
})
|
||||
this.selected = true
|
||||
TickUpdates.keyframe_selection = true;
|
||||
if (select_tool) {
|
||||
switch (this.channel) {
|
||||
case 'rotation': BarItems.rotate_tool.select(); break;
|
||||
@ -717,6 +719,9 @@ BARS.defineActions(function() {
|
||||
Undo.initEdit({keyframes: Timeline.selected})
|
||||
Timeline.selected.forEach((kf) => {
|
||||
kf.time = end + start - kf.time;
|
||||
if (kf.transform && kf.data_points.length > 1) {
|
||||
kf.data_points.reverse();
|
||||
}
|
||||
})
|
||||
Undo.finishEdit('reverse keyframes')
|
||||
updateKeyframeSelection()
|
||||
|
@ -1268,6 +1268,7 @@ class GimbalControls {
|
||||
if (!scope.preview.controls.enableRotate && scope.preview.angle == null) return;
|
||||
convertTouchEvent(e1);
|
||||
let last_event = e1;
|
||||
let move_calls = 0;
|
||||
|
||||
function move(e2) {
|
||||
convertTouchEvent(e2);
|
||||
@ -1276,9 +1277,11 @@ class GimbalControls {
|
||||
if (scope.preview.angle != null) {
|
||||
scope.preview.setProjectionMode(false);
|
||||
}
|
||||
scope.preview.controls.rotateLeft((e1.touches ? (e2.clientX - last_event.clientX) : Math.clamp(e2.movementX, -5, 5)) / 40);
|
||||
scope.preview.controls.rotateUp((e1.touches ? (e2.clientY - last_event.clientY) : Math.clamp(e2.movementY, -5, 5)) / 40);
|
||||
let limit = move_calls <= 2 ? 1 : 32;
|
||||
scope.preview.controls.rotateLeft((e1.touches ? (e2.clientX - last_event.clientX) : Math.clamp(e2.movementX, -limit, limit)) / 40);
|
||||
scope.preview.controls.rotateUp((e1.touches ? (e2.clientY - last_event.clientY) : Math.clamp(e2.movementY, -limit, limit)) / 40);
|
||||
last_event = e2;
|
||||
move_calls++;
|
||||
}
|
||||
function off(e2) {
|
||||
document.exitPointerLock()
|
||||
|
@ -1465,7 +1465,7 @@ BARS.defineActions(function() {
|
||||
new Action('origin_to_geometry', {
|
||||
icon: 'filter_center_focus',
|
||||
category: 'transform',
|
||||
condition: {modes: ['edit']},
|
||||
condition: {modes: ['edit', 'animate']},
|
||||
click: function () {origin2geometry()}
|
||||
})
|
||||
new Action('rescale_toggle', {
|
||||
|
Loading…
Reference in New Issue
Block a user