-
Notifications
You must be signed in to change notification settings - Fork 44
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
Refactor 'targets' internal control #351
base: master
Are you sure you want to change the base?
Conversation
I think this PR also resolved @mottosso 's little worry in #347. 😉 |
I think I need to explain my motivation on proposal 2 a little : One of my plugins was checking on current targets so to filter out instances in working scene by family, before instance is created. For example, I have a context plugin which responsible to create instances and runs in all targets, and if the current target is "remote publish", then I don't want instance which it's family is like |
Could you do the same workflow but just inherit a plugin class and changing the target? |
Yes, it still can be done with current mechanism, but have to write a bit more code. Anyway, the example above was not the main problem, it's not a "must-solve" issue, but could solve better if proposal 1 has implemented. So the point still is the Problem 1. Also note that, this PR will NOT change any current features, only tweaked the internal data flow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally approved this PR which I haven't actually checked thoroughly. I meant to approve another one.
Seems a merge conflict must be resolved @davidlatwe
Problem 1
The plugins was
discover
in parent-process (server side), and formatted into JSON then send to child-process (client side), next, theplugins_by_targets
logic was handled there.So say we have 10 plugins total, 5 for target "A" and the other 5 for target "B". In current data workflow described above, there's high chance that server is sending all 10 plugins into client and filter out 5 plugins which won't needed. Which I think can be improved.
Proposal 1
Moving the target filtering process from client to server.
Problem 2
In #335, @BigRoy mentioned:
In this design, in other words, you can not trust
pyblish.api.registered_targets
inside plugin which runs inpyblish-qml
.Proposal 2
Implement targets query function into
pyblish_qml.api
.pyblish_qml.api.current_targets
And with proposal 1 implemented, we can spend no more server-client communication for querying current targets.
Extra Proposal
I often used
pyblish_qml.api.current_server().service._context
to get thepyblish.api.Context
object inpyblish_qml
session.So I propose to implement a convenient function for that propose as well.
pyblish_qml.api.current_context