Blender has a Python API, and the Documentation is open to the public. I think that if there is a document, I can afford it, so I look at the parameter name from the GUI and search for the document, but I feel that it often does not get caught. Why. The simple story is that the property name displayed in the GUI and the property name in the python API are different.
For example, Power displayed by a light source, which is energy if it is an API. No no no. Radius is shadow_soft_size. What is it already? If you drop the creation of the light source in the above figure into the code, it will be as follows
light_add.py
bpy.ops.object.light_add(type='POINT')
light_obj = bpy.context.active_object
light = light_obj.data
light.color = (1.0, 1.0, 1.0)
light.energy = 10
light.specular_factor = 1.0
light.shadow_soft_size = 0.25
How to find out
Copy Data Path
. Or hit the command on the right (Shift + Command + C on macOS)If I set the workspace to Scripting, will the code come out when I change it manually? In FreeCAD, it is displayed at the bottom by default. I am grateful that it will be easier to automate. ~~ By the way, why doesn't it apply even if I change cycles.samples from the code? (Under investigation) ~~ Orz that seems to have changed the setting in another place
Recommended Posts