Skip to content

Commit

Permalink
control.py & window.py: Fix issue pyblish#59 with plugin and instance…
Browse files Browse the repository at this point in the history
… states being out of date after initializing the pair_generator the first time.
  • Loading branch information
darkvertex committed Nov 1, 2018
1 parent 0892cc4 commit f4ba39b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions pyblish_lite/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ def on_next():
if order > (until + 0.5):
return util.defer(100, on_finished_)

plug, instance = self.current_pair
if not plug.active or \
(instance is not None and instance.data.get("publish") is False):
util.defer(10, try_next)
return

self.about_to_process.emit(*self.current_pair)

util.defer(10, on_process)
Expand All @@ -187,6 +193,9 @@ def on_process():
# IMPORTANT: This *must* be done *after* processing of
# the current pair, otherwise data generated at that point
# will *not* be included.
try_next()

def try_next():
try:
self.current_pair = next(self.pair_generator)

Expand Down Expand Up @@ -227,11 +236,10 @@ def _iterator(self, plugins, context):
test = pyblish.logic.registered_test()

for plug, instance in pyblish.logic.Iterator(plugins, context):
if not plug.active:
continue

if instance is not None and instance.data.get("publish") is False:
continue
# We do not care about checking the plugin or instance "active" states
# because it can change outside of this "for" loop, so any checks here
# could potentially be outdated or inaccurate.

self.processing["nextOrder"] = plug.order

Expand Down
2 changes: 1 addition & 1 deletion pyblish_lite/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def __init__(self, controller, parent=None):
controller.was_validated.connect(self.on_was_validated)
controller.was_published.connect(self.on_was_published)
controller.was_acted.connect(self.on_was_acted)
controller.was_finished.connect(self.on_finished)
# controller.was_finished.connect(self.on_finished)

# Discovery happens synchronously during reset, that's
# why it's important that this connection is triggered
Expand Down

0 comments on commit f4ba39b

Please sign in to comment.