mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-27 04:21:46 +08:00
Prepare cullfaces for bedrock support
Fix java block format scenes being shifted down 8 pixels
This commit is contained in:
parent
3cc455c087
commit
5cedf21fca
@ -2279,6 +2279,7 @@ span.controller_state_section_info {
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
width: 50px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.uv_face_properties_labels label > i {
|
||||
vertical-align: top;
|
||||
|
@ -1312,9 +1312,7 @@ enterDisplaySettings = function() { //Enterung Display Setting Mode, changes th
|
||||
scene.add(display_area);
|
||||
if (Project.model_3d) {
|
||||
Project.model_3d.position.copy(Canvas.scene.position);
|
||||
if (Format.id == 'bedrock_block') {
|
||||
Project.model_3d.position.y = -8;
|
||||
}
|
||||
Project.model_3d.position.y = -8;
|
||||
}
|
||||
scene.position.set(0, 0, 0);
|
||||
|
||||
@ -1336,7 +1334,7 @@ exitDisplaySettings = function() { //Enterung Display Setting Mode, changes the
|
||||
Canvas.global_light_side = 0;
|
||||
Canvas.updateShading();
|
||||
scene.remove(display_area)
|
||||
if (!Format.centered_grid) scene.position.set(-8, -8, -8);
|
||||
if (!Format.centered_grid) scene.position.set(-8, 0, -8);
|
||||
display_base.children.forEachReverse(child => {
|
||||
display_base.remove(child);
|
||||
child.position.set(0, 0, 0);
|
||||
|
@ -65,7 +65,7 @@ class ModelFormat {
|
||||
scene.position.set(0, 0, 0);
|
||||
Canvas.ground_plane.position.x = Canvas.ground_plane.position.z = 8;
|
||||
} else {
|
||||
scene.position.set(-8, -8, -8);
|
||||
scene.position.set(-8, 0, -8);
|
||||
Canvas.ground_plane.position.x = Canvas.ground_plane.position.z = 0;
|
||||
}
|
||||
PreviewModel.getActiveModels().forEach(model => {
|
||||
@ -281,6 +281,7 @@ new Property(ModelFormat, 'boolean', 'rotation_snap');
|
||||
new Property(ModelFormat, 'boolean', 'uv_rotation');
|
||||
new Property(ModelFormat, 'boolean', 'java_cube_shading_properties');
|
||||
new Property(ModelFormat, 'boolean', 'java_face_properties');
|
||||
new Property(ModelFormat, 'boolean', 'cullfaces');
|
||||
new Property(ModelFormat, 'boolean', 'select_texture_for_particles');
|
||||
new Property(ModelFormat, 'boolean', 'texture_mcmeta');
|
||||
new Property(ModelFormat, 'boolean', 'bone_binding_expression');
|
||||
|
@ -532,6 +532,7 @@ var format = new ModelFormat({
|
||||
uv_rotation: true,
|
||||
java_cube_shading_properties: true,
|
||||
java_face_properties: true,
|
||||
cullfaces: true,
|
||||
animated_textures: true,
|
||||
select_texture_for_particles: true,
|
||||
texture_mcmeta: true,
|
||||
|
@ -19,7 +19,7 @@ function getSelectionCenter(all = false) {
|
||||
let center = (min[0] == Infinity) ? [0, 0, 0] : max.V3_add(min).V3_divide(2);
|
||||
|
||||
if (!Format.centered_grid) {
|
||||
center.V3_add(8, 8, 8)
|
||||
center.V3_add(8, 0, 8)
|
||||
}
|
||||
return center;
|
||||
}
|
||||
@ -1950,7 +1950,7 @@ BARS.defineActions(function() {
|
||||
})
|
||||
new Action('auto_set_cullfaces', {
|
||||
icon: 'smart_button',
|
||||
condition: () => Modes.edit && Format.java_face_properties,
|
||||
condition: () => Modes.edit && Format.cullfaces,
|
||||
click() {
|
||||
if (!Cube.selected.length) {
|
||||
BarItems.select_all.click();
|
||||
@ -1977,7 +1977,8 @@ BARS.defineActions(function() {
|
||||
});
|
||||
})
|
||||
|
||||
Undo.finishEdit('Automatically set cullfaces')
|
||||
updateSelection();
|
||||
Undo.finishEdit('Automatically set cullfaces');
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -619,7 +619,7 @@ class Cube extends OutlinerElement {
|
||||
vec.set(...coords.V3_subtract(this.origin));
|
||||
vec.applyMatrix4( this.mesh.matrixWorld );
|
||||
let arr = vec.toArray();
|
||||
arr.V3_add(8, 8, 8);
|
||||
arr.V3_add(8, 0, 8);
|
||||
return arr;
|
||||
})
|
||||
}
|
||||
|
@ -1098,7 +1098,6 @@ class Preview {
|
||||
intersect.object.localToWorld(brush_coord);
|
||||
if (!Format.centered_grid) {
|
||||
brush_coord.x += 8;
|
||||
brush_coord.y += 8;
|
||||
brush_coord.z += 8;
|
||||
}
|
||||
Canvas.brush_outline.position.copy(brush_coord);
|
||||
|
@ -602,8 +602,10 @@ const UVEditor = {
|
||||
let face = UVEditor.getReferenceFace();
|
||||
if (face instanceof CubeFace) {
|
||||
BarItems.uv_rotation.set((face && face.rotation)||0);
|
||||
if (Format.java_face_properties) {
|
||||
if (Format.cullfaces) {
|
||||
BarItems.cullface.set(face.cullface||'off')
|
||||
}
|
||||
if (Format.java_face_properties) {
|
||||
BarItems.face_tint.setIcon(face.tint !== -1 ? 'check_box' : 'check_box_outline_blank')
|
||||
BarItems.slider_face_tint.update()
|
||||
}
|
||||
@ -1495,7 +1497,7 @@ const UVEditor = {
|
||||
},
|
||||
new MenuSeparator('face_options'),
|
||||
'face_tint',
|
||||
{icon: 'flip_to_back', condition: () => (Format.java_face_properties && Cube.selected.length && UVEditor.getReferenceFace()), name: 'action.cullface' , children: function() {
|
||||
{icon: 'flip_to_back', condition: () => (Format.cullfaces && Cube.selected.length && UVEditor.getReferenceFace()), name: 'action.cullface' , children: function() {
|
||||
let off = 'far.fa-circle';
|
||||
let on = 'far.fa-dot-circle';
|
||||
function setCullface(cullface) {
|
||||
@ -1881,7 +1883,7 @@ BARS.defineActions(function() {
|
||||
})
|
||||
new BarSelect('cullface', {
|
||||
category: 'uv',
|
||||
condition: () => UVEditor.isFaceUV() && Format.java_face_properties && Cube.selected.length && UVEditor.getReferenceFace(),
|
||||
condition: () => UVEditor.isFaceUV() && Format.cullfaces && Cube.selected.length && UVEditor.getReferenceFace(),
|
||||
label: true,
|
||||
options: {
|
||||
off: tl('uv_editor.no_faces'),
|
||||
@ -1901,7 +1903,7 @@ BARS.defineActions(function() {
|
||||
new Action('auto_cullface', {
|
||||
icon: 'block',
|
||||
category: 'uv',
|
||||
condition: () => UVEditor.isFaceUV() && Format.java_face_properties && Cube.selected.length && UVEditor.getReferenceFace(),
|
||||
condition: () => UVEditor.isFaceUV() && Format.cullfaces && Cube.selected.length && UVEditor.getReferenceFace(),
|
||||
keybind: new Keybind({}, {
|
||||
all_faces: 'shift'
|
||||
}),
|
||||
@ -2425,8 +2427,10 @@ Interface.definePanels(function() {
|
||||
UVEditor.updateSelectionOutline(false);
|
||||
},
|
||||
centerView() {
|
||||
this.$refs.viewport.scrollLeft = this.width/2;
|
||||
this.$refs.viewport.scrollTop = this.height/2;
|
||||
if (this.$refs.viewport) {
|
||||
this.$refs.viewport.scrollLeft = this.width/2;
|
||||
this.$refs.viewport.scrollTop = this.height/2;
|
||||
}
|
||||
this.centered_view = true;
|
||||
},
|
||||
setMode(mode) {
|
||||
@ -4041,7 +4045,9 @@ Interface.definePanels(function() {
|
||||
${tl('action.face_tint')}
|
||||
<i class="material-icons">info</i>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<template v-if="checkFormat({cullfaces: true})">
|
||||
<label style="width: 50px;" @click="showInfoBox('action.cullface', 'uv_editor.cullface.info')" title="${tl('uv_editor.cullface.info')}" class="flexible">
|
||||
${tl('action.cullface')}
|
||||
<i class="material-icons">info</i>
|
||||
@ -4079,7 +4085,9 @@ Interface.definePanels(function() {
|
||||
<input type="checkbox" title="${tl('action.face_tint')}" :checked="mappable_elements[0].faces[key].tint > -1" @change="toggleFaceTint(key, $event)">
|
||||
<input type="number" title="${tl('action.face_tint')}" style="width: 30px;" :value="mappable_elements[0].faces[key].tint" min="0" step="1" @input="changeFaceTint(key, $event)" v-if="mappable_elements[0].faces[key].tint > -1">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="checkFormat({cullfaces: true})">
|
||||
<select-input class="flexible" title="${tl('action.cullface')}" :value="mappable_elements[0].faces[key].cullface" @input="setCullface(key, $event)" :options="cullface_options" />
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user