mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
ignore classes feature
This commit is contained in:
parent
929bc254fa
commit
db87fa010f
4 changed files with 81 additions and 2 deletions
|
|
@ -385,6 +385,10 @@ pub struct SyncbackRules {
|
|||
/// syncback.
|
||||
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
|
||||
ignore_properties: IndexMap<Ustr, Vec<Ustr>>,
|
||||
/// A list of class names to ignore entirely during syncback.
|
||||
/// Instances of these classes will not be added, removed, or synced.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
ignore_classes: Vec<String>,
|
||||
/// Whether or not the `CurrentCamera` of `Workspace` is included in the
|
||||
/// syncback or not. Defaults to `false`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
|
|
|||
|
|
@ -206,6 +206,24 @@ impl<'sync> SyncbackSnapshot<'sync> {
|
|||
.as_ref()
|
||||
.map(|rules| rules.ignore_trees.as_slice())
|
||||
}
|
||||
|
||||
/// Returns user-specified ignore classes.
|
||||
#[inline]
|
||||
pub fn ignore_classes(&self) -> Option<&[String]> {
|
||||
self.data
|
||||
.project
|
||||
.syncback_rules
|
||||
.as_ref()
|
||||
.map(|rules| rules.ignore_classes.as_slice())
|
||||
}
|
||||
|
||||
/// Checks if a class name should be ignored during syncback.
|
||||
#[inline]
|
||||
pub fn should_ignore_class(&self, class_name: &str) -> bool {
|
||||
self.ignore_classes()
|
||||
.map(|classes| classes.iter().any(|c| c == class_name))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn filter_out_property(inst: &Instance, prop_name: &str) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue