@babylonjs/node-editor 6.3.0 → 6.4.0
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.
@@ -54805,6 +54805,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
54805
54805
|
|
54806
54806
|
|
54807
54807
|
|
54808
|
+
|
54808
54809
|
|
54809
54810
|
|
54810
54811
|
const dontSerializeTextureContent = true;
|
@@ -54884,6 +54885,27 @@ class PreviewManager {
|
|
54884
54885
|
this._camera.minZ = 0.1;
|
54885
54886
|
this._camera.attachControl(false);
|
54886
54887
|
this._lightParent = new core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.TransformNode("LightParent", this._scene);
|
54888
|
+
this._globalState.filesInput = new core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.FilesInput(this._engine, this._scene, (_, scene) => {
|
54889
|
+
this._meshes.push(...scene.meshes);
|
54890
|
+
this._prepareScene();
|
54891
|
+
}, null, null, null, null, null, () => {
|
54892
|
+
this._reset();
|
54893
|
+
}, true);
|
54894
|
+
const canvas = this._engine.getRenderingCanvas();
|
54895
|
+
if (canvas) {
|
54896
|
+
const onDrag = (evt) => {
|
54897
|
+
evt.stopPropagation();
|
54898
|
+
evt.preventDefault();
|
54899
|
+
};
|
54900
|
+
canvas.addEventListener("dragenter", onDrag, false);
|
54901
|
+
canvas.addEventListener("dragover", onDrag, false);
|
54902
|
+
const onDrop = (evt) => {
|
54903
|
+
evt.stopPropagation();
|
54904
|
+
evt.preventDefault();
|
54905
|
+
this._globalState.onDropEventReceivedObservable.notifyObservers(evt);
|
54906
|
+
};
|
54907
|
+
canvas.addEventListener("drop", onDrop, false);
|
54908
|
+
}
|
54887
54909
|
this._refreshPreviewMesh();
|
54888
54910
|
this._engine.runRenderLoop(() => {
|
54889
54911
|
this._engine.resize();
|
@@ -54910,6 +54932,13 @@ class PreviewManager {
|
|
54910
54932
|
lastOffsetX = evt.event.offsetX;
|
54911
54933
|
});
|
54912
54934
|
}
|
54935
|
+
_reset() {
|
54936
|
+
this._globalState.previewType = _previewType__WEBPACK_IMPORTED_MODULE_1__.PreviewType.Box;
|
54937
|
+
this._globalState.listOfCustomPreviewFiles = [];
|
54938
|
+
this._scene.meshes.forEach((m) => m.dispose());
|
54939
|
+
this._globalState.onRefreshPreviewMeshControlComponentRequiredObservable.notifyObservers();
|
54940
|
+
this._refreshPreviewMesh(true);
|
54941
|
+
}
|
54913
54942
|
_handleAnimations() {
|
54914
54943
|
this._scene.stopAllAnimations();
|
54915
54944
|
if (this._globalState.rotatePreview) {
|
@@ -54991,8 +55020,8 @@ class PreviewManager {
|
|
54991
55020
|
// Material
|
54992
55021
|
this._updatePreview();
|
54993
55022
|
}
|
54994
|
-
_refreshPreviewMesh() {
|
54995
|
-
if (this._currentType !== this._globalState.previewType || this._currentType === _previewType__WEBPACK_IMPORTED_MODULE_1__.PreviewType.Custom) {
|
55023
|
+
_refreshPreviewMesh(force) {
|
55024
|
+
if (this._currentType !== this._globalState.previewType || this._currentType === _previewType__WEBPACK_IMPORTED_MODULE_1__.PreviewType.Custom || force) {
|
54996
55025
|
this._currentType = this._globalState.previewType;
|
54997
55026
|
if (this._meshes && this._meshes.length) {
|
54998
55027
|
for (const mesh of this._meshes) {
|
@@ -55066,10 +55095,7 @@ class PreviewManager {
|
|
55066
55095
|
});
|
55067
55096
|
return;
|
55068
55097
|
case _previewType__WEBPACK_IMPORTED_MODULE_1__.PreviewType.Custom:
|
55069
|
-
|
55070
|
-
this._meshes.push(...this._scene.meshes);
|
55071
|
-
this._prepareScene();
|
55072
|
-
});
|
55098
|
+
this._globalState.filesInput.loadFiles({ target: { files: this._globalState.listOfCustomPreviewFiles } });
|
55073
55099
|
return;
|
55074
55100
|
}
|
55075
55101
|
}
|
@@ -55320,9 +55346,17 @@ class PreviewMeshControlComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
|
|
55320
55346
|
this._onResetRequiredObserver = this.props.globalState.onResetRequiredObservable.add(() => {
|
55321
55347
|
this.forceUpdate();
|
55322
55348
|
});
|
55349
|
+
this._onDropEventObserver = this.props.globalState.onDropEventReceivedObservable.add((event) => {
|
55350
|
+
this.useCustomMesh(event);
|
55351
|
+
});
|
55352
|
+
this._onRefreshPreviewMeshControlComponentRequiredObserver = this.props.globalState.onRefreshPreviewMeshControlComponentRequiredObservable.add(() => {
|
55353
|
+
this.forceUpdate();
|
55354
|
+
});
|
55323
55355
|
}
|
55324
55356
|
componentWillUnmount() {
|
55325
55357
|
this.props.globalState.onResetRequiredObservable.remove(this._onResetRequiredObserver);
|
55358
|
+
this.props.globalState.onDropEventReceivedObservable.remove(this._onDropEventObserver);
|
55359
|
+
this.props.globalState.onRefreshPreviewMeshControlComponentRequiredObservable.remove(this._onRefreshPreviewMeshControlComponentRequiredObserver);
|
55326
55360
|
}
|
55327
55361
|
changeMeshType(newOne) {
|
55328
55362
|
if (this.props.globalState.previewType === newOne) {
|
@@ -55334,13 +55368,13 @@ class PreviewMeshControlComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
|
|
55334
55368
|
this.forceUpdate();
|
55335
55369
|
}
|
55336
55370
|
useCustomMesh(evt) {
|
55337
|
-
const files = evt.target.files;
|
55371
|
+
const files = evt.target?.files || evt.dataTransfer?.files;
|
55338
55372
|
if (files && files.length) {
|
55339
55373
|
const file = files[0];
|
55340
55374
|
this.props.globalState.previewFile = file;
|
55341
55375
|
this.props.globalState.previewType = _previewType__WEBPACK_IMPORTED_MODULE_3__.PreviewType.Custom;
|
55376
|
+
this.props.globalState.listOfCustomPreviewFiles = [...files];
|
55342
55377
|
this.props.globalState.onPreviewCommandActivated.notifyObservers(false);
|
55343
|
-
this.props.globalState.listOfCustomPreviewFiles = [file];
|
55344
55378
|
this.forceUpdate();
|
55345
55379
|
}
|
55346
55380
|
if (this._filePickerRef.current) {
|
@@ -55396,7 +55430,7 @@ class PreviewMeshControlComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
|
|
55396
55430
|
});
|
55397
55431
|
}
|
55398
55432
|
const options = this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Particle ? particleTypeOptions : meshTypeOptions;
|
55399
|
-
const accept = this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Particle ? ".json" : "
|
55433
|
+
const accept = this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Particle ? ".json" : ".*";
|
55400
55434
|
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { id: "preview-mesh-bar", children: [(this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Material || this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Particle) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_8__.OptionsLineComponent, { label: "", options: options, target: this.props.globalState, propertyName: "previewType", noDirectUpdate: true, onSelect: (value) => {
|
55401
55435
|
if (value !== _previewType__WEBPACK_IMPORTED_MODULE_3__.PreviewType.Custom + 1) {
|
55402
55436
|
this.changeMeshType(value);
|
@@ -55406,7 +55440,7 @@ class PreviewMeshControlComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
|
|
55406
55440
|
}
|
55407
55441
|
} }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { style: {
|
55408
55442
|
display: "none",
|
55409
|
-
}, title: "Preview with a custom mesh", children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { ref: this._filePickerRef, id: "file-picker", type: "file", onChange: (evt) => this.useCustomMesh(evt), accept: accept }) })] })), this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Material && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { title: "Turn-table animation", onClick: () => this.changeAnimation(), className: "button", id: "play-button", children: this.props.globalState.rotatePreview ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_pauseIcon_svg__WEBPACK_IMPORTED_MODULE_6__, alt: "" }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_playIcon_svg__WEBPACK_IMPORTED_MODULE_7__, alt: "" }) }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { id: "color-picker-button", title: "Background color", className: "button align", onClick: (_) => this.changeBackgroundClick(), children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_colorPicker_svg__WEBPACK_IMPORTED_MODULE_5__, alt: "", id: "color-picker-image" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { ref: this._colorInputRef, id: "color-picker", type: "color", value: this.props.globalState.backgroundColor.toHexString().slice(0, 7), onChange: (evt) => this.changeBackground(evt.target.value) })] })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { title: "Open preview in new window", id: "preview-new-window", onClick: () => this.onPopUp(), className: "button", children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_popOut_svg__WEBPACK_IMPORTED_MODULE_4__, alt: "" }) })] }));
|
55443
|
+
}, title: "Preview with a custom mesh", children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { ref: this._filePickerRef, multiple: true, id: "file-picker", type: "file", onChange: (evt) => this.useCustomMesh(evt), accept: accept }) })] })), this.props.globalState.mode === core_Maths_math_color__WEBPACK_IMPORTED_MODULE_2__.NodeMaterialModes.Material && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { title: "Turn-table animation", onClick: () => this.changeAnimation(), className: "button", id: "play-button", children: this.props.globalState.rotatePreview ? (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_pauseIcon_svg__WEBPACK_IMPORTED_MODULE_6__, alt: "" }) : (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_playIcon_svg__WEBPACK_IMPORTED_MODULE_7__, alt: "" }) }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { id: "color-picker-button", title: "Background color", className: "button align", onClick: (_) => this.changeBackgroundClick(), children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_colorPicker_svg__WEBPACK_IMPORTED_MODULE_5__, alt: "", id: "color-picker-image" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { ref: this._colorInputRef, id: "color-picker", type: "color", value: this.props.globalState.backgroundColor.toHexString().slice(0, 7), onChange: (evt) => this.changeBackground(evt.target.value) })] })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { title: "Open preview in new window", id: "preview-new-window", onClick: () => this.onPopUp(), className: "button", children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: _svgs_popOut_svg__WEBPACK_IMPORTED_MODULE_4__, alt: "" }) })] }));
|
55410
55444
|
}
|
55411
55445
|
}
|
55412
55446
|
|
@@ -56140,10 +56174,12 @@ class GlobalState {
|
|
56140
56174
|
this.onAnimationCommandActivated = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
|
56141
56175
|
this.onImportFrameObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
|
56142
56176
|
this.onPopupClosedObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
|
56177
|
+
this.onDropEventReceivedObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
|
56143
56178
|
this.particleSystemBlendMode = core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.ParticleSystem.BLENDMODE_ONEONE;
|
56144
56179
|
this.listOfCustomPreviewFiles = [];
|
56145
56180
|
this.lockObject = new shared_ui_components_tabs_propertyGrids_lockObject__WEBPACK_IMPORTED_MODULE_4__.LockObject();
|
56146
56181
|
this.pointerOverCanvas = false;
|
56182
|
+
this.onRefreshPreviewMeshControlComponentRequiredObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
|
56147
56183
|
this.previewType = core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataStorage.ReadNumber("PreviewType", _components_preview_previewType__WEBPACK_IMPORTED_MODULE_1__.PreviewType.Box);
|
56148
56184
|
this.backFaceCulling = core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataStorage.ReadBoolean("BackFaceCulling", true);
|
56149
56185
|
this.depthPrePass = core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataStorage.ReadBoolean("DepthPrePass", false);
|