Important API changes in 1.22.4

Posted by Miss 3 months ago

Developer

Important API changes in 1.22.4

Openplanet 1.22.4 was released yesterday, and there are some important changes in the API that you might want to pay attention to.

Optional dependencies

It's now possible to make optional dependencies using the optional_dependencies key. When any optional dependency is loaded, a new preprocessor definition specifically for that plugin will be defined. The documentation has also been updated to cover this.

New VehicleState dependency

Openplanet now ships with a new dependency plugin called VehicleState. You can use this to get the currently viewed vehicle state. This code was moved away from Dashboard into its own dependency so everyone can use that functionality.

Empty ID's in UI are now invalid

First of all, ImGui has made a debug effort to fix common issues, which includes passing empty strings as labels to UI widgets. This means that stuff like UI::Checkbox("", foo); is now invalid, and you should use ## instead, like so: UI::Checkbox("##Foo", foo); (where "Foo" is an ID) Basically, empty ID's are now explicitly invalid in ImGui!

Make sure you make this change in your plugins, so that users don't see random failed assertions in their notifications and logs when they interact with your UI. This regex might help you find any occurrences in your code: UI::.*\("" (don't rely on this to be 100% correct though.)

String split now works as expected

Previously, string::split() would return only 3 items for the string a;b;c;. This was fixed to properly return the expected 4th empty string as well. I don't know if anyone relied on this broken behavior in some way, but it's probably worth mentioning.

This post was written by Miss