generated from stilobique/BlenderTemplate
Outline operator, set all collection
This commit is contained in:
+13
-13
@@ -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
|
||||
|
||||
@@ -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'}
|
||||
|
||||
Reference in New Issue
Block a user