To read the code correctly, it is important to ** look at the entire code **.
To see the whole code, the point is to abstract and ** compress the information **. It's easier to understand if it gets shorter !! This is to symbolize the code.
When reading the code, ** reading from the left end ** is not recommended !!!!!!!!!
The code to use is the code (↓) that adds the monkey used in the previous article.
bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
The image of symbolization (abstraction) is as follows.
bpy.ops.mesh.primitive_monkey_add(size←2, enter_editmode←False, align←'WORLD', location←(0, 0, 0), scale←(1, 1, 1))
⬇️ □.□.□.primitive_monkey_add(□←2,□←False,□←'WORLD',□←(0, 0, 0),□←(1, 1, 1))
⬇️ ===> Function (□ ← numerical value, □ ← boolean value, □ ← character string, □ ← tuple, □ ← tuple)
⬇️ ===> Function (argument 1, argument 2, argument 3, argument 4, argument 5)
⬇️ ** Perform the process of adding a monkey using 5 arguments **
Variables are like ** boxes ** that hold data.
If you set the variable as □, the above code will be
□.□.□.primitive_monkey_add(□=2,□=False,□='World',□=(0,0,0),□=(1,1,1))
It will be.
The function is like a ** output device . The information ( argument **) in () provided is used to perform the specified processing.
Here, ** primitive_monkey_add () ** is the function. Use the ** size and position information ** in () to make the monkey appear.
Dots are easy to understand if you think of them as ** right-pointing arrows (→) **.
So the first part is
bpy → ops → mesh → primitive_monkey_add( )
It will be.
In Japanese, it means ** go inside **.
primitive_monkey_add ()
in mesh in ops in bpy
In other words, it can be said that it is a ** route ** to reach the target (function in this case).
====> primitive_monkey_add( )
It is easy to understand if you think that the equal is ** arrow pointing to the left (←) **. In other words, the inside of the method () is
size ← 2, enter_editmode ← False, align ← 'WORLD', location ← (0, 0, 0), scale ← (1, 1, 1)
It will be.
In Japanese, it means ** to substitute for ** ~.
#Assign the integer 2 to the variable size
size = 2,
#Variable enter with Boolean False_Assign to editmode
enter_editmode = False,
#String'WORLD'To the variable align
align = 'WORLD',
#Tuple(0, 0, 0)To the variable location
location = (0, 0, 0),
#Tuple(1, 1, 1)To the variable scale
scale = (1, 1, 1)
This time, I aimed to make it easier to understand the whole picture of the code by abstracting the code and thinking with symbols. Anyway, I hope you find it useful to think in terms of symbols.
Recommended Posts