From 54b9f83c8093af64f9f3062060e42258f3291ab3 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Thu, 3 Nov 2022 19:11:26 +0100 Subject: [PATCH] Fix #1633 Null object visual size resets in animation mode Fix issue with molang expression validator Fix UV editing of mesh vertices not working on tall textures Add failsafe and warning for plugin BarItems without correct ID --- js/animations/animation.js | 4 +++- js/interface/actions.js | 10 +++++++++- js/modes.js | 2 +- js/texturing/uv.js | 2 +- js/validator.js | 3 --- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/js/animations/animation.js b/js/animations/animation.js index e0540cc4..f2dcd683 100644 --- a/js/animations/animation.js +++ b/js/animations/animation.js @@ -906,7 +906,9 @@ const Animator = { var mesh = node.mesh; if (mesh.fix_rotation) mesh.rotation.copy(mesh.fix_rotation); if (mesh.fix_position) mesh.position.copy(mesh.fix_position); - mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; + if (node.constructor.animator.prototype.channels && node.constructor.animator.prototype.channels.scale) { + mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; + } }) if (!no_matrix_update) scene.updateMatrixWorld() }, diff --git a/js/interface/actions.js b/js/interface/actions.js index affbeac2..4fb7067a 100644 --- a/js/interface/actions.js +++ b/js/interface/actions.js @@ -9,7 +9,15 @@ class BarItem { constructor(id, data) { this.id = id; if (!data.private) { - BarItems[this.id] = this; + if (this.id && !BarItems[this.id]) { + BarItems[this.id] = this; + } else { + if (!BarItems[this.id]) { + console.warn(`${this.constructor.name} ${this.id} has a duplicate ID`) + } else { + console.warn(`${this.constructor.name} defined without a vaild ID`) + } + } } this.name = tl('action.'+this.id) if (data.name) this.name = tl(data.name); diff --git a/js/modes.js b/js/modes.js index 8752351e..9650cbe8 100644 --- a/js/modes.js +++ b/js/modes.js @@ -67,7 +67,7 @@ class Mode extends KeybindItem { } Canvas.updateRenderSides() - if (BarItems[this.tool] && Condition(BarItems[this.tool])) { + if (this.tool && BarItems[this.tool] && Condition(BarItems[this.tool])) { BarItems[this.tool].select(); } else if (BarItems[this.default_tool]) { if (!BarItems[this.default_tool].selected) BarItems[this.default_tool].select(); diff --git a/js/texturing/uv.js b/js/texturing/uv.js index ccdc899d..8aa541a3 100644 --- a/js/texturing/uv.js +++ b/js/texturing/uv.js @@ -2734,7 +2734,7 @@ Interface.definePanels(function() { face.vertices.forEach(vertex_key => { if (this.selected_vertices[element.uuid] && this.selected_vertices[element.uuid].includes(vertex_key)) { x = Math.clamp(x, -face.uv[vertex_key][0], Project.texture_width - face.uv[vertex_key][0]); - y = Math.clamp(y, -face.uv[vertex_key][1], Project.texture_width - face.uv[vertex_key][1]); + y = Math.clamp(y, -face.uv[vertex_key][1], Project.texture_height - face.uv[vertex_key][1]); } }) }) diff --git a/js/validator.js b/js/validator.js index 2416ef49..81032928 100644 --- a/js/validator.js +++ b/js/validator.js @@ -325,9 +325,6 @@ new ValidatorCheck('molang_syntax', { if (clear_string.match(/^[+*/.,?=&<>|]/)) { issues.push('Expression starts with an invalid character'); } - if (clear_string.match(/(?!')[a-df-z_]+\s*[-?]+\s*[a-z_]+/i)) { - issues.push('Invalid expression "' + clear_string.match(/(?!')[a-df-z_]+\s*[-?]+\s*[a-z_]+/i)[0] + '"'); - } if (clear_string.match(/[\w.]\s+[\w.]/)) { issues.push('Two expressions with no operator in between'); }