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

Implement pyblish-base/#250 #266

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion pyblish_qml/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,13 @@ def on_finished(plugins, context):
plugin)
plugin.compatibleInstances = list(i.id for i in instances)
else:
plugin.compatibleInstances = [context.id]


# When filtering to families at least a single instance
# with that family must be available for ContextPlugin
if ("*" in plugin.families or
pyblish.logic.instances_by_plugin(context, plugin)):
plugin.compatibleInstances = [context.id]

self.data["models"]["item"].reorder(context)

Expand Down Expand Up @@ -1046,4 +1052,14 @@ def iterator(plugins, context):
yield plugin, instance

else:


# When filtering to families at least a single instance with
# that family must be active in the current publish
if "*" not in plugin.families:
if not any(instance.data.get("publish") is not False
Copy link
Member

@mottosso mottosso Oct 26, 2017

Choose a reason for hiding this comment

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

I can't make sense of this line.

If not "any of these" is not "Not True", then loop through the below. Have a look and see if you can't make this more intuitive

Copy link
Member Author

@BigRoy BigRoy Oct 26, 2017

Choose a reason for hiding this comment

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

The check is this explicit to check for False because the Pyblish logic does the same with such an explicit check. As such I couldn't just do not instance.data.get("publish") because then it would also consider None whereas the Pyblish logic wouldn't.

The logic is that at least one instance must have its publish set to True. So if there's no "active" one it should continue.

The check whether it's true is: instance.data.get("publish") is not False

This could also work:

def _is_active(instance):
    """Whether instance is currently set active to publish"""
    return instance.data.get("publish") is not False 

if not any(_is_active(instance) for instance in instances):
    continue

for instance in instances):
continue


yield plugin, None