diff --git a/plugins/utilities.json b/plugins/utilities.json index ad3ad27..3dde59e 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -651,6 +651,20 @@ "md5sum": "cc1738b0326c9679453bdf1489ded483" } } + }, + "allow_invisible_models": { + "description": "Changing model to None will make it invisible instead of raising an exception.", + "external_url": "", + "authors": [ + { + "name": "Rikko", + "email": "rikkolovescats@proton.me", + "discord": "Rikko#7383" + } + ], + "versions": { + "1.0.0": null + } } } -} \ No newline at end of file +} diff --git a/plugins/utilities/allow_invisible_models.py b/plugins/utilities/allow_invisible_models.py new file mode 100644 index 0000000..b2d1403 --- /dev/null +++ b/plugins/utilities/allow_invisible_models.py @@ -0,0 +1,15 @@ +# ba_meta require api 7 +import ba + +original_getmodel = ba.getmodel + + +def get_model_gracefully(model): + if model is not None: + return original_getmodel(model) + + +# ba_meta export plugin +class Main(ba.Plugin): + def on_app_running(self): + ba.getmodel = get_model_gracefully