@hology/core 0.0.179 → 0.0.181

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.
@@ -1,11 +1,16 @@
1
1
  import { Object3D } from "three";
2
- import { Asset } from "../model";
3
2
  import { BaseActor } from "../../gameplay/actors/actor.js";
3
+ import { Asset } from "../model";
4
4
  export declare class Prefab {
5
5
  asset: Asset;
6
6
  }
7
7
  export declare class PrefabInstance {
8
8
  object: Object3D;
9
9
  actors: BaseActor[];
10
+ mainActor: BaseActor | null;
11
+ }
12
+ export declare class PrefabOf<T extends BaseActor> {
13
+ readonly prefab: Prefab;
14
+ constructor(prefab: Prefab);
10
15
  }
11
16
  //# sourceMappingURL=prefab.d.ts.map
@@ -1,4 +1,4 @@
1
- export class Prefab{constructor(s){this.asset=s}}export class PrefabInstance{}/*
1
+ export class Prefab{constructor(s){this.asset=s}}export class PrefabInstance{}export class PrefabOf{constructor(s){this.prefab=s}}/*
2
2
  * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -2,7 +2,7 @@ import { AssetsProvider } from '../scene/assets-provider.js';
2
2
  import { Subject } from 'rxjs';
3
3
  import { Asset } from '../scene/model.js';
4
4
  import { RuntimeBackendService } from './runtime-backend-service.js';
5
- export declare class RuntimeAssetsService implements AssetsProvider {
5
+ export declare class RuntimeAssetsService extends AssetsProvider {
6
6
  private backend;
7
7
  private assets;
8
8
  private loaded;
@@ -1,4 +1,4 @@
1
- import{Subject as s}from"rxjs";export class RuntimeAssetsService{constructor(t){this.backend=t,this.assets=new Map,this.loaded=!1,this.onCreate=new s,this.onDelete=new s,this.onUpdate=new s}async getAssets(){if(!this.loaded){const s=await this.backend.getAssets();for(const t of s)this.assets.set(t.id,t)}return Array.from(this.assets.values())}async getAsset(s){return this.assets.get(s)??async function(s,e){t.has(s)||t.set(s,e(s));return t.get(s)}(s,()=>this.backend.getAsset(s))}}const t=new Map;/*
1
+ import{AssetsProvider as s}from"../scene/assets-provider.js";import{Subject as e}from"rxjs";export class RuntimeAssetsService extends s{constructor(s){super(),this.backend=s,this.assets=new Map,this.loaded=!1,this.onCreate=new e,this.onDelete=new e,this.onUpdate=new e}async getAssets(){if(!this.loaded){const s=await this.backend.getAssets();for(const e of s)this.assets.set(e.id,e)}return Array.from(this.assets.values())}async getAsset(s){return this.assets.get(s)??async function(s,e){t.has(s)||t.set(s,e(s));return t.get(s)}(s,()=>this.backend.getAsset(s))}}const t=new Map;/*
2
2
  * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,13 +1,13 @@
1
1
  import 'reflect-metadata';
2
2
  import { Type } from '../utils/type.js';
3
3
  import { BaseActor } from '../gameplay/actors/actor.js';
4
- import { Color, Euler, Material, Object3D, Texture, Vector2, Vector3, Vector4 } from 'three';
4
+ import { Color, Euler, Material, Object3D, Texture, Vector2, Vector3, Vector4, AnimationClip } from 'three';
5
5
  import { BooleanNode, FloatNode, RgbNode, Sampler2DNode, Vec2Node, Vec3Node, Vec4Node } from '../shader-nodes/index.js';
6
6
  import { VisualEffect } from '../effects/vfx/vfx-param.js';
7
- import { Prefab } from '../scene/objects/prefab.js';
7
+ import { Prefab, PrefabOf } from '../scene/objects/prefab.js';
8
8
  import { Curve2 } from '../utils/curve.js';
9
9
  import { ColorLayer, MaskLayer } from './color-layer.js';
10
- export type ParameterType = Type<FloatNode | Number | Texture | Sampler2DNode | Boolean | BooleanNode | Vector2 | Vec2Node | Vector3 | Vec3Node | Vector4 | Vec4Node | Color | RgbNode | String | BaseActor | Euler | Object3D | Material | VisualEffect | Prefab | Curve2 | ColorLayer | MaskLayer>;
10
+ export type ParameterType = Type<FloatNode | Number | Texture | Sampler2DNode | Boolean | BooleanNode | Vector2 | Vec2Node | Vector3 | Vec3Node | Vector4 | Vec4Node | Color | RgbNode | String | BaseActor | Euler | Object3D | Material | AnimationClip | VisualEffect | Prefab | PrefabOf<BaseActor> | Curve2 | ColorLayer | MaskLayer>;
11
11
  export type ParameterOption<T> = {
12
12
  name: string;
13
13
  value: T;
@@ -24,6 +24,24 @@ export interface ParameterOptions {
24
24
  help?: string;
25
25
  /** Only show this parameter when the specified properties have the required values */
