generated from stilobique/BlenderTemplate
4f539912eb
Make a Property Group for blender
28 lines
860 B
Python
28 lines
860 B
Python
import bpy
|
|
|
|
from ..properties.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'}
|