-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: Unified Viewport.Camera and Viewport.Shading,
- Loading branch information
Showing
5 changed files
with
67 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { UIPanel, UISelect } from './libs/ui.js'; | ||
|
||
function ViewportControls( editor ) { | ||
|
||
const signals = editor.signals; | ||
|
||
const container = new UIPanel(); | ||
container.setPosition( 'absolute' ); | ||
container.setRight( '10px' ); | ||
container.setTop( '10px' ); | ||
|
||
// camera | ||
|
||
const cameraSelect = new UISelect(); | ||
cameraSelect.setMarginRight( '10px' ); | ||
cameraSelect.onChange( function () { | ||
|
||
editor.setViewportCamera( this.getValue() ); | ||
|
||
} ); | ||
container.add( cameraSelect ); | ||
|
||
signals.cameraAdded.add( update ); | ||
signals.cameraRemoved.add( update ); | ||
|
||
// shading | ||
|
||
const shadingSelect = new UISelect(); | ||
shadingSelect.setOptions( { 'default': 'default', 'normals': 'normals', 'wireframe': 'wireframe' } ); | ||
shadingSelect.setValue( 'default' ); | ||
shadingSelect.onChange( function () { | ||
|
||
editor.setViewportShading( this.getValue() ); | ||
|
||
} ); | ||
container.add( shadingSelect ); | ||
|
||
update(); | ||
|
||
// | ||
|
||
function update() { | ||
|
||
const options = {}; | ||
|
||
const cameras = editor.cameras; | ||
|
||
for ( const key in cameras ) { | ||
|
||
const camera = cameras[ key ]; | ||
options[ camera.uuid ] = camera.name; | ||
|
||
} | ||
|
||
cameraSelect.setOptions( options ); | ||
cameraSelect.setValue( editor.viewportCamera.uuid ); | ||
|
||
} | ||
|
||
return container; | ||
|
||
} | ||
|
||
export { ViewportControls }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters