diff --git a/Fange Pipeline/models.py b/Fange Pipeline/models.py index 972eaf6..f5ac2d6 100644 --- a/Fange Pipeline/models.py +++ b/Fange Pipeline/models.py @@ -1,6 +1,7 @@ import bpy from pathlib import Path +from dataclasses import dataclass class FangeProject: @@ -31,25 +32,24 @@ class FangeProject: return self._project_path.joinpath(self._subdir_path, self._characters_path) +@dataclass +class Collection: + name: str + color: str + + class Outline: """ Model about the Outline config. """ def __init__(self): self._collections = { - 'Placeholder': ['COLOR_01'], - 'Icon': ['COLOR_04'], - 'Game Object': ['COLOR_05'] + 'Placeholder': Collection(name='Placeholder', color='COLOR_01'), + 'Icon': Collection(name='Icon', color='COLOR_04'), + 'Game Object': Collection(name='Game Object', color='COLOR_05') } @property - def placeholder(self): - return 'Placeholder' - - @property - def icon(self): - return 'Icon' - - @property - def game(self): - return 'Game Object' + def collections(self) -> [str]: + """Returns all collections in a dict""" + return self._collections diff --git a/Fange Pipeline/operators/outline.py b/Fange Pipeline/operators/outline.py index 7656c66..08472cc 100644 --- a/Fange Pipeline/operators/outline.py +++ b/Fange Pipeline/operators/outline.py @@ -13,4 +13,14 @@ class ConfigBlendScene(bpy.types.Operator): def execute(self, context): print(f'[Pipeline] Generate outline') + + for key, value in self._outline.collections.items(): + print(f'[Pipeline] Check the collection {key}') + collection = bpy.data.collections.get(key) + + if collection is None: + collection = bpy.data.collections.new(value.name) + collection.color_tag = value.color + context.scene.collection.children.link(collection) + return {'FINISHED'}