Skip to content

Instantly share code, notes, and snippets.

@sambler
sambler / uvproject.py
Last active October 6, 2020 08:27
uvunwrap a blender object using a script
# save this as uvproject.py and use the following command
# blender -b test.blend -P uvproject.py
import bpy
# Deselect all
bpy.ops.object.select_all(action='DESELECT')
for obj in bpy.context.scene.objects:
if obj.type == 'MESH':
@sambler
sambler / test-blend-bGPDstroke.c
Created November 17, 2019 02:55
check size and alignment of struct members
/*
* test alignments of struct members
* run on multiple platforms to compare output
cc test-blend-bGPDstroke.c -o testpad
./testpad
*/
#include <stdio.h>
#include <stddef.h>
@sambler
sambler / OSL_1.10.7_clang_9_build.log
Last active October 18, 2019 10:52
OSL build fail with clang 9.0
===> License BSD3CLAUSE accepted by the user
===> openshadinglanguage-1.10.7 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by openshadinglanguage-1.10.7 for building
===> Extracting for openshadinglanguage-1.10.7
=> SHA256 Checksum OK for imageworks-OpenShadingLanguage-Release-1.10.7_GH0.tar.gz.
===> Patching for openshadinglanguage-1.10.7
===> Applying FreeBSD patches for openshadinglanguage-1.10.7
===> openshadinglanguage-1.10.7 depends on executable: llvm-config90 - found
===> openshadinglanguage-1.10.7 depends on file: /usr/local/bin/clang90 - found
===> openshadinglanguage-1.10.7 depends on executable: bison - found
@sambler
sambler / OSL_473e1f6e2df1_llvm9.0rc2_build.log
Created August 23, 2019 01:15
OSL build fail with LLVM 9.0RC2
===> License BSD3CLAUSE accepted by the user
===> openshadinglanguage-1.10.6 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by openshadinglanguage-1.10.6 for building
===> Extracting for openshadinglanguage-1.10.6
=> SHA256 Checksum OK for imageworks-OpenShadingLanguage-Release-1.10.6-473e1f6e2df1_GH0.tar.gz.
===> Patching for openshadinglanguage-1.10.6
===> Applying FreeBSD patches for openshadinglanguage-1.10.6
===> openshadinglanguage-1.10.6 depends on executable: llvm-config90 - found
===> openshadinglanguage-1.10.6 depends on executable: bison - found
===> openshadinglanguage-1.10.6 depends on file: /usr/local/bin/cmake - found
@sambler
sambler / duplicate_objects_along_curve.py
Created June 9, 2019 07:25
Suggested variation of script in BSE answer
# script variation for https://blender.stackexchange.com/a/142495/935
import bpy
skull = bpy.data.objects["Skull"]
curve = bpy.data.objects["xobject_name"]
if 'Skulls' not in bpy.data.collections:
newCol = bpy.data.collections.new('Skulls')
bpy.context.scene.collection.children.link(newCol)
@sambler
sambler / fill_in_sequence.py
Last active July 10, 2018 09:25
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
@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 / 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 / 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 / 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",