generated from stilobique/BlenderTemplate
Outline operator, set all collection
This commit is contained in:
+13
-13
@@ -1,6 +1,7 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
class FangeProject:
|
class FangeProject:
|
||||||
@@ -31,25 +32,24 @@ class FangeProject:
|
|||||||
return self._project_path.joinpath(self._subdir_path, self._characters_path)
|
return self._project_path.joinpath(self._subdir_path, self._characters_path)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Collection:
|
||||||
|
name: str
|
||||||
|
color: str
|
||||||
|
|
||||||
|
|
||||||
class Outline:
|
class Outline:
|
||||||
"""
|
"""
|
||||||
Model about the Outline config.
|
Model about the Outline config.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._collections = {
|
self._collections = {
|
||||||
'Placeholder': ['COLOR_01'],
|
'Placeholder': Collection(name='Placeholder', color='COLOR_01'),
|
||||||
'Icon': ['COLOR_04'],
|
'Icon': Collection(name='Icon', color='COLOR_04'),
|
||||||
'Game Object': ['COLOR_05']
|
'Game Object': Collection(name='Game Object', color='COLOR_05')
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def placeholder(self):
|
def collections(self) -> [str]:
|
||||||
return 'Placeholder'
|
"""Returns all collections in a dict"""
|
||||||
|
return self._collections
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
return 'Icon'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def game(self):
|
|
||||||
return 'Game Object'
|
|
||||||
|
|||||||
@@ -13,4 +13,14 @@ class ConfigBlendScene(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
print(f'[Pipeline] Generate outline')
|
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'}
|
return {'FINISHED'}
|
||||||
|
|||||||
Reference in New Issue
Block a user