mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-27 04:21:46 +08:00
v1.10.2
This commit is contained in:
parent
27db10ef08
commit
af893a20ab
@ -879,7 +879,7 @@
|
||||
<div class="tool wide m_edit nslide_tool selection_only"><div class="nslide" n-action="size_x"></div><div class="tooltip">Scale X</div></div>
|
||||
<div class="tool wide m_edit nslide_tool selection_only"><div class="nslide" n-action="size_y"></div><div class="tooltip">Scale Y</div></div>
|
||||
<div class="tool wide m_edit nslide_tool selection_only"><div class="nslide" n-action="size_z"></div><div class="tooltip">Scale Z</div></div>
|
||||
<dir class="mode_tab" id="mode_display_tab" onclick="if (!display_mode) {enterDisplaySettings()}">Display</dir>
|
||||
<dir class="mode_tab block_mode_only" id="mode_display_tab" onclick="if (!display_mode) {enterDisplaySettings()}">Display</dir>
|
||||
<dir class="mode_tab open" id="mode_edit_tab" onclick="if (display_mode) {exitDisplaySettings()}">Edit</dir>
|
||||
</header>
|
||||
<div id="left_bar" class="sidebar">
|
||||
|
@ -643,64 +643,6 @@
|
||||
|
||||
};
|
||||
|
||||
/*this.calcPosition = function(offset) {
|
||||
|
||||
if (selected.length === 0) return;
|
||||
scope.children[0].rotation.set(0, 0, 0)
|
||||
|
||||
var center = [0, 0, 0]
|
||||
var i = 0;
|
||||
selected.forEach(function(s) {
|
||||
var obj = elements[s]
|
||||
i = 0;
|
||||
while (i < 3) {
|
||||
center[i] += obj.from[i]
|
||||
center[i] += obj.to[i]
|
||||
i++;
|
||||
}
|
||||
})
|
||||
i = 0;
|
||||
while (i < 3) {
|
||||
center[i] = center[i] / (selected.length * 2)
|
||||
i++;
|
||||
}
|
||||
var vec = new THREE.Vector3()
|
||||
vec.set(center[0], center[1], center[2])
|
||||
if (settings.entity_mode.value) {
|
||||
var obj = elements[selected[0]]
|
||||
if (obj.display.parent !== 'root' &&
|
||||
typeof obj.display.parent === 'object' &&
|
||||
obj.display.parent.display.parent === 'root' &&
|
||||
obj.display.parent.rotation.join('_') !== '0_0_0'
|
||||
) {
|
||||
vec.setFromMatrixPosition(obj.display.mesh.matrixWorld)
|
||||
scope.rotation['x'] = Math.PI / (180 / obj.display.parent.rotation[0])
|
||||
scope.rotation['y'] = Math.PI / (180 / obj.display.parent.rotation[1])
|
||||
scope.rotation['z'] = Math.PI / (180 / obj.display.parent.rotation[2])
|
||||
vec.x -= obj.display.parent.origin[0]
|
||||
vec.y -= obj.display.parent.origin[1]
|
||||
vec.z -= obj.display.parent.origin[2]
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
scope.rotation.set(0, 0, 0)
|
||||
}
|
||||
if (offset !== undefined) {
|
||||
vec.add(offset)
|
||||
if (movementAxis === true) {
|
||||
if (obj.rotation && settings.entity_mode.value === false) {
|
||||
vec.setFromMatrixPosition(obj.display.mesh.matrixWorld)
|
||||
scope.rotation[obj.rotation.axis] = Math.PI / (180 / obj.rotation.angle)
|
||||
vec.x -= obj.rotation.origin[0]
|
||||
vec.y -= obj.rotation.origin[1]
|
||||
vec.z -= obj.rotation.origin[2]
|
||||
}
|
||||
}
|
||||
scope.position.copy(vec)
|
||||
//scope.position.add(vec)
|
||||
}
|
||||
}*/
|
||||
|
||||
function onPointerHover( event ) {
|
||||
|
||||
@ -834,9 +776,9 @@
|
||||
var obj = elements[s]
|
||||
var mesh = scope.objects[i]
|
||||
if (scope.direction === true) { //Positive
|
||||
scaleCube(obj, limitNumber(oldScale + point[axis], 0, 48), axisNumber)
|
||||
scaleCube(obj, limitCoord(oldScale + point[axis]-16)+16, axisNumber)
|
||||
} else {
|
||||
scaleCubeNegative(obj, limitNumber(oldScale - point[axis], 0, 48), axisNumber)
|
||||
scaleCubeNegative(obj, limitCoord(oldScale - point[axis]-16)+16, axisNumber)
|
||||
}
|
||||
if (settings.entity_mode.value === true) {
|
||||
Canvas.updateUV(s)
|
||||
|
@ -762,10 +762,13 @@ function updateNslideValues() {
|
||||
|
||||
//Movement
|
||||
function isInBox(val) {
|
||||
return (val < 32 && val > -16 || settings.entity_mode.value)
|
||||
return (val < 32 && val > -16 || isCanvasRestricted() === false)
|
||||
}
|
||||
function isCanvasRestricted() {
|
||||
return (settings.restricted_canvas.value === true && settings.entity_mode.value === false)
|
||||
}
|
||||
function limitToBox(val) {
|
||||
if (settings.entity_mode.value) {
|
||||
if (!isCanvasRestricted()) {
|
||||
return val;
|
||||
} else if (val > 32) {
|
||||
return 32;
|
||||
@ -1013,7 +1016,7 @@ function createSelection() {
|
||||
}
|
||||
|
||||
function limitCoord(coord) {
|
||||
if (settings.entity_mode.value === true) return coord
|
||||
if (isCanvasRestricted() === false) return coord
|
||||
if (coord > 32) {coord = 32}
|
||||
else if (coord < -16) {coord = -16}
|
||||
return coord;
|
||||
@ -1203,7 +1206,7 @@ function paint() {
|
||||
from[1]+base_cube.size(1),
|
||||
from[2]+base_cube.size(2)
|
||||
]
|
||||
if (settings.entity_mode.value === false) {
|
||||
if (isCanvasRestricted()) {
|
||||
var i = 0
|
||||
while (i < 3) {
|
||||
if (base_cube.to[i] > 32 || from[i] < -16) return;
|
||||
|
12
js/io.js
12
js/io.js
@ -111,7 +111,7 @@ function buildBlockModel(options) { //Export Blockmodel
|
||||
var new_display = {}
|
||||
for (var key in display) {
|
||||
if (display.hasOwnProperty(key)) {
|
||||
if ((display[key].scale && display[key].scale.join('_') !== '1_1_1') ||
|
||||
if ((typeof display[key].scale === 'object' && display[key].scale.join('_') !== '1_1_1') ||
|
||||
display[key].rotation ||
|
||||
display[key].translation
|
||||
) {
|
||||
@ -345,7 +345,10 @@ function loadPEModel() {
|
||||
group.origin = [0, 0, 0]
|
||||
}
|
||||
if (b.rotation) {
|
||||
group.rotation = b.rotation
|
||||
group.rotation = b.rotation.slice()
|
||||
group.rotation.forEach(function(br, ri) {
|
||||
group.rotation[ri] *= -1
|
||||
})
|
||||
}
|
||||
group.reset = b.reset === true
|
||||
|
||||
@ -394,7 +397,10 @@ function buildEntityModel(options) {
|
||||
bone.name = g.name
|
||||
bone.pivot = g.origin
|
||||
if (g.rotation.join('_') !== '0_0_0') {
|
||||
bone.rotation = g.rotation
|
||||
bone.rotation = g.rotation.slice()
|
||||
bone.rotation.forEach(function(br, ri) {
|
||||
bone.rotation[ri] *= -1
|
||||
})
|
||||
}
|
||||
if (g.reset) {
|
||||
bone.reset = true
|
||||
|
@ -120,6 +120,7 @@ function settingSetup() {
|
||||
headline3: {is_title: true, title: "Edit"},
|
||||
entity_mode: {value: false, name: 'Entity Model Mode', desc: 'Unrestricted editing mode for Bedrock and Optifine models'},
|
||||
undo_limit: {value: 20, is_number: true, name: 'Undo Limit', desc: 'Number of steps you can undo'},
|
||||
restricted_canvas:{value: true, name: 'Restricted Canvas', desc: 'Move rotated elements on their own axes if possible'},
|
||||
move_origin: {value: false, name: 'Move on Relative Axes', desc: 'Move rotated elements on their own axes if possible'},
|
||||
autouv: {value: true, name: 'Auto UV', desc: 'Enable AutoUV by default'},
|
||||
create_rename:{value: false, name: 'Rename new Cube', desc: 'Focus name field when creating new element or group'},
|
||||
@ -526,6 +527,9 @@ function toggleWireframe() {
|
||||
var entityMode = {
|
||||
state: false,
|
||||
join: function() {
|
||||
if (display_mode) {
|
||||
exitDisplaySettings()
|
||||
}
|
||||
settings.entity_mode.value = true
|
||||
$('body').addClass('entity_mode')
|
||||
$('label[for="project_parent"]').text('Mob Geometry Name')
|
||||
|
@ -20096,7 +20096,7 @@
|
||||
|
||||
} catch ( error ) {
|
||||
|
||||
$('#status_bar').html('<div><i class="material-icons">warning</i></div><div>Your '+isApp ? 'computer' : 'browser'+' is not compatible with WebGL.</div>')
|
||||
$('#status_bar').html('<div><i class="material-icons">warning</i></div><div>Your '+(isApp ? 'computer' : 'browser')+' is not compatible with WebGL.</div>')
|
||||
console.error('Could not create WebGL context')
|
||||
console.error(error)
|
||||
|
||||
|
2
main.js
2
main.js
@ -26,7 +26,7 @@ function createWindow () {
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
win.webContents.openDevTools()
|
||||
//win.webContents.openDevTools()
|
||||
}
|
||||
|
||||
app.on('ready', createWindow)
|
||||
|
@ -15,10 +15,6 @@
|
||||
"files": [
|
||||
"assets/",
|
||||
"build/",
|
||||
"build/background.png",
|
||||
"build/icon.icns",
|
||||
"build/icon.ico",
|
||||
"build/icon.png",
|
||||
"css/",
|
||||
"font/",
|
||||
"js",
|
||||
|
Loading…
Reference in New Issue
Block a user