Skip to content

Instantly share code, notes, and snippets.

@sambler
sambler / set_dpi.py
Created May 10, 2017 10:53
Small blender addon to toggle the DPI settings
# made for https://blender.stackexchange.com/q/79333/935
bl_info = {
"name": "Set DPI",
"author": "sambler",
"version": (1, 0),
"blender": (2, 75, 0),
"location": "Info header",
"description": "Toggle between two DPI settings",
"category": "System",
@sambler
sambler / find_image_users.py
Created July 12, 2017 10:36
Show image usage and provide way to clear it.
# made for https://blender.stackexchange.com/q/84328/935
# show places in blender where an image is in use.
# also provide a way to clear the usage of the images.
import bpy
bl_info = {
"name": "Find image users",
"author": "sambler",
"version": (1, 0),
@sambler
sambler / simplified_mesh.py
Created July 25, 2017 13:55
Simplify a mesh to be close to viewport preview drawing
# made for https://blender.stackexchange.com/q/86248/935
# duplicate a mesh to get the edges that define the shape
# skip any extra edges that are part of a flat section
import bpy
import bmesh
# source object
obj = bpy.context.object
# minimum angle between faces that will be kept.
@sambler
sambler / set_image.py
Created August 9, 2017 14:56
Sample of how to set an image to be shown in the 3D viewport as a texture
# made for https://stackoverflow.com/q/45586114/2684771
# expects the current screen to have a 3dviewport and image editor visible
import bpy
bpy.context.scene.render.engine = 'BLENDER_RENDER'
for obj in bpy.data.objects:
bpy.data.objects.remove(obj)
@sambler
sambler / set_origin.py
Last active October 12, 2017 08:09
Create a custom set origin menu
# made in response to https://blender.stackexchange.com/q/92105/935
bl_info = {
"name": "Test setting origin",
"author": "sambler",
"version": (1, 0),
"blender": (2, 75, 0),
"location": "blender",
"description": "test setting origin menu",
@sambler
sambler / mesh_select_cycle.py
Last active January 1, 2019 04:06
Cycle through the available mesh selection modes.
# made in response to https://blender.stackexchange.com/q/97746/935
bl_info = {
"name": "Cycle mesh select",
"author": "sambler",
"version": (1, 1),
"blender": (2, 80, 0),
"location": "blender",
"description": "Cycle through mesh selection modes.",
"category": "Mesh",
@sambler
sambler / multirender.py
Created April 5, 2018 17:28
Start background instances of blender to do rendering
#!/usr/bin/env python3
import os
import subprocess as sp
# this script is sent to each instance to do the render
# use str.format() to fill in the {}'s
render_scr = """import bpy
scn = bpy.context.scene
scn.render.use_sequencer = False
@sambler
sambler / curve_simplify.py
Last active December 15, 2020 19:32
adjusted version of blenders simplify f-curve addon
# this is a modified version of a blender addon
# This temporary version adds the ability to also simplify shape_key animations
# some more work should be done to make this more versatile
#
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
@sambler
sambler / startjackd
Created June 15, 2018 05:22
shell script to start jackd and jack_umidi for available devices
#!/bin/sh
# my machine seems to not work with jack -- realtime
# some audio progs allow specifying realtime but don't
# set --no-realtime without it
# so we start jack specifically with --no-realtime
if [ ! `pgrep -u $USER jackd | head -1` ]
then
@sambler
sambler / fill_in_sequence.py
Last active May 22, 2025 10:11
fill in missing frames in an image sequence
#!/usr/bin/env python
# made for https://blender.stackexchange.com/q/112530/935
# fill in missing frames in an image sequence
# by linking missing frames to the previous existing frame
import os
base_filename = 'Display'
base_extension = '.png'
# filename is composed of basename a four digit zero padded number and extension