Open shotgun panel on new file (nuke)

Hello,

I’m trying to Open the shotgun panel with current entity context and show the “Notes” tab when creating a new file in nuke.
so, I’ve added the following code in hooks/tk-multi-workfiles2/scene_operation_tk-nuke.py
when parent_action == "new_file" and operation == "prepare_new"

panel_app = engine.apps["tk-multi-shotgunpanel"]
# Open the Shotgrid panel on current entity as dialog
panel_app.navigate(
    context.entity["type"],
    context.entity["id"],
    panel_app.DIALOG
 )
# Select notes tab
tab_index = panel_app._current_dialog.ENTITY_TABS.index(
    panel_app._current_dialog.ENTITY_TAB_NOTES
)
panel_app._current_dialog.ui.entity_tab_widget.setCurrentIndex(tab_index)

But the shotgun panel takes quite a while to refresh when launched from the shotgrid browser/file manager (more that it takes when launched without the shotgrid browser with the same code) and also I’ve some random crashes when I change the tab index.

I’ve tested with the latest versions of the shotgun panel and framework widgets.

Do you have any ideas to fix my issues ?

Thank you,

Louise

Hello,

So, I made some progress.

  • For the “panel takes quite a while to refresh”, it’s just in one of our project, it’s fast in other projects, so another thing to debug…

  • For the crashes, I managed to find the source, it was when applying stylesheet on the widget creation, not the first time but the times after.

And it seems that I’m not the only one who experienced these crashes in Nuke >= 12
there is some code to apply the stylesheet in defer mode in tk-nuke when created as a nuke panel

I investigated a little more to find that it would come from the ActivitySreamWidget from tk-framework-qtwidgets.

If I add a self.setStyleSheet(“”) as first line in in destroy() and _clear() methods, I don’t have crashes anymore.

1 Like