From 7011d02c292ac1c91a5c9cc1a075ea2727982cee Mon Sep 17 00:00:00 2001
From: Nathan Craddock <nzcraddock@gmail.com>
Date: Fri, 9 Oct 2020 14:27:43 +1100
Subject: [PATCH] blender_theme_as_c: Add workaround for collection colors

When running blender_theme_as_c.py after collection colors were added,
the generated default theme only had one collection color because array
themes are not supported yet.

This hard codes the collection colors into the script just like is done
for bone color sets.

Ref D9154
---
 utils/blender_theme_as_c.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/utils/blender_theme_as_c.py b/utils/blender_theme_as_c.py
index 298f035..4c87dc0 100755
--- a/utils/blender_theme_as_c.py
+++ b/utils/blender_theme_as_c.py
@@ -160,6 +160,32 @@ TARM_WORKAROUND = '''\t\t{
 \t\t},
 '''
 
+COLLECTION_COLOR_WORKAROUND = '''\t\t{
+\t\t\t.color = RGBA(0xe4312bff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0xef7e42ff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0xe4dd52ff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0x9ac546ff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0x46bcc2ff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0x8b65dcff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0x999999ff),
+\t\t},
+\t\t{
+\t\t\t.color = RGBA(0x06d4432ff),
+\t\t},
+'''
+
 
 def round_float_32(f):
     from struct import pack, unpack
@@ -288,6 +314,11 @@ def write_member(fw, indent, b, theme, ls):
                 fw(TARM_WORKAROUND)
             path_old = path_new
             continue
+        if key[0] == b'collection_color':
+            if path_old[0] != b'collection_color':
+                fw(COLLECTION_COLOR_WORKAROUND)
+            path_old = path_new
+            continue
 
         if not is_ignore_dna_name(key[-1]):
             indent = '\t' * (len(path_new) + 1)
-- 
GitLab