Skip to content

Instantly share code, notes, and snippets.

@tamask
tamask / select_by_color.py
Created May 4, 2012 01:04
Select By Color (Blender)
import bpy
from mathutils import Color
bl_info = {
'name': 'Select By Color',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 1),
'location': 'View3D > Specials > Select By Color',
'description': 'Select all faces with the same vertex color of the selected face',
@tamask
tamask / vertex_data_map.py
Created May 7, 2012 11:48
Vertex Data Map (Blender)
import bpy
bl_info = {
'name': 'Vertex Data Map',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'View3D > Specials > Vertex Data Map',
'description': 'Generate vertex data map UV texture',
'category': 'Mesh'
@tamask
tamask / map_vertex_colors.py
Created May 7, 2012 12:54
Map Vertex Colors (Blender)
import bpy
bl_info = {
'name': 'Map Vertex Colors',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 1),
'location': 'View3D > Specials > Map Vertex Colors',
'description': 'Bake vertex colors to active uv texture image',
'category': 'Mesh'
@tamask
tamask / io_export_unity_lines.py
Created May 10, 2012 13:29
Unity Lines (.js) (Blender exporter)
import os
import bpy
bl_info = {
'name': 'Unity Lines (.js)',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'File > Import-Export > Unity Lines (.js)',
'description': 'Export loose edges of a mesh as Unity GL immediate-mode commands',
@tamask
tamask / set_loose_vertex_colors.py
Created May 11, 2012 00:30
Set Loose Vertex Colors (Blender)
import bpy
import mathutils
bl_info = {
'name': 'Set Loose Vertex Colors',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'View3D > Specials > Set Loose Vertex Colors',
'description': 'Store loose vertex colors via vertex groups',
@tamask
tamask / map_loose_vertex_colors.py
Created May 13, 2012 14:40
Map Loose Vertex Colors (Blender)
import bpy
bl_info = {
'name': 'Map Loose Vertex Colors',
'author': 'Tamas Kemenczy',
'version': (0, 1),
'blender': (2, 6, 3),
'location': 'View3D > Specials > Map Loose Vertex Colors',
'description': 'Bake vertex colors to active uv texture image',
'category': 'Mesh'
@tamask
tamask / arc.js
Created August 19, 2012 19:32
SVG arc
function arc(x, y, rx, ry, from, to) {
var ar = from * Math.PI / 180;
var ax = x + rx * Math.cos(ar);
var ay = y + ry * Math.sin(ar);
var br = to * Math.PI / 180;
var bx = x + rx * Math.cos(br);
var by = y + ry * Math.sin(br);
var sweep = (to - from) > 180 ? 1 : 0;
@tamask
tamask / raphael.py
Created August 24, 2012 22:35
SVG to Raphael.js converter
import re
import sys
import json
import math
from lxml import etree
# TODO
# - text nodes
# - image nodes
# - transforms
var Preloader = function(sources, oncomplete, onload) {
this.init(sources, oncomplete, onload);
}
Preloader.prototype = {
init: function(sources, oncomplete, onload) {
this.sources = sources;
this.oncomplete = oncomplete
this.onload = onload;
this.images = [];
Boxfill = function(el) {
this.init(el);
};
Boxfill.prototype = {
init: function(el) {
this.el = el;
this.el.style.overflow = 'hidden';
if (!this.el.style.position)