Skip to content

Instantly share code, notes, and snippets.

@IPv6
IPv6 / make_starling_atlas.py
Last active February 4, 2022 01:50
Starling Atlas generation. Recursively loads images from directory and arranges them into one big png file with xml decription
# Starling Atlas generation: make_starling_atlas.py
# Recursively loads images from directory and arranges them into one big png file with xml decription
# Reqirement: PIL
# ported from https://github.com/Gamua/Sparrow-Framework/blob/master/sparrow/util/atlas_generator/generate_atlas.rb
# ********* ************* *******
import sys
import os
from PIL import Image
local function clamp(value, low1, high1)
if value<low1 then
return low1
end
if value>high1 then
return high1
end
return value
end
def eliminateNG(self, node):
node_groups = bpy.data.node_groups
# Get the node group name as 3-tuple (base, separator, extension)
(base, sep, ext) = node.node_tree.name.rpartition('.')
# Replace the numeric duplicate
if ext.isnumeric():
if base in node_groups:
print("- Replace nodegroup '%s' with '%s'" % (node.node_tree.name, base))
def get_object_by_name(name):
if name in bpy.data.objects:
return bpy.data.objects[name]
return None
def unselect_all():
for obj in bpy.data.objects:
obj.select = False
def force_visible_object(obj):