Jump to content

ftrack-connect-nuke New Assets Prompt


tokejepsen

Recommended Posts

Posted

Hey,

We have had a lot of issues with the consistency of prompting users in Nuke when there are new asset versions available.

It seems to usually be when you launch Nuke, that the prompt does not appear. If you have launched Nuke and open another comp, it seems to prompt the user correctly.

I'm wondering whether the callback "onScriptLoad" is not being execute when you launch Nuke and pass a nuke script to the Nuke executable.

Posted

Hi Toke, thank your for bringing up this.

Quote

I'm wondering whether the callback "onScriptLoad" is not being execute when you launch Nuke and pass a nuke script to the Nuke executable.

Are you launching Nuke manually with the ftrack plugin + a script as a launch argument?

Posted
3 hours ago, Mattias Lagergren said:

Are you launching Nuke manually with the ftrack plugin + a script as a launch argument?

Yes, I'm passing the Nuke executable a script, with the launch arguments.

Posted
44 minutes ago, lorenzo.angeli said:

Hi @Toke Jepsen I'm currently looking into this issue.
Could you please provide the snippet you are using in your custom hook to load the nuke file ?

Thanks.

L.

Hey Lorenzo,

Its passing a file to the Nuke executable by modifying the command of the Nuke hook. It basically gets boiled down to this:
 

import ftrack


def modify_application_launch(event):
    """Modify the application launch command with potential files to open"""

    data = event["data"]
    data["command"].append("path/to/nuke/script")
    return data


def register(registry, **kw):
    """Register location plugin."""

    # Validate that registry is the correct ftrack.Registry. If not,
    # assume that register is being called with another purpose or from a
    # new or incompatible API and return without doing anything.
    if registry is not ftrack.EVENT_HANDLERS:
        # Exit to avoid registering this plugin again.
        return

    ftrack.EVENT_HUB.subscribe(
        "topic=ftrack.connect.application.launch",
        modify_application_launch
    )

EDIT: Updated with reduce code example.

Posted

Hi @tokejepsen

found a workaround for now, see whether does work for you.

# in your hook
def get_task_data(event):
    cwd = os.path.dirname(__file__)
    data = event["data"]
    data["command"].append(os.path.join(cwd, 'fileload.py'))
    return data

 

 

# in the same folder in a file called fileload.py
from ftrack_connect_nuke.ui.legacy import scan_for_new_assets

import nuke

nuke.addOnScriptLoad(scan_for_new_assets)
nuke.scriptOpen('/home/efesto/Desktop/<myfile>.nk')


I'll keep checking for a better solution but I'm not sure whether this is a nuke or an ftrack issue.

Please let me know if this does work for the time being.

L.

 

Posted

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...