How to set object (mesh) to active in Blender 2.8 Python API

To set mesh (object) as active in Blender 2.8 Python API the “context.view_layer” is used instead of “context.scene”.

When trying to make object active with “bpy.context.scene.objects.active” Blender throws an error:

AttributeError: bpy_prop_collection: attribute “active” not found

To make object active in Blender 2.8 use the following code:

 

Selecting objects (meshes) in Blender 2.8 Python API

According to Blender 2.8 Python API changes mesh (object) can be selected with using getters and setters.

When trying to check the selected status of the mesh through the “bpy.context.active_object.select” property, Blender throws an error:

AttributeError: ‘Object’ object has no attribute ‘select’

To check whether an object is selected in Blender 2.8 use a getter:

To select an object in Blender 2.8 use a setter:

To unselect an object use the same setter:

 

How to check what version of Python interpreter is used in Blender

To find what Python interpreter version is used in current Blender version type the following commands in Python Console window in Blender:

It means that the version of Python used in Blender is 3.7.0.

To make it more readable type the following command:

or with full info:

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:

Blender icons

Blender logo in three different colors (white, red and green) on a transparent background in the “ico” format for desktop shortcuts.

With multi-colored icons, it is very convenient to distinguish installed Blender 2.7 and 2.8 versions.

By Dmitry Sushkov and Victor Mukaev.

BIS add-on for Blender 2.8

BIS (Blender Interplanety Storage) add-on is ported to Blender 2.8

The add-on branch for Blender 2.7 is fixed on the number 1.5. The master release for Blender 2.8 has version number 1.6 and higher in future development.

For both add-on versions the same library is used, so all BIS materials are available for all add-on versions, however, please note, materials made for Blender 2.8 may not look correct in Blender 2.7 and backward.

Now the download consists of two archives to install the add-on:

  • bis_2_7.zip – for Blender 2.7
  • BIS.zip – for Blender 2.8