fix empty names - set color
1.1.1 - changed: autobuild beta - added: autobuild: fix layer name with empty desc (only prefix) - added: autobuild: Set layer color autoamtically (if not some already there)
This commit is contained in:
@@ -1544,4 +1544,36 @@ def set_scene_output_from_active_fileout_item():
|
||||
if attr.startswith('__') or attr.startswith('bl_') or attr in excluded:
|
||||
continue
|
||||
if hasattr(scn.render.image_settings, attr) and not scn.render.image_settings.is_property_readonly(attr):
|
||||
setattr(scn.render.image_settings, attr, getattr(fmt, attr))
|
||||
setattr(scn.render.image_settings, attr, getattr(fmt, attr))
|
||||
|
||||
|
||||
def set_layer_colors(skip_if_colored=False):
|
||||
'''Set hardcoded color to grease pencil layer channel according to prefixes'''
|
||||
|
||||
## UW -> TO (here used fo CU): (0.015996, 0.246201, 0.246201) # Indigo
|
||||
## invisible (close to violet light) in UW: (0.246201, 0.132868, 0.496933)
|
||||
prefix_color = {
|
||||
# 'MA_': (0.09, 0.08, 0.46), # Vivid blue
|
||||
'MA_': (0.65, 0.4, 0.6), # Pink Light
|
||||
|
||||
'FX_': (0.12, 0.33, 0.58), # (0.3, 0.49, 0.63) # Blue Light
|
||||
# 'CO_': (0.35, 0.0085, 0.25),
|
||||
'CO_': (0.5,0.1,0.5), # Clear Pink
|
||||
# 'CU': (0.092070, 0.177356, 0.447959), # Blue clear
|
||||
'CU_': (0.02, 0.27, 0.27), # Indigo
|
||||
}
|
||||
|
||||
for ob in bpy.context.scene.objects:
|
||||
if ob.type != 'GPENCIL':
|
||||
continue
|
||||
if skip_if_colored and any([has_channel_color(l) for l in ob.data.layers]):
|
||||
continue
|
||||
for l in ob.data.layers:
|
||||
# if l.info.startswith(prefix_color.keys()):
|
||||
color = prefix_color.get(l.info[:3])
|
||||
if not color:
|
||||
continue
|
||||
print(l.info, '->', color)
|
||||
l.channel_color = color
|
||||
|
||||
bpy.context.preferences.edit.use_anim_channel_group_colors = True
|
||||
Reference in New Issue
Block a user