update active_font_index if out or range

This commit is contained in:
themancalledjakob 2024-08-23 12:28:01 +02:00
parent 4caaa5b687
commit 30235b565c

View file

@ -257,7 +257,14 @@ class ABC3D_text_properties(bpy.types.PropertyGroup):
#TODO: simply, merge, cut cut cut #TODO: simply, merge, cut cut cut
class ABC3D_data(bpy.types.PropertyGroup): class ABC3D_data(bpy.types.PropertyGroup):
available_fonts: bpy.props.CollectionProperty(type=ABC3D_available_font, name="Available fonts") available_fonts: bpy.props.CollectionProperty(type=ABC3D_available_font, name="Available fonts")
active_font_index: bpy.props.IntProperty() def active_font_index_update(self, context):
if len(self.available_fonts) <= self.active_font_index:
self.active_font_index = len(self.available_fonts) - 1
active_font_index: bpy.props.IntProperty(
default=-1,
update=active_font_index_update,
)
available_texts: bpy.props.CollectionProperty(type=ABC3D_text_properties, name="Available texts") available_texts: bpy.props.CollectionProperty(type=ABC3D_text_properties, name="Available texts")
def active_text_index_update(self, context): def active_text_index_update(self, context):
if self.active_text_index != -1: if self.active_text_index != -1: