@needle-tools/engine 3.2.9-alpha → 3.2.11-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "3.2.9-alpha",
3
+ "version": "3.2.11-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",
@@ -7,10 +7,13 @@ export const needleLicense = (command, config, userSettings) => {
7
7
  name: "needle-license",
8
8
  enforce: 'pre',
9
9
  async transform(src, id) {
10
- if (id.includes("engine/engine_license") || id.includes("needle-tools_engine.js")) {
10
+ const isNeedleEngineFile = id.includes("engine/engine_license") || id.includes("needle-tools_engine.js");
11
+ // sometimes the actual license parameter is in a unnamed chunk file
12
+ const isViteChunkFile = id.includes("chunk") && id.includes(".vite");
13
+ if (isNeedleEngineFile || isViteChunkFile) {
11
14
  const needleConfig = await loadConfig();
12
15
  if (needleConfig) {
13
- if (needleConfig.hasProLicense !== undefined && typeof needleConfig.hasProLicense === "boolean") {
16
+ if (needleConfig.hasProLicense === true) {
14
17
  src = src.replace("NEEDLE_ENGINE_COMMERCIAL_USE_LICENSE = false;", "NEEDLE_ENGINE_COMMERCIAL_USE_LICENSE = " + needleConfig.hasProLicense + ";");
15
18
  return { code: src, map: null }
16
19
  }
@@ -31,8 +31,8 @@ async function showLicenseInfo(ctx: IContext) {
31
31
 
32
32
 
33
33
  const licenseElementIdentifier = "needle-license-element";
34
- const licenseDuration = 30000;
35
- const licenseDelay = 600;
34
+ const licenseDuration = 15000;
35
+ const licenseDelay = 500;
36
36
 
37
37
  function onNonCommercialVersionDetected(ctx: IContext) {
38
38
  setTimeout(() => insertNonCommercialUseHint(ctx), 2000);
@@ -67,7 +67,6 @@ function insertNonCommercialUseHint(ctx: IContext) {
67
67
 
68
68
  licenseElement.title = "Needle Engine — non commercial version";
69
69
  licenseElement.addEventListener("click", () => {
70
- console.log("CLICK")
71
70
  globalThis.open("https://needle.tools", "_blank");
72
71
  });
73
72
 
@@ -162,6 +161,7 @@ function createLicenseStyle() {
162
161
  mix-blend-mode: difference;
163
162
  line-height: 1em;
164
163
  margin-left: -3px;
164
+ text-shadow: 0 0 2px rgba(200,200,200, .3);
165
165
  }
166
166
 
167
167
  ${selector} .text .non-commercial {
@@ -167,11 +167,14 @@ export function processStart(context: IContext, object?: Object3D) {
167
167
  // keep them in queue until script has started
168
168
  // call awake if the script was inactive before
169
169
  utils.safeInvoke(script.__internalAwake.bind(script));
170
- utils.safeInvoke(script.__internalEnable.bind(script));
171
- // now call start
172
- utils.safeInvoke(script.__internalStart.bind(script));
173
- context.new_script_start.splice(i, 1);
174
- i--;
170
+ if(script.enabled)
171
+ {
172
+ utils.safeInvoke(script.__internalEnable.bind(script));
173
+ // now call start
174
+ utils.safeInvoke(script.__internalStart.bind(script));
175
+ context.new_script_start.splice(i, 1);
176
+ i--;
177
+ }
175
178
  }
176
179
  catch (err) {
177
180
  console.error(err);
@@ -274,7 +277,7 @@ function updateIsActiveInHierarchyRecursiveRuntime(go: Object3D, activeInHierarc
274
277
  }
275
278
  }
276
279
  else {
277
- if (comp["__didAwake"]) {
280
+ if (comp["__didAwake"] && comp.enabled) {
278
281
  comp["__didEnable"] = false;
279
282
  comp.onDisable();
280
283
  }
@@ -75,7 +75,7 @@ export class NEEDLE_lighting_settings implements GLTFLoaderPlugin {
75
75
  ContextRegistry.registerCallback(ContextEvent.ContextCreated, e => {
76
76
  const ctx = e.context as Context;
77
77
  const lightingSettings = GameObject.findObjectOfType(SceneLightSettings, ctx as Context);
78
- if (lightingSettings?.sourceId) ctx.sceneLighting.enable(lightingSettings.sourceId);
78
+ if (lightingSettings?.sourceId) lightingSettings.enabled = true;
79
79
  })
80
80
 
81
81
  // exists once per gltf scene root (if it contains reflection)
@@ -130,7 +130,7 @@ export class SceneLightSettings extends Behaviour {
130
130
  }
131
131
 
132
132
  onEnable(): void {
133
- if (debug) console.warn("💡🟡 >>> Enable lighting", this.sourceId, this);
133
+ if (debug) console.warn("💡🟡 >>> Enable lighting", this.sourceId, this.enabled, this);
134
134
 
135
135
  if (this.ambientMode == AmbientMode.Flat) {
136
136
  if (this.ambientLight && !this._ambientLightObj) {
@@ -102,7 +102,7 @@ export class Animator extends Behaviour {
102
102
  /**@deprecated use setTrigger */
103
103
  SetTrigger(name: string | number) { this.setTrigger(name); }
104
104
  setTrigger(name: string | number) {
105
- console.log("name", name);
105
+ if(debug) console.log("SetTrigger", name);
106
106
  this.runtimeAnimatorController?.setTrigger(name);
107
107
  }
108
108
 
@@ -24,7 +24,7 @@ export class GroundProjectedEnv extends Behaviour {
24
24
  set radius(val: number) {
25
25
  this._radius = val;
26
26
  if (this.env)
27
- this.env.height = val;
27
+ this.env.radius = val;
28
28
  }
29
29
  get radius(): number { return this._radius; }
30
30
  private _radius: number = 100;