Tk-multi-publish2 - Is there a way to query if a publish task is checked in the UI?

Hello,

I’m trying to figure out if I’m able to check if an item’s specific publish task is checked in the Publisher UI, is this possible?

I’ve tried getting the item’s .tasks list, then checking .checked, .active. .enabled on the task, all return True, even when the task is unchecked.
I’m sure I’m going about this the wrong way here…

I’m basically trying to check if this specific publish task is been unchecked, from the validate method of another publish task.

Reason is that I’m trying to essentially “force” a specific publish task to always be “on” (checked?).
I couldn’t find a way to force a publish task to be checked, or lock it in anyway (which would be another question… is the possible?).
So I thought I’d try the route of checking it from other publish tasks during validation… if that specific task is not checked then validation would error.

Is there a way to do something like this that I’m missing?

Thank you for any help!

Cheers,
Jake

2 Likes

No one ever answered this, but I had the same question and needed a solution, so here’s the solution for anyone in the future who might be looking:

On the item level, the PublishTask object is what contains the actual information you’re looking for. Here’s an example of how to get the check state of an item’s parent’s plugin state in the validate() step:

      scene_publish_task = None
      for task in item.parent.tasks:
          if task.name == "Publish Maya Scene":
              scene_publish_task = task
              break
      
      if not scene_publish_task.checked:
          self.logger.error(
              "omg no don't do that!",
              extra=_get_save_as_action()
          )
          raise Exception(error_msg)
1 Like