From 79e2e058f3108b6505fa1d59bcd5ae399c7a7655 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Fri, 1 Oct 2021 12:58:46 +0200 Subject: [PATCH] fix rename lowercase with target modifier 0.5.2 - fix: `rename lowercase` also change modifier layer target names (else target was broken) --- CHANGELOG.md | 4 ++++ README.md | 6 +++--- __init__.py | 2 +- fn.py | 11 ++++++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a77256b..f61bc88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ Activate / deactivate layer opaticty according to prefix Activate / deactivate all masks using MA layers --> +0.5.2 + +- fix: `rename lowercase` also change modifier layer target names (else target was broken) + 0.5.1 - feat: reconnect existing sockets inside nodegroups with clean nodes > re-order diff --git a/README.md b/README.md index cc6c24a..a8d4533 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,12 @@ ## Todo -- on renaming, correct also names in GP modifiers !!! - opt: multi-merge : also merge merged NG automatically disabling AA without group (or externalise AA node ?) - opt : How to disable main output -- To add : Reconnect inside nodegroup for nodes when using clean nodes ## Done - set exlude VL on non-used layers - set real AA nodegroup -- disable all masks (with filter) \ No newline at end of file +- disable all masks (with filter) +- Reconnect inside nodegroup for nodes when using clean nodes +- on renaming, correct also names in GP modifiers \ No newline at end of file diff --git a/__init__.py b/__init__.py index aedc594..39291da 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ bl_info = { "name": "GP Render", "description": "Organise export of gp layers through compositor output", "author": "Samuel Bernou", - "version": (0, 5, 1), + "version": (0, 5, 2), "blender": (2, 93, 0), "location": "View3D", "warning": "", diff --git a/fn.py b/fn.py index 7f0109f..661cbf4 100644 --- a/fn.py +++ b/fn.py @@ -723,8 +723,17 @@ def normalize_layer_name(layer, prefix='', desc='', suffix='', lower=True, dash_ new = f'{grp}{tag}{name}{sfix}' # lower suffix ? if new != layer.info: - print(f'{layer.info} >> new') + old = layer.info + print(f'{old} >> {new}') layer.info = new + + # Also change name string in modifier target ! + for ob in [o for o in bpy.data.objects if o.type == 'GPENCIL' and o.data == layer.id_data]: + for m in ob.grease_pencil_modifiers: + if hasattr(m, 'layer') and m.layer: + if m.layer == old: + print(f' - updated in {ob.name} modifier {m.name}') + m.layer = new ## confirm pop-up message: def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'):