@combeenation/3d-viewer 12.1.1-beta1 → 12.1.1
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/element.js +1 -1
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/util/babylonHelper.js +1 -1
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +2 -1
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js +14 -8
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/api/classes/element.ts +1 -1
- package/src/api/util/babylonHelper.ts +1 -1
- package/src/api/util/sceneLoaderHelper.ts +19 -9
package/package.json
CHANGED
|
@@ -90,7 +90,7 @@ export class Element extends VariantParameterizable {
|
|
|
90
90
|
|
|
91
91
|
// fix enabled and tags state after cloning
|
|
92
92
|
exchangedInstance.setEnabled(clonedInstance.isEnabled(false));
|
|
93
|
-
if (Tags
|
|
93
|
+
if (Tags.HasTags(clonedInstance)) {
|
|
94
94
|
Tags.AddTagsTo(exchangedInstance, Tags.GetTags(clonedInstance, true));
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -118,7 +118,7 @@ const cloneTransformNode = function (
|
|
|
118
118
|
clone.setEnabled(node.isEnabled(false));
|
|
119
119
|
|
|
120
120
|
// tags are not cloned for instanced meshes by default
|
|
121
|
-
if (Tags
|
|
121
|
+
if (Tags.HasTags(node)) {
|
|
122
122
|
Tags.AddTagsTo(clone, Tags.GetTags(node, true));
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -114,7 +114,8 @@ export const addMissingMaterialMetadata = function (dataParsed: any, container:
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* Help function for manipulating tags of instances meshes after parsing.
|
|
117
|
-
* Per default babylon attaches the tags of the source mesh to the instance, if no tags are set for the
|
|
117
|
+
* Per default babylon attaches the tags of the source mesh to the instance, **but only** if no tags are set for the
|
|
118
|
+
* instanced mesh. If the instanced mesh has dedicated tags set, the ones from the source mesh are **not** copied over.
|
|
118
119
|
* In this case it's not possible to have tags on the source mesh but not on the instance, which is a problem with our
|
|
119
120
|
* tagging system in the viewer and the Combeenation asset editor as well.
|
|
120
121
|
* This function rejects the default tag import algorithm and just copies the tags of the original parsed node without
|
|
@@ -126,15 +127,24 @@ export const addMissingMaterialMetadata = function (dataParsed: any, container:
|
|
|
126
127
|
export const reconstructTagsForInstancedMeshes = function (dataParsed: any, container: AssetContainer) {
|
|
127
128
|
container.meshes.forEach(importedMesh => {
|
|
128
129
|
if (importedMesh instanceof InstancedMesh) {
|
|
129
|
-
// remove all tags from the imported mesh
|
|
130
|
+
// remove all tags from the imported mesh if there are some, since these tags are probably coming from the
|
|
131
|
+
// source mesh, if no tags are set there is no need for further operation though
|
|
130
132
|
const importedTags = Tags.GetTags(importedMesh);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
if (importedTags) {
|
|
134
|
+
Tags.RemoveTagsFrom(importedMesh, importedTags);
|
|
135
|
+
|
|
136
|
+
// get tags of parsed instanced mesh and set them on the imported instanced mesh
|
|
137
|
+
const parsedSourceMesh = dataParsed.meshes?.find(
|
|
138
|
+
(parsedMesh: any) => parsedMesh.name === importedMesh.sourceMesh.name
|
|
139
|
+
);
|
|
140
|
+
const parsedInstancedMesh = parsedSourceMesh?.instances.find(
|
|
141
|
+
(parsedMesh: any) => parsedMesh.name === importedMesh.name
|
|
142
|
+
);
|
|
143
|
+
const parsedTags = parsedInstancedMesh?.tags;
|
|
144
|
+
if (parsedTags) {
|
|
145
|
+
Tags.AddTagsTo(importedMesh, parsedTags);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
138
148
|
}
|
|
139
149
|
});
|
|
140
150
|
};
|