Blender 3D
Changes in add-ons registration through the API in Blender 2.8
Add-on registration and removing were made with the “Window manager” (wm) in Blender 2.7 Python API:
1 2 3 4 5 |
bpy.ops.wm.addon_install(filepath='_path_to_addon', overwrite=True) bpy.ops.wm.addon_enable(module='addon_name') bpy.ops.wm.addon_remove(module='addon_name') |
In Blender 2.8 API add-on operators moved to the “preferences”:
1 2 3 4 5 |
bpy.ops.preferences.addon_install(filepath='_path_to_addon', overwrite=True) bpy.ops.preferences.addon_enable(module='addon_name') bpy.ops.preferences.addon_remove(module='addon_name') |
3D Cursor location in Blender 2.8 Python API
3D-cursor location property
1 |
context.scene.cursor_location |
in Blender 2.8 API moved to “cursor” object
1 |
context.scene.cursor.location |
When trying to get the cursor location through the “context.scene.cursor_location” Blender throws an error:
‘Scene’ object has no attribute ‘cursor_location’
Add-on preferences panel
When developing add-ons it is often necessary to give an ability to set a number of parameters that affect the whole add-on work to the user. For example, the user can specify a directory for saving/loading files, set some default variables or switch between add-on modes. Of course, the interface for setting such parameters can be placed in the add-on panel, but it is better to place it in a separate add-on preferences panel, which is located in the “Preferences” window under the add-on installation panel.
The main advantage of the add-on preferences is that they don’t reset when Blender restarts. The user does not need to configure the add-on preferences each time, it’s enough to set the necessary parameters once, personalizing the add-on for convenient work.
Let’s create an add-on and define a parameter, placing it in the add-on preferences panel.
Matrix, vector and quaternion multiplication in Blender 2.8 Python API
In Blender 2.7 the “*” (star) operator is used in the matrix, vector, and quaternion multiplication. In Blender 2.8 it is replaced with the “@” (at) operator.
If the “*” operator is used in vector, matrix or quaternion multiplication in Blender 2.8 it throws an error:
Element-wise multiplication: not supported between ‘Matrix’ and ‘Matrix’ types
Proper use of the “@” operator:
1 |
bpy.context.region_data.view_rotation @ Vector((0.0, 0.0, 1.0)) |
Baroque interior in Blender EEVEE
“Baroque” style interior demonstration. Visualization made in Blender 2.8 on a new render engine EEVEE.
Autor: Paul Kotelevets (1D_Inc)
Removing delete object confirmation in Blender
When deleting objects with pressing the “x” keyboard key, Blender shows the confirmation dialog:
To delete objects immediately without confirmation:
Making a water drop and the right water shader
Making beautiful water splashes and drops and setting up a procedural water shader.
By Vitaly Sokol
Snapping elements property in Blender 2.8 Python API
The snapping elements property from Blender 2.7
1 |
bpy.context.scene.tool_settings.snap_element |
changed in Blender 2.8 API to
1 2 |
bpy.context.scene.tool_settings.snap_elements # {'EDGE'} |