This commit is contained in:
JannisX11 2019-01-09 15:54:35 +01:00 committed by GitHub
parent fe649db220
commit 0471db38ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 1363 additions and 1656 deletions

View File

@ -431,9 +431,6 @@
input.mediun_width { input.mediun_width {
width: 64px; width: 64px;
} }
.custom_select.ctx ul {
display: block;
}
div.nslide { div.nslide {
height: 32px; height: 32px;
width: 79px; width: 79px;
@ -658,7 +655,6 @@
.single_canvas_wrapper { .single_canvas_wrapper {
height: 100%; height: 100%;
width: 100%; width: 100%;
position: relative;
} }
.quad_canvas_wrapper { .quad_canvas_wrapper {
height: 50%; height: 50%;
@ -897,29 +893,10 @@
#cubes_list > div.vue-tree > ul > li > *:not(ul) { #cubes_list > div.vue-tree > ul > li > *:not(ul) {
display: none; display: none;
} }
/* .outliner_node .outliner_object i, .outliner_object i[class^="icon-"] {
#cubes_list > div > ul > li > ul > li > ul > li > div {
padding-left: 20px;
}
#cubes_list > div > ul > li > ul > li > ul > li > ul > li > div {
padding-left: 40px;
}
#cubes_list > div > ul > li > ul > li > ul > li > ul > li > ul > li > div {
padding-left: 60px;
}
#cubes_list > div > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > div {
padding-left: 80px;
}
#cubes_list > div > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > div {
padding-left: 100px;
}
#cubes_list > div > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > ul li > div {
padding-left: 120px;
}
*/
.outliner_object i.fa {
text-align: center; text-align: center;
width: 18px; width: 18px;
font-size: 17.3px;
} }
.outliner_opener_placeholder { .outliner_opener_placeholder {
width: 18px; width: 18px;
@ -1777,32 +1754,6 @@
background-color: var(--color-back); background-color: var(--color-back);
float: none; float: none;
} }
#display_presets {
margin-left: 5px;
cursor: default;
}
#display_presets ul {
display: none;
position: absolute;
max-height: 214px;
overflow-y: auto;
}
#display_presets.ctx ul {
display: block;
background-color: var(--color-dark)
}
#display_presets ul li {
cursor: default;
height: 36px;
padding: 4px;
}
#display_presets ul li > * {
float: left;
margin-right: 5px;
}
#display_presets ul li > *:hover {
color: var(--color-light);
}
.dialog.paddinged { .dialog.paddinged {
padding: 24px; padding: 24px;
} }

1875
index.html

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
<script> <script>
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
const isApp = typeof require !== 'undefined'; const isApp = typeof require !== 'undefined';
const appVersion = '2.3.1'; const appVersion = '2.3.2';
</script> </script>
<script src="lib/vue.min.js"></script> <script src="lib/vue.min.js"></script>
<script src="lib/vue_sortable.js"></script> <script src="lib/vue_sortable.js"></script>
@ -85,7 +85,6 @@
?></div> ?></div>
<div style="display: none;"></div> <div style="display: none;"></div>
<div id="blackout" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"></div> <div id="blackout" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"></div>
<div class="dialog draggable" id="welcome_screen"> <div class="dialog draggable" id="welcome_screen">
@ -100,7 +99,6 @@
<div id="updater_content"></div> <div id="updater_content"></div>
<div class="progress_bar" id="update_bar"> <div class="progress_bar" id="update_bar">
<div class="progress_bar_inner"></div> <div class="progress_bar_inner"></div>
</div> </div>
@ -283,7 +281,7 @@
<h2 class="dialog_handle tl">dialog.scale.title</h2> <h2 class="dialog_handle tl">dialog.scale.title</h2>
<div class="dialog_bar narrow"> <div class="dialog_bar narrow">
<label for="file_folder" class="tl">dialog.scale.axis</label> <label class="tl">dialog.scale.axis</label>
</div> </div>
<div class="dialog_bar" style="height: 32px;"> <div class="dialog_bar" style="height: 32px;">
@ -296,7 +294,7 @@
</div> </div>
<div class="dialog_bar narrow"> <div class="dialog_bar narrow">
<label for="file_folder" class="tl">dialog.scale.scale</label> <label class="tl">dialog.scale.scale</label>
</div> </div>
<div class="dialog_bar" style="height: 32px;"> <div class="dialog_bar" style="height: 32px;">
@ -374,12 +372,12 @@
</div> </div>
<div class="dialog_bar"> <div class="dialog_bar">
<label class="name_space_left tl" for="selgen_new">dialog.select.name</label> <label class="name_space_left tl">dialog.select.name</label>
<input type="text" class="dark_bordered half" id="selgen_name"> <input type="text" class="dark_bordered half" id="selgen_name">
</div> </div>
<div class="dialog_bar"> <div class="dialog_bar">
<label class="name_space_left tl" for="selgen_new">dialog.select.random</label> <label class="name_space_left tl">dialog.select.random</label>
<input type="range" min="0" max="100" step="1" value="100" class="tool half" id="selgen_random"> <input type="range" min="0" max="100" step="1" value="100" class="tool half" id="selgen_random">
</div> </div>
@ -410,13 +408,13 @@
</div> </div>
<div class="dialog_bar" class="name_space_left block_mode_only"> <div class="dialog_bar" class="name_space_left block_mode_only">
<label for="project_description" class="name_space_left tl">dialog.project.ao</label> <label for="project_ambientocclusion" class="name_space_left tl">dialog.project.ao</label>
<input v-model="Project.ambientocclusion" type="checkbox" id="project_ambientocclusion"> <input v-model="Project.ambientocclusion" type="checkbox" id="project_ambientocclusion">
</div> </div>
<div class="dialog_bar narrow"> <div class="dialog_bar narrow">
<label for="project_description" class="tl">dialog.project.texture_size</label> <label class="tl">dialog.project.texture_size</label>
</div> </div>
<div class="dialog_bar"> <div class="dialog_bar">
<label for="project_texsize_x" class="inline_label tl">dialog.project.width</label> <label for="project_texsize_x" class="inline_label tl">dialog.project.width</label>
@ -783,8 +781,8 @@
v-bind:min="Math.abs(slot.translation[axis]) < 10 ? -20 : (slot.translation[axis] > 0 ? -70*3+10 : -80)" v-bind:min="Math.abs(slot.translation[axis]) < 10 ? -20 : (slot.translation[axis] > 0 ? -70*3+10 : -80)"
v-bind:max="Math.abs(slot.translation[axis]) < 10 ? 20 : (slot.translation[axis] < 0 ? 70*3-10 : 80)" v-bind:max="Math.abs(slot.translation[axis]) < 10 ? 20 : (slot.translation[axis] < 0 ? 70*3-10 : 80)"
v-bind:step="Math.abs(slot.translation[axis]) < 10 ? 0.25 : 1" v-bind:step="Math.abs(slot.translation[axis]) < 10 ? 0.25 : 1"
value="0" @input="change(axis, 'rotation')" @mousedown="start" @change="save"> value="0" @input="change(axis, 'translation')" @mousedown="start" @change="save">
<input type="number" class="tool disp_text" v-model.number="slot.translation[axis]" min="-80" max="80" step="0.5" value="0" @input="change(axis, 'rotation');save()" @mousedown="start"> <input type="number" class="tool disp_text" v-model.number="slot.translation[axis]" min="-80" max="80" step="0.5" value="0" @input="change(axis, 'translation');save()" @mousedown="start">
</div> </div>
<p class="tl">display.scale</p><div class="tool head_right" v-on:click="resetChannel('scale')"><i class="material-icons">replay</i></div> <p class="tl">display.scale</p><div class="tool head_right" v-on:click="resetChannel('scale')"><i class="material-icons">replay</i></div>

View File

@ -5,14 +5,6 @@
* @author WestLangley / http://github.com/WestLangley * @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com * @author erich666 / http://erichaines.com
*/ */
// This set of controls performs orbiting, dollying (zooming), and panning.
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
//
// Orbit - left mouse / touch: one finger move
// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
// Pan - right mouse, or arrow keys / touch: three finger swipe
THREE.OrbitControls = function ( object, preview ) { THREE.OrbitControls = function ( object, preview ) {
this.object = object; this.object = object;
@ -72,9 +64,7 @@ THREE.OrbitControls = function ( object, preview ) {
scope.object.updateProjectionMatrix(); scope.object.updateProjectionMatrix();
scope.dispatchEvent( changeEvent ); scope.dispatchEvent( changeEvent );
scope.update(); scope.update();
state = STATE.NONE; state = STATE.NONE;
}; };
@ -246,7 +236,6 @@ THREE.OrbitControls = function ( object, preview ) {
} }
function getZoomScale() { function getZoomScale() {
return Math.pow( 0.95, scope.zoomSpeed ); return Math.pow( 0.95, scope.zoomSpeed );
} }
@ -254,7 +243,6 @@ THREE.OrbitControls = function ( object, preview ) {
function rotateLeft( angle ) { function rotateLeft( angle ) {
sphericalDelta.theta -= angle; sphericalDelta.theta -= angle;
} }
function rotateUp( angle ) { function rotateUp( angle ) {
@ -358,15 +346,12 @@ THREE.OrbitControls = function ( object, preview ) {
function dollyOut( dollyScale ) { function dollyOut( dollyScale ) {
if ( scope.object instanceof THREE.PerspectiveCamera ) { if ( scope.object instanceof THREE.PerspectiveCamera ) {
scale *= dollyScale; scale *= dollyScale;
} else if ( scope.object instanceof THREE.OrthographicCamera ) { } else if ( scope.object instanceof THREE.OrthographicCamera ) {
scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) ); scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
scope.object.updateProjectionMatrix(); scope.object.updateProjectionMatrix();
zoomChanged = true; zoomChanged = true;
} else { } else {
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
@ -376,38 +361,21 @@ THREE.OrbitControls = function ( object, preview ) {
} }
//
// event callbacks - update the object state // event callbacks - update the object state
//
function handleMouseDownRotate( event ) { function handleMouseDownRotate( event ) {
//console.log( 'handleMouseDownRotate' );
rotateStart.set( event.clientX, event.clientY ); rotateStart.set( event.clientX, event.clientY );
} }
function handleMouseDownDolly( event ) { function handleMouseDownDolly( event ) {
//console.log( 'handleMouseDownDolly' );
dollyStart.set( event.clientX, event.clientY ); dollyStart.set( event.clientX, event.clientY );
} }
function handleMouseDownPan( event ) { function handleMouseDownPan( event ) {
//console.log( 'handleMouseDownPan' );
panStart.set( event.clientX, event.clientY ); panStart.set( event.clientX, event.clientY );
} }
function handleMouseMoveRotate( event ) { function handleMouseMoveRotate( event ) {
//console.log( 'handleMouseMoveRotate' );
rotateEnd.set( event.clientX, event.clientY ); rotateEnd.set( event.clientX, event.clientY );
rotateDelta.subVectors( rotateEnd, rotateStart ); rotateDelta.subVectors( rotateEnd, rotateStart );
@ -424,75 +392,48 @@ THREE.OrbitControls = function ( object, preview ) {
scope.update(); scope.update();
scope.updateSceneScale(); scope.updateSceneScale();
} }
function handleMouseMoveDolly( event ) { function handleMouseMoveDolly( event ) {
//console.log( 'handleMouseMoveDolly' );
dollyEnd.set( event.clientX, event.clientY ); dollyEnd.set( event.clientX, event.clientY );
dollyDelta.subVectors( dollyEnd, dollyStart ); dollyDelta.subVectors( dollyEnd, dollyStart );
if ( dollyDelta.y > 0 ) { if ( dollyDelta.y > 0 ) {
dollyIn( getZoomScale() ); dollyIn( getZoomScale() );
} else if ( dollyDelta.y < 0 ) { } else if ( dollyDelta.y < 0 ) {
dollyOut( getZoomScale() ); dollyOut( getZoomScale() );
} }
dollyStart.copy( dollyEnd ); dollyStart.copy( dollyEnd );
scope.update(); scope.update();
scope.updateSceneScale(); scope.updateSceneScale();
} }
function handleMouseMovePan( event ) { function handleMouseMovePan( event ) {
//console.log( 'handleMouseMovePan' );
panEnd.set( event.clientX, event.clientY ); panEnd.set( event.clientX, event.clientY );
panDelta.subVectors( panEnd, panStart ); panDelta.subVectors( panEnd, panStart );
pan( panDelta.x, panDelta.y ); pan( panDelta.x, panDelta.y );
panStart.copy( panEnd ); panStart.copy( panEnd );
scope.update(); scope.update();
scope.updateSceneScale(); scope.updateSceneScale();
} }
function handleMouseUp( event ) { function handleMouseUp( event ) {
// console.log( 'handleMouseUp' );
} }
function handleMouseWheel( event ) { function handleMouseWheel( event ) {
// console.log( 'handleMouseWheel' );
if ( event.deltaY < 0 ) { if ( event.deltaY < 0 ) {
dollyOut( getZoomScale() ); dollyOut( getZoomScale() );
} else if ( event.deltaY > 0 ) { } else if ( event.deltaY > 0 ) {
dollyIn( getZoomScale() ); dollyIn( getZoomScale() );
} }
scope.update(); scope.update();
scope.updateSceneScale(); scope.updateSceneScale();
} }
@ -522,23 +463,15 @@ THREE.OrbitControls = function ( object, preview ) {
pan( - scope.keyPanSpeed, 0 ); pan( - scope.keyPanSpeed, 0 );
scope.update(); scope.update();
break; break;
} }
} }
function handleTouchStartRotate( event ) { function handleTouchStartRotate( event ) {
//console.log( 'handleTouchStartRotate' );
rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
} }
function handleTouchStartDolly( event ) { function handleTouchStartDolly( event ) {
//console.log( 'handleTouchStartDolly' );
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
@ -549,17 +482,11 @@ THREE.OrbitControls = function ( object, preview ) {
} }
function handleTouchStartPan( event ) { function handleTouchStartPan( event ) {
//console.log( 'handleTouchStartPan' );
panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
} }
function handleTouchMoveRotate( event ) { function handleTouchMoveRotate( event ) {
//console.log( 'handleTouchMoveRotate' );
rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
rotateDelta.subVectors( rotateEnd, rotateStart ); rotateDelta.subVectors( rotateEnd, rotateStart );
@ -578,18 +505,13 @@ THREE.OrbitControls = function ( object, preview ) {
} }
function handleTouchMoveDolly( event ) { function handleTouchMoveDolly( event ) {
//console.log( 'handleTouchMoveDolly' );
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
var distance = Math.sqrt( dx * dx + dy * dy ); var distance = Math.sqrt( dx * dx + dy * dy );
dollyEnd.set( 0, distance ); dollyEnd.set( 0, distance );
dollyDelta.subVectors( dollyEnd, dollyStart ); dollyDelta.subVectors( dollyEnd, dollyStart );
if ( dollyDelta.y > 0 ) { if ( dollyDelta.y > 0 ) {
dollyOut( getZoomScale() ); dollyOut( getZoomScale() );
@ -608,8 +530,6 @@ THREE.OrbitControls = function ( object, preview ) {
function handleTouchMovePan( event ) { function handleTouchMovePan( event ) {
//console.log( 'handleTouchMovePan' );
panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
panDelta.subVectors( panEnd, panStart ); panDelta.subVectors( panEnd, panStart );
@ -622,95 +542,41 @@ THREE.OrbitControls = function ( object, preview ) {
} }
function handleTouchEnd( event ) {
//console.log( 'handleTouchEnd' );
}
// //
// event handlers - FSM: listen for events and reset state // event handlers - FSM: listen for events and reset state
// //
function onMouseDown( event ) { function onMouseDown( event ) {
if ( scope.isEnabled() === false ) return; if (scope.isEnabled() === false || Transformer.dragging) return;
event.preventDefault(); event.preventDefault();
scope.hasMoved = false scope.hasMoved = false
if ( Keybinds.extra.preview_rotate.keybind.isTriggered(event) ) { if ( Keybinds.extra.preview_rotate.keybind.isTriggered(event) ) {
if (/**/false/**/ && scope.object.isOrthographicCamera === true && scope.enablePan === true) {
handleMouseDownPan( event );
state = STATE.PAN;
} else {
if ( scope.enableRotate === false ) return; if ( scope.enableRotate === false ) return;
if (event.which === 1 && Canvas.raycast() && display_mode === false) { if (event.which === 1 && Canvas.raycast() && display_mode === false) {
return; return;
} }
handleMouseDownRotate( event ); handleMouseDownRotate( event );
state = STATE.ROTATE; state = STATE.ROTATE;
}
} else if ( Keybinds.extra.preview_drag.keybind.isTriggered(event) ) { } else if ( Keybinds.extra.preview_drag.keybind.isTriggered(event) ) {
if ( scope.enablePan === false ) return; if ( scope.enablePan === false ) return;
if (event.which === 1 && Canvas.raycast() && display_mode === false) { if (event.which === 1 && Canvas.raycast() && display_mode === false) {
return; return;
} }
handleMouseDownPan( event ); handleMouseDownPan( event );
state = STATE.PAN; state = STATE.PAN;
} }
/*
if ( event.button === scope.mouseButtons.ORBIT ) {
if ( scope.enableRotate === false ) return;
handleMouseDownRotate( event );
state = STATE.ROTATE;
} else if ( event.button === scope.mouseButtons.ZOOM ) {
if ( scope.enableZoom === false ) return;
handleMouseDownDolly( event );
state = STATE.DOLLY;
} else if ( event.button === scope.mouseButtons.PAN ) {
if ( scope.enablePan === false ) return;
handleMouseDownPan( event );
state = STATE.PAN;
}
*/
if ( state !== STATE.NONE ) { if ( state !== STATE.NONE ) {
document.addEventListener( 'mousemove', onMouseMove, false ); document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'mouseup', onMouseUp, false ); document.addEventListener( 'mouseup', onMouseUp, false );
scope.dispatchEvent( startEvent ); scope.dispatchEvent( startEvent );
} }
@ -719,32 +585,26 @@ THREE.OrbitControls = function ( object, preview ) {
function onMouseMove( event ) { function onMouseMove( event ) {
if ( scope.isEnabled() === false ) return; if (scope.isEnabled() === false || Transformer.dragging) return;
event.preventDefault(); event.preventDefault();
scope.hasMoved = true scope.hasMoved = true
if ( state === STATE.ROTATE ) { if ( state === STATE.ROTATE ) {
if ( scope.enableRotate === false ) return; if ( scope.enableRotate === false ) return;
handleMouseMoveRotate( event ); handleMouseMoveRotate( event );
} else if ( state === STATE.DOLLY ) { } else if ( state === STATE.DOLLY ) {
if ( scope.enableZoom === false ) return; if ( scope.enableZoom === false ) return;
handleMouseMoveDolly( event ); handleMouseMoveDolly( event );
} else if ( state === STATE.PAN ) { } else if ( state === STATE.PAN ) {
if ( scope.enablePan === false ) return; if ( scope.enablePan === false ) return;
handleMouseMovePan( event ); handleMouseMovePan( event );
} }
} }
function onMouseUp( event ) { function onMouseUp( event ) {
@ -755,9 +615,7 @@ THREE.OrbitControls = function ( object, preview ) {
document.removeEventListener( 'mousemove', onMouseMove, false ); document.removeEventListener( 'mousemove', onMouseMove, false );
document.removeEventListener( 'mouseup', onMouseUp, false ); document.removeEventListener( 'mouseup', onMouseUp, false );
scope.dispatchEvent( endEvent ); scope.dispatchEvent( endEvent );
state = STATE.NONE; state = STATE.NONE;
if (scope.hasMoved === false && settings.canvas_unselect.value) { if (scope.hasMoved === false && settings.canvas_unselect.value) {
@ -777,18 +635,12 @@ THREE.OrbitControls = function ( object, preview ) {
event.stopPropagation(); event.stopPropagation();
handleMouseWheel( event ); handleMouseWheel( event );
scope.dispatchEvent( startEvent ); // not sure why these are here...
scope.dispatchEvent( endEvent );
} }
function onKeyDown( event ) { function onKeyDown( event ) {
if ( scope.isEnabled() === false || scope.enableKeys === false || scope.enablePan === false ) return; if ( scope.isEnabled() === false || scope.enableKeys === false || scope.enablePan === false ) return;
handleKeyDown( event ); handleKeyDown( event );
} }
function onTouchStart( event ) { function onTouchStart( event ) {
@ -807,7 +659,6 @@ THREE.OrbitControls = function ( object, preview ) {
handleTouchStartRotate( event ); handleTouchStartRotate( event );
state = STATE.TOUCH_ROTATE; state = STATE.TOUCH_ROTATE;
} }
break; break;
case 2: // two-fingered touch: dolly case 2: // two-fingered touch: dolly
@ -827,11 +678,8 @@ THREE.OrbitControls = function ( object, preview ) {
handleTouchStartPan( event ); handleTouchStartPan( event );
state = STATE.TOUCH_PAN; state = STATE.TOUCH_PAN;
break; break;
default: default:
state = STATE.NONE; state = STATE.NONE;
} }
@ -868,7 +716,6 @@ THREE.OrbitControls = function ( object, preview ) {
break; break;
case 2: // two-fingered touch: dolly case 2: // two-fingered touch: dolly
if ( scope.enableZoom === false ) return; if ( scope.enableZoom === false ) return;
if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?... if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
@ -877,7 +724,6 @@ THREE.OrbitControls = function ( object, preview ) {
break; break;
case 3: // three-fingered touch: pan case 3: // three-fingered touch: pan
if ( scope.enablePan === false ) return; if ( scope.enablePan === false ) return;
if ( state !== STATE.TOUCH_PAN ) return; // is this needed?... if ( state !== STATE.TOUCH_PAN ) return; // is this needed?...
@ -886,174 +732,29 @@ THREE.OrbitControls = function ( object, preview ) {
break; break;
default: default:
state = STATE.NONE; state = STATE.NONE;
} }
} }
function onTouchEnd( event ) { function onTouchEnd( event ) {
if ( scope.isEnabled() === false ) return; if ( scope.isEnabled() === false ) return;
handleTouchEnd( event );
scope.dispatchEvent( endEvent ); scope.dispatchEvent( endEvent );
state = STATE.NONE; state = STATE.NONE;
} }
function onContextMenu( event ) {
event.preventDefault();
}
//
scope.domElement.addEventListener( 'contextmenu', onContextMenu, false );
scope.domElement.addEventListener( 'mousedown', onMouseDown, false ); scope.domElement.addEventListener( 'mousedown', onMouseDown, false );
scope.domElement.addEventListener( 'wheel', onMouseWheel, false ); scope.domElement.addEventListener( 'wheel', onMouseWheel, false );
scope.domElement.addEventListener( 'touchstart', onTouchStart, false ); scope.domElement.addEventListener( 'touchstart', onTouchStart, false );
scope.domElement.addEventListener( 'touchend', onTouchEnd, false ); scope.domElement.addEventListener( 'touchend', onTouchEnd, false );
scope.domElement.addEventListener( 'touchmove', onTouchMove, false ); scope.domElement.addEventListener( 'touchmove', onTouchMove, false );
window.addEventListener( 'keydown', onKeyDown, false ); window.addEventListener( 'keydown', onKeyDown, false );
// force an update at start
this.update(); this.update();
}; };
THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype ); THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
THREE.OrbitControls.prototype.constructor = THREE.OrbitControls; THREE.OrbitControls.prototype.constructor = THREE.OrbitControls;
Object.defineProperties( THREE.OrbitControls.prototype, {
center: {
get: function () {
console.warn( 'THREE.OrbitControls: .center has been renamed to .target' );
return this.target;
}
},
// backward compatibility
noZoom: {
get: function () {
console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
return ! this.enableZoom;
},
set: function ( value ) {
console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
this.enableZoom = ! value;
}
},
noRotate: {
get: function () {
console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
return ! this.enableRotate;
},
set: function ( value ) {
console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
this.enableRotate = ! value;
}
},
noPan: {
get: function () {
console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
return ! this.enablePan;
},
set: function ( value ) {
console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
this.enablePan = ! value;
}
},
noKeys: {
get: function () {
console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
return ! this.enableKeys;
},
set: function ( value ) {
console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
this.enableKeys = ! value;
}
},
staticMoving: {
get: function () {
console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
return ! this.enableDamping;
},
set: function ( value ) {
console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
this.enableDamping = ! value;
}
},
dynamicDampingFactor: {
get: function () {
console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
return this.dampingFactor;
},
set: function ( value ) {
console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
this.dampingFactor = value;
}
}
} );

View File

@ -707,7 +707,7 @@
object = display_area; object = display_area;
} else if (Blockbench.entity_mode && selected_group) { } else if (Blockbench.entity_mode && selected_group) {
if (Toolbox.selected.transformerMode !== 'scale' && selected_group.parent.type === 'group') { if (Toolbox.selected.transformerMode !== 'scale' && selected_group.parent.type === 'group') {
object = selected_group.parent.getMesh() object = selected_group.parent.mesh
} }
} }
if (scope.objects.length == 0 && !selected_group && !display_mode && !Animator.open) { if (scope.objects.length == 0 && !selected_group && !display_mode && !Animator.open) {
@ -791,12 +791,13 @@
this.setCanvas(domElement) this.setCanvas(domElement)
function onPointerHover( event ) { function onPointerHover( event ) {
if ( scope.objects.length === 0 || ( event.button !== undefined && event.button !== 0 ) ) return; if ( scope.objects.length === 0 || ( event.button !== undefined && event.button !== 0 ) ) return;
var pointer = event.changedTouches ? event.changedTouches[ 0 ] : event; var pointer = event.changedTouches ? event.changedTouches[ 0 ] : event;
var intersect = intersectObjects( pointer, _gizmo[ _mode ].pickers.children ); var intersect = intersectObjects( pointer, _gizmo[ _mode ].pickers.children );
if (intersect) { if (intersect) {
scope.dragging = true //scope.dragging = true
} }
if (_dragging === true) return; if (_dragging === true) return;
scope.hoverAxis = null; scope.hoverAxis = null;
@ -825,7 +826,7 @@
scope.dragging = true scope.dragging = true
Transformer.getWorldPosition(worldPosition) Transformer.getWorldPosition(worldPosition)
if (scope.camera.axis && (scope.hoverAxis.toLowerCase() === scope.camera.axis) === (_mode !== 'rotate')) return; if (scope.camera.axis && (scope.hoverAxis && scope.hoverAxis.toLowerCase() === scope.camera.axis) === (_mode !== 'rotate')) return;
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
scope.dispatchEvent( mouseDownEvent ); scope.dispatchEvent( mouseDownEvent );
@ -1061,17 +1062,18 @@
point.applyQuaternion(rotation.inverse()) point.applyQuaternion(rotation.inverse())
var channel = animation_channels[_mode] var channel = animation_channels[_mode]
if (channel === 'position') channel = 'translation' if (channel === 'position') channel = 'translation';
var value = (Toolbox.selected.id === 'rotate_tool') ? angle : point[axis] var value = point[axis]
if (channel === 'scale') { var bf = display[display_slot][channel][axisNumber] - (previousValue||0)
value = Math.round(value*64)/(64*8)
if (!scope.direction) value *= -1; if (channel === 'rotation') {
} else { value = Math.trimDeg(bf + Math.round(angle*4)/4) - bf;
value = Math.round(value*4)/4 } else if (channel === 'translation') {
} value = limitNumber( bf+Math.round(value*4)/4, -80, 80) - bf;
if (Toolbox.selected.id === 'rotate_tool') { } else /* scale */ {
value = Math.trimDeg(value) value = limitNumber( bf+Math.round(value*64)/(64*8)*(scope.direction ? 1 : -1), 0, 4) - bf;
} }
if (display_slot.includes('lefthand')) { if (display_slot.includes('lefthand')) {
if (channel === 'rotation' && axisNumber) { if (channel === 'rotation' && axisNumber) {
value *= -1 value *= -1
@ -1087,7 +1089,7 @@
var difference = value - (previousValue||0) var difference = value - (previousValue||0)
display[display_slot][channel][axisNumber] += difference display[display_slot][channel][axisNumber] += difference
if (event.shiftKey) { if (event.shiftKey && channel === 'scale') {
var val = display[display_slot][channel][axisNumber] var val = display[display_slot][channel][axisNumber]
display[display_slot][channel][(axisNumber+1)%3] = val display[display_slot][channel][(axisNumber+1)%3] = val
display[display_slot][channel][(axisNumber+2)%3] = val display[display_slot][channel][(axisNumber+2)%3] = val

View File

@ -1,4 +1,4 @@
var Toolbars, BarItems, MenuBar, open_menu, Toolbox; var Toolbars, BarItems, open_menu, Toolbox;
//Bars //Bars
class MenuSeparator { class MenuSeparator {
constructor() { constructor() {
@ -196,7 +196,6 @@ class Action extends BarItem {
} }
} }
} }
class Tool extends Action { class Tool extends Action {
constructor(data) { constructor(data) {
super(data) super(data)
@ -213,7 +212,7 @@ class Tool extends Action {
if (!this.condition) { if (!this.condition) {
this.condition = function() { this.condition = function() {
return scope.modes && scope.modes.includes(Modes.id) return !scope.modes || scope.modes.includes(Modes.id);
} }
} }
this.onCanvasClick = data.onCanvasClick; this.onCanvasClick = data.onCanvasClick;
@ -806,7 +805,7 @@ class Toolbar {
} }
} }
var BARS = { const BARS = {
stored: {}, stored: {},
editing_bar: undefined, editing_bar: undefined,
action_definers: [], action_definers: [],
@ -946,7 +945,7 @@ var BARS = {
category: 'file', category: 'file',
condition: () => isApp, condition: () => isApp,
click: function (e) { click: function (e) {
shell.showItemInFolder(app.app.getPath('userData')+osfs+'backups'+osfs+'.') shell.showItemInFolder(app.getPath('userData')+osfs+'backups'+osfs+'.')
} }
}) })
new Action({ new Action({
@ -1831,7 +1830,7 @@ class BarMenu extends Menu {
return this; return this;
} }
} }
var MenuBar = { const MenuBar = {
menues: {}, menues: {},
open: undefined, open: undefined,
setup: function() { setup: function() {
@ -2020,7 +2019,7 @@ var MenuBar = {
'_', '_',
'toggle_wireframe', 'toggle_wireframe',
'toggle_quad_view', 'toggle_quad_view',
{name: 'menu.view.screenshot', id: 'screenshot', condition: isApp, icon: 'camera_alt', children: [ {name: 'menu.view.screenshot', id: 'screenshot', icon: 'camera_alt', children: [
'screenshot_model', 'screenshot_model',
'screenshot_app', 'screenshot_app',
'record_model_gif', 'record_model_gif',
@ -2062,7 +2061,7 @@ var MenuBar = {
} }
} }
} }
var Keybinds = { const Keybinds = {
actions: [], actions: [],
stored: {}, stored: {},
extra: {}, extra: {},

View File

@ -177,7 +177,6 @@ class Animation {
delete delete
*/ */
]) ])
class BoneAnimator { class BoneAnimator {
constructor() { constructor() {
this.keyframes = [] this.keyframes = []
@ -237,13 +236,13 @@ class BoneAnimator {
} }
doRender() { doRender() {
this.getGroup() this.getGroup()
if (this.group && this.group.children && this.group.getMesh()) { if (this.group && this.group.children && this.group.mesh) {
let mesh = this.group.getMesh() let mesh = this.group.mesh
return (mesh && mesh.fix_rotation) return (mesh && mesh.fix_rotation)
} }
} }
displayRotation(arr) { displayRotation(arr) {
var bone = this.group.getMesh() var bone = this.group.mesh
bone.rotation.copy(bone.fix_rotation) bone.rotation.copy(bone.fix_rotation)
if (!arr) { if (!arr) {
@ -260,7 +259,7 @@ class BoneAnimator {
return this; return this;
} }
displayPosition(arr) { displayPosition(arr) {
var bone = this.group.getMesh() var bone = this.group.mesh
bone.position.copy(bone.fix_position) bone.position.copy(bone.fix_position)
if (arr) { if (arr) {
bone.position.add(new THREE.Vector3().fromArray(arr)) bone.position.add(new THREE.Vector3().fromArray(arr))
@ -268,7 +267,7 @@ class BoneAnimator {
return this; return this;
} }
displayScale(arr) { displayScale(arr) {
var bone = this.group.getMesh() var bone = this.group.mesh
if (arr) { if (arr) {
bone.scale.x = bone.scale.y = bone.scale.z = arr[0] ? arr[0] : 0.00001 bone.scale.x = bone.scale.y = bone.scale.z = arr[0] ? arr[0] : 0.00001
} else { } else {
@ -349,7 +348,7 @@ class BoneAnimator {
this.displayScale(result) this.displayScale(result)
} }
} }
this.group.getMesh().updateMatrixWorld() this.group.mesh.updateMatrixWorld()
} }
select() { select() {
var duplicates; var duplicates;
@ -591,6 +590,7 @@ class Keyframe {
if (this.parent) { if (this.parent) {
this.parent.keyframes.remove(this) this.parent.keyframes.remove(this)
} }
Timeline.selected.remove(this)
} }
extend(data) { extend(data) {
if (data.channel && Animator.possible_channels[data.channel]) { if (data.channel && Animator.possible_channels[data.channel]) {
@ -649,7 +649,6 @@ class Keyframe {
*/ */
]) ])
function updateKeyframeValue(obj) { function updateKeyframeValue(obj) {
var axis = $(obj).attr('axis') var axis = $(obj).attr('axis')
var value = $(obj).val() var value = $(obj).val()
@ -731,7 +730,6 @@ function removeSelectedKeyframes() {
Undo.finishEdit('remove keyframes') Undo.finishEdit('remove keyframes')
} }
const Animator = { const Animator = {
possible_channels: {rotation: true, position: true, scale: true}, possible_channels: {rotation: true, position: true, scale: true},
channel_index: ['rotation', 'position', 'scale'], channel_index: ['rotation', 'position', 'scale'],
@ -890,7 +888,6 @@ const Animator = {
animations: animations animations: animations
} }
} }
} }
const Timeline = { const Timeline = {
keyframes: [],//frames keyframes: [],//frames
@ -949,25 +946,26 @@ const Timeline = {
Animator.preview() Animator.preview()
} }
}) })
.mousemove(e => { $(document).mousemove(e => {
if (Timeline.dragging_marker) { if (Timeline.dragging_marker) {
let time = e.offsetX / Timeline.vue._data.size let offset = mouse_pos.x - $('#timeline_inner #timeline_time').offset().left
let time = offset / Timeline.vue._data.size
Timeline.setTime(time) Timeline.setTime(time)
if (Animator.selected) { Animator.preview()
Animator.preview()
}
} }
}) })
$(document).mouseup(e => { .mouseup(e => {
if (Timeline.dragging_marker) { if (Timeline.dragging_marker) {
delete Timeline.dragging_marker delete Timeline.dragging_marker
} }
}) })
//Keyframe inputs
$('.keyframe_input').click(e => { $('.keyframe_input').click(e => {
Undo.initEdit({keyframes: Timeline.selected, keep_saved: true}) Undo.initEdit({keyframes: Timeline.selected, keep_saved: true})
}).focusout(e => { }).focusout(e => {
Undo.finishEdit('edit keyframe') Undo.finishEdit('edit keyframe')
}) })
//Enter Time
$('#timeline_corner').click(e => { $('#timeline_corner').click(e => {
if ($('#timeline_corner').attr('contenteditable') == 'true') return; if ($('#timeline_corner').attr('contenteditable') == 'true') return;
@ -994,7 +992,6 @@ const Timeline = {
range.setEnd(node, sel[1]) range.setEnd(node, sel[1])
selection.removeAllRanges(); selection.removeAllRanges();
selection.addRange(range); selection.addRange(range);
}) })
.on('focusout keydown', e => { .on('focusout keydown', e => {
if (e.type === 'focusout' || Keybinds.extra.confirm.keybind.isTriggered(e) || Keybinds.extra.cancel.keybind.isTriggered(e)) { if (e.type === 'focusout' || Keybinds.extra.confirm.keybind.isTriggered(e) || Keybinds.extra.cancel.keybind.isTriggered(e)) {

View File

@ -172,10 +172,6 @@ class API {
} else { } else {
jq_dialog.css('width', limitNumber(options.buttons.length*170+44, 380, 894)+'px') jq_dialog.css('width', limitNumber(options.buttons.length*170+44, 380, 894)+'px')
} }
setTimeout(function() {
$('.context_handler.ctx').removeClass('ctx')
}, 64)
open_dialog = 'message_box' open_dialog = 'message_box'
open_interface = 'message_box' open_interface = 'message_box'
return jq_dialog return jq_dialog
@ -226,7 +222,7 @@ class API {
options.extensions = ['png', 'jpg', 'jpeg', 'bmp', 'tiff', 'tif', 'gif'] options.extensions = ['png', 'jpg', 'jpeg', 'bmp', 'tiff', 'tif', 'gif']
} }
app.dialog.showOpenDialog( electron.dialog.showOpenDialog(
currentwindow, currentwindow,
{ {
title: options.title ? options.title : '', title: options.title ? options.title : '',
@ -401,7 +397,7 @@ class API {
cb() cb()
} }
} else { } else {
app.dialog.showSaveDialog(currentwindow, { electron.dialog.showSaveDialog(currentwindow, {
filters: [ { filters: [ {
name: options.type, name: options.type,
extensions: options.extensions extensions: options.extensions
@ -517,7 +513,7 @@ class API {
delete this.drag_handlers[id] delete this.drag_handlers[id]
} }
} }
var Blockbench = new API() const Blockbench = new API()
function Dialog(settings) { function Dialog(settings) {
var scope = this; var scope = this;
@ -619,9 +615,6 @@ function Dialog(settings) {
if (this.width) { if (this.width) {
jq_dialog.css('width', this.width+'px') jq_dialog.css('width', this.width+'px')
} }
setTimeout(function() {
$('.context_handler.ctx').removeClass('ctx')
}, 64)
open_dialog = scope.id open_dialog = scope.id
open_interface = scope open_interface = scope
Prop.active_panel = 'dialog' Prop.active_panel = 'dialog'

View File

@ -1,22 +1,22 @@
var app = require('electron').remote, const electron = require('electron').remote;
fs = require('fs'), const {clipboard, shell, nativeImage} = require('electron');
nativeImage = require('electron').nativeImage, const app = electron.app;
exec = require('child_process').exec, const fs = require('fs');
originalFs = require('original-fs'), const zlib = require('zlib');
https = require('https'), const exec = require('child_process').exec;
currentwindow = app.getCurrentWindow(), const originalFs = require('original-fs');
dialog_win = null, const https = require('https');
const currentwindow = electron.getCurrentWindow();
var dialog_win = null,
latest_version = false, latest_version = false,
preventClosing = true; preventClosing = true;
recent_projects= undefined recent_projects= undefined;
const shell = require('electron').shell;
const {clipboard} = require('electron')
$(document).ready(function() { $(document).ready(function() {
if (app.process.argv.length >= 2) { if (electron.process.argv.length >= 2) {
if (app.process.argv[1].substr(-5) == '.json') { if (electron.process.argv[1].substr(-5) == '.json') {
readFile(app.process.argv[1], true) readFile(electron.process.argv[1], true)
} }
} }
$('.open-in-browser').click((event) => { $('.open-in-browser').click((event) => {
@ -24,8 +24,8 @@ $(document).ready(function() {
shell.openExternal(event.target.href); shell.openExternal(event.target.href);
return true; return true;
}); });
if (fs.existsSync(app.app.getPath('userData')+osfs+'backups') === false) { if (fs.existsSync(app.getPath('userData')+osfs+'backups') === false) {
fs.mkdirSync( app.app.getPath('userData')+osfs+'backups') fs.mkdirSync( app.getPath('userData')+osfs+'backups')
} }
createBackup(true) createBackup(true)
$('.web_only').remove() $('.web_only').remove()
@ -38,22 +38,22 @@ getLatestVersion(true)
//Called on start to show message //Called on start to show message
function getLatestVersion(init) { function getLatestVersion(init) {
if (process.platform == 'linux') return; if (process.platform == 'linux') return;
$.getJSON('https://blockbench.net/api/index.json', (data) => { $.getJSON('https://raw.githubusercontent.com/JannisX11/blockbench/master/package.json', (data) => {
if (data.version) { if (data.version) {
latest_version = data.version latest_version = data.version
if (compareVersions(latest_version, appVersion) && init === true) { if (compareVersions(latest_version, appVersion) && init === true) {
Blockbench.showMessageBox({ Blockbench.showMessageBox({
translateKey: 'update_notification', translateKey: 'update_notification',
message: tl('message.update_notification.message', [latest_version]), message: tl('message.update_notification.message', [latest_version]),
icon: 'update', icon: 'update',
buttons: [tl('message.update_notification.install'), tl('message.update_notification.later')], buttons: [tl('message.update_notification.install'), tl('message.update_notification.later')],
confirm: 0, cancel: 1 confirm: 0, cancel: 1
}, (result) => { }, (result) => {
if (result === 0) { if (result === 0) {
checkForUpdates(true) checkForUpdates(true)
} }
}) })
} else if (init === false) { } else if (init === false) {
checkForUpdates() checkForUpdates()
@ -209,7 +209,7 @@ function changeImageEditor(texture) {
}).show() }).show()
} }
function selectImageEditorFile(texture) { function selectImageEditorFile(texture) {
app.dialog.showOpenDialog(currentwindow, { electron.dialog.showOpenDialog(currentwindow, {
title: tl('message.image_editor.exe'), title: tl('message.image_editor.exe'),
filters: [{name: 'Executable Program', extensions: ['exe']}] filters: [{name: 'Executable Program', extensions: ['exe']}]
}, function(filePaths) { }, function(filePaths) {
@ -223,7 +223,7 @@ function selectImageEditorFile(texture) {
} }
//Default Pack //Default Pack
function openDefaultTexturePath() { function openDefaultTexturePath() {
var answer = app.dialog.showMessageBox(currentwindow, { var answer = electron.dialog.showMessageBox(currentwindow, {
type: 'info', type: 'info',
buttons: ( buttons: (
settings.default_path.value ? [tl('dialog.cancel'), tl('message.default_textures.continue'), tl('message.default_textures.remove')] settings.default_path.value ? [tl('dialog.cancel'), tl('message.default_textures.continue'), tl('message.default_textures.remove')]
@ -237,7 +237,7 @@ function openDefaultTexturePath() {
if (answer === 0) { if (answer === 0) {
return; return;
} else if (answer === 1) { } else if (answer === 1) {
app.dialog.showOpenDialog(currentwindow, { electron.dialog.showOpenDialog(currentwindow, {
title: tl('message.default_textures.select'), title: tl('message.default_textures.select'),
properties: ['openDirectory'], properties: ['openDirectory'],
}, function(filePaths) { }, function(filePaths) {
@ -406,7 +406,7 @@ function writeFileEntity(content, filepath) {
obj = JSON.parse(data.replace(/\/\*[^(\*\/)]*\*\/|\/\/.*/g, '')) obj = JSON.parse(data.replace(/\/\*[^(\*\/)]*\*\/|\/\/.*/g, ''))
} catch (err) { } catch (err) {
err = err+'' err = err+''
var answer = app.dialog.showMessageBox(currentwindow, { var answer = electron.dialog.showMessageBox(currentwindow, {
type: 'warning', type: 'warning',
buttons: [ buttons: [
tl('message.bedrock_overwrite_error.backup_overwrite'), tl('message.bedrock_overwrite_error.backup_overwrite'),
@ -461,7 +461,7 @@ function writeFileEntity(content, filepath) {
Blockbench.showQuickMessage('message.save_entity') Blockbench.showQuickMessage('message.save_entity')
Prop.project_saved = true; Prop.project_saved = true;
setProjectTitle(pathToName(filepath, false)) setProjectTitle(pathToName(filepath, false))
addRecentProject({name: pathToName(filepath, 'mobs_id'), path: filepath}) addRecentProject({name: pathToName(filepath, 'mobs_id'), path: filepath})
if (Blockbench.hasFlag('close_after_saving')) { if (Blockbench.hasFlag('close_after_saving')) {
closeBlockbenchWindow() closeBlockbenchWindow()
} }
@ -503,25 +503,25 @@ function writeFileObj(content, filepath) {
//Open //Open
function readFile(filepath, makeNew) { function readFile(filepath, makeNew) {
fs.readFile(filepath, 'utf-8', function (err, data) { fs.readFile(filepath, 'utf-8', function (err, data) {
if (err) { if (err) {
console.log(err) console.log(err)
Blockbench.showMessageBox({ Blockbench.showMessageBox({
translateKey: 'file_not_found', translateKey: 'file_not_found',
icon: 'error_outline' icon: 'error_outline'
}) })
return; return;
} }
addRecentProject({name: pathToName(filepath, 'mobs_id'), path: filepath}) addRecentProject({name: pathToName(filepath, 'mobs_id'), path: filepath})
loadModel(data, filepath, !makeNew) loadModel(data, filepath, !makeNew)
}) })
} }
//Backup //Backup
function createBackup(init) { function createBackup(init) {
setTimeout(createBackup, limitNumber(parseFloat(settings.backup_interval.value), 1, 10e8)*60000) setTimeout(createBackup, limitNumber(parseFloat(settings.backup_interval.value), 1, 10e8)*60000)
var duration = parseInt(settings.backup_retain.value)+1 var duration = parseInt(settings.backup_retain.value)+1
var folder_path = app.app.getPath('userData')+osfs+'backups' var folder_path = app.getPath('userData')+osfs+'backups'
var d = new Date() var d = new Date()
var days = d.getDate() + (d.getMonth()+1)*30.44 + (d.getYear()-100)*365.25 var days = d.getDate() + (d.getMonth()+1)*30.44 + (d.getYear()-100)*365.25
@ -598,7 +598,7 @@ function showSaveDialog(close) {
} }
}) })
if ((Prop.project_saved === false && elements.length > 0) || unsaved_textures) { if ((Prop.project_saved === false && elements.length > 0) || unsaved_textures) {
var answer = app.dialog.showMessageBox(currentwindow, { var answer = electron.dialog.showMessageBox(currentwindow, {
type: 'question', type: 'question',
buttons: [tl('dialog.save'), tl('dialog.discard'), tl('dialog.cancel')], buttons: [tl('dialog.save'), tl('dialog.discard'), tl('dialog.cancel')],
title: 'Blockbench', title: 'Blockbench',

View File

@ -34,8 +34,8 @@ const Project = {
texture_height : 16, texture_height : 16,
ambientocclusion: true, ambientocclusion: true,
} }
var mouse_pos = {x:0,y:0} const mouse_pos = {x:0,y:0}
var sort_collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'}); const sort_collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'});
$.ajaxSetup({ cache: false }); $.ajaxSetup({ cache: false });
@ -222,9 +222,9 @@ function setupVue() {
DisplayMode.slot.scale[2] = val; DisplayMode.slot.scale[2] = val;
} }
} else if (channel === 'translation') { } else if (channel === 'translation') {
DisplayMode.slot.translation[axis] = limitNumber(DisplayMode.slot.translation[axis], -80, 80) DisplayMode.slot.translation[axis] = limitNumber(DisplayMode.slot.translation[axis], -80, 80)||0;
} else { } else {
DisplayMode.slot.rotation[axis] = Math.trimDeg(DisplayMode.slot.rotation[axis]) DisplayMode.slot.rotation[axis] = Math.trimDeg(DisplayMode.slot.rotation[axis])||0;
} }
DisplayMode.updateDisplayBase() DisplayMode.updateDisplayBase()
}, },
@ -347,11 +347,11 @@ function updateSelection() {
} }
if (obj.selected === true) { if (obj.selected === true) {
if (Toolbox.selected.transformerMode !== 'hidden' && obj.visibility === true && (Toolbox.selected.transformerMode !== 'rotate' || !Blockbench.entity_mode)) { if (Toolbox.selected.transformerMode !== 'hidden' && obj.visibility === true && (Toolbox.selected.transformerMode !== 'rotate' || !Blockbench.entity_mode)) {
Transformer.attach(obj.getMesh()) Transformer.attach(obj.mesh)
} }
} }
if (obj.visibility) { if (obj.visibility) {
var mesh = obj.getMesh() var mesh = obj.mesh
if (mesh && mesh.outline) { if (mesh && mesh.outline) {
mesh.outline.visible = obj.selected mesh.outline.visible = obj.selected
} }
@ -375,10 +375,10 @@ function updateSelection() {
if (selected_group) { if (selected_group) {
$('.selection_only#options').css('visibility', 'visible') $('.selection_only#options').css('visibility', 'visible')
if (settings.origin_size.value > 0 && selected_group.visibility) { if (settings.origin_size.value > 0 && selected_group.visibility) {
selected_group.getMesh().add(rot_origin) selected_group.mesh.add(rot_origin)
} }
if (Toolbox.selected.transformerMode === 'rotate') { if (Toolbox.selected.transformerMode === 'rotate') {
Transformer.attach(selected_group.getMesh()) Transformer.attach(selected_group.mesh)
} }
} else { } else {
$('.selection_only#options').css('visibility', 'hidden') $('.selection_only#options').css('visibility', 'hidden')
@ -392,7 +392,7 @@ function updateSelection() {
} else { } else {
//Origin Helper //Origin Helper
if (selected.length === 1 && selected[0].visibility) { if (selected.length === 1 && selected[0].visibility) {
let mesh = selected[0].getMesh() let mesh = selected[0].mesh
if (mesh) { if (mesh) {
mesh.add(rot_origin) mesh.add(rot_origin)
} }
@ -416,7 +416,7 @@ function updateSelection() {
i++; i++;
} }
if (first_visible && typeof origin === 'object') { if (first_visible && typeof origin === 'object') {
let mesh = first_visible.getMesh() let mesh = first_visible.mesh
if (mesh) { if (mesh) {
mesh.add(rot_origin) mesh.add(rot_origin)
} }
@ -518,7 +518,6 @@ class Mode extends KeybindItem {
Modes.selected = this; Modes.selected = this;
updateInterface() updateInterface()
Canvas.updateRenderSides() Canvas.updateRenderSides()
resizeWindow()
if (BarItems[this.default_tool]) { if (BarItems[this.default_tool]) {
BarItems[this.default_tool].select() BarItems[this.default_tool].select()
} else { } else {
@ -577,12 +576,6 @@ BARS.defineActions(function() {
//Misc //Misc
var Screencam = { var Screencam = {
fullScreen: function(options, cb) { fullScreen: function(options, cb) {
setTimeout(function() {
$('.context_handler.ctx').removeClass('ctx')
$('.context_handler.ctx').removeClass('ctx')
$('.context_handler.ctx').removeClass('ctx')
$('.context_handler.ctx').removeClass('ctx')
}, 10)
setTimeout(function() { setTimeout(function() {
currentwindow.capturePage(function(screenshot) { currentwindow.capturePage(function(screenshot) {
var dataUrl = screenshot.toDataURL() var dataUrl = screenshot.toDataURL()
@ -621,7 +614,7 @@ var Screencam = {
cancel: 0 cancel: 0
}, function(result) { }, function(result) {
if (result === 1) { if (result === 1) {
app.dialog.showSaveDialog(currentwindow, {filters: [ {name: tl('data.image'), extensions: [is_gif ? 'gif' : 'png']} ]}, function (fileName) { electron.dialog.showSaveDialog(currentwindow, {filters: [ {name: tl('data.image'), extensions: [is_gif ? 'gif' : 'png']} ]}, function (fileName) {
if (fileName === undefined) { if (fileName === undefined) {
return; return;
} }
@ -788,8 +781,6 @@ var Clipbench = {
Vue.nextTick(Timeline.update) Vue.nextTick(Timeline.update)
} }
} }
} else if (p == 'uv' || p == 'preview') { } else if (p == 'uv' || p == 'preview') {
main_uv.paste(event) main_uv.paste(event)
} else if (p == 'textures' && isApp) { } else if (p == 'textures' && isApp) {
@ -808,6 +799,7 @@ var Clipbench = {
var group = 'root' var group = 'root'
if (selected_group) { if (selected_group) {
group = selected_group group = selected_group
selected_group.isOpen = true
} else if (selected[0]) { } else if (selected[0]) {
group = selected[0] group = selected[0]
} }
@ -826,6 +818,9 @@ var Clipbench = {
} catch (err) {} } catch (err) {}
} }
if (Clipbench.group) { if (Clipbench.group) {
if (typeof Clipbench.group.duplicate !== 'function') {
Clipbench.group = new Group(Clipbench.group)
}
Clipbench.group.duplicate(group) Clipbench.group.duplicate(group)
} else { } else {
Clipbench.cubes.forEach(function(obj) { Clipbench.cubes.forEach(function(obj) {
@ -988,15 +983,15 @@ var Vertexsnap = {
$('#preview').get(0).removeEventListener("mousemove", Vertexsnap.hoverCanvas) $('#preview').get(0).removeEventListener("mousemove", Vertexsnap.hoverCanvas)
$('#preview').get(0).addEventListener("mousemove", Vertexsnap.hoverCanvas) $('#preview').get(0).addEventListener("mousemove", Vertexsnap.hoverCanvas)
var o_vertices = cube.getMesh().geometry.vertices var o_vertices = cube.mesh.geometry.vertices
cube.getMesh().updateMatrixWorld() cube.mesh.updateMatrixWorld()
o_vertices.forEach(function(v, id) { o_vertices.forEach(function(v, id) {
var outline_color = '0x'+app_colors.accent.hex.replace('#', '') var outline_color = '0x'+app_colors.accent.hex.replace('#', '')
var mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({color: parseInt(outline_color)})) var mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({color: parseInt(outline_color)}))
var pos = mesh.position.copy(v) var pos = mesh.position.copy(v)
pos.applyMatrix4(cube.getMesh().matrixWorld) pos.applyMatrix4(cube.mesh.matrixWorld)
pos.addScalar(8) pos.addScalar(8)
mesh.rotation.copy(cube.getMesh().rotation) mesh.rotation.copy(cube.mesh.rotation)
mesh.cube = cube mesh.cube = cube
mesh.isVertex = true mesh.isVertex = true
mesh.vertex_id = id mesh.vertex_id = id
@ -1096,7 +1091,7 @@ var Vertexsnap = {
} }
Vertexsnap.cubes.forEach(function(obj) { Vertexsnap.cubes.forEach(function(obj) {
var q = obj.getMesh().getWorldQuaternion(new THREE.Quaternion()).inverse() var q = obj.mesh.getWorldQuaternion(new THREE.Quaternion()).inverse()
var cube_pos = new THREE.Vector3().copy(pos).applyQuaternion(q) var cube_pos = new THREE.Vector3().copy(pos).applyQuaternion(q)
for (i=0; i<3; i++) { for (i=0; i<3; i++) {
@ -1118,7 +1113,7 @@ var Vertexsnap = {
obj.origin[1] += cube_pos.getComponent(1) obj.origin[1] += cube_pos.getComponent(1)
obj.origin[2] += cube_pos.getComponent(2) obj.origin[2] += cube_pos.getComponent(2)
} else { } else {
var q = obj.getMesh().getWorldQuaternion(new THREE.Quaternion()).inverse() var q = obj.mesh.getWorldQuaternion(new THREE.Quaternion()).inverse()
cube_pos.applyQuaternion(q) cube_pos.applyQuaternion(q)
} }
obj.from[0] += cube_pos.getComponent(0) obj.from[0] += cube_pos.getComponent(0)

View File

@ -5,7 +5,6 @@ var ground_animation = false;
var ground_timer = 0 var ground_timer = 0
var display_slot; var display_slot;
var display_preview; var display_preview;
var display_clipboard;
var enterDisplaySettings, exitDisplaySettings; var enterDisplaySettings, exitDisplaySettings;
const DisplayMode = {}; const DisplayMode = {};
@ -13,11 +12,15 @@ const DisplayMode = {};
class DisplaySlot { class DisplaySlot {
constructor(id, data) { constructor(id, data) {
this.default()
if (data) this.extend(data)
}
default() {
this.rotation = [0, 0, 0]; this.rotation = [0, 0, 0];
this.translation = [0, 0, 0]; this.translation = [0, 0, 0];
this.scale = [1, 1, 1]; this.scale = [1, 1, 1];
this.mirror = [false, false, false] this.mirror = [false, false, false]
if (data) this.extend(data) return this;
} }
copy() { copy() {
return { return {
@ -56,7 +59,7 @@ class DisplaySlot {
return this; return this;
} }
update() { update() {
if (this === DisplayMode.slot) { if (display_mode && this === DisplayMode.slot) {
DisplayMode.vue.$forceUpdate() DisplayMode.vue.$forceUpdate()
DisplayMode.updateDisplayBase() DisplayMode.updateDisplayBase()
} }
@ -1251,18 +1254,19 @@ window.displayReferenceObjects = {
'thirdperson_righthand', 'thirdperson_righthand',
'thirdperson_lefthand', 'thirdperson_lefthand',
'firstperson_righthand', 'firstperson_righthand',
'firstperson_righthand', 'firstperson_lefthand',
'ground', 'ground',
'gui', 'gui',
'head', 'head',
'fixed', 'fixed',
] ]
} }
DisplayMode.slots = displayReferenceObjects.slots
enterDisplaySettings = function() { //Enterung Display Setting Mode, changes the scene etc enterDisplaySettings = function() { //Enterung Display Setting Mode, changes the scene etc
display_mode = true; display_mode = true;
selected = [] selected.empty()
updateSelection() updateSelection()
if (!display_preview) { if (!display_preview) {
@ -1280,14 +1284,13 @@ enterDisplaySettings = function() { //Enterung Display Setting Mode, changes th
$('.m_edit').hide() $('.m_edit').hide()
$('.m_disp').show() $('.m_disp').show()
$('#display_bar input#thirdperson_righthand').prop("checked", true) $('#display_bar input#thirdperson_righthand').prop("checked", true)
updateInterface()
buildGrid() buildGrid()
setShading() setShading()
DisplayMode.loadThirdRight() DisplayMode.loadThirdRight()
Canvas.updateRenderSides() Canvas.updateRenderSides()
resizeWindow()
display_area.updateMatrixWorld() display_area.updateMatrixWorld()
display_base.updateMatrixWorld() display_base.updateMatrixWorld()
DisplayMode.centerTransformer() DisplayMode.centerTransformer()
@ -1388,7 +1391,10 @@ DisplayMode.applyPreset = function(preset, all) {
}; };
Undo.initEdit({display_slots: slots}) Undo.initEdit({display_slots: slots})
slots.forEach(function(sl) { slots.forEach(function(sl) {
DisplayMode.slot.extend(preset.areas[sl]) if (!display[sl]) {
display[sl] = new DisplaySlot()
}
display[sl].extend(preset.areas[sl])
}) })
DisplayMode.updateDisplayBase() DisplayMode.updateDisplayBase()
Undo.finishEdit('apply display preset') Undo.finishEdit('apply display preset')
@ -1420,7 +1426,6 @@ DisplayMode.loadJSON = function(data) {
} }
} }
var setDisplayArea = DisplayMode.setBase = function(x, y, z, rx, ry, rz, sx, sy, sz) {//Sets the Work Area to the given Space var setDisplayArea = DisplayMode.setBase = function(x, y, z, rx, ry, rz, sx, sy, sz) {//Sets the Work Area to the given Space
display_area.rotation['x'] = Math.PI / (180 / rx); display_area.rotation['x'] = Math.PI / (180 / rx);
display_area.rotation['y'] = Math.PI / (180 / ry); display_area.rotation['y'] = Math.PI / (180 / ry);
@ -1464,7 +1469,6 @@ function loadDisp(key) { //Loads The Menu and slider values, common for all Radi
DisplayMode.vue._data.slot = display[key] DisplayMode.vue._data.slot = display[key]
DisplayMode.slot = display[key] DisplayMode.slot = display[key]
DisplayMode.updateDisplayBase() DisplayMode.updateDisplayBase()
DisplayMode.centerTransformer()
} }
DisplayMode.loadThirdRight = function() { //Loader DisplayMode.loadThirdRight = function() { //Loader
@ -1551,11 +1555,11 @@ DisplayMode.load = function(slot) {
} }
DisplayMode.copy = function() { DisplayMode.copy = function() {
display_clipboard = DisplayMode.slot.copy() Clipbench.display_slot = DisplayMode.slot.copy()
} }
DisplayMode.paste = function() { DisplayMode.paste = function() {
Undo.initEdit({display_slots: [display_slot]}) Undo.initEdit({display_slots: [display_slot]})
DisplayMode.slot.extend(display_clipboard) DisplayMode.slot.extend(Clipbench.display_slot)
DisplayMode.updateDisplayBase() DisplayMode.updateDisplayBase()
Undo.finishEdit('paste display slot') Undo.finishEdit('paste display slot')
} }

View File

@ -40,9 +40,11 @@ var OutlinerButtons = {
}, },
shading: { shading: {
id: 'shading', id: 'shading',
title: tl('switches.shading'), get title() {return Blockbench.entity_mode ? tl('switches.mirror') : tl('switches.shading')},
icon: ' fa fa-star', get icon() {return Blockbench.entity_mode ? 'fa fa-star' : 'fa fa-star'},
icon_off: ' fa fa-star-o', get icon_off() {return Blockbench.entity_mode ? 'fa fa-star-half-o' : 'fa fa-star-o'},
//icon: ' fa fa-star',
//icon_off: ' fa fa-star-o',
advanced_option: true, advanced_option: true,
click: function(obj) { click: function(obj) {
obj.toggle('shade') obj.toggle('shade')
@ -346,7 +348,7 @@ class Cube extends OutlinerElement {
if (!this.parent || (this.parent === 'root' && TreeElements.indexOf(this) === -1)) { if (!this.parent || (this.parent === 'root' && TreeElements.indexOf(this) === -1)) {
this.addTo() this.addTo()
} }
if (this.visibility && (!this.getMesh() || !scene.children.includes(this.getMesh()))) { if (this.visibility && (!this.mesh || !scene.children.includes(this.mesh))) {
Canvas.addCube(this) Canvas.addCube(this)
} }
if (update !== false) { if (update !== false) {
@ -385,9 +387,12 @@ class Cube extends OutlinerElement {
return this.rotation_axis; return this.rotation_axis;
} }
getMesh() { getMesh() {
return Canvas.meshes[this.uuid] return this.mesh;
} }
index() { get mesh() {
return Canvas.meshes[this.uuid];
}
get index() {
return elements.indexOf(this) return elements.indexOf(this)
} }
select(event, isOutlinerClick) { select(event, isOutlinerClick) {
@ -539,7 +544,7 @@ class Cube extends OutlinerElement {
remove(update) { remove(update) {
TreeElements.clearObjectRecursive(this) TreeElements.clearObjectRecursive(this)
if (this.visibility) { if (this.visibility) {
var mesh = this.getMesh() var mesh = this.mesh
if (mesh) { if (mesh) {
if (mesh.parent) { if (mesh.parent) {
mesh.parent.remove(mesh) mesh.parent.remove(mesh)
@ -552,7 +557,7 @@ class Cube extends OutlinerElement {
if (selected.includes(this)) { if (selected.includes(this)) {
selected.splice(selected.indexOf(this), 1) selected.splice(selected.indexOf(this), 1)
} }
elements.splice(this.index(), 1) elements.splice(this.index, 1)
if (Transformer.dragging) { if (Transformer.dragging) {
outlines.remove(outlines.getObjectByName(this.uuid+'_ghost_outline')) outlines.remove(outlines.getObjectByName(this.uuid+'_ghost_outline'))
} }
@ -1049,6 +1054,9 @@ class Group extends OutlinerElement {
} }
} }
getMesh() { getMesh() {
return this.mesh;
}
get mesh() {
var bone = Canvas.bones[this.uuid] var bone = Canvas.bones[this.uuid]
if (!bone) { if (!bone) {
bone = new THREE.Object3D() bone = new THREE.Object3D()
@ -1289,9 +1297,11 @@ class Group extends OutlinerElement {
} else if (destination !== 'cache') { } else if (destination !== 'cache') {
base_group.addTo(destination, false) base_group.addTo(destination, false)
} }
base_group.createUniqueName() if (destination !== 'cache') {
Canvas.updatePositions() base_group.createUniqueName()
loadOutlinerDraggable() Canvas.updatePositions()
loadOutlinerDraggable()
}
return base_group; return base_group;
} }
getChildlessCopy() { getChildlessCopy() {
@ -1424,8 +1434,7 @@ Array.prototype.clearObjectRecursive = function(obj) {
Array.prototype.findRecursive = function(key1, val) { Array.prototype.findRecursive = function(key1, val) {
var i = 0 var i = 0
while (i < this.length) { while (i < this.length) {
let tag = this[i][key1] if (this[i][key1] === val) {
if (tag === val) {
return this[i]; return this[i];
} else if (this[i].children && this[i].children.length > 0) { } else if (this[i].children && this[i].children.length > 0) {
let inner = this[i].children.findRecursive(key1, val) let inner = this[i].children.findRecursive(key1, val)
@ -1854,7 +1863,7 @@ function renameCubes(element) {
Blockbench.textPrompt(tl('message.rename_cubes'), selected[0].name, function (name) { Blockbench.textPrompt(tl('message.rename_cubes'), selected[0].name, function (name) {
Undo.initEdit({cubes: selected}) Undo.initEdit({cubes: selected})
selected.forEach(function(obj, i) { selected.forEach(function(obj, i) {
obj.name = name.split('%').join(obj.index()).split('$').join(i) obj.name = name.replace(/%/g, obj.index).replace(/\$/g, i)
}) })
Undo.finishEdit('rename') Undo.finishEdit('rename')
}) })
@ -1915,6 +1924,7 @@ BARS.defineActions(function() {
id: 'add_group', id: 'add_group',
icon: 'create_new_folder', icon: 'create_new_folder',
category: 'edit', category: 'edit',
condition: () => !Animator.open,
keybind: new Keybind({key: 71, ctrl: true}), keybind: new Keybind({key: 71, ctrl: true}),
click: function () { click: function () {
addGroup(); addGroup();

View File

@ -166,7 +166,7 @@ var Interface = {
right_bar_width: 300, right_bar_width: 300,
quad_view_x: 50, quad_view_x: 50,
quad_view_y: 50, quad_view_y: 50,
left_bar: ['uv', 'textures', 'display'], left_bar: ['uv', 'textures', 'display', 'animations', 'keyframe', 'variable_placeholders'],
right_bar: ['options', 'outliner'] right_bar: ['options', 'outliner']
}, },
Resizers: { Resizers: {
@ -397,9 +397,6 @@ function setupInterface() {
unselectTextures() unselectTextures()
}) })
$(document).mousedown(function(event) { $(document).mousedown(function(event) {
if ($('.ctx').find(event.target).length === 0) {
$('.context_handler.ctx').removeClass('ctx')
}
if (open_menu && $('.contextMenu').find(event.target).length === 0 && $('.menu_bar_point.opened:hover').length === 0) { if (open_menu && $('.contextMenu').find(event.target).length === 0 && $('.menu_bar_point.opened:hover').length === 0) {
open_menu.hide(); open_menu.hide();
} }
@ -472,20 +469,26 @@ function updateInterface() {
BARS.updateConditions() BARS.updateConditions()
MenuBar.update() MenuBar.update()
resizeWindow() resizeWindow()
resizeWindow()
localStorage.setItem('interface_data', JSON.stringify(Interface.data)) localStorage.setItem('interface_data', JSON.stringify(Interface.data))
} }
function updateInterfacePanels() { function updateInterfacePanels() {
var left_width = $('.sidebar#left_bar > .panel:visible').length ? Interface.data.left_bar_width : 0
var right_width = $('.sidebar#right_bar > .panel:visible').length ? Interface.data.right_bar_width : 0
$('body').css( $('body').css(
'grid-template-columns', 'grid-template-columns',
left_width+'px auto '+ right_width +'px' Interface.data.left_bar_width+'px auto '+ Interface.data.right_bar_width +'px'
) )
for (var key in Interface.Panels) { for (var key in Interface.Panels) {
var panel = Interface.Panels[key] var panel = Interface.Panels[key]
panel.update() panel.update()
} }
var left_width = $('.sidebar#left_bar > .panel:visible').length ? Interface.data.left_bar_width : 0
var right_width = $('.sidebar#right_bar > .panel:visible').length ? Interface.data.right_bar_width : 0
if (!left_width || !right_width) {
$('body').css(
'grid-template-columns',
left_width+'px auto '+ right_width +'px'
)
}
$('.quad_canvas_wrapper.qcw_x').css('width', Interface.data.quad_view_x+'%') $('.quad_canvas_wrapper.qcw_x').css('width', Interface.data.quad_view_x+'%')
$('.quad_canvas_wrapper.qcw_y').css('height', Interface.data.quad_view_y+'%') $('.quad_canvas_wrapper.qcw_y').css('height', Interface.data.quad_view_y+'%')
$('.quad_canvas_wrapper:not(.qcw_x)').css('width', (100-Interface.data.quad_view_x)+'%') $('.quad_canvas_wrapper:not(.qcw_x)').css('width', (100-Interface.data.quad_view_x)+'%')
@ -496,6 +499,26 @@ function updateInterfacePanels() {
} }
} }
function resizeWindow(event) {
if (!previews || (event && event.target && event.target !== window)) {
return;
}
if (Animator.open) {
Timeline.updateSize()
}
if (Interface.data) {
updateInterfacePanels()
}
previews.forEach(function(prev) {
if (prev.canvas.isConnected) {
prev.resize()
}
})
BARS.updateToolToolbar()
}
$(window).resize(resizeWindow)
function setActivePanel(panel) { function setActivePanel(panel) {
Prop.active_panel = panel Prop.active_panel = panel
} }
@ -524,9 +547,6 @@ function showDialog(dialog) {
$('.dialog').hide(0) $('.dialog').hide(0)
$('#blackout').fadeIn(200) $('#blackout').fadeIn(200)
obj.fadeIn(200) obj.fadeIn(200)
setTimeout(function() {
$('.context_handler.ctx').removeClass('ctx')
}, 64)
open_dialog = dialog open_dialog = dialog
open_interface = dialog open_interface = dialog
Prop.active_panel = 'dialog' Prop.active_panel = 'dialog'

View File

@ -869,7 +869,7 @@ function buildBlockModel(options) {
if (s.export == false) return; if (s.export == false) return;
//Create Element //Create Element
var element = {} var element = {}
element_index_lut[s.index()] = clear_elements.length element_index_lut[s.index] = clear_elements.length
if ((options.cube_name !== false && !settings.minifiedout.value) || options.cube_name === true) { if ((options.cube_name !== false && !settings.minifiedout.value) || options.cube_name === true) {
if (s.name !== 'cube') { if (s.name !== 'cube') {
@ -1036,11 +1036,14 @@ function buildBlockModel(options) {
if (checkExport('display', Object.keys(display).length >= 1)) { if (checkExport('display', Object.keys(display).length >= 1)) {
var new_display = {} var new_display = {}
var entries = 0; var entries = 0;
for (var key in display) { for (var i in DisplayMode.slots) {
var slot = display[key].export() var key = DisplayMode.slots[i]
if (slot) { if (DisplayMode.slots.hasOwnProperty(i) && display[key]) {
new_display[key] = display[key].export() var slot = display[key].export()
entries++; if (slot) {
new_display[key] = display[key].export()
entries++;
}
} }
} }
if (entries) { if (entries) {
@ -1122,7 +1125,7 @@ function buildEntityModel(options) {
cube.mirror = !s.shade cube.mirror = !s.shade
} }
//Visible Bounds //Visible Bounds
var mesh = s.getMesh() var mesh = s.mesh
if (mesh) { if (mesh) {
visible_box.expandByObject(mesh) visible_box.expandByObject(mesh)
} }
@ -1583,8 +1586,9 @@ BARS.defineActions(function() {
category: 'file', category: 'file',
keybind: new Keybind({key: 78, ctrl: true, shift: true}), keybind: new Keybind({key: 78, ctrl: true, shift: true}),
click: function () { click: function () {
newProject(true); if (newProject(true)) {
showDialog('project_settings'); showDialog('project_settings');
}
} }
}) })
//Import //Import

View File

@ -1,4 +1,3 @@
class Keybind { class Keybind {
constructor(keys) { constructor(keys) {
this.key = -1; this.key = -1;
@ -166,8 +165,6 @@ class Keybind {
} }
} }
function setupKeybindings() { function setupKeybindings() {
Keybinds.vue = new Vue({ Keybinds.vue = new Vue({
el: 'ul#keybindlist', el: 'ul#keybindlist',
@ -215,7 +212,6 @@ function setupKeybindings() {
}) })
} }
$(document).keydown(function(e) { $(document).keydown(function(e) {
if (Keybinds.recording) return; if (Keybinds.recording) return;
//Shift //Shift
@ -243,7 +239,7 @@ $(document).keydown(function(e) {
} }
//Hardcoded Keys //Hardcoded Keys
if (e.ctrlKey === true && e.which == 73 && isApp) { if (e.ctrlKey === true && e.which == 73 && isApp) {
app.getCurrentWindow().toggleDevTools() electron.getCurrentWindow().toggleDevTools()
used = true used = true
} else if (e.which === 18 && Toolbox.selected.alt_tool && !Toolbox.original) { } else if (e.which === 18 && Toolbox.selected.alt_tool && !Toolbox.original) {
//Alt Tool //Alt Tool
@ -253,6 +249,8 @@ $(document).keydown(function(e) {
alt.select() alt.select()
Toolbox.original = orig Toolbox.original = orig
} }
} else if (Keybinds.extra.cancel.keybind.isTriggered(e) && (Transformer.dragging/* || ...*/)) {
Undo.cancelEdit()
} }
//Keybinds //Keybinds
if (!input_focus) { if (!input_focus) {
@ -303,4 +301,4 @@ $(document).keyup(function(e) {
Toolbox.original.select() Toolbox.original.select()
delete Toolbox.original; delete Toolbox.original;
} }
}); })

View File

@ -63,7 +63,7 @@ function loadLanguage() {
dataType: "json", dataType: "json",
url: 'lang/'+Language.code+'.json', url: 'lang/'+Language.code+'.json',
//data: data, //data: data,
async: false, //async: false,
success: function(data) { success: function(data) {
Language.data = data Language.data = data
translateUI() translateUI()

View File

@ -3,8 +3,8 @@ Plugin Loader for Blockbench
By JannisX11 By JannisX11
*/ */
var onUninstall, onInstall; var onUninstall, onInstall;
var Plugins = { const Plugins = {
apipath: 'https://blockbench.net/api/plugins.json', apipath: 'https://raw.githubusercontent.com/JannisX11/blockbench-plugins/master/plugins.json',
Vue: [], //Vue Object Vue: [], //Vue Object
installed: [], //Simple List of Names installed: [], //Simple List of Names
json: undefined, //Json from website json: undefined, //Json from website
@ -27,16 +27,14 @@ var Plugins = {
} }
if (isApp) { if (isApp) {
Plugins.path = app.app.getPath('userData')+osfs+'plugins'+osfs Plugins.path = app.getPath('userData')+osfs+'plugins'+osfs
fs.readdir(Plugins.path, function(err) { fs.readdir(Plugins.path, function(err) {
if (err) { if (err) {
fs.mkdir(Plugins.path, function(a) {}) fs.mkdir(Plugins.path, function(a) {})
} }
}) })
} else {
Plugins.apipath = '../api/plugins.json'
} }
$.getJSON('https://blockbench.net/api/plugins.json', function(data) { $.getJSON(Plugins.apipath, function(data) {
Plugins.json = data Plugins.json = data
if (Plugins.loadingStep === true) { if (Plugins.loadingStep === true) {
loadInstalledPlugins() loadInstalledPlugins()
@ -217,7 +215,7 @@ function loadPlugin(id, cb, install) {
saveInstalledPlugins() saveInstalledPlugins()
}) })
} else { } else {
$.getScript('https://blockbench.net/api/plugins/'+id+'.js', function() { $.getScript('https://raw.githubusercontent.com/JannisX11/blockbench-plugins/master/plugins/'+id+'.js', function() {
if (onUninstall) { if (onUninstall) {
Plugins.data.findInArray('id', id).uninstall = onUninstall Plugins.data.findInArray('id', id).uninstall = onUninstall
onUninstall = undefined onUninstall = undefined
@ -305,7 +303,7 @@ function downloadPlugin(id, is_install) {
//$('.uc_btn').attr('disabled', true) //$('.uc_btn').attr('disabled', true)
var file = originalFs.createWriteStream(Plugins.path+id+'.js') var file = originalFs.createWriteStream(Plugins.path+id+'.js')
var request = https.get('https://blockbench.net/api/plugins/'+id+'.js', function(response) { var request = https.get('https://raw.githubusercontent.com/JannisX11/blockbench-plugins/master/plugins/'+id+'.js', function(response) {
response.pipe(file); response.pipe(file);
response.on('end', function() { response.on('end', function() {
setTimeout(function() { setTimeout(function() {

View File

@ -445,7 +445,7 @@ class Preview {
if ((event.shiftKey || event.ctrlKey) && scope.selection.old_selected.indexOf(cube) >= 0) { if ((event.shiftKey || event.ctrlKey) && scope.selection.old_selected.indexOf(cube) >= 0) {
var isSelected = true var isSelected = true
} else { } else {
var mesh = cube.getMesh() var mesh = cube.mesh
var from = new THREE.Vector3().copy(mesh.geometry.vertices[6]).applyMatrix4(mesh.matrixWorld) var from = new THREE.Vector3().copy(mesh.geometry.vertices[6]).applyMatrix4(mesh.matrixWorld)
var to = new THREE.Vector3().copy(mesh.geometry.vertices[0]).applyMatrix4(mesh.matrixWorld) var to = new THREE.Vector3().copy(mesh.geometry.vertices[0]).applyMatrix4(mesh.matrixWorld)
var cube_rect = getRectangle( var cube_rect = getRectangle(
@ -592,7 +592,7 @@ class Preview {
edit(rot_origin) edit(rot_origin)
edit(Vertexsnap.vertexes) edit(Vertexsnap.vertexes)
selected.forEach(function(obj) { selected.forEach(function(obj) {
var m = obj.getMesh() var m = obj.mesh
if (m && m.outline) { if (m && m.outline) {
edit(m.outline) edit(m.outline)
} }
@ -643,8 +643,15 @@ class Preview {
var wrapper = $('<div class="single_canvas_wrapper"></div>') var wrapper = $('<div class="single_canvas_wrapper"></div>')
wrapper.append(this.canvas) wrapper.append(this.canvas)
$('#preview').append(wrapper) $('#preview').append(wrapper)
resizeWindow() previews.forEach(function(prev) {
if (prev.canvas.isConnected) {
prev.resize()
}
})
if (Interface.data) {
updateInterfacePanels()
}
return this; return this;
} }
toggleFullscreen() { toggleFullscreen() {
@ -940,25 +947,6 @@ function animate() {
DisplayMode.groundAnimation() DisplayMode.groundAnimation()
} }
} }
function resizeWindow(event) {
if (!previews || (event && event.target && event.target !== window)) {
return;
}
previews.forEach(function(prev) {
if (prev.canvas.isConnected) {
prev.resize()
}
})
if (Interface.data) {
updateInterfacePanels()
}
if (Animator.open) {
Timeline.updateSize()
}
BARS.updateToolToolbar()
}
$(window).resize(resizeWindow)
function setShading() { function setShading() {
scene.remove(lights) scene.remove(lights)
@ -1093,7 +1081,7 @@ function centerTransformer(offset) {
var rotate_tool = Toolbox.selected.transformerMode === 'rotate' var rotate_tool = Toolbox.selected.transformerMode === 'rotate'
if (Animator.open && selected_group) { if (Animator.open && selected_group) {
var g_mesh = selected_group.getMesh() var g_mesh = selected_group.mesh
g_mesh.getWorldPosition(Transformer.position) g_mesh.getWorldPosition(Transformer.position)
Transformer.position.x += 8; Transformer.position.x += 8;
@ -1120,7 +1108,7 @@ function centerTransformer(offset) {
var center = [0, 0, 0] var center = [0, 0, 0]
var i = 0; var i = 0;
selected.forEach(function(obj) { selected.forEach(function(obj) {
var m = obj.getMesh() var m = obj.mesh
if (obj.visibility && m) { if (obj.visibility && m) {
var pos = new THREE.Vector3( var pos = new THREE.Vector3(
obj.from[0] + obj.size(0)/2, obj.from[0] + obj.size(0)/2,
@ -1176,7 +1164,7 @@ function centerTransformer(offset) {
Transformer.rotation.set(0, 0, 0) Transformer.rotation.set(0, 0, 0)
Transformer.position.copy(vec) Transformer.position.copy(vec)
var mesh = first_obj.getMesh() var mesh = first_obj.mesh
if (mesh && Blockbench.globalMovement === false && !rotate_tool) { if (mesh && Blockbench.globalMovement === false && !rotate_tool) {
Transformer.rotation.copy(mesh.rotation) Transformer.rotation.copy(mesh.rotation)
} }
@ -1184,7 +1172,7 @@ function centerTransformer(offset) {
//Entity Mode //Entity Mode
if (selected_group && rotate_tool) { if (selected_group && rotate_tool) {
var mesh = selected_group.getMesh() var mesh = selected_group.mesh
if (mesh) { if (mesh) {
mesh.getWorldPosition(Transformer.position) mesh.getWorldPosition(Transformer.position)
} }
@ -1215,7 +1203,7 @@ function centerTransformer(offset) {
vec.x -= group.origin[0] vec.x -= group.origin[0]
vec.y -= group.origin[1] vec.y -= group.origin[1]
vec.z -= group.origin[2] vec.z -= group.origin[2]
vec.applyEuler(first_obj.getMesh().rotation) vec.applyEuler(first_obj.mesh.rotation)
vec.x += group.origin[0] vec.x += group.origin[0]
vec.y += group.origin[1] vec.y += group.origin[1]
vec.z += group.origin[2] vec.z += group.origin[2]
@ -1223,7 +1211,7 @@ function centerTransformer(offset) {
Transformer.position.copy(vec) Transformer.position.copy(vec)
if (Blockbench.globalMovement === false && !rotate_tool) { if (Blockbench.globalMovement === false && !rotate_tool) {
var rotation = new THREE.Quaternion() var rotation = new THREE.Quaternion()
first_obj.getMesh().getWorldQuaternion(rotation) first_obj.mesh.getWorldQuaternion(rotation)
Transformer.rotation.setFromQuaternion( rotation ) Transformer.rotation.setFromQuaternion( rotation )
} else { } else {
Transformer.rotation.set(0, 0, 0) Transformer.rotation.set(0, 0, 0)
@ -1344,7 +1332,7 @@ class CanvasController {
} }
updateVisibility() { updateVisibility() {
elements.forEach(function(s) { elements.forEach(function(s) {
var mesh = s.getMesh() var mesh = s.mesh
if (s.visibility == true) { if (s.visibility == true) {
if (!mesh) { if (!mesh) {
Canvas.addCube(s) Canvas.addCube(s)
@ -1408,7 +1396,7 @@ class CanvasController {
arr = selected arr = selected
} }
arr.forEach(function(obj) { arr.forEach(function(obj) {
var mesh = obj.getMesh() var mesh = obj.mesh
if (mesh !== undefined) { if (mesh !== undefined) {
mesh.parent.remove(mesh) mesh.parent.remove(mesh)
} }
@ -1461,7 +1449,7 @@ class CanvasController {
outlineObjects(arr) { outlineObjects(arr) {
arr.forEach(function(obj) { arr.forEach(function(obj) {
if (!obj.visibility) return; if (!obj.visibility) return;
var mesh = obj.getMesh() var mesh = obj.mesh
if (mesh === undefined) return; if (mesh === undefined) return;
var line = Canvas.getOutlineMesh(mesh) var line = Canvas.getOutlineMesh(mesh)
@ -1478,7 +1466,7 @@ class CanvasController {
updateAllBones() { updateAllBones() {
getAllOutlinerGroups().forEach((obj) => { getAllOutlinerGroups().forEach((obj) => {
let mesh = obj.getMesh() let mesh = obj.mesh
if (obj.visibility && mesh) { if (obj.visibility && mesh) {
mesh.rotation.reorder('ZYX') mesh.rotation.reorder('ZYX')
@ -1494,7 +1482,7 @@ class CanvasController {
mesh.position.y -= obj.parent.origin[1] mesh.position.y -= obj.parent.origin[1]
mesh.position.z -= obj.parent.origin[2] mesh.position.z -= obj.parent.origin[2]
var parent_mesh = obj.parent.getMesh() var parent_mesh = obj.parent.mesh
parent_mesh.add(mesh) parent_mesh.add(mesh)
} else { } else {
scene.add(mesh) scene.add(mesh)
@ -1526,7 +1514,7 @@ class CanvasController {
adaptObjectPosition(obj, mesh, parent) { adaptObjectPosition(obj, mesh, parent) {
if (!obj.visibility) return; if (!obj.visibility) return;
if (!mesh || mesh > 0) mesh = obj.getMesh() if (!mesh || mesh > 0) mesh = obj.mesh
function setSize(geo) { function setSize(geo) {
if (Blockbench.entity_mode && obj.inflate !== undefined) { if (Blockbench.entity_mode && obj.inflate !== undefined) {
@ -1549,7 +1537,7 @@ class CanvasController {
mesh.position.set(0, 0, 0) mesh.position.set(0, 0, 0)
mesh.rotation.reorder('YZX') mesh.rotation.reorder('YZX')
if (obj.parent.type === 'group') { if (obj.parent.type === 'group') {
obj.parent.getMesh().add(mesh) obj.parent.mesh.add(mesh)
mesh.position.x -= obj.parent.origin[0] mesh.position.x -= obj.parent.origin[0]
mesh.position.y -= obj.parent.origin[1] mesh.position.y -= obj.parent.origin[1]
mesh.position.z -= obj.parent.origin[2] mesh.position.z -= obj.parent.origin[2]
@ -1586,7 +1574,7 @@ class CanvasController {
function iterate(obj, mesh) { function iterate(obj, mesh) {
//Iterate inside (cube) > outside //Iterate inside (cube) > outside
if (!mesh) { if (!mesh) {
mesh = obj.getMesh() mesh = obj.mesh
} }
if (obj.type === 'group') { if (obj.type === 'group') {
mesh.rotation.reorder('ZYX') mesh.rotation.reorder('ZYX')
@ -1621,7 +1609,7 @@ class CanvasController {
iterate(el, elmesh) iterate(el, elmesh)
} }
adaptObjectFaces(obj, mesh) { adaptObjectFaces(obj, mesh) {
if (!mesh) mesh = obj.getMesh() if (!mesh) mesh = obj.mesh
if (!mesh) return; if (!mesh) return;
if (!Prop.wireframe) { if (!Prop.wireframe) {
var materials = [] var materials = []
@ -1646,7 +1634,7 @@ class CanvasController {
} }
updateUV(obj, animation, force_entity_mode) { updateUV(obj, animation, force_entity_mode) {
if (Prop.wireframe === true) return; if (Prop.wireframe === true) return;
var mesh = obj.getMesh() var mesh = obj.mesh
if (mesh === undefined) return; if (mesh === undefined) return;
mesh.geometry.faceVertexUvs[0] = []; mesh.geometry.faceVertexUvs[0] = [];
@ -1689,34 +1677,34 @@ class CanvasController {
f.from[1] /= Project.texture_height / 16 f.from[1] /= Project.texture_height / 16
f.size[0] /= Project.texture_width / 16 f.size[0] /= Project.texture_width / 16
f.size[1] /= Project.texture_height / 16 f.size[1] /= Project.texture_height / 16
var data = { var uv= [
uv: [ f.from[0] + obj.uv_offset[0] / Project.texture_width * 16,
f.from[0] + Math.floor(obj.uv_offset[0]+0.0000001) / Project.texture_width * 16, f.from[1] + obj.uv_offset[1] / Project.texture_height * 16,
f.from[1] + Math.floor(obj.uv_offset[1]+0.0000001) / Project.texture_height * 16, f.from[0] + f.size[0] + obj.uv_offset[0] / Project.texture_width * 16,
f.from[0] + f.size[0] + Math.floor(obj.uv_offset[0]+0.0000001) / Project.texture_width * 16, f.from[1] + f.size[1] + obj.uv_offset[1] / Project.texture_height * 16
f.from[1] + f.size[1] + Math.floor(obj.uv_offset[1]+0.0000001) / Project.texture_height * 16 ]
] uv.forEach(function(s, si) {
} uv[si] *= 1
data.uv.forEach(function(s, si) {
data.uv[si] *= 1
}) })
obj.faces[f.face].uv[0] = data.uv[0] obj.faces[f.face].uv[0] = uv[0]
obj.faces[f.face].uv[1] = data.uv[1] obj.faces[f.face].uv[1] = uv[1]
obj.faces[f.face].uv[2] = data.uv[2] obj.faces[f.face].uv[2] = uv[2]
obj.faces[f.face].uv[3] = data.uv[3] obj.faces[f.face].uv[3] = uv[3]
var uvArray = getUVArray(data, 0) var do_cl = Math.random()<0.001
mesh.geometry.faceVertexUvs[0][f.fIndex] = [
uvArray[0], //Fight Bleeding
uvArray[1], for (var si = 0; si < 2; si++) {
uvArray[3] let margin = 16/(si?Project.texture_height:Project.texture_width)/16;
]; if (uv[si] > uv[si+2]) {
mesh.geometry.faceVertexUvs[0][f.fIndex+1] = [ margin = -margin
uvArray[1], }
uvArray[2], uv[si] += margin
uvArray[3] uv[si+2] -= margin
]; }
Canvas.updateUVFace(mesh.geometry.faceVertexUvs[0], f.fIndex, {uv: uv}, 0)
}) })
} else { } else {
@ -1726,15 +1714,6 @@ class CanvasController {
var frame = 0 var frame = 0
for (var face in obj) { for (var face in obj) {
if (obj.hasOwnProperty(face)) { if (obj.hasOwnProperty(face)) {
var fIndex = 0;
switch(face) {
case 'north': fIndex = 10;break;
case 'east': fIndex = 0; break;
case 'south': fIndex = 8; break;
case 'west': fIndex = 2; break;
case 'up': fIndex = 4; break;
case 'down': fIndex = 6; break;
}
stretch = 1 stretch = 1
frame = 0 frame = 0
if (obj[face].texture && obj[face].texture !== null) { if (obj[face].texture && obj[face].texture !== null) {
@ -1746,17 +1725,7 @@ class CanvasController {
} }
} }
} }
var uvArray = getUVArray(obj[face], frame, stretch) Canvas.updateUVFace(mesh.geometry.faceVertexUvs[0], Canvas.face_order.indexOf(face)*2, obj[face], frame, stretch)
mesh.geometry.faceVertexUvs[0][fIndex] = [
uvArray[0],
uvArray[1],
uvArray[3]
];
mesh.geometry.faceVertexUvs[0][fIndex+1] = [
uvArray[1],
uvArray[2],
uvArray[3]
];
} }
} }
@ -1764,6 +1733,55 @@ class CanvasController {
mesh.geometry.elementsNeedUpdate = true; mesh.geometry.elementsNeedUpdate = true;
return mesh.geometry return mesh.geometry
} }
updateUVFace(vertex_uvs, index, face, frame, stretch) {
if (stretch === undefined) {
stretch = -1
} else {
stretch = stretch*(-1)
}
if (!vertex_uvs[index]) vertex_uvs[index] = [];
if (!vertex_uvs[index+1]) vertex_uvs[index+1] = [];
var arr = [
vertex_uvs[index][0],
vertex_uvs[index][1],
vertex_uvs[index+1][1],
vertex_uvs[index+1][2],
]
for (var i = 0; i < 4; i++) {
if (arr[i] === undefined) {
arr[i] = new THREE.Vector2()
}
}
arr[0].set(face.uv[0]/16, (face.uv[1]/16)/stretch+1), //0,1
arr[1].set(face.uv[0]/16, (face.uv[3]/16)/stretch+1), //0,0
arr[2].set(face.uv[2]/16, (face.uv[3]/16)/stretch+1), //1,0
arr[3].set(face.uv[2]/16, (face.uv[1]/16)/stretch+1) //1,1
if (frame > 0 && stretch !== -1) {
//Animate
var offset = (1/stretch) * frame
arr[0].y += offset
arr[1].y += offset
arr[2].y += offset
arr[3].y += offset
}
var rot = (face.rotation+0)
while (rot > 0) {
arr.push(arr.shift())
rot = rot-90;
}
vertex_uvs[index] = [
arr[0],
arr[1],
arr[3]
];
vertex_uvs[index+1] = [
arr[1],
arr[2],
arr[3]
];
}
//Outline //Outline
getOutlineMesh(mesh) { getOutlineMesh(mesh) {
var vs = mesh.geometry.vertices var vs = mesh.geometry.vertices
@ -1782,7 +1800,7 @@ class CanvasController {
} }
buildOutline(obj) { buildOutline(obj) {
if (obj.visibility == false) return; if (obj.visibility == false) return;
var mesh = obj.getMesh(); var mesh = obj.mesh;
if (mesh === undefined) return; if (mesh === undefined) return;
if (mesh.outline) { if (mesh.outline) {
@ -1800,7 +1818,7 @@ class CanvasController {
mesh.add(line); mesh.add(line);
} }
} }
var Canvas = new CanvasController() const Canvas = new CanvasController()
BARS.defineActions(function() { BARS.defineActions(function() {
new Action({ new Action({
@ -1863,6 +1881,7 @@ BARS.defineActions(function() {
id: 'screenshot_app', id: 'screenshot_app',
icon: 'icon-bb_interface', icon: 'icon-bb_interface',
category: 'view', category: 'view',
condition: isApp,
click: function () {Screencam.fullScreen()} click: function () {Screencam.fullScreen()}
}) })
new Action({ new Action({
@ -1874,25 +1893,6 @@ BARS.defineActions(function() {
main_preview.toggleFullscreen() main_preview.toggleFullscreen()
} }
}) })
//{icon: getBtn(0, true), name: 'menu.preview.perspective.normal', click: function(preview) {preview.setNormalCamera()}},
//{icon: getBtn(0), name: 'direction.top', color: 'y', (0)}},
//{icon: getBtn(1), name: 'direction.bottom', color: 'y', (1)}},
//{icon: getBtn(2), name: 'direction.south', color: 'z', (2)}},
//{icon: getBtn(3), name: 'direction.north', color: 'z', (3)}},
//{icon: getBtn(4), name: 'direction.east', color: 'x', (4)}},
//{icon: getBtn(5), name: 'direction.west', color: 'x', (5)}}
/*
reset_view: {shift: false, ctrl: false, alt: false, code: 96, name: 'Reset View', char: 'NUMPAD 0'},
view_normal: {shift: false, ctrl: false, alt: false, code: 101, name: 'Normal View', char: 'NUMPAD 5'},
view_0: {shift: false, ctrl: false, alt: false, code: 104, name: 'Top View', char: 'NUMPAD 8'},
view_1: {shift: false, ctrl: false, alt: false, code: 98, name: 'Bottom View', char: 'NUMPAD 2'},
view_2: {shift: false, ctrl: false, alt: false, code: 100, name: 'South View', char: 'NUMPAD 4'},
view_3: {shift: false, ctrl: false, alt: false, code: 102, name: 'North View', char: 'NUMPAD 6'},
view_4: {shift: false, ctrl: false, alt: false, code: 103, name: 'East View', char: 'NUMPAD 7'},
view_5: {shift: false, ctrl: false, alt: false, code: 105, name: 'West View', char: 'NUMPAD 9'}
*/
new Action({ new Action({
id: 'camera_reset', id: 'camera_reset',
name: 'direction.top', name: 'direction.top',

View File

@ -567,7 +567,7 @@ class Texture {
if (fs.existsSync(settings.image_editor.value)) { if (fs.existsSync(settings.image_editor.value)) {
require('child_process').spawn(settings.image_editor.value, [this.path]) require('child_process').spawn(settings.image_editor.value, [this.path])
} else { } else {
var answer = app.dialog.showMessageBox(currentwindow, { var answer = electron.dialog.showMessageBox(currentwindow, {
type: 'info', type: 'info',
noLink: true, noLink: true,
title: tl('message.image_editor_missing.title'), title: tl('message.image_editor_missing.title'),
@ -909,7 +909,7 @@ function changeTexturesFolder() {
path.splice(-1) path.splice(-1)
path = path.join(osfs) path = path.join(osfs)
app.dialog.showOpenDialog(currentwindow, { electron.dialog.showOpenDialog(currentwindow, {
title: tl('message.default_textures.select'), title: tl('message.default_textures.select'),
properties: ['openDirectory'], properties: ['openDirectory'],
defaultPath: path defaultPath: path

View File

@ -49,8 +49,8 @@ function origin2geometry() {
element_center.y -= obj.origin[1] element_center.y -= obj.origin[1]
element_center.z -= obj.origin[2] element_center.z -= obj.origin[2]
if (obj.getMesh()) { if (obj.mesh) {
element_center.applyEuler(obj.getMesh().rotation) element_center.applyEuler(obj.mesh.rotation)
} }
obj.origin[0] += element_center.x obj.origin[0] += element_center.x
obj.origin[1] += element_center.y obj.origin[1] += element_center.y
@ -171,7 +171,7 @@ function moveCube(obj, val, axis, move_origin) {
m[getAxisLetter(axis)] = difference m[getAxisLetter(axis)] = difference
var rotation = new THREE.Quaternion() var rotation = new THREE.Quaternion()
obj.getMesh().getWorldQuaternion(rotation) obj.mesh.getWorldQuaternion(rotation)
m.applyQuaternion(rotation.inverse()) m.applyQuaternion(rotation.inverse())
obj.from[0] += m.x; obj.from[0] += m.x;

View File

@ -35,6 +35,12 @@ var Undo = {
Prop.project_saved = false; Prop.project_saved = false;
} }
}, },
cancelEdit: function() {
if (!Undo.current_save) return;
outlines.children.length = 0
Undo.loadSave(Undo.current_save, new Undo.save(Undo.current_save.aspects))
delete Undo.current_save;
},
undo: function() { undo: function() {
if (Undo.history.length <= 0 || Undo.index < 1) return; if (Undo.history.length <= 0 || Undo.index < 1) return;
@ -146,7 +152,11 @@ var Undo = {
if (aspects.display_slots) { if (aspects.display_slots) {
scope.display_slots = {} scope.display_slots = {}
aspects.display_slots.forEach(slot => { aspects.display_slots.forEach(slot => {
scope.display_slots[slot] = display[slot].copy() if (display[slot]) {
scope.display_slots[slot] = display[slot].copy()
} else {
scope.display_slots[slot] = null
}
}) })
} }
}, },
@ -155,7 +165,7 @@ var Undo = {
for (var uuid in save.cubes) { for (var uuid in save.cubes) {
if (save.cubes.hasOwnProperty(uuid)) { if (save.cubes.hasOwnProperty(uuid)) {
var data = save.cubes[uuid] var data = save.cubes[uuid]
var obj = TreeElements.findRecursive('uuid', uuid) var obj = elements.findInArray('uuid', uuid)
if (obj) { if (obj) {
for (var face in obj.faces) { for (var face in obj.faces) {
obj.faces[face] = {uv: []} obj.faces[face] = {uv: []}
@ -171,7 +181,7 @@ var Undo = {
} }
for (var uuid in reference.cubes) { for (var uuid in reference.cubes) {
if (reference.cubes.hasOwnProperty(uuid) && !save.cubes.hasOwnProperty(uuid)) { if (reference.cubes.hasOwnProperty(uuid) && !save.cubes.hasOwnProperty(uuid)) {
var obj = TreeElements.findRecursive('uuid', uuid) var obj = elements.findInArray('uuid', uuid)
if (obj) { if (obj) {
obj.remove(false) obj.remove(false)
} }
@ -275,22 +285,19 @@ var Undo = {
var animation = false; var animation = false;
if (Animator.selected.uuid !== save.keyframes.animation) { if (Animator.selected.uuid !== save.keyframes.animation) {
animation = Animator.animations.findInArray('uuid', save.keyframes.animation) animation = Animator.animations.findInArray('uuid', save.keyframes.animation)
} else { if (animation.select) {
animation = Animator.selected animation.select()
}
} }
if (animation.select && animation !== Animator.selected) { var bone = Animator.selected.getBoneAnimator();
animation.select() if (!bone || bone.uuid !== save.keyframes.bone) {
} for (var uuid in Animator.selected.bones) {
var bone = false; if (uuid === save.keyframes.bone) {
if (Animator.selected.uuid !== save.keyframes.animation) { bone = Animator.selected.bones[uuid]
animation = Animator.animations.findInArray('uuid', save.keyframes.animation) bone.select()
} else { }
animation = Animator.selected }
}
if (animation.select && animation !== Animator.selected) {
animation.select()
} }
@ -312,11 +319,14 @@ var Undo = {
kf.extend(data) kf.extend(data)
} else { } else {
kf = new Keyframe(data) kf = new Keyframe(data)
kf.parent = bone;
kf.uuid = uuid;
Timeline.keyframes.push(kf) Timeline.keyframes.push(kf)
added++; added++;
} }
} }
} }
for (var uuid in reference.keyframes) { for (var uuid in reference.keyframes) {
if (uuid.length === 36 && reference.keyframes.hasOwnProperty(uuid) && !save.keyframes.hasOwnProperty(uuid)) { if (uuid.length === 36 && reference.keyframes.hasOwnProperty(uuid) && !save.keyframes.hasOwnProperty(uuid)) {
var kf = getKeyframe(uuid) var kf = getKeyframe(uuid)
@ -329,14 +339,19 @@ var Undo = {
Vue.nextTick(Timeline.update) Vue.nextTick(Timeline.update)
} }
updateKeyframeSelection() updateKeyframeSelection()
Animator.preview()
} }
if (save.display_slots) { if (save.display_slots) {
for (var slot in save.display_slots) { for (var slot in save.display_slots) {
if (!display[slot]) { var data = save.display_slots[slot]
if (!display[slot] && data) {
display[slot] = new DisplaySlot() display[slot] = new DisplaySlot()
} else if (data === null && display[slot]) {
display[slot].default()
} }
display[slot].extend(save.display_slots[slot]).update() display[slot].extend(data).update()
} }
} }
updateSelection() updateSelection()

View File

@ -205,13 +205,10 @@ Array.prototype.empty = function() {
this.length = 0; this.length = 0;
} }
Array.prototype.findInArray = function(key, value) { Array.prototype.findInArray = function(key, value) {
if (this.length === 0) return {}; for (var i = 0; i < this.length; i++) {
var i = 0
while (i < this.length) {
if (this[i][key] === value) return this[i] if (this[i][key] === value) return this[i]
i++;
} }
return {}; return false;
} }
Array.prototype.positiveItems = function() { Array.prototype.positiveItems = function() {
var x = 0, i = 0; var x = 0, i = 0;

View File

@ -431,7 +431,7 @@ class UVEditor {
forCubes(cb) { forCubes(cb) {
var i = 0; var i = 0;
while (i < selected.length) { while (i < selected.length) {
cb(selected[i], selected[i].index()) cb(selected[i])
i++; i++;
} }
} }
@ -603,7 +603,7 @@ class UVEditor {
applyTexture(id) { applyTexture(id) {
var scope = this; var scope = this;
Undo.initEdit({cubes: selected, uv_only: true}) Undo.initEdit({cubes: selected, uv_only: true})
this.forCubes(function(obj) { this.forCubes(obj => {
obj.faces[scope.face].texture = '#'+id obj.faces[scope.face].texture = '#'+id
}) })
this.loadData() this.loadData()
@ -834,20 +834,20 @@ class UVEditor {
//Events //Events
disableAutoUV() { disableAutoUV() {
this.forCubes(function(obj) { this.forCubes(obj => {
obj.autouv = 0 obj.autouv = 0
}) })
} }
toggleUV() { toggleUV() {
var scope = this var scope = this
var state = selected[0].faces[this.face].enabled === false var state = selected[0].faces[this.face].enabled === false
this.forCubes(function(obj) { this.forCubes(obj => {
obj.faces[scope.face].enabled = state obj.faces[scope.face].enabled = state
}) })
} }
maximize(event) { maximize(event) {
var scope = this; var scope = this;
this.forCubes(function(obj) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
obj.faces[side].uv = [0, 0, 16, 16] obj.faces[side].uv = [0, 0, 16, 16]
}) })
@ -861,7 +861,7 @@ class UVEditor {
var scope = this; var scope = this;
var top, left, top2, left2; var top, left, top2, left2;
this.forCubes(function(obj, i) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
left = top = 0; left = top = 0;
if (side == 'north' || side == 'south') { if (side == 'north' || side == 'south') {
@ -884,7 +884,7 @@ class UVEditor {
} }
setRelativeAutoSize(event) { setRelativeAutoSize(event) {
var scope = this; var scope = this;
this.forCubes(function(obj, i) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
var uv = obj.faces[side].uv var uv = obj.faces[side].uv
switch (side) { switch (side) {
@ -950,7 +950,7 @@ class UVEditor {
} }
mirrorX(event) { mirrorX(event) {
var scope = this; var scope = this;
this.forCubes(function(obj, i) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
var proxy = obj.faces[side].uv[0] var proxy = obj.faces[side].uv[0]
obj.faces[side].uv[0] = obj.faces[side].uv[2] obj.faces[side].uv[0] = obj.faces[side].uv[2]
@ -964,7 +964,7 @@ class UVEditor {
} }
mirrorY(event) { mirrorY(event) {
var scope = this; var scope = this;
this.forCubes(function(obj, i) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
var proxy = obj.faces[side].uv[1] var proxy = obj.faces[side].uv[1]
obj.faces[side].uv[1] = obj.faces[side].uv[3] obj.faces[side].uv[1] = obj.faces[side].uv[3]
@ -978,7 +978,7 @@ class UVEditor {
} }
applyAll(event) { applyAll(event) {
var scope = this; var scope = this;
this.forCubes(function(obj, i) { this.forCubes(obj => {
uv_dialog.allFaces.forEach(function(side) { uv_dialog.allFaces.forEach(function(side) {
$.extend(true, obj.faces[side], obj.faces[scope.face]) $.extend(true, obj.faces[side], obj.faces[scope.face])
}) })
@ -991,7 +991,7 @@ class UVEditor {
clear(event) { clear(event) {
var scope = this; var scope = this;
Undo.initEdit({cubes: selected, uv_only: true}) Undo.initEdit({cubes: selected, uv_only: true})
this.forCubes(function(obj, i) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
obj.faces[side].uv = [0, 0, 0, 0] obj.faces[side].uv = [0, 0, 0, 0]
obj.faces[side].texture = null; obj.faces[side].texture = null;
@ -1008,7 +1008,7 @@ class UVEditor {
Undo.initEdit({cubes: selected, uv_only: true}) Undo.initEdit({cubes: selected, uv_only: true})
var val = BarItems.cullface.get() var val = BarItems.cullface.get()
if (val === 'off') val = false if (val === 'off') val = false
this.forCubes(function(obj) { this.forCubes(obj => {
if (val) { if (val) {
obj.faces[scope.face].cullface = val obj.faces[scope.face].cullface = val
} else { } else {
@ -1027,7 +1027,7 @@ class UVEditor {
var val = selected[0].faces[scope.face].tintindex === undefined var val = selected[0].faces[scope.face].tintindex === undefined
if (event === true || event === false) val = event if (event === true || event === false) val = event
this.forCubes(function(obj) { this.forCubes(obj => {
if (val) { if (val) {
obj.faces[scope.face].tintindex = 0 obj.faces[scope.face].tintindex = 0
} else { } else {
@ -1044,7 +1044,7 @@ class UVEditor {
rotate() { rotate() {
var scope = this; var scope = this;
var value = BarItems.uv_rotation.get() var value = BarItems.uv_rotation.get()
this.forCubes(function(obj, i) { this.forCubes(obj => {
if (value == 0) { if (value == 0) {
delete obj.faces[scope.face].rotation delete obj.faces[scope.face].rotation
} else { } else {
@ -1057,7 +1057,7 @@ class UVEditor {
} }
setRotation(value) { setRotation(value) {
var scope = this; var scope = this;
this.forCubes(function(obj, i) { this.forCubes(obj => {
if (value == 0) { if (value == 0) {
delete obj.faces[scope.face].rotation delete obj.faces[scope.face].rotation
} else { } else {
@ -1072,7 +1072,7 @@ class UVEditor {
} }
autoCullface(event) { autoCullface(event) {
var scope = this; var scope = this;
this.forCubes(function(obj) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
obj.faces[side].cullface = side obj.faces[side].cullface = side
}) })
@ -1192,7 +1192,7 @@ class UVEditor {
} }
reset(event) { reset(event) {
var scope = this; var scope = this;
this.forCubes(function(obj, i) { this.forCubes(obj => {
scope.getFaces(event).forEach(function(side) { scope.getFaces(event).forEach(function(side) {
obj.faces[side].uv = [0, 0, 1, 1] obj.faces[side].uv = [0, 0, 1, 1]
delete obj.faces[side].texture; delete obj.faces[side].texture;
@ -1321,7 +1321,7 @@ class UVEditor {
]) ])
var uv_dialog = { const uv_dialog = {
isSetup: false, isSetup: false,
single: false, single: false,
clipboard: null, clipboard: null,

View File

@ -1,5 +1,8 @@
(function() { (function() {
$.getScript("lib/file_saver.js"); $.getScript("lib/file_saver.js");
$.getScript('https://rawgit.com/nodeca/pako/master/dist/pako.js', function() {
window.zlib = pako
})
})() })()
$(document).ready(function() { $(document).ready(function() {

View File

@ -823,5 +823,7 @@
"action.color_picker": "Farbpipette", "action.color_picker": "Farbpipette",
"action.color_picker.desc": "Wählt die Farbe eines Pixels der Textur aus.", "action.color_picker.desc": "Wählt die Farbe eines Pixels der Textur aus.",
"action.open_backup_folder": "Backup-Ordner öffnen", "action.open_backup_folder": "Backup-Ordner öffnen",
"action.open_backup_folder.desc": "Öffnet den Backup-Ordner von Blockbench" "action.open_backup_folder.desc": "Öffnet den Backup-Ordner von Blockbench",
"switches.mirror": "UV Spiegeln",
"language_name": "Deutsch"
} }

View File

@ -1,4 +1,6 @@
{ {
"language_name": "English",
"dialog.ok": "OK", "dialog.ok": "OK",
"dialog.cancel": "Cancel", "dialog.cancel": "Cancel",
"dialog.confirm": "Confirm", "dialog.confirm": "Confirm",
@ -826,6 +828,7 @@
"switches.visibility": "Visibility", "switches.visibility": "Visibility",
"switches.export": "Export", "switches.export": "Export",
"switches.shading": "Shade", "switches.shading": "Shade",
"switches.mirror": "Mirror UV",
"switches.autouv": "Auto UV", "switches.autouv": "Auto UV",
"panel.uv": "UV", "panel.uv": "UV",

View File

@ -823,5 +823,7 @@
"action.color_picker": "Seleccionador de Color", "action.color_picker": "Seleccionador de Color",
"action.color_picker.desc": "Herramienta para seleccionar el color de píxeles en tu textura", "action.color_picker.desc": "Herramienta para seleccionar el color de píxeles en tu textura",
"action.open_backup_folder": "Abrir Carpeta de Backups", "action.open_backup_folder": "Abrir Carpeta de Backups",
"action.open_backup_folder.desc": "Abre la carpeta de backups de Blockbench" "action.open_backup_folder.desc": "Abre la carpeta de backups de Blockbench",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -823,5 +823,7 @@
"action.color_picker": "Pipette à couleurs", "action.color_picker": "Pipette à couleurs",
"action.color_picker.desc": "Outil pour choisir la couleur des pixels sur votre texture", "action.color_picker.desc": "Outil pour choisir la couleur des pixels sur votre texture",
"action.open_backup_folder": "Ouvrir le dossier de sauvegarde", "action.open_backup_folder": "Ouvrir le dossier de sauvegarde",
"action.open_backup_folder.desc": "Ouvre le dossier de sauvegarde de Blockbench" "action.open_backup_folder.desc": "Ouvre le dossier de sauvegarde de Blockbench",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -806,15 +806,15 @@
"action.export_class_entity.desc": "エンティティモデルをjava としてエクスポートする", "action.export_class_entity.desc": "エンティティモデルをjava としてエクスポートする",
"settings.seethrough_outline": "X-Rey アウトライン", "settings.seethrough_outline": "X-Rey アウトライン",
"settings.seethrough_outline.desc": "オブジェクトを通してアウトラインを表示する", "settings.seethrough_outline.desc": "オブジェクトを通してアウトラインを表示する",
"mode.edit": "Edit", "mode.edit": "編集",
"mode.paint": "Paint", "mode.paint": "ペイント",
"mode.display": "Display", "mode.display": "ディスプレイ",
"mode.animate": "Animate", "mode.animate": "生き物",
"status_bar.recording_gif": "Recording GIF", "status_bar.recording_gif": "Recording GIF",
"status_bar.processing_gif": "Processing GIF", "status_bar.processing_gif": "Processing GIF",
"settings.backup_retain": "Backup Retain Duration", "settings.backup_retain": "Backup Retain Duration",
"settings.backup_retain.desc": "Set how long Blockbench retains old backups in days", "settings.backup_retain.desc": "Set how long Blockbench retains old backups in days",
"action.rotate_tool": "Rotate", "action.rotate_tool": "回転",
"action.rotate_tool.desc": "Tool to select and rotate elements", "action.rotate_tool.desc": "Tool to select and rotate elements",
"action.fill_tool": "Paint Bucket", "action.fill_tool": "Paint Bucket",
"action.fill_tool.desc": "Paint bucket to fill entire faces with one color", "action.fill_tool.desc": "Paint bucket to fill entire faces with one color",
@ -823,5 +823,7 @@
"action.color_picker": "Color Picker", "action.color_picker": "Color Picker",
"action.color_picker.desc": "Tool to pick the color of pixels on your texture", "action.color_picker.desc": "Tool to pick the color of pixels on your texture",
"action.open_backup_folder": "Open Backup Folder", "action.open_backup_folder": "Open Backup Folder",
"action.open_backup_folder.desc": "Opens the Blockbench backup folder" "action.open_backup_folder.desc": "Opens the Blockbench backup folder",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -823,5 +823,7 @@
"action.color_picker": "Color Picker", "action.color_picker": "Color Picker",
"action.color_picker.desc": "Tool to pick the color of pixels on your texture", "action.color_picker.desc": "Tool to pick the color of pixels on your texture",
"action.open_backup_folder": "Open Backup Folder", "action.open_backup_folder": "Open Backup Folder",
"action.open_backup_folder.desc": "Opens the Blockbench backup folder" "action.open_backup_folder.desc": "Opens the Blockbench backup folder",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -823,5 +823,7 @@
"action.color_picker": "Color Picker", "action.color_picker": "Color Picker",
"action.color_picker.desc": "Tool to pick the color of pixels on your texture", "action.color_picker.desc": "Tool to pick the color of pixels on your texture",
"action.open_backup_folder": "Open Backup Folder", "action.open_backup_folder": "Open Backup Folder",
"action.open_backup_folder.desc": "Opens the Blockbench backup folder" "action.open_backup_folder.desc": "Opens the Blockbench backup folder",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -38,7 +38,7 @@
"keys.down": "Стрелка вниз", "keys.down": "Стрелка вниз",
"keys.pageup": "Page Up", "keys.pageup": "Page Up",
"keys.pagedown": "Page Down", "keys.pagedown": "Page Down",
"keys.plus": "+", "keys.plus": "Плюс",
"keys.comma": ",", "keys.comma": ",",
"keys.point": ".", "keys.point": ".",
"keys.minus": "-", "keys.minus": "-",
@ -810,8 +810,8 @@
"mode.paint": "Красить", "mode.paint": "Красить",
"mode.display": "Предпросмотр", "mode.display": "Предпросмотр",
"mode.animate": "Анимировать", "mode.animate": "Анимировать",
"status_bar.recording_gif": "Recording GIF", "status_bar.recording_gif": "Запись GIF",
"status_bar.processing_gif": "Processing GIF", "status_bar.processing_gif": "Обработка GIF",
"settings.backup_retain": "Продолжительность хранения автосохранений", "settings.backup_retain": "Продолжительность хранения автосохранений",
"settings.backup_retain.desc": "Set how long Blockbench retains old backups in days", "settings.backup_retain.desc": "Set how long Blockbench retains old backups in days",
"action.rotate_tool": "Вращать", "action.rotate_tool": "Вращать",
@ -822,6 +822,8 @@
"action.eraser.desc": "Eraser tool to replace colors on a texture with transparency", "action.eraser.desc": "Eraser tool to replace colors on a texture with transparency",
"action.color_picker": "Color Picker", "action.color_picker": "Color Picker",
"action.color_picker.desc": "Tool to pick the color of pixels on your texture", "action.color_picker.desc": "Tool to pick the color of pixels on your texture",
"action.open_backup_folder": "Открыть папку", "action.open_backup_folder": "Открыть папку автосохранений",
"action.open_backup_folder.desc": "Opens the Blockbench backup folder" "action.open_backup_folder.desc": "Opens the Blockbench backup folder",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -823,5 +823,7 @@
"action.color_picker": "Color Picker", "action.color_picker": "Color Picker",
"action.color_picker.desc": "Tool to pick the color of pixels on your texture", "action.color_picker.desc": "Tool to pick the color of pixels on your texture",
"action.open_backup_folder": "Open Backup Folder", "action.open_backup_folder": "Open Backup Folder",
"action.open_backup_folder.desc": "Opens the Blockbench backup folder" "action.open_backup_folder.desc": "Opens the Blockbench backup folder",
"switches.mirror": "Mirror UV",
"language_name": "English"
} }

View File

@ -823,5 +823,7 @@
"action.color_picker": "颜色选择器", "action.color_picker": "颜色选择器",
"action.color_picker.desc": "用于选择材质纹理上像素颜色的工具", "action.color_picker.desc": "用于选择材质纹理上像素颜色的工具",
"action.open_backup_folder": "打开备份文件夹", "action.open_backup_folder": "打开备份文件夹",
"action.open_backup_folder.desc": "打开Blockbench备份文件夹" "action.open_backup_folder.desc": "打开Blockbench备份文件夹",
"switches.mirror": "Mirror UV",
"language_name": "中文"
} }

10
main.js
View File

@ -17,9 +17,9 @@ function createWindow () {
} }
}) })
var index_path = path.join(__dirname, 'index.html') var index_path = path.join(__dirname, 'index.html')
if (__dirname.includes('xampp\\htdocs\\')) { /*if (__dirname.includes('xampp\\htdocs\\')) {
//index_path = path.join(__dirname, 'index.php') index_path = path.join(__dirname, 'index.php')
} }*/
win.setMenu(null); win.setMenu(null);
win.maximize() win.maximize()
win.show() win.show()
@ -35,15 +35,15 @@ function createWindow () {
} }
app.commandLine.appendSwitch('ignore-gpu-blacklist') app.commandLine.appendSwitch('ignore-gpu-blacklist')
app.on('ready', createWindow) app.on('ready', createWindow)
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
app.quit() app.quit()
}) })
app.on('activate', () => { app.on('activate', () => {
if (win === null) { if (win === null) {
createWindow() createWindow()
} }
}) })

View File

@ -1,7 +1,7 @@
{ {
"name": "Blockbench", "name": "Blockbench",
"description": "Minecraft Block Model Editor", "description": "Minecraft Block Model Editor",
"version": "2.3.1", "version": "2.3.2",
"license": "MIT", "license": "MIT",
"author": { "author": {
"name": "JannisX11", "name": "JannisX11",
@ -42,7 +42,7 @@
"x": 200, "x": 200,
"y": 100, "y": 100,
"width": 440, "width": 440,
"height": 220 "height": 220
}, },
"contents": [ "contents": [
{ {
@ -71,10 +71,12 @@
}, },
"scripts": { "scripts": {
"dist": "build --publish=always", "dist": "build --publish=always",
"dist32": "build -w --ia32 --publish=always" "win64": "build -w --ia32 --publish=always",
"win32": "build -w --x64 --publish=always"
}, },
"devDependencies": { "devDependencies": {
"async": "^2.4.1", "async": "^2.4.1",
"electron": "4.0.1",
"electron-builder": "^20.38.4" "electron-builder": "^20.38.4"
} }
} }