@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
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
import { Element } from '../classes/element';
|
|
2
2
|
import { Variant } from '../classes/variant';
|
|
3
3
|
import { VariantInstance } from '../classes/variantInstance';
|
|
4
|
-
import {
|
|
4
|
+
import { GltfExportManager } from '../manager/gltfExportManager';
|
|
5
|
+
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
5
6
|
import { Tags } from '@babylonjs/core/Misc/tags';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* Find out if a
|
|
9
|
-
* @param
|
|
9
|
+
* Find out if a node is part of a list of excluded geometry
|
|
10
|
+
* @param node BJS node
|
|
10
11
|
* @param list list of excluded geometry
|
|
11
|
-
* @returns boolean based on whether
|
|
12
|
+
* @returns boolean based on whether node (or one of its parents) was found in list
|
|
12
13
|
*/
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
return
|
|
14
|
+
const isNodeIncludedInExclusionList = function (node: TransformNode, list: ExcludedGeometryList): boolean {
|
|
15
|
+
const checkNode = (inputNode: TransformNode, nodeToCheck: TransformNode) => {
|
|
16
|
+
return inputNode.uniqueId === nodeToCheck.uniqueId;
|
|
16
17
|
};
|
|
17
|
-
const checkElement = (inputEl: Element,
|
|
18
|
-
return inputEl.
|
|
18
|
+
const checkElement = (inputEl: Element, nodeToCheck: TransformNode) => {
|
|
19
|
+
return inputEl.nodesFlat.some(m => checkNode(m, nodeToCheck));
|
|
19
20
|
};
|
|
20
|
-
const checkVariant = (inputVariant: Variant,
|
|
21
|
-
return inputVariant.elements.some(el => checkElement(el,
|
|
21
|
+
const checkVariant = (inputVariant: Variant, nodeToCheck: TransformNode) => {
|
|
22
|
+
return inputVariant.elements.some(el => checkElement(el, nodeToCheck));
|
|
22
23
|
};
|
|
23
|
-
const checkVariantInstance = (inputVarInst: VariantInstance,
|
|
24
|
-
return inputVarInst.variant.elements.some(el => checkElement(el,
|
|
24
|
+
const checkVariantInstance = (inputVarInst: VariantInstance, nodeToCheck: TransformNode) => {
|
|
25
|
+
return inputVarInst.variant.elements.some(el => checkElement(el, nodeToCheck));
|
|
25
26
|
};
|
|
26
|
-
const checkTagManagerSubject = (inputSubject: TagManagerSubject,
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const checkTagManagerSubject = (inputSubject: TagManagerSubject, nodeToCheck: TransformNode) => {
|
|
28
|
+
const nodeName = nodeToCheck.metadata?.[GltfExportManager.NAME_BEFORE_EXPORT_METADATA_PROPERTY] ?? nodeToCheck.name;
|
|
29
|
+
const nameMatches = inputSubject.nodeName && inputSubject.nodeName === nodeName;
|
|
30
|
+
const tagMatches = inputSubject.tagName && Tags.MatchesQuery(nodeToCheck, inputSubject.tagName);
|
|
29
31
|
return nameMatches || tagMatches;
|
|
30
32
|
};
|
|
31
|
-
const check = (geometryToExclude: ExcludedGeometry,
|
|
33
|
+
const check = (geometryToExclude: ExcludedGeometry, node: TransformNode) => {
|
|
32
34
|
if (geometryToExclude instanceof VariantInstance) {
|
|
33
|
-
return checkVariantInstance(geometryToExclude,
|
|
35
|
+
return checkVariantInstance(geometryToExclude, node);
|
|
34
36
|
}
|
|
35
37
|
if (geometryToExclude instanceof Variant) {
|
|
36
|
-
return checkVariant(geometryToExclude,
|
|
38
|
+
return checkVariant(geometryToExclude, node);
|
|
37
39
|
}
|
|
38
40
|
if (geometryToExclude instanceof Element) {
|
|
39
|
-
return checkElement(geometryToExclude,
|
|
41
|
+
return checkElement(geometryToExclude, node);
|
|
40
42
|
}
|
|
41
|
-
if (geometryToExclude instanceof
|
|
42
|
-
return
|
|
43
|
+
if (geometryToExclude instanceof TransformNode) {
|
|
44
|
+
return checkNode(geometryToExclude, node);
|
|
43
45
|
}
|
|
44
46
|
if ((geometryToExclude as TagManagerSubject).tagName || (geometryToExclude as TagManagerSubject).nodeName) {
|
|
45
|
-
return checkTagManagerSubject(geometryToExclude as TagManagerSubject,
|
|
47
|
+
return checkTagManagerSubject(geometryToExclude as TagManagerSubject, node);
|
|
46
48
|
}
|
|
47
49
|
return false;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
|
-
let isExcluded = list.some(geometryToExclude => check(geometryToExclude,
|
|
51
|
-
if (!isExcluded &&
|
|
52
|
-
isExcluded =
|
|
52
|
+
let isExcluded = list.some(geometryToExclude => check(geometryToExclude, node));
|
|
53
|
+
if (!isExcluded && node.parent instanceof TransformNode) {
|
|
54
|
+
isExcluded = isNodeIncludedInExclusionList(node.parent, list);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
return isExcluded;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
export {
|
|
60
|
+
export { isNodeIncludedInExclusionList };
|