I have created a Frame Range validator for Fusion but the way Fusion’s publish plugins are setup the validator would need to be run first of all. There are a bunch of collectors that uses fusions frame range to calculate handles and so on.
I would need 3 different options for the validator: Force range = It sets the frame range and handles to the contexts properties without any user input Validate range = Check if the frame range is correct, else throw validation error Ignore range = Render as is. Can be needed for special plate-renders that need longer ranges than the comp.
(Fusion renders all instances at the same time, thus the range is handled in the context)
Bonus question:
In the publisher you first have collectors and then validators but is it ok to have a validator run first of all?
Or should this functionality be built into a collector instead?
Any thoughts on this?
The collectors should not validate, they should collect the scene state and should try and not raise any errors, that’s up to validators.
The validators should validate whether your scene state is as intended. It should clearly report to the user what is invalid and preferably propose solutions to solve the issue.
The new publisher can define UI attribute per Creator but also per plug-in. That works for any plug-in, Collectors, Validators Extractors, Integrators and for both Context plugins and for Instance plugins. All that is needed is to implement get_attribute_defs method on the plugins, like in the OptionalPyblishPluginMixin.
From your example I am not sure why the Validator needs to run first. Could you elaborate why you think it must? Note that context and instance plugins can run at any order.
Your particular customizable setting sounds like something that a studio might not want to allow per instance but have fixed settings for in production.
Edit: reading it again I think I now understand what you meant with validator/collector order. The forced frame range setting you proposed would have to adjust the frame range of the instance.
Honestly, I’d just see it as:
There is a validator whether frame range of an Instance matches the asset entity. This can be optional (or maybe enforced by a studio using system settings by disabling the optional state of it or remove it completely by tweaking the enabled state of the plugin.)
The instance frame range collector can have three modes: use comp range, use asset document range, use custom range.
I feel like that would cover all the cases just as well and keeps the validator succinct.
Fusion renders all instances at the same time, thus the range is handled in the context
This is something I will make a PR for to resolve too so that the user can customize frame range per saver if needed.
Thanks - for what it’s worth and as far as I know the exact case @Danell asked about here ended up getting solved differently. Instead of “validating” the actual Creators ended up getting attributes that are able to ‘collect’ the time from the different cases.