@needle-tools/engine 5.1.15 → 5.1.16
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/CHANGELOG.md +4 -0
- package/dist/{needle-engine.bundle-BivRq9Io.umd.cjs → needle-engine.bundle-CFnhozXr.umd.cjs} +133 -133
- package/dist/{needle-engine.bundle-ByEd2JMt.js → needle-engine.bundle-Ccvgzl3v.js} +4122 -4117
- package/dist/{needle-engine.bundle-DiobwRVT.min.js → needle-engine.bundle-DBXustN8.min.js} +136 -136
- package/dist/needle-engine.d.ts +7 -7
- package/dist/needle-engine.js +233 -233
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug_overlay.js +5 -8
- package/lib/engine/debug/debug_overlay.js.map +1 -1
- package/lib/engine/engine_context_registry.js +3 -1
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +87 -77
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_utils.js +2 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -2
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine-components/Skybox.js +11 -7
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/web/Clickthrough.d.ts +1 -0
- package/lib/engine-components/web/Clickthrough.js +7 -2
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +1 -2
- package/lib/engine-components-experimental/networking/PlayerSync.js +10 -13
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/package.json +1 -1
- package/plugins/common/license.js +4 -4
- package/plugins/vite/license.js +4 -4
- package/src/engine/api.ts +1 -1
- package/src/engine/debug/debug_overlay.ts +6 -9
- package/src/engine/engine_context_registry.ts +4 -2
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +83 -74
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_utils.ts +2 -0
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +2 -2
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine-components/Skybox.ts +12 -9
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/web/Clickthrough.ts +8 -2
- package/src/engine-components-experimental/networking/PlayerSync.ts +11 -15
|
@@ -3,7 +3,7 @@ import { Euler, Material, Matrix4, Mesh, Object3D, Quaternion, Vector3 } from "t
|
|
|
3
3
|
|
|
4
4
|
import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../../../engine/debug/index.js";
|
|
5
5
|
import { findObjectOfType } from "../../../engine/engine_components.js";
|
|
6
|
-
import {
|
|
6
|
+
import { _$RTXoT } from "../../../engine/engine_license.js";
|
|
7
7
|
import { serializable } from "../../../engine/engine_serialization.js";
|
|
8
8
|
import { getFormattedDate, Progress } from "../../../engine/engine_time_utils.js";
|
|
9
9
|
import { DeviceUtilities, getParam } from "../../../engine/engine_utils.js";
|
|
@@ -277,7 +277,7 @@ export class USDZExporter extends Behaviour {
|
|
|
277
277
|
let name = this.exportFileName ?? this.objectToExport?.name ?? this.name;
|
|
278
278
|
name += "-" + getFormattedDate(); // seems iOS caches the file in some cases, this ensures we always have a fresh file
|
|
279
279
|
|
|
280
|
-
if (!
|
|
280
|
+
if (!_$RTXoT()) {
|
|
281
281
|
if (name !== "") name += "-";
|
|
282
282
|
name += "MadeWithNeedle";
|
|
283
283
|
}
|
|
@@ -682,7 +682,7 @@ export class USDZExporter extends Behaviour {
|
|
|
682
682
|
if (debug)
|
|
683
683
|
showBalloonMessage("Quicklook url: " + callToActionURL);
|
|
684
684
|
if (callToActionURL) {
|
|
685
|
-
if (!
|
|
685
|
+
if (!_$RTXoT()) {
|
|
686
686
|
console.warn("Quicklook closed: custom redirects require a Needle Engine Pro license: https://needle.tools/pricing", callToActionURL)
|
|
687
687
|
}
|
|
688
688
|
else {
|
|
@@ -697,7 +697,7 @@ export class USDZExporter extends Behaviour {
|
|
|
697
697
|
private buildQuicklookOverlay(): CustomBranding {
|
|
698
698
|
const obj: CustomBranding = {};
|
|
699
699
|
if (this.customBranding) Object.assign(obj, this.customBranding);
|
|
700
|
-
if (!
|
|
700
|
+
if (!_$RTXoT()) {
|
|
701
701
|
console.log("Custom Quicklook banner text requires pro license: https://needle.tools/pricing");
|
|
702
702
|
obj.callToAction = "Close";
|
|
703
703
|
obj.checkoutTitle = "🌵 Made with Needle";
|
|
@@ -5,15 +5,17 @@ import { onStart } from "../../engine/engine_lifecycle_api.js";
|
|
|
5
5
|
import { addAttributeChangeCallback } from "../../engine/engine_utils.js";
|
|
6
6
|
import { Behaviour } from "../Component.js";
|
|
7
7
|
|
|
8
|
+
const attributeUnsubscribers = new WeakMap<ClickThrough, () => void>();
|
|
9
|
+
|
|
8
10
|
// Automatically add ClickThrough component if "clickthrough" attribute is present on the needle-engine element
|
|
9
11
|
onStart(ctx => {
|
|
10
12
|
const attribute = ctx.domElement.getAttribute("clickthrough");
|
|
11
13
|
if (clickthroughEnabled(attribute)) {
|
|
12
14
|
const comp = ctx.scene.addComponent(ClickThrough);
|
|
13
|
-
addAttributeChangeCallback(ctx.domElement, "clickthrough", () => {
|
|
15
|
+
attributeUnsubscribers.set(comp, addAttributeChangeCallback(ctx.domElement, "clickthrough", () => {
|
|
14
16
|
const attribute = ctx.domElement.getAttribute("clickthrough");
|
|
15
17
|
comp.enabled = clickthroughEnabled(attribute);
|
|
16
|
-
});
|
|
18
|
+
}));
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
function clickthroughEnabled(val: string | null) {
|
|
@@ -167,6 +169,10 @@ export class ClickThrough extends Behaviour {
|
|
|
167
169
|
window.removeEventListener("touchend", this.onTouchEnd);
|
|
168
170
|
this.context.domElement.style.pointerEvents = this._previousPointerEvents;
|
|
169
171
|
}
|
|
172
|
+
onDestroy() {
|
|
173
|
+
attributeUnsubscribers.get(this)?.();
|
|
174
|
+
attributeUnsubscribers.delete(this);
|
|
175
|
+
}
|
|
170
176
|
onPointerEnter() {
|
|
171
177
|
/** do nothing, necessary to raycast children */
|
|
172
178
|
}
|
|
@@ -114,11 +114,8 @@ export class PlayerSync extends Behaviour {
|
|
|
114
114
|
this.onPlayerSpawned = new EventList();
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
awake(): void {
|
|
118
|
-
this.watchTabVisible();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
117
|
onEnable(): void {
|
|
118
|
+
document.addEventListener("visibilitychange", this.onVisibilityChange);
|
|
122
119
|
this.context.connection.beginListen(RoomEvents.RoomStateSent, this.onJoinedRoom);
|
|
123
120
|
this.context.connection.beginListen(RoomEvents.JoinedRoom, this.onJoinedRoom);
|
|
124
121
|
this.context.connection.beginListen(RoomEvents.LeftRoom, this.destroyInstance);
|
|
@@ -141,6 +138,7 @@ export class PlayerSync extends Behaviour {
|
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
onDisable(): void {
|
|
141
|
+
document.removeEventListener("visibilitychange", this.onVisibilityChange);
|
|
144
142
|
this.context.connection.stopListen(RoomEvents.RoomStateSent, this.onJoinedRoom);
|
|
145
143
|
this.context.connection.stopListen(RoomEvents.JoinedRoom, this.onJoinedRoom);
|
|
146
144
|
this.context.connection.stopListen(RoomEvents.LeftRoom, this.destroyInstance);
|
|
@@ -207,18 +205,16 @@ export class PlayerSync extends Behaviour {
|
|
|
207
205
|
/**
|
|
208
206
|
* Sets up visibility change listeners to handle player cleanup when browser tab visibility changes
|
|
209
207
|
*/
|
|
210
|
-
private
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
pl.doDestroy();
|
|
217
|
-
}
|
|
208
|
+
private onVisibilityChange = () => {
|
|
209
|
+
if (document.visibilityState === "visible") {
|
|
210
|
+
for (let i = PlayerState.all.length - 1; i >= 0; i--) {
|
|
211
|
+
const pl = PlayerState.all[i];
|
|
212
|
+
if (!pl.owner || !this.context.connection.userIsInRoom(pl.owner)) {
|
|
213
|
+
pl.doDestroy();
|
|
218
214
|
}
|
|
219
215
|
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
222
218
|
}
|
|
223
219
|
|
|
224
220
|
/**
|
|
@@ -454,4 +450,4 @@ export class PlayerState extends Behaviour {
|
|
|
454
450
|
return;
|
|
455
451
|
}
|
|
456
452
|
}
|
|
457
|
-
}
|
|
453
|
+
}
|