mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
PR Feedback
This commit is contained in:
parent
ee25fae85f
commit
b1b7223c81
@ -2249,7 +2249,7 @@ const BARS = {
|
||||
id: 'element_stretch',
|
||||
name: 'panel.element.stretch',
|
||||
label: true,
|
||||
condition: () => settings.stretch_enabled.value && Format.id === "free",
|
||||
condition: () => Format.stretch_cubes,
|
||||
children: [
|
||||
'slider_stretch_x',
|
||||
'slider_stretch_y',
|
||||
|
@ -458,7 +458,6 @@ const Settings = {
|
||||
'face': tl('menu.paste.face'),
|
||||
'mesh_selection': tl('menu.paste.mesh_selection'),
|
||||
}});
|
||||
new Setting('stretch_enabled',{category: 'edit', value: true});
|
||||
new Setting('stretch_linked',{category: 'edit', value: true});
|
||||
|
||||
//Grid
|
||||
|
@ -240,6 +240,7 @@ new Property(ModelFormat, 'boolean', 'animated_textures');
|
||||
new Property(ModelFormat, 'boolean', 'bone_rig');
|
||||
new Property(ModelFormat, 'boolean', 'centered_grid');
|
||||
new Property(ModelFormat, 'boolean', 'rotate_cubes');
|
||||
new Property(ModelFormat, 'boolean', 'stretch_cubes');
|
||||
new Property(ModelFormat, 'boolean', 'integer_size');
|
||||
new Property(ModelFormat, 'boolean', 'meshes');
|
||||
new Property(ModelFormat, 'boolean', 'texture_meshes');
|
||||
|
@ -16,6 +16,7 @@ new ModelFormat({
|
||||
},
|
||||
meshes: true,
|
||||
rotate_cubes: true,
|
||||
stretch_cubes: true,
|
||||
bone_rig: true,
|
||||
centered_grid: true,
|
||||
optional_box_uv: true,
|
||||
|
@ -1205,7 +1205,7 @@ BARS.defineActions(function() {
|
||||
description: tl('action.slider_stretch.desc', ['X']),
|
||||
color: 'x',
|
||||
category: 'transform',
|
||||
condition: function() {return Cube.selected.length && Modes.edit},
|
||||
condition: function() {return Format.stretch_cubes && Cube.selected.length && Modes.edit},
|
||||
getInterval: getSpatialInterval,
|
||||
get: function() {
|
||||
return Cube.selected[0].stretch[0]
|
||||
@ -1238,7 +1238,7 @@ BARS.defineActions(function() {
|
||||
description: tl('action.slider_stretch.desc', ['Y']),
|
||||
color: 'y',
|
||||
category: 'transform',
|
||||
condition: function() {return Cube.selected.length && Modes.edit},
|
||||
condition: function() {return Format.stretch_cubes && Cube.selected.length && Modes.edit},
|
||||
getInterval: getSpatialInterval,
|
||||
get: function() {
|
||||
return Cube.selected[0].stretch[1]
|
||||
@ -1271,7 +1271,7 @@ BARS.defineActions(function() {
|
||||
description: tl('action.slider_stretch.desc', ['Z']),
|
||||
color: 'z',
|
||||
category: 'transform',
|
||||
condition: function() {return Cube.selected.length && Modes.edit},
|
||||
condition: function() {return Format.stretch_cubes && Cube.selected.length && Modes.edit},
|
||||
getInterval: getSpatialInterval,
|
||||
get: function() {
|
||||
return Cube.selected[0].stretch[2]
|
||||
@ -1755,11 +1755,7 @@ BARS.defineActions(function() {
|
||||
icon: 'fas.fa-link',
|
||||
category: 'transform',
|
||||
linked_setting: 'stretch_linked',
|
||||
condition: {
|
||||
modes: ['edit', 'animate'],
|
||||
selected: {outliner: true},
|
||||
method: () => Cube.selected.length
|
||||
}
|
||||
condition: () => Format.stretch_cubes && Cube.selected.length && Modes.edit
|
||||
})
|
||||
new Action('origin_to_geometry', {
|
||||
icon: 'filter_center_focus',
|
||||
|
@ -878,11 +878,19 @@ new Property(Cube, 'boolean', 'locked');
|
||||
OutlinerElement.registerType(Cube, 'cube');
|
||||
|
||||
function adjustFromAndToForInflateAndStretch(from, to, element) {
|
||||
var halfSize = element.size().slice();
|
||||
halfSize.forEach((v, i) => {
|
||||
halfSize[i] /= 2;
|
||||
});
|
||||
var center = [
|
||||
element.from[0] + halfSize[0],
|
||||
element.from[1] + halfSize[1],
|
||||
element.from[2] + halfSize[2]
|
||||
];
|
||||
|
||||
for (let i = 0; i < from.length; i++) {
|
||||
from[i] = (from[i] - element.inflate) * element.stretch[i];
|
||||
}
|
||||
for (let i = 0; i < to.length; i++) {
|
||||
to[i] = (to[i] + element.inflate) * element.stretch[i];
|
||||
from[i] = center[i] - (halfSize[i] + element.inflate) * element.stretch[i];
|
||||
to[i] = center[i] + (halfSize[i] + element.inflate) * element.stretch[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ new ValidatorCheck('box_uv', {
|
||||
Cube.all.forEach(cube => {
|
||||
if (!cube.box_uv) return;
|
||||
let size = cube.size();
|
||||
let invalid_size_axes = size.filter(value => value < 0.999 && (value+cube.inflate*2) > 0.005);
|
||||
let invalid_size_axes = size.filter((value, axis) => value < 0.999 && (value+cube.inflate*2) * cube.stretch[axis] > 0.005);
|
||||
if (invalid_size_axes.length) {
|
||||
let buttons = [
|
||||
{
|
||||
|
File diff suppressed because one or more lines are too long
@ -823,8 +823,6 @@
|
||||
"settings.only_selected_bezier_handles.desc": "Hide handles of bézier keyframes that are not currently selected",
|
||||
"settings.stretch_linked": "Link Stretching",
|
||||
"settings.stretch_linked.desc": "Stretch the cube in all directions with the same value",
|
||||
"settings.stretch_enabled": "Enable Stretching",
|
||||
"settings.stretch_enabled.desc": "Enables the stretching tool for generic models only",
|
||||
|
||||
"settings.base_grid": "Small Grid",
|
||||
"settings.base_grid.desc": "Show small grid and axes",
|
||||
|
Loading…
Reference in New Issue
Block a user