26
26
  requires?: Record<string, unknown>;
27
+ /**
28
+ * When true, enables override mode for this parameter.
29
+ * The parameter will show an override checkbox in the editor,
30
+ * allowing the user to explicitly opt-in to overriding the default value.
31
+ */
32
+ optional?: boolean;
33
+ /**
34
+ * Restrict prefabs to be possible to select to those that have a main actor
35
+ * that inherits from the given actor class.
36
+ * This option should be used together with the property type PrefabOf<T>
37
+ * The property value can then be using in world.spawnActor which instantiates
38
+ * the prefab and returns the actor with a correct type.
39
+ *
40
+ * Example:
41
+ * @Parameter({prefabOf: BaseActor})
42
+ * prefab: PrefabOf<BaseActor>
43
+ */
44
+ prefabOf?: Type<BaseActor>;
27
45
  }
28
46
  export interface PropertyParameter {
29
47
  name: string;
@@ -1,4 +1,4 @@
1
- import"reflect-metadata";import{reflect as t,decorateProperty as e}from"@plumier/reflect";import{ArrayMap as r}from"../utils/collections.js";Symbol("format");class o{constructor(t){this.options=t,this.isParameterDecorator=!0}}new Map;const a=new r;export function Parameter(t){return function(r,n,c){if(null!=r){a.push(r.constructor,{name:n,options:t??{}});try{e(new o(t))(r,n,c)}catch(t){console.warn("Failed to decorate method ",r,n,c)}}}}export function extractShaderParameters(t){if(null==t)return[];const e=a.get(t).map(({name:e,options:r})=>{const o=Reflect.getMetadata("design:type",t.prototype,e),a=r.type??o;return r.array=o===Array,{name:e,type:a,options:r}});return[...extractShaderParameters(Object.getPrototypeOf(t)).filter(t=>e.every(e=>e.name!==t.name)),...e]}export function ParameterCategory(t){}/*
1
+ import"reflect-metadata";import{reflect as t,decorateProperty as e}from"@plumier/reflect";import{ArrayMap as r}from"../utils/collections.js";Symbol("format");class o{constructor(t){this.options=t,this.isParameterDecorator=!0}}new Map;const a=new r;export function Parameter(t){return function(r,n,c){if(null!=r){a.push(r.constructor,{name:n,options:t??{}});try{e(new o(t))(r,n,c)}catch(t){console.warn("Failed to decorate method ",r,n,c)}}}}export function extractShaderParameters(t){if(null==t)return[];const e=a.get(t).map(({name:e,options:r})=>{const o=Reflect.getMetadata("design:type",t.prototype,e),a=r.type??o,n=Reflect.getMetadata("prefab:type",t.prototype,e);return r.prefabOf??(r.prefabOf=n),r.array=o===Array,{name:e,type:a,options:r}});return[...extractShaderParameters(Object.getPrototypeOf(t)).filter(t=>e.every(e=>e.name!==t.name)),...e]}export function ParameterCategory(t){}/*
2
2
  * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hology/core",
3
- "version": "0.0.179",
3
+ "version": "0.0.181",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -168,13 +168,13 @@
168
168
  "dependencies": {
169
169
  "@babel/runtime": "^7.24.8",
170
170
  "@dimforge/rapier3d-compat": "^0.14.0",
171
- "@hology/nebula": "^0.0.157",
171
+ "@hology/nebula": "^0.0.158",
172
172
  "@plumier/reflect": "^1.1.0",
173
173
  "@recast-navigation/three": "0.39.0",
174
174
  "recast-navigation": "0.39.0",
175
175
  "rxjs": "7.8.1",
176
176
  "three-mesh-bvh": "^0.7.5",
177
- "three-shader-graph": "^0.2.36",
177
+ "three-shader-graph": "^0.2.37",
178
178
  "three-stdlib": "2.34.0",
179
179
  "ts-key-enum": "^2.0.12",
180
180
  "typedi": "^0.10.0"