@combeenation/3d-viewer 8.0.0 → 8.1.0-alpha1
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/dist/lib-cjs/api/classes/parameter.d.ts +27 -0
- package/dist/lib-cjs/api/classes/parameter.js +27 -0
- package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
- package/dist/lib-cjs/api/classes/variant.d.ts +8 -0
- package/dist/lib-cjs/api/classes/variant.js +12 -0
- package/dist/lib-cjs/api/classes/variant.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewer.d.ts +2 -2
- package/dist/lib-cjs/api/classes/viewer.js +9 -8
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +1 -0
- package/dist/lib-cjs/api/manager/gltfExportManager.js +7 -2
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/tagManager.d.ts +25 -23
- package/dist/lib-cjs/api/manager/tagManager.js +153 -89
- package/dist/lib-cjs/api/manager/tagManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +1 -1
- package/dist/lib-cjs/api/manager/variantInstanceManager.js +5 -7
- package/dist/lib-cjs/api/manager/variantInstanceManager.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +16 -4
- package/dist/lib-cjs/api/util/structureHelper.d.ts +6 -6
- package/dist/lib-cjs/api/util/structureHelper.js +31 -28
- package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/api/classes/parameter.ts +30 -0
- package/src/api/classes/variant.ts +14 -0
- package/src/api/classes/viewer.ts +12 -14
- package/src/api/manager/gltfExportManager.ts +8 -3
- package/src/api/manager/tagManager.ts +178 -119
- package/src/api/manager/variantInstanceManager.ts +5 -8
- package/src/api/util/globalTypes.ts +20 -4
- package/src/api/util/structureHelper.ts +29 -27
|
@@ -250,7 +250,7 @@ declare type ScreenshotSettings = {
|
|
|
250
250
|
/**
|
|
251
251
|
* Use this to define geometry to be excluded from autofocus, GLB export, etc.
|
|
252
252
|
*/
|
|
253
|
-
declare type ExcludedGeometry =
|
|
253
|
+
declare type ExcludedGeometry = TransformNode | VariantInstance | Variant | VariantElement | TagManagerSubject;
|
|
254
254
|
declare type ExcludedGeometryList = ExcludedGeometry[];
|
|
255
255
|
declare type AutofocusSettings = {
|
|
256
256
|
/**
|
|
@@ -327,7 +327,6 @@ declare type VariantInstanceDefinition = {
|
|
|
327
327
|
name?: string;
|
|
328
328
|
variant: DottedPathArgument;
|
|
329
329
|
parameters?: ParameterBag;
|
|
330
|
-
tagManagerParameterValues?: TagManagerParameterValue[];
|
|
331
330
|
lazy?: boolean;
|
|
332
331
|
};
|
|
333
332
|
declare type SetupJson = {
|
|
@@ -350,7 +349,7 @@ declare type ParsedParameterBag = {
|
|
|
350
349
|
};
|
|
351
350
|
declare type DottedPathArgument = string | string[] | DottedPath;
|
|
352
351
|
declare type ParameterObserverResult = boolean | void;
|
|
353
|
-
declare type ParameterObserver = (
|
|
352
|
+
declare type ParameterObserver = (object: any, oldValue: Undefinable<ParameterValue>, newValue: ParameterValue) => Promise<ParameterObserverResult>;
|
|
354
353
|
declare type PlacementDefinitions = {
|
|
355
354
|
[name: string]: PlacementDefinition;
|
|
356
355
|
};
|
|
@@ -425,26 +424,39 @@ declare type TagMapping = {
|
|
|
425
424
|
declare type TagManagerSubject = {
|
|
426
425
|
tagName?: string;
|
|
427
426
|
nodeName?: string;
|
|
427
|
+
materialName?: string;
|
|
428
428
|
};
|
|
429
|
+
declare type TagManagerParameterObserverResult = ParameterObserverResult;
|
|
429
430
|
/**
|
|
430
431
|
* The observer should return `false` in cases where the given value was not actually applied. E.g. when wanting to
|
|
431
432
|
* apply a property on the given `node`s material which doesn't exist at the time the observer is called etc.
|
|
432
433
|
*/
|
|
433
|
-
declare type TagManagerParameterObserver = (payload: TagManagerParameterObserverPayload) => Promise<
|
|
434
|
+
declare type TagManagerParameterObserver = (payload: TagManagerParameterObserverPayload) => Promise<TagManagerParameterObserverResult>;
|
|
434
435
|
declare type TagManagerParameterBag = FuzzyMap<TagManagerSubject, ParameterBag>;
|
|
435
436
|
declare type TagManagerParameterObserverBag = Map<string, TagManagerParameterObserver>;
|
|
436
437
|
declare type TagManagerParameterObserverPayload = {
|
|
437
438
|
subject: TagManagerSubject;
|
|
438
439
|
nodes: TransformNode[];
|
|
440
|
+
materials: Material[];
|
|
439
441
|
newValue: ParameterValue;
|
|
440
442
|
oldValue: Undefinable<ParameterValue>;
|
|
441
443
|
};
|
|
442
444
|
declare type TagManagerParameterValue = {
|
|
443
445
|
tagName?: string;
|
|
444
446
|
nodeName?: string;
|
|
447
|
+
materialName?: string;
|
|
445
448
|
parameterName: string;
|
|
446
449
|
value: ParameterValue;
|
|
447
450
|
};
|
|
451
|
+
declare type TagManagerParameterObserverResultBag = {
|
|
452
|
+
subject: TagManagerSubject;
|
|
453
|
+
parameter: string;
|
|
454
|
+
nodes: TransformNode[];
|
|
455
|
+
materials: Material[];
|
|
456
|
+
oldValue: ParameterValue;
|
|
457
|
+
newValue: ParameterValue;
|
|
458
|
+
parameterObserverResult: TagManagerParameterObserverResult;
|
|
459
|
+
};
|
|
448
460
|
declare type NodeNamingStrategyPayload = {
|
|
449
461
|
variantInstance: VariantInstance;
|
|
450
462
|
variant: Variant;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
2
2
|
/**
|
|
3
|
-
* Find out if a
|
|
4
|
-
* @param
|
|
3
|
+
* Find out if a node is part of a list of excluded geometry
|
|
4
|
+
* @param node BJS node
|
|
5
5
|
* @param list list of excluded geometry
|
|
6
|
-
* @returns boolean based on whether
|
|
6
|
+
* @returns boolean based on whether node (or one of its parents) was found in list
|
|
7
7
|
*/
|
|
8
|
-
declare const
|
|
9
|
-
export {
|
|
8
|
+
declare const isNodeIncludedInExclusionList: (node: TransformNode, list: ExcludedGeometryList) => boolean;
|
|
9
|
+
export { isNodeIncludedInExclusionList };
|
|
@@ -1,58 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isNodeIncludedInExclusionList = void 0;
|
|
4
4
|
const element_1 = require("../classes/element");
|
|
5
5
|
const variant_1 = require("../classes/variant");
|
|
6
6
|
const variantInstance_1 = require("../classes/variantInstance");
|
|
7
|
-
const
|
|
7
|
+
const gltfExportManager_1 = require("../manager/gltfExportManager");
|
|
8
|
+
const transformNode_1 = require("@babylonjs/core/Meshes/transformNode");
|
|
8
9
|
const tags_1 = require("@babylonjs/core/Misc/tags");
|
|
9
10
|
/**
|
|
10
|
-
* Find out if a
|
|
11
|
-
* @param
|
|
11
|
+
* Find out if a node is part of a list of excluded geometry
|
|
12
|
+
* @param node BJS node
|
|
12
13
|
* @param list list of excluded geometry
|
|
13
|
-
* @returns boolean based on whether
|
|
14
|
+
* @returns boolean based on whether node (or one of its parents) was found in list
|
|
14
15
|
*/
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
return
|
|
16
|
+
const isNodeIncludedInExclusionList = function (node, list) {
|
|
17
|
+
const checkNode = (inputNode, nodeToCheck) => {
|
|
18
|
+
return inputNode.uniqueId === nodeToCheck.uniqueId;
|
|
18
19
|
};
|
|
19
|
-
const checkElement = (inputEl,
|
|
20
|
-
return inputEl.
|
|
20
|
+
const checkElement = (inputEl, nodeToCheck) => {
|
|
21
|
+
return inputEl.nodesFlat.some(m => checkNode(m, nodeToCheck));
|
|
21
22
|
};
|
|
22
|
-
const checkVariant = (inputVariant,
|
|
23
|
-
return inputVariant.elements.some(el => checkElement(el,
|
|
23
|
+
const checkVariant = (inputVariant, nodeToCheck) => {
|
|
24
|
+
return inputVariant.elements.some(el => checkElement(el, nodeToCheck));
|
|
24
25
|
};
|
|
25
|
-
const checkVariantInstance = (inputVarInst,
|
|
26
|
-
return inputVarInst.variant.elements.some(el => checkElement(el,
|
|
26
|
+
const checkVariantInstance = (inputVarInst, nodeToCheck) => {
|
|
27
|
+
return inputVarInst.variant.elements.some(el => checkElement(el, nodeToCheck));
|
|
27
28
|
};
|
|
28
|
-
const checkTagManagerSubject = (inputSubject,
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
const checkTagManagerSubject = (inputSubject, nodeToCheck) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const nodeName = (_b = (_a = nodeToCheck.metadata) === null || _a === void 0 ? void 0 : _a[gltfExportManager_1.GltfExportManager.NAME_BEFORE_EXPORT_METADATA_PROPERTY]) !== null && _b !== void 0 ? _b : nodeToCheck.name;
|
|
32
|
+
const nameMatches = inputSubject.nodeName && inputSubject.nodeName === nodeName;
|
|
33
|
+
const tagMatches = inputSubject.tagName && tags_1.Tags.MatchesQuery(nodeToCheck, inputSubject.tagName);
|
|
31
34
|
return nameMatches || tagMatches;
|
|
32
35
|
};
|
|
33
|
-
const check = (geometryToExclude,
|
|
36
|
+
const check = (geometryToExclude, node) => {
|
|
34
37
|
if (geometryToExclude instanceof variantInstance_1.VariantInstance) {
|
|
35
|
-
return checkVariantInstance(geometryToExclude,
|
|
38
|
+
return checkVariantInstance(geometryToExclude, node);
|
|
36
39
|
}
|
|
37
40
|
if (geometryToExclude instanceof variant_1.Variant) {
|
|
38
|
-
return checkVariant(geometryToExclude,
|
|
41
|
+
return checkVariant(geometryToExclude, node);
|
|
39
42
|
}
|
|
40
43
|
if (geometryToExclude instanceof element_1.Element) {
|
|
41
|
-
return checkElement(geometryToExclude,
|
|
44
|
+
return checkElement(geometryToExclude, node);
|
|
42
45
|
}
|
|
43
|
-
if (geometryToExclude instanceof
|
|
44
|
-
return
|
|
46
|
+
if (geometryToExclude instanceof transformNode_1.TransformNode) {
|
|
47
|
+
return checkNode(geometryToExclude, node);
|
|
45
48
|
}
|
|
46
49
|
if (geometryToExclude.tagName || geometryToExclude.nodeName) {
|
|
47
|
-
return checkTagManagerSubject(geometryToExclude,
|
|
50
|
+
return checkTagManagerSubject(geometryToExclude, node);
|
|
48
51
|
}
|
|
49
52
|
return false;
|
|
50
53
|
};
|
|
51
|
-
let isExcluded = list.some(geometryToExclude => check(geometryToExclude,
|
|
52
|
-
if (!isExcluded &&
|
|
53
|
-
isExcluded =
|
|
54
|
+
let isExcluded = list.some(geometryToExclude => check(geometryToExclude, node));
|
|
55
|
+
if (!isExcluded && node.parent instanceof transformNode_1.TransformNode) {
|
|
56
|
+
isExcluded = isNodeIncludedInExclusionList(node.parent, list);
|
|
54
57
|
}
|
|
55
58
|
return isExcluded;
|
|
56
59
|
};
|
|
57
|
-
exports.
|
|
60
|
+
exports.isNodeIncludedInExclusionList = isNodeIncludedInExclusionList;
|
|
58
61
|
//# sourceMappingURL=structureHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structureHelper.js","sourceRoot":"","sources":["../../../../src/api/util/structureHelper.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAC7C,gDAA6C;AAC7C,gEAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"structureHelper.js","sourceRoot":"","sources":["../../../../src/api/util/structureHelper.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAC7C,gDAA6C;AAC7C,gEAA6D;AAC7D,oEAAiE;AACjE,wEAAqE;AACrE,oDAAiD;AAEjD;;;;;GAKG;AACH,MAAM,6BAA6B,GAAG,UAAU,IAAmB,EAAE,IAA0B;IAC7F,MAAM,SAAS,GAAG,CAAC,SAAwB,EAAE,WAA0B,EAAE,EAAE;QACzE,OAAO,SAAS,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,CAAC;IACrD,CAAC,CAAC;IACF,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,WAA0B,EAAE,EA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