Update Wintersky to 1.1.0

Fix issue where variables set by keyframes could no longer
Fix sign of camera rotation queries on X axis
This commit is contained in:
JannisX11 2022-04-22 22:40:55 +02:00
parent 9adc6fc4f2
commit 79e371f621
3 changed files with 39 additions and 28 deletions

@ -1455,10 +1455,14 @@ Animator.MolangParser.global_variables = {
return Timeline.time;
},
'query.camera_rotation'(axis) {
return cameraTargetToRotation(Preview.selected.camera.position.toArray(), Preview.selected.controls.target.toArray())[axis ? 0 : 1];
let val = cameraTargetToRotation(Preview.selected.camera.position.toArray(), Preview.selected.controls.target.toArray())[axis ? 0 : 1];
if (axis == 0) val *= -1;
return val;
},
'query.rotation_to_camera'(axis) {
return cameraTargetToRotation([0, 0, 0], Preview.selected.camera.position.toArray())[axis ? 0 : 1] ;
let val = cameraTargetToRotation([0, 0, 0], Preview.selected.camera.position.toArray())[axis ? 0 : 1] ;
if (axis == 0) val *= -1;
return val;
},
get 'query.distance_from_camera'() {
return Preview.selected.camera.position.length() / 16;
@ -2014,38 +2018,45 @@ Interface.definePanels(function() {
this.buttons.forEach(b => old_values[b.id] = b.value);
this.buttons.empty();
let matches = this.text.toLowerCase().match(/(slider|toggle)\(.+\)/g);
let text = this.text.toLowerCase();
let matches = text.matchAll(/(slider|toggle)\(.+\)/g);
if (matches) {
matches.forEach(match => {
let [type, content] = match.substring(0, match.length - 1).split(/\(/);
let [id, ...args] = content.split(/\(|, */);
id = id.replace(/['"]/g, '');
if (this.buttons.find(b => b.id == id)) return;
for (let match of matches) {
let [type, content] = match[0].substring(0, match[0].length - 1).split(/\(/);
let [id, ...args] = content.split(/\(|, */);
id = id.replace(/['"]/g, '');
if (this.buttons.find(b => b.id == id)) return;
if (type == 'slider') {
this.buttons.push({
type,
id,
value: old_values[id] || 0,
step: args[0],
min: args[1],
max: args[2]
})
} else {
this.buttons.push({
type,
id,
value: old_values[id] || 0,
})
}
})
let variable = text.substring(0, match.index).match(/[\w.-]+ *= *$/);
variable = variable ? variable[0].replace(/[ =]+/g, '').replace(/^v\./, 'variable.').replace(/^q\./, 'query.').replace(/^t\./, 'temp.').replace(/^c\./, 'context.') : undefined;
if (type == 'slider') {
this.buttons.push({
type,
id,
value: old_values[id] || 0,
variable,
step: args[0],
min: args[1],
max: args[2]
})
} else {
this.buttons.push({
type,
id,
value: old_values[id] || 0,
variable,
})
}
}
},
changeButtonValue(button, event) {
if (button.type == 'toggle') {
button.value = event.target.checked ? 1 : 0;
}
if (button.variable) {
delete Animator.MolangParser.variables[button.variable];
}
Animator.preview();
},
slideButton(button, e1) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long