Porting add-on from Blender 2.7 to Blender 2.8

In the latest version 2.8 of Blender developers have made many changes in API, so all the scripts and add-ons written for earlier Blender versions (2.7 and below) have stopped working. To run your add-ons in the new Blender 2.8, you need to port them – correct their code to work properly with the new Blender API.

To enable your add-on in Blender 2.80 you have to make the following changes in code:

  1. Blender 2.7 and below uses the Python interpreter version 3.5.3 and below. Blender 2.8 uses Python version 3.7.0. Add-on developers should upgrade the Python interpreter installed in the system to appropriate version.
  2. In the initialization add-on section – in the __init__.py file or in the add-on header in the “bl_info” dictionary, you must specify the Blender version 2.80. All developers must do that change. Add-ons with the lower version will not start in Blender 2.8 and it throws an exception:

Add-on … has not been upgraded to 2.8, ignoring

The correct code looks like this:


  1. If there are operators with defined properties (parameters) in the add-on code, their initialization should be described not with the “=” sign, but with the “:”. This is due to the Python PEP8 specification, which Blender follows. This affects all developers.

If these changes are not made, Blender throws an error when calling such an operator:

class .. contains a properties which should be an annotation!

Sample code with the correctly defined property of an operator:


  1. The T-panel in Blender 2.8 is no longer used to host the user interface (UI). If there is an interface located in the T-panels in the add-on, Blender throws an error:

Registering panel class … has category

Now the user interface is located in the N-panel, so in the user panel class in the “bl_region_type” parameter, instead of “TOOLS”, you must specify the “UI” value.

A right code example:


  1. When calling functions with parameters, in Blender 2.8 you cannot specify unnamed parameters. The arguments to the function must be passed as “argument_name = argument_value”. This change affects all developers. The reason again in the following the PEP specification.

If a function is called without specifying a named argument, Blender throws an error:

… operator (): required parameter “…” to be a keyword argument!

The correct parameter specifying example (“text=” required):


  1. In Blender 2.8 you can no longer get the active scene from the “bpy.context.screen.scene”. When trying such a call, Blender throws an error:

AttributeError: ‘screen’ object has no attribute ‘scene’

Now the active scene is enabled through the “window” object.

An example of the right active scene access:


  1. The active object in Blender 2.8 can be accessed only through the context, it is no longer possible to access it through the “scene.objects.active”. This is due to the introduction of collections.

When trying to access the active object through the scene object, Blender throws an error:

AttributeError: ‘bpy_prop_collection’ object has no attribute ‘active’

Accessing the active mesh:


  1. Lamps in Blender 2.8 now have the ‘LIGHT’ type and in the bpy.data section are placed in the “lights” list.

When trying to access the lights list through the “bpy.data.lamps” Blender throws an error:

AttributeError: ‘BlendData’ object has no attribute ‘lamps’

An example of proper access lights:


  1. Access to the user properties is changed from “user_preferences” to “preferences”.

When trying to access user preferences through the “bpy.context.user_preferences”, Blender throws an error:

AttributeError: ‘Context’ object has no attribute ‘user_preferences’

An example of proper access to user preferences:


  1. Internal icons in Blender 2.8 have been reworked – some icons have been removed, some have been added, some have changed their identifier.

When using icons with incorrect identifiers in operator calls, for example,

Blender throws an error:

TypeError: UILayout.operator (): Error with keyword “enum” – enum “ZOOM” not found in {…

To check the right icons identifiers, you can use the built-in “Icon Viewer” add-on.

  1. From the events available for handling from the add-on, removed the scene update events “scene_update_post” and “scene_update_pre”, and now it is impossible registering user handlers for these events in Blender 2.8. Now it is impossible to call user-defined functions when the scene is updating.

When trying to add a handler for a scene update event, Blender throws an error:

AttributeError: ‘bpy.app_handlers’ object has no attribute ‘scene_update_post’

As a result, the opportunity to bypass an “ACCESS VIOLATION” error in some types of batch operations was lost. For example, in a batch renderer, the render from the next camera could not be called immediately after the finishing previous camera rendering – Blender crashes, but it could be called after updating the scene – no error occurred.

One of the possible solutions is to use timers instead of handling the scene update events, but this solution is not so beautiful.

An example of using a timer to call the next render, after the previous one is completed:


0 0 votes
Article Rating
Notify of
0 Comment
Inline Feedbacks
View all comments