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
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)
import bpy
class RigLayers(bpy.types.Panel):
bl_idname = 'POSE_PT_RigLayers'
bl_label = "Rig Layers"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_context = "posemode"
bl_category = 'CUSTOM_CATEGORY'
"""
Example Usage
=============
A folder titled png_icons will be created in the current directory
Run as:
blender icons_geom.blend --background --python blender_icons_geom_png.py