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,204 @@
1
+ "use strict"
2
+
3
+ const
4
+ util = require ("util"),
5
+ _ = require ("../Application/GetText")
6
+
7
+ module .exports = class UndoManager
8
+ {
9
+ static shared = new UndoManager (true)
10
+
11
+ saveNeeded = false
12
+ undoStack = [ ]
13
+ undoFunctions = [ ]
14
+ deferFunctions = new Map ()
15
+ undoList = [ ]
16
+ undoIndex = -1
17
+ undoLabel = _ ("Undo")
18
+ redoLabel = _ ("Redo")
19
+
20
+ undo ()
21
+ {
22
+ if (this .undoIndex < 0)
23
+ return
24
+
25
+ const undoItem = this .undoList [this .undoIndex]
26
+
27
+ // Call undo functions.
28
+
29
+ this .beginUndo (undoItem .description)
30
+
31
+ for (const undoFunction of undoItem .undoFunctions)
32
+ undoFunction ()
33
+
34
+ // Process deferred functions.
35
+
36
+ for (const deferFunction of this .deferFunctions .values ())
37
+ deferFunction ()
38
+
39
+ // End undo.
40
+
41
+ this .undoStack .pop ()
42
+
43
+ // Assign redo functions.
44
+
45
+ undoItem .redoFunctions = this .undoFunctions
46
+ this .undoFunctions = [ ]
47
+ this .deferFunctions = new Map ()
48
+ this .undoIndex -= 1
49
+ this .saveNeeded = true
50
+
51
+ // Make labels.
52
+
53
+ if (this .undoIndex < 0)
54
+ this .undoLabel = _ ("Undo")
55
+ else
56
+ this .undoLabel = util .format (_ ("Undo %s"), this .undoList [this .undoIndex] .description)
57
+
58
+ this .redoLabel = util .format (_ ("Redo %s"), undoItem .description)
59
+
60
+ // Propagate change.
61
+
62
+ this .processInterests ()
63
+ }
64
+
65
+ redo ()
66
+ {
67
+ if (this .undoIndex + 1 >= this .undoList .length)
68
+ return
69
+
70
+ this .undoIndex += 1
71
+
72
+ const undoItem = this .undoList [this .undoIndex]
73
+
74
+ // Call redo functions.
75
+
76
+ this .beginUndo (undoItem .description)
77
+
78
+ for (const redoFunction of undoItem .redoFunctions)
79
+ redoFunction ()
80
+
81
+ // Process deferred functions.
82
+
83
+ for (const deferFunction of this .deferFunctions .values ())
84
+ deferFunction ()
85
+
86
+ // End undo.
87
+
88
+ this .undoStack .pop ()
89
+
90
+ // Assign undo functions.
91
+
92
+ undoItem .undoFunctions = this .undoFunctions
93
+ this .undoFunctions = [ ]
94
+ this .deferFunctions = new Map ()
95
+ this .saveNeeded = true
96
+
97
+ // Make labels.
98
+
99
+ this .undoLabel = util .format (_ ("Undo %s"), undoItem .description)
100
+
101
+ if (this .undoIndex + 1 >= this .undoList .length)
102
+ this .redoLabel = _ ("Redo")
103
+ else
104
+ this .redoLabel = util .format (_ ("Redo %s"), this .undoList [this .undoIndex + 1] .description)
105
+
106
+ // Propagate change.
107
+
108
+ this .processInterests ()
109
+ }
110
+
111
+ /**
112
+ *
113
+ * @param {...string} args description
114
+ */
115
+ beginUndo (...args)
116
+ {
117
+ this .undoStack .push (util .format (...args))
118
+ }
119
+
120
+ endUndo ()
121
+ {
122
+ const description = this .undoStack .pop ()
123
+
124
+ if (this .undoStack .length)
125
+ return
126
+
127
+ // Process deferred functions.
128
+
129
+ this .undoStack .push (description)
130
+
131
+ for (const deferFunction of this .deferFunctions .values ())
132
+ deferFunction ()
133
+
134
+ this .undoStack .pop ()
135
+
136
+ // Test if something happened.
137
+
138
+ if (!this .undoFunctions .length)
139
+ return
140
+
141
+ // Assign undo functions.
142
+
143
+ this .undoList .length = this .undoIndex + 1
144
+
145
+ this .undoList .push ({
146
+ description: description,
147
+ undoFunctions: this .undoFunctions,
148
+ })
149
+
150
+ this .undoFunctions = [ ]
151
+ this .deferFunctions = new Map ()
152
+ this .undoIndex = this .undoList .length - 1
153
+ this .saveNeeded = true
154
+
155
+ // Make labels.
156
+
157
+ this .undoLabel = util .format (_ ("Undo %s"), description)
158
+ this .redoLabel = _ ("Redo")
159
+
160
+ // Propagate change.
161
+
162
+ this .processInterests ()
163
+ }
164
+
165
+ /**
166
+ *
167
+ * @param {function} undoFunction
168
+ * @param {boolean} after
169
+ */
170
+ registerUndo (undoFunction, after = false)
171
+ {
172
+ if (after)
173
+ this .undoFunctions .push (undoFunction)
174
+ else
175
+ this .undoFunctions .unshift (undoFunction)
176
+ }
177
+
178
+ /**
179
+ * If only key is provided, the function return if there is already a defer function registered.
180
+ * @param {*} key
181
+ * @param {function=} deferFunction
182
+ * @returns
183
+ */
184
+ defer (key, deferFunction)
185
+ {
186
+ if (arguments .length == 1)
187
+ return this .deferFunctions .has (key)
188
+
189
+ this .deferFunctions .set (key, deferFunction)
190
+ }
191
+
192
+ interests = new Map ()
193
+
194
+ addInterest (key, callback)
195
+ {
196
+ this .interests .set (key, callback)
197
+ }
198
+
199
+ processInterests ()
200
+ {
201
+ for (const callback of this .interests .values ())
202
+ callback ()
203
+ }
204
+ }
@@ -0,0 +1,8 @@
1
+ "use strict"
2
+
3
+ /**
4
+ * @type {{ SFBool: SFBool, SFColor: SFColor, }}
5
+ */
6
+ const X3D = process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT" ? require ("../../x_ite/dist/x_ite") : require ("x_ite")
7
+
8
+ module .exports = X3D