-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Issue
In Pyblish whenever one registers a custom target it still includes the default target - as if it is always present.
import pyblish.api
import pyblish.util
pyblish.api.register_target("render")
pyblish.util.publish()
# Pyblish will now use targets: ["default", "render"]This concept propagates correctly to pyblish_qml.show() when no targets are provided:
import pyblish.api
import pyblish_qml
pyblish.api.register_target("render")
pyblish_qml.show()
# Pyblish QML will now use targets: ["default", "render"]However when providing targets explicitly to pyblish_qml.show() it will only include default when explicitly provided. This behavior does nicely match what Pyblish currently does when using pyblish.util.publish(), like:
pyblish.util.publish(targets=["render"])
# Pyblish will only use targets: ["render"]
pyblish_qml.show(targets=["render"])
# Pyblish QML will only use targets: ["render"]Note that here "default" is not included in the targets
Discussion
The consusion rises when you query pyblish.api.registered_targets() , it never lists "default" even though it is included by default, yet not when you start to explicitly providing targets.
Somehow it left me confused for two hours where the behavior started to differ when I triggered QML with a target and it lacked the default plug-ins. I'm wondering whether we should be able to simplify the logic so it's the same in all those cases. Additionally the Documentation led me off the path too as it indicated by default plug-ins would target anything with *:
Targets work the same way as families, so a wildcard of
*enables the plugin for all targets. Since all plugins are registered with*as targets, this workflow is backwards compatible with existing plugins that has not overwritten the targets attribute.
However the code indicates the default target is set only to targets = ["default"]
Reference: