Skip to content

Instantly share code, notes, and snippets.

import os
import gzip
from ctypes import *
# NOTE Select a single cube extrude it 1 block and execute "/pastebrush py" or "/pastebrush house"
# /pastebrush does not! work with block range selections (blue selection box) and
# only overrides cubes in the selection according to some rules
# i.e. cubes of air material do not override/replace existing cubes
# orientation up 4(or down 5) means dimension is 4 >> 1 == 2, row R[2] == 0, column C[2] == 1, depth D[2] == 2
# dimension coord (orient & 1) does matter (see blockcube(...)) and determines direction
import bpy
from mathutils import Matrix, Vector
# ported from blenkernel/intern/armature.c to python
# --------------------------------------------------------------------
def get_mat_offs(pose_bone):
bone = pose_bone.bone
mat_offs = bone.matrix.to_4x4()
mat_offs.translation = bone.head
mat_offs.translation.y += bone.parent.length
@pink-vertex
pink-vertex / c_types_vfont.py
Created October 29, 2015 23:47
breakdown text curve into characters (experiment - tested on ubuntu 2.75a 64bit)
import bpy
import mathutils
import ctypes
c_int_p = ctypes.POINTER(ctypes.c_int)
c_float_p = ctypes.POINTER(ctypes.c_float)
class BezTriple(ctypes.Structure):
_pack_ = 8
_fields_ = [
@pink-vertex
pink-vertex / convert_anim.py
Created September 25, 2015 05:51
Applies parent inverse matrix to the child's local matrix.
import bpy
import mathutils
class Converter:
def __init__(self, ob, logging=False):
self.ob = ob
self.action = ob.animation_data.action
self.rot_mode = ob.rotation_mode
self.logging = logging