@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,892 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIPanel, UIRow, UIInput, UIButton, UIColor, UICheckbox, UIInteger, UITextArea, UIText, UINumber } from './libs/ui.js';
|
|
4
|
+
import { UIBoolean } from './libs/ui.three.js';
|
|
5
|
+
|
|
6
|
+
import { SetUuidCommand } from './commands/SetUuidCommand.js';
|
|
7
|
+
import { SetValueCommand } from './commands/SetValueCommand.js';
|
|
8
|
+
import { SetPositionCommand } from './commands/SetPositionCommand.js';
|
|
9
|
+
import { SetRotationCommand } from './commands/SetRotationCommand.js';
|
|
10
|
+
import { SetScaleCommand } from './commands/SetScaleCommand.js';
|
|
11
|
+
import { SetColorCommand } from './commands/SetColorCommand.js';
|
|
12
|
+
import { SetShadowValueCommand } from './commands/SetShadowValueCommand.js';
|
|
13
|
+
|
|
14
|
+
function SidebarObject( editor ) {
|
|
15
|
+
|
|
16
|
+
const strings = editor.strings;
|
|
17
|
+
|
|
18
|
+
const signals = editor.signals;
|
|
19
|
+
|
|
20
|
+
const container = new UIPanel();
|
|
21
|
+
container.setBorderTop( '0' );
|
|
22
|
+
container.setPaddingTop( '20px' );
|
|
23
|
+
container.setDisplay( 'none' );
|
|
24
|
+
|
|
25
|
+
// Actions
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
let objectActions = new UI.Select().setPosition( 'absolute' ).setRight( '8px' ).setFontSize( '11px' );
|
|
29
|
+
objectActions.setOptions( {
|
|
30
|
+
|
|
31
|
+
'Actions': 'Actions',
|
|
32
|
+
'Reset Position': 'Reset Position',
|
|
33
|
+
'Reset Rotation': 'Reset Rotation',
|
|
34
|
+
'Reset Scale': 'Reset Scale'
|
|
35
|
+
|
|
36
|
+
} );
|
|
37
|
+
objectActions.onClick( function ( event ) {
|
|
38
|
+
|
|
39
|
+
event.stopPropagation(); // Avoid panel collapsing
|
|
40
|
+
|
|
41
|
+
} );
|
|
42
|
+
objectActions.onChange( function ( event ) {
|
|
43
|
+
|
|
44
|
+
let object = editor.selected;
|
|
45
|
+
|
|
46
|
+
switch ( this.getValue() ) {
|
|
47
|
+
|
|
48
|
+
case 'Reset Position':
|
|
49
|
+
editor.execute( new SetPositionCommand( editor, object, new Vector3( 0, 0, 0 ) ) );
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
case 'Reset Rotation':
|
|
53
|
+
editor.execute( new SetRotationCommand( editor, object, new Euler( 0, 0, 0 ) ) );
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
case 'Reset Scale':
|
|
57
|
+
editor.execute( new SetScaleCommand( editor, object, new Vector3( 1, 1, 1 ) ) );
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.setValue( 'Actions' );
|
|
63
|
+
|
|
64
|
+
} );
|
|
65
|
+
container.addStatic( objectActions );
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
// type
|
|
69
|
+
|
|
70
|
+
const objectTypeRow = new UIRow();
|
|
71
|
+
const objectType = new UIText();
|
|
72
|
+
|
|
73
|
+
objectTypeRow.add( new UIText( strings.getKey( 'sidebar/object/type' ) ).setClass( 'Label' ) );
|
|
74
|
+
objectTypeRow.add( objectType );
|
|
75
|
+
|
|
76
|
+
container.add( objectTypeRow );
|
|
77
|
+
|
|
78
|
+
// uuid
|
|
79
|
+
|
|
80
|
+
const objectUUIDRow = new UIRow();
|
|
81
|
+
const objectUUID = new UIInput().setWidth( '102px' ).setFontSize( '12px' ).setDisabled( true );
|
|
82
|
+
const objectUUIDRenew = new UIButton( strings.getKey( 'sidebar/object/new' ) ).setMarginLeft( '7px' ).onClick( function () {
|
|
83
|
+
|
|
84
|
+
objectUUID.setValue( THREE.MathUtils.generateUUID() );
|
|
85
|
+
|
|
86
|
+
editor.execute( new SetUuidCommand( editor, editor.selected, objectUUID.getValue() ) );
|
|
87
|
+
|
|
88
|
+
} );
|
|
89
|
+
|
|
90
|
+
objectUUIDRow.add( new UIText( strings.getKey( 'sidebar/object/uuid' ) ).setClass( 'Label' ) );
|
|
91
|
+
objectUUIDRow.add( objectUUID );
|
|
92
|
+
objectUUIDRow.add( objectUUIDRenew );
|
|
93
|
+
|
|
94
|
+
container.add( objectUUIDRow );
|
|
95
|
+
|
|
96
|
+
// name
|
|
97
|
+
|
|
98
|
+
const objectNameRow = new UIRow();
|
|
99
|
+
const objectName = new UIInput().setWidth( '150px' ).setFontSize( '12px' ).onChange( function () {
|
|
100
|
+
|
|
101
|
+
editor.execute( new SetValueCommand( editor, editor.selected, 'name', objectName.getValue() ) );
|
|
102
|
+
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
objectNameRow.add( new UIText( strings.getKey( 'sidebar/object/name' ) ).setClass( 'Label' ) );
|
|
106
|
+
objectNameRow.add( objectName );
|
|
107
|
+
|
|
108
|
+
container.add( objectNameRow );
|
|
109
|
+
|
|
110
|
+
// position
|
|
111
|
+
|
|
112
|
+
const objectPositionRow = new UIRow();
|
|
113
|
+
const objectPositionX = new UINumber().setPrecision( 3 ).setWidth( '50px' ).onChange( update );
|
|
114
|
+
const objectPositionY = new UINumber().setPrecision( 3 ).setWidth( '50px' ).onChange( update );
|
|
115
|
+
const objectPositionZ = new UINumber().setPrecision( 3 ).setWidth( '50px' ).onChange( update );
|
|
116
|
+
|
|
117
|
+
objectPositionRow.add( new UIText( strings.getKey( 'sidebar/object/position' ) ).setClass( 'Label' ) );
|
|
118
|
+
objectPositionRow.add( objectPositionX, objectPositionY, objectPositionZ );
|
|
119
|
+
|
|
120
|
+
container.add( objectPositionRow );
|
|
121
|
+
|
|
122
|
+
// rotation
|
|
123
|
+
|
|
124
|
+
const objectRotationRow = new UIRow();
|
|
125
|
+
const objectRotationX = new UINumber().setStep( 10 ).setNudge( 0.1 ).setUnit( '°' ).setWidth( '50px' ).onChange( update );
|
|
126
|
+
const objectRotationY = new UINumber().setStep( 10 ).setNudge( 0.1 ).setUnit( '°' ).setWidth( '50px' ).onChange( update );
|
|
127
|
+
const objectRotationZ = new UINumber().setStep( 10 ).setNudge( 0.1 ).setUnit( '°' ).setWidth( '50px' ).onChange( update );
|
|
128
|
+
|
|
129
|
+
objectRotationRow.add( new UIText( strings.getKey( 'sidebar/object/rotation' ) ).setClass( 'Label' ) );
|
|
130
|
+
objectRotationRow.add( objectRotationX, objectRotationY, objectRotationZ );
|
|
131
|
+
|
|
132
|
+
container.add( objectRotationRow );
|
|
133
|
+
|
|
134
|
+
// scale
|
|
135
|
+
|
|
136
|
+
const objectScaleRow = new UIRow();
|
|
137
|
+
const objectScaleX = new UINumber( 1 ).setPrecision( 3 ).setWidth( '50px' ).onChange( update );
|
|
138
|
+
const objectScaleY = new UINumber( 1 ).setPrecision( 3 ).setWidth( '50px' ).onChange( update );
|
|
139
|
+
const objectScaleZ = new UINumber( 1 ).setPrecision( 3 ).setWidth( '50px' ).onChange( update );
|
|
140
|
+
|
|
141
|
+
objectScaleRow.add( new UIText( strings.getKey( 'sidebar/object/scale' ) ).setClass( 'Label' ) );
|
|
142
|
+
objectScaleRow.add( objectScaleX, objectScaleY, objectScaleZ );
|
|
143
|
+
|
|
144
|
+
container.add( objectScaleRow );
|
|
145
|
+
|
|
146
|
+
// fov
|
|
147
|
+
|
|
148
|
+
const objectFovRow = new UIRow();
|
|
149
|
+
const objectFov = new UINumber().onChange( update );
|
|
150
|
+
|
|
151
|
+
objectFovRow.add( new UIText( strings.getKey( 'sidebar/object/fov' ) ).setClass( 'Label' ) );
|
|
152
|
+
objectFovRow.add( objectFov );
|
|
153
|
+
|
|
154
|
+
container.add( objectFovRow );
|
|
155
|
+
|
|
156
|
+
// left
|
|
157
|
+
|
|
158
|
+
const objectLeftRow = new UIRow();
|
|
159
|
+
const objectLeft = new UINumber().onChange( update );
|
|
160
|
+
|
|
161
|
+
objectLeftRow.add( new UIText( strings.getKey( 'sidebar/object/left' ) ).setClass( 'Label' ) );
|
|
162
|
+
objectLeftRow.add( objectLeft );
|
|
163
|
+
|
|
164
|
+
container.add( objectLeftRow );
|
|
165
|
+
|
|
166
|
+
// right
|
|
167
|
+
|
|
168
|
+
const objectRightRow = new UIRow();
|
|
169
|
+
const objectRight = new UINumber().onChange( update );
|
|
170
|
+
|
|
171
|
+
objectRightRow.add( new UIText( strings.getKey( 'sidebar/object/right' ) ).setClass( 'Label' ) );
|
|
172
|
+
objectRightRow.add( objectRight );
|
|
173
|
+
|
|
174
|
+
container.add( objectRightRow );
|
|
175
|
+
|
|
176
|
+
// top
|
|
177
|
+
|
|
178
|
+
const objectTopRow = new UIRow();
|
|
179
|
+
const objectTop = new UINumber().onChange( update );
|
|
180
|
+
|
|
181
|
+
objectTopRow.add( new UIText( strings.getKey( 'sidebar/object/top' ) ).setClass( 'Label' ) );
|
|
182
|
+
objectTopRow.add( objectTop );
|
|
183
|
+
|
|
184
|
+
container.add( objectTopRow );
|
|
185
|
+
|
|
186
|
+
// bottom
|
|
187
|
+
|
|
188
|
+
const objectBottomRow = new UIRow();
|
|
189
|
+
const objectBottom = new UINumber().onChange( update );
|
|
190
|
+
|
|
191
|
+
objectBottomRow.add( new UIText( strings.getKey( 'sidebar/object/bottom' ) ).setClass( 'Label' ) );
|
|
192
|
+
objectBottomRow.add( objectBottom );
|
|
193
|
+
|
|
194
|
+
container.add( objectBottomRow );
|
|
195
|
+
|
|
196
|
+
// near
|
|
197
|
+
|
|
198
|
+
const objectNearRow = new UIRow();
|
|
199
|
+
const objectNear = new UINumber().onChange( update );
|
|
200
|
+
|
|
201
|
+
objectNearRow.add( new UIText( strings.getKey( 'sidebar/object/near' ) ).setClass( 'Label' ) );
|
|
202
|
+
objectNearRow.add( objectNear );
|
|
203
|
+
|
|
204
|
+
container.add( objectNearRow );
|
|
205
|
+
|
|
206
|
+
// far
|
|
207
|
+
|
|
208
|
+
const objectFarRow = new UIRow();
|
|
209
|
+
const objectFar = new UINumber().onChange( update );
|
|
210
|
+
|
|
211
|
+
objectFarRow.add( new UIText( strings.getKey( 'sidebar/object/far' ) ).setClass( 'Label' ) );
|
|
212
|
+
objectFarRow.add( objectFar );
|
|
213
|
+
|
|
214
|
+
container.add( objectFarRow );
|
|
215
|
+
|
|
216
|
+
// intensity
|
|
217
|
+
|
|
218
|
+
const objectIntensityRow = new UIRow();
|
|
219
|
+
const objectIntensity = new UINumber().onChange( update );
|
|
220
|
+
|
|
221
|
+
objectIntensityRow.add( new UIText( strings.getKey( 'sidebar/object/intensity' ) ).setClass( 'Label' ) );
|
|
222
|
+
objectIntensityRow.add( objectIntensity );
|
|
223
|
+
|
|
224
|
+
container.add( objectIntensityRow );
|
|
225
|
+
|
|
226
|
+
// color
|
|
227
|
+
|
|
228
|
+
const objectColorRow = new UIRow();
|
|
229
|
+
const objectColor = new UIColor().onInput( update );
|
|
230
|
+
|
|
231
|
+
objectColorRow.add( new UIText( strings.getKey( 'sidebar/object/color' ) ).setClass( 'Label' ) );
|
|
232
|
+
objectColorRow.add( objectColor );
|
|
233
|
+
|
|
234
|
+
container.add( objectColorRow );
|
|
235
|
+
|
|
236
|
+
// ground color
|
|
237
|
+
|
|
238
|
+
const objectGroundColorRow = new UIRow();
|
|
239
|
+
const objectGroundColor = new UIColor().onInput( update );
|
|
240
|
+
|
|
241
|
+
objectGroundColorRow.add( new UIText( strings.getKey( 'sidebar/object/groundcolor' ) ).setClass( 'Label' ) );
|
|
242
|
+
objectGroundColorRow.add( objectGroundColor );
|
|
243
|
+
|
|
244
|
+
container.add( objectGroundColorRow );
|
|
245
|
+
|
|
246
|
+
// distance
|
|
247
|
+
|
|
248
|
+
const objectDistanceRow = new UIRow();
|
|
249
|
+
const objectDistance = new UINumber().setRange( 0, Infinity ).onChange( update );
|
|
250
|
+
|
|
251
|
+
objectDistanceRow.add( new UIText( strings.getKey( 'sidebar/object/distance' ) ).setClass( 'Label' ) );
|
|
252
|
+
objectDistanceRow.add( objectDistance );
|
|
253
|
+
|
|
254
|
+
container.add( objectDistanceRow );
|
|
255
|
+
|
|
256
|
+
// angle
|
|
257
|
+
|
|
258
|
+
const objectAngleRow = new UIRow();
|
|
259
|
+
const objectAngle = new UINumber().setPrecision( 3 ).setRange( 0, Math.PI / 2 ).onChange( update );
|
|
260
|
+
|
|
261
|
+
objectAngleRow.add( new UIText( strings.getKey( 'sidebar/object/angle' ) ).setClass( 'Label' ) );
|
|
262
|
+
objectAngleRow.add( objectAngle );
|
|
263
|
+
|
|
264
|
+
container.add( objectAngleRow );
|
|
265
|
+
|
|
266
|
+
// penumbra
|
|
267
|
+
|
|
268
|
+
const objectPenumbraRow = new UIRow();
|
|
269
|
+
const objectPenumbra = new UINumber().setRange( 0, 1 ).onChange( update );
|
|
270
|
+
|
|
271
|
+
objectPenumbraRow.add( new UIText( strings.getKey( 'sidebar/object/penumbra' ) ).setClass( 'Label' ) );
|
|
272
|
+
objectPenumbraRow.add( objectPenumbra );
|
|
273
|
+
|
|
274
|
+
container.add( objectPenumbraRow );
|
|
275
|
+
|
|
276
|
+
// decay
|
|
277
|
+
|
|
278
|
+
const objectDecayRow = new UIRow();
|
|
279
|
+
const objectDecay = new UINumber().setRange( 0, Infinity ).onChange( update );
|
|
280
|
+
|
|
281
|
+
objectDecayRow.add( new UIText( strings.getKey( 'sidebar/object/decay' ) ).setClass( 'Label' ) );
|
|
282
|
+
objectDecayRow.add( objectDecay );
|
|
283
|
+
|
|
284
|
+
container.add( objectDecayRow );
|
|
285
|
+
|
|
286
|
+
// shadow
|
|
287
|
+
|
|
288
|
+
const objectShadowRow = new UIRow();
|
|
289
|
+
|
|
290
|
+
objectShadowRow.add( new UIText( strings.getKey( 'sidebar/object/shadow' ) ).setClass( 'Label' ) );
|
|
291
|
+
|
|
292
|
+
const objectCastShadow = new UIBoolean( false, strings.getKey( 'sidebar/object/cast' ) ).onChange( update );
|
|
293
|
+
objectShadowRow.add( objectCastShadow );
|
|
294
|
+
|
|
295
|
+
const objectReceiveShadow = new UIBoolean( false, strings.getKey( 'sidebar/object/receive' ) ).onChange( update );
|
|
296
|
+
objectShadowRow.add( objectReceiveShadow );
|
|
297
|
+
|
|
298
|
+
container.add( objectShadowRow );
|
|
299
|
+
|
|
300
|
+
// shadow intensity
|
|
301
|
+
|
|
302
|
+
const objectShadowIntensityRow = new UIRow();
|
|
303
|
+
|
|
304
|
+
objectShadowIntensityRow.add( new UIText( strings.getKey( 'sidebar/object/shadowIntensity' ) ).setClass( 'Label' ) );
|
|
305
|
+
|
|
306
|
+
const objectShadowIntensity = new UINumber( 0 ).setRange( 0, 1 ).onChange( update );
|
|
307
|
+
objectShadowIntensityRow.add( objectShadowIntensity );
|
|
308
|
+
|
|
309
|
+
container.add( objectShadowIntensityRow );
|
|
310
|
+
|
|
311
|
+
// shadow bias
|
|
312
|
+
|
|
313
|
+
const objectShadowBiasRow = new UIRow();
|
|
314
|
+
|
|
315
|
+
objectShadowBiasRow.add( new UIText( strings.getKey( 'sidebar/object/shadowBias' ) ).setClass( 'Label' ) );
|
|
316
|
+
|
|
317
|
+
const objectShadowBias = new UINumber( 0 ).setPrecision( 5 ).setStep( 0.0001 ).setNudge( 0.00001 ).onChange( update );
|
|
318
|
+
objectShadowBiasRow.add( objectShadowBias );
|
|
319
|
+
|
|
320
|
+
container.add( objectShadowBiasRow );
|
|
321
|
+
|
|
322
|
+
// shadow normal offset
|
|
323
|
+
|
|
324
|
+
const objectShadowNormalBiasRow = new UIRow();
|
|
325
|
+
|
|
326
|
+
objectShadowNormalBiasRow.add( new UIText( strings.getKey( 'sidebar/object/shadowNormalBias' ) ).setClass( 'Label' ) );
|
|
327
|
+
|
|
328
|
+
const objectShadowNormalBias = new UINumber( 0 ).onChange( update );
|
|
329
|
+
objectShadowNormalBiasRow.add( objectShadowNormalBias );
|
|
330
|
+
|
|
331
|
+
container.add( objectShadowNormalBiasRow );
|
|
332
|
+
|
|
333
|
+
// shadow radius
|
|
334
|
+
|
|
335
|
+
const objectShadowRadiusRow = new UIRow();
|
|
336
|
+
|
|
337
|
+
objectShadowRadiusRow.add( new UIText( strings.getKey( 'sidebar/object/shadowRadius' ) ).setClass( 'Label' ) );
|
|
338
|
+
|
|
339
|
+
const objectShadowRadius = new UINumber( 1 ).onChange( update );
|
|
340
|
+
objectShadowRadiusRow.add( objectShadowRadius );
|
|
341
|
+
|
|
342
|
+
container.add( objectShadowRadiusRow );
|
|
343
|
+
|
|
344
|
+
// visible
|
|
345
|
+
|
|
346
|
+
const objectVisibleRow = new UIRow();
|
|
347
|
+
const objectVisible = new UICheckbox().onChange( update );
|
|
348
|
+
|
|
349
|
+
objectVisibleRow.add( new UIText( strings.getKey( 'sidebar/object/visible' ) ).setClass( 'Label' ) );
|
|
350
|
+
objectVisibleRow.add( objectVisible );
|
|
351
|
+
|
|
352
|
+
container.add( objectVisibleRow );
|
|
353
|
+
|
|
354
|
+
// frustumCulled
|
|
355
|
+
|
|
356
|
+
const objectFrustumCulledRow = new UIRow();
|
|
357
|
+
const objectFrustumCulled = new UICheckbox().onChange( update );
|
|
358
|
+
|
|
359
|
+
objectFrustumCulledRow.add( new UIText( strings.getKey( 'sidebar/object/frustumcull' ) ).setClass( 'Label' ) );
|
|
360
|
+
objectFrustumCulledRow.add( objectFrustumCulled );
|
|
361
|
+
|
|
362
|
+
container.add( objectFrustumCulledRow );
|
|
363
|
+
|
|
364
|
+
// renderOrder
|
|
365
|
+
|
|
366
|
+
const objectRenderOrderRow = new UIRow();
|
|
367
|
+
const objectRenderOrder = new UIInteger().setWidth( '50px' ).onChange( update );
|
|
368
|
+
|
|
369
|
+
objectRenderOrderRow.add( new UIText( strings.getKey( 'sidebar/object/renderorder' ) ).setClass( 'Label' ) );
|
|
370
|
+
objectRenderOrderRow.add( objectRenderOrder );
|
|
371
|
+
|
|
372
|
+
container.add( objectRenderOrderRow );
|
|
373
|
+
|
|
374
|
+
// user data
|
|
375
|
+
|
|
376
|
+
const objectUserDataRow = new UIRow();
|
|
377
|
+
const objectUserData = new UITextArea().setWidth( '150px' ).setHeight( '40px' ).setFontSize( '12px' ).onChange( update );
|
|
378
|
+
objectUserData.onKeyUp( function () {
|
|
379
|
+
|
|
380
|
+
try {
|
|
381
|
+
|
|
382
|
+
JSON.parse( objectUserData.getValue() );
|
|
383
|
+
|
|
384
|
+
objectUserData.dom.classList.add( 'success' );
|
|
385
|
+
objectUserData.dom.classList.remove( 'fail' );
|
|
386
|
+
|
|
387
|
+
} catch ( error ) {
|
|
388
|
+
|
|
389
|
+
objectUserData.dom.classList.remove( 'success' );
|
|
390
|
+
objectUserData.dom.classList.add( 'fail' );
|
|
391
|
+
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
} );
|
|
395
|
+
|
|
396
|
+
objectUserDataRow.add( new UIText( strings.getKey( 'sidebar/object/userdata' ) ).setClass( 'Label' ) );
|
|
397
|
+
objectUserDataRow.add( objectUserData );
|
|
398
|
+
|
|
399
|
+
container.add( objectUserDataRow );
|
|
400
|
+
|
|
401
|
+
// Export JSON
|
|
402
|
+
|
|
403
|
+
const exportJson = new UIButton( strings.getKey( 'sidebar/object/export' ) );
|
|
404
|
+
exportJson.setMarginLeft( '120px' );
|
|
405
|
+
exportJson.onClick( function () {
|
|
406
|
+
|
|
407
|
+
const object = editor.selected;
|
|
408
|
+
|
|
409
|
+
let output = object.toJSON();
|
|
410
|
+
|
|
411
|
+
try {
|
|
412
|
+
|
|
413
|
+
output = JSON.stringify( output, null, '\t' );
|
|
414
|
+
output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
|
|
415
|
+
|
|
416
|
+
} catch ( error ) {
|
|
417
|
+
|
|
418
|
+
output = JSON.stringify( output );
|
|
419
|
+
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
editor.utils.save( new Blob( [ output ] ), `${ objectName.getValue() || 'object' }.json` );
|
|
424
|
+
|
|
425
|
+
} );
|
|
426
|
+
container.add( exportJson );
|
|
427
|
+
|
|
428
|
+
//
|
|
429
|
+
|
|
430
|
+
function update() {
|
|
431
|
+
|
|
432
|
+
const object = editor.selected;
|
|
433
|
+
|
|
434
|
+
if ( object !== null ) {
|
|
435
|
+
|
|
436
|
+
const newPosition = new THREE.Vector3( objectPositionX.getValue(), objectPositionY.getValue(), objectPositionZ.getValue() );
|
|
437
|
+
if ( object.position.distanceTo( newPosition ) >= 0.01 ) {
|
|
438
|
+
|
|
439
|
+
editor.execute( new SetPositionCommand( editor, object, newPosition ) );
|
|
440
|
+
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const newRotation = new THREE.Euler( objectRotationX.getValue() * THREE.MathUtils.DEG2RAD, objectRotationY.getValue() * THREE.MathUtils.DEG2RAD, objectRotationZ.getValue() * THREE.MathUtils.DEG2RAD );
|
|
444
|
+
if ( new THREE.Vector3().setFromEuler( object.rotation ).distanceTo( new THREE.Vector3().setFromEuler( newRotation ) ) >= 0.01 ) {
|
|
445
|
+
|
|
446
|
+
editor.execute( new SetRotationCommand( editor, object, newRotation ) );
|
|
447
|
+
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const newScale = new THREE.Vector3( objectScaleX.getValue(), objectScaleY.getValue(), objectScaleZ.getValue() );
|
|
451
|
+
if ( object.scale.distanceTo( newScale ) >= 0.01 ) {
|
|
452
|
+
|
|
453
|
+
editor.execute( new SetScaleCommand( editor, object, newScale ) );
|
|
454
|
+
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if ( object.fov !== undefined && Math.abs( object.fov - objectFov.getValue() ) >= 0.01 ) {
|
|
458
|
+
|
|
459
|
+
editor.execute( new SetValueCommand( editor, object, 'fov', objectFov.getValue() ) );
|
|
460
|
+
object.updateProjectionMatrix();
|
|
461
|
+
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if ( object.left !== undefined && Math.abs( object.left - objectLeft.getValue() ) >= 0.01 ) {
|
|
465
|
+
|
|
466
|
+
editor.execute( new SetValueCommand( editor, object, 'left', objectLeft.getValue() ) );
|
|
467
|
+
object.updateProjectionMatrix();
|
|
468
|
+
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if ( object.right !== undefined && Math.abs( object.right - objectRight.getValue() ) >= 0.01 ) {
|
|
472
|
+
|
|
473
|
+
editor.execute( new SetValueCommand( editor, object, 'right', objectRight.getValue() ) );
|
|
474
|
+
object.updateProjectionMatrix();
|
|
475
|
+
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
if ( object.top !== undefined && Math.abs( object.top - objectTop.getValue() ) >= 0.01 ) {
|
|
479
|
+
|
|
480
|
+
editor.execute( new SetValueCommand( editor, object, 'top', objectTop.getValue() ) );
|
|
481
|
+
object.updateProjectionMatrix();
|
|
482
|
+
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if ( object.bottom !== undefined && Math.abs( object.bottom - objectBottom.getValue() ) >= 0.01 ) {
|
|
486
|
+
|
|
487
|
+
editor.execute( new SetValueCommand( editor, object, 'bottom', objectBottom.getValue() ) );
|
|
488
|
+
object.updateProjectionMatrix();
|
|
489
|
+
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if ( object.near !== undefined && Math.abs( object.near - objectNear.getValue() ) >= 0.01 ) {
|
|
493
|
+
|
|
494
|
+
editor.execute( new SetValueCommand( editor, object, 'near', objectNear.getValue() ) );
|
|
495
|
+
if ( object.isOrthographicCamera ) {
|
|
496
|
+
|
|
497
|
+
object.updateProjectionMatrix();
|
|
498
|
+
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if ( object.far !== undefined && Math.abs( object.far - objectFar.getValue() ) >= 0.01 ) {
|
|
504
|
+
|
|
505
|
+
editor.execute( new SetValueCommand( editor, object, 'far', objectFar.getValue() ) );
|
|
506
|
+
if ( object.isOrthographicCamera ) {
|
|
507
|
+
|
|
508
|
+
object.updateProjectionMatrix();
|
|
509
|
+
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if ( object.intensity !== undefined && Math.abs( object.intensity - objectIntensity.getValue() ) >= 0.01 ) {
|
|
515
|
+
|
|
516
|
+
editor.execute( new SetValueCommand( editor, object, 'intensity', objectIntensity.getValue() ) );
|
|
517
|
+
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if ( object.color !== undefined && object.color.getHex() !== objectColor.getHexValue() ) {
|
|
521
|
+
|
|
522
|
+
editor.execute( new SetColorCommand( editor, object, 'color', objectColor.getHexValue() ) );
|
|
523
|
+
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if ( object.groundColor !== undefined && object.groundColor.getHex() !== objectGroundColor.getHexValue() ) {
|
|
527
|
+
|
|
528
|
+
editor.execute( new SetColorCommand( editor, object, 'groundColor', objectGroundColor.getHexValue() ) );
|
|
529
|
+
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
if ( object.distance !== undefined && Math.abs( object.distance - objectDistance.getValue() ) >= 0.01 ) {
|
|
533
|
+
|
|
534
|
+
editor.execute( new SetValueCommand( editor, object, 'distance', objectDistance.getValue() ) );
|
|
535
|
+
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if ( object.angle !== undefined && Math.abs( object.angle - objectAngle.getValue() ) >= 0.01 ) {
|
|
539
|
+
|
|
540
|
+
editor.execute( new SetValueCommand( editor, object, 'angle', objectAngle.getValue() ) );
|
|
541
|
+
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if ( object.penumbra !== undefined && Math.abs( object.penumbra - objectPenumbra.getValue() ) >= 0.01 ) {
|
|
545
|
+
|
|
546
|
+
editor.execute( new SetValueCommand( editor, object, 'penumbra', objectPenumbra.getValue() ) );
|
|
547
|
+
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
if ( object.decay !== undefined && Math.abs( object.decay - objectDecay.getValue() ) >= 0.01 ) {
|
|
551
|
+
|
|
552
|
+
editor.execute( new SetValueCommand( editor, object, 'decay', objectDecay.getValue() ) );
|
|
553
|
+
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if ( object.visible !== objectVisible.getValue() ) {
|
|
557
|
+
|
|
558
|
+
editor.execute( new SetValueCommand( editor, object, 'visible', objectVisible.getValue() ) );
|
|
559
|
+
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
if ( object.frustumCulled !== objectFrustumCulled.getValue() ) {
|
|
563
|
+
|
|
564
|
+
editor.execute( new SetValueCommand( editor, object, 'frustumCulled', objectFrustumCulled.getValue() ) );
|
|
565
|
+
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if ( object.renderOrder !== objectRenderOrder.getValue() ) {
|
|
569
|
+
|
|
570
|
+
editor.execute( new SetValueCommand( editor, object, 'renderOrder', objectRenderOrder.getValue() ) );
|
|
571
|
+
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if ( object.castShadow !== undefined && object.castShadow !== objectCastShadow.getValue() ) {
|
|
575
|
+
|
|
576
|
+
editor.execute( new SetValueCommand( editor, object, 'castShadow', objectCastShadow.getValue() ) );
|
|
577
|
+
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if ( object.receiveShadow !== objectReceiveShadow.getValue() ) {
|
|
581
|
+
|
|
582
|
+
if ( object.material !== undefined ) object.material.needsUpdate = true;
|
|
583
|
+
editor.execute( new SetValueCommand( editor, object, 'receiveShadow', objectReceiveShadow.getValue() ) );
|
|
584
|
+
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if ( object.shadow !== undefined ) {
|
|
588
|
+
|
|
589
|
+
if ( object.shadow.intensity !== objectShadowIntensity.getValue() ) {
|
|
590
|
+
|
|
591
|
+
editor.execute( new SetShadowValueCommand( editor, object, 'intensity', objectShadowIntensity.getValue() ) );
|
|
592
|
+
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if ( object.shadow.bias !== objectShadowBias.getValue() ) {
|
|
596
|
+
|
|
597
|
+
editor.execute( new SetShadowValueCommand( editor, object, 'bias', objectShadowBias.getValue() ) );
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
if ( object.shadow.normalBias !== objectShadowNormalBias.getValue() ) {
|
|
602
|
+
|
|
603
|
+
editor.execute( new SetShadowValueCommand( editor, object, 'normalBias', objectShadowNormalBias.getValue() ) );
|
|
604
|
+
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
if ( object.shadow.radius !== objectShadowRadius.getValue() ) {
|
|
608
|
+
|
|
609
|
+
editor.execute( new SetShadowValueCommand( editor, object, 'radius', objectShadowRadius.getValue() ) );
|
|
610
|
+
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
try {
|
|
616
|
+
|
|
617
|
+
const userData = JSON.parse( objectUserData.getValue() );
|
|
618
|
+
if ( JSON.stringify( object.userData ) != JSON.stringify( userData ) ) {
|
|
619
|
+
|
|
620
|
+
editor.execute( new SetValueCommand( editor, object, 'userData', userData ) );
|
|
621
|
+
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
} catch ( exception ) {
|
|
625
|
+
|
|
626
|
+
console.warn( exception );
|
|
627
|
+
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function updateRows( object ) {
|
|
635
|
+
|
|
636
|
+
const properties = {
|
|
637
|
+
'fov': objectFovRow,
|
|
638
|
+
'left': objectLeftRow,
|
|
639
|
+
'right': objectRightRow,
|
|
640
|
+
'top': objectTopRow,
|
|
641
|
+
'bottom': objectBottomRow,
|
|
642
|
+
'near': objectNearRow,
|
|
643
|
+
'far': objectFarRow,
|
|
644
|
+
'intensity': objectIntensityRow,
|
|
645
|
+
'color': objectColorRow,
|
|
646
|
+
'groundColor': objectGroundColorRow,
|
|
647
|
+
'distance': objectDistanceRow,
|
|
648
|
+
'angle': objectAngleRow,
|
|
649
|
+
'penumbra': objectPenumbraRow,
|
|
650
|
+
'decay': objectDecayRow,
|
|
651
|
+
'castShadow': objectShadowRow,
|
|
652
|
+
'receiveShadow': objectReceiveShadow,
|
|
653
|
+
'shadow': [ objectShadowIntensityRow, objectShadowBiasRow, objectShadowNormalBiasRow, objectShadowRadiusRow ]
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
for ( const property in properties ) {
|
|
657
|
+
|
|
658
|
+
const uiElement = properties[ property ];
|
|
659
|
+
|
|
660
|
+
if ( Array.isArray( uiElement ) === true ) {
|
|
661
|
+
|
|
662
|
+
for ( let i = 0; i < uiElement.length; i ++ ) {
|
|
663
|
+
|
|
664
|
+
uiElement[ i ].setDisplay( object[ property ] !== undefined ? '' : 'none' );
|
|
665
|
+
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
} else {
|
|
669
|
+
|
|
670
|
+
uiElement.setDisplay( object[ property ] !== undefined ? '' : 'none' );
|
|
671
|
+
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
//
|
|
677
|
+
|
|
678
|
+
if ( object.isLight ) {
|
|
679
|
+
|
|
680
|
+
objectReceiveShadow.setDisplay( 'none' );
|
|
681
|
+
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
if ( object.isAmbientLight || object.isHemisphereLight ) {
|
|
685
|
+
|
|
686
|
+
objectShadowRow.setDisplay( 'none' );
|
|
687
|
+
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function updateTransformRows( object ) {
|
|
693
|
+
|
|
694
|
+
if ( object.isLight ) {
|
|
695
|
+
|
|
696
|
+
objectRotationRow.setDisplay( 'none' );
|
|
697
|
+
objectScaleRow.setDisplay( 'none' );
|
|
698
|
+
|
|
699
|
+
} else {
|
|
700
|
+
|
|
701
|
+
objectRotationRow.setDisplay( '' );
|
|
702
|
+
objectScaleRow.setDisplay( '' );
|
|
703
|
+
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// events
|
|
709
|
+
|
|
710
|
+
signals.objectSelected.add( function ( object ) {
|
|
711
|
+
|
|
712
|
+
if ( object !== null ) {
|
|
713
|
+
|
|
714
|
+
container.setDisplay( 'block' );
|
|
715
|
+
|
|
716
|
+
updateRows( object );
|
|
717
|
+
updateUI( object );
|
|
718
|
+
|
|
719
|
+
} else {
|
|
720
|
+
|
|
721
|
+
container.setDisplay( 'none' );
|
|
722
|
+
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
} );
|
|
726
|
+
|
|
727
|
+
signals.objectChanged.add( function ( object ) {
|
|
728
|
+
|
|
729
|
+
if ( object !== editor.selected ) return;
|
|
730
|
+
|
|
731
|
+
updateUI( object );
|
|
732
|
+
|
|
733
|
+
} );
|
|
734
|
+
|
|
735
|
+
signals.refreshSidebarObject3D.add( function ( object ) {
|
|
736
|
+
|
|
737
|
+
if ( object !== editor.selected ) return;
|
|
738
|
+
|
|
739
|
+
updateUI( object );
|
|
740
|
+
|
|
741
|
+
} );
|
|
742
|
+
|
|
743
|
+
function updateUI( object ) {
|
|
744
|
+
|
|
745
|
+
objectType.setValue( object.type );
|
|
746
|
+
|
|
747
|
+
objectUUID.setValue( object.uuid );
|
|
748
|
+
objectName.setValue( object.name );
|
|
749
|
+
|
|
750
|
+
objectPositionX.setValue( object.position.x );
|
|
751
|
+
objectPositionY.setValue( object.position.y );
|
|
752
|
+
objectPositionZ.setValue( object.position.z );
|
|
753
|
+
|
|
754
|
+
objectRotationX.setValue( object.rotation.x * THREE.MathUtils.RAD2DEG );
|
|
755
|
+
objectRotationY.setValue( object.rotation.y * THREE.MathUtils.RAD2DEG );
|
|
756
|
+
objectRotationZ.setValue( object.rotation.z * THREE.MathUtils.RAD2DEG );
|
|
757
|
+
|
|
758
|
+
objectScaleX.setValue( object.scale.x );
|
|
759
|
+
objectScaleY.setValue( object.scale.y );
|
|
760
|
+
objectScaleZ.setValue( object.scale.z );
|
|
761
|
+
|
|
762
|
+
if ( object.fov !== undefined ) {
|
|
763
|
+
|
|
764
|
+
objectFov.setValue( object.fov );
|
|
765
|
+
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
if ( object.left !== undefined ) {
|
|
769
|
+
|
|
770
|
+
objectLeft.setValue( object.left );
|
|
771
|
+
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
if ( object.right !== undefined ) {
|
|
775
|
+
|
|
776
|
+
objectRight.setValue( object.right );
|
|
777
|
+
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
if ( object.top !== undefined ) {
|
|
781
|
+
|
|
782
|
+
objectTop.setValue( object.top );
|
|
783
|
+
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
if ( object.bottom !== undefined ) {
|
|
787
|
+
|
|
788
|
+
objectBottom.setValue( object.bottom );
|
|
789
|
+
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
if ( object.near !== undefined ) {
|
|
793
|
+
|
|
794
|
+
objectNear.setValue( object.near );
|
|
795
|
+
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
if ( object.far !== undefined ) {
|
|
799
|
+
|
|
800
|
+
objectFar.setValue( object.far );
|
|
801
|
+
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
if ( object.intensity !== undefined ) {
|
|
805
|
+
|
|
806
|
+
objectIntensity.setValue( object.intensity );
|
|
807
|
+
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
if ( object.color !== undefined ) {
|
|
811
|
+
|
|
812
|
+
objectColor.setHexValue( object.color.getHexString() );
|
|
813
|
+
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
if ( object.groundColor !== undefined ) {
|
|
817
|
+
|
|
818
|
+
objectGroundColor.setHexValue( object.groundColor.getHexString() );
|
|
819
|
+
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
if ( object.distance !== undefined ) {
|
|
823
|
+
|
|
824
|
+
objectDistance.setValue( object.distance );
|
|
825
|
+
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
if ( object.angle !== undefined ) {
|
|
829
|
+
|
|
830
|
+
objectAngle.setValue( object.angle );
|
|
831
|
+
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if ( object.penumbra !== undefined ) {
|
|
835
|
+
|
|
836
|
+
objectPenumbra.setValue( object.penumbra );
|
|
837
|
+
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
if ( object.decay !== undefined ) {
|
|
841
|
+
|
|
842
|
+
objectDecay.setValue( object.decay );
|
|
843
|
+
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
if ( object.castShadow !== undefined ) {
|
|
847
|
+
|
|
848
|
+
objectCastShadow.setValue( object.castShadow );
|
|
849
|
+
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if ( object.receiveShadow !== undefined ) {
|
|
853
|
+
|
|
854
|
+
objectReceiveShadow.setValue( object.receiveShadow );
|
|
855
|
+
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
if ( object.shadow !== undefined ) {
|
|
859
|
+
|
|
860
|
+
objectShadowIntensity.setValue( object.shadow.intensity );
|
|
861
|
+
objectShadowBias.setValue( object.shadow.bias );
|
|
862
|
+
objectShadowNormalBias.setValue( object.shadow.normalBias );
|
|
863
|
+
objectShadowRadius.setValue( object.shadow.radius );
|
|
864
|
+
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
objectVisible.setValue( object.visible );
|
|
868
|
+
objectFrustumCulled.setValue( object.frustumCulled );
|
|
869
|
+
objectRenderOrder.setValue( object.renderOrder );
|
|
870
|
+
|
|
871
|
+
try {
|
|
872
|
+
|
|
873
|
+
objectUserData.setValue( JSON.stringify( object.userData, null, ' ' ) );
|
|
874
|
+
|
|
875
|
+
} catch ( error ) {
|
|
876
|
+
|
|
877
|
+
console.log( error );
|
|
878
|
+
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
objectUserData.setBorderColor( 'transparent' );
|
|
882
|
+
objectUserData.setBackgroundColor( '' );
|
|
883
|
+
|
|
884
|
+
updateTransformRows( object );
|
|
885
|
+
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
return container;
|
|
889
|
+
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export { SidebarObject };
|