diff --git a/devtool/gatsby-mdx-plugin/package.json b/devtool/gatsby-mdx-plugin/package.json index 13d432f7..538dd2a6 100644 --- a/devtool/gatsby-mdx-plugin/package.json +++ b/devtool/gatsby-mdx-plugin/package.json @@ -23,7 +23,7 @@ "unist-util-visit": "^2.0" }, "peerDependencies": { - "gatsby": "^4.0" + "gatsby": "4.x" }, "devDependencies": { "@types/node": "^17.0.8", diff --git a/package.json b/package.json index b5b1d781..a35e262c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "typescript": ">=4.6.2" }, "engines": { - "node": ">=16.0.0 <17.0.0", + "node": ">=16.0.0", "npm": ">=8.0.0" }, "lint-staged": { diff --git a/packages/react-babylonjs/package.json b/packages/react-babylonjs/package.json index 85c10afb..d6c23d64 100644 --- a/packages/react-babylonjs/package.json +++ b/packages/react-babylonjs/package.json @@ -46,8 +46,8 @@ "test:coverage": "c8 --reporter=lcov --reporter=text-summary npm run test" }, "devDependencies": { - "@babylonjs/core": "^6.0.0", - "@babylonjs/gui": "^6.0.0", + "@babylonjs/core": "^6.3.1", + "@babylonjs/gui": "^6.3.1", "@rollup/plugin-json": "^4.0.2", "@rollup/plugin-replace": "^3.0.0", "@types/lodash.camelcase": "^4.3.6", diff --git a/packages/react-babylonjs/src/customHosts/AdvancedDynamicTextureLifecycleListener.ts b/packages/react-babylonjs/src/customHosts/AdvancedDynamicTextureLifecycleListener.ts index 0dd998f9..dd1a12f0 100644 --- a/packages/react-babylonjs/src/customHosts/AdvancedDynamicTextureLifecycleListener.ts +++ b/packages/react-babylonjs/src/customHosts/AdvancedDynamicTextureLifecycleListener.ts @@ -2,7 +2,8 @@ import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial.js' import { Color3 } from '@babylonjs/core/Maths/math.color.js' import { Mesh } from '@babylonjs/core/Meshes/mesh.js' import { AdvancedDynamicTexture } from '@babylonjs/gui/2D/advancedDynamicTexture.js' -import { Grid } from '@babylonjs/gui/2D/controls/grid' +import { Grid } from '@babylonjs/gui/2D/controls/grid.js' +import { Nullable } from '@babylonjs/core/types.js' import { CreatedInstance } from '../CreatedInstance' import { ADTCustomProps, VirtualKeyboardCustomProps } from '../CustomProps' import { FiberAdvancedDynamicTextureProps } from '../generatedProps' @@ -12,6 +13,14 @@ export default class AdvancedDynamicTextureLifecycleListener extends BaseLifecyc AdvancedDynamicTexture, FiberAdvancedDynamicTextureProps > { + private materialRef: Nullable = null + + onUnmount(): void { + if (this.materialRef !== null) { + this.materialRef.dispose() + } + } + onMount(instance: CreatedInstance): void { instance.state = { added: true } // allow children to attach this.addControls(instance) @@ -22,7 +31,10 @@ export default class AdvancedDynamicTextureLifecycleListener extends BaseLifecyc const mesh: Mesh = instance.parent!.hostInstance // should crawl parent hierarchy for a mesh // console.error('we will be attaching the mesh:', mesh.name, mesh); - const material = new StandardMaterial('AdvancedDynamicTextureMaterial', mesh.getScene()) + const material = (this.materialRef = new StandardMaterial( + 'AdvancedDynamicTextureMaterial', + mesh.getScene() + )) material.backFaceCulling = false material.diffuseColor = Color3.Black() material.specularColor = Color3.Black() diff --git a/packages/static/content/examples/gui/2d-gui/2DGUI.tsx b/packages/static/content/examples/gui/2d-gui/2DGUI.tsx index e0a6e386..de48318a 100644 --- a/packages/static/content/examples/gui/2d-gui/2DGUI.tsx +++ b/packages/static/content/examples/gui/2d-gui/2DGUI.tsx @@ -9,6 +9,12 @@ import { AbstractMesh } from '@babylonjs/core/Meshes/abstractMesh' import { Camera, Texture } from '@babylonjs/core' import { Control } from '@babylonjs/gui/2D/controls/control' +// https://github.com/sebavan/BabylonjsInkSample/blob/master/src/debug/appDebug.ts +// To get inspector to load +// import "@babylonjs/core/Legacy/legacy"; +// import "@babylonjs/core/Debug/debugLayer"; +// import "@babylonjs/inspector"; + const DEFAULT_BOXES = [ { name: 'red', @@ -30,6 +36,19 @@ const DEFAULT_BOXES = [ }, ] +// const Inspector = () => { +// const scene = useScene(); +// useEffect(() => { +// if (scene) { +// scene.debugLayer.show(); +// } else { +// console.log('no scene') +// } +// }, []) + +// return null; +// }; + const UIComponent: FC = () => { const plane = useRef(undefined) const [showModal, setShowModal] = useState(false) @@ -302,6 +321,7 @@ const UIComponent: FC = () => { webVROptions={{ createDeviceOrientationCamera: false }} enableInteractions /> + {/* */} ) diff --git a/packages/static/gatsby-config.js b/packages/static/gatsby-config.js index bef77e74..7c2ecec3 100755 --- a/packages/static/gatsby-config.js +++ b/packages/static/gatsby-config.js @@ -131,12 +131,8 @@ if (config.pwa && config.pwa.enabled && config.pwa.manifest) { plugins.push('gatsby-plugin-remove-serviceworker') } -// check and remove trailing slash -if (config.gatsby && !config.gatsby.trailingSlash) { - plugins.push('gatsby-plugin-remove-trailing-slashes') -} - module.exports = { + trailingSlash: 'always', pathPrefix: config.gatsby.pathPrefix, siteMetadata: { title: config.siteMetadata.title, diff --git a/packages/static/gatsby-node.js b/packages/static/gatsby-node.js index f964ce97..cfaf567a 100644 --- a/packages/static/gatsby-node.js +++ b/packages/static/gatsby-node.js @@ -53,8 +53,19 @@ exports.createPages = ({ graphql, actions }) => { }) } -exports.onCreateWebpackConfig = ({ actions }) => { +/** + * @babylonjs/inspector -> Reference error: document is not defined for "babylon.inspector.bundle.max.js" + */ +exports.onCreateWebpackConfig = ({ actions, loaders }) => { actions.setWebpackConfig({ + module: { + rules: [ + { + test: /babylon\.inspector/, + use: loaders.null(), + }, + ], + }, resolve: { modules: [path.resolve(__dirname, 'src'), 'node_modules'], alias: { diff --git a/packages/static/package.json b/packages/static/package.json index 30b47709..92d5ff48 100755 --- a/packages/static/package.json +++ b/packages/static/package.json @@ -5,11 +5,14 @@ "version": "0.0.1", "dependencies": { "@babel/plugin-proposal-export-default-from": "^7.12.13", - "@babylonjs/core": "^5.41.0", - "@babylonjs/gui": "^5.41.0", - "@babylonjs/loaders": "^5.41.0", - "@babylonjs/materials": "^5.41.0", - "@babylonjs/procedural-textures": "^5.42.0", + "@babylonjs/core": "^6.3.1", + "@babylonjs/gui": "^6.3.1", + "@babylonjs/gui-editor": "^6.3.1", + "@babylonjs/inspector": "^6.3.1", + "@babylonjs/loaders": "^6.3.1", + "@babylonjs/materials": "^6.3.1", + "@babylonjs/procedural-textures": "^6.3.1", + "@babylonjs/serializers": "^6.3.1", "@devtool/gatsby-mdx-plugin": "*", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", @@ -96,7 +99,6 @@ "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.23.2", - "gatsby-plugin-remove-trailing-slashes": "^3.4.0", "prettier": "^2.6.1", "prettier-plugin-organize-imports": "^2.3.4", "prism-react-renderer": "^1.2.0",