mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Add validate method to individual checks
Fix switching elements to per face UV in validator
This commit is contained in:
parent
40ee8232f5
commit
83a1685f74
@ -96,6 +96,7 @@ class ValidatorCheck {
|
||||
this.run = options.run;
|
||||
this.errors = [];
|
||||
this.warnings = [];
|
||||
this._timeout = null;
|
||||
|
||||
Validator.checks.push(this);
|
||||
Validator.updateCashedTriggers();
|
||||
@ -116,6 +117,26 @@ class ValidatorCheck {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
validate() {
|
||||
if (this._timeout) {
|
||||
clearTimeout(this._timeout);
|
||||
this._timeout = null;
|
||||
}
|
||||
|
||||
this._timeout = setTimeout(() => {
|
||||
this._timeout = null;
|
||||
|
||||
this.update();
|
||||
|
||||
Validator.warnings.empty();
|
||||
Validator.errors.empty();
|
||||
|
||||
Validator.checks.forEach(check => {
|
||||
Validator.warnings.push(...check.warnings);
|
||||
Validator.errors.push(...check.errors);
|
||||
})
|
||||
}, 40)
|
||||
}
|
||||
warn(...warnings) {
|
||||
this.warnings.push(...warnings);
|
||||
}
|
||||
@ -186,15 +207,10 @@ new ValidatorCheck('box_uv', {
|
||||
click() {
|
||||
Validator.dialog.hide();
|
||||
|
||||
save = Undo.initEdit({uv_mode: true})
|
||||
Project.box_uv = false;
|
||||
Canvas.updateAllUVs()
|
||||
updateSelection()
|
||||
Undo.finishEdit('Change project UV settings')
|
||||
BARS.updateConditions()
|
||||
if (Project.EditSession) {
|
||||
Project.EditSession.sendAll('change_project_meta', JSON.stringify({box_uv: false}));
|
||||
}
|
||||
Undo.initEdit({elements: [cube], uv_only: true});
|
||||
cube.setUVMode(false);
|
||||
Undo.finishEdit('Change UV mode')
|
||||
updateSelection();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user