[solved] Plugins display when no compatible families are present

I think we had a discussion about whether to have context as an argument when processing the instance, and the conclusion was that you should have it as an argument instead of accessing it through the instance; instance.context.

Accessing the context through the instance would solve this problem.

Does this happen in the latest pyblish-win release, or is this new?

It certainly is. :slight_smile: In general, the workflow for bugs; first here, and then an issue if needed.

The problem is probably from Pyblish itself, either here in the current pyblish-win release (1.2) or here for the current latest. This function decides what plug-ins are compatible with a given instance.

Not using pyblish-win. I have the latest commits of all repos.

When it comes to bugs, and you aren’t using the current release, it’s better to talk about it outside of the forums, as they might apply only to you and only in this particular instance. That is, the information provided to fix the issue might not apply in the next release. A good place it on Gitter.

It’s worth having a look in the current release when you encounter a bug, to see if it’s new. It’ll narrow down the search as well.

And just so it’s obvious; it is recommended that you work with the versions released in pyblish-win or pyblish-x. They’re the stable release. It makes it easier and more centralised to handle bug reports such as these.

I just updated from pyblish-win 1.2.5 to 1.2.6 and this bug started happening to us, so it’s certainly something in the latest release.

I seem to have a related issue her, which actually breaks our workflow completely in the 1.2.6.

I have a collector that runs on an instance and context. It’s offset to the end of collectors queue to make sure instances already exists. It adds data to the instances based on their families or task type we’re in.

After the update it shows among the collectors, however it doesn’t run, hence much needed data doesn’t get attached to the instances. It’s a simple plugin that can be distilled to this

import pyblish.api

@pyblish.api.log
class CollectFtrackAsset(pyblish.api.Collector):

    """ Adds ftrack asset information to the instance
    """

    order = pyblish.api.Collector.order + 0.41
    label = 'Asset Attributes'

    def process(self, instance, context):

        # skipping instance if ftrackData isn't present
        if not context.has_data('ftrackData'):
            self.log.info('No ftrackData present. Skipping this instance')
            return

        # skipping instance if ftrackComponents isn't present
        if not instance.has_data('ftrackComponents'):
            self.log.info('No ftrackComponents present. Skipping this instance')
            return

        ftrack_data = context.data['ftrackData'].copy()

        instance.data['ftrackAssetName'] = ftrack_data['Task']['name']

        task_type = ftrack_data['Task']['type'].lower()

        # task type filtering
        if task_type == 'lighting':
            asset_type = 'render'
        if task_type == 'compositing':
            asset_type = 'img'

        # family filtering
        if 'camera' in instance.data['family']:
            asset_type = 'cam'

        instance.data['ftrackAssetType'] = asset_type

It just shows as white in the collectors whatever I do to it. I tried pulling context directly from instance, but that didn’t work either.

Thanks for confirming this @mkolar.

The quickest thing to do is to revert to 1.2.5 for now, this will be fixed in the next release.

I can’t test at the moment, but something like this should do it.

cd pyblish-win
git reset --hard 1.2.5
git submodule update --init
git submodule foreach --recursive git reset --hard

Alternatively, clone directly from the 1.2.5 tag.

Can confirm that having an instance for an argument for a collector plugin, will cause it to not run. @marcus would this be a separate issue we need to track?

As a workaround you could input only the context, and iterate over the instances instead:

class CollectContextInstance(pyblish.api.Collector):
    def process(self, context):
        print context
        for instance in context:
            print instance

Yes that works well and is a quick fix.

Looks like a separate issue to me as well.

Yeah, it does sound like it. Could you set one up?

Is it a pyblish-qml issue or pyblish-base?

Good question! I don’t know, if you be great if you could find out.

This should reveal whether QML is involved.

import pyblish.util
context = pyblish.util.publish()

It seems to be in pyblish-base.

Has this been resolved?

The reproducible example at the start of this topic runs correctly in 1.3.2. The Validator only shows when a family is present of otherFamily, otherwise it is ignored. As such in that exact example the Validator is skipped/ignored as opposed to its original behavior where they “wrongly” were displayed.

Seems fixed.

Cool, thanks.

@tokejepsen, could you mark this as [solved] if this works for you?

Actually the process(self, instance, context) variation works, but only with context it doesn’t. Then it’s the same problem as ContextPlugin running when instance of family not present

To reproduce with Validator as opposed to ContextPlugin:

import pyblish.api
import pyblish_integration


class CollectInstance(pyblish.api.Collector):
    
    def process(self, context):
        
        context.create_instance("Some Instance", family="someFamily")

class ValidatorWithoutInstance(pyblish.api.Validator):
    
    families = ["otherFamily"]
    
    def process(self, context):
        
        pass


pyblish.api.register_plugin(CollectInstance)
pyblish.api.register_plugin(ValidatorWithoutInstance)

pyblish_integration.show()

Marking this thread as solved, as the original reproducable has been solved.