Skip to content

Instantly share code, notes, and snippets.

@pcote
pcote / grease_pencil_scripting.py
Created October 23, 2011 18:06
An example of Python scripting using gease pencil scripting for Blender. A partial re-invention of the "Convert Grease Pencil" operator.
def make_basic_curve():
crv = bpy.data.curves.new("crv", type="CURVE")
crv_ob = bpy.data.objects.new("crv_ob", crv)
return crv, crv_ob
scnobs = bpy.context.scene.objects
pencil = bpy.data.grease_pencil[0]
for i, stroke in enumerate(pencil.layers[0].active_frame.strokes):
@jeacom25b
jeacom25b / draw_lines_3d.py
Last active November 9, 2021 23:08
Utility module for blender 2.8, a line renderer for visual debugging and line drawing.
'''
Created by Jeacom
This is a utility module for drawing lines in the 3D viewport on Blender 2.8
using the GPU Api
The idea is to get rid of messy draw functions and data that is hard to keep track.
This class works directly like a callable draw handler and keeps track of all the geometry data.
'''
@karpathy
karpathy / stablediffusionwalk.py
Last active July 17, 2024 06:48
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4