Closed rydb closed 10 months ago
Would something like SavePipelineBuilder::exclude_component_by_id()
(which would call deny_by_id
internally) solve your use case?
If so, I'd prefer that option, so that SavePipelineBuilder
has full control of SaveFilter
. This is mainly to make future refactoring easier as needed.
The changes which add the SaveFile
should be a in a separate CL.
Additionally, I was planning to solve the resource issue in a much simpler way without the need for any resources.
Similar to save
, save_default
, and save_all
functions, we could introduce a save_custom
function which takes a system as its input, whose job is to return a save filter and trigger the save pipeline.
Then anyone can use that to get their SaveFilter
and start the pipe with anything, including a custom SaveFile
resource if needed.
As of version 0.3.3, you can use a DynamicSavePipelineBuilder
to feed a SaveFilter
into the save pipeline from any system which returns a SaveFilter
:
fn dynamic_filter(/* ... */) -> SaveFilter {
todo!()
}
let mut app = app();
app.add_systems(PreUpdate, save_default_with(dynamic_filter).into_file(PATH));
Additionally, I've added exclude_component_by_id
and include_component_by_id
members to SavePipelineBuilder
.
I'm working on a library that integrates moonshine_save to include some extra utilities for managing saving/loading components with moonshine_save, and one of those features needs to be able to exclude components by TypeID. However, deny_by_id() is locked behind SceneFilter, which is not accessible due to scene being private.
This PR adds pub to scene to allow deny_by_id() to be accessible.