This animation was created in Blender by using Python to create the tower of cubes, which is of course on the XYZ axis system of Blender's world space. This position or index of the cube on any given axis is used to calculate the Red, Green or Blue component of the RGB color used as the diffuse color of new Material created for each cube. So the XYZ space of the tower of cubes is mapped completely onto the RGB color space. The lower front corner cube is pure black (RBG 0,0,0) and the rear top corner cube is pure white (RGB 1,1,1 in Blender terms where color values range from 0 to 1 instead of the typical 0 to 255.) So in this way EVERY part of the RGB color space is represented.
Mapping XYZ space to RGB space, thus forming a type of RGB color cube is an obvious and logical thing to try. The tricky part was figuring out how to use Blender operations and how to access Blender internal data structures correctly using Python to create, customize and assign a unique material to each cube as it is created.
If you are attempting to automate Blender, just be patient and search for many relevant examples online of similar actions in order to get clues as to how to do a particular thing. Of course a big part of figuring out Blender Python automation is to perform the actions manually in the Blender GUI and then to look at the Info log file to see the internal commands Blender is using. The context of operations is very important, so thing about how you are changing context within the GUI as you look at the internal commands showing up in the log file and keep this in mind.
Another important factor is to be able to see the full detail of Python errors. These are not usually visible within the Blender GUI or even within Blender's Info log file, so you will need to take another step when launching Blender. Create a shell script which opens the Blender application for you in a console window where you will see Blender's STDOUT and STDERR ouput. This is the only place I am aware of where you can see the full detail of any errors thrown by Python code.
The entire code, Blender file, related scripts and more are available here on my GitHub:
https://github.com/jimmygizmo/boablend
Please post any questions you might have in the comments and I will do my best to give you a good answer!
Jimmy Gizmo
##
#
Auf dieser Seite können Sie das Online-Video Python 3D Animation using Blender - Blender Objects and Materials with Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Jimmy Gizmo 13 Mai 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,101 Mal angesehen und es wurde von 9 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!