Skip to content

Commit

Permalink
v4.3.0 [ci-build]
Browse files Browse the repository at this point in the history
(Fix issue in collada exporter)
  • Loading branch information
JannisX11 committed Jul 22, 2022
1 parent 6f57ec1 commit 8bd7faa
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<script>
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
const isApp = typeof require !== 'undefined';
const appVersion = '4.3.0-beta.3';
const appVersion = '4.3.0';


if (localStorage.getItem('theme')) {
Expand Down
20 changes: 18 additions & 2 deletions js/io/formats/collada.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@ var codec = new Codec('collada', {
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);

let add_keyframe_at_end = track.times[track.times.length-1] - anim_obj.duration <= 0.1;
if (add_keyframe_at_end) track_channel.times.push(anim_obj.duration + time_offset);

if (track.channel == 'rotation') {
if (!track_channel.values) track_channel.values = {};
Expand All @@ -626,14 +629,22 @@ var codec = new Codec('collada', {
return i % 3 == axis_i;
}).map(v => Math.radToDeg(v));
track_channel.values[axis].push(...axis_values);
if (add_keyframe_at_end) {
track_channel.values[axis].push(...track_channel.values[axis].slice(-1));
}
})
} else {
if (!track_channel.values) track_channel.values = [];
track_channel.values.push(...track.values);
if (add_keyframe_at_end) {
track_channel.values.push(...track_channel.values.slice(-3));
}
}
})

for (let uuid in animators) {
let group = Group.all.find(group => group.uuid == uuid);

for (let channel in animators[uuid]) {
let track_channel = animators[uuid][channel];
if (track_channel.animations_added.includes(anim_i)) {
Expand All @@ -647,10 +658,15 @@ var codec = new Codec('collada', {
if (!track_channel.values[axis]) track_channel.values[axis] = [];
track_channel.values[axis].push(0, 0);
})
} else if (channel == 'scale') {
if (!track_channel.values) track_channel.values = [];
track_channel.values.push(1, 1, 1, 1, 1, 1);
} 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 pos = group.origin.slice();
if (group.parent instanceof Group) pos.V3_subtract(group.parent.origin);
pos.V3_divide(16);
track_channel.values.push(...pos, ...pos);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/webpack/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Blockbench",
"description": "Low-poly modeling and animation software",
"version": "4.3.0-beta.3",
"version": "4.3.0",
"license": "GPL-3.0-or-later",
"author": {
"name": "JannisX11",
Expand Down
Loading

0 comments on commit 8bd7faa

Please sign in to comment.