Skip to content

Instantly share code, notes, and snippets.

@sambler
sambler / uvproject.py
Last active Oct 6, 2020
uvunwrap a blender object using a script
View uvproject.py
# 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 Nov 17, 2019
check size and alignment of struct members
View test-blend-bGPDstroke.c
/*
* 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 Oct 18, 2019
OSL build fail with clang 9.0
View OSL_1.10.7_clang_9_build.log
===> 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
View OSL_473e1f6e2df1_llvm9.0rc2_build.log
===> 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 Jun 9, 2019
Suggested variation of script in BSE answer
View duplicate_objects_along_curve.py
# 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 Jul 10, 2018
fill in missing frames in an image sequence
View fill_in_sequence.py
#!/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 Jun 15, 2018
shell script to start jackd and jack_umidi for available devices
View startjackd
#!/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 Dec 15, 2020
adjusted version of blenders simplify f-curve addon
View curve_simplify.py
# 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 Apr 5, 2018
Start background instances of blender to do rendering
View multirender.py
#!/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 Jan 1, 2019
Cycle through the available mesh selection modes.
View mesh_select_cycle.py
# 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",