Skip to content

Instantly share code, notes, and snippets.

View Theverat's full-sized avatar

Simon Wendsche Theverat

  • Germany
View GitHub Profile
import bpy
images = []
for image in bpy.data.images:
images.append((image.name, list(image.size), image.size[0] * image.size[1]))
images.sort(key=lambda elem: elem[2], reverse=True)
print("\nlargest images:")
import bpy
OLD_DEFAULT_ID = -1
NEW_DEFAULT_ID = 0
# Object IDs
for obj in bpy.data.objects:
if obj.luxcore.id == OLD_DEFAULT_ID:
obj.luxcore.id = NEW_DEFAULT_ID
print("Changed ID of object", obj.name)
import bpy
for obj in bpy.context.selected_objects:
if obj.data and obj.type == "MESH":
vcols = obj.data.vertex_colors
if vcols:
print("%s: removing %d vertex color layers" % (obj.name, len(vcols)))
else:
print("%s: no vertex colors" % obj.name)
@Theverat
Theverat / exifparser.cpp
Created August 21, 2018 23:20
My custom EXIF parser for use in Qt projects. Currently it only reads the image orientation.
#include "exifparser.h"
#include <QFile>
#include <QDataStream>
#include <QtEndian>
#include <QDebug>
#include <vector>
@Theverat
Theverat / nodes.py
Created July 23, 2018 23:30 — forked from IARI/nodes.py
Test Blender PYthon Nodes
bl_info = {
'name': 'Node Test',
'category': 'User',
'author': 'Julian Jarecki',
'blender': (2, 79, 0),
# 'location': 'File > Export',
'description': "Test custom Nodes and sockets",
}
import bpy
import bpy
tex_type_map = {
"IMAGE": "LuxCoreNodeTexImagemap",
}
def new_node(bl_idname, node_tree, previous_node, output=0, input=0):
node = node_tree.nodes.new(bl_idname)
node.location = (previous_node.location.x - 250, previous_node.location.y)
from time import sleep
import array
# I assume that pyluxcore and all required libraries are in the same
# directory as this Python script. Obviously you can also move it to
# a dedicated module, like I did in BlendLuxCore.
import pyluxcore
WIDTH = 800
HEIGHT = 600
"""
An addon that can create LuxCore imagemap nodes from Cycles materials.
Installation: https://docs.blender.org/manual/en/dev/preferences/addons.html#header
Or copy into a text editor and click "Run Script".
The addon adds a button called "Create Image Nodes" in the properties window, scene tab.
"""
import bpy