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

Attempt to fix issue #59 #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

darkvertex
Copy link
Contributor

This is not really working quite right yet, but I'm giving it a try. Advice, corrections, tips all welcome.

This is my testing scenario which generates potato_0 through potato_3 and only the last one is activated:

import pyblish.api
import pyblish_lite


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

    def process(self, context):
        for i in range(4):
            name = 'potato_{0}'.format(i)
            inst = context.create_instance(
                name, label=name, family='vegetable')
            inst.data['icon'] = 'male'
            inst.data['optional'] = True

            # Leave them all OFF except the last one:
            inst.data['publish'] = name == 'potato_3'


class FakeValidator(pyblish.api.InstancePlugin):
    order = pyblish.api.ValidatorOrder
    families = ['vegetable']

    def process(self, instance):
        # raise pyblish.api.ValidationError('Boo!')
        pass


def setupPlugins():
    pyblish.api.deregister_all_plugins()
    pyblish.api.deregister_all_paths()
    pyblish.api.register_plugin(FakeCollector)
    pyblish.api.register_plugin(FakeValidator)


def startUI():
    setupPlugins()
    pyblish.api.register_host("python")
    window = pyblish_lite.show()


startUI()

Previous to this PR, if you untick potato_3 and tick any of the others, potato_3 will get a green outline, meaning it processed, despite being deactivated.

With the code as it stands at the moment, if I uncheck potato_3, it does not get evaluated, but neither does the others. It seems I made the whole FakeValidator skip instead of the individual instance. I must've done something wrong somewhere.

… states being out of date after initializing the pair_generator the first time.
@mottosso
Copy link
Member

mottosso commented Nov 1, 2018

Thanks for this @darkvertex. I can't spot what's gone wrong from a quick glance, but if it helps you're welcome to remove the iterator altogether, and with it the ability to "pause" which I think is the thing making the most fuss. It has never really worked out that well, and likely doesn't provide much value either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants