adds option for different selection modes

This commit is contained in:
Michel Fedde 2024-01-30 20:19:58 +01:00
parent 53366cc71d
commit 060612d789
7 changed files with 95 additions and 15 deletions

View file

@ -19,5 +19,28 @@ class BakeToIDInfoPanel(bpy.types.Panel):
source = get_source(props.source)
layout.label(text="Selected Object-Count: " + str(len(context.selected_objects)))
layout.label(text="Estimated ID-Count: " + str(source.estimate_ids(context, props)))
if props.selection_mode != 'SINGLE':
layout.label(text="Selected Object-Count: " + str(len(context.selected_objects)))
layout.separator()
if props.selection_mode == 'SINGLE':
layout.label(text="ID-Total: " + str(source.estimate_ids([context.active_object])))
if props.selection_mode == 'MULTIPLE_SEPARATE':
total = 0
count = 0
for obj in context.selected_objects:
if (obj.type != 'MESH'):
continue
total += source.estimate_ids([obj])
count += 1
layout.label(text="Estimated ID-Total: " + str(total))
try:
layout.label(text="Estimated ID-Average: " + str(total / count))
except ZeroDivisionError:
layout.label(text="Estimated ID-Average: 0")
if props.selection_mode == 'MULTIPLE_COMBINED':
layout.label(text="ID-Total: " + str(source.estimate_ids(context.selected_objects)))