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
This commit is contained in:
JannisX11 2022-11-03 19:11:26 +01:00
parent 756433c6ae
commit 54b9f83c80
5 changed files with 14 additions and 7 deletions

View File

@ -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()
},

View File

@ -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);

View File

@ -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();

View File

@ -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]);
}
})
})

View File

@ -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');
}