mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Use smoother equation smooth brush falloff
Fix grid not updating when exploding model (#1451) Fix tooltip in texture generator dialog Change background color in center texture/UV editor Increase minimum image zoom in Paint format Fix wrong keybinding label in status bar on Mac
This commit is contained in:
parent
e5c172ea92
commit
7ad1c898b6
@ -150,6 +150,9 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
.dialog_bar.form_bar .tool > .tooltip {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
.dialog_bar.small_text li {
|
.dialog_bar.small_text li {
|
||||||
list-style: auto;
|
list-style: auto;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
@ -1300,9 +1300,12 @@
|
|||||||
/*UV*/
|
/*UV*/
|
||||||
.UVEditor {
|
.UVEditor {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
--color-background: var(--color-back);
|
||||||
|
--color-frame: var(--color-ui);
|
||||||
}
|
}
|
||||||
dialog .UVEditor {
|
#center .UVEditor {
|
||||||
z-index: 20;
|
--color-background: var(--color-dark);
|
||||||
|
--color-frame: var(--color-back);
|
||||||
}
|
}
|
||||||
.UVEditor > .toolbar {
|
.UVEditor > .toolbar {
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
@ -1349,8 +1352,8 @@
|
|||||||
width: 320px;
|
width: 320px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
border: 4px solid var(--color-ui);
|
border: 4px solid var(--color-frame);
|
||||||
box-shadow: 0 0 0 1800px var(--color-back);
|
box-shadow: 0 0 0 1800px var(--color-background);
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
--color-uv-unselected: var(--color-grid);
|
--color-uv-unselected: var(--color-grid);
|
||||||
--color-uv-selected: white;
|
--color-uv-selected: white;
|
||||||
|
@ -778,7 +778,7 @@ onVueSetup(function() {
|
|||||||
|
|
||||||
<template v-if="show_modifier_keys && !isMobile">
|
<template v-if="show_modifier_keys && !isMobile">
|
||||||
<div class="status_bar_modifier_key" v-if="modifier_keys.ctrl.length" @click="clickModifiers()">
|
<div class="status_bar_modifier_key" v-if="modifier_keys.ctrl.length" @click="clickModifiers()">
|
||||||
<kbd>${tl(Blockbench.platform == 'darwin' ? 'keys.cmd' : 'keys.ctrl')}</kbd>
|
<kbd>${tl(Blockbench.platform == 'darwin' ? 'keys.meta' : 'keys.ctrl')}</kbd>
|
||||||
<span>{{ tl(modifier_keys.ctrl.last()) }}</span>
|
<span>{{ tl(modifier_keys.ctrl.last()) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="status_bar_modifier_key" v-if="modifier_keys.shift.length" @click="clickModifiers()">
|
<div class="status_bar_modifier_key" v-if="modifier_keys.shift.length" @click="clickModifiers()">
|
||||||
|
@ -70,6 +70,7 @@ class ModelFormat {
|
|||||||
model.model_3d.position.x = model.model_3d.position.z = 8;
|
model.model_3d.position.x = model.model_3d.position.z = 8;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Interface.preview.style.display = Format.id == 'image' ? 'none' : null;
|
||||||
Preview.all.forEach(preview => {
|
Preview.all.forEach(preview => {
|
||||||
if (preview.isOrtho && typeof preview.angle == 'number') {
|
if (preview.isOrtho && typeof preview.angle == 'number') {
|
||||||
preview.loadAnglePreset(DefaultCameraPresets[preview.angle+1])
|
preview.loadAnglePreset(DefaultCameraPresets[preview.angle+1])
|
||||||
|
@ -835,10 +835,6 @@ new NodePreviewController(Cube, {
|
|||||||
mesh.scale[axis] = 1;
|
mesh.scale[axis] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Modes.paint) {
|
|
||||||
element.preview_controller.updatePaintingGrid(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dispatchEvent('update_transform', {element});
|
this.dispatchEvent('update_transform', {element});
|
||||||
},
|
},
|
||||||
updateGeometry(element) {
|
updateGeometry(element) {
|
||||||
|
@ -773,7 +773,7 @@ const Canvas = {
|
|||||||
if ((aspects.uv || update_all)) {
|
if ((aspects.uv || update_all)) {
|
||||||
if (controller.updateUV) controller.updateUV(element);
|
if (controller.updateUV) controller.updateUV(element);
|
||||||
}
|
}
|
||||||
if ((aspects.painting_grid || update_all) && Modes.paint && settings.painting_grid.value) {
|
if ((aspects.painting_grid || aspects.geometry || aspects.transform || update_all) && Modes.paint && settings.painting_grid.value) {
|
||||||
if (controller.updatePaintingGrid) controller.updatePaintingGrid(element);
|
if (controller.updatePaintingGrid) controller.updatePaintingGrid(element);
|
||||||
}
|
}
|
||||||
if (aspects.visibility || update_all) {
|
if (aspects.visibility || update_all) {
|
||||||
|
@ -1221,7 +1221,7 @@ const Painter = {
|
|||||||
this.bitmap.data[idx + 3] = color.a
|
this.bitmap.data[idx + 3] = color.a
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editCircle(ctx, x, y, r, s, editPx) {
|
editCircle(ctx, x, y, r, soft, editPx) {
|
||||||
r = Math.round(r+1)/2
|
r = Math.round(r+1)/2
|
||||||
Painter.scanCanvas(ctx, Math.floor(x)-Math.ceil(r)-2, Math.floor(y)-Math.ceil(r)-2, 2*r+3, 2*r+3, function (px, py, pixel) {
|
Painter.scanCanvas(ctx, Math.floor(x)-Math.ceil(r)-2, Math.floor(y)-Math.ceil(r)-2, 2*r+3, 2*r+3, function (px, py, pixel) {
|
||||||
if (
|
if (
|
||||||
@ -1250,8 +1250,9 @@ const Painter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var distance = Math.sqrt(v_px*v_px + v_py*v_py)
|
var distance = Math.sqrt(v_px*v_px + v_py*v_py)
|
||||||
if (s*r != 0) {
|
if (soft*r != 0) {
|
||||||
var pos_on_gradient = (distance-(1-s)*r) / (s*r)
|
var pos_on_gradient = Math.clamp((distance-(1-soft)*r) / (soft*r), 0, 1)
|
||||||
|
pos_on_gradient = 3*Math.pow(pos_on_gradient, 2) - 2*Math.pow(pos_on_gradient, 3);
|
||||||
} else {
|
} else {
|
||||||
if (r < 8) {
|
if (r < 8) {
|
||||||
distance *= 1.2;
|
distance *= 1.2;
|
||||||
@ -1305,7 +1306,8 @@ const Painter = {
|
|||||||
|
|
||||||
var distance = Math.max(Math.abs(v_px), Math.abs(v_py));
|
var distance = Math.max(Math.abs(v_px), Math.abs(v_py));
|
||||||
if (s*r != 0) {
|
if (s*r != 0) {
|
||||||
var pos_on_gradient = (distance-(1-s)*r) / (s*r)
|
var pos_on_gradient = Math.clamp((distance-(1-s)*r) / (s*r), 0, 1)
|
||||||
|
pos_on_gradient = 3*Math.pow(pos_on_gradient, 2) - 2*Math.pow(pos_on_gradient, 3);
|
||||||
} else {
|
} else {
|
||||||
var pos_on_gradient = Math.floor((distance)/r)
|
var pos_on_gradient = Math.floor((distance)/r)
|
||||||
}
|
}
|
||||||
@ -1396,14 +1398,14 @@ BARS.defineActions(function() {
|
|||||||
changePixel(px, py, pxcolor, local_opacity, {color, opacity, ctx, x, y, size, softness, texture, event}) {
|
changePixel(px, py, pxcolor, local_opacity, {color, opacity, ctx, x, y, size, softness, texture, event}) {
|
||||||
let blend_mode = BarItems.blend_mode.value;
|
let blend_mode = BarItems.blend_mode.value;
|
||||||
if (blend_mode == 'set_opacity') local_opacity = 1;
|
if (blend_mode == 'set_opacity') local_opacity = 1;
|
||||||
let a = opacity * local_opacity;
|
let a = opacity * local_opacity * 0.24;
|
||||||
|
|
||||||
if (blend_mode == 'set_opacity') {
|
if (blend_mode == 'set_opacity') {
|
||||||
if (Painter.lock_alpha && pxcolor.a == 0) return pxcolor;
|
if (Painter.lock_alpha && pxcolor.a == 0) return pxcolor;
|
||||||
return {r: color.r, g: color.g, b: color.b, a}
|
return {r: color.r, g: color.g, b: color.b, a}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var before = Painter.getAlphaMatrix(texture, px, py)
|
var before = 0;//Painter.getAlphaMatrix(texture, px, py)
|
||||||
Painter.setAlphaMatrix(texture, px, py, a);
|
Painter.setAlphaMatrix(texture, px, py, a);
|
||||||
if (a > before) {
|
if (a > before) {
|
||||||
a = (a - before) / (1 - before);
|
a = (a - before) / (1 - before);
|
||||||
@ -1851,7 +1853,7 @@ BARS.defineActions(function() {
|
|||||||
new Toggle('painting_grid', {
|
new Toggle('painting_grid', {
|
||||||
icon: 'grid_on',
|
icon: 'grid_on',
|
||||||
category: 'view',
|
category: 'view',
|
||||||
condition: () => Modes.paint && Format.edit_mode,
|
condition: () => Modes.paint && Format.id != 'image',
|
||||||
keybind: new Keybind({key: 'g'}),
|
keybind: new Keybind({key: 'g'}),
|
||||||
linked_setting: 'painting_grid'
|
linked_setting: 'painting_grid'
|
||||||
})
|
})
|
||||||
|
@ -60,9 +60,6 @@ const TextureGenerator = {
|
|||||||
if (form.type == 'template' && TextureGenerator.background_color.get().toHex8() === 'ffffffff') {
|
if (form.type == 'template' && TextureGenerator.background_color.get().toHex8() === 'ffffffff') {
|
||||||
TextureGenerator.background_color.set('#00000000')
|
TextureGenerator.background_color.set('#00000000')
|
||||||
}
|
}
|
||||||
if (form.type == 'blank' && TextureGenerator.background_color.get().toHex8() === '00000000') {
|
|
||||||
TextureGenerator.background_color.set('#ffffffff')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onConfirm: function(results) {
|
onConfirm: function(results) {
|
||||||
results.particle = 'auto';
|
results.particle = 'auto';
|
||||||
|
@ -393,7 +393,7 @@ const UVEditor = {
|
|||||||
},
|
},
|
||||||
//Set
|
//Set
|
||||||
setZoom(zoom) {
|
setZoom(zoom) {
|
||||||
zoom = Math.clamp(zoom, 0.5, UVEditor.max_zoom)
|
zoom = Math.clamp(zoom, UVEditor.height > 800 ? 0.2 : 0.5, UVEditor.max_zoom)
|
||||||
this.vue.zoom = zoom;
|
this.vue.zoom = zoom;
|
||||||
Project.uv_viewport.zoom = this.zoom;
|
Project.uv_viewport.zoom = this.zoom;
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user