Skip to content

Commit

Permalink
Remove variant selection when removing relevant variants
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy committed Nov 30, 2023
1 parent 24c54b7 commit eae504d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions usd_qtpy/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ def on_delete_variant_set(self):
if index != -1:
del list_proxy[index]

# Remove variant selection opinion
if variant_set_name in prim_spec.variantSelections:
del prim_spec.variantSelections[variant_set_name]

self.variant_set_deleted.emit()

def on_add_variant(self):
Expand Down Expand Up @@ -287,6 +291,12 @@ def remove_row(layout: QtWidgets.QGridLayout, remove_row):
if variant_spec:
variant_set_spec.RemoveVariant(variant_spec)

# Also remove the variant selection if it's set to the removed
# variant
selected = prim_spec.variantSelections.get(variant_set_name)
if variant_name == selected:
del prim_spec.variantSelections[variant_set_name]

def on_set_edit_target(self, variant_name, state):
"""Callback when a variant is set to be the edit target"""

Expand Down

0 comments on commit eae504d

Please sign in to comment.