Fix problem when viewlayer name reach character limit

This commit is contained in:
pullusb
2024-04-22 15:20:17 +02:00
parent 7fa914e438
commit 2251313794
3 changed files with 35 additions and 10 deletions
+11 -6
View File
@@ -334,8 +334,8 @@ def get_set_viewlayer_from_gp(ob, l, scene=None, node_scene=None,
scene = scene or fn.get_render_scene()
node_scene = node_scene or fn.get_compo_scene() or scene
print('Viewlayer Scene: ', scene.name)
print('Compo Scene: ', node_scene.name)
# print('Viewlayer Scene:', scene.name) #Dbg
# print('Compo Scene:', node_scene.name) #Dbg
## If not passed, identical to scene holding viewlayers
@@ -468,11 +468,16 @@ def get_set_viewlayer_from_gp(ob, l, scene=None, node_scene=None,
# cp.location = (top_loc[0], top_loc[1] + 100) # temp location to adjust x loc
# list of layer names in nodes order
rl_names = [n.layer.split(' / ')[1] for n in rl_nodes] # get True layer name from rl
# names with the right order WITH the new layer included
names = [lay.info for lay in ob.data.layers if lay.info in rl_names or lay == l]
# List of layer names in nodes order
rl_names = [n.layer.split(' / ')[1] for n in rl_nodes] # Get True layer name from rl
## Names with the right order WITH the new layer included
# names = [lay.info for lay in ob.data.layers if lay.info in rl_names or lay == l] # <- Character limit problem
## Consider viewlayer name length of 63 char max
char_limit = 63 - len(ob.name + ' / ')
names = [lay.info[:char_limit] for lay in ob.data.layers if lay.info[:char_limit] in rl_names or lay == l]
rl_nodes.append(cp)
# filter by getting index(layer_name)