This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function qsort(a, k, l, r) { | |
| // a: array to sort, k: key to sort by, | |
| // l, r: optional array index array range | |
| // i: stack index, s: stack, | |
| // p: pivot index, v: pivot value, | |
| // t: temporary array item, | |
| // x, y: partion low/high | |
| var i, s, p, v, t, x, y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import random | |
| bl_info = { | |
| 'name': 'Add Random Object', | |
| 'version': (0, 0, 0), | |
| 'blender': (2, 5, 9), | |
| 'category': 'Object', | |
| 'description': 'Pick a random object and add it at the cursor', | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EPSILON = 0.000001 | |
| def approx_eq(a, b): | |
| return abs(a - b) < EPSILON | |
| def get_item_or_attr(obj, attr): | |
| try: | |
| return obj[attr] | |
| except (TypeError, KeyError): | |
| return getattr(obj, attr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import json | |
| json.encoder.c_make_encoder = None | |
| json.encoder.FLOAT_REPR = lambda o: format(o, '.6f') | |
| actions = [] | |
| for action in bpy.data.actions: | |
| a = { | |
| 'name': action.name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function interpolate_bezier(a, b, c, d, resolution) { | |
| /* Blender's forward differencing bezier interpolation */ | |
| var p = []; | |
| var res = resolution - 1; | |
| var dims = Math.max( | |
| a.length, b.length, c.length, d.length); | |
| for (var i = 0; i < res; i++) { | |
| var x = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| atlas = sys.stdin.read() | |
| for item in atlas.split('\n'): | |
| if not item: | |
| continue | |
| tokens = item.split('\t') | |
| atlas = tokens[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| bl_info = { | |
| 'name': 'Bake Vertex Colors', | |
| 'author': 'Tamas Kemenczy', | |
| 'version': (0, 1), | |
| 'blender': (2, 6, 1), | |
| 'location': 'View3D > Specials > Bake Vertex Colors', | |
| 'description': 'Bake the active uv texture image to vertex colors', | |
| 'category': 'Mesh' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| from mathutils import Color | |
| MODES = { | |
| '=': lambda a, b: b, | |
| '+': lambda a, b: a + b, | |
| '-': lambda a, b: a - b, | |
| '*': lambda a, b: Color((a.r * b.r, a.g * b.g, a.b * b.b)), | |
| '/': lambda a, b: Color((a.r / b.r, a.g / b.g, a.b / b.b)), | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| bl_info = { | |
| 'name': 'Adjust Vertex Colors', | |
| 'author': 'Tamas Kemenczy', | |
| 'version': (0, 1), | |
| 'blender': (2, 6, 1), | |
| 'location': 'View3D > Specials > Adjust Vertex Colors', | |
| 'description': 'HSV vertex color adjustment of the selected faces', | |
| 'category': 'Mesh' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def paint(mesh, fn): | |
| c = mesh.vertex_colors.active.data | |
| for p in mesh.polygons: | |
| if p.select: | |
| for i in p.loop_indices: | |
| c[i].color = fn(c[i].color) |
OlderNewer