"""Every painted tool in ArtSource/Blender/stylized side by side, for review in Blender. blender -b --factory-startup --python ArtSource/Blender/scripts/gc_style_review.py Writes ArtSource/Blender/stylized/Style_Tools_Review.blend (opens in Material Preview). """ import os import bpy from mathutils import Vector HERE = os.path.dirname(os.path.abspath(__file__)) DIR = os.path.normpath(os.path.join(HERE, "..", "stylized")) NAMES = ["SM_Tool_NailScissors", "SM_Tool_GardenShears", "SM_Tool_Sickle", "SM_Tool_Hammer", "SM_Tool_Scythe", "SM_Tool_LongScythe", "SM_Tool_WideScythe"] bpy.ops.wm.read_factory_settings(use_empty=True) scene = bpy.context.scene x = 0.0 for name in NAMES: path = os.path.join(DIR, name + ".blend") if not os.path.exists(path): continue with bpy.data.libraries.load(path, link=False) as (src, dst): dst.objects = list(src.objects) roots = [] for o in dst.objects: if o is None or o.type not in {"MESH", "EMPTY"}: continue scene.collection.objects.link(o) if o.parent is None: roots.append(o) # lay the tool out flat with a gap after the previous one xs = [(o.matrix_world @ Vector(c)).x for o in dst.objects if o and o.type == "MESH" for c in o.bound_box] width = (max(xs) - min(xs)) if xs else 0.3 for r in roots: r.location.x += x - (min(xs) if xs else 0.0) label = bpy.data.curves.new(name + "_label", "FONT") label.body = name.replace("SM_Tool_", "") label.size = 0.08 t = bpy.data.objects.new(name + "_label", label) t.location = (x, -0.25, -0.4) scene.collection.objects.link(t) x += width + 0.35 for area_screen in bpy.data.screens: for area in area_screen.areas: if area.type == "VIEW_3D": for sp in area.spaces: if sp.type == "VIEW_3D": sp.shading.type = "MATERIAL" out = os.path.join(DIR, "Style_Tools_Review.blend") bpy.ops.wm.save_as_mainfile(filepath=out, check_existing=False) print("REVIEW", out)