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

@ -13,4 +13,19 @@ class BakeToIDMapPanel(bpy.types.Panel):
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
self.layout.operator("object.bake_to_id_map", text="Bake")
props = context.scene.bake_to_id_props
operator_row = layout.row()
operator_row.operator("object.bake_to_id_map", text="Bake")
operator_row.enabled = self.check_if_props_valid(context, props)
layout.prop(props, "selection_mode")
def check_if_props_valid(self, context, props):
if (props.selection_mode == "SINGLE" and context.active_object is None):
return False
if (props.selection_mode != "SINGLE" and len(context.selected_objects) < 1):
return False
return True