The classic way of localizing a Blender add-on (translating it into different languages) is convenient because requires just a single Blender Python API call – to get the currently used locale. This way is maximum universal, but Blender would not be Blender if it did not provide users an ability to localize add-ons through its own API.
The principle of creating multilingual add-ons using the Blender Python API is not much different from the classical one – we need to create a dictionary with all the variants of translations for all text strings from our add-on and use this dictionary in the localization.
When fine-tuning the finished render in “Compositing”, sometimes it is necessary to refer to the pixels coordinates of the processed image, for example, to apply effects distributed over the entire width or height of the image.
We can get the distribution factor of coordinates along with the height or width of the rendered image using texture nodes.
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.
Working with mesh geometry, it may be necessary to assign each vertex some custom properties or data that must be written to the blend-file when saved, and which must be accessed later.
However, an attempt to assign the necessary data to the vertexes through the creation of custom properties fails. Instead of the custom vertex property, only a tuple with reference to the type of the property is created.
The Blender API provides a set of simple property types described in bpy.props (IntProperty, BoolProperty, etc.). But the basic types are not always enough, sometimes we need more complex ones. The Blender API allows to group simple properties to make complex properties.
Let’s consider such complex property creation and make the 3×3 matrix property as an example.
The button click is basically connected with the operator calling in the Blender user interface. However, some times actions, that need to be performed when a button is pressed, are quite simple and do not require a separate operator for them. And it makes no sense to fill a registered operators stack with a multitude of specific operators designed to perform one highly specialized function. It would be much more convenient to associate a button press with a separate function call but the Blender API allows to associate buttons only with an operator call.
To solve the problem of creating a separate operator for each button we can use the fact that the operator can be called with the input parameters.
I need a frame. No, two frames: one larger, the other smaller, but made from one profile. I drew a rectangle, set the desired dimensions, duplicated, set other sizes. I drew a separate profile. For a section to both rectangles I applied this profile. … why did I get different frames? And none matches the size of the profile? Ah, I forgot to apply the scale. Applied. The dimensions of the cross-section changed, became different, but again not equal to the profile. How to make them equal – read below!
Solving the problem of the discrepancy between the size of the track section and the profile applied to it
This problem occurs when the path for profiling is constructed in any way but then scaled to the desired size. In this case, it does not matter if its scale is 1 or not. If we apply the profile we need to it, then it will be different in size from the set … Why? We will see now.