@thanhthbm/scene-editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/dist/index.css +921 -0
- package/dist/index.js +14076 -0
- package/package.json +49 -0
- package/src/editor/css/main.css +1030 -0
- package/src/editor/js/Animation.js +618 -0
- package/src/editor/js/AnimationResizer.js +73 -0
- package/src/editor/js/Command.js +40 -0
- package/src/editor/js/Config.js +86 -0
- package/src/editor/js/Editor.js +1006 -0
- package/src/editor/js/EditorControls.js +489 -0
- package/src/editor/js/GLTFImportDialog.js +112 -0
- package/src/editor/js/History.js +321 -0
- package/src/editor/js/Loader.js +1162 -0
- package/src/editor/js/LoaderUtils.js +90 -0
- package/src/editor/js/Menubar.Add.js +559 -0
- package/src/editor/js/Menubar.Edit.js +155 -0
- package/src/editor/js/Menubar.File.js +585 -0
- package/src/editor/js/Menubar.Help.js +73 -0
- package/src/editor/js/Menubar.Render.js +858 -0
- package/src/editor/js/Menubar.Status.js +51 -0
- package/src/editor/js/Menubar.View.js +193 -0
- package/src/editor/js/Menubar.js +29 -0
- package/src/editor/js/Player.js +53 -0
- package/src/editor/js/Resizer.js +65 -0
- package/src/editor/js/Script.js +532 -0
- package/src/editor/js/Selector.js +129 -0
- package/src/editor/js/Sidebar.Geometry.BoxGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.BufferGeometry.js +124 -0
- package/src/editor/js/Sidebar.Geometry.CapsuleGeometry.js +109 -0
- package/src/editor/js/Sidebar.Geometry.CircleGeometry.js +97 -0
- package/src/editor/js/Sidebar.Geometry.CylinderGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.DodecahedronGeometry.js +73 -0
- package/src/editor/js/Sidebar.Geometry.ExtrudeGeometry.js +196 -0
- package/src/editor/js/Sidebar.Geometry.IcosahedronGeometry.js +73 -0
- package/src/editor/js/Sidebar.Geometry.LatheGeometry.js +98 -0
- package/src/editor/js/Sidebar.Geometry.Modifiers.js +73 -0
- package/src/editor/js/Sidebar.Geometry.OctahedronGeometry.js +74 -0
- package/src/editor/js/Sidebar.Geometry.PlaneGeometry.js +97 -0
- package/src/editor/js/Sidebar.Geometry.RingGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.ShapeGeometry.js +76 -0
- package/src/editor/js/Sidebar.Geometry.SphereGeometry.js +133 -0
- package/src/editor/js/Sidebar.Geometry.TetrahedronGeometry.js +74 -0
- package/src/editor/js/Sidebar.Geometry.TextGeometry.js +136 -0
- package/src/editor/js/Sidebar.Geometry.TorusGeometry.js +109 -0
- package/src/editor/js/Sidebar.Geometry.TorusKnotGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.TubeGeometry.js +135 -0
- package/src/editor/js/Sidebar.Geometry.js +471 -0
- package/src/editor/js/Sidebar.Material.BooleanProperty.js +60 -0
- package/src/editor/js/Sidebar.Material.ColorProperty.js +87 -0
- package/src/editor/js/Sidebar.Material.ConstantProperty.js +62 -0
- package/src/editor/js/Sidebar.Material.MapProperty.js +277 -0
- package/src/editor/js/Sidebar.Material.NumberProperty.js +60 -0
- package/src/editor/js/Sidebar.Material.Program.js +73 -0
- package/src/editor/js/Sidebar.Material.RangeValueProperty.js +63 -0
- package/src/editor/js/Sidebar.Material.js +751 -0
- package/src/editor/js/Sidebar.Object.js +892 -0
- package/src/editor/js/Sidebar.Project.App.js +218 -0
- package/src/editor/js/Sidebar.Project.Materials.js +82 -0
- package/src/editor/js/Sidebar.Project.Renderer.js +193 -0
- package/src/editor/js/Sidebar.Project.Resources.js +242 -0
- package/src/editor/js/Sidebar.Project.js +21 -0
- package/src/editor/js/Sidebar.Properties.js +73 -0
- package/src/editor/js/Sidebar.Scene.js +643 -0
- package/src/editor/js/Sidebar.Script.js +129 -0
- package/src/editor/js/Sidebar.Settings.History.js +146 -0
- package/src/editor/js/Sidebar.Settings.Shortcuts.js +198 -0
- package/src/editor/js/Sidebar.Settings.js +58 -0
- package/src/editor/js/Sidebar.js +41 -0
- package/src/editor/js/Storage.js +98 -0
- package/src/editor/js/Strings.js +2718 -0
- package/src/editor/js/TextureParametersDialog.js +293 -0
- package/src/editor/js/Toolbar.js +75 -0
- package/src/editor/js/Viewport.Controls.js +98 -0
- package/src/editor/js/Viewport.Info.js +144 -0
- package/src/editor/js/Viewport.Pathtracer.js +27 -0
- package/src/editor/js/Viewport.ViewHelper.js +41 -0
- package/src/editor/js/Viewport.XR.js +7 -0
- package/src/editor/js/Viewport.js +982 -0
- package/src/editor/js/commands/AddObjectCommand.js +68 -0
- package/src/editor/js/commands/AddScriptCommand.js +75 -0
- package/src/editor/js/commands/Commands.js +24 -0
- package/src/editor/js/commands/MoveObjectCommand.js +117 -0
- package/src/editor/js/commands/MultiCmdsCommand.js +85 -0
- package/src/editor/js/commands/RemoveObjectCommand.js +88 -0
- package/src/editor/js/commands/RemoveScriptCommand.js +81 -0
- package/src/editor/js/commands/SetColorCommand.js +73 -0
- package/src/editor/js/commands/SetGeometryCommand.js +86 -0
- package/src/editor/js/commands/SetGeometryValueCommand.js +70 -0
- package/src/editor/js/commands/SetMaterialColorCommand.js +87 -0
- package/src/editor/js/commands/SetMaterialCommand.js +80 -0
- package/src/editor/js/commands/SetMaterialMapCommand.js +144 -0
- package/src/editor/js/commands/SetMaterialRangeCommand.js +92 -0
- package/src/editor/js/commands/SetMaterialValueCommand.js +91 -0
- package/src/editor/js/commands/SetMaterialVectorCommand.js +88 -0
- package/src/editor/js/commands/SetPositionCommand.js +84 -0
- package/src/editor/js/commands/SetRotationCommand.js +84 -0
- package/src/editor/js/commands/SetScaleCommand.js +84 -0
- package/src/editor/js/commands/SetSceneCommand.js +104 -0
- package/src/editor/js/commands/SetScriptValueCommand.js +80 -0
- package/src/editor/js/commands/SetShadowValueCommand.js +73 -0
- package/src/editor/js/commands/SetTextureParametersCommand.js +143 -0
- package/src/editor/js/commands/SetUuidCommand.js +70 -0
- package/src/editor/js/commands/SetValueCommand.js +75 -0
- package/src/editor/js/libs/acorn/acorn.js +3236 -0
- package/src/editor/js/libs/acorn/acorn_loose.js +1299 -0
- package/src/editor/js/libs/acorn/walk.js +344 -0
- package/src/editor/js/libs/app/index.html +51 -0
- package/src/editor/js/libs/app.js +14 -0
- package/src/editor/js/libs/codemirror/addon/dialog.css +32 -0
- package/src/editor/js/libs/codemirror/addon/dialog.js +163 -0
- package/src/editor/js/libs/codemirror/addon/show-hint.css +36 -0
- package/src/editor/js/libs/codemirror/addon/show-hint.js +529 -0
- package/src/editor/js/libs/codemirror/addon/tern.css +87 -0
- package/src/editor/js/libs/codemirror/addon/tern.js +750 -0
- package/src/editor/js/libs/codemirror/codemirror.css +344 -0
- package/src/editor/js/libs/codemirror/codemirror.js +9849 -0
- package/src/editor/js/libs/codemirror/mode/glsl.js +233 -0
- package/src/editor/js/libs/codemirror/mode/javascript.js +959 -0
- package/src/editor/js/libs/codemirror/theme/monokai.css +41 -0
- package/src/editor/js/libs/esprima.js +6401 -0
- package/src/editor/js/libs/jsonlint.js +453 -0
- package/src/editor/js/libs/signals.min.js +14 -0
- package/src/editor/js/libs/tern-threejs/build-defs.js +233 -0
- package/src/editor/js/libs/ternjs/comment.js +87 -0
- package/src/editor/js/libs/ternjs/def.js +588 -0
- package/src/editor/js/libs/ternjs/doc_comment.js +401 -0
- package/src/editor/js/libs/ternjs/infer.js +1635 -0
- package/src/editor/js/libs/ternjs/polyfill.js +80 -0
- package/src/editor/js/libs/ternjs/signal.js +26 -0
- package/src/editor/js/libs/ternjs/tern.js +993 -0
- package/src/editor/js/libs/ui.js +1305 -0
- package/src/editor/js/libs/ui.three.js +946 -0
- package/src/events.js +273 -0
- package/src/index.js +284 -0
- package/src/presets/machines.js +239 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { UIPanel, UIText, UITabbedPanel, UIListbox, UIButton } from './libs/ui.js';
|
|
2
|
+
|
|
3
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
4
|
+
import { SetMaterialCommand } from './commands/SetMaterialCommand.js';
|
|
5
|
+
|
|
6
|
+
function SidebarProjectResources( editor ) {
|
|
7
|
+
|
|
8
|
+
const signals = editor.signals;
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
|
|
11
|
+
const container = new UITabbedPanel();
|
|
12
|
+
|
|
13
|
+
// Geometries
|
|
14
|
+
|
|
15
|
+
const geometriesTab = new UIPanel();
|
|
16
|
+
geometriesTab.dom.style.borderTop = 'none';
|
|
17
|
+
const geometriesListbox = new UIListbox();
|
|
18
|
+
geometriesListbox.dom.style.height = '140px';
|
|
19
|
+
geometriesListbox.dom.style.resize = 'vertical';
|
|
20
|
+
geometriesListbox.dom.style.marginBottom = '10px';
|
|
21
|
+
geometriesTab.add( geometriesListbox );
|
|
22
|
+
|
|
23
|
+
const geometriesAssign = new UIButton( strings.getKey( 'sidebar/project/Assign' ) );
|
|
24
|
+
geometriesTab.add( geometriesAssign );
|
|
25
|
+
|
|
26
|
+
const geometriesInfo = new UIText();
|
|
27
|
+
geometriesInfo.dom.style.float = 'right';
|
|
28
|
+
geometriesTab.add( geometriesInfo );
|
|
29
|
+
geometriesAssign.onClick( function () {
|
|
30
|
+
|
|
31
|
+
const selectedObject = editor.selected;
|
|
32
|
+
|
|
33
|
+
if ( selectedObject !== null && selectedObject.geometry !== undefined ) {
|
|
34
|
+
|
|
35
|
+
const selectedId = geometriesListbox.getValue();
|
|
36
|
+
const geometries = Object.values( editor.geometries );
|
|
37
|
+
const geometry = geometries.find( g => g.id === parseInt( selectedId ) );
|
|
38
|
+
|
|
39
|
+
if ( geometry !== undefined ) {
|
|
40
|
+
|
|
41
|
+
editor.execute( new SetGeometryCommand( editor, selectedObject, geometry ) );
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
} );
|
|
48
|
+
|
|
49
|
+
container.addTab( 'geometries', strings.getKey( 'sidebar/project/geometries' ), geometriesTab );
|
|
50
|
+
|
|
51
|
+
// Materials
|
|
52
|
+
|
|
53
|
+
const materialsTab = new UIPanel();
|
|
54
|
+
materialsTab.dom.style.borderTop = 'none';
|
|
55
|
+
const materialsListbox = new UIListbox();
|
|
56
|
+
materialsListbox.dom.style.height = '140px';
|
|
57
|
+
materialsListbox.dom.style.resize = 'vertical';
|
|
58
|
+
materialsListbox.dom.style.marginBottom = '10px';
|
|
59
|
+
materialsTab.add( materialsListbox );
|
|
60
|
+
|
|
61
|
+
const materialsAssign = new UIButton( strings.getKey( 'sidebar/project/Assign' ) );
|
|
62
|
+
materialsTab.add( materialsAssign );
|
|
63
|
+
|
|
64
|
+
const materialsInfo = new UIText();
|
|
65
|
+
materialsInfo.dom.style.float = 'right';
|
|
66
|
+
materialsTab.add( materialsInfo );
|
|
67
|
+
|
|
68
|
+
materialsAssign.onClick( function () {
|
|
69
|
+
|
|
70
|
+
const selectedObject = editor.selected;
|
|
71
|
+
|
|
72
|
+
if ( selectedObject !== null && selectedObject.material !== undefined ) {
|
|
73
|
+
|
|
74
|
+
const selectedId = materialsListbox.getValue();
|
|
75
|
+
const materials = Object.values( editor.materials );
|
|
76
|
+
const material = materials.find( m => m.id === parseInt( selectedId ) );
|
|
77
|
+
|
|
78
|
+
if ( material !== undefined ) {
|
|
79
|
+
|
|
80
|
+
editor.execute( new SetMaterialCommand( editor, selectedObject, material ) );
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
} );
|
|
87
|
+
|
|
88
|
+
container.addTab( 'materials', strings.getKey( 'sidebar/project/materials' ), materialsTab );
|
|
89
|
+
|
|
90
|
+
// Textures
|
|
91
|
+
|
|
92
|
+
const texturesTab = new UIPanel();
|
|
93
|
+
texturesTab.dom.style.borderTop = 'none';
|
|
94
|
+
const texturesListbox = new UIListbox();
|
|
95
|
+
texturesListbox.dom.style.height = '140px';
|
|
96
|
+
texturesListbox.dom.style.resize = 'vertical';
|
|
97
|
+
texturesListbox.dom.style.marginBottom = '10px';
|
|
98
|
+
texturesTab.add( texturesListbox );
|
|
99
|
+
|
|
100
|
+
const texturesInfo = new UIText();
|
|
101
|
+
texturesInfo.dom.style.float = 'right';
|
|
102
|
+
texturesTab.add( texturesInfo );
|
|
103
|
+
|
|
104
|
+
container.addTab( 'textures', strings.getKey( 'sidebar/project/textures' ), texturesTab );
|
|
105
|
+
|
|
106
|
+
container.select( 'geometries' );
|
|
107
|
+
|
|
108
|
+
// Signals
|
|
109
|
+
|
|
110
|
+
function refreshGeometriesUI() {
|
|
111
|
+
|
|
112
|
+
const geometries = Object.values( editor.geometries );
|
|
113
|
+
|
|
114
|
+
geometriesListbox.setItems( geometries );
|
|
115
|
+
geometriesInfo.setValue( geometries.length + ' ' + strings.getKey( 'sidebar/project/geometries' ).toLowerCase() );
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function refreshMaterialsUI() {
|
|
120
|
+
|
|
121
|
+
const materials = Object.values( editor.materials );
|
|
122
|
+
|
|
123
|
+
materialsListbox.setItems( materials );
|
|
124
|
+
materialsInfo.setValue( materials.length + ' ' + strings.getKey( 'sidebar/project/materials' ).toLowerCase() );
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function refreshTexturesUI() {
|
|
129
|
+
|
|
130
|
+
const textures = [];
|
|
131
|
+
const types = [];
|
|
132
|
+
const texturesUsed = new Set();
|
|
133
|
+
|
|
134
|
+
const materials = Object.values( editor.materials );
|
|
135
|
+
|
|
136
|
+
for ( const material of materials ) {
|
|
137
|
+
|
|
138
|
+
for ( const property in material ) {
|
|
139
|
+
|
|
140
|
+
const value = material[ property ];
|
|
141
|
+
|
|
142
|
+
if ( value !== null && value !== undefined && value.isTexture === true ) {
|
|
143
|
+
|
|
144
|
+
if ( texturesUsed.has( value.uuid ) === false ) {
|
|
145
|
+
|
|
146
|
+
textures.push( value );
|
|
147
|
+
types.push( getTextureType( value ) );
|
|
148
|
+
texturesUsed.add( value.uuid );
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
texturesListbox.setItems( textures, types );
|
|
159
|
+
texturesInfo.setValue( textures.length + ' ' + strings.getKey( 'sidebar/project/textures' ).toLowerCase() );
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function getTextureType( texture ) {
|
|
164
|
+
|
|
165
|
+
if ( texture.isCanvasTexture ) return 'CanvasTexture';
|
|
166
|
+
if ( texture.isVideoTexture ) return 'VideoTexture';
|
|
167
|
+
if ( texture.isCubeDepthTexture ) return 'CubeDepthTexture';
|
|
168
|
+
if ( texture.isDepthTexture ) return 'DepthTexture';
|
|
169
|
+
if ( texture.isCompressedArrayTexture ) return 'CompressedArrayTexture';
|
|
170
|
+
if ( texture.isCompressedCubeTexture ) return 'CompressedCubeTexture';
|
|
171
|
+
if ( texture.isCompressedTexture ) return 'CompressedTexture';
|
|
172
|
+
if ( texture.isCubeTexture ) return 'CubeTexture';
|
|
173
|
+
if ( texture.isData3DTexture ) return 'Data3DTexture';
|
|
174
|
+
if ( texture.isDataArrayTexture ) return 'DataArrayTexture';
|
|
175
|
+
if ( texture.isDataTexture ) return 'DataTexture';
|
|
176
|
+
if ( texture.isFramebufferTexture ) return 'FramebufferTexture';
|
|
177
|
+
|
|
178
|
+
return 'Texture';
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function refreshUI() {
|
|
183
|
+
|
|
184
|
+
refreshGeometriesUI();
|
|
185
|
+
refreshMaterialsUI();
|
|
186
|
+
refreshTexturesUI();
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
let timeout;
|
|
191
|
+
|
|
192
|
+
function refreshUIDelayed() {
|
|
193
|
+
|
|
194
|
+
clearTimeout( timeout );
|
|
195
|
+
|
|
196
|
+
timeout = setTimeout( refreshUI, 100 );
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
signals.editorCleared.add( refreshUIDelayed );
|
|
201
|
+
signals.sceneGraphChanged.add( refreshUIDelayed );
|
|
202
|
+
signals.geometryChanged.add( refreshUIDelayed );
|
|
203
|
+
signals.materialAdded.add( refreshUIDelayed );
|
|
204
|
+
signals.materialChanged.add( refreshUIDelayed );
|
|
205
|
+
signals.materialRemoved.add( refreshUIDelayed );
|
|
206
|
+
|
|
207
|
+
signals.objectSelected.add( function ( object ) {
|
|
208
|
+
|
|
209
|
+
if ( object !== null ) {
|
|
210
|
+
|
|
211
|
+
const geometries = Object.values( editor.geometries );
|
|
212
|
+
const materials = Object.values( editor.materials );
|
|
213
|
+
|
|
214
|
+
if ( object.geometry !== undefined ) {
|
|
215
|
+
|
|
216
|
+
const geometryIndex = geometries.indexOf( object.geometry );
|
|
217
|
+
geometriesListbox.selectIndex( geometryIndex );
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if ( object.material !== undefined ) {
|
|
222
|
+
|
|
223
|
+
const material = Array.isArray( object.material ) ? object.material[ 0 ] : object.material;
|
|
224
|
+
const materialIndex = materials.indexOf( material );
|
|
225
|
+
materialsListbox.selectIndex( materialIndex );
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
} else {
|
|
230
|
+
|
|
231
|
+
geometriesListbox.selectIndex( - 1 );
|
|
232
|
+
materialsListbox.selectIndex( - 1 );
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
} );
|
|
237
|
+
|
|
238
|
+
return container;
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export { SidebarProjectResources };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UISpan } from './libs/ui.js';
|
|
2
|
+
|
|
3
|
+
import { SidebarProjectApp } from './Sidebar.Project.App.js';
|
|
4
|
+
import { SidebarProjectRenderer } from './Sidebar.Project.Renderer.js';
|
|
5
|
+
import { SidebarProjectResources } from './Sidebar.Project.Resources.js';
|
|
6
|
+
|
|
7
|
+
function SidebarProject( editor ) {
|
|
8
|
+
|
|
9
|
+
const container = new UISpan();
|
|
10
|
+
|
|
11
|
+
container.add( new SidebarProjectRenderer( editor ) );
|
|
12
|
+
|
|
13
|
+
container.add( new SidebarProjectApp( editor ) );
|
|
14
|
+
|
|
15
|
+
container.add( new SidebarProjectResources( editor ) );
|
|
16
|
+
|
|
17
|
+
return container;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { SidebarProject };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { UITabbedPanel } from './libs/ui.js';
|
|
2
|
+
|
|
3
|
+
import { SidebarObject } from './Sidebar.Object.js';
|
|
4
|
+
import { SidebarGeometry } from './Sidebar.Geometry.js';
|
|
5
|
+
import { SidebarMaterial } from './Sidebar.Material.js';
|
|
6
|
+
import { SidebarScript } from './Sidebar.Script.js';
|
|
7
|
+
|
|
8
|
+
function SidebarProperties( editor ) {
|
|
9
|
+
|
|
10
|
+
const strings = editor.strings;
|
|
11
|
+
|
|
12
|
+
const container = new UITabbedPanel();
|
|
13
|
+
container.setId( 'properties' );
|
|
14
|
+
|
|
15
|
+
container.addTab( 'objectTab', strings.getKey( 'sidebar/properties/object' ), new SidebarObject( editor ) );
|
|
16
|
+
container.addTab( 'geometryTab', strings.getKey( 'sidebar/properties/geometry' ), new SidebarGeometry( editor ) );
|
|
17
|
+
container.addTab( 'materialTab', strings.getKey( 'sidebar/properties/material' ), new SidebarMaterial( editor ) );
|
|
18
|
+
container.addTab( 'scriptTab', strings.getKey( 'sidebar/properties/script' ), new SidebarScript( editor ) );
|
|
19
|
+
container.select( 'objectTab' );
|
|
20
|
+
|
|
21
|
+
function getTabByTabId( tabs, tabId ) {
|
|
22
|
+
|
|
23
|
+
return tabs.find( function ( tab ) {
|
|
24
|
+
|
|
25
|
+
return tab.dom.id === tabId;
|
|
26
|
+
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const geometryTab = getTabByTabId( container.tabs, 'geometryTab' );
|
|
32
|
+
const materialTab = getTabByTabId( container.tabs, 'materialTab' );
|
|
33
|
+
const scriptTab = getTabByTabId( container.tabs, 'scriptTab' );
|
|
34
|
+
|
|
35
|
+
function toggleTabs( object ) {
|
|
36
|
+
|
|
37
|
+
container.setHidden( object === null );
|
|
38
|
+
|
|
39
|
+
if ( object === null ) return;
|
|
40
|
+
|
|
41
|
+
geometryTab.setHidden( ! object.geometry );
|
|
42
|
+
|
|
43
|
+
materialTab.setHidden( ! object.material );
|
|
44
|
+
|
|
45
|
+
scriptTab.setHidden( object === editor.camera );
|
|
46
|
+
|
|
47
|
+
// set active tab
|
|
48
|
+
|
|
49
|
+
if ( container.selected === 'geometryTab' ) {
|
|
50
|
+
|
|
51
|
+
container.select( geometryTab.isHidden() ? 'objectTab' : 'geometryTab' );
|
|
52
|
+
|
|
53
|
+
} else if ( container.selected === 'materialTab' ) {
|
|
54
|
+
|
|
55
|
+
container.select( materialTab.isHidden() ? 'objectTab' : 'materialTab' );
|
|
56
|
+
|
|
57
|
+
} else if ( container.selected === 'scriptTab' ) {
|
|
58
|
+
|
|
59
|
+
container.select( scriptTab.isHidden() ? 'objectTab' : 'scriptTab' );
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
editor.signals.objectSelected.add( toggleTabs );
|
|
66
|
+
|
|
67
|
+
toggleTabs( editor.selected );
|
|
68
|
+
|
|
69
|
+
return container;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { SidebarProperties };
|