Deserialization error when using VectorMergerBlock in NME


I just had a weird problem when loading a node material from a json file saved with the current version of NME. I get an deserialization error. It was on an existing material (created in a previous version of NME) that I have been using successfully and then I made a small change and saved from the current NME and it no longer worked. I compared the file to the previous version in my source control and worked out it was these lines that were added to the inputs of a VectorMerger block that caused the problem.

      "isExposedOnFrame": true,
      "exposedPortPosition": -1

I am not sure how to reproduce this anywhere. Is it possible to choose the version of NME that you are using like you can choose the engine in the playground?

Adding @msDestiny14 as it seems related to frames.

No, there’s no versionning for the NME, there’s only the latest version.

Just a couple of questions to help me track this down. Was the input block in a frame or just by itself? If you have the json for the node material I’d love to take a look at it.

This may be tricky without a repro as well.

Thanks for the replies. It happened in two materials, I think they were both inside a frame but one of them had one of its inputs from outside the frame. I will do some more testing around that but in the meantime I will attach one of the json files here … (3.5 KB)

The offending VectorMergerBlock is in the VS Frame.

This file was saved in the current version but then I manually edited it to remove the lines I mentioned that were preventing it from deserializing. I will try soon to provide a clean one as saved by current version after a meeting now.

Mine loads. :confused:

I also tried creating more frames with the same block. There are cases where it will have it serialized to those the lines you provided and that should be fine. Unless I’m misunderstanding? The one you sent was the broken json?

Ah sorry I wasn’t clear as I was rushing, I have more time now.

The error comes not when I load in NME (which works fine) but when I load it in my app via:
import GWMaterial from ‘…/assets/GW-Material-bad.json’;
NodeMaterial.Parse(GWMaterial, scene);

This is in an app using node modules and BJS version 4.2.0

The file I previously sent was a working version, the file attached to this reply is the result when I load that file in NME then save it with no changes. This one fails to load via NodeMaterial.Parse (3.5 KB)

Alright! Aha.I got to the bottom of this. The reason it is failing to load is the version of BJS. Setting it to the latest fixes it. The older version does not have the feature that NME is exporting. I believe this was a decision that using a newer feature NME (frames) would require to also use the latest version of BJS. Now having an older node material will not break on the newer version of BJS.

I will pass this along and see what can be done about this, if anything. My recommendation would either be to remove the line which you did or update the app to latest.

1 Like

Ah, I see thank you. I was not wanting to update the version as it is alpha. Would it be possible to have a version selector on the NME? As it is I will need to be cautious when using it.