Repro
First run this;
import pyblish.api
import pyblish_integration
def toggle_unwanted(instance, new_value, old_value):
print "I shouldn't be here"
pyblish.api.register_callback("instanceToggled", toggle_unwanted)
class CollectInstance(pyblish.api.Collector):
def process(self, context):
context.create_instance("Some Instance", family="someFamily")
pyblish.api.register_plugin(CollectInstance)
pyblish_integration.show()
Followed by this:
import pyblish.api
import pyblish_integration
def toggle_wanted(instance, new_value, old_value):
print "I want to be here"
pyblish.api.register_callback("instanceToggled", toggle_wanted)
class CollectInstance(pyblish.api.Collector):
def process(self, context):
context.create_instance("Some Instance", family="someFamily")
pyblish.api.register_plugin(CollectInstance)
pyblish_integration.show()
Looks like the callbacks doesn’t get cleared when resetting. You could have the workflow of only registering the callback when launching an application, but this isn’t very developer friendly. Secondly I would expect to keep my callbacks together with my plugins, if they are related.
Solution
Guessing you would need to run pyblish.api.deregister_callbacks()
when resetting in the GUI, and pyblish core?