Files
Blender-Fange-Pipeline/Fange Pipeline/operators/outline.py
T

28 lines
849 B
Python

import bpy
from ..models import Outline
class ConfigBlendScene(bpy.types.Operator):
"""Init the opened blend scene"""
bl_idname = 'graou.build_scene'
bl_label = 'Config or update the outline'
def __init__(self):
self._outline = Outline()
def execute(self, context):
for key, value in self._outline.collections.items():
collection = bpy.data.collections.get(key)
# Make the collection if this item not exist
if collection is None:
collection = bpy.data.collections.new(value.name)
context.scene.collection.children.link(collection)
# Check if the color are correctly setup, if not update-it
if collection.color_tag is not value.color:
collection.color_tag = value.color
return {'FINISHED'}