Implement #1466 Scroll to change color picker hue

List model loaders in File > New menu
Add credit tag export to OptiFine JEM
Fix #1467 corrupting texture files when saving while closing
This commit is contained in:
JannisX11 2022-07-07 19:44:40 +02:00
parent d0fb0e549f
commit 21b741ad5c
5 changed files with 42 additions and 18 deletions

View File

@ -591,21 +591,32 @@ const MenuBar = {
'_',
{name: 'menu.file.new', id: 'new', icon: 'insert_drive_file',
children: function() {
var arr = [];
let arr = [];
let redact = settings.streamer_mode.value;
for (var key in Formats) {
(function() {
var format = Formats[key];
arr.push({
id: format.id,
name: (redact && format.confidential) ? `[${tl('generic.redacted')}]` : format.name,
icon: format.icon,
description: format.description,
click: (e) => {
format.new()
}
})
})()
for (let key in Formats) {
let format = Formats[key];
arr.push({
id: format.id,
name: (redact && format.confidential) ? `[${tl('generic.redacted')}]` : format.name,
icon: format.icon,
description: format.description,
click: (e) => {
format.new()
}
})
}
arr.push('_');
for (let key in ModelLoader.loaders) {
let loader = ModelLoader.loaders[key];
arr.push({
id: loader.id,
name: (redact && loader.confidential) ? `[${tl('generic.redacted')}]` : loader.name,
icon: loader.icon,
description: loader.description,
click: (e) => {
loader.new()
}
})
}
return arr;
}

View File

@ -413,6 +413,9 @@ class ModelLoader {
Vue.component(`format_page_${this.id}`, this.format_page.component)
}
}
new() {
this.onStart();
}
delete() {
delete ModelLoader.loaders[this.id];
}

View File

@ -14,6 +14,9 @@ var codec = new Codec('optifine_entity', {
compile(options) {
if (options === undefined) options = {}
var entitymodel = {}
if (settings.credit.value) {
jpm.credit = settings.credit.value
}
var geo_code = 'geometry.'+Project.geometry_name
if (Texture.getDefault()) {
let tex = Texture.getDefault();

View File

@ -116,6 +116,14 @@ Interface.definePanels(() => {
settings.color_wheel.set(!settings.color_wheel.value);
Panels.color.onResize();
},
onMouseWheel(event) {
if (!event.target) return;
if (settings.color_wheel.value || event.target.classList.contains('sp-hue') || event.target.classList.contains('sp-slider')) {
let sign = Math.sign(event.deltaY);
if (event.shiftKey) sign *= 4;
BarItems.slider_color_h.change(v => v+sign);
}
},
sort(event) {
var item = this.palette.splice(event.oldIndex, 1)[0];
this.palette.splice(event.newIndex, 0, item);
@ -191,7 +199,7 @@ Interface.definePanels(() => {
</div>
</div>
<div v-show="open_tab == 'picker' || open_tab == 'both'">
<div v-show="open_tab == 'picker' || open_tab == 'both'" @mousewheel="onMouseWheel($event)">
<div v-show="picker_type == 'box'" ref="square_picker" :style="{maxWidth: width + 'px'}">
<input id="main_colorpicker">
</div>

View File

@ -1047,9 +1047,8 @@ class Texture {
}
tex_version++;
if (!as && this.path && fs.existsSync(this.path)) {
fs.writeFile(this.path, image, function (err) {
scope.fromPath(scope.path)
})
fs.writeFileSync(this.path, image);
scope.fromPath(scope.path)
} else {
var find_path;
if (Format.bone_rig && Project.geometry_name && Project.BedrockEntityManager) {