diff --git a/js/animations/timeline.js b/js/animations/timeline.js index 17e47ce3..64361468 100644 --- a/js/animations/timeline.js +++ b/js/animations/timeline.js @@ -1321,21 +1321,27 @@ Interface.definePanels(() => { }, clickGraphEditor(event) { if (!this.show_other_graphs || !this.graph_editor_animator) return; - let time = event.offsetX / this.size; let value = (this.graph_offset - event.offsetY) / this.graph_size; - let original_time = Timeline.time; - Timeline.time = time; - let distances = ['x', 'y', 'z'].map(axis => { - let axis_value = this.graph_editor_animator.interpolate(this.graph_editor_channel, false, axis); - let diff = Math.abs(axis_value - value) * this.graph_size; - if (diff < 12.5) { - return {axis, diff}; - } - }).filter(a => a); + let tryAt = (x_coord) => { + let time = (x_coord) / this.size; + Timeline.time = time; - if (distances.length) { + let distances = ['x', 'y', 'z'].map(axis => { + let axis_value = this.graph_editor_animator.interpolate(this.graph_editor_channel, false, axis); + let diff = Math.abs(axis_value - value) * this.graph_size; + if (diff < 12.5) { + return {axis, diff}; + } + }).filter(a => a); + if (distances.length) return distances; + } + + let real_x_coord = event.offsetX-8; + let distances = tryAt(real_x_coord) || tryAt(real_x_coord + 4) || tryAt(real_x_coord - 4); + + if (distances) { distances.sort((a, b) => a.diff - b.diff); this.graph_editor_axis = distances[0].axis; } diff --git a/js/animations/timeline_animators.js b/js/animations/timeline_animators.js index 4c644245..74883188 100644 --- a/js/animations/timeline_animators.js +++ b/js/animations/timeline_animators.js @@ -37,6 +37,7 @@ class GeneralAnimator { if (!this[channel]) this[channel] = []; } if (!this.expanded) this.expanded = true; + TickUpdates.keyframe_selection = true; return this; } addKeyframe(data, uuid) { diff --git a/js/io/formats/java_block.js b/js/io/formats/java_block.js index e110a660..f5f65708 100644 --- a/js/io/formats/java_block.js +++ b/js/io/formats/java_block.js @@ -308,7 +308,7 @@ var codec = new Codec('java_block', { if (link.startsWith('#') && texture_arr[link.substring(1)]) { link = texture_arr[link.substring(1)]; } - let texture = new Texture({id: key}).fromJavaLink(texture_arr[key], path_arr.slice()).add(); + let texture = new Texture({id: key}).fromJavaLink(link, path_arr.slice()).add(); texture_paths[texture_arr[key].replace(/^minecraft:/, '')] = texture_ids[key] = texture; new_textures.push(texture); } @@ -450,13 +450,6 @@ var codec = new Codec('java_block', { } }, (result) => { if (result) { - let textures; - if (result == 'open_with_textures') { - textures = {}; - Texture.all.forEach(tex => { - textures[tex.id] = tex; - }) - } let parent = model.parent.replace(/\w+:/, ''); let path_arr = path.split(osfs); let index = path_arr.length - path_arr.indexOf('models'); @@ -468,9 +461,9 @@ var codec = new Codec('java_block', { loadModelFile(files[0]); if (result == 'open_with_textures') { - Texture.all.forEach(tex => { + Texture.all.forEachReverse(tex => { if (tex.error == 3 && tex.name.startsWith('#')) { - let loaded_tex = textures[tex.name.replace(/#/, '')]; + let loaded_tex = texture_ids[tex.name.replace(/#/, '')]; if (loaded_tex) { tex.fromPath(loaded_tex.path); tex.namespace = loaded_tex.namespace;