Closed mottosso closed 8 years ago
To reproduce:
import pyblish.api
import pyblish.plugin
class MyAction(pyblish.api.Action):
def process(self, plugin, context):
assert False, "Action ran"
class MyValidator(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
actions = [
pyblish.api.Category("Scene"),
MyAction,
]
context = pyblish.api.Context()
result = pyblish.plugin.process(MyValidator, context, instance=None, action="MyAction")
assert str(result["error"]) == "Action ran"
Actions paired to InstancePlugin throws an AssertionError.
The error lies in a logic check made here:
Which is logically making sure that, if a plug-in is an InstancePlugin but there is no instance being passed, the caller of this function is doing something wrong. But what it doesn't to take into account, is if there is an Action being processed, there doesn't have to be an instance.
Thanks to @madoodia and @BigRoy for spotting this.