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 generate_node_screenshots.py
import bpy
from dataclasses import dataclass
from itertools import islice
@dataclass
class Rectangle:
x: float
y: float
width: float
height: float
@JacquesLucke
JacquesLucke / llvm_add.cc
Created Nov 30, 2018
Compile simple add function using the LLVM C++ API.
View llvm_add.cc
#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
JacquesLucke / auto_load.py
Last active Feb 26, 2019
Utility to (un)register all classes in a Blender addon.
View auto_load.py
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);
Py_DecRef(module);
return function;
}
static PyObject *call_external_method(
View iterative_merge_sort.py
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
JacquesLucke / setup.py
Created Nov 1, 2017
Simple setup.py that also checks if cython exists or not. Also allows for extra .c files.
View setup.py
sources = [
("test1.pyx", []),
("test2.pyx", ["extra.c"])
]
import os
import sys
def main():
if cython_exists():
@JacquesLucke
JacquesLucke / midi_input_node.py
Last active Oct 23, 2017
Idea for the structure of a simple Midi Input node.
View midi_input_node.py
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.