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

Add support for mandatory instances #292

Merged
merged 2 commits into from Jul 11, 2018

Conversation

darkvertex
Copy link
Contributor

pyblish-lite implements this by omitting the checkbox when an Instance has .data['optional'] = False, effectively making an instance "mandatory" (in whatever state it was added.)

With this PR, pyblish-qml implements mandatory isntances by greying out the checkbox, just like it's already doing for the "Context" entry in the top left. Clicking on them shows a "Cannot toggle." status prompt.

To show what this looks like, here's a dummy Collector I used:

class Collector(pyblish.api.ContextPlugin):
    order = pyblish.api.CollectorOrder
    def process(self, context):
        instance = context.create_instance('farmer', family='human')
        instance.data['optional'] = False
        instance.data['publish'] = True
        for i in range(3):
            instance = context.create_instance('potato%s' % i, family='vegetable')
            instance.data['optional'] = True
            instance.data['publish'] = False

And here's what this looks like in action:

pyblishqml_mandatory_instances

and for comparison, the same Collector without the PR's changes, in action:

pyblishqml_mandatory_instances_not_working

and the same Collector again, with the latest official release of pyblish-lite:

pyblishlite_mandatory_instances

If this was to be merged, it would fix issue #291.

@@ -133,6 +133,9 @@ def format_data(data):
"publish",
"comment",

# Allows an instance to be non-optional (ie, mandatory)
"optional",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, omg was this all that had to be done!? :D Well spotted!

@mottosso
Copy link
Member

Thanks for this @darkvertex, would it be possible to increment the patch version? That way I can make a release with this new feature.

@darkvertex
Copy link
Contributor Author

@mottosso Just bumped VERSION_PATCH in version.py

(Is that the only place for the version number info? Let me know if I have to edit elsewhere.)

@mottosso
Copy link
Member

That's exactly right, sorry I should have said!

This all looks good to me, thanks again!

@mottosso mottosso merged commit 4a388e5 into pyblish:master Jul 11, 2018
@darkvertex darkvertex deleted the mandatory_instances_support branch July 11, 2018 16:33
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.

None yet

2 participants