Skip to content

Instantly share code, notes, and snippets.

@blender8r
blender8r / gp_gradient_ref_script.py
Last active March 11, 2023 19:29
Generates a line to which various formulas can be applied to test different value gradients
# Generates grease pencil line to which various formulas can be applied
# to test different value gradients
import bpy
import random
from math import tau, sin, cos, tan
def line(gp_frame, start_pos, end_pos, num_pts):
gp_stroke = gp_frame.strokes.new()
gp_stroke.line_width = 30
import bpy
from math import pi, sin, cos
from mathutils import Vector
num_points = 10
center = (0.0, 0.0, 0.0)
def get_frame(frames, frame_num):
'''Checks for the existence of a given frame'''
import bpy
from math import pi, sin, cos
from mathutils import Vector
num_points = 10
center = (0.0, 0.0, 0.0)
def get_frame(frames, frame_num):
'''Checks for the existence of a given frame'''
import bpy
from math import pi, sin, cos
num_points = 10
center = (0.0, 0.0, 0.0)
def star(gp_frame, center, radius_x, radius_z, num_points, offset=0.75):
gp_stroke = gp_frame.strokes.new()
gp_stroke.line_width = 30
gp_stroke.use_cyclic = True
import bpy
from math import pi, sin, cos
num_points = 48
center = (0.0, 0.0, 0.0)
def ellipse(gp_frame, center, radius_x, radius_z, num_points):
gp_stroke = gp_frame.strokes.new()
import bpy
from math import pi, sin, cos
num_points = 48
center = (0.0, 0.0, 0.0)
def ellipse(gp_frame, center, radius_x, radius_z, num_points):
gp_stroke = gp_frame.strokes.new()
@blender8r
blender8r / gpencil_add_noise_modifier.py
Last active January 8, 2022 14:44
Adds a noise modifier to a grease pencil stroke
# adds a grease pencil noise modifier to the selected grease pencil object
import bpy
import random, math
from mathutils import Vector
def line(gp_frame, start_pos, end_pos, num_pts):
gp_stroke = gp_frame.strokes.new()
gp_stroke.line_width = 30
@blender8r
blender8r / gpencil_wiggly_line.py
Last active January 8, 2022 14:46
Generates a grease pencil line that wanders noisily in all directions
# Generates grease pencil line with random noise on x and z axes
import bpy
import random
from mathutils import Vector
def line(gp_frame, start_pos, end_pos, num_pts):
gp_stroke = gp_frame.strokes.new()
gp_stroke.line_width = 30
@blender8r
blender8r / gpencil_better_noise.py
Last active January 8, 2022 14:51
Generates a grease pencil line with noise (alternate method)
# Generates grease pencil line with random noise on z axis (alternate method)
import bpy
import random
def line(gp_frame, start_pos, end_pos, num_pts):
gp_stroke = gp_frame.strokes.new()
gp_stroke.line_width = 30
@blender8r
blender8r / gpencil_w_noise.py
Last active January 8, 2022 14:52
Generates a grease pencil line with noise on vertical axis
# Generates grease pencil line with random noise on z axis
import bpy
import random
def line(gp_frame, start_pos, end_pos, num_pts):
gp_stroke = gp_frame.strokes.new()
gp_stroke.line_width = 30