Browser: Bodies folders only where they help: Always, Several bodies only (the default) or Never (#4217) (#4219)

* claim: #4217

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Browser: Bodies folders only where they help: Always, Several bodies only (the default) or Never (#4217)

A new preference on the Interface page, in the Layout section under Browser, sets when a
component's bodies sit in a Bodies folder of their own. Several bodies only lists a component's
lone body, when it has no groups, straight under its placement. Never lists every component's
bodies and groups there. Always keeps the folder as before. The design's own Bodies folder and a
folder hidden with its eye always stay.

One rule, browser::bodies_folded, decides it for the rows and for the menu. A folded folder
draws no row and stays open; its items move up one level, and their own eyes, hover and drops do
its jobs. While a folder is folded, its placement's menu takes the folder's Create Components from
Bodies and Group Selected; New Group and Show All were already there.

ui.prefs takes browser_bodies_folders (always, several, never) and refuses other values; saved
preferences read an unknown value as the default. The s37 scenario sets Always so that it still
checks the Bodies folder's chevron.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Browser: Bodies folders in Arabic, Hebrew and Vietnamese too (#4217)

Arabic, Hebrew, Japanese, Vietnamese and Chinese are complete catalogues, so
every_complete_catalog_carries_every_english_message fails a new message any of them lacks. The
preference's four messages get their Arabic, Hebrew and Vietnamese text, in the words those
catalogues already use for a body and a folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CamWight
2026-10-28 00:24:17 +00:00
committed by GitHub
parent 03606ec97b
commit 303fddb20e
10 changed files with 358 additions and 20 deletions
@@ -0,0 +1,50 @@
{
"en": {
"prefs.bodies_folders": "Bodies folders",
"prefs.bodies_folders_always": "Always",
"prefs.bodies_folders_never": "Never",
"prefs.bodies_folders_several": "Several bodies only"
},
"ar": {
"prefs.bodies_folders": "مجلدات الأجسام",
"prefs.bodies_folders_always": "دائمًا",
"prefs.bodies_folders_never": "أبدًا",
"prefs.bodies_folders_several": "عند تعدد الأجسام فقط"
},
"he": {
"prefs.bodies_folders": "תיקיות גופים",
"prefs.bodies_folders_always": "תמיד",
"prefs.bodies_folders_never": "אף פעם",
"prefs.bodies_folders_several": "רק כשיש כמה גופים"
},
"de": {
"prefs.bodies_folders": "Körperordner",
"prefs.bodies_folders_always": "Immer",
"prefs.bodies_folders_never": "Nie",
"prefs.bodies_folders_several": "Nur bei mehreren Körpern"
},
"ja": {
"prefs.bodies_folders": "ボディフォルダー",
"prefs.bodies_folders_always": "常に表示",
"prefs.bodies_folders_never": "表示しない",
"prefs.bodies_folders_several": "複数ボディのみ"
},
"ko": {
"prefs.bodies_folders": "바디 폴더",
"prefs.bodies_folders_always": "항상 표시",
"prefs.bodies_folders_never": "표시 안 함",
"prefs.bodies_folders_several": "바디가 여러 개일 때만"
},
"vi": {
"prefs.bodies_folders": "Thư mục thân khối",
"prefs.bodies_folders_always": "Luôn luôn",
"prefs.bodies_folders_never": "Không bao giờ",
"prefs.bodies_folders_several": "Chỉ khi có nhiều thân khối"
},
"zh": {
"prefs.bodies_folders": "实体文件夹",
"prefs.bodies_folders_always": "始终显示",
"prefs.bodies_folders_never": "不显示",
"prefs.bodies_folders_several": "仅限多个实体"
}
}
+62 -18
View File
@@ -360,6 +360,26 @@ pub fn folder_items(app: &SolveApp, component: u64, folder: &str, scope: &str) -
v
}
/// A component's or placement's menu, while its Bodies folder is folded away (#4217), takes the
/// folder's items it lacks: Create Components from Bodies and Group Selected (New Group and Show
/// All are on every component's menu).
pub fn folded_folder_items(app: &SolveApp, target: &Target) -> Vec<Item> {
let (comp, scope) = match target {
Target::Component { id } => (*id, format!("c{id}")),
Target::Occurrence { path } => match app.session.occurrence_placement(path) {
Ok(placement) => (placement.component, occurrence_key(path)),
Err(_) => return Vec::new(),
},
_ => return Vec::new(),
};
if !bodies_folded(app, comp, &scope, entries(app, comp, "bodies").len()) {
return Vec::new();
}
let items =
folder_items(app, comp, "bodies", &scope).into_iter().filter(|i| matches!(i.id.as_str(), "component.from_bodies" | "ui.groupSelected"));
std::iter::once(Item::sep()).chain(items).collect()
}
/// The menu of the Origin folder.
pub fn origin_items(app: &SolveApp) -> Vec<Item> {
let planes = ["XY", "XZ", "YZ"].iter().all(|p| !app.session.visibility.hidden_origin.iter().any(|h| h == p));
@@ -2275,6 +2295,22 @@ fn folder_static(folder: &str) -> &'static str {
}
}
/// Whether a component's Bodies folder is folded away, its bodies (and groups) listed straight
/// under the component or placement row (Preferences › Interface › Bodies folders, #4217).
/// `scope` is that row's tree key (`c{id}`, `o:{path}`) and `bodies` how many items the folder
/// holds. The design's own folder always stays, and so does a hidden one: its eye is the way back.
fn bodies_folded(app: &SolveApp, comp: u64, scope: &str, bodies: usize) -> bool {
use crate::prefs::BodiesFolders;
if comp == 0 || bodies == 0 || app.session.folder_hidden(&format!("{scope}/bodies")) {
return false;
}
match app.preferences.browser_bodies_folders {
BodiesFolders::Always => false,
BodiesFolders::Several => bodies == 1 && !app.session.doc.browser_groups.iter().any(|g| g.component == comp && g.folder == "bodies"),
BodiesFolders::Never => true,
}
}
/// A component's folder: its row, its groups and its items. Rows are drag sources; items,
/// groups and the folder row are drop targets (reorder, into a group, out of groups).
#[allow(clippy::too_many_arguments)]
@@ -2304,26 +2340,34 @@ fn folder_rows_at(
app.tree.collapsed.remove(&format!("g{}", g.id));
}
}
let open = is_open(app, key, true);
// A folded folder draws no row: its groups and items move up into its place, and their own
// eyes, hover and drops do its jobs. It is always open, as nothing could open it again.
let folded = folder == "bodies" && bodies_folded(app, comp, prefix, data.entries().count());
let open = folded || is_open(app, key, true);
let inner = if folded { depth } else { depth + 1 };
// The folder's eye is its own: hiding it hides its items without changing theirs, and its
// items never change it. It and everything in it fade while it or a placement above is
// hidden, whatever their own eyes say.
let shown = !app.session.folder_hidden(key);
let folder_faded = !shown || path.is_some_and(|p| !app.session.occurrence_visible(p));
let r = draw_row(
ui,
ui.id().with(key),
&Row {
depth,
fold: Some(open),
eye: Some(shown),
icon: "folder",
label: folder_label(folder),
dim: folder_faded,
mark: acts.lit.branch(app, data.entries()),
..Default::default()
},
);
let r = if folded {
RowResp::default()
} else {
draw_row(
ui,
ui.id().with(key),
&Row {
depth,
fold: Some(open),
eye: Some(shown),
icon: "folder",
label: folder_label(folder),
dim: folder_faded,
mark: acts.lit.branch(app, data.entries()),
..Default::default()
},
)
};
if r.fold {
toggle(app, key, true);
} else if r.clicked {
@@ -2368,7 +2412,7 @@ fn folder_rows_at(
ui,
ui.id().with(gkey),
&Row {
depth: depth + 1,
depth: inner,
fold: Some(gopen),
eye: Some(gshown),
icon: "folder",
@@ -2403,12 +2447,12 @@ fn folder_rows_at(
}
if gopen {
for e in items {
entry_row(app, ui, comp, path, fstatic, e, depth + 2, Some(id), loose_keys, group_faded, acts);
entry_row(app, ui, comp, path, fstatic, e, inner + 1, Some(id), loose_keys, group_faded, acts);
}
}
}
for e in &data.loose {
entry_row(app, ui, comp, path, fstatic, e, depth + 1, None, loose_keys, folder_faded, acts);
entry_row(app, ui, comp, path, fstatic, e, inner, None, loose_keys, folder_faded, acts);
}
}
+1
View File
@@ -398,6 +398,7 @@ pub fn items(app: &SolveApp, target: &Target) -> Vec<Item> {
.collect(),
Target::NamedView { name } => crate::browser::view_items(app, name),
};
v.extend(crate::browser::folded_folder_items(app, target));
// Several items of the folder selected: they can be grouped.
if let Some(p) = crate::browser::selection_group(app, target) {
v.push(Item::sep());
+122
View File
@@ -335,3 +335,125 @@ fn a_copied_component_pastes_into_its_parent_not_into_itself() {
assert!((pasted.transform[3][0] - 50.0).abs() < 1e-9, "where the copied instance is");
assert!(!crate::browser::is_open(&h.app, &format!("o:{}", pasted.id), true), "it arrives folded");
}
/// #4217: whether a component's Bodies folder folds away, under Always, Several bodies only and
/// Never. Several bodies only (the default) folds a lone body with no groups, Never every
/// component's folder, Always none. The design's own folder, an empty one and a hidden one never
/// fold, and hiding is per placement.
#[test]
fn bodies_folders_fold_by_the_preference_but_never_the_designs_or_a_hidden_one() {
use crate::prefs::BodiesFolders;
let (mut h, component, first, second) = fixture();
assert_eq!(h.app.preferences.browser_bodies_folders, BodiesFolders::Several, "the default");
let modes = |h: &mut Harness, comp: u64, scope: &str| {
let bodies = super::entries(&h.app, comp, "bodies").len();
BodiesFolders::ALL.map(|mode| {
h.app.preferences.browser_bodies_folders = mode;
super::bodies_folded(&h.app, comp, scope, bodies)
})
};
let (one, two) = (super::occurrence_key(&[first]), super::occurrence_key(&[second]));
assert_eq!(modes(&mut h, component, &one), [false, true, true], "one body");
assert_eq!(modes(&mut h, component, &two), [false, true, true], "one body, the other placement");
h.app.run("solid.box", json!({"length":5,"width":5,"height":5,"corner":[0,40,0]})).unwrap();
assert_eq!(modes(&mut h, 0, "c0"), [false; 3], "the design's own folder");
let empty = h.app.run("component.create", json!({"name":"Empty"})).unwrap();
h.app.run("component.activate", json!({"component":0})).unwrap();
let empty_scope = super::occurrence_key(&[empty["occurrence"].as_u64().unwrap()]);
assert_eq!(modes(&mut h, empty["component"].as_u64().unwrap(), &empty_scope), [false; 3], "no bodies");
let show = |h: &mut Harness, visible: bool| {
h.app.run("browser.visibility", json!({"tree_folders":[format!("{one}/bodies")],"visible":visible})).unwrap()
};
show(&mut h, false);
assert_eq!(modes(&mut h, component, &one), [false; 3], "a hidden folder stays: its eye is the way back");
assert_eq!(modes(&mut h, component, &two), [false, true, true], "the other placement's folder has its own eye");
show(&mut h, true);
let group = h.app.run("browser.group", json!({"component":component,"folder":"bodies","items":["Body1"]})).unwrap()["group"].clone();
assert_eq!(modes(&mut h, component, &one), [false, false, true], "a group");
h.app.run("browser.ungroup", json!({"group":group})).unwrap();
assert_eq!(modes(&mut h, component, &one), [false, true, true], "the group gone");
h.app.run("component.activate", json!({"component":component})).unwrap();
h.app.run("solid.box", json!({"length":5,"width":5,"height":5,"corner":[20,0,0]})).unwrap();
h.app.run("component.activate", json!({"component":0})).unwrap();
assert_eq!(modes(&mut h, component, &one), [false, false, true], "two bodies");
}
/// #4217: a folded folder's lone body is drawn one level under its placement, two placements
/// deep, with no Bodies row, even when that folder was closed while it was still drawn (nothing
/// could open it again). Always draws the folder, closed as it was left, then open with the body
/// two levels under the placement.
#[test]
fn a_folded_body_sits_one_level_under_its_nested_placement() {
use crate::prefs::BodiesFolders;
let mut h = Harness::new();
let parent = h.app.run("component.create", json!({"name":"Assembly"})).unwrap()["occurrence"].as_u64().unwrap();
let child = h.app.run("component.create", json!({"name":"Child"})).unwrap()["occurrence"].as_u64().unwrap();
h.app.run("solid.box", json!({"length":10,"width":10,"height":10,"body_name":"Pin"})).unwrap();
h.app.run("component.activate", json!({"component":0})).unwrap();
h.app.tree.collapsed.insert(format!("{}/bodies", super::occurrence_key(&[parent, child])));
// How many levels the body's row sits under its placement's (each eye sits at the same offset
// in its row).
let levels = || -> Option<i32> {
let placement = crate::scenario::handle_at(&format!("eye:occurrence:{parent}/{child}"))?;
let body = crate::scenario::handle_at("eye:Pin")?;
Some(((body.x - placement.x) / super::INDENT).round() as i32)
};
for (mode, want) in [(BodiesFolders::Several, Some(1)), (BodiesFolders::Never, Some(1)), (BodiesFolders::Always, None)] {
h.app.preferences.browser_bodies_folders = mode;
h.frames(2);
assert_eq!(levels(), want, "{mode:?}");
assert_eq!(crate::scenario::handle_at("fold:Bodies").is_some(), mode == BodiesFolders::Always, "{mode:?}: the Bodies row");
}
h.app.tree.collapsed.clear();
h.frames(2);
assert_eq!(levels(), Some(2), "Always, open: under the Bodies folder");
}
/// #4217: Find in Browser reaches a body whose folder is folded away: its closed placement opens
/// and the body's row is drawn and scrolled to.
#[test]
fn find_in_browser_reaches_a_folded_body() {
let (mut h, _, first, second) = fixture();
let body = h.app.session.occurrence_bodies(&[second], true).unwrap()[0].clone();
let scope = super::occurrence_key(&[second]);
h.app.tree.collapsed.extend([super::occurrence_key(&[first]), scope.clone(), format!("{scope}/bodies")]);
h.frames(2);
assert!(!h.app.tree.order.contains(&format!("b:{body}")), "the body's row is closed away");
h.app.session.selection = vec![Sel::Body { name: body.clone() }];
let find = context_menu::items(&h.app, &Target::Viewport).into_iter().find(|i| i.id == "ui.findBrowser").unwrap();
context_menu::run_item(&mut h.app, &find, egui::Pos2::ZERO);
assert_eq!(h.app.tree.reveal.as_deref(), Some(body.as_str()));
h.frames(2);
assert!(h.app.tree.reveal.is_none(), "revealed");
assert!(!h.app.tree.collapsed.contains(&scope));
assert!(h.app.tree.order.contains(&format!("b:{body}")), "the row is drawn");
assert!(crate::scenario::handle_at("fold:Bodies").is_none(), "with no folder row");
}
/// #4217: while a placement's Bodies folder is folded away, the placement's menu takes the
/// folder's items it lacks: Create Components from Bodies (the folder's bodies) and, with several
/// of them selected, Group Selected. With the folder drawn they stay on the folder's own menu.
#[test]
fn a_folded_folders_menu_items_move_to_the_placements_menu() {
use crate::prefs::BodiesFolders;
let (mut h, component, first, _) = fixture();
h.app.run("component.activate", json!({"component":component})).unwrap();
h.app.run("solid.box", json!({"length":5,"width":5,"height":5,"corner":[20,0,0],"body_name":"Second"})).unwrap();
h.app.run("component.activate", json!({"component":0})).unwrap();
let target = Target::Occurrence { path: vec![first] };
let has = |h: &Harness, id: &str| context_menu::items(&h.app, &target).iter().any(|i| i.id == id);
assert!(!has(&h, "component.from_bodies"), "Several bodies only: two bodies keep their folder");
h.app.preferences.browser_bodies_folders = BodiesFolders::Never;
let items = context_menu::items(&h.app, &target);
let from = items.iter().find(|i| i.id == "component.from_bodies").unwrap();
assert_eq!(from.params.as_ref().unwrap()["bodies"], json!(["Body1", "Second"]));
assert!(has(&h, "ui.newGroup") && has(&h, "ui.showAll"), "on every component's menu");
assert!(!has(&h, "ui.groupSelected"), "nothing selected");
h.app.session.selection = vec![Sel::Body { name: "Body1".into() }, Sel::Body { name: "Second".into() }];
let group = context_menu::items(&h.app, &target).into_iter().find(|i| i.id == "ui.groupSelected").unwrap();
context_menu::run_item(&mut h.app, &group, egui::Pos2::ZERO);
let made = h.app.session.doc.browser_groups.iter().find(|g| g.component == component).unwrap();
assert_eq!(made.items, ["Body1", "Second"]);
h.app.preferences.browser_bodies_folders = BodiesFolders::Always;
assert!(!has(&h, "component.from_bodies"), "Always: on the folder's own menu");
}
+64
View File
@@ -596,6 +596,35 @@ pub const DEFAULT_BROWSER_WIDTH: f32 = 250.0;
/// split; the column clamps what the user drags so both cards keep their header and two rows.
pub const DEFAULT_BROWSER_SHARE: f32 = 0.5;
/// When a component's bodies sit in a Bodies folder of their own in the browser (#4217): each
/// folder is one more level that pushes deep assemblies right. Only folders inside components
/// fold; the design's own Bodies folder, and a folder hidden with its eye (its eye is the way
/// back), always stay (`browser::bodies_folded`).
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BodiesFolders {
Always,
/// A component with one body and no groups lists the body straight under it. Also what a
/// value this version doesn't know reads as (`lenient`).
#[default]
Several,
/// Components list their bodies and groups straight under them.
Never,
}
impl BodiesFolders {
pub const ALL: [Self; 3] = [Self::Always, Self::Several, Self::Never];
/// Its name in the Preferences (a message id).
pub fn label_id(self) -> &'static str {
match self {
Self::Always => "prefs.bodies_folders_always",
Self::Several => "prefs.bodies_folders_several",
Self::Never => "prefs.bodies_folders_never",
}
}
}
// The stored fields, their defaults, page resets and simple form controls share this table.
// Omitted pages keep fields such as grid_follows_view and added agents when restoring defaults.
// Accepted control-channel ranges may differ from slider ranges (look_at_speed).
@@ -834,6 +863,8 @@ preference_settings! {
dialog_place: crate::dialog_column::DialogPlace = Default::default(), PAGE_INTERFACE;
/// The names the browser, dialogs and lists show for the origin planes (#6491).
origin_plane_names: OriginPlaneNames = OriginPlaneNames::default(), PAGE_INTERFACE;
/// When components' bodies sit in a Bodies folder in the browser (#4217).
browser_bodies_folders: BodiesFolders = BodiesFolders::Several, PAGE_INTERFACE;
/// The wheel zooms toward the point under the cursor (else toward the view's centre).
zoom_to_cursor: bool = true, PAGE_NAVIGATION => check("Zoom to the cursor", "The wheel zooms toward the point under the cursor (off: toward the view's centre)");
/// Spread discrete wheel input across frames (off: apply each event immediately).
@@ -3912,6 +3943,39 @@ mod tests {
assert_eq!(app.preferences.ui_font, "");
}
/// Bodies folders (#4217): Several bodies only by default, also in preferences saved before it
/// existed. Each value is saved and read back; `ui.prefs` refuses anything else and changes
/// nothing, and saved preferences read such a value as the default and keep the rest. The
/// Interface page's segments set it, Cancel puts it back and the page's Restore Defaults resets it.
#[test]
fn bodies_folders_is_saved_restored_and_refuses_unknown_values() {
use super::*;
let mut h = crate::scenario::Harness::new();
assert_eq!(h.app.preferences.browser_bodies_folders, BodiesFolders::Several);
assert_eq!(lenient(&json!({"theme": "light"})).browser_bodies_folders, BodiesFolders::Several, "saved before it existed");
for (mode, id) in [(BodiesFolders::Always, "always"), (BodiesFolders::Several, "several"), (BodiesFolders::Never, "never")] {
assert_eq!(control(&mut h.app, &json!({"browser_bodies_folders": id})).unwrap()["browser_bodies_folders"], id);
let mut restored = SolveApp::new(Default::default(), Default::default());
restored.load_prefs(&h.app.prefs());
assert_eq!(restored.preferences.browser_bodies_folders, mode, "{id}");
}
for bad in [json!("sometimes"), json!("Never"), json!(""), json!(2), json!(null), json!(["never"])] {
let before = h.app.preferences.clone();
assert!(set(&mut h.app, &json!({"browser_bodies_folders": bad})).is_err(), "{bad}");
assert_eq!(h.app.preferences, before, "{bad}: a refused value changes nothing");
let saved = lenient(&json!({"browser_bodies_folders": bad, "theme": "light"}));
assert_eq!((saved.browser_bodies_folders, saved.theme.as_str()), (BodiesFolders::Several, "light"), "{bad}");
}
h.call("ui.prefs", json!({"open": "Interface"}));
reveal_preference(&mut h, "dialog:Bodies folders:Always");
h.step(&json!({"click": {"handle": "dialog:Bodies folders:Always"}})).unwrap();
assert_eq!(h.app.preferences.browser_bodies_folders, BodiesFolders::Always);
h.call("ui.prefs", json!({"button": "cancel"}));
assert_eq!(h.app.preferences.browser_bodies_folders, BodiesFolders::Never, "Cancel puts it back");
defaults(&mut h.app, PAGE_INTERFACE);
assert_eq!(h.app.preferences.browser_bodies_folders, BodiesFolders::Several, "Interface's Restore Defaults");
}
/// Theme files (#2255): a built-in one and an imported one turn on through `ui.prefs`, the
/// next frame draws with their colours (dark following the base), an export gives the theme
/// back complete, imported themes are saved with the preferences, Remove falls back to the
+10
View File
@@ -159,6 +159,16 @@ pub(super) fn interface(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
let check = setting::view_confirm_corner(app, ui).on_hover_text(app.tr("prefs.view_confirm_corner_note"));
crate::scenario::publish_target("prefs:view_confirm_corner", check.rect);
});
ui_kit::row(ui, app.tr("prefs.bodies_folders"), |ui| {
let modes = BodiesFolders::ALL;
let labels: Vec<_> = modes.iter().map(|m| app.tr(m.label_id())).collect();
let mut selected = modes.iter().position(|m| *m == app.preferences.browser_bodies_folders).unwrap_or(0);
if ui_kit::segmented(ui, &mut selected, &labels, ui_kit::Segments { proportional: true, compact: true, ..Default::default() })
&& let Some(mode) = modes.get(selected)
{
app.preferences.browser_bodies_folders = *mode;
}
});
ui_kit::text(ui, app.tr("prefs.layout_note"), ui_kit::Text::Hint("layout"));
ui_kit::text(ui, app.tr("prefs.history_sketches_note"), ui_kit::Text::Hint("history_sketches"));
ui_kit::LayoutPreview {
@@ -0,0 +1,33 @@
[
{"note": "Bodies folders (#4217, Preferences › Interface): a nested assembly of plain boxes. Frame:1 holds the body Plate and the placement Pin:1, which holds the body Shaft. The design itself has no bodies, so every Bodies row is a component's."},
{"call": "engine.execute", "params": {"command": "component.create", "params": {"name": "Frame"}}},
{"call": "engine.execute", "params": {"command": "solid.box", "params": {"length": 40, "width": 20, "height": 5, "body_name": "Plate"}}},
{"call": "engine.execute", "params": {"command": "component.create", "params": {"name": "Pin"}}},
{"call": "engine.execute", "params": {"command": "solid.box", "params": {"length": 4, "width": 4, "height": 20, "corner": [0, 40, 0], "body_name": "Shaft"}}},
{"call": "engine.execute", "params": {"command": "component.activate", "params": {"component": "root"}}},
{"expect": {"bodies": 2, "errors": 0, "prefs": {"browser_bodies_folders": "several"}}},
{"note": "Several bodies only (the default): each lone body sits straight under its placement, one level in, with no Bodies row."},
{"expect": {"browser_has": ["Frame:1", "Plate", "Pin:1", "Shaft"], "browser_lacks": ["Bodies"], "handle_order": ["eye:Frame:1", "eye:Plate"]}},
{"expect": {"handle_order": ["eye:Pin:1", "eye:Shaft"]}},
{"note": "A second body in Frame brings Frame's folder back; Pin's lone body stays folded."},
{"call": "engine.execute", "params": {"command": "component.activate", "params": {"component": "Frame"}}},
{"call": "engine.execute", "params": {"command": "solid.box", "params": {"length": 5, "width": 20, "height": 15, "corner": [60, 0, 0], "body_name": "Rib"}}},
{"call": "engine.execute", "params": {"command": "component.activate", "params": {"component": "root"}}},
{"expect": {"bodies": 3, "browser_has": ["Bodies", "Plate", "Rib", "Shaft"], "handle_order": ["eye:Bodies", "eye:Plate"]}},
{"note": "Never: every component's bodies sit straight under it, two of them too."},
{"call": "ui.prefs", "params": {"browser_bodies_folders": "never"}},
{"expect": {"prefs": {"browser_bodies_folders": "never"}, "browser_has": ["Plate", "Rib", "Shaft"], "browser_lacks": ["Bodies"]}},
{"note": "Always: every component keeps its folder, Pin's too (the last Bodies row drawn, between Pin:1 and Shaft)."},
{"call": "ui.prefs", "params": {"browser_bodies_folders": "always"}},
{"expect": {"prefs": {"browser_bodies_folders": "always"}, "browser_has": ["Bodies", "Plate", "Rib", "Shaft"], "handle_order": ["eye:Pin:1", "eye:Bodies", "eye:Shaft"]}},
{"note": "A value this version doesn't know is refused and changes nothing."},
{"call": "ui.prefs", "params": {"browser_bodies_folders": "sometimes"}, "fail": true},
{"expect": {"prefs": {"browser_bodies_folders": "always"}}},
{"call": "ui.prefs", "params": {"browser_bodies_folders": "several"}},
{"expect": {"prefs": {"browser_bodies_folders": "several"}, "browser_has": ["Bodies", "Rib", "Shaft"]}}
]
@@ -2,6 +2,15 @@
{
"note": "Browser chevrons expand and collapse every kind of node (folders, components, groups, the origin, named views, document settings). Model: two components with a body each, a joint, a sketch, an offset plane, a named view."
},
{
"note": "Each component keeps its Bodies folder (Preferences › Interface › Bodies folders: Always), so that folder's chevron is checked too."
},
{
"call": "ui.prefs",
"params": {
"browser_bodies_folders": "always"
}
},
{
"start": "component.create"
},
+6 -1
View File
@@ -19,7 +19,12 @@
hides an item, a component's radio button makes it the active component, and right-clicking any
row gives that item's menu. Right-click the design or a component and choose **Expand All** or
**Collapse All** to open or close every folder under that row (the design row stays visible
when the whole tree is collapsed). Rows drag into groups and other components.
when the whole tree is collapsed). Rows drag into groups and other components. **Preferences ›
Interface › Bodies folders** sets when a component's bodies sit in a Bodies folder of their own:
**Several bodies only** (the default) lists a component's body straight under it when it has
only one and no groups, **Never** lists every component's bodies and groups straight under it
(the folder's menu items are then on the component's menu), and **Always** keeps the folder.
The design's own Bodies folder, and a folder hidden with its eye, always stay.
- **Viewport.** Click to select, Shift or Ctrl to add (Preferences › Selection), drag for a window or crossing box. While sketching, Ctrl/Cmd or Alt/Option suppress auto-snap by default; Shift prefers a midpoint; the pointer also snaps to where two curves cross. To
reach something under something else (two lines drawn on top of each other, coincident points,
an edge in front of a face, overlapping bodies), hold the left button still for half a second
File diff suppressed because one or more lines are too long