Skip to content

Commit

Permalink
python/tk_multi_loader: add comments in reselecting
Browse files Browse the repository at this point in the history
  • Loading branch information
awierzchowski authored and JeanChristopheMorinRodeoFX committed Jan 12, 2016
1 parent 4560212 commit 7a85ae0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/tk_multi_loader/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,9 @@ def _on_home_clicked(self):
found_preset = self.ui.entity_preset_tabs.tabText(0)

if found_model and found_item:
# store current selection data in case model is refreshed. If this happens selection will be lost
# and user will have to press home again. This data will be used in SgEntityModel to restore
# selection after new data is fed into model.
found_model.reSelector['entity'] = found_item.get_sg_data()
found_model.reSelector['found_preset'] = found_preset
found_model.reSelector['sel_func'] = self._select_item_in_entity_tree
Expand Down
6 changes: 6 additions & 0 deletions python/tk_multi_loader/model_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def __init__(self, parent, entity_type, filters, hierarchy, bg_task_manager):
fields=["image", "sg_status_list", "description"]
self._load_data(entity_type, filters, hierarchy, fields)

# this dict holds entity which was selected in dialog after model was filled. This selection
# is result of self._on_home_clicked() executed at last line of _load_entity_presets()
# reSelector will be used only once in data_refreshed_cb to restore selection if items in model
# were destroyed and created again as result of differences between local shotgun disc cache
# and actual shotgun data
# see __on_sg_data_arrived(...) in class ShotgunModel
self.reSelector = {'entity': None,
'found_preset': None,
'dialog': parent,
Expand Down

0 comments on commit 7a85ae0

Please sign in to comment.