Updating "WIN Path to Frames" value when "Path to Frames" is filled for an entity

Hello.

I am new to writing a plugin for Shotgun and I’m trying to write a plugin in Python so that when the “Path to Frames” value is filled in with the Linux path for an entity, the “WIN Path to Frames” value is automatically filled in with the Windows version of that Linux path, and vice-versa.

Can someone give me some guidance or tips for writing this plugin?

Explanations or even sample codes may be helpful.

Thank you in advance.

You will need to run an event daemon to be able to react to SG events with custom code, best to just grab this and follow the instructions:

There are some good examples in there as well. Your use case is super simple so getting the daemon up and runing will be the bulk of the work.

I guess webhooks could also be used but I have not yet looked into those myself.

Cheers,
frank

Hi, Frank. Thank you for your response.

Two things:

  1. I already figured out that I would need to write an event daemon for this, so thanks for the confirmation. And you mentioned that in the link you provided that there are examples in there. Where? I can’t find any examples of that code being used - there’s just codes in there…

  2. And as for the event daemon, I’m guessing that I’ll have to make a “registerCallbacks(reg)” function like the following skeleton code?:

def registerCallbacks(reg):
    args = {...}

    event_filter = {f'Shotgun_{args.get("entity_type")}_Change': [args.get('sg_p2f'),
                                                                                                                args.get('sg_p2m')]}

    # Register our callback with the Shotgun_%s_Change event and tell the logger
    # about it.
    reg.registerCallback(SCRIPT_NAME, SCRIPT_KEY, lin2win, event_filter, args)
    reg.logger.debug("Registered callback: lin2win.py")

def lin2win(sg, logger, event, args):
   ...

If there’s anything you can suggest I add to the above skeleton code, I’d love to hear it.

Thanks again.