However, at this time, I thought that it would be fun if I could model automatically with python to some extent, but I tried to introduce blender and python, it is a memo writing.
Machine specs
Install directly from Blender's official website below. I used 2.79 until now, but I have installed the latest version of 2.83 by overwriting it.
https://www.blender.org
Start blender. You can open the application as it is, but I set it to open on the terminal anyway.
If blender exists on MacOS, it will be in the following path.
/Applications/Blender.app/Contents/MacOS/Blender
I made it possible to call it at any time through the path here. By the way, other initialization files and add-ons are also included in scripts directly under Contents.
A screen like this was displayed. Blender is in English by default, but you can change it to Japanese. Edit → preferences → interface → Translation → Language
Now that blender can be started with CUI, let's run python on blender.
By selecting "scripting" which is one of the tabs, the console screen and the editor screen are displayed in the upper left of the model view screen.
You can operate blender with python by typing python commands into this console.
I tried to make a prototype of the sea like that with the following command.
import bpy
#Object removal
bpy.ops.object.delete(use_global=False)
#Create a new object, this is a plane(Plane)
bpy.ops.mesh.primitive_plane_add(enter_editmode=False, align='WORLD')
#Add Ocean as modifier to object
bpy.ops.object.modifier_add(type='OCEAN')
With this alone, it is faster to add the modifier manually ... It seems that the future is still long.
https://docs.blender.org/api/current https://qiita.com/yassyskywalker/items/18e8541079bfae2af0e7
Recommended Posts