From c857c1eb6c7bea0d8667d6c742d50550d94cae84 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 7 May 2024 16:53:54 -0700 Subject: [PATCH] Editor: Cleaned up Add / Mesh --- editor/js/Menubar.Add.js | 34 +++++----- editor/js/Strings.js | 140 +++++++++++++++++++++------------------ 2 files changed, 93 insertions(+), 81 deletions(-) diff --git a/editor/js/Menubar.Add.js b/editor/js/Menubar.Add.js index aacfd076eae5fb..aab3f2b22abdeb 100644 --- a/editor/js/Menubar.Add.js +++ b/editor/js/Menubar.Add.js @@ -40,7 +40,7 @@ function MenubarAdd( editor ) { options.add( new UIHorizontalRule() ); - // Mesh (submenu) + // Mesh const meshSubmenuTitle = new UIRow().setTextContent( strings.getKey( 'menubar/add/mesh' ) ).addClass( 'option' ).addClass( 'submenu-title' ); meshSubmenuTitle.onMouseOver( function () { @@ -67,7 +67,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/box' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/box' ) ); option.onClick( function () { const geometry = new THREE.BoxGeometry( 1, 1, 1, 1, 1, 1 ); @@ -83,7 +83,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/capsule' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/capsule' ) ); option.onClick( function () { const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8 ); @@ -100,7 +100,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/circle' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/circle' ) ); option.onClick( function () { const geometry = new THREE.CircleGeometry( 1, 32, 0, Math.PI * 2 ); @@ -116,7 +116,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/cylinder' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/cylinder' ) ); option.onClick( function () { const geometry = new THREE.CylinderGeometry( 1, 1, 1, 32, 1, false, 0, Math.PI * 2 ); @@ -132,7 +132,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/dodecahedron' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/dodecahedron' ) ); option.onClick( function () { const geometry = new THREE.DodecahedronGeometry( 1, 0 ); @@ -148,7 +148,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/icosahedron' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/icosahedron' ) ); option.onClick( function () { const geometry = new THREE.IcosahedronGeometry( 1, 0 ); @@ -164,7 +164,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/lathe' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/lathe' ) ); option.onClick( function () { const geometry = new THREE.LatheGeometry(); @@ -180,7 +180,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/octahedron' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/octahedron' ) ); option.onClick( function () { const geometry = new THREE.OctahedronGeometry( 1, 0 ); @@ -196,7 +196,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/plane' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/plane' ) ); option.onClick( function () { const geometry = new THREE.PlaneGeometry( 1, 1, 1, 1 ); @@ -213,7 +213,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/ring' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/ring' ) ); option.onClick( function () { const geometry = new THREE.RingGeometry( 0.5, 1, 32, 1, 0, Math.PI * 2 ); @@ -229,7 +229,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/sphere' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/sphere' ) ); option.onClick( function () { const geometry = new THREE.SphereGeometry( 1, 32, 16, 0, Math.PI * 2, 0, Math.PI ); @@ -245,7 +245,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/sprite' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/sprite' ) ); option.onClick( function () { const sprite = new THREE.Sprite( new THREE.SpriteMaterial() ); @@ -260,7 +260,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/tetrahedron' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/tetrahedron' ) ); option.onClick( function () { const geometry = new THREE.TetrahedronGeometry( 1, 0 ); @@ -276,7 +276,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/torus' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/torus' ) ); option.onClick( function () { const geometry = new THREE.TorusGeometry( 1, 0.4, 12, 48, Math.PI * 2 ); @@ -292,7 +292,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/torusknot' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/torusknot' ) ); option.onClick( function () { const geometry = new THREE.TorusKnotGeometry( 1, 0.4, 64, 8, 2, 3 ); @@ -308,7 +308,7 @@ function MenubarAdd( editor ) { option = new UIRow(); option.setClass( 'option' ); - option.setTextContent( strings.getKey( 'menubar/add/tube' ) ); + option.setTextContent( strings.getKey( 'menubar/add/mesh/tube' ) ); option.onClick( function () { const path = new THREE.CatmullRomCurve3( [ diff --git a/editor/js/Strings.js b/editor/js/Strings.js index a47c9ff0dbc90f..cf913af2ac88a6 100644 --- a/editor/js/Strings.js +++ b/editor/js/Strings.js @@ -51,28 +51,31 @@ function Strings( config ) { 'menubar/add': 'Add', 'menubar/add/group': 'Group', + 'menubar/add/mesh': 'Mesh', - 'menubar/add/plane': 'Plane', - 'menubar/add/box': 'Box', - 'menubar/add/capsule': 'Capsule', - 'menubar/add/circle': 'Circle', - 'menubar/add/cylinder': 'Cylinder', - 'menubar/add/ring': 'Ring', - 'menubar/add/sphere': 'Sphere', - 'menubar/add/dodecahedron': 'Dodecahedron', - 'menubar/add/icosahedron': 'Icosahedron', - 'menubar/add/octahedron': 'Octahedron', - 'menubar/add/tetrahedron': 'Tetrahedron', - 'menubar/add/torus': 'Torus', - 'menubar/add/tube': 'Tube', - 'menubar/add/torusknot': 'TorusKnot', - 'menubar/add/lathe': 'Lathe', - 'menubar/add/sprite': 'Sprite', + 'menubar/add/mesh/plane': 'Plane', + 'menubar/add/mesh/box': 'Box', + 'menubar/add/mesh/capsule': 'Capsule', + 'menubar/add/mesh/circle': 'Circle', + 'menubar/add/mesh/cylinder': 'Cylinder', + 'menubar/add/mesh/ring': 'Ring', + 'menubar/add/mesh/sphere': 'Sphere', + 'menubar/add/mesh/dodecahedron': 'Dodecahedron', + 'menubar/add/mesh/icosahedron': 'Icosahedron', + 'menubar/add/mesh/octahedron': 'Octahedron', + 'menubar/add/mesh/tetrahedron': 'Tetrahedron', + 'menubar/add/mesh/torus': 'Torus', + 'menubar/add/mesh/tube': 'Tube', + 'menubar/add/mesh/torusknot': 'TorusKnot', + 'menubar/add/mesh/lathe': 'Lathe', + 'menubar/add/mesh/sprite': 'Sprite', + 'menubar/add/pointlight': 'PointLight', 'menubar/add/spotlight': 'SpotLight', 'menubar/add/directionallight': 'DirectionalLight', 'menubar/add/hemispherelight': 'HemisphereLight', 'menubar/add/ambientlight': 'AmbientLight', + 'menubar/add/perspectivecamera': 'PerspectiveCamera', 'menubar/add/orthographiccamera': 'OrthographicCamera', @@ -431,28 +434,31 @@ function Strings( config ) { 'menubar/add': 'Ajouter', 'menubar/add/group': 'Groupe', + 'menubar/add/mesh': 'Maille', - 'menubar/add/plane': 'Plan', - 'menubar/add/box': 'Cube', - 'menubar/add/capsule': 'Capsule', - 'menubar/add/circle': 'Cercle', - 'menubar/add/cylinder': 'Cylindre', - 'menubar/add/ring': 'Bague', - 'menubar/add/sphere': 'Sphère', - 'menubar/add/dodecahedron': 'Dodécaèdre', - 'menubar/add/icosahedron': 'Icosaèdre', - 'menubar/add/octahedron': 'Octaèdre', - 'menubar/add/tetrahedron': 'Tétraèdre', - 'menubar/add/torus': 'Torus', - 'menubar/add/tube': 'Tube', - 'menubar/add/torusknot': 'Noeud Torus', - 'menubar/add/lathe': 'Tour', - 'menubar/add/sprite': 'Sprite', + 'menubar/add/mesh/plane': 'Plan', + 'menubar/add/mesh/box': 'Cube', + 'menubar/add/mesh/capsule': 'Capsule', + 'menubar/add/mesh/circle': 'Cercle', + 'menubar/add/mesh/cylinder': 'Cylindre', + 'menubar/add/mesh/ring': 'Bague', + 'menubar/add/mesh/sphere': 'Sphère', + 'menubar/add/mesh/dodecahedron': 'Dodécaèdre', + 'menubar/add/mesh/icosahedron': 'Icosaèdre', + 'menubar/add/mesh/octahedron': 'Octaèdre', + 'menubar/add/mesh/tetrahedron': 'Tétraèdre', + 'menubar/add/mesh/torus': 'Torus', + 'menubar/add/mesh/tube': 'Tube', + 'menubar/add/mesh/torusknot': 'Noeud Torus', + 'menubar/add/mesh/lathe': 'Tour', + 'menubar/add/mesh/sprite': 'Sprite', + 'menubar/add/pointlight': 'Lumière ponctuelle', 'menubar/add/spotlight': 'Projecteur', 'menubar/add/directionallight': 'Lumière directionnelle', 'menubar/add/hemispherelight': 'Lumière hémisphérique', 'menubar/add/ambientlight': 'Lumière ambiante', + 'menubar/add/perspectivecamera': 'Caméra perspective', 'menubar/add/orthographiccamera': 'Caméra orthographique', @@ -811,28 +817,31 @@ function Strings( config ) { 'menubar/add': '添加', 'menubar/add/group': '组', + 'menubar/add/mesh': '网格', - 'menubar/add/plane': '平面', - 'menubar/add/box': '正方体', - 'menubar/add/capsule': '胶囊', - 'menubar/add/circle': '圆', - 'menubar/add/cylinder': '圆柱体', - 'menubar/add/ring': '环', - 'menubar/add/sphere': '球体', - 'menubar/add/dodecahedron': '十二面体', - 'menubar/add/icosahedron': '二十面体', - 'menubar/add/octahedron': '八面体', - 'menubar/add/tetrahedron': '四面体', - 'menubar/add/torus': '圆环体', - 'menubar/add/torusknot': '环面纽结体', - 'menubar/add/tube': '管', - 'menubar/add/lathe': '酒杯', - 'menubar/add/sprite': '精灵', + 'menubar/add/mesh/plane': '平面', + 'menubar/add/mesh/box': '正方体', + 'menubar/add/mesh/capsule': '胶囊', + 'menubar/add/mesh/circle': '圆', + 'menubar/add/mesh/cylinder': '圆柱体', + 'menubar/add/mesh/ring': '环', + 'menubar/add/mesh/sphere': '球体', + 'menubar/add/mesh/dodecahedron': '十二面体', + 'menubar/add/mesh/icosahedron': '二十面体', + 'menubar/add/mesh/octahedron': '八面体', + 'menubar/add/mesh/tetrahedron': '四面体', + 'menubar/add/mesh/torus': '圆环体', + 'menubar/add/mesh/torusknot': '环面纽结体', + 'menubar/add/mesh/tube': '管', + 'menubar/add/mesh/lathe': '酒杯', + 'menubar/add/mesh/sprite': '精灵', + 'menubar/add/pointlight': '点光源', 'menubar/add/spotlight': '聚光灯', 'menubar/add/directionallight': '平行光', 'menubar/add/hemispherelight': '半球光', 'menubar/add/ambientlight': '环境光', + 'menubar/add/perspectivecamera': '透视相机', 'menubar/add/orthographiccamera': '正交相机', @@ -1191,28 +1200,31 @@ function Strings( config ) { 'menubar/add': '追加', 'menubar/add/group': 'グループ', + 'menubar/add/mesh': 'メッシュ', - 'menubar/add/plane': '平面', - 'menubar/add/box': '直方体', - 'menubar/add/capsule': 'カプセル', - 'menubar/add/circle': '円', - 'menubar/add/cylinder': '円柱', - 'menubar/add/ring': 'リング', - 'menubar/add/sphere': '球', - 'menubar/add/dodecahedron': '十二面体', - 'menubar/add/icosahedron': '二十面体', - 'menubar/add/octahedron': '八面体', - 'menubar/add/tetrahedron': '四面体', - 'menubar/add/torus': 'トーラス', - 'menubar/add/tube': 'チューブ', - 'menubar/add/torusknot': 'ノットトーラス', - 'menubar/add/lathe': '旋盤形', - 'menubar/add/sprite': 'スプライト', + 'menubar/add/mesh/plane': '平面', + 'menubar/add/mesh/box': '直方体', + 'menubar/add/mesh/capsule': 'カプセル', + 'menubar/add/mesh/circle': '円', + 'menubar/add/mesh/cylinder': '円柱', + 'menubar/add/mesh/ring': 'リング', + 'menubar/add/mesh/sphere': '球', + 'menubar/add/mesh/dodecahedron': '十二面体', + 'menubar/add/mesh/icosahedron': '二十面体', + 'menubar/add/mesh/octahedron': '八面体', + 'menubar/add/mesh/tetrahedron': '四面体', + 'menubar/add/mesh/torus': 'トーラス', + 'menubar/add/mesh/tube': 'チューブ', + 'menubar/add/mesh/torusknot': 'ノットトーラス', + 'menubar/add/mesh/lathe': '旋盤形', + 'menubar/add/mesh/sprite': 'スプライト', + 'menubar/add/pointlight': 'ポイントライト', 'menubar/add/spotlight': 'スポットライト', 'menubar/add/directionallight': 'ディレクショナルライト', 'menubar/add/hemispherelight': 'ヘミスフィアライト', 'menubar/add/ambientlight': 'アンビエントライト', + 'menubar/add/perspectivecamera': '透視投影カメラ', 'menubar/add/orthographiccamera': '平行投影カメラ',