Skip to content

Commit

Permalink
Editor: Fixed helpers checkbox also hiding the grid.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Nov 28, 2023
1 parent e0d329d commit 116382c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions editor/js/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ function Viewport( editor ) {
const camera = editor.camera;
const scene = editor.scene;
const sceneHelpers = editor.sceneHelpers;
let showSceneHelpers = true;

// helpers

const grid = new THREE.Group();
sceneHelpers.add( grid );

const grid1 = new THREE.GridHelper( 30, 30, 0x888888 );
grid1.material.color.setHex( 0x888888 );
Expand Down Expand Up @@ -675,17 +673,18 @@ function Viewport( editor ) {

} );

signals.showGridChanged.add( function ( showGrid ) {
signals.showGridChanged.add( function ( value ) {

grid.visible = value;

grid.visible = showGrid;
render();

} );

signals.showHelpersChanged.add( function ( showHelpers ) {
signals.showHelpersChanged.add( function ( value ) {

showSceneHelpers = showHelpers;
transformControls.enabled = showHelpers;
sceneHelpers.visible = value;
transformControls.enabled = value;

render();

Expand Down Expand Up @@ -760,7 +759,8 @@ function Viewport( editor ) {
if ( camera === editor.viewportCamera ) {

renderer.autoClear = false;
if ( showSceneHelpers === true ) renderer.render( sceneHelpers, camera );
if ( grid.visible === true ) renderer.render( grid, camera );
if ( sceneHelpers.visible === true ) renderer.render( sceneHelpers, camera );
if ( vr.currentSession === null ) viewHelper.render( renderer );
renderer.autoClear = true;

Expand Down

0 comments on commit 116382c

Please sign in to comment.