0
$\begingroup$

I noticed that Blender doesn't call register() on my addon when my bl_info specifies "blender" : (2, 78, 0), but if I change to (2, 80, 0), then register() is called.

Here is a minimal version of the __init__.py:

bl_info = {
    "name": "My Str Test Add-on",
    "location": "View3D > Sidebar > MelPropHelper",
    # "blender": (2, 80, 0), # toggle un-comment and blender does call register()
    "blender": (2, 78, 0),
    "category": "3D View", 
}

def register():
    print(F"welcome to register") # will not print when 2, 78 is specified
 
def unregister():
    print(F"welcome to unregister") # will not print when 2, 78 is specified

Here's a sample output to the console with 2, 78:

Modules Installed (stripped-addon) from 'E:\\temp\\ble-zip-import-test\\bb_zip_import_me\\bb72.zip' into 'C:\\Users\\my_user\\AppData\\Roaming\\Blender Foundation\\Blender\\3.2\\scripts\\addons'

And after clicking the check box

module changed on disk: 'C:\\Users\\my_user_name\\AppData\\Roaming\\Blender Foundation\\Blender\\3.2\\scripts\\addons\\stripped-addon\\__init__.py' reloading...

And after unclicking the check box:

addon_utils.disable: stripped-addon not loaded

Here's the output with 2,80

Modules Installed (stripped-addon) from 'E:\\temp\\ble-zip-import-test\\bb_zip_import_me\\bb72.zip' into 'C:\\Users\\my_user\\AppData\\Roaming\\Blender Foundation\\Blender\\3.2\\scripts\\addons'

After clicking the check box

module changed on disk: 'C:\\Users\\my_user\\AppData\\Roaming\\Blender Foundation\\Blender\\3.2\\scripts\\addons\\stripped-addon\\__init__.py' reloading...
welcome to register bb

After unclicking the check box

welcome to unregister

Tested on Blender 3.2.1 Is there an explanation for this?

$\endgroup$

1 Answer 1

1
$\begingroup$

I can't tell exactly why, but I have a hunch that it's probably because of the several API "breaking" changes and compatibility handling that are done since 2.80.

When 2.80 came out, all addons had to be updated to the new API to even be allowed to run.

See in Reference/Release Notes/2.80/Python API/Addons - Blender Developer Wiki we can read:

Make sure the "blender" key in the bl_info dictionary is set to:
(2, 80, 0) not (2, 8, 0) or (2, 79, 0)

Example: "blender": (2, 80, 0),

Otherwise, this error is reported:

Exception: Add-on 'ADDON_NAME' has not been upgraded to 2.8, ignoring

I guess you would have that issue with any version number prior to 2.80.0.

The page details other things that changed from v2.80, like registration. But overall, many breaking changes happened in the API since 2.80, and can happen at any new version. So I wouldn't expect to be able to make a 2.78 addon that works in newer versions. Nor would I expect to make an addon using v3.2's API that works with 2.78.

Keeping track of API changes

I'll just quote this post from testure:

The most recent Python API changes are always listed in the api documentation, and are generated automatically:
https://docs.blender.org/api/current/change_log.html

A historical record of changes can be found on the wiki, but since these are hand-made docs there’s more chance for something not making it into the notes: Reference/Release Notes - Blender Developer Wiki

That said, it’s worth noting that 2.93.6 to 3.3.1 is a pretty big jump- any time you wait this long to update your scripts you should expect there to be a lot of breaking changes that will need to be updated. So many versions have passed that it would be a pretty difficult task to track down each version that changed it, etc.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .