Skip to content

Instantly share code, notes, and snippets.

View natecraddock's full-sized avatar

Nathan Craddock natecraddock

View GitHub Profile
@natecraddock
natecraddock / Readme
Last active October 19, 2015 02:11
Blender Pixel Maker Addon
My addon is now found at: https://github.com/natecraddock/pixel-maker
@natecraddock
natecraddock / markertosubtitle.py
Created October 17, 2015 03:26
Blender Markers to Subtitle Script
# Marker Subtitle Script For Blender
#
# Exports Blender Timecodes to a
# .txt or .srt file.
# 2015 Nathan Craddock
# Type the location here that you would like to save the file
# on windows devices make sure to double backslash \\ so python
# reads it as a \
import bpy
from bpy.types import Panel, EnumProperty, WindowManager
import bpy.utils.previews
import os
# UI
class PreviewsExamplePanel(bpy.types.Panel):
bl_label = "Previews Example Panel"
bl_idname = "OBJECT_PT_previews"
bl_info = {
"name": "Custom Property Manager",
"author": "Nathan Craddock",
"version": (0, 1),
"blender": (2, 77, 0),
"location": "UI > Properties Panel",
"description": "Add objects to track Custom Props on",
"tracker_url": "",
"category": "Object"
}
@natecraddock
natecraddock / images.py
Created August 3, 2016 20:58
Some simple Python scripts to generate every possible an n x n image of black and transparent pixels. The other one merges the images together
# Nathan Craddock 2016
from PIL import Image
import random
import os
from subprocess import run
from itertools import product
size = (4, 4)
colors = [(0, 0, 0, 0), (0, 0, 0, 255)]
@natecraddock
natecraddock / pythagorean.py
Last active August 4, 2016 21:06
Returns the distance between two objects in Blender
import math
def pythagorean(object1, object2):
dx = object1.location.x - object2.location.x
dy = object1.location.y - object2.location.y
dz = object1.location.z - object2.location.z
return math.sqrt(pow(dx, 2) + pow(dy, 2) + pow(dz, 2))
@natecraddock
natecraddock / image_numbers.py
Created August 6, 2016 01:37
Inspired by a recent standupmaths video
# Nathan Craddock 2016
from PIL import Image
size = (256, 256)
num_pixels = size[0] * size[1]
# Returns the list of base 256 colors
def get_pixel_colors(n):
color_values = []

I'm documenting my setup for configuring my ThinkPad on Linux

Issues:

  • Brightness controls stop working (cinnamon.power) after suspend
  • Wireless (wifi) interface not found after suspend

Fixes:

  • Wireless problems (Ask Ubuntu Wifi doesn't work after suspend)
sudo systemctl restart network-manager.service
# Audio Visualizer Script
# Load the script into blender
# Make sure Auto Run Python scripts is enabled in your
# User preferences for the drivers
# Enjoy!
import bpy
import bmesh
import mathutils
@natecraddock
natecraddock / directory-cat.py
Last active April 4, 2019 22:10
Copy all files in path to out.txt with filename headers
import os
path = "node-master"
out = open("out.txt", 'w')
for file in os.listdir(path):
in_file = open(os.path.join(path, file))
out.write(file)