OpenPype icon indicating copy to clipboard operation
OpenPype copied to clipboard

Enhancement: Provide optionality for pre launch hooks

Open kalisp opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Please describe the feature you have in mind and explain what the current shortcomings are?

There is no way how to configure triggering state for pre launch hooks in the Settings, imho.

It might be good to provide functionality to disable some pre-launch hooks if necessary.

How would you imagine the implementation of the feature?

I don't think it is completely necessary for PreLaunchHook to mimic regular plugins (that Settings would be applied automatically). It might be enough to figure out:

  • where to put configuration for pre-launch hook to the Settings
  • provide example how to access Setting (might not be so simple, maybe)

Are there any labels you wish to add?

  • [X] I have added the relevant labels to the enhancement request.

Describe alternatives you've considered:

No response

Additional context:

No response

[cuID:OP-7979]

kalisp avatar Jan 08 '24 14:01 kalisp

  • provide example how to access Setting (might not be so simple, maybe)

The hooks have access to e.g. self.data["project_settings"] - would that suffice? Currently some hooks do check e.g. settings I believe to skip itself for certain scenarios. Something like:

class MyLaunchHook(..):
    def execute(self):
        if not self.data["project_settings"]["myfeature_enabled"]:
            return

BigRoy avatar Jan 08 '24 15:01 BigRoy

I think this would cover the scenario if you wanted to make a hook optional. This would be good to add to dev docs on ayon.ynput.io.

@kalisp maybe you could tackle it considering you've opened this up?

mkolar avatar Feb 08 '24 22:02 mkolar