Cesium3DTileFeature.setProperty stopped working in 1.97

Hi, I have added a short sandcastle here where I add a simple text property to each loaded feature (“additionalProp”). Right after I added it, it’s not possible to read it via feature.getProperty("additionalProp"). The ref-doc says to setProperty(): “If a property with the given name doesn’t exist, it is created.” getProperty() should return the value of the property. In Version 1.96 it still worked. In my app I loaded the additional props in this way and with a click on the feature these properties could be identified. Or does this work in a different way now?

Hi @mholthausen, thanks for bringing this to our attention!

I tried your sandcastle and determined that this is a bug. I opened this issue in GitHub with more details.

1 Like

Hi again @mholthausen,

I fixed this today in this PR: fix `feature.setProperty()` to create a new property if it doesn't already exist by ptrgags · Pull Request #10775 · CesiumGS/cesium · GitHub. It’s already merged in main, and will be available in the 1.98 release in October.

1 Like

Thank you very much!

Hi @ptrgags after version 1.98.1 was released, i tried it again, as well as in the sandcastle example mentioned in my first post. But i cant make it work. The previously added property seems still be undefined, when I try to log it.

Hi @mholthausen,

Huh, when I run your example with a local Sandcastle it works fine. This is literally the same code copied into a local sandcastle

But when I run it on the hosted Sandcastle I can reproduce your undefined issue:

So something wasn’t quite right with the released version. I’ll continue to investigate what’s different.

@mholthausen

I looked into this a bit more. The copy of Cesium hosted for sandcastle.cesium.com is somehow out of sync with the latest main. I let the team know, and they said they’ll be looking into redeploying the website soon to fix this.

Outside of Sandcastle, were you using the 1.98.1 release anywhere? e.g. installing through npm?. I tried installing that and that has the correct code for this fix.

Thanks @ptrgags. Yes, outside of the Sandcastle Cesium is installed via npm. But I will check this as soon as possible again.

@ptrgags I have checked the sandcastle again and it works now. I also deleted node_modules folder locally and installed Cesium 1.98.1 again and it seems to work in my project as well! Thanks for your support!

1 Like