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', {name: 'menu.file.new', id: 'new', icon: 'insert_drive_file',
children: function() { children: function() {
var arr = []; let arr = [];
let redact = settings.streamer_mode.value; let redact = settings.streamer_mode.value;
for (var key in Formats) { for (let key in Formats) {
(function() { let format = Formats[key];
var format = Formats[key]; arr.push({
arr.push({ id: format.id,
id: format.id, name: (redact && format.confidential) ? `[${tl('generic.redacted')}]` : format.name,
name: (redact && format.confidential) ? `[${tl('generic.redacted')}]` : format.name, icon: format.icon,
icon: format.icon, description: format.description,
description: format.description, click: (e) => {
click: (e) => { format.new()
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; return arr;
} }

View File

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

View File

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

View File

@ -116,6 +116,14 @@ Interface.definePanels(() => {
settings.color_wheel.set(!settings.color_wheel.value); settings.color_wheel.set(!settings.color_wheel.value);
Panels.color.onResize(); 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) { sort(event) {
var item = this.palette.splice(event.oldIndex, 1)[0]; var item = this.palette.splice(event.oldIndex, 1)[0];
this.palette.splice(event.newIndex, 0, item); this.palette.splice(event.newIndex, 0, item);
@ -191,7 +199,7 @@ Interface.definePanels(() => {
</div> </div>
</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'}"> <div v-show="picker_type == 'box'" ref="square_picker" :style="{maxWidth: width + 'px'}">
<input id="main_colorpicker"> <input id="main_colorpicker">
</div> </div>

View File

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