ContextPlugin running when instance of family not present


#1

Problem

A ContextPlugin with families specified will run when there’s no instance with that family.

import pyblish.api

class ValidateModelOrRig(pyblish.api.ContextPlugin):
    order = pyblish.api.ValidatorOrder
    label = "Run only for family of model or rig"
    families = ['model', 'rig']

    def process(self, context):
        self.log.warning("Processing Model or Rig")

The above will show up in the GUI and will actually process even when no instance of model or rig is present, but another is (e.g. foobar). The above will also run when there are no instances at all.

Expected

I’d expect anything with families specified should only run when at least one instance is available with at least one of those families.

As such the above should only run if there are instances present of family rig and/or model. When those are present it should run only once, like any ContextPlugin.


Tested in version Pyblish 1.31


[solved] InstancePlugin not running as Collector?
#2

Fixed

This seems to be fixed with the latest update 1.3.2 with the fix for InstancePlugin not running as Collector in this issue.

Note that this current release shows the version of pyblish-base as opposed to pyblish so GUI might show 1.3.1, as stated here.


[solved] Plugins display when no compatible families are present
#3

Not fixed?

Had another look at this and this actually seems to still be an Issue and working incorrectly.

To reproduce

import pyblish.api


class CollectInstanceTest(pyblish.api.ContextPlugin):
    order = pyblish.api.CollectorOrder

    def process(self, context):
        context.create_instance("testInstance", family="thisFamily")


class ValidateContextTest(pyblish.api.ContextPlugin):
    order = pyblish.api.ValidatorOrder
    families = ["otherFamily"]
    label = "Context Test (otherFamily only!)"

    def process(self, context):
        self.log.info("This should only run when instance "
                      "of otherFamily is present")

This Validator will run even though there’s no Instance available of family otherFamily.

I’m pretty sure I’m running 1.3.2 here. pyblish-win\lib\pyblish\VERSION states 1.3.2.

@marcus Shall I open an additional Issue for this?


#4

Created Issue

Made an issue for this #250 since it’s still present (as of 1.3.2) and somewhat inconvenient.

Also changed title of this topic removing [solved].