Next assignment after fractals: Perlin noise koch_rotating.py example: I really wanted it to just run like this: blender -P koch_rotating.py It does! First: Rotation Animation and key frames A key frame denotes a point in an animation We really only need two for a rotation, beginning and end First frame: Roation euler is (0, 0, 0) Last frame: Rotation euler is (0, 0, pi/2) keyframe_insert method, data_path for what we're changing, frame number We can insert two of them like that, changing the rotation between ChatGPT thought we need to set the interpolation as linear for all fcurves Might be overkill Default seems to be something with a gentle start/stop probably at least 3 fcurves, only need rotation z axis Automatically playing it is easy: bpy.ops.screen.animation_play() Second: The splash screen Didn't seem to be anywhere in the UI (shows until a project is open) I couldn't fix this by script ChatGPT thought it had ideas, none seemed to work Like, open a project, or whatnot If we just open a project, it won't show the screen blender default.blend -P koch_rotating.py It's important to say default.blend first rather than second Third: Zoom level We did the automatic material view selection in color_staircase.py As part of that, we find a reference to the space the object is displayed in To change space.shading.type We can also change space.region_3d.view_distance ChatGPT was pretty worthless on this one Didn't even get the Python keyword argument rules right Fourth: Unselect the object I thought it looked silly with the orange outline This one is easy: bpy.ops.object.select_all(action='DESELECT') Finally: Cleanup and make a starting point for us co is already a mathutils.Vector, use built-in methods mathutils is a Blender thing Until adding the color, we don't need a bmesh And we don't need it at all unless we add colors Could we maybe use functions to make this easier? It would be cool if they were in a library The Midterm: Let's make a review guide and some decisions It'll be on Tuesday Perlin Noise finally! Noise: This kind https://en.wikipedia.org/wiki/Noise_(spectral_phenomenon) Gradient Noise: https://en.wikipedia.org/wiki/Gradient_noise Perlin Noise: Random vectors in a grid Interpolate for areas inbetween For a gentle transition Example of how it looks (perlin.py) If none of that made sense: TL;DR: Perlin noise gives us random numbers in a grid Each number isn't too different from the ones around it Changes are smoothly spread out Blender's built-in implementation mathutils has a module called "noise" If we give it a coordinate, it'll give us a noise value It won't be the same every time we run the program noise.noise(coordinate), where coordinate is a mathutils.Vector Can we apply that and make a doughnut that's not so perfect? Can we animate the deformation? This one is a little harder First make a key named "Basis" This holds the initial shape Basis for shape transformations, basically Then add a key and keep a reference We can omit the name if we keep a reference If we had a name, we could look it up later without the reference Change the data in key.data It works like obj.data.vertices You don't have to say .vertices Can use this directly as a for loop range The key will have a data path called value Set key.value to 0.0 Call key.keyframe_insert and insert it at the first frame we want to animate Set key.value to 1.0 Insert it at the last value to animate The rest of this is like the spinning example