Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<script src="js/Sidebar.Animation.js"></script>
<script src="js/Sidebar.Script.js"></script>
<script src="js/Sidebar.History.js"></script>
<script src="js/Strings.js"></script>
<script src="js/Toolbar.js"></script>
<script src="js/Viewport.js"></script>
<script src="js/Viewport.Info.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions editor/js/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var Config = function () {
var name = 'threejs-editor';

var storage = {
'language': 'en',

'autosave': true,
'theme': 'css/light.css',

Expand Down
2 changes: 2 additions & 0 deletions editor/js/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ var Editor = function () {
this.config = new Config();
this.history = new History( this );
this.storage = new Storage();
this.strings = new Strings( this.config );

this.loader = new Loader( this );

this.camera = this.DEFAULT_CAMERA.clone();
Expand Down
38 changes: 20 additions & 18 deletions editor/js/Menubar.Add.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

Menubar.Add = function ( editor ) {

var strings = editor.strings;

var container = new UI.Panel();
container.setClass( 'menu' );

var title = new UI.Panel();
title.setClass( 'title' );
title.setTextContent( 'Add' );
title.setTextContent( strings.getKey( 'menubar/add' ) );
container.add( title );

var options = new UI.Panel();
Expand All @@ -20,7 +22,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Group' );
option.setTextContent( strings.getKey( 'menubar/add/group' ) );
option.onClick( function () {

var mesh = new THREE.Group();
Expand All @@ -39,7 +41,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Plane' );
option.setTextContent( strings.getKey( 'menubar/add/plane' ) );
option.onClick( function () {

var geometry = new THREE.PlaneBufferGeometry( 1, 1, 1, 1 );
Expand All @@ -56,7 +58,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Box' );
option.setTextContent( strings.getKey( 'menubar/add/box' ) );
option.onClick( function () {

var geometry = new THREE.BoxBufferGeometry( 1, 1, 1, 1, 1, 1 );
Expand All @@ -72,7 +74,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Circle' );
option.setTextContent( strings.getKey( 'menubar/add/circle' ) );
option.onClick( function () {

var geometry = new THREE.CircleBufferGeometry( 1, 8, 0, Math.PI * 2 );
Expand All @@ -88,7 +90,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Cylinder' );
option.setTextContent( strings.getKey( 'menubar/add/cylinder' ) );
option.onClick( function () {

var geometry = new THREE.CylinderBufferGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
Expand All @@ -104,7 +106,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Sphere' );
option.setTextContent( strings.getKey( 'menubar/add/sphere' ) );
option.onClick( function () {

var geometry = new THREE.SphereBufferGeometry( 1, 8, 6, 0, Math.PI * 2, 0, Math.PI );
Expand All @@ -120,7 +122,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Icosahedron' );
option.setTextContent( strings.getKey( 'menubar/add/icosahedron' ) );
option.onClick( function () {

var geometry = new THREE.IcosahedronGeometry( 1, 0 );
Expand All @@ -136,7 +138,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Torus' );
option.setTextContent( strings.getKey( 'menubar/add/torus' ) );
option.onClick( function () {

var geometry = new THREE.TorusBufferGeometry( 1, 0.4, 8, 6, Math.PI * 2 );
Expand All @@ -152,7 +154,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'TorusKnot' );
option.setTextContent( strings.getKey( 'menubar/add/torusknot' ) );
option.onClick( function () {

var geometry = new THREE.TorusKnotBufferGeometry( 1, 0.4, 64, 8, 2, 3 );
Expand Down Expand Up @@ -197,7 +199,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Lathe' );
option.setTextContent( strings.getKey( 'menubar/add/lathe' ) );
option.onClick( function() {

var points = [
Expand Down Expand Up @@ -227,7 +229,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Sprite' );
option.setTextContent( strings.getKey( 'menubar/add/sprite' ) );
option.onClick( function () {

var sprite = new THREE.Sprite( new THREE.SpriteMaterial() );
Expand All @@ -246,7 +248,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'PointLight' );
option.setTextContent( strings.getKey( 'menubar/add/pointlight' ) );
option.onClick( function () {

var color = 0xffffff;
Expand All @@ -265,7 +267,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'SpotLight' );
option.setTextContent( strings.getKey( 'menubar/add/spotlight' ) );
option.onClick( function () {

var color = 0xffffff;
Expand All @@ -289,7 +291,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'DirectionalLight' );
option.setTextContent( strings.getKey( 'menubar/add/directionallight' ) );
option.onClick( function () {

var color = 0xffffff;
Expand All @@ -310,7 +312,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'HemisphereLight' );
option.setTextContent( strings.getKey( 'menubar/add/hemispherelight' ) );
option.onClick( function () {

var skyColor = 0x00aaff;
Expand All @@ -331,7 +333,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'AmbientLight' );
option.setTextContent( strings.getKey( 'menubar/add/ambientlight' ) );
option.onClick( function() {

var color = 0x222222;
Expand All @@ -352,7 +354,7 @@ Menubar.Add = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'PerspectiveCamera' );
option.setTextContent( strings.getKey( 'menubar/add/perspectivecamera' ) );
option.onClick( function() {

var camera = new THREE.PerspectiveCamera( 50, 1, 1, 10000 );
Expand Down
16 changes: 9 additions & 7 deletions editor/js/Menubar.Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

Menubar.Edit = function ( editor ) {

var strings = editor.strings;

var container = new UI.Panel();
container.setClass( 'menu' );

var title = new UI.Panel();
title.setClass( 'title' );
title.setTextContent( 'Edit' );
title.setTextContent( strings.getKey( 'menubar/edit' ) );
container.add( title );

var options = new UI.Panel();
Expand All @@ -20,7 +22,7 @@ Menubar.Edit = function ( editor ) {

var undo = new UI.Row();
undo.setClass( 'option' );
undo.setTextContent( 'Undo (Ctrl+Z)' );
undo.setTextContent( strings.getKey( 'menubar/edit/undo' ) );
undo.onClick( function () {

editor.undo();
Expand All @@ -32,7 +34,7 @@ Menubar.Edit = function ( editor ) {

var redo = new UI.Row();
redo.setClass( 'option' );
redo.setTextContent( 'Redo (Ctrl+Shift+Z)' );
redo.setTextContent( strings.getKey( 'menubar/edit/redo' ) );
redo.onClick( function () {

editor.redo();
Expand All @@ -44,7 +46,7 @@ Menubar.Edit = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Clear History' );
option.setTextContent( strings.getKey( 'menubar/edit/clear_history' ) );
option.onClick( function () {

if ( confirm( 'The Undo/Redo History will be cleared. Are you sure?' ) ) {
Expand Down Expand Up @@ -86,7 +88,7 @@ Menubar.Edit = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Clone' );
option.setTextContent( strings.getKey( 'menubar/edit/clone' ) );
option.onClick( function () {

var object = editor.selected;
Expand All @@ -104,7 +106,7 @@ Menubar.Edit = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Delete (Del)' );
option.setTextContent( strings.getKey( 'menubar/edit/delete' ) );
option.onClick( function () {

var object = editor.selected;
Expand All @@ -121,7 +123,7 @@ Menubar.Edit = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Minify Shaders' );
option.setTextContent( strings.getKey( 'menubar/edit/minify_shaders' ) );
option.onClick( function() {

var root = editor.selected || editor.scene;
Expand Down
4 changes: 3 additions & 1 deletion editor/js/Menubar.Examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

Menubar.Examples = function ( editor ) {

var strings = editor.strings;

var container = new UI.Panel();
container.setClass( 'menu' );

var title = new UI.Panel();
title.setClass( 'title' );
title.setTextContent( 'Examples' );
title.setTextContent( strings.getKey( 'menubar/examples' ) );
container.add( title );

var options = new UI.Panel();
Expand Down
25 changes: 13 additions & 12 deletions editor/js/Menubar.File.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ Menubar.File = function ( editor ) {
//

var config = editor.config;
var strings = editor.strings;

var container = new UI.Panel();
container.setClass( 'menu' );

var title = new UI.Panel();
title.setClass( 'title' );
title.setTextContent( 'File' );
title.setTextContent( strings.getKey( 'menubar/file' ) );
container.add( title );

var options = new UI.Panel();
Expand All @@ -32,7 +33,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'New' );
option.setTextContent( strings.getKey( 'menubar/file/new' ) );
option.onClick( function () {

if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
Expand Down Expand Up @@ -67,7 +68,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Import' );
option.setTextContent( strings.getKey( 'menubar/file/import' ) );
option.onClick( function () {

fileInput.click();
Expand All @@ -83,7 +84,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export Geometry' );
option.setTextContent( strings.getKey( 'menubar/file/export/geometry' ) );
option.onClick( function () {

var object = editor.selected;
Expand Down Expand Up @@ -126,7 +127,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export Object' );
option.setTextContent( strings.getKey( 'menubar/file/export/object' ) );
option.onClick( function () {

var object = editor.selected;
Expand Down Expand Up @@ -160,7 +161,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export Scene' );
option.setTextContent( strings.getKey( 'menubar/file/export/scene' ) );
option.onClick( function () {

var output = editor.scene.toJSON();
Expand Down Expand Up @@ -189,7 +190,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export DAE' );
option.setTextContent( strings.getKey( 'menubar/file/export/dae' ) );
option.onClick( function () {

var exporter = new THREE.ColladaExporter();
Expand All @@ -207,7 +208,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export GLB' );
option.setTextContent( strings.getKey( 'menubar/file/export/glb' ) );
option.onClick( function () {

var exporter = new THREE.GLTFExporter();
Expand All @@ -227,7 +228,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export GLTF' );
option.setTextContent( strings.getKey( 'menubar/file/export/gltf' ) );
option.onClick( function () {

var exporter = new THREE.GLTFExporter();
Expand All @@ -246,7 +247,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export OBJ' );
option.setTextContent( strings.getKey( 'menubar/file/export/obj' ) );
option.onClick( function () {

var object = editor.selected;
Expand All @@ -269,7 +270,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Export STL' );
option.setTextContent( strings.getKey( 'menubar/file/export/stl' ) );
option.onClick( function () {

var exporter = new THREE.STLExporter();
Expand All @@ -287,7 +288,7 @@ Menubar.File = function ( editor ) {

var option = new UI.Row();
option.setClass( 'option' );
option.setTextContent( 'Publish' );
option.setTextContent( strings.getKey( 'menubar/file/publish' ) );
option.onClick( function () {

var zip = new JSZip();
Expand Down
Loading