Skip to content

Commit 09d19ca

Browse files
committed
Fix: Blender 2.80+ use wrong icons for channel selection on new layer popup
1 parent daab1e9 commit 09d19ca

File tree

5 files changed

+8
-42
lines changed

5 files changed

+8
-42
lines changed

Bake.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,10 +1192,8 @@ def bake_vcol_channel_items(self, context):
11921192
# Add two spaces to prevent text from being translated
11931193
text_ch_name = ch.name + ' '
11941194
# Index plus one, minus one when read
1195-
if hasattr(lib, 'custom_icons'):
1196-
icon_name = lib.channel_custom_icon_dict[ch.type]
1197-
items.append((str(i + 2), text_ch_name, '', lib.get_icon(icon_name), i + 2))
1198-
else: items.append((str(i + 2), text_ch_name, '', lib.channel_icon_dict[ch.type], i + 2))
1195+
icon_name = lib.channel_custom_icon_dict[ch.type]
1196+
items.append((str(i + 2), text_ch_name, '', lib.get_icon(icon_name), i + 2))
11991197

12001198
return items
12011199

@@ -2012,10 +2010,8 @@ def merge_channel_items(self, context):
20122010
counter = 0
20132011
for i, ch in enumerate(yp.channels):
20142012
if not layer.channels[i].enable: continue
2015-
if hasattr(lib, 'custom_icons'):
2016-
icon_name = lib.channel_custom_icon_dict[ch.type]
2017-
items.append((str(i), ch.name, '', lib.get_icon(icon_name), counter))
2018-
else: items.append((str(i), ch.name, '', lib.channel_icon_dict[ch.type], counter))
2013+
icon_name = lib.channel_custom_icon_dict[ch.type]
2014+
items.append((str(i), ch.name, '', lib.get_icon(icon_name), counter))
20192015
counter += 1
20202016

20212017
return items

Layer.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,12 @@ def channel_items(self, context):
2020
items = []
2121

2222
for i, ch in enumerate(yp.channels):
23-
#if hasattr(lib, 'custom_icons'):
2423
# Add two spaces to prevent text from being translated
2524
text_ch_name = ch.name + ' '
26-
if not is_bl_newer_than(2, 80):
27-
icon_name = lib.channel_custom_icon_dict[ch.type]
28-
items.append((str(i), text_ch_name, '', lib.get_icon(icon_name), i))
29-
else: items.append((str(i), text_ch_name, '', lib.channel_icon_dict[ch.type], i))
30-
31-
#if hasattr(lib, 'custom_icons'):
32-
if not is_bl_newer_than(2, 80):
33-
items.append(('-1', 'All Channels', '', lib.get_icon('channels'), len(items)))
34-
else: items.append(('-1', 'All Channels', '', 'GROUP_VERTEX', len(items)))
25+
icon_name = lib.channel_custom_icon_dict[ch.type]
26+
items.append((str(i), text_ch_name, '', lib.get_icon(icon_name), i))
27+
28+
items.append(('-1', 'All Channels', '', lib.get_icon('channels'), len(items)))
3529

3630
return items
3731

Root.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,27 +2561,11 @@ def remove_preview(mat, advanced=False):
25612561
# pass
25622562

25632563
def layer_preview_mode_type_items(self, context):
2564-
#node = get_active_ypaint_node()
2565-
#yp = node.node_tree.yp
2566-
25672564
items = (
25682565
('LAYER', 'Layer', '', lib.get_icon('texture'), 0),
25692566
('MASK', 'Mask', '', lib.get_icon('mask'), 1),
25702567
('SPECIFIC_MASK', 'Specific Mask', '', lib.get_icon('mask'), 2)
25712568
)
2572-
2573-
#for i, ch in enumerate(yp.channels):
2574-
# #if hasattr(lib, 'custom_icons'):
2575-
# if not is_bl_newer_than(2, 80):
2576-
# icon_name = lib.channel_custom_icon_dict[ch.type]
2577-
# items.append((str(i), ch.name, '', lib.custom_icons[icon_name].icon_id, i))
2578-
# else: items.append((str(i), ch.name, '', lib.channel_icon_dict[ch.type], i))
2579-
2580-
##if hasattr(lib, 'custom_icons'):
2581-
#if not is_bl_newer_than(2, 80):
2582-
# items.append(('-1', 'All Channels', '', lib.custom_icons['channels'].icon_id, len(items)))
2583-
#else: items.append(('-1', 'All Channels', '', 'GROUP_VERTEX', len(items)))
2584-
25852569
return items
25862570

25872571
def update_layer_preview_mode(self, context):

lib.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,6 @@
229229
'NORMAL' : 'vector_channel',
230230
}
231231

232-
channel_icon_dict = {
233-
'RGB' : 'KEYTYPE_KEYFRAME_VEC',
234-
'VALUE' : 'HANDLETYPE_FREE_VEC',
235-
'NORMAL' : 'KEYTYPE_BREAKDOWN_VEC',
236-
}
237-
238232
def get_icon_folder():
239233
if not is_bl_newer_than(2, 80):
240234
icon_set = 'legacy'

ui.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,6 @@ def draw_root_channels_ui(context, layout, node):
953953
else: icon_name = 'collapsed_' + icon_name
954954
icon_value = lib.get_icon(icon_name)
955955
row.prop(chui, 'expand_content', text='', emboss=False, icon_value=icon_value)
956-
#else:
957-
# row.prop(chui, 'expand_content', text='', emboss=True, icon=lib.channel_icon_dict[channel.type])
958956

959957
row.label(text=channel.name + ' ' + pgettext_iface('Channel'))
960958

0 commit comments

Comments
 (0)