To anyone also trying to develop a plugin with 2 views:
nallath and I discovered and fixed a small bug in Uranium that caused the previous problems.
Since Cura 4.12 beta is already out, I guess the solution is to wait for Cura 4.13 (unless the fix is included in the release version of 4.12).
With this fix, Views can be hidden from the dropdown in Preview Stage with the 'visible' metadata as nallath said in the 1st answer.
-
1
Recommended Posts
nallath 1,104
_populateMetadata is being called in the pluginRegistry. It's used in "getMetaData" and in "loadPlugin"
I don't know what you did in your code, so i can't really help out entirely with what is going on. If you have a public repo somewhere, I could have a look.
You could have a look at the https://github.com/tetonsim/is-cura-ui/blob/master/SmartSlicePlugin/ if i recall correctly, they also use multiple views.
Link to post
Share on other sites
Tyronnosaurus 7
I can only find one view. Maybe they had 2 in the past but I haven't found anything in past versions.
I saw this in Uranium's source code, but still wasn't sure if it was getMetadata() or loadPlugin() that was doing the calling, and how was plugin_id generated in _populateMetaData(self, plugin_id: str).
In any case, I've found something that may be a possible bug:
I managed to run Cura from source, and added some code in Uranium to see all the stack of function calls when _populateMetaData() is called, from deepest to highest:
The 3rd deepest function is ViewModel.update().
Note how it only accounts for Views that have been automatically assigned the same name as the plugin. If a view is named as PluginName_ViewName, it will not be found because there's no such plugin by that name:
Edit: if I change it like this, everything works:
nallath, do you think I should report the issue on Github?Nvm, posted it.In the meantime, do you think there's any way to bypass this problem with code in the plugin, rather than modifying Uranium?
Posted issue on Github
Link to post
Share on other sites