@needle-tools/engine 3.3.0-alpha → 3.5.0-alpha

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 (149) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/needle-engine.js +62620 -61118
  3. package/dist/needle-engine.min.js +434 -410
  4. package/dist/needle-engine.umd.cjs +435 -411
  5. package/lib/engine/api.d.ts +1 -0
  6. package/lib/engine/api.js +1 -0
  7. package/lib/engine/api.js.map +1 -1
  8. package/lib/engine/codegen/register_types.js +50 -2
  9. package/lib/engine/codegen/register_types.js.map +1 -1
  10. package/lib/engine/engine_context.d.ts +1 -1
  11. package/lib/engine/engine_context.js +21 -15
  12. package/lib/engine/engine_context.js.map +1 -1
  13. package/lib/engine/engine_context_registry.d.ts +5 -3
  14. package/lib/engine/engine_context_registry.js +10 -2
  15. package/lib/engine/engine_context_registry.js.map +1 -1
  16. package/lib/engine/engine_element.js.map +1 -1
  17. package/lib/engine/engine_element_loading.js +2 -3
  18. package/lib/engine/engine_element_loading.js.map +1 -1
  19. package/lib/engine/engine_gameobject.d.ts +1 -1
  20. package/lib/engine/engine_gameobject.js +4 -2
  21. package/lib/engine/engine_gameobject.js.map +1 -1
  22. package/lib/engine/engine_input.d.ts +2 -2
  23. package/lib/engine/engine_physics.d.ts +20 -93
  24. package/lib/engine/engine_physics.js +20 -892
  25. package/lib/engine/engine_physics.js.map +1 -1
  26. package/lib/engine/engine_physics.types.js.map +1 -1
  27. package/lib/engine/engine_physics_rapier.d.ts +103 -0
  28. package/lib/engine/engine_physics_rapier.js +1003 -0
  29. package/lib/engine/engine_physics_rapier.js.map +1 -0
  30. package/lib/engine/engine_three_utils.js +2 -2
  31. package/lib/engine/engine_three_utils.js.map +1 -1
  32. package/lib/engine/engine_types.d.ts +50 -1
  33. package/lib/engine/engine_types.js +8 -0
  34. package/lib/engine/engine_types.js.map +1 -1
  35. package/lib/engine-components/Animation.js +4 -0
  36. package/lib/engine-components/Animation.js.map +1 -1
  37. package/lib/engine-components/Collider.js +6 -6
  38. package/lib/engine-components/Collider.js.map +1 -1
  39. package/lib/engine-components/Joints.js +2 -2
  40. package/lib/engine-components/Joints.js.map +1 -1
  41. package/lib/engine-components/RigidBody.d.ts +0 -1
  42. package/lib/engine-components/RigidBody.js +24 -30
  43. package/lib/engine-components/RigidBody.js.map +1 -1
  44. package/lib/engine-components/codegen/components.d.ts +25 -1
  45. package/lib/engine-components/codegen/components.js +25 -1
  46. package/lib/engine-components/codegen/components.js.map +1 -1
  47. package/lib/engine-components/export/usdz/Extension.d.ts +4 -4
  48. package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +86 -0
  49. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +858 -0
  50. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -0
  51. package/lib/engine-components/export/usdz/USDZExporter.d.ts +6 -3
  52. package/lib/engine-components/export/usdz/USDZExporter.js +34 -11
  53. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  54. package/lib/engine-components/export/usdz/extensions/Animation.d.ts +15 -15
  55. package/lib/engine-components/export/usdz/extensions/Animation.js +24 -29
  56. package/lib/engine-components/export/usdz/extensions/Animation.js.map +1 -1
  57. package/lib/engine-components/export/usdz/extensions/DocumentExtension.d.ts +5 -0
  58. package/lib/engine-components/export/usdz/extensions/DocumentExtension.js +7 -0
  59. package/lib/engine-components/export/usdz/extensions/DocumentExtension.js.map +1 -0
  60. package/lib/engine-components/export/usdz/extensions/USDZText.d.ts +47 -0
  61. package/lib/engine-components/export/usdz/extensions/USDZText.js +114 -0
  62. package/lib/engine-components/export/usdz/extensions/USDZText.js.map +1 -0
  63. package/lib/engine-components/export/usdz/extensions/behavior/Actions.d.ts +30 -0
  64. package/lib/engine-components/export/usdz/extensions/behavior/Actions.js +89 -0
  65. package/lib/engine-components/export/usdz/extensions/behavior/Actions.js.map +1 -0
  66. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +23 -0
  67. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js +114 -0
  68. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js.map +1 -0
  69. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +102 -0
  70. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +458 -0
  71. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -0
  72. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +111 -0
  73. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +409 -0
  74. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js.map +1 -0
  75. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  76. package/lib/engine-components/ui/BaseUIComponent.d.ts +2 -0
  77. package/lib/engine-components/ui/BaseUIComponent.js +6 -0
  78. package/lib/engine-components/ui/BaseUIComponent.js.map +1 -1
  79. package/lib/engine-components/ui/Canvas.d.ts +11 -1
  80. package/lib/engine-components/ui/Canvas.js +72 -3
  81. package/lib/engine-components/ui/Canvas.js.map +1 -1
  82. package/lib/engine-components/ui/Graphic.js.map +1 -1
  83. package/lib/engine-components/ui/Image.js +4 -4
  84. package/lib/engine-components/ui/Image.js.map +1 -1
  85. package/lib/engine-components/ui/Interfaces.d.ts +11 -0
  86. package/lib/engine-components/ui/Interfaces.js +11 -0
  87. package/lib/engine-components/ui/Interfaces.js.map +1 -1
  88. package/lib/engine-components/ui/Layout.d.ts +65 -3
  89. package/lib/engine-components/ui/Layout.js +304 -3
  90. package/lib/engine-components/ui/Layout.js.map +1 -1
  91. package/lib/engine-components/ui/RectTransform.d.ts +8 -7
  92. package/lib/engine-components/ui/RectTransform.js +66 -36
  93. package/lib/engine-components/ui/RectTransform.js.map +1 -1
  94. package/lib/engine-components/utils/LookAt.d.ts +7 -1
  95. package/lib/engine-components/utils/LookAt.js +43 -6
  96. package/lib/engine-components/utils/LookAt.js.map +1 -1
  97. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +4 -3
  98. package/lib/engine-components/webxr/WebXRImageTracking.js +81 -25
  99. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  100. package/lib/tsconfig.tsbuildinfo +1 -1
  101. package/package.json +1 -1
  102. package/plugins/vite/config.js +2 -1
  103. package/plugins/vite/defines.js +30 -0
  104. package/plugins/vite/dependency-watcher.js +173 -0
  105. package/plugins/vite/editor-connection.js +37 -39
  106. package/plugins/vite/index.js +5 -1
  107. package/plugins/vite/reload.js +16 -3
  108. package/src/engine/api.ts +1 -0
  109. package/src/engine/codegen/register_types.js +50 -2
  110. package/src/engine/engine_context.ts +32 -23
  111. package/src/engine/engine_context_registry.ts +13 -6
  112. package/src/engine/engine_element.ts +2 -1
  113. package/src/engine/engine_element_loading.ts +2 -3
  114. package/src/engine/engine_gameobject.ts +3 -2
  115. package/src/engine/engine_input.ts +2 -2
  116. package/src/engine/engine_physics.ts +25 -1020
  117. package/src/engine/engine_physics.types.ts +1 -3
  118. package/src/engine/engine_physics_rapier.ts +1127 -0
  119. package/src/engine/engine_three_utils.ts +2 -2
  120. package/src/engine/engine_types.ts +66 -4
  121. package/src/engine-components/Animation.ts +4 -0
  122. package/src/engine-components/Collider.ts +6 -6
  123. package/src/engine-components/Joints.ts +2 -2
  124. package/src/engine-components/RigidBody.ts +24 -31
  125. package/src/engine-components/codegen/components.ts +25 -1
  126. package/src/engine-components/export/usdz/Extension.ts +4 -5
  127. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +1312 -0
  128. package/src/engine-components/export/usdz/USDZExporter.ts +39 -17
  129. package/src/engine-components/export/usdz/extensions/Animation.ts +37 -45
  130. package/src/engine-components/export/usdz/extensions/DocumentExtension.ts +10 -0
  131. package/src/engine-components/export/usdz/extensions/USDZText.ts +142 -0
  132. package/src/engine-components/export/usdz/extensions/behavior/Actions.ts +99 -0
  133. package/src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +181 -0
  134. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +545 -0
  135. package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +459 -0
  136. package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
  137. package/src/engine-components/ui/BaseUIComponent.ts +7 -1
  138. package/src/engine-components/ui/Canvas.ts +80 -5
  139. package/src/engine-components/ui/Graphic.ts +2 -0
  140. package/src/engine-components/ui/Image.ts +3 -3
  141. package/src/engine-components/ui/Interfaces.ts +30 -6
  142. package/src/engine-components/ui/Layout.ts +303 -4
  143. package/src/engine-components/ui/RectTransform.ts +67 -41
  144. package/src/engine-components/utils/LookAt.ts +60 -7
  145. package/src/engine-components/webxr/WebXRImageTracking.ts +100 -27
  146. package/lib/engine-components/export/usdz/types.d.ts +0 -34
  147. package/lib/engine-components/export/usdz/types.js +0 -2
  148. package/lib/engine-components/export/usdz/types.js.map +0 -1
  149. package/src/engine-components/export/usdz/types.ts +0 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "3.3.0-alpha",
3
+ "version": "3.5.0-alpha",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "type": "module",
@@ -53,4 +53,5 @@ export function tryLoadProjectConfig() {
53
53
  /** "assets" -> the directory name inside the output directory to put e.g. glb files into */
54
54
  export function builtAssetsDirectory(){
55
55
  return "assets";
56
- }
56
+ }
57
+
@@ -0,0 +1,30 @@
1
+ import { loadConfig } from "./config.js";
2
+
3
+ /** used to pass config variables into vite.config.define
4
+ * for example "useRapier"
5
+ */
6
+ export const needleDefines = (command, config, userSettings) => {
7
+
8
+ if (!userSettings) userSettings = {};
9
+
10
+ let useRapier = true;
11
+ if (config.useRapier === false || userSettings?.useRapier === false) useRapier = false;
12
+
13
+ return {
14
+ name: 'needle-defines',
15
+ enforce: 'pre',
16
+ config(config) {
17
+ if (useRapier && userSettings?.useRapier !== true) {
18
+ const meta = loadConfig();
19
+ if (meta?.useRapier === false) {
20
+ useRapier = false;
21
+ }
22
+ }
23
+ console.log("UseRapier?", useRapier);
24
+ if (!config.define) config.define = {};
25
+ if (config.define.NEEDLE_USE_RAPIER === undefined) {
26
+ config.define.NEEDLE_USE_RAPIER = useRapier;
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,173 @@
1
+ import { exec, execSync } from 'child_process';
2
+ import { existsSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+
6
+ const prefix = "[needle-dependency-watcher] ";
7
+ function log(...msg) {
8
+ console.log(prefix, ...msg)
9
+ }
10
+
11
+ export const needleDependencyWatcher = (command, config, userSettings) => {
12
+ if (command === "build") return;
13
+
14
+ if (userSettings?.noDependencyWatcher === true) return;
15
+
16
+ const dir = process.cwd();
17
+ const packageJsonPath = path.join(dir, "package.json");
18
+ const viteCacheDir = path.join(dir, "node_modules", ".vite");
19
+
20
+ return {
21
+ name: 'needle-dependency-watcher',
22
+ configureServer(server) {
23
+ watchPackageJson(server, dir, packageJsonPath, viteCacheDir);
24
+ manageClients(server);
25
+ }
26
+ }
27
+ }
28
+
29
+ const currentClients = new Set();
30
+
31
+ function manageClients(server) {
32
+ server.ws.on("connection", (socket) => {
33
+ currentClients.add(socket);
34
+ socket.on("close", () => {
35
+ currentClients.delete(socket);
36
+ });
37
+ });
38
+ }
39
+
40
+ function triggerReloadOnClients() {
41
+ log("Triggering reload on clients (todo)", currentClients.size)
42
+ // for (const client of currentClients) {
43
+ // client.send(JSON.stringify({ type: "full-reload" }));
44
+ // }
45
+ }
46
+
47
+
48
+ let packageJsonStat;
49
+ let lastEditTime;
50
+ let packageJsonSize;
51
+ let packageJson;
52
+ let requireInstall = false;
53
+
54
+ function watchPackageJson(server, projectDir, packageJsonPath, cachePath) {
55
+
56
+ if (!existsSync(packageJsonPath)) {
57
+ return;
58
+ }
59
+
60
+ log("Watching project", packageJsonPath)
61
+
62
+ lastRestartTime = 0;
63
+ packageJsonStat = statSync(packageJsonPath);
64
+ lastEditTime = packageJsonStat.mtime;
65
+ packageJsonSize = packageJsonStat.size;
66
+ packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
67
+
68
+ setTimeout(() => {
69
+ requireInstall = testIfInstallIsRequired(projectDir, packageJson);
70
+ }, 1000);
71
+
72
+ setInterval(() => {
73
+ packageJsonStat = statSync(packageJsonPath);
74
+ let modified = false;
75
+ if (packageJsonStat.mtime > lastEditTime) {
76
+ modified = true;
77
+ }
78
+ if (packageJsonStat.size !== packageJsonSize) {
79
+ modified = true;
80
+ }
81
+ if (modified || requireInstall) {
82
+ if (modified)
83
+ log("package.json has changed")
84
+
85
+ let requireReload = false;
86
+ if (!requireInstall) {
87
+ requireInstall = testIfInstallIsRequired(projectDir, packageJson);
88
+ }
89
+
90
+ // test if dependencies changed
91
+ let newPackageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
92
+ for (const key in newPackageJson.dependencies) {
93
+ if (packageJson.dependencies[key] !== newPackageJson.dependencies[key] && newPackageJson.dependencies[key] !== undefined) {
94
+ log("Dependency added", key)
95
+ requireReload = true;
96
+ }
97
+ }
98
+
99
+
100
+ packageJsonSize = packageJsonStat.size;
101
+ lastEditTime = packageJsonStat.mtime;
102
+
103
+ if (requireReload || requireInstall) {
104
+ restart(server, projectDir, cachePath);
105
+ }
106
+ }
107
+ }, 1000);
108
+ }
109
+
110
+ function testIfInstallIsRequired(projectDir, packageJson) {
111
+
112
+ if (packageJson.dependencies) {
113
+ for (const key in packageJson.dependencies) {
114
+ // make sure the dependency is installed
115
+ const depPath = path.join(projectDir, "node_modules", key);
116
+ if (!existsSync(depPath)) {
117
+ log("Dependency not installed", key)
118
+ return true;
119
+ }
120
+ }
121
+ }
122
+ return false;
123
+ }
124
+
125
+ let isRunningRestart = false;
126
+ let restartId = 0;
127
+ let lastRestartTime = 0;
128
+
129
+ async function restart(server, projectDir, cachePath) {
130
+
131
+ if (isRunningRestart) return;
132
+ isRunningRestart = true;
133
+
134
+ try {
135
+ const id = ++restartId;
136
+
137
+ if (requireInstall) {
138
+ requireInstall = false;
139
+ log("Installing dependencies...")
140
+ execSync("npm install", { cwd: projectDir, stdio: "inherit" });
141
+ requireInstall = false;
142
+ }
143
+
144
+ if (id !== restartId) return;
145
+ if (Date.now() - lastRestartTime < 1000) return;
146
+ log("Restarting server...")
147
+ lastRestartTime = Date.now();
148
+ requireInstall = false;
149
+ if (existsSync(cachePath))
150
+ rmSync(cachePath, { recursive: true, force: true });
151
+ triggerReloadOnClients();
152
+
153
+ // touch vite config to trigger reload
154
+ // const viteConfigPath = path.join(projectDir, "vite.config.js");
155
+ // if (existsSync(viteConfigPath)) {
156
+ // const content = readFileSync(viteConfigPath, "utf8");
157
+ // writeFileSync(viteConfigPath, content, "utf8");
158
+ // isRunningRestart = false;
159
+ // return;
160
+ // }
161
+
162
+ // check if server is running
163
+ if (server.httpServer.listening)
164
+ server.restart();
165
+ isRunningRestart = false;
166
+ console.log("-----------------------------------------------")
167
+ }
168
+ catch (err) {
169
+ log("Error restarting server", err);
170
+ isRunningRestart = false;
171
+ }
172
+
173
+ }
@@ -73,48 +73,46 @@ function createPlugin(isInstalled) {
73
73
  },
74
74
 
75
75
  configureServer(server) {
76
- server.ws.on('connection', (socket, _request) => {
77
-
78
- // console.log("Send editor sync status: " + isInstalled);
79
- const reply = {
80
- type: "needle:editor-sync:installation-status",
81
- data: isInstalled
82
- }
83
- socket.send(JSON.stringify(reply));
84
-
85
- socket.on('message', async (bytes) => {
86
- if (bytes?.length < 50) {
87
- const message = Buffer.from(bytes).toString();
88
- if (message === "needle:editor:restart") {
89
- console.log("Received request for a soft restart of the vite server... restarting in 1 second")
90
- setTimeout(() => {
76
+ try
77
+ {
78
+ server.ws.on('connection', (socket, _request) => {
79
+
80
+ // console.log("Send editor sync status: " + isInstalled);
81
+ const reply = {
82
+ type: "needle:editor-sync:installation-status",
83
+ data: isInstalled
84
+ }
85
+ socket.send(JSON.stringify(reply));
86
+
87
+ socket.on('message', async (bytes) => {
88
+ if (bytes?.length < 50) {
89
+ const message = Buffer.from(bytes).toString();
90
+ if (message === "needle:editor:restart") {
91
+ console.log("Received request for a soft restart of the vite server... ")
91
92
  // This just restarts the vite server
92
93
  server.restart();
93
- // TODO: restart isnt recommended right now because e.g. Unity doesnt properly find the new process to display it in the progress bar
94
- // spawn(process.argv.shift(), process.argv, {
95
- // cwd: process.cwd(),
96
- // detached: true,
97
- // stdio: "inherit"
98
- // });
99
- // process.exit();
100
- }, 1000);
101
- }
102
- else if (message === "needle:editor:stop") {
103
- process.exit();
104
- }
105
- else if (message === `{"type":"ping"}`) {
106
- socket.send(JSON.stringify({ type: "pong" }));
94
+ }
95
+ else if (message === "needle:editor:stop") {
96
+ process.exit();
97
+ }
98
+ else if (message === `{"type":"ping"}`) {
99
+ socket.send(JSON.stringify({ type: "pong" }));
100
+ }
101
+ else if (message === "needle:editor:editor-sync-enabled") {
102
+ console.log("Editor sync enabled")
103
+ editorSyncEnabled = true;
104
+ }
105
+ else if (message === "needle:editor:editor-sync-disabled") {
106
+ editorSyncEnabled = false;
107
+ }
107
108
  }
108
- else if (message === "needle:editor:editor-sync-enabled") {
109
- console.log("Editor sync enabled")
110
- editorSyncEnabled = true;
111
- }
112
- else if (message === "needle:editor:editor-sync-disabled") {
113
- editorSyncEnabled = false;
114
- }
115
- }
116
- })
117
- });
109
+ })
110
+ });
111
+ }
112
+ catch(err){
113
+ console.error("Error in needle-editor-connection")
114
+ console.error(err)
115
+ }
118
116
  }
119
117
 
120
118
  }
@@ -1,3 +1,4 @@
1
+ import { needleDefines } from "./defines.js";
1
2
  import { needleBuild } from "./build.js";
2
3
  import { needleMeta } from "./meta.js"
3
4
  import { needlePoster } from "./poster.js"
@@ -9,6 +10,7 @@ import { needleViteAlias } from "./alias.js";
9
10
  import { needleTransformCodegen } from "./transform-codegen.js";
10
11
  import { needleLicense } from "./license.js";
11
12
  import { needlePeerjs } from "./peer.js";
13
+ import { needleDependencyWatcher } from "./dependency-watcher.js";
12
14
 
13
15
  export * from "./gzip.js";
14
16
  export * from "./config.js";
@@ -22,6 +24,7 @@ export const needlePlugins = async (command, config, userSettings) => {
22
24
  // ensure we have user settings initialized with defaults
23
25
  userSettings = { ...defaultUserSettings, ...userSettings }
24
26
  const array = [
27
+ needleDefines(command, config, userSettings),
25
28
  needleLicense(command, config, userSettings),
26
29
  needleViteAlias(command, config, userSettings),
27
30
  needleMeta(command, config, userSettings),
@@ -31,7 +34,8 @@ export const needlePlugins = async (command, config, userSettings) => {
31
34
  needleCopyFiles(command, config, userSettings),
32
35
  needleTransformCodegen(command, config, userSettings),
33
36
  needleDrop(command, config, userSettings),
34
- needlePeerjs(command, config, userSettings)
37
+ needlePeerjs(command, config, userSettings),
38
+ needleDependencyWatcher(command, config, userSettings)
35
39
  ];
36
40
  array.push(await editorConnection(command, config, userSettings, array));
37
41
  return array;
@@ -9,10 +9,13 @@ const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = path.dirname(__filename);
10
10
 
11
11
  const filesUsingHotReload = new Set();
12
+ let assetsDirectory = "";
12
13
 
13
14
  export const needleReload = (command, config, userSettings) => {
14
15
  if (command === "build") return;
15
16
 
17
+ if (userSettings?.noReload === true) return;
18
+
16
19
 
17
20
  let isUpdatingConfig = false;
18
21
  const updateConfig = async () => {
@@ -23,8 +26,9 @@ export const needleReload = (command, config, userSettings) => {
23
26
  if (res) config = res;
24
27
  }
25
28
 
26
-
27
29
  const projectConfig = tryLoadProjectConfig();
30
+ assetsDirectory = path.resolve(projectConfig?.assetsDirectory || "assets");
31
+
28
32
  const buildDirectory = projectConfig?.buildDirectory?.length ? process.cwd().replaceAll("\\", "/") + "/" + projectConfig?.buildDirectory : "";
29
33
  if (buildDirectory?.length) {
30
34
  setTimeout(() => console.log("Build directory: ", buildDirectory), 100);
@@ -43,7 +47,7 @@ export const needleReload = (command, config, userSettings) => {
43
47
  else if (!config.server.watch.ignored) config.server.watch.ignored = [];
44
48
  for (const pattern of ignorePatterns)
45
49
  config.server.watch.ignored.push(pattern);
46
- if(config?.debug === true || userSettings?.debug === true)
50
+ if (config?.debug === true || userSettings?.debug === true)
47
51
  setTimeout(() => console.log("Updated server ignore patterns: ", config.server.watch.ignored), 100);
48
52
  },
49
53
  handleHotUpdate(args) {
@@ -153,7 +157,16 @@ async function handleReload({ file, server, modules, read, buildDirectory }) {
153
157
  }
154
158
  }
155
159
 
156
- if (file.endsWith(".vue") || file.endsWith(".ts") || file.endsWith(".js") || file.endsWith(".jsx") || file.endsWith(".tsx"))
160
+ // these are known file types we export from integrations
161
+ const knownExportFileTypes = [ ".glb", ".gltf", ".bin", "exr", ".ktx2", ".mp3", ".ogg", ".mp4", ".webm" ];
162
+ if (!knownExportFileTypes.some((type) => file.endsWith(type)))
163
+ return;
164
+
165
+ // we only care about exports into "assets"
166
+ if (!path.resolve(file).startsWith(assetsDirectory))
167
+ return;
168
+
169
+ if (file.endsWith(".svelte") || file.endsWith(".vue") || file.endsWith(".ts") || file.endsWith(".js") || file.endsWith(".jsx") || file.endsWith(".tsx"))
157
170
  return;
158
171
 
159
172
  if (file.endsWith(lockFileName)) return;
package/src/engine/api.ts CHANGED
@@ -27,6 +27,7 @@ export * from "./engine_patcher"
27
27
  export * from "./engine_playerview"
28
28
  export * from "./engine_physics"
29
29
  export * from "./engine_physics.types"
30
+ export * from "./engine_physics_rapier"
30
31
  export * from "./engine_scenelighting"
31
32
  export * from "./engine_input";
32
33
  export * from "./engine_math";
@@ -2,6 +2,9 @@
2
2
 
3
3
  // Import types
4
4
  import { __Ignore } from "../../engine-components/codegen/components";
5
+ import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
6
+ import { ActionCollection } from "../../engine-components/export/usdz/extensions/behavior/Actions";
7
+ import { ActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
5
8
  import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint";
6
9
  import { Animation } from "../../engine-components/Animation";
7
10
  import { AnimationCurve } from "../../engine-components/AnimationCurve";
@@ -26,6 +29,8 @@ import { AvatarModel } from "../../engine-components/AvatarLoader";
26
29
  import { AxesHelper } from "../../engine-components/AxesHelper";
27
30
  import { BaseUIComponent } from "../../engine-components/ui/BaseUIComponent";
28
31
  import { BasicIKConstraint } from "../../engine-components/BasicIKConstraint";
32
+ import { BehaviorExtension } from "../../engine-components/export/usdz/extensions/behavior/Behaviour";
33
+ import { BehaviorModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
29
34
  import { Behaviour } from "../../engine-components/Component";
30
35
  import { Bloom } from "../../engine-components/postprocessing/Effects/Bloom";
31
36
  import { BoxCollider } from "../../engine-components/Collider";
@@ -37,6 +42,8 @@ import { Camera } from "../../engine-components/Camera";
37
42
  import { Canvas } from "../../engine-components/ui/Canvas";
38
43
  import { CanvasGroup } from "../../engine-components/ui/CanvasGroup";
39
44
  import { CapsuleCollider } from "../../engine-components/Collider";
45
+ import { ChangeMaterialOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
46
+ import { ChangeTransformOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
40
47
  import { CharacterController } from "../../engine-components/CharacterController";
41
48
  import { CharacterControllerInput } from "../../engine-components/CharacterController";
42
49
  import { ChromaticAberration } from "../../engine-components/postprocessing/Effects/ChromaticAberration";
@@ -50,10 +57,12 @@ import { Deletable } from "../../engine-components/DeleteBox";
50
57
  import { DeleteBox } from "../../engine-components/DeleteBox";
51
58
  import { DepthOfField } from "../../engine-components/postprocessing/Effects/DepthOfField";
52
59
  import { DeviceFlag } from "../../engine-components/DeviceFlag";
60
+ import { DocumentExtension } from "../../engine-components/export/usdz/extensions/DocumentExtension";
53
61
  import { DragControls } from "../../engine-components/DragControls";
54
62
  import { DropListener } from "../../engine-components/DropListener";
55
63
  import { Duplicatable } from "../../engine-components/Duplicatable";
56
64
  import { EmissionModule } from "../../engine-components/ParticleSystemModules";
65
+ import { EmphasizeOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
57
66
  import { EventList } from "../../engine-components/EventList";
58
67
  import { EventListEvent } from "../../engine-components/EventList";
59
68
  import { EventSystem } from "../../engine-components/ui/EventSystem";
@@ -70,13 +79,14 @@ import { GraphicRaycaster } from "../../engine-components/ui/Raycaster";
70
79
  import { GridHelper } from "../../engine-components/GridHelper";
71
80
  import { GridLayoutGroup } from "../../engine-components/ui/Layout";
72
81
  import { GroundProjectedEnv } from "../../engine-components/GroundProjection";
82
+ import { GroupActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
83
+ import { HideOnStart } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
73
84
  import { HingeJoint } from "../../engine-components/Joints";
74
85
  import { HorizontalLayoutGroup } from "../../engine-components/ui/Layout";
75
86
  import { Image } from "../../engine-components/ui/Image";
76
87
  import { InheritVelocityModule } from "../../engine-components/ParticleSystemModules";
77
88
  import { InputField } from "../../engine-components/ui/InputField";
78
89
  import { Interactable } from "../../engine-components/Interactable";
79
- import { LayoutGroup } from "../../engine-components/ui/Layout";
80
90
  import { Light } from "../../engine-components/Light";
81
91
  import { LimitVelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
82
92
  import { LODGroup } from "../../engine-components/LODGroup";
@@ -98,17 +108,21 @@ import { OffsetConstraint } from "../../engine-components/OffsetConstraint";
98
108
  import { OpenURL } from "../../engine-components/utils/OpenURL";
99
109
  import { OrbitControls } from "../../engine-components/OrbitControls";
100
110
  import { Outline } from "../../engine-components/ui/Outline";
111
+ import { Padding } from "../../engine-components/ui/Layout";
101
112
  import { ParticleBurst } from "../../engine-components/ParticleSystemModules";
102
113
  import { ParticleSubEmitter } from "../../engine-components/ParticleSystemSubEmitter";
103
114
  import { ParticleSystem } from "../../engine-components/ParticleSystem";
104
115
  import { ParticleSystemRenderer } from "../../engine-components/ParticleSystem";
105
116
  import { PixelationEffect } from "../../engine-components/postprocessing/Effects/Pixelation";
106
117
  import { PlayableDirector } from "../../engine-components/timeline/PlayableDirector";
118
+ import { PlayAnimationOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
107
119
  import { PlayerColor } from "../../engine-components/PlayerColor";
108
120
  import { PlayerState } from "../../engine-components-experimental/networking/PlayerSync";
109
121
  import { PlayerSync } from "../../engine-components-experimental/networking/PlayerSync";
110
122
  import { PointerEventData } from "../../engine-components/ui/PointerEvents";
111
123
  import { PostProcessingHandler } from "../../engine-components/postprocessing/PostProcessingHandler";
124
+ import { PreliminaryAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
125
+ import { PreliminaryTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
112
126
  import { PresentationMode } from "../../engine-components-experimental/Presentation";
113
127
  import { QuickLookOverlay } from "../../engine-components/export/usdz/USDZExporter";
114
128
  import { RawImage } from "../../engine-components/ui/Image";
@@ -127,6 +141,7 @@ import { RotationOverLifetimeModule } from "../../engine-components/ParticleSyst
127
141
  import { SceneSwitcher } from "../../engine-components/SceneSwitcher";
128
142
  import { ScreenCapture } from "../../engine-components/ScreenCapture";
129
143
  import { ScreenSpaceAmbientOcclusion } from "../../engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion";
144
+ import { SetActiveOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
130
145
  import { ShadowCatcher } from "../../engine-components/ShadowCatcher";
131
146
  import { ShapeModule } from "../../engine-components/ParticleSystemModules";
132
147
  import { SignalAsset } from "../../engine-components/timeline/SignalAsset";
@@ -151,24 +166,33 @@ import { SubEmitterSystem } from "../../engine-components/ParticleSystem";
151
166
  import { SyncedCamera } from "../../engine-components/SyncedCamera";
152
167
  import { SyncedRoom } from "../../engine-components/SyncedRoom";
153
168
  import { SyncedTransform } from "../../engine-components/SyncedTransform";
169
+ import { TapGestureTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
154
170
  import { TeleportTarget } from "../../engine-components/webxr/WebXRController";
155
171
  import { TestRunner } from "../../engine-components/TestRunner";
156
172
  import { TestSimulateUserData } from "../../engine-components/TestRunner";
157
173
  import { Text } from "../../engine-components/ui/Text";
174
+ import { TextBuilder } from "../../engine-components/export/usdz/extensions/USDZText";
175
+ import { TextExtension } from "../../engine-components/export/usdz/extensions/USDZText";
158
176
  import { TextureSheetAnimationModule } from "../../engine-components/ParticleSystemModules";
159
177
  import { TiltShiftEffect } from "../../engine-components/postprocessing/Effects/TiltShiftEffect";
160
178
  import { ToneMapping } from "../../engine-components/postprocessing/Effects/Tonemapping";
161
179
  import { TrailModule } from "../../engine-components/ParticleSystemModules";
162
180
  import { TransformData } from "../../engine-components/export/usdz/extensions/Animation";
163
181
  import { TransformGizmo } from "../../engine-components/TransformGizmo";
182
+ import { TriggerBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
183
+ import { TriggerModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
164
184
  import { UIRaycastUtils } from "../../engine-components/ui/RaycastUtils";
165
185
  import { UIRootComponent } from "../../engine-components/ui/BaseUIComponent";
166
186
  import { UsageMarker } from "../../engine-components/Interactable";
187
+ import { USDZBehaviours } from "../../engine-components/export/usdz/extensions/behavior/Behaviour";
167
188
  import { USDZExporter } from "../../engine-components/export/usdz/USDZExporter";
189
+ import { USDZText } from "../../engine-components/export/usdz/extensions/USDZText";
190
+ import { VariantAction } from "../../engine-components/export/usdz/extensions/behavior/Actions";
168
191
  import { VelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
169
192
  import { VerticalLayoutGroup } from "../../engine-components/ui/Layout";
170
193
  import { VideoPlayer } from "../../engine-components/VideoPlayer";
171
194
  import { Vignette } from "../../engine-components/postprocessing/Effects/Vignette";
195
+ import { VisibilityAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
172
196
  import { Voip } from "../../engine-components/Voip";
173
197
  import { Volume } from "../../engine-components/postprocessing/Volume";
174
198
  import { VolumeParameter } from "../../engine-components/postprocessing/VolumeParameter";
@@ -193,6 +217,9 @@ import { XRState } from "../../engine-components/XRFlag";
193
217
 
194
218
  // Register types
195
219
  TypeStore.add("__Ignore", __Ignore);
220
+ TypeStore.add("ActionBuilder", ActionBuilder);
221
+ TypeStore.add("ActionCollection", ActionCollection);
222
+ TypeStore.add("ActionModel", ActionModel);
196
223
  TypeStore.add("AlignmentConstraint", AlignmentConstraint);
197
224
  TypeStore.add("Animation", Animation);
198
225
  TypeStore.add("AnimationCurve", AnimationCurve);
@@ -217,6 +244,8 @@ TypeStore.add("AvatarModel", AvatarModel);
217
244
  TypeStore.add("AxesHelper", AxesHelper);
218
245
  TypeStore.add("BaseUIComponent", BaseUIComponent);
219
246
  TypeStore.add("BasicIKConstraint", BasicIKConstraint);
247
+ TypeStore.add("BehaviorExtension", BehaviorExtension);
248
+ TypeStore.add("BehaviorModel", BehaviorModel);
220
249
  TypeStore.add("Behaviour", Behaviour);
221
250
  TypeStore.add("Bloom", Bloom);
222
251
  TypeStore.add("BoxCollider", BoxCollider);
@@ -228,6 +257,8 @@ TypeStore.add("Camera", Camera);
228
257
  TypeStore.add("Canvas", Canvas);
229
258
  TypeStore.add("CanvasGroup", CanvasGroup);
230
259
  TypeStore.add("CapsuleCollider", CapsuleCollider);
260
+ TypeStore.add("ChangeMaterialOnClick", ChangeMaterialOnClick);
261
+ TypeStore.add("ChangeTransformOnClick", ChangeTransformOnClick);
231
262
  TypeStore.add("CharacterController", CharacterController);
232
263
  TypeStore.add("CharacterControllerInput", CharacterControllerInput);
233
264
  TypeStore.add("ChromaticAberration", ChromaticAberration);
@@ -241,10 +272,12 @@ TypeStore.add("Deletable", Deletable);
241
272
  TypeStore.add("DeleteBox", DeleteBox);
242
273
  TypeStore.add("DepthOfField", DepthOfField);
243
274
  TypeStore.add("DeviceFlag", DeviceFlag);
275
+ TypeStore.add("DocumentExtension", DocumentExtension);
244
276
  TypeStore.add("DragControls", DragControls);
245
277
  TypeStore.add("DropListener", DropListener);
246
278
  TypeStore.add("Duplicatable", Duplicatable);
247
279
  TypeStore.add("EmissionModule", EmissionModule);
280
+ TypeStore.add("EmphasizeOnClick", EmphasizeOnClick);
248
281
  TypeStore.add("EventList", EventList);
249
282
  TypeStore.add("EventListEvent", EventListEvent);
250
283
  TypeStore.add("EventSystem", EventSystem);
@@ -261,13 +294,14 @@ TypeStore.add("GraphicRaycaster", GraphicRaycaster);
261
294
  TypeStore.add("GridHelper", GridHelper);
262
295
  TypeStore.add("GridLayoutGroup", GridLayoutGroup);
263
296
  TypeStore.add("GroundProjectedEnv", GroundProjectedEnv);
297
+ TypeStore.add("GroupActionModel", GroupActionModel);
298
+ TypeStore.add("HideOnStart", HideOnStart);
264
299
  TypeStore.add("HingeJoint", HingeJoint);
265
300
  TypeStore.add("HorizontalLayoutGroup", HorizontalLayoutGroup);
266
301
  TypeStore.add("Image", Image);
267
302
  TypeStore.add("InheritVelocityModule", InheritVelocityModule);
268
303
  TypeStore.add("InputField", InputField);
269
304
  TypeStore.add("Interactable", Interactable);
270
- TypeStore.add("LayoutGroup", LayoutGroup);
271
305
  TypeStore.add("Light", Light);
272
306
  TypeStore.add("LimitVelocityOverLifetimeModule", LimitVelocityOverLifetimeModule);
273
307
  TypeStore.add("LODGroup", LODGroup);
@@ -289,17 +323,21 @@ TypeStore.add("OffsetConstraint", OffsetConstraint);
289
323
  TypeStore.add("OpenURL", OpenURL);
290
324
  TypeStore.add("OrbitControls", OrbitControls);
291
325
  TypeStore.add("Outline", Outline);
326
+ TypeStore.add("Padding", Padding);
292
327
  TypeStore.add("ParticleBurst", ParticleBurst);
293
328
  TypeStore.add("ParticleSubEmitter", ParticleSubEmitter);
294
329
  TypeStore.add("ParticleSystem", ParticleSystem);
295
330
  TypeStore.add("ParticleSystemRenderer", ParticleSystemRenderer);
296
331
  TypeStore.add("PixelationEffect", PixelationEffect);
297
332
  TypeStore.add("PlayableDirector", PlayableDirector);
333
+ TypeStore.add("PlayAnimationOnClick", PlayAnimationOnClick);
298
334
  TypeStore.add("PlayerColor", PlayerColor);
299
335
  TypeStore.add("PlayerState", PlayerState);
300
336
  TypeStore.add("PlayerSync", PlayerSync);
301
337
  TypeStore.add("PointerEventData", PointerEventData);
302
338
  TypeStore.add("PostProcessingHandler", PostProcessingHandler);
339
+ TypeStore.add("PreliminaryAction", PreliminaryAction);
340
+ TypeStore.add("PreliminaryTrigger", PreliminaryTrigger);
303
341
  TypeStore.add("PresentationMode", PresentationMode);
304
342
  TypeStore.add("QuickLookOverlay", QuickLookOverlay);
305
343
  TypeStore.add("RawImage", RawImage);
@@ -318,6 +356,7 @@ TypeStore.add("RotationOverLifetimeModule", RotationOverLifetimeModule);
318
356
  TypeStore.add("SceneSwitcher", SceneSwitcher);
319
357
  TypeStore.add("ScreenCapture", ScreenCapture);
320
358
  TypeStore.add("ScreenSpaceAmbientOcclusion", ScreenSpaceAmbientOcclusion);
359
+ TypeStore.add("SetActiveOnClick", SetActiveOnClick);
321
360
  TypeStore.add("ShadowCatcher", ShadowCatcher);
322
361
  TypeStore.add("ShapeModule", ShapeModule);
323
362
  TypeStore.add("SignalAsset", SignalAsset);
@@ -342,24 +381,33 @@ TypeStore.add("SubEmitterSystem", SubEmitterSystem);
342
381
  TypeStore.add("SyncedCamera", SyncedCamera);
343
382
  TypeStore.add("SyncedRoom", SyncedRoom);
344
383
  TypeStore.add("SyncedTransform", SyncedTransform);
384
+ TypeStore.add("TapGestureTrigger", TapGestureTrigger);
345
385
  TypeStore.add("TeleportTarget", TeleportTarget);
346
386
  TypeStore.add("TestRunner", TestRunner);
347
387
  TypeStore.add("TestSimulateUserData", TestSimulateUserData);
348
388
  TypeStore.add("Text", Text);
389
+ TypeStore.add("TextBuilder", TextBuilder);
390
+ TypeStore.add("TextExtension", TextExtension);
349
391
  TypeStore.add("TextureSheetAnimationModule", TextureSheetAnimationModule);
350
392
  TypeStore.add("TiltShiftEffect", TiltShiftEffect);
351
393
  TypeStore.add("ToneMapping", ToneMapping);
352
394
  TypeStore.add("TrailModule", TrailModule);
353
395
  TypeStore.add("TransformData", TransformData);
354
396
  TypeStore.add("TransformGizmo", TransformGizmo);
397
+ TypeStore.add("TriggerBuilder", TriggerBuilder);
398
+ TypeStore.add("TriggerModel", TriggerModel);
355
399
  TypeStore.add("UIRaycastUtils", UIRaycastUtils);
356
400
  TypeStore.add("UIRootComponent", UIRootComponent);
357
401
  TypeStore.add("UsageMarker", UsageMarker);
402
+ TypeStore.add("USDZBehaviours", USDZBehaviours);
358
403
  TypeStore.add("USDZExporter", USDZExporter);
404
+ TypeStore.add("USDZText", USDZText);
405
+ TypeStore.add("VariantAction", VariantAction);
359
406
  TypeStore.add("VelocityOverLifetimeModule", VelocityOverLifetimeModule);
360
407
  TypeStore.add("VerticalLayoutGroup", VerticalLayoutGroup);
361
408
  TypeStore.add("VideoPlayer", VideoPlayer);
362
409
  TypeStore.add("Vignette", Vignette);
410
+ TypeStore.add("VisibilityAction", VisibilityAction);
363
411
  TypeStore.add("Voip", Voip);
364
412
  TypeStore.add("Volume", Volume);
365
413
  TypeStore.add("VolumeParameter", VolumeParameter);