Skip to content

Commit 0843753

Browse files
authored
Use config basename as config inner name. (#55)
Closes #52. Signed-off-by: Thomas Mansencal <thomas.mansencal@gmail.com>
1 parent eb59486 commit 0843753

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

opencolorio_config_aces/config/cg/generate/config.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import csv
1414
import logging
15+
import re
1516

1617
import PyOpenColorIO as ocio
1718
from collections import defaultdict
@@ -313,22 +314,26 @@ def config_name_cg(config_mapping_file_path=PATH_TRANSFORMS_MAPPING_FILE_CG):
313314
).format(**dependency_versions(config_mapping_file_path))
314315

315316

316-
def config_description_cg():
317+
def config_description_cg(
318+
config_mapping_file_path=PATH_TRANSFORMS_MAPPING_FILE_CG,
319+
):
317320
"""
318321
Generate the ACES* Computer Graphics (CG) *OpenColorIO* config
319322
description.
320323
324+
Parameters
325+
----------
326+
config_mapping_file_path : str, optional
327+
Path to the *CSV* mapping file.
328+
321329
Returns
322330
-------
323331
str
324332
ACES* Computer Graphics (CG) *OpenColorIO* config description.
325333
"""
326334

327-
header = (
328-
f'The "Academy Color Encoding System" (ACES {version_aces_dev()}) '
329-
f'"CG Config"'
330-
)
331-
underline = "-" * len(header)
335+
name = config_name_cg(config_mapping_file_path)
336+
underline = "-" * len(name)
332337
description = (
333338
'This minimalistic "OpenColorIO" config is geared toward computer '
334339
"graphics artists requiring a lean config that does not include "
@@ -339,7 +344,7 @@ def config_description_cg():
339344
f'on the {datetime.now().strftime("%Y/%m/%d at %H:%M")}.'
340345
)
341346

342-
return "\n".join([header, underline, "", description, "", timestamp])
347+
return "\n".join([name, underline, "", description, "", timestamp])
343348

344349

345350
def generate_config_cg(
@@ -412,8 +417,10 @@ def generate_config_cg(
412417
transform_data
413418
)
414419

415-
data.name = config_name_cg(config_mapping_file_path)
416-
data.description = config_description_cg()
420+
data.name = re.sub(
421+
r"\.ocio$", "", config_basename_cg(config_mapping_file_path)
422+
)
423+
data.description = config_description_cg(config_mapping_file_path)
417424

418425
def multi_filters(array, filterers):
419426
"""Apply given filterers on given array."""

opencolorio_config_aces/config/reference/generate/config.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,22 +1111,26 @@ def config_name_aces(
11111111
).format(**dependency_versions(config_mapping_file_path))
11121112

11131113

1114-
def config_description_aces():
1114+
def config_description_aces(
1115+
config_mapping_file_path=PATH_TRANSFORMS_MAPPING_FILE_REFERENCE,
1116+
):
11151117
"""
11161118
Generate the *aces-dev* reference implementation *OpenColorIO* Config
11171119
description.
11181120
1121+
Parameters
1122+
----------
1123+
config_mapping_file_path : str, optional
1124+
Path to the *CSV* mapping file.
1125+
11191126
Returns
11201127
-------
11211128
str
11221129
*aces-dev* reference implementation *OpenColorIO* Config description.
11231130
"""
11241131

1125-
header = (
1126-
f'The "Academy Color Encoding System" (ACES {version_aces_dev()}) '
1127-
f'"Reference Config"'
1128-
)
1129-
underline = "-" * len(header)
1132+
name = config_name_aces(config_mapping_file_path)
1133+
underline = "-" * len(name)
11301134
description = (
11311135
'This "OpenColorIO" config is a strict and quasi-analytical '
11321136
'implementation of "aces-dev" and is designed as a reference to '
@@ -1139,7 +1143,7 @@ def config_description_aces():
11391143
f'on the {datetime.now().strftime("%Y/%m/%d at %H:%M")}.'
11401144
)
11411145

1142-
return "\n".join([header, underline, "", description, "", timestamp])
1146+
return "\n".join([name, underline, "", description, "", timestamp])
11431147

11441148

11451149
def generate_config_aces(
@@ -1387,8 +1391,10 @@ def generate_config_aces(
13871391
)
13881392

13891393
data = ConfigData(
1390-
name=config_name_aces(config_mapping_file_path),
1391-
description=config_description_aces(),
1394+
name=re.sub(
1395+
r"\.ocio$", "", config_basename_aces(config_mapping_file_path)
1396+
),
1397+
description=config_description_aces(config_mapping_file_path),
13921398
roles={
13931399
ocio.ROLE_COLOR_TIMING: f"{aces_family_prefix} - ACEScct",
13941400
ocio.ROLE_COMPOSITING_LOG: f"{aces_family_prefix} - ACEScct",

0 commit comments

Comments
 (0)