sunrize 1.10.4 → 1.11.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "1.10.4",
4
+ "version": "1.11.0",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -78,13 +78,13 @@
78
78
  "url": "https://patreon.com/X_ITE"
79
79
  },
80
80
  "devDependencies": {
81
- "@electron-forge/cli": "^7.8.1",
82
- "@electron-forge/maker-deb": "^7.8.1",
83
- "@electron-forge/maker-dmg": "^7.8.1",
84
- "@electron-forge/maker-rpm": "^7.8.1",
85
- "@electron-forge/maker-squirrel": "^7.8.1",
86
- "@electron-forge/maker-zip": "^7.8.1",
87
- "@electron-forge/publisher-github": "^7.8.1",
81
+ "@electron-forge/cli": "^7.9.0",
82
+ "@electron-forge/maker-deb": "^7.9.0",
83
+ "@electron-forge/maker-dmg": "^7.9.0",
84
+ "@electron-forge/maker-rpm": "^7.9.0",
85
+ "@electron-forge/maker-squirrel": "^7.9.0",
86
+ "@electron-forge/maker-zip": "^7.9.0",
87
+ "@electron-forge/publisher-github": "^7.9.0",
88
88
  "shell-tools": "^1.1.9"
89
89
  },
90
90
  "dependencies": {
@@ -99,7 +99,7 @@
99
99
  "jquery-ui-dist": "^1.13.3",
100
100
  "jstree": "^3.3.17",
101
101
  "material-icons": "^1.13.14",
102
- "material-symbols": "^0.35.0",
102
+ "material-symbols": "^0.36.1",
103
103
  "md5": "^2.3.0",
104
104
  "mime-types": "^3.0.1",
105
105
  "monaco-editor": "^0.53.0",
@@ -109,7 +109,7 @@
109
109
  "string-similarity": "^4.0.4",
110
110
  "tweakpane": "^3.1.10",
111
111
  "update-electron-app": "^3.1.1",
112
- "x_ite": "^12.0.9",
112
+ "x_ite": "^12.1.0",
113
113
  "x3d-traverse": "^1.0.13"
114
114
  }
115
115
  }
@@ -304,7 +304,7 @@ module .exports = class Application
304
304
  click: () => this .mainWindow .webContents .send ("save-file"),
305
305
  },
306
306
  {
307
- label: _("Save As..."),
307
+ label: _("Save as..."),
308
308
  accelerator: "Shift+CmdOrCtrl+S",
309
309
  click: async () =>
310
310
  {
@@ -353,7 +353,7 @@ module .exports = class Application
353
353
  ... exportPath ?
354
354
  [
355
355
  {
356
- label: util .format (_("Export As %s"), path .basename (exportPath)),
356
+ label: util .format (_("Export as %s"), path .basename (exportPath)),
357
357
  accelerator: "CmdOrCtrl+E",
358
358
  click: () => this .mainWindow .webContents .send ("export-as", exportPath),
359
359
  }
@@ -361,7 +361,7 @@ module .exports = class Application
361
361
  :
362
362
  [ ],
363
363
  {
364
- label: _("Export As..."),
364
+ label: _("Export as..."),
365
365
  accelerator: "Shift+CmdOrCtrl+E",
366
366
  click: async () =>
367
367
  {
@@ -928,7 +928,6 @@ module .exports = class Application
928
928
  window .on ("unmaximize", () => this .onunmaximize ());
929
929
  window .on ("enter-full-screen", () => this .onenterfullscreen ());
930
930
  window .on ("leave-full-screen", () => this .onleavefullscreen ());
931
- window .on ("blur", () => this .onblur ());
932
931
  window .on ("close", (event) => this .onclose (event));
933
932
 
934
933
  if (this .config .fullscreen)
@@ -1170,11 +1169,6 @@ module .exports = class Application
1170
1169
  this .config .maximized = false;
1171
1170
  }
1172
1171
 
1173
- onblur ()
1174
- {
1175
- this .mainWindow .webContents .send ("save-all-files");
1176
- }
1177
-
1178
1172
  onclose (event)
1179
1173
  {
1180
1174
  if (!this .mainWindow .closing)
@@ -70,7 +70,7 @@ module .exports = class Document extends Interface
70
70
  // File Menu
71
71
 
72
72
  electron .ipcRenderer .on ("open-files", (event, urls) => this .loadURL (urls [0])); // DEBUG
73
- electron .ipcRenderer .on ("save-file", (event, force) => this .saveFile (force));
73
+ electron .ipcRenderer .on ("save-file", (event) => this .saveFile ());
74
74
  electron .ipcRenderer .on ("save-file-as", (event, filePath) => this .saveFileAs (filePath));
75
75
  electron .ipcRenderer .on ("save-copy-as", (event, filePath) => this .saveCopyAs (filePath));
76
76
  electron .ipcRenderer .on ("auto-save", (event, value) => this .autoSave = value);
@@ -434,13 +434,10 @@ Viewpoint {
434
434
  *
435
435
  * @param {boolean} force force save
436
436
  */
437
- saveFile (force = false)
437
+ saveFile ()
438
438
  {
439
439
  this .footer .scriptEditor ?.apply ();
440
440
 
441
- if (!UndoManager .shared .saveNeeded && !force)
442
- return;
443
-
444
441
  const scene = this .browser .currentScene;
445
442
 
446
443
  // Infer profile and components.
@@ -515,7 +512,7 @@ Viewpoint {
515
512
 
516
513
  Editor .rewriteURLs (scene, scene, oldWorldURL, scene .worldURL);
517
514
 
518
- this .saveFile (true);
515
+ this .saveFile ();
519
516
  }
520
517
 
521
518
  /**
@@ -536,7 +533,7 @@ Viewpoint {
536
533
 
537
534
  Editor .rewriteURLs (scene, scene, oldWorldURL, newWorldURL, undoManager);
538
535
 
539
- this .saveFile (true);
536
+ this .saveFile ();
540
537
 
541
538
  undoManager .undo ();
542
539
 
@@ -552,19 +549,19 @@ Viewpoint {
552
549
  {
553
550
  this .config .global .autoSave = value;
554
551
 
555
- this .registerAutoSave ();
552
+ this .requestAutoSave ();
556
553
  }
557
554
 
558
555
  #saveTimeoutId = undefined;
559
556
 
560
- registerAutoSave ()
557
+ requestAutoSave ()
561
558
  {
562
559
  if (!this .autoSave)
563
560
  return;
564
561
 
565
562
  clearTimeout (this .#saveTimeoutId);
566
563
 
567
- this .#saveTimeoutId = setTimeout (() => this .saveFile (false), 1000);
564
+ this .#saveTimeoutId = setTimeout (() => this .saveFile (), 1000);
568
565
  }
569
566
 
570
567
  exportAs (filePath)
@@ -574,7 +571,8 @@ Viewpoint {
574
571
 
575
572
  close ()
576
573
  {
577
- this .saveFile (false);
574
+ if (UndoManager .shared .saveNeeded)
575
+ this .saveFile ();
578
576
 
579
577
  electron .ipcRenderer .sendToHost ("closed");
580
578
  }
@@ -598,7 +596,7 @@ Viewpoint {
598
596
  this .updateMenu ();
599
597
 
600
598
  if (UndoManager .shared .saveNeeded)
601
- this .registerAutoSave ();
599
+ this .requestAutoSave ();
602
600
 
603
601
  electron .ipcRenderer .sendToHost ("saved", !UndoManager .shared .saveNeeded);
604
602
  }
@@ -16,11 +16,9 @@ module .exports = class Footer extends Tabs
16
16
 
17
17
  addTabs ()
18
18
  {
19
- this .addTextTab ("console", _("Console"))
20
- this .addTextTab ("script-editor", _("Script Editor"))
21
-
22
- if (process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT")
23
- this .addTextTab ("animation-editor", _("Animation Editor"))
19
+ this .addTextTab ("console", _("Console"))
20
+ this .addTextTab ("script-editor", _("Script Editor"))
21
+ this .addTextTab ("animation-editor", _("Animation Editor"))
24
22
 
25
23
  this .console = new Console (this .getPanel ("console"))
26
24
  }
@@ -51,7 +51,6 @@ module .exports = new class Tabs
51
51
 
52
52
  electron .ipcRenderer .on ("open-files", (event, urls) => this .openTabs (urls));
53
53
  electron .ipcRenderer .on ("reload" , (event) => this .reloadTab ());
54
- electron .ipcRenderer .on ("save-file", (event) => this .saveFile ());
55
54
  electron .ipcRenderer .on ("save-file-as", (event, filePath) => this .saveFileAs (filePath));
56
55
  electron .ipcRenderer .on ("save-all-files", (event) => this .saveAllFiles ());
57
56
  electron .ipcRenderer .on ("close-tab", (event) => this .tabs .getActiveTab () ?.close (true));
@@ -68,7 +67,7 @@ module .exports = new class Tabs
68
67
  this .forwardToAllTabs ("auto-save");
69
68
  this .forwardToActiveTab ("export-as");
70
69
 
71
- this .forwardToActiveTab ("scene-properties");
70
+ this .forwardToActiveTab ("save-file");
72
71
  this .forwardToActiveTab ("save-copy-as");
73
72
  this .forwardToActiveTab ("scene-properties");
74
73
 
@@ -110,6 +109,7 @@ module .exports = new class Tabs
110
109
  this .forwardToActiveTab ("move-selection-center-to-snap-target");
111
110
 
112
111
  this .forwardToActiveTab ("script-editor");
112
+ this .forwardToActiveTab ("animation-members-list");
113
113
  this .forwardToActiveTab ("outline-editor");
114
114
 
115
115
  // Restore tabs.
@@ -315,11 +315,6 @@ module .exports = new class Tabs
315
315
  this .saveTabs ();
316
316
  }
317
317
 
318
- saveFile ()
319
- {
320
- this .tabs .getActiveTab () .webview .send ("save-file", true);
321
- }
322
-
323
318
  saveFileAs (filePath)
324
319
  {
325
320
  const
@@ -11,6 +11,14 @@ function Collision (executionContext)
11
11
 
12
12
  Object .assign (Object .setPrototypeOf (Collision .prototype, X3D .Collision .prototype),
13
13
  {
14
+ initialize ()
15
+ {
16
+ X3D .Collision .prototype .initialize .call (this);
17
+
18
+ this ._proxy .addInterest ("set_tool_proxy__", this);
19
+
20
+ this .set_tool_proxy__ ();
21
+ },
14
22
  getProxyDisplay ()
15
23
  {
16
24
  return this .proxyDisplay;
@@ -21,21 +29,23 @@ Object .assign (Object .setPrototypeOf (Collision .prototype, X3D .Collision .pr
21
29
 
22
30
  this .set_collisionObjects__ ();
23
31
  },
24
- set_proxy__ ()
32
+ set_tool_proxy__ ()
25
33
  {
26
- this .pointingObjects .delete (this .proxyNode);
27
- this .visibleObjects .delete (this .proxyNode);
34
+ this .pointingObjects .delete (this .toolProxyNode);
35
+ this .visibleObjects .delete (this .toolProxyNode);
36
+
37
+ this .toolProxyNode = X3D .X3DCast (X3D .X3DConstants .X3DChildNode, this ._proxy);
28
38
 
29
- X3D .Collision .prototype .set_proxy__ .call (this);
39
+ this .set_collisionObjects__ ();
30
40
  },
31
41
  set_pointingObjects__ ()
32
42
  {
33
- if (this .proxyNode)
43
+ if (this .toolProxyNode)
34
44
  {
35
45
  if (this .proxyDisplay)
36
- this .pointingObjects .add (this .proxyNode);
46
+ this .pointingObjects .add (this .toolProxyNode);
37
47
  else
38
- this .pointingObjects .delete (this .proxyNode);
48
+ this .pointingObjects .delete (this .toolProxyNode);
39
49
  }
40
50
 
41
51
  X3D .Collision .prototype .set_pointingObjects__ .call (this);
@@ -51,12 +61,12 @@ Object .assign (Object .setPrototypeOf (Collision .prototype, X3D .Collision .pr
51
61
  },
52
62
  set_visibleObjects__ ()
53
63
  {
54
- if (this .proxyNode)
64
+ if (this .toolProxyNode)
55
65
  {
56
66
  if (this .proxyDisplay)
57
- this .visibleObjects .add (this .proxyNode);
67
+ this .visibleObjects .add (this .toolProxyNode);
58
68
  else
59
- this .visibleObjects .delete (this .proxyNode);
69
+ this .visibleObjects .delete (this .toolProxyNode);
60
70
  }
61
71
 
62
72
  X3D .Collision .prototype .set_visibleObjects__ .call (this);
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ const
4
+ X3D = require ("../X3D"),
5
+ util = require ("util"),
6
+ $ = require ("jquery"),
7
+ _ = require ("../Application/GetText");
8
+
9
+ require ("./Popover");
10
+
11
+ $.fn.animationPropertiesPopover = function (editor)
12
+ {
13
+ // Create content.
14
+
15
+ const content = $("<div></div>");
16
+
17
+ $("<span></span>")
18
+ .text (_("Frames"))
19
+ .appendTo (content);
20
+
21
+ const durationInput = $("<input></input>")
22
+ .attr ("type", "number")
23
+ .attr ("step", 1)
24
+ .attr ("min", 1)
25
+ .attr ("placeholder", _("Enter duration"))
26
+ .val (editor .getDuration ())
27
+ .on ("change input", updateTime)
28
+ .appendTo (content);
29
+
30
+ $("<span></span>")
31
+ .text (_("Frame Rate (fps)"))
32
+ .appendTo (content);
33
+
34
+ const frameRateInput = $("<input></input>")
35
+ .attr ("type", "number")
36
+ .attr ("step", 1)
37
+ .attr ("min", 1)
38
+ .attr ("placeholder", _("Enter frame rate"))
39
+ .val (editor .getFrameRate ())
40
+ .on ("change input", updateTime)
41
+ .appendTo (content);
42
+
43
+ const scaleInput = $("<input></input>")
44
+ .attr ("type", "checkbox")
45
+ .attr ("id", "keyframe-scale")
46
+ .appendTo (content);
47
+
48
+ if (editor .config .file .scaleKeyframes)
49
+ scaleInput .attr ("checked", "");
50
+
51
+ const scaleLabel = $("<label></label>")
52
+ .attr ("for", "keyframe-scale")
53
+ .text (_("Scale Keyframes"))
54
+ .appendTo (content);
55
+
56
+ const timeText = $("<span></span>")
57
+ .attr ("title", _("Duration (hours:minutes:seconds:frames)."))
58
+ .css ("margin-top", "2px")
59
+ .css ("margin-bottom", "4px")
60
+ .appendTo (content);
61
+
62
+ const applyButton = $("<button></button>")
63
+ .text (_("Apply"))
64
+ .appendTo (content);
65
+
66
+ updateTime ();
67
+
68
+ function updateTime ()
69
+ {
70
+ const duration = parseInt (durationInput .val ())
71
+ const frameRate = parseInt (frameRateInput .val ());
72
+
73
+ timeText .text (util .format (_("Duration: %s"), editor .formatFrames (duration, frameRate)));
74
+ }
75
+
76
+ // Create tooltip.
77
+
78
+ const tooltip = this .popover ({
79
+ position: {
80
+ my: "bottom right",
81
+ at: "top left",
82
+ },
83
+ content: content,
84
+ events: {
85
+ show: (event, api) =>
86
+ {
87
+ applyButton .on ("click", (event) =>
88
+ {
89
+ api .toggle (false);
90
+ editor .resizeAnimation (parseInt (durationInput .val ()), parseInt (frameRateInput .val ()), scaleInput .prop ("checked"));
91
+ })
92
+ },
93
+ },
94
+ });
95
+
96
+ return this;
97
+ };
98
+
@@ -3,56 +3,56 @@
3
3
  const
4
4
  $ = require ("jquery"),
5
5
  Interface = require ("../Application/Interface"),
6
- Algorithm = require ("../Bits/Algorithm")
6
+ Algorithm = require ("../Bits/Algorithm");
7
7
 
8
8
  module .exports = class Splitter extends Interface
9
9
  {
10
10
  constructor (element, orientation)
11
11
  {
12
- super (`Sunrize.Splitter.${element .attr ("id")}.`)
12
+ super (`Sunrize.Splitter.${element .attr ("id")}.`);
13
13
 
14
- this .splitter = element
15
- this .orientation = orientation
14
+ this .splitter = element;
15
+ this .orientation = orientation;
16
16
 
17
17
  switch (this .orientation)
18
18
  {
19
19
  case "horizontal":
20
20
  {
21
- const top = this .splitter .find ("> .horizontal-splitter-top")
21
+ const top = this .splitter .find ("> .horizontal-splitter-top");
22
22
 
23
23
  top .resizable ({
24
24
  minHeight: 0,
25
25
  handles: "s",
26
26
  resize: () => this .position = this .position,
27
- })
27
+ });
28
28
 
29
- top .find ("> .ui-resizable-s") .append ($("<div></div>"))
30
- break
29
+ top .find ("> .ui-resizable-s") .append ($("<div></div>"));
30
+ break;
31
31
  }
32
32
  case "vertical":
33
33
  {
34
- const left = this .splitter .find ("> .vertical-splitter-left")
34
+ const left = this .splitter .find ("> .vertical-splitter-left");
35
35
 
36
36
  left .resizable ({
37
37
  minWidth: 0,
38
38
  handles: "e",
39
39
  resize: () => this .position = this .position,
40
- })
40
+ });
41
41
 
42
- left .find ("> .ui-resizable-e") .append ($("<div></div>"))
43
- break
42
+ left .find ("> .ui-resizable-e") .append ($("<div></div>"));
43
+ break;
44
44
  }
45
45
  }
46
46
 
47
- this .setup ()
47
+ this .setup ();
48
48
  }
49
49
 
50
50
  configure ()
51
51
  {
52
52
  if (this .config .file .position !== undefined)
53
- this .position = this .config .file .position
53
+ this .position = this .config .file .position;
54
54
  else
55
- this .splitter .trigger ("position")
55
+ this .splitter .trigger ("position");
56
56
  }
57
57
 
58
58
  get position ()
@@ -61,15 +61,15 @@ module .exports = class Splitter extends Interface
61
61
  {
62
62
  case "horizontal":
63
63
  {
64
- const top = this .splitter .find ("> .horizontal-splitter-top")
64
+ const top = this .splitter .find ("> .horizontal-splitter-top");
65
65
 
66
- return this .position = top .outerHeight () / this .splitter .innerHeight ()
66
+ return top .outerHeight () / this .splitter .innerHeight ();
67
67
  }
68
68
  case "vertical":
69
69
  {
70
- const left = this .splitter .find ("> .vertical-splitter-left")
70
+ const left = this .splitter .find ("> .vertical-splitter-left");
71
71
 
72
- return left .outerWidth () / this .splitter .innerWidth ()
72
+ return left .outerWidth () / this .splitter .innerWidth ();
73
73
  }
74
74
  }
75
75
  }
@@ -79,9 +79,9 @@ module .exports = class Splitter extends Interface
79
79
  */
80
80
  set position (position)
81
81
  {
82
- position = Algorithm .clamp (position, 0, 1)
82
+ position = Algorithm .clamp (position, 0, 1);
83
83
 
84
- this .config .file .position = position
84
+ this .config .file .position = position;
85
85
 
86
86
  switch (this .orientation)
87
87
  {
@@ -89,24 +89,24 @@ module .exports = class Splitter extends Interface
89
89
  {
90
90
  const
91
91
  top = this .splitter .find ("> .horizontal-splitter-top"),
92
- bottom = this .splitter .find ("> .horizontal-splitter-bottom")
92
+ bottom = this .splitter .find ("> .horizontal-splitter-bottom");
93
93
 
94
- top .css ("height", (100 * position) + "%")
95
- bottom .css ("height", (100 * (1 - position)) + "%")
96
- break
94
+ top .css ("height", (100 * position) + "%");
95
+ bottom .css ("height", (100 * (1 - position)) + "%");
96
+ break;
97
97
  }
98
98
  case "vertical":
99
99
  {
100
100
  const
101
101
  left = this .splitter .find ("> .vertical-splitter-left"),
102
- right = this .splitter .find ("> .vertical-splitter-right")
102
+ right = this .splitter .find ("> .vertical-splitter-right");
103
103
 
104
- left .css ("width", (100 * position) + "%")
105
- right .css ("width", (100 * (1 - position)) + "%")
106
- break
104
+ left .css ("width", (100 * position) + "%");
105
+ right .css ("width", (100 * (1 - position)) + "%");
106
+ break;
107
107
  }
108
108
  }
109
109
 
110
- this .splitter .trigger ("position")
110
+ this .splitter .trigger ("position");
111
111
  }
112
112
  }