Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Wendsche Theverat

View GitHub Profile
View list_largest_images.py
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:")
View change_obj_and_mat_IDs.py
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)
View remove_vertex_colors.py
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 Aug 21, 2018
My custom EXIF parser for use in Qt projects. Currently it only reads the image orientation.
View exifparser.cpp
#include "exifparser.h"
#include <QFile>
#include <QDataStream>
#include <QtEndian>
#include <QDebug>
#include <vector>
@Theverat
Theverat / nodes.py
Created Jul 23, 2018 — forked from IARI/nodes.py
Test Blender PYthon Nodes
View nodes.py
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
View convert_blender_internal_to_luxcore.py
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)
View pyluxcore_demo.py
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
View luxcore_extras.py
"""
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
You can’t perform that action at this time.