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

Implement pyblish-base/#250 #266

wants to merge 5 commits into from

Conversation

BigRoy
Copy link
Member

@BigRoy BigRoy commented Oct 21, 2017

Implement the same functionality for QML as for base regarding: pyblish/pyblish-base#250

This should work with PR: pyblish/pyblish-base#325


Note: Somehow when toggling off an instance of family a it will still show the ContextPlugins that are filtered to family a, but it will not run them. How to visually hide them I have no clue, but aside from cosmetics it is working.

@tokejepsen
Copy link
Member

Will this also work with the matching algorithms?

@BigRoy
Copy link
Member Author

BigRoy commented Oct 21, 2017

Since it triggers the instance_by_plugins logic I'd assume it does, but I haven't tested it.

@BigRoy
Copy link
Member Author

BigRoy commented Oct 23, 2017

@tokejepsen are you able to test this? :) We have this live in production here right now, but are not using targets workflows and neither to we use the other matching algorithms so I'm not sure if that's stable for you.

@tokejepsen
Copy link
Member

Seems to work just fine here :)

# 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

@mottosso
Copy link
Member

Ok, I took a stab at simplifying the logic. It's still complex, and I haven't tested it. Let me know what you think.



no_wildcard = "*" not in plugin.families
no_active_instance = not any(inst.data.get("publish") for inst in instances)
Copy link
Member Author

Choose a reason for hiding this comment

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

@mottosso note that this is now a different check than what logic.py does in pyblish-base because there it explicitly checks for is not False. This could potentially start behaving different.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. Do try this locally first, then we'll need to update Lite and Base to follow suit. It's a backwards incompatible change, so odds are we'll put it behind a PYBLISH_SOMETHING_SOMETHING environment flag to be explicitly enabled.

@mottosso
Copy link
Member

The iterator() you just removed is from here, which leads to this: #218 (comment)

Make sure we don't break that.

@BigRoy
Copy link
Member Author

BigRoy commented Mar 21, 2018

Make sure we don't break that.

Like this? 😄

Interesting that the previous also passed the tests, that should've been caught by a test.

@mottosso
Copy link
Member

mottosso commented Mar 21, 2018

Interesting that the previous also passed the tests, that should've been caught by a test.

This project is lacking a good test suite, which is also why it's a little risky to change things around. But if you could give this a go yourself and keep an eye out for oddities, I think we should be fine.

@BigRoy
Copy link
Member Author

BigRoy commented Mar 21, 2018

Ok, thanks!

Any idea how to solve this one: 6a20765#diff-ac156cba73ac1ef385b357bbfc21d258R698 ?

In pyblish base I made this backwards compatible by implementing a toggle in os.environ but I'm not sure how to propagate that to pyblish QML since it runs in its own process. The QML process does not inherit that value from the parent process so I can't just seem to check against that variable.

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.

3 participants