In scripts and add-ons for importing-exporting files with formats that are not supported in Blender by default, we must give the user an ability to select files using the “FileBrowser” interface.
To open the file browser window, and after the user selects the necessary file, to return the path to it, we need to use the “ImportHelper” and the “ExportHelper” classes.
Continue reading “Using the FileBrowser interface window to opening and saving files”
To add custom mesh to the scene through the Blender Python API we need to do the following:
Open the “Text Editor” window.
Continue reading “How to create mesh through the Blender Python API”
For objects rotation, we can use the “rotation_euler” property. This property is a list of three items, each of them corresponds to the rotation angle around the X, Y, and Z-axis. The otation_euler contains the rotation angle around the X-axis, rotation_euler – around the Y-axis, and rotation_euler – around the Z-axis. To rotate an object we must set a rotation angle to the appropriate field of the property.
For example, to rotate an active object around the X-axis to the 90 degrees angle we must execute the following command:
import math bpy . context . active_object . rotation_euler [ 0 ] = math . radians ( 90 )
math.radians is used to convert degrees to radians.
The flat/smooth shading mode is regulated through the “use_smooth” property of each polygon of the mesh.
To enable smooth shading we need to set the “use_smooth” property of each mesh polygon to “True”.
For active object:
bpy . context . object . data . polygons . foreach_set ( 'use_smooth' , [ True ] * len ( bpy . context . object . data . polygons ) )
To enable flat shading – set the “use_smooth” property of each polygon to “False”.
bpy . context . object . data . polygons . foreach_set ( 'use_smooth' , [ False ] * len ( bpy . context . object . data . polygons ) )
To make new shading mode visible – force update mesh data:
bpy . context . object . data . update ( )
To switch to the view from the active camera we can execute the following command:
bpy . ops . view3d . view_camera ( )
This operator works in the toggle mode, so the next executing of the same command returns the view to the previous state.
Continue reading “Switching to the view from camera throug the python API”
To switch from a global coordinate system to a local coordinate system of an object, we need to multiply the global coordinates by the inverted matrix of an object:
object_matrix_inverted = copy . copy ( bpy . context . object . matrix_world ) object_matrix_inverted . invert ( ) cursor_location_local = object_matrix_inverted @ bpy . context . scene . cursor . location
To switch from the local coordinate system of the object to the global coordinate system, we need to multiply the local coordinates by the matrix of an object:
object_matrix = copy . copy ( bpy . context . object . matrix_world ) vertex_0 = bpy . context . object . data . vertices [ 0 ] . co vertex_0_global = object_matrix @ vertex_0
To scroll the animation in Blender without leaving the “Viewport” window – hold the Alt key and turn the mouse wheel.
This type of animation scroll works even if there is no “TimeLine” window open.
In Blender 2.8 node connectors in the “Shader Editor” window are straight by default, unlike earlier versions, where they bent curving. To return the usual connections bend, change the following settings:
Open the “Preferences” window
Switch to “Themes”
Expand the “Node Editor” tree branch
In the “Node Curving” field, set the value greater than 0. 0 means straight lines, the larger – the greater bend. A value of 4 corresponds to the bend that was in Blender 2.7x versions.
In the last Blender 2.83 version, the function to remove doubles and merge vertices is moved to the “m” key code. The “alt + m” key code, used before, now executes the “Split” functions.
Various aspects of lighting in the Blender EEVEE rendering engine tutorial.
By Brainy Man
Continue reading “Lighting basics in Blender EEVEE”
Knife Project is a powerful Blender tool for quickly cutting holes of various shapes in objects.
Continue reading “Knife Project”
In Blender 2.81 and earlier, you could see the possible code completion by pressing “ctrl + space” in the python console. This key-shot shows nothing in Blender 2.82.
Code autocompletion in the python console was not removed in 2.82, it was moved to the “
Blender add-on “
B-Presets” updated to v. 1.1.2.
Presets sorted alphabetically on load
Fixed some bugs
Interface elements in custom user panels often do not correspond to each other in size. As a result – the overall panel layout does not look beautiful. As an example, let’s create a custom panel and place an operator button and an input text field on it.
Can we make it more accurate?
Continue reading “User interface elements alignment by columns”
Blender add-on “
EEVEE Materials Override” updated to v. 1.1.0.
Added materials override for objects with no material
To make glass objects render faster and cleaner in Cycles render engine, we can adjust glass material processing by the number of beam bounces.
Continue reading “Glass shader tuning for Cycles render engine”
To get a list of collections with all internal collections, we can use the following function:
def collections ( collection , col_list ) : col_list . append ( collection ) for sub_collection in collection . children : collections ( sub_collection , col_list )
Continue reading “How to get all collectons list”
In Blender 2.82 we can get a random index of UV islands in the Shader Editor through the “Geometry” node
Works only for the “Cycles’ render engine.
Some times we need to make a render of the scene with the single material, for example, for clay or wireframe renders. Blender has the global materials override option for the Cycles render engine in the “View Layer Properties” – “Override” but not for the EEVEE render engine.
Quick materials override for the EEVEE rendering engine can be made with a small script, as shown in the following video:
Script and video by
Continue reading “Global materials override for the Blender EEVEE render engine”
To enable gradient background in the “3D View” window you need:
open the “Preferences” window
press the “Themes” button
in the “3D View” – “Theme Space” -” Gradient Colors” section on the “Use Gradient” checkbox
and tune the gradient colors “Gradient HighOff” (top color) and “Gradient Low” (bottom color)
press the “Save Preferences” button to save changes
Blender 3D add-on for redirecting the print output and the error messages to the Python Console window.
Continue reading “Blender add-on: Print to Python Console”
Creating a scene with an iridescent luminous particles cloud.
Blender add-on “
B-Presets” updated to v. 1.1.0.
Excluded the name of the Scene
Added active view_layer settings (optional)
Added saving curves from Color management
Creating an organic shader to emulate an electron microscope look for Blender EEVEE render engine tutorials.
VIDEO nCoV-2019 Electron Microscope shader
VIDEO SARS-CoV-2 2019-nCoV
The “White 8” theme for Blender 2.82 added to themes collection:
By Michail Soluyanov