Fix an issue in molang validation

Fix profile delete dialog not translated
Fix playback of animated textures with per-frame frame time
This commit is contained in:
JannisX11 2023-01-13 23:25:53 +01:00
parent 733b19b3ba
commit a6c04681a3
5 changed files with 4 additions and 5 deletions

View File

@ -212,7 +212,6 @@
padding: 2px;
padding-right: 15px;
padding-left: 100px;
background: rgb(3,86,112);
background: linear-gradient(90deg, rgba(3,86,112,0) 0%, rgba(0,10,22,0.63) 34%, rgba(0,9,20,0.72) 45%);
}
#start_screen div.start_screen_right {

View File

@ -1781,7 +1781,7 @@ BARS.defineActions(function() {
new Action('load_animation_file', {
icon: 'fa-file-video',
category: 'animation',
condition: {modes: ['animate'], method: () => Format.animation_files},
condition: {modes: ['animate'], features: ['animation_files']},
click: function () {
var path = Project.export_path
if (isApp) {

View File

@ -598,7 +598,7 @@ new ValidatorCheck('molang_syntax', {
issues.push('Invalid token ' + clear_string.match(/(^|[^a-z0-9_])[\d.]+[a-z_]+/i)[0].replace(/[^a-z0-9._]/g, ''));
}
if (clear_string.match(/[^\w\s+\-*/().,;:[\]!?=<>&|]/)) {
issues.push('Invalid character: ' + clear_string.match(/[^\w+\-*/().,;:[\]!?=<>&|]+/g).join(', '));
issues.push('Invalid character: ' + clear_string.match(/[^\s\w+\-*/().,;:[\]!?=<>&|]+/g).join(', '));
}
let left = string.match(/\(/g) || 0;
let right = string.match(/\)/g) || 0;

View File

@ -294,7 +294,7 @@ class SettingsProfile {
_2: '_',
remove: {type: 'buttons', buttons: ['generic.delete'], click: (button) => {
if (confirm('settings_profile.confirm_delete'))
if (confirm(tl('settings_profile.confirm_delete')))
this.remove();
Settings.dialog.content_vue.profile = null;
SettingsProfile.unselect();

View File

@ -1863,7 +1863,7 @@ TextureAnimator = {
let custom_indices = Format.texture_mcmeta && tex.getAnimationFrameIndices();
if (custom_indices) {
let index = custom_indices[TextureAnimator.frame_total % custom_indices.length];
tex.currentFrame = index;
tex.currentFrame = Math.clamp(typeof index == 'object' ? index.index : index, 0, tex.frameCount-1);
} else {
if (tex.currentFrame >= tex.frameCount-1) {