MonoGame
MonoGame copied to clipboard
Unable to add dependency in a custom pipeline importer
When we create a custom importer in a pipeline extension project, we override this method :
public abstract TOutput Process(TInput input, ContentProcessorContext context);
However, we can't add a dependency to an external file by using context.AddDependency(filepath)
because this method is empty :
https://github.com/MonoGame/MonoGame/blob/1c09add4a7407cf14690614d5ec36666d6c2a8ea/MonoGame.Framework.Content.Pipeline/Builder/PipelineImporterContext.cs#L22-L24
The type ContentProcessorContext
is abstract but the concrete type is PipelineImporterContext
which has this empty method, and this method is not overriden anywhere else.
You may note that adding a dependency does work with a custom processor as the PipelineProcessorContext
has an implementation for the method AddDependency
:
https://github.com/MonoGame/MonoGame/blob/1c09add4a7407cf14690614d5ec36666d6c2a8ea/MonoGame.Framework.Content.Pipeline/Builder/PipelineProcessorContext.cs#L37-L40
You are right @Paphos . This is indeed missing pipeline functionality.
I think the implementation is simple. The existing PipelineBuildEvent
should be passed into the PipelineImporterContext
here:
https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework.Content.Pipeline/Builder/PipelineManager.cs#L650
Then just like we do for PipelineProcessorContext
the AddDependency
can be implemented.
@tomspilman Know I'm reviving a dead thread, but has anyone noticed the open PR from '21 here? The fix looks incredibly simple and follows your suggested script. I've built it and am using it myself currently.