Node Material Editor (Code Export for 4.0.2)

Hey everyone,

I’m looking to include procedural textures I built using the Node Material Editor into my current project, but TypeScript is throwing me errors saying certain properties and methods don’t exist – which is probably a revision control problem. I’d be happy to update @babylonjs/core to 5.0.0, but there doesn’t seem to be any declaration files included; so I’m wondering if a version of the Node Material Editor exists for 4.0.2 or if there’s a way to get access to new declaration files.

Thanks in advance :smiley:

This is strange the declaration files should be in the package.

Could you detail a bit what you are using and how or even a repro ?

I might have solved it; originally I copied “npm i @babylonjs/core@preview” from your documentation and that’s where I ran into the issue, but “npm i @babylonjs/core@5.0.0-alpha.25” from the NPM site seemed to have included it!

our preview should be @babylonjs/core - npm you could try npm i @babylonjs/core@5.0.0-alpha.63

Must’ve installed incorrectly the first time, because everything seems to be in order now. Thanks!

1 Like

While I’m here, almost all of the errors have been thrown but this one generated by the Node Material is puzzling:
Cannot find name ‘r’. Cannot find name ‘g’. Cannot find name ‘b’. Cannot find name ‘a’.
ColorMerger.rSwizzle = r};
ColorMerger.gSwizzle = g};
ColorMerger.bSwizzle = b};
ColorMerger.aSwizzle = a};

Should I just convert them to strings? This is how they were exported.

This is impossible to troubleshoot without a repro :frowning: could you create one in the playground

Hey @sebavan, I’ve generated a playground example to show the issue I’m still having; essentially I thought the “incompatible material mode” console.log might have been related to TypeScript tree shaking or Node Material code generated that was clashing with my version of BabylonJS (4.0.2), however I’m still having the same problem. Link: https://playground.babylonjs.com/#3ZJYU8#1

You need to set your material in procedural mode and set your light appropriately: https://playground.babylonjs.com/#3ZJYU8#4

That was it! Thanks :smiley: