sunrize 1.0.11

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.
Files changed (200) hide show
  1. package/.vscode/launch.json +17 -0
  2. package/.vscode/settings.json +21 -0
  3. package/.vscode/tasks.json +25 -0
  4. package/LICENSE.md +627 -0
  5. package/Makefile +4 -0
  6. package/README.md +15 -0
  7. package/bin/sunrise.js +13 -0
  8. package/package.json +103 -0
  9. package/src/audio/Tink.mp3 +0 -0
  10. package/src/html/application.html +62 -0
  11. package/src/html/application.js +6 -0
  12. package/src/html/document.html +36 -0
  13. package/src/html/document.js +6 -0
  14. package/src/images/OutlineEditor/AccessTypes/AccessTypes.xcf +0 -0
  15. package/src/images/OutlineEditor/AccessTypes/initializeOnly.png +0 -0
  16. package/src/images/OutlineEditor/AccessTypes/inputOnly.0.png +0 -0
  17. package/src/images/OutlineEditor/AccessTypes/inputOnly.1.png +0 -0
  18. package/src/images/OutlineEditor/AccessTypes/inputOnly.2.png +0 -0
  19. package/src/images/OutlineEditor/AccessTypes/inputOnly.active.png +0 -0
  20. package/src/images/OutlineEditor/AccessTypes/inputOnly.png +0 -0
  21. package/src/images/OutlineEditor/AccessTypes/inputOutput.0.0.png +0 -0
  22. package/src/images/OutlineEditor/AccessTypes/inputOutput.0.1.png +0 -0
  23. package/src/images/OutlineEditor/AccessTypes/inputOutput.0.2.png +0 -0
  24. package/src/images/OutlineEditor/AccessTypes/inputOutput.1.0.png +0 -0
  25. package/src/images/OutlineEditor/AccessTypes/inputOutput.1.1.png +0 -0
  26. package/src/images/OutlineEditor/AccessTypes/inputOutput.1.2.png +0 -0
  27. package/src/images/OutlineEditor/AccessTypes/inputOutput.2.0.png +0 -0
  28. package/src/images/OutlineEditor/AccessTypes/inputOutput.2.1.png +0 -0
  29. package/src/images/OutlineEditor/AccessTypes/inputOutput.2.2.png +0 -0
  30. package/src/images/OutlineEditor/AccessTypes/inputOutput.png +0 -0
  31. package/src/images/OutlineEditor/AccessTypes/outputOnly.0.png +0 -0
  32. package/src/images/OutlineEditor/AccessTypes/outputOnly.1.png +0 -0
  33. package/src/images/OutlineEditor/AccessTypes/outputOnly.2.png +0 -0
  34. package/src/images/OutlineEditor/AccessTypes/outputOnly.active.png +0 -0
  35. package/src/images/OutlineEditor/AccessTypes/outputOnly.png +0 -0
  36. package/src/images/OutlineEditor/Fields/MFBool.svg +177 -0
  37. package/src/images/OutlineEditor/Fields/MFColor.svg +150 -0
  38. package/src/images/OutlineEditor/Fields/MFColorRGBA.svg +220 -0
  39. package/src/images/OutlineEditor/Fields/MFDouble.svg +162 -0
  40. package/src/images/OutlineEditor/Fields/MFFloat.svg +173 -0
  41. package/src/images/OutlineEditor/Fields/MFImage.svg +234 -0
  42. package/src/images/OutlineEditor/Fields/MFInt32.svg +168 -0
  43. package/src/images/OutlineEditor/Fields/MFMatrix3d.svg +219 -0
  44. package/src/images/OutlineEditor/Fields/MFMatrix3f.svg +212 -0
  45. package/src/images/OutlineEditor/Fields/MFMatrix4d.svg +212 -0
  46. package/src/images/OutlineEditor/Fields/MFMatrix4f.svg +205 -0
  47. package/src/images/OutlineEditor/Fields/MFNode.svg +180 -0
  48. package/src/images/OutlineEditor/Fields/MFRotation.svg +175 -0
  49. package/src/images/OutlineEditor/Fields/MFString.svg +152 -0
  50. package/src/images/OutlineEditor/Fields/MFTime.svg +164 -0
  51. package/src/images/OutlineEditor/Fields/MFVec2d.svg +172 -0
  52. package/src/images/OutlineEditor/Fields/MFVec2f.svg +165 -0
  53. package/src/images/OutlineEditor/Fields/MFVec3d.svg +179 -0
  54. package/src/images/OutlineEditor/Fields/MFVec3f.svg +173 -0
  55. package/src/images/OutlineEditor/Fields/MFVec4d.svg +166 -0
  56. package/src/images/OutlineEditor/Fields/MFVec4f.svg +159 -0
  57. package/src/images/OutlineEditor/Fields/SFBool.svg +137 -0
  58. package/src/images/OutlineEditor/Fields/SFColor.svg +143 -0
  59. package/src/images/OutlineEditor/Fields/SFColorRGBA.svg +213 -0
  60. package/src/images/OutlineEditor/Fields/SFDouble.svg +155 -0
  61. package/src/images/OutlineEditor/Fields/SFFloat.svg +166 -0
  62. package/src/images/OutlineEditor/Fields/SFImage.svg +234 -0
  63. package/src/images/OutlineEditor/Fields/SFInt32.svg +163 -0
  64. package/src/images/OutlineEditor/Fields/SFMatrix3d.svg +219 -0
  65. package/src/images/OutlineEditor/Fields/SFMatrix3f.svg +206 -0
  66. package/src/images/OutlineEditor/Fields/SFMatrix4d.svg +212 -0
  67. package/src/images/OutlineEditor/Fields/SFMatrix4f.svg +199 -0
  68. package/src/images/OutlineEditor/Fields/SFNode.svg +174 -0
  69. package/src/images/OutlineEditor/Fields/SFRotation.svg +169 -0
  70. package/src/images/OutlineEditor/Fields/SFString.svg +147 -0
  71. package/src/images/OutlineEditor/Fields/SFTime.svg +158 -0
  72. package/src/images/OutlineEditor/Fields/SFVec2d.svg +166 -0
  73. package/src/images/OutlineEditor/Fields/SFVec2f.svg +159 -0
  74. package/src/images/OutlineEditor/Fields/SFVec3d.svg +173 -0
  75. package/src/images/OutlineEditor/Fields/SFVec3f.svg +167 -0
  76. package/src/images/OutlineEditor/Fields/SFVec4d.svg +166 -0
  77. package/src/images/OutlineEditor/Fields/SFVec4f.svg +153 -0
  78. package/src/images/OutlineEditor/Fields/Unkown.svg +137 -0
  79. package/src/images/OutlineEditor/Fields/none.png +0 -0
  80. package/src/images/OutlineEditor/Node/ExportedNode.svg +212 -0
  81. package/src/images/OutlineEditor/Node/ExternProto.svg +237 -0
  82. package/src/images/OutlineEditor/Node/ImportedNode.svg +230 -0
  83. package/src/images/OutlineEditor/Node/NULL.svg +160 -0
  84. package/src/images/OutlineEditor/Node/Prototype.svg +263 -0
  85. package/src/images/OutlineEditor/Node/Route.svg +207 -0
  86. package/src/images/OutlineEditor/Node/SharedNode.svg +245 -0
  87. package/src/images/OutlineEditor/Node/X3DBaseNode.svg +167 -0
  88. package/src/images/OutlineEditor/Node/X3DExecutionContext.svg +207 -0
  89. package/src/images/OutlineEditor/Values/Bell.svg +79 -0
  90. package/src/images/OutlineEditor/Values/FALSE.svg +76 -0
  91. package/src/images/OutlineEditor/Values/TRUE.svg +76 -0
  92. package/src/images/icon.icns +0 -0
  93. package/src/images/icon.ico +0 -0
  94. package/src/images/icon.png +0 -0
  95. package/src/images/icons/arrow.svg +113 -0
  96. package/src/images/icons/hand.svg +129 -0
  97. package/src/main.js +9 -0
  98. package/src/sunrize/Application/ActionKeys.js +80 -0
  99. package/src/sunrize/Application/Application.js +660 -0
  100. package/src/sunrize/Application/DataStorage.js +179 -0
  101. package/src/sunrize/Application/Document.js +453 -0
  102. package/src/sunrize/Application/Footer.js +46 -0
  103. package/src/sunrize/Application/GetText.js +10 -0
  104. package/src/sunrize/Application/Interface.js +148 -0
  105. package/src/sunrize/Application/SecondaryToolbar.js +156 -0
  106. package/src/sunrize/Application/Selection.js +49 -0
  107. package/src/sunrize/Application/Sidebar.js +51 -0
  108. package/src/sunrize/Application/Tabs.js +329 -0
  109. package/src/sunrize/Application/Traverse.js +341 -0
  110. package/src/sunrize/Bits/Algorithm.js +5 -0
  111. package/src/sunrize/Bits/Beep.js +13 -0
  112. package/src/sunrize/Bits/Highlight.js +16 -0
  113. package/src/sunrize/Bits/Validate.js +59 -0
  114. package/src/sunrize/Controls/AddPrototypePopover.js +111 -0
  115. package/src/sunrize/Controls/Dialog.js +74 -0
  116. package/src/sunrize/Controls/EditUserDefinedFieldPopover.js +223 -0
  117. package/src/sunrize/Controls/Popover.js +32 -0
  118. package/src/sunrize/Controls/RenameNodeInput.js +94 -0
  119. package/src/sunrize/Controls/RenameNodePopover.js +40 -0
  120. package/src/sunrize/Controls/Splitter.js +102 -0
  121. package/src/sunrize/Controls/Tabs.js +96 -0
  122. package/src/sunrize/Editors/AnimationEditor.js +18 -0
  123. package/src/sunrize/Editors/BrowserSize.js +101 -0
  124. package/src/sunrize/Editors/Console.js +239 -0
  125. package/src/sunrize/Editors/FileManager.js +18 -0
  126. package/src/sunrize/Editors/Library.js +268 -0
  127. package/src/sunrize/Editors/NodeInspector.js +18 -0
  128. package/src/sunrize/Editors/NodeList.js +122 -0
  129. package/src/sunrize/Editors/OutlineEditor.js +2007 -0
  130. package/src/sunrize/Editors/OutlineRouteGraph.js +557 -0
  131. package/src/sunrize/Editors/OutlineView.js +3017 -0
  132. package/src/sunrize/Editors/Primitives.js +452 -0
  133. package/src/sunrize/Editors/SceneProperties.js +477 -0
  134. package/src/sunrize/Editors/ScriptEditor.js +594 -0
  135. package/src/sunrize/Editors/Units.js +146 -0
  136. package/src/sunrize/Fields/MFStringTextArea.js +32 -0
  137. package/src/sunrize/Fields/SFStringInput.js +32 -0
  138. package/src/sunrize/Fields.js +2 -0
  139. package/src/sunrize/Tools/CADGeometry/CADAssemblyTool.js +20 -0
  140. package/src/sunrize/Tools/CADGeometry/CADFaceTool.js +20 -0
  141. package/src/sunrize/Tools/CADGeometry/CADLayerTool.js +20 -0
  142. package/src/sunrize/Tools/CADGeometry/CADPartTool.js +20 -0
  143. package/src/sunrize/Tools/CADGeometry.js +6 -0
  144. package/src/sunrize/Tools/Core/ToolColors.js +33 -0
  145. package/src/sunrize/Tools/Core/X3DNodeTool.js +132 -0
  146. package/src/sunrize/Tools/Core/X3DPrototypeInstanceTool.js +31 -0
  147. package/src/sunrize/Tools/Core.js +3 -0
  148. package/src/sunrize/Tools/Geospatial/GeoLODTool.js +40 -0
  149. package/src/sunrize/Tools/Geospatial/GeoLocationTool.js +20 -0
  150. package/src/sunrize/Tools/Geospatial/GeoTransformTool.js +20 -0
  151. package/src/sunrize/Tools/Geospatial.js +5 -0
  152. package/src/sunrize/Tools/Grouping/GroupTool.js +20 -0
  153. package/src/sunrize/Tools/Grouping/StaticGroupTool.js +20 -0
  154. package/src/sunrize/Tools/Grouping/SwitchTool.js +20 -0
  155. package/src/sunrize/Tools/Grouping/TransformTool.js +20 -0
  156. package/src/sunrize/Tools/Grouping/TransformTool.x3d +37 -0
  157. package/src/sunrize/Tools/Grouping/Vector.x3d +98 -0
  158. package/src/sunrize/Tools/Grouping/X3DBoundedObjectTool.js +44 -0
  159. package/src/sunrize/Tools/Grouping/X3DBoundedObjectTool.x3d +330 -0
  160. package/src/sunrize/Tools/Grouping/X3DTransformNodeTool.js +44 -0
  161. package/src/sunrize/Tools/Grouping.js +6 -0
  162. package/src/sunrize/Tools/HAnim/HAnimHumanoidTool.js +20 -0
  163. package/src/sunrize/Tools/HAnim/HAnimJointTool.js +20 -0
  164. package/src/sunrize/Tools/HAnim/HAnimSegmentTool.js +20 -0
  165. package/src/sunrize/Tools/HAnim/HAnimSiteTool.js +20 -0
  166. package/src/sunrize/Tools/HAnim.js +6 -0
  167. package/src/sunrize/Tools/Layering/LayerTool.js +16 -0
  168. package/src/sunrize/Tools/Layering/X3DLayerNodeTool.js +22 -0
  169. package/src/sunrize/Tools/Layering.js +3 -0
  170. package/src/sunrize/Tools/Layout/LayoutGroupTool.js +78 -0
  171. package/src/sunrize/Tools/Layout/LayoutLayerTool.js +16 -0
  172. package/src/sunrize/Tools/Layout/ScreenGroupTool.js +20 -0
  173. package/src/sunrize/Tools/Layout.js +5 -0
  174. package/src/sunrize/Tools/Navigation/BillboardTool.js +37 -0
  175. package/src/sunrize/Tools/Navigation/CollisionTool.js +37 -0
  176. package/src/sunrize/Tools/Navigation/LODTool.js +37 -0
  177. package/src/sunrize/Tools/Navigation.js +5 -0
  178. package/src/sunrize/Tools/Networking/AnchorTool.js +20 -0
  179. package/src/sunrize/Tools/Networking/InlineTool.js +20 -0
  180. package/src/sunrize/Tools/Networking.js +4 -0
  181. package/src/sunrize/Tools/ParticleSystems/ParticleSystemTool.js +20 -0
  182. package/src/sunrize/Tools/ParticleSystems.js +3 -0
  183. package/src/sunrize/Tools/Picking/PickableGroupTool.js +20 -0
  184. package/src/sunrize/Tools/Picking.js +3 -0
  185. package/src/sunrize/Tools/RigidBodyPhysics/CollidableOffsetTool.js +37 -0
  186. package/src/sunrize/Tools/RigidBodyPhysics/CollidableShapeTool.js +37 -0
  187. package/src/sunrize/Tools/RigidBodyPhysics.js +4 -0
  188. package/src/sunrize/Tools/Shaders/ToolShader.x3d +86 -0
  189. package/src/sunrize/Tools/Shape/ShapeTool.js +20 -0
  190. package/src/sunrize/Tools/Shape.js +3 -0
  191. package/src/sunrize/Tools/VolumeRendering/IsoSurfaceVolumeDataTool.js +16 -0
  192. package/src/sunrize/Tools/VolumeRendering/SegmentedVolumeDataTool.js +16 -0
  193. package/src/sunrize/Tools/VolumeRendering/VolumeDataTool.js +16 -0
  194. package/src/sunrize/Tools/VolumeRendering/X3DVolumeDataNodeTool.js +12 -0
  195. package/src/sunrize/Tools/VolumeRendering.js +5 -0
  196. package/src/sunrize/Tools.js +15 -0
  197. package/src/sunrize/Undo/Editor.js +2146 -0
  198. package/src/sunrize/Undo/UndoManager.js +204 -0
  199. package/src/sunrize/X3D.js +8 -0
  200. package/src/themes/dark.css +1291 -0
@@ -0,0 +1,148 @@
1
+ "use strict"
2
+
3
+ const
4
+ $ = require ("jquery"),
5
+ url = require ("url"),
6
+ md5 = require ("md5"),
7
+ X3D = require ("../X3D"),
8
+ DataStorage = require ("./DataStorage")
9
+
10
+ require ("../Bits/Highlight")
11
+ require ("../Bits/Beep")
12
+
13
+ module .exports = class Interface
14
+ {
15
+ static #interfaces = new Set ()
16
+
17
+ constructor (namespace)
18
+ {
19
+ Interface .#interfaces .add (this)
20
+
21
+ this .namespace = namespace
22
+ this .config = { global: this .createGlobalConfig () }
23
+ this .config .file = this .createFileConfig ()
24
+
25
+ this .browser .addBrowserCallback (this, this .setBrowserEvent .bind (this))
26
+ }
27
+
28
+ setup ()
29
+ {
30
+ this .initialize ()
31
+
32
+ this .setBrowserEvent (X3D .X3DConstants .INITIALIZED_EVENT)
33
+ }
34
+
35
+ initialize () { }
36
+
37
+ static #idMap = new WeakMap ()
38
+ static #idCounter = 0
39
+
40
+ static getId (object)
41
+ {
42
+ const id = Interface .#idMap .get (object)
43
+
44
+ if (id !== undefined)
45
+ return id
46
+
47
+ Interface .#idMap .set (object, ++ Interface .#idCounter)
48
+
49
+ return Interface .#idCounter
50
+ }
51
+
52
+ get id ()
53
+ {
54
+ return Interface .getId (this)
55
+ }
56
+
57
+ get browser ()
58
+ {
59
+ return X3D .getBrowser ("#browser")
60
+ }
61
+
62
+ get filePath ()
63
+ {
64
+ const worldURL = this .browser .currentScene .worldURL
65
+
66
+ // New unsaved file.
67
+ if (location .href === worldURL || !worldURL .startsWith ("file:"))
68
+ return undefined
69
+ else
70
+ return url .fileURLToPath (worldURL)
71
+ }
72
+
73
+ set filePath (value)
74
+ {
75
+ const
76
+ oldWorldURL = this .browser .currentScene .worldURL,
77
+ newWorldURL = value ? url .pathToFileURL (value) .href : location .href
78
+
79
+ this .browser .currentScene .setWorldURL (newWorldURL)
80
+
81
+ this .updateFileConfigs (oldWorldURL, newWorldURL)
82
+ }
83
+
84
+ /**
85
+ *
86
+ * @param {string} event
87
+ */
88
+ setBrowserEvent (event)
89
+ {
90
+ if (event !== X3D .X3DConstants .INITIALIZED_EVENT)
91
+ return
92
+
93
+ this .config .file = this .createFileConfig (this .browser .getWorldURL ())
94
+
95
+ this .configure ()
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @param {string} namespace
101
+ * @returns A new data storage
102
+ */
103
+ createGlobalConfig (namespace = this .namespace)
104
+ {
105
+ return new DataStorage (localStorage, namespace)
106
+ }
107
+
108
+ /**
109
+ *
110
+ * @param {string} url
111
+ * @returns {DataStorage}
112
+ */
113
+ createFileConfig (url = "", global = this .config .global)
114
+ {
115
+ return global .addNameSpace (md5 (url) + ".")
116
+ }
117
+
118
+ /**
119
+ *
120
+ * @param {string} from URL
121
+ * @param {string} to URL
122
+ */
123
+ updateFileConfigs (from, to)
124
+ {
125
+ const
126
+ fromHash = `.${md5 (from)}.`,
127
+ toHash = `.${md5 (to)}.`
128
+
129
+ const config = new DataStorage (localStorage, "Sunrize.")
130
+
131
+ for (const key of Object .keys (config))
132
+ {
133
+ if (!key .includes (fromHash))
134
+ continue
135
+
136
+ const
137
+ value = config [key],
138
+ newKey = key .replace (fromHash, toHash)
139
+
140
+ config [newKey] = value
141
+ }
142
+
143
+ for (const other of Interface .#interfaces)
144
+ other .config .file = other .createFileConfig (to)
145
+ }
146
+
147
+ configure () { }
148
+ }
@@ -0,0 +1,156 @@
1
+ "use strict"
2
+
3
+ const
4
+ $ = require ("jquery"),
5
+ X3D = require ("../X3D"),
6
+ Interface = require ("./Interface"),
7
+ Box3 = X3D .require ("standard/Math/Geometry/Box3"),
8
+ _ = require ("./GetText")
9
+
10
+ module .exports = class SecondaryToolbar extends Interface
11
+ {
12
+ constructor (element)
13
+ {
14
+ super ("Sunrize.SecondaryToolbar.")
15
+
16
+ this .toolbar = element
17
+
18
+ this .setup ()
19
+ }
20
+
21
+ async initialize ()
22
+ {
23
+ this .handButton = $("<span></span>")
24
+ .addClass (["image-icon", "hand"])
25
+ .attr ("title", _ ("Switch to browser mode."))
26
+ .appendTo (this .toolbar)
27
+ .on ("click", () => this .hand ())
28
+
29
+ this .handButton .addClass ("active")
30
+
31
+ this .arrowButton = $("<span></span>")
32
+ .addClass (["image-icon", "arrow"])
33
+ .attr ("title", _ ("Switch to edit mode."))
34
+ .appendTo (this .toolbar)
35
+ .on ("click", () => this .arrow ())
36
+
37
+ this .playButton = $("<span></span>")
38
+ .addClass (["material-icons", "active"])
39
+ .attr ("title", _ ("Toggle browser update."))
40
+ .css ({ position: "relative", left: "-1px", "font-weight": "bold" })
41
+ .text ("play_arrow")
42
+ .appendTo (this .toolbar)
43
+ .on ("click", () => this .play (!this .config .file .play))
44
+
45
+ $("<span></span>") .addClass ("separator") .appendTo (this .toolbar)
46
+
47
+ this .viewAllButton = $("<span></span>")
48
+ .addClass (["material-symbols-outlined"])
49
+ .attr ("title", _ ("View all objects in active layer."))
50
+ .text ("center_focus_strong")
51
+ .appendTo (this .toolbar)
52
+ .on ("click", () => this .viewAll ())
53
+
54
+ this .straightenButton = $("<span></span>")
55
+ .addClass (["material-symbols-outlined", "active"])
56
+ .attr ("title", _ ("Straighten horizon."))
57
+ .text ("wb_twilight")
58
+ .appendTo (this .toolbar)
59
+ .on ("click", () => this .straighten (!this .browser .getBrowserOption ("StraightenHorizon")))
60
+ }
61
+
62
+ configure ()
63
+ {
64
+ this .config .file .addDefaultValues ({
65
+ pointer: "hand",
66
+ play: true,
67
+ })
68
+
69
+ this [this .config .file .pointer] ()
70
+ this .play (this .config .file .play)
71
+ this .straighten (this .browser .getBrowserOption ("StraightenHorizon"))
72
+ }
73
+
74
+ hand ()
75
+ {
76
+ this .config .file .pointer = "hand"
77
+
78
+ if (this .handButton .hasClass ("active"))
79
+ return
80
+
81
+ this .arrowButton .removeClass ("active")
82
+ this .handButton .addClass ("active")
83
+ }
84
+
85
+ arrow ()
86
+ {
87
+ this .config .file .pointer = "arrow"
88
+
89
+ if (this .arrowButton .hasClass ("active"))
90
+ return
91
+
92
+ this .handButton .removeClass ("active")
93
+ this .arrowButton .addClass ("active")
94
+ }
95
+
96
+ play (value)
97
+ {
98
+ this .config .file .play = value
99
+
100
+ if (value)
101
+ {
102
+ this .playButton .addClass ("active")
103
+ this .browser .beginUpdate ()
104
+ }
105
+ else
106
+ {
107
+ this .playButton .removeClass ("active")
108
+ this .browser .endUpdate ()
109
+ }
110
+ }
111
+
112
+ viewAll ()
113
+ {
114
+ const
115
+ outlineEditor = require ("./Document") .sidebar .outlineEditor,
116
+ selection = outlineEditor .sceneGraph .find (".node.selected")
117
+
118
+ if (selection .length)
119
+ {
120
+ const
121
+ layerNode = this .browser .getActiveLayer (),
122
+ viewpointNode = this .browser .getActiveViewpoint (),
123
+ bbox = new Box3 (),
124
+ straighten = this .browser .getBrowserOption ("StraightenHorizon")
125
+
126
+ for (const element of selection)
127
+ {
128
+ const node = outlineEditor .getNode ($(element))
129
+
130
+ if (!node .getType () .includes (X3D .X3DConstants .X3DBoundedObject))
131
+ continue
132
+
133
+ const modelMatrix = outlineEditor .getModelMatrix ($(element), false)
134
+
135
+ bbox .add (node .getBBox (new Box3 ()) .multRight (modelMatrix))
136
+ }
137
+
138
+ viewpointNode .lookAtBBox (layerNode, bbox, 1, straighten)
139
+ }
140
+ else
141
+ {
142
+ this .browser .viewAll ()
143
+ }
144
+ }
145
+
146
+ straighten (value)
147
+ {
148
+ this .browser .setBrowserOption ("StraightenHorizon", value)
149
+
150
+ if (value)
151
+ this .straightenButton .addClass ("active")
152
+ else
153
+ this .straightenButton .removeClass ("active")
154
+ }
155
+ }
156
+
@@ -0,0 +1,49 @@
1
+ require ("../Tools")
2
+
3
+ module .exports = new class Selection
4
+ {
5
+ constructor ()
6
+ {
7
+ this .nodes = new Map ()
8
+ }
9
+
10
+ clear (exception)
11
+ {
12
+ for (const node of this .nodes .values ())
13
+ {
14
+ if (node !== exception)
15
+ node .removeTool ()
16
+ }
17
+
18
+ this .nodes .clear ()
19
+ }
20
+
21
+ set (node)
22
+ {
23
+ const tool = this .tool (node)
24
+
25
+ this .clear (tool)
26
+ this .add (tool ?? node)
27
+ }
28
+
29
+ add (node)
30
+ {
31
+ this .nodes .set (this .node (node), node .addTool ())
32
+ }
33
+
34
+ remove (node)
35
+ {
36
+ this .tool (node) .removeTool ()
37
+ this .nodes .delete (this .node (node))
38
+ }
39
+
40
+ node (node)
41
+ {
42
+ return node .node ?? node
43
+ }
44
+
45
+ tool (node)
46
+ {
47
+ return this .nodes .get (this .node (node))
48
+ }
49
+ }
@@ -0,0 +1,51 @@
1
+ "use strict"
2
+
3
+ const
4
+ OutlineEditor = require ("../Editors/OutlineEditor"),
5
+ Tabs = require ("../Controls/Tabs")
6
+
7
+ module .exports = class Sidebar extends Tabs
8
+ {
9
+ constructor (element)
10
+ {
11
+ super (element, "bottom")
12
+
13
+ this .setup ()
14
+ }
15
+
16
+ addTabs ()
17
+ {
18
+ this .addIconTab ("file-manager", "description", "File Manager")
19
+ this .addIconTab ("outline-editor", "list", "Outline Editor")
20
+ this .addIconTab ("node-inspector", "visibility", "Node Inspector")
21
+
22
+ this .outlineEditor = new OutlineEditor (this .getPanel ("outline-editor"))
23
+ }
24
+
25
+ configure ()
26
+ {
27
+ super .configure ({ active: 1 })
28
+ }
29
+
30
+ initTab (panel)
31
+ {
32
+ switch (panel .attr ("id"))
33
+ {
34
+ case "file-manager":
35
+ {
36
+ const FileManager = require ("../Editors/FileManager")
37
+
38
+ this .fileManger = new FileManager (panel)
39
+ break
40
+ }
41
+ case "node-inspector":
42
+ {
43
+ const NodeInspector = require ("../Editors/NodeInspector")
44
+
45
+ this .nodeInspector = new NodeInspector (panel)
46
+ break
47
+ }
48
+ }
49
+ }
50
+ }
51
+