Skip to content

Instantly share code, notes, and snippets.

Jacques Lucke JacquesLucke

Block or report user

Report or block JacquesLucke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View map_random_int_to_01.c
uint a = BLI_rng_get_uint(rng);
uint b = 0x3F800000 | (0x007FFFFF & a);
float c = *(float *)&b;
return c - 1.0f;
import bpy
from dataclasses import dataclass
from itertools import islice
class Rectangle:
x: float
y: float
width: float
height: float
JacquesLucke /
Created Nov 30, 2018
Compile simple add function using the LLVM C++ API.
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include <vector>
#include <memory>
void test_llvm() {
llvm::LLVMContext *context = new llvm::LLVMContext();
JacquesLucke /
Last active Jan 12, 2020
Utility to (un)register all classes in a Blender addon.
import os
import bpy
import sys
import typing
import inspect
import pkgutil
import importlib
from pathlib import Path
__all__ = (
View call_external_python_function.c
static PyObject *get_external_function(const char *module_name, const char *function_name)
PyObject *module = PyImport_ImportModule(module_name);
PyObject *globals = PyModule_GetDict(module);
PyObject *function = PyDict_GetItemString(globals, function_name);
return function;
static PyObject *call_external_method(
from math import ceil
from random import randint
def mergesort(A):
B = [None] * len(A)
chunk_size = 1
while chunk_size < len(A):
for i in range(ceil(len(A) / chunk_size / 2)):
merge(A, B,
start1 = 2 * i * chunk_size,
JacquesLucke /
Created Nov 1, 2017
Simple that also checks if cython exists or not. Also allows for extra .c files.
sources = [
("test1.pyx", []),
("test2.pyx", ["extra.c"])
import os
import sys
def main():
if cython_exists():
JacquesLucke /
Last active Oct 23, 2017
Idea for the structure of a simple Midi Input node.
import bpy
from bpy.props import *
from ... base_types import AnimationNode
from ... data_structures import DoubleList
class MidiNoteData(bpy.types.PropertyGroup):
noteName = StringProperty() # e.g. C4, B5, ...
# This value can be keyframed.
# It is possible but not easy to 'find' the fcurve of this property.
# Therefor only the value in the current frame can be accessed efficiently.
You can’t perform that action at this time.