Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profiles to 'CollectFramesFixDef' settings #839

Conversation

MustafaJafar
Copy link
Contributor

@MustafaJafar MustafaJafar commented Aug 7, 2024

Changelog Description

Add profiles to 'CollectFramesFixDef' settings
image

Additional info

This PR is the twin of Houdini's PR ynput/ayon-houdini#45

Testing notes:

  1. In Nuke, 'CollectFramesFixDef' should works as usual.
  2. In Houdini, you should be able to see frames to fix in the publisher UI. (but, it won't fix anything without the mentioned PR above )

@MustafaJafar MustafaJafar added the type: enhancement Improvement of existing functionality or minor addition label Aug 7, 2024
@MustafaJafar MustafaJafar self-assigned this Aug 7, 2024
@ynbot ynbot added the size/XS label Aug 7, 2024
Copy link
Member

@moonyuet moonyuet Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to create a new class to inherit from CollectFramesDef class for Houdini? Something like:

class CollectFramesFixDefHou(CollectFramesDef):
    """Provides text field to insert frame(s) to be rerendered for Houdini host.
    Published files of last version of an instance product are collected into
    instance.data["last_version_published_files"]. All these but frames
    mentioned in text field will be reused for new version.
    """
    label = "Collect Frames to Fix (Houdini)"
    hosts = ["houdini"]
    families = ["*"] 
    rewrite_version_enable = False

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool idea but I still need to expose families to settings which will seem like we are duplicating the settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine implementing your idea as the following snippet:
and then I can add the dedicated settings in Houdini's addon.

from ayon_core.plugins.publish.collect_frames_fix import CollectFramesDef

class CollectFramesFixDefHou(CollectFramesDef):
  """Provides text field to insert frame(s) to be rerendered for Houdini host.
  Published files of last version of an instance product are collected into
  instance.data["last_version_published_files"]. All these but frames
  mentioned in text field will be reused for new version.
  """
  label = "Collect Frames to Fix (Houdini)"
  hosts = ["houdini"]   # Note how I still need to define `hosts` as I'm not using `plugin.HoudiniInstancePlugin`
  families = ["*"] 
  rewrite_version_enable = False

Copy link
Member

@moonyuet moonyuet Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess this is the better temp solution if you want it to be specific as Houdini validator. But like @iLLiCiTiT said, it requires some discussion.
But I just want to add that the profile setting broke something in unreal publisher when I was using this branch to build the addon setting and put it into server.
The profile settings may not be the best options for this case as it affects all hosts.
image

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Aug 8, 2024

To be honest I don't know how to handle these plugins. From my point of view the plugin should have only families filter without any settings. And some plugin in nuke, houdini, whatever should add the family to instance if this should happen. This topic requires more discussion.

The issue is, that if you enable this plugin for nuke, only nuke addon knows what instances (families) should be handled with this plugin, it is not something that a TD who is changing the settings should know. The same for houdini, how do TD know which families he should (can) set?

@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented Aug 8, 2024

To be honest I don't know how to handle these plugins. From my point of view the plugin should have only families filter without any settings. And some plugin in nuke, houdini, whatever should add the family to instance if this should happen. This topic requires more discussion.

I think it might fail
Because, sometimes we use the same families names in different hosts, which may lead to undesired results.

The issue is, that if you enable this plugin for nuke, only nuke addon knows what instances (families) should be handled with this plugin, it is not something that a TD who is changing the settings should know. The same for houdini, how do TD know which families he should (can) set?

Totally agreed!
I'm not sure if this can be solved in this PR.


I've provided more info in my reply on discord.

@moonyuet
Copy link
Member

Any update on this PR or?

@iLLiCiTiT
Copy link
Member

Discussion is still alive. Is this feature that should be already done (for client)? If yes then please create houdini equivalent of the plugin in houdini addon please.

@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented Aug 19, 2024

Closing this PR in favor of #839 (comment) .. I've copied the plugin to my ayon-houdini PR ynput/ayon-houdini#45.

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 3, 2024

Can we make this part of the "Extended Publisher" target @dee-ynput @iLLiCiTiT ? Or find another spot to track this well enough.

I understand the reason to moe this to ayon-houdini for now, but we're basically duplicating logic that we prefer to be shared between host integrations so that we don't need to redo this, each time. The more this remains, the harder it is to maintain but also to develop and maintain this feature for other existing host integrations or future host integrations since we'd just be rolling 'their own' for all otherwise.

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 3, 2024

@MustafaJafar can we for now, maybe, in core split the current functionality of this plug-in here in two.

  1. We keep the CollectFramesToFix plug-in, yet ALL it does is set:
instance.data["frames_to_fix"] = blabla
instance.data["rewrite_to_last_version"] = True

Do note that I believe there are other ways of specifying that you want to write into the existing version, e.g. wouldn't just setting instance.data["version"] = previous_version do that in a way?

  1. We have the other plug-in, that runs over all instances, regardless and whenever it finds that data THEN it does what the rest of the plug-in does now, like a ApplyFramesToFix plugin at collect stage that does whatever other logic is needed.

By doing so, we can still "move" Houdini-specific logic for the time being, but ALL we'd be putting there is a CollectFramesToFixHoudini that ONLY has to set that instance.data.

I believe we can even do this:

import ayon_core.plugins.publish.collect_frames_fix as frames_fix

class CollectFramesToFixHoudini(frames_fix.CollectFramesToFix):
    hosts = ["houdini"]
    families = ["*"]

Or create a dedicated 'base class' for now in some other place in core if we don't even want to duplicate the instance attribute definitions and WHAT attributes it sets on instance.data - that can then all live and be maintained in ayon-core. But we only specify the families for then in ayon-houdini.

And then we should also move this logic out of nuke... and into something "dedicated" for that frames_to_fix behavior that works across the board.

@MustafaJafar
Copy link
Contributor Author

@BigRoy Your idea makes sense. let me give it a try.

@MustafaJafar MustafaJafar reopened this Sep 6, 2024
@MustafaJafar MustafaJafar marked this pull request as draft September 6, 2024 09:53
@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented Sep 6, 2024

or maybe I'll do it in another PR. but could we have an issue for it?

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Sep 6, 2024

Could we rather make it family based on ayon-core with backwards compatibility?

class CollectFramesToFix(CollectFramesToFix):
    families = ["ayon.fix.frames"]

    ...Implementation...


# Backwards compatibility
class CollectFramesToFixOld(CollectFramesToFix):
    hosts = ["nuke"]
    families = ["render", "prerender"]

So only thing houdini has to do, is to add "ayon.fix.frames" to instance.data["families"].

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 6, 2024

Could we rather make it family based on ayon-core with backwards compatibility?

class CollectFramesToFix(CollectFramesToFix):
    families = ["ayon.fix.frames"]

    ...Implementation...


# Backwards compatibility
class CollectFramesToFixOld(CollectFramesToFix):
    hosts = ["nuke"]
    families = ["render", "prerender"]

So only thing houdini has to do, is to add "ayon.fix.frames" to instance.data["families"].

Almost - because the publisher UI won't show attributes for 'dynamic' families like that, only for the product type. Also, that'd mean that the ayon.fix.frames should be present on the CreatedInstance already?

Becuase preferably you'd even share the input field itself among them, yes? So that tooltip etc. is all maintained in one place?

@iLLiCiTiT
Copy link
Member

Ok, I see this is more important than I thought #860

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Sep 9, 2024

Ok, I see this is more important than I thought #860

Just realized this might not solve the issue.

Another issue is importing plugin from ayon_core/plugins/publish/. If we need to import something it should be in ayon_core/pipeline/publish/. Plugins should never be imported.

NOTE:
We might split the logic into 2 plugins, first would be same as my suggestion. Second would be to change hosts and families filtering to show definitions, it would store it to instance and add "ayon.fix.frames" family. This plugin base would be in ayon_core/pipeline/publish/ and imported where needed to change hosts and families.

@dee-ynput
Copy link

but could we have an issue for it?

Here it is: #879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants