@archvisioninc/canvas 2.4.6 → 2.4.8

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,7 +1,7 @@
1
1
  import * as BABYLON from 'babylonjs';
2
2
 
3
- // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused...
4
- // eslint-disable-next-line
3
+ // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused.
4
+ // eslint-disable-next-line no-unused-vars
5
5
  import { GLTFFileLoader } from 'babylonjs-loaders';
6
6
  import { reactProps as props } from '../Canvas';
7
7
  import { DRAG_DROP_FORMATS } from '../enums';
@@ -219,7 +219,22 @@ export const loadFromDragDrop = () => {
219
219
  const onProgress = null;
220
220
  const additionalRenderLoopLogic = null;
221
221
  const textureLoading = null;
222
- const startingProcessingFiles = () => checkSupportedFileTypes();
222
+ const startingProcessingFiles = () => {
223
+ const hasGuid = !_.isEmpty(props.guidURL);
224
+ if (hasGuid) {
225
+ // eslint-disable-next-line max-len
226
+ const message = "This model has published data that can't be updated from a drag and drop operation. Use Create from gLTF to start a new file.";
227
+ const config = {
228
+ type: MESSAGE_TYPES.warning
229
+ };
230
+ props.addNotification?.([{
231
+ message,
232
+ config
233
+ }], clearExisting);
234
+ throw new Error(message);
235
+ }
236
+ checkSupportedFileTypes();
237
+ };
223
238
  const onReload = null;
224
239
  const onError = (file, scene, error) => {
225
240
  const missingBin = error.includes('.bin');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "2.4.6",
3
+ "version": "2.4.8",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -1,7 +1,7 @@
1
1
  import * as BABYLON from 'babylonjs';
2
2
 
3
- // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused...
4
- // eslint-disable-next-line
3
+ // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused.
4
+ // eslint-disable-next-line no-unused-vars
5
5
  import { GLTFFileLoader } from 'babylonjs-loaders';
6
6
 
7
7
  import { reactProps as props } from '../Canvas';
@@ -235,15 +235,30 @@ let filesInput;
235
235
 
236
236
  export const loadFromDragDrop = () => {
237
237
  const handleCloseLoading = () => props.clearNotifications?.();
238
+
238
239
  const sceneLoaded = (file, newScene) => {
239
240
  const fileName = file.name.split('.').shift();
240
241
  initSceneFromFile(newScene, fileName);
241
242
  modelToOrigin();
242
243
  };
244
+
243
245
  const onProgress = null;
244
246
  const additionalRenderLoopLogic = null;
245
247
  const textureLoading = null;
246
- const startingProcessingFiles = () => checkSupportedFileTypes();
248
+ const startingProcessingFiles = () => {
249
+ const hasGuid = !_.isEmpty(props.guidURL);
250
+
251
+ if (hasGuid) {
252
+ // eslint-disable-next-line max-len
253
+ const message = "This model has published data that can't be updated from a drag and drop operation. Use Create from gLTF to start a new file.";
254
+ const config = { type: MESSAGE_TYPES.warning };
255
+
256
+ props.addNotification?.([ { message, config } ], clearExisting);
257
+ throw new Error(message);
258
+ }
259
+
260
+ checkSupportedFileTypes();
261
+ };
247
262
  const onReload = null;
248
263
 
249
264
  const onError = (file, scene, error) => {