PBRMaterial clone has stopped working in my scene just now (or a few hours ago)

Dears, I was working on my scene this morning linked to preview.
When I came back on it just now, I got this error. I checked older version and get the same error.
It appears all my clones of class PBRMaterial are now generating this error
Checked on chrome and safari Mac.
Did you just merge something that could cause this? It was working fine 2 hours ago.

Having a look now, could come from the PR I did about cloning material plugins…

1 Like

It seems the problem involves cube textures, but I can’t reproduce:

What do you mean by “older version”? Older Babylon.js versions?

If you can narrow the problem it would help a lot!

Or, are you able to provide a link (even outside the playground) that we could use to debug?

Sry, no. Just an older version of my scene to make sure I didn’t mess up something with the materials.

Well, I just tried on never rig and os version and everything is fine. So it looks like it’s related only to my relic of a macpro (10.11.6). Might be hard to reproduce (unless you also have the same relic :wink: Point is I didn’t make any updates nor anything so it’s kind of strange. I guess I’m gonna try restart the system see if it changes anything…

EDIT: Huh! :thinking: Just restarted the system and the problem has gone. You’re gonna think I’m fool, but I did clean the cache restart the browser and even launch another browser on which I never loaded the scene and got this error. Something just very persistent must have occured. Black MAC magic I suppose. Looks like it’s fine now. Sorry for the disturbance and have a great day :sunglasses:

I’m relieved it seems there’s no bug :slight_smile:

Your stacktrace looked very strange, I don’t know how we could end up in AnimationRange from DetailMapConfiguration.parse

As I said, black MAC magic :imp: Not as if we never experienced it before. I should have double or triple-checked before posting. My bad :zipper_mouth_face: Again, my apologies for the additional stress. I will try to be more careful before posting in the future (can’t promise though :grin: :wink:)

@Evgeni_Popov You wouldn’t believe it, but I have to revive this topic.
I don’t know by what magic it has been working for a time yesterday, but this morning without making any changes, it bugs again :thinking: :dizzy_face:
However, this time it does the same on windows and macOS and I multiple checked it all.
Better than that, I have been able to repro it in this PG.

I’m doing the same cloning using this prefiltered cloned env texture on both a class PBRMetallic and PBRMaterial. Where the metallic or standard class has no issue, the cloning of PBRMaterial throws the error (uncomment these in PG).

I hope you’ll find an explanation for it?
Sorry for the new bother.

Thanks for the repro!

In fact, it’s not a bug with plugins but with CubeTexture serialization.

I was able to reproduce the problem with a simple PG :

The bug stems from the name property being overwritten. In the case of CubeTexture it’s possible to fix it, so here’s the PR :

But for other textures, overwriting the name property won’t work if the texture is serialized at some point. This is because, for historical reasons, name stores the texture’s url, so putting something other than a url will fail at parsing time.

Note that CubeTexture.CreateFromPrefilteredData and Color3.FromHexString are static, so you shouldn’t use the new keyword with them.

Wow, thanks a lot. Looks like I learned something new from you, just once more :hugs: I knew my method might not have been the most conventional :grinning: but I was worried because it was working until now. Thanks also for the PR and have a great day :sunglasses:

EDIT: Yup, confirm it’s all good. Don’t know why I had that. It’s useless anyways. Must be the remains of an old project I used as a base for my mats. I guess at least it helped me understanding a few things.
Thanks again for your efforts and support. :smiling_face_with_three_hearts: