normalize layer name: convert points to underscore

main
pullusb 2023-06-07 12:13:50 +02:00
parent 3a014e077e
commit 04d6349d1c
2 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,7 @@ Activate / deactivate all masks using MA layers
1.3.3 1.3.3
- fixed: problem evaluating broken modifier target - fixed: problem evaluating broken modifier target
- added: normalize layer name now convert points to underscore
1.3.2 1.3.2

4
fn.py
View File

@ -980,7 +980,7 @@ def normalize(text):
return text.lower().replace('-', '_') return text.lower().replace('-', '_')
PATTERN = r'^(?P<grp>-\s)?(?P<tag>[A-Z]{2}_)?(?P<name>.*?)(?P<sfix>_[A-Z]{2})?(?P<inc>\.\d{3})?$' # numering PATTERN = r'^(?P<grp>-\s)?(?P<tag>[A-Z]{2}_)?(?P<name>.*?)(?P<sfix>_[A-Z]{2})?(?P<inc>\.\d{3})?$' # numering
def normalize_layer_name(layer, prefix='', desc='', suffix='', lower=True, dash_to_underscore=True, get_only=False): def normalize_layer_name(layer, prefix='', desc='', suffix='', lower=True, dash_to_underscore=True, point_to_underscore=True, get_only=False):
'''GET a layer and argument to build and assign name''' '''GET a layer and argument to build and assign name'''
import re import re
@ -1022,6 +1022,8 @@ def normalize_layer_name(layer, prefix='', desc='', suffix='', lower=True, dash_
name = name.lower() name = name.lower()
if dash_to_underscore: if dash_to_underscore:
name = name.replace('-', '_') name = name.replace('-', '_')
if point_to_underscore:
name = name.replace('.', '_')
new = f'{grp}{tag}{name}{sfix}' # lower suffix ? new = f'{grp}{tag}{name}{sfix}' # lower suffix ?
if get_only: if get_only: