ddg.blender.freestyle module
- ddg.blender.freestyle.freestylify_curve(curve)[source]
Enable freestyle on edges of a curve (hacky).
This function is a workaround for the problem that freestyle doesn’t work on edges that don’t belong to a large enough face. The function works by extruding all edges of the curve and slightly nudging the newly created vertices. It then enables freestyle on one edge of each newly created edge pair.
The original curve is not altered. Creates a copy with freestyle “enabled” and links it to the original curve’s collection, or the current scene collection if curve is not linked to a collection.
- Parameters:
- curvebpy.types.Object
Curve or 1D mesh
- Returns:
- bpy.types.Object
Freestylified clone of curve. This is always a mesh object.
Notes
Blender will output a bunch of “Warning: degenerated triangle detected, correcting” warnings. The nudge amount does not seem to influence this.
- ddg.blender.freestyle.mark_all_edges(bobj_or_mesh)[source]
Mark all the edges of a Blender object for freestyle.
- Parameters:
- bobj: bpy.types.Object or bpy.types.Mesh
The Blender object of which the edges should be marked.
- ddg.blender.freestyle.settings(scene=None, view_layer=None)[source]
Initialize freestyle settings.
- Parameters:
- scenebpy.types.Scene (default=None)
The scene to apply freestyle to. If
None, thenbpy.context.scenewill be set to scene.- view_layerbpy.types.ViewLayer (default=None)
The view layer of
sceneto set freestyle to. IfNone, thenscene.view_layers[0]will be set as view layer.
- Returns:
- bpy.types.FreestyleSettings
The newly initialized freestyle settings.
- ddg.blender.freestyle.lineset(fs_settings, name)[source]
Add a freestyle lineset to the settings.
- Parameters:
- fs_settings: bpy.types.FreestyleSettings
The freestyle settings to add the lineset to.
- name: str
The name to give to the lineset.
- Returns:
- bpy.types.FreestyleLineSet
- ddg.blender.freestyle.linestyle(name)[source]
Make a new freestyle linesetyle.
- Parameters:
- name: str
The name to give to the linestyle.
- Returns:
- bpy.types.FreestyleLineStyle
- ddg.blender.freestyle.lineset_to_marked_visible(fs_lineset)[source]
Setup a lineset to match marked and visible edges.
- Parameters:
- fs_lineset: bpy.types.FreestyleLineSet
The lineset to setup.
- Returns:
- bpy.types.FreestyleLineSet
Setup a lineset to match marked and hidden edges.
- Parameters:
- fs_lineset: bpy.types.FreestyleLineSet
The lineset to setup.
- Returns:
- bpy.types.FreestyleLineSet
- ddg.blender.freestyle.linestyle_to_plain(fs_linestyle, thickness=1.3)[source]
Set a linestyle to plain line.
- Parameters:
- fs_linestyle: bpy.types.FreestyleLineStyle
The lineset to setup.
- thickness: float
The thickness of the line.
- Returns:
- bpy.types.FreestyleLineStyle
- ddg.blender.freestyle.linestyle_to_dashed(fs_linestyle, thickness=1, dash=5, gap=5)[source]
Set a linestyle to dashed line.
- Parameters:
- fs_linestyle: bpy.types.FreestyleLineStyle
The lineset to setup.
- thickness: float
The thickness of the line.
- dash: float
The length of the dashes.
- gap: float
The length of the gaps between the dashes.
- Returns:
- bpy.types.FreestyleLineStyle