This commit is contained in:
1 parent
4b8872e4d0
commit
f06b76e14f
4 files changed
+49
-22
No files matched your search
@@ -1544,7 +1544,8 @@ pub struct Feature {
|
||||
pub name: String,
|
||||
#[serde(default)]
|
||||
pub suppressed: bool,
|
||||
/// Names for the bodies this feature creates (in order); missing ones get `BodyN`.
|
||||
/// Names for the bodies this feature creates (in order); missing ones are numbered after the
|
||||
/// first (`Ribs (4)`), or get `BodyN` when there is none (or see `shell_piece_order`).
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub body_names: Vec<String>,
|
||||
/// Parameter names of the feature's inputs (see `FeatureKind::inputs`), e.g. `d3`.
|
||||
@@ -1570,6 +1571,8 @@ pub struct Feature {
|
||||
/// The pieces this feature splits a body into take its body names in the kernel's shell order,
|
||||
/// as builds before format 14 named them, instead of after their faces (`lineage::order_lumps`).
|
||||
/// Set on the features of designs saved before then, whose stored body names mean that order.
|
||||
/// Such features also name the bodies past their `body_names` `BodyN`, as those builds did,
|
||||
/// where newer ones number them after the first name (`Ribs (4)`, #373).
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub shell_piece_order: bool,
|
||||
#[serde(flatten)]
|
||||
|
||||
@@ -1054,6 +1054,16 @@ fn new_name(state: &mut ModelState, f: &Feature, k: usize) -> String {
|
||||
{
|
||||
return n.clone();
|
||||
}
|
||||
// Bodies past the stored names (a profile added after the feature was made) are numbered
|
||||
// after the first name: `Ribs (4)` (#373). Features saved before format 14 keep `BodyN`,
|
||||
// which later features of those designs may name.
|
||||
if !f.shell_piece_order
|
||||
&& k >= f.body_names.len()
|
||||
&& let Some(base) = f.body_names.first().map(|n| n.trim()).filter(|n| !n.is_empty())
|
||||
{
|
||||
let n = format!("{base} ({})", k.saturating_add(1));
|
||||
return if state.body(&n).is_none() { n } else { unique_body_name(state, base) };
|
||||
}
|
||||
loop {
|
||||
state.body_counter += 1;
|
||||
let n = format!("Body{}", state.body_counter);
|
||||
|
||||
Reference in new issue
Block a user