-
Notifications
You must be signed in to change notification settings - Fork 207
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
Reconsider Dispatcher::setupPlugs() mechanism #915
Comments
So this has just bit me on #871. I was trying to add a batchSize plug in |
Nothing I'm totally happy with, but here's a couple of options to mull over :
|
|
…me batching. This allows users to determine an appropriate frame batching size for each ExecutableNode instance. Note that batchSize is added and used by the Dispatcher base class, rather than being specific to each type of Dispatcher. Also note that nodes which requireSequenceExecution currently have a batchSize plug, even though it doesn't make sense. Once GafferHQ#915 is taken care of, these nodes will no longer have this plug. Fixes GafferHQ#871.
I tried implementing |
To answer your original question, yes that would be OK. I've put up a pull request (#937) with a fix to I'm not sure I like this approach though - it has the same problem with dynamic plugs as the current implementation, in that plugs will be added during construction when loading a file, and then any previously saved dynamic plugs will get added over the top (and renamed in the process). This is a problem with either 1) or 2). What do you think to making it necessary to make an explicit call to |
The explicit call seems a bit too fiddly for scripters to need to remember... if we're serializing it into the |
Yeah, I'm not really happy with any of my ideas so far. When you say a |
Doesn't Maya have a concept like that? It's a function that is called right after the constructor when it's safe to call member functions of the derived class. I have no idea how they implemented it, but it's kind of what we're after, isn't it? |
Wait, I guess that doesn't fix the dynamic plug problem... we need |
The problem with a post constructor is that coming up with a mechanism for it is just as hard as coming up with a mechanism for what we're discussing anyway, except it would affect /everything/. The only reliable way I can think of would be to have no public constructors, and to force all construction to go through factory methods (so no And yep, post constructors wouldn't be the right thing for this anyway, if we want dynamic plugs to be an option for dispatchers. The thing certain-third-party-packages might do to deal with that would then be to have an am-i-in-the-course-of-loading? flag that can be queried, and then modify behaviour based on that. But I think having those types of things quickly leads to hard to understand behaviours and questions like "are importing and pasting and duplicating the same as loading?" So I'm keen to stick to more fundamental concepts that are well defined at the library level, like "my parent is changing". That does mean a few awkward situations like this one, but I'd rather that than the even-more-awkward situations I imagine would be introduced by more nebulous concepts. I actually don't think a postConstructor is one of those nebulous concepts if it's implemented perfectly, but I don't know of a way of doing that without abandoning So, I haven't really come up with anything useful there have I? But hopefully I've explained my rationale for preferring a little bit of awkwardness here vs a whole lot of new machinery... |
Some further thoughts on this :
|
This uses an `intrusive_ptr_add_ref` gambit first introduced in GafferHQ#5985, with the rationale for that over various alternatives being documented there. Fixes GafferHQ#915.
Currently,
Dispatchers
are given the opportunity of adding custom plugs toExecutableNodes
, so that they can add dispatcher-specific settings to each node. For instance, a farm dispatcher might add plugs to control resource requirements like machine type or license reservations. This is achieved by theExecutableNode
constructor callingDispatcher::setupPlugs()
, but has a couple of problems :ExecutableNode
isn't fully constructed at the point thatDispatcher::doSetupPlugs()
gets called, sonode->typeId()
will always returnExecutableNodeTypeId
, and the dispatcher can't choose what plugs to add based on node type.ExecutableNode
is constructed while loading a file, a dispatcher might want to remove plugs that are no longer relevant, but during loading any dynamic plugs are added after construction, and thereforeDispatcher::doSetupPlugs()
doesn't see them.We need to consider how best to resolve this.
The text was updated successfully, but these errors were encountered: