Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ for an empty workbench or to reload the sample.
1. Drop STL, OBJ, GLB, embedded GLTF, or 3MF files into the editor. Source units
and up axis can be overridden. Automatic mode uses meters / Y up for glTF,
millimeters / Z up for STL and OBJ, and declared 3MF units / Z up.
2. Select parts in the viewport or the searchable part tree. Shift-click selects
several parts. Move, rotate, and scale using gizmos or numeric fields. The
2. Select parts in the viewport or the searchable part tree. Ctrl/⌘-click selects
several parts, as does Shift-click in the viewport; Shift-click in the part tree
selects a range. **Ctrl/⌘ + G** groups the selection, and clicking a grouped part
in the viewport selects its whole group. Move, rotate, and scale using gizmos or numeric fields. The
inspector’s **Move** and **Rotate** controls also offer X/Y/Z −/+ buttons for
precise adjustments, including whole selections. Enter a **Step** in millimeters
or degrees; **Snap dragging** uses that same increment for the handles. The
Expand Down Expand Up @@ -692,6 +694,7 @@ During contact painting, undo removes the last brush stroke before scene changes
| Deselect all | `Ctrl/⌘ + Shift + A`; `Esc` in Select mode |
| Copy / cut / paste components | `Ctrl/⌘ + C` / `X` / `V` |
| Duplicate selected | `Ctrl/⌘ + D` |
| Group / ungroup | `Ctrl/⌘ + G` / `Ctrl/⌘ + Shift + G` |
| Rename one component | `F2` |
| Delete unlocked selection | `Delete` / `Backspace` |
| Undo / redo | `Ctrl/⌘ + Z` / `Ctrl/⌘ + Shift + Z`; `Ctrl + Y` |
Expand Down
13 changes: 13 additions & 0 deletions docs/scene-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ editor metadata, independent of mesh buffers, supported by all three scene reade
],
"joints": [],
"constraints": [],
// Only when parts are grouped.
"groups": [{ "id": "4f0c…", "name": "Upper body" }],
// Only when the scene has lighting of its own.
"lighting": {
"exposure": 1,
Expand Down Expand Up @@ -180,6 +182,15 @@ light. Only its direction counts, so it cannot be zero. A point light's `positio
position in millimeters; it does not dim with distance unless it has a `range`. With `camera`,
both are in the camera's frame instead: x right, y up, +z toward the viewer.

### Groups

Groups are optional and only organize the editor. No export contains them, and a file without
them opens with every part ungrouped.

- `groups` lists each group's `id`, unique within `groups`, and its `name`. It is present only
when at least one part is grouped, and lists only groups that have parts.
- `parts[].groupId` names the group the part belongs to. It is absent when the part has none.

## Validation

A file can be damaged, or crafted, so the reader checks it before trusting it:
Expand All @@ -204,6 +215,8 @@ A file can be damaged, or crafted, so the reader checks it before trusting it:
it is directional with a zero position, and only the first 8 valid lights are kept. Its other
fields fall back to the name `Light` or `Point`, `#ffffff`, intensity 1, range 0, enabled,
without shadows, and not following the camera. Unknown fields are dropped.
- Groups are repaired rather than refused. A group whose `id` or `name` is not a string, or
whose `id` is empty or repeated, is dropped, and so is a `groupId` that names no group.
- A file with a higher version number asks for a newer version of Kitbasher.

Blocks carry no checksum. Damage that still unpacks to finite values in range opens as a
Expand Down
8 changes: 6 additions & 2 deletions mcp/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { solveAlignment } from '../src/core/alignment';
import { evaluateBoolean } from '../src/core/boolean';
import type { ClipReport } from '../src/core/clipping';
import type { BooleanOperation } from '../src/core/boolean';
import { captureComponents, instantiateComponents } from '../src/core/clipboard';
import { addedGroups, captureComponents, instantiateComponents } from '../src/core/clipboard';
import { anchorError, isJointConnected } from '../src/core/constraints';
import {
export3mf,
Expand Down Expand Up @@ -724,7 +724,10 @@ export class Session {
transform = step.clone().multiply(transform);
const scene = editor().scene;
const clipboard = { ...captureComponents(scene, sources), nextOffset: 0 };
const copies = instantiateComponents(clipboard, [...scene.parts, ...added]);
const copies = instantiateComponents(clipboard, {
parts: [...scene.parts, ...added],
groups: scene.groups,
});
const ids = new Map<string, string>();
const parts = copies.parts.map((part, i) => {
const name = spec.names?.[added.length + i] ?? part.name;
Expand Down Expand Up @@ -770,6 +773,7 @@ export class Session {
parts: [...scene.parts, ...parts],
joints: [...scene.joints, ...joints],
constraints: [...(scene.constraints ?? []), ...constraints],
...addedGroups(scene, copies.groups),
});
added.push(...parts);
}
Expand Down
Binary file modified public/docs/images/reference/view-menu.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/components/Dialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ function HelpDialog() {
['Fine move / rotate / scale', 'Hold Shift while dragging · 10× finer'],
['Pan', 'Right drag or Shift + left drag'],
['Zoom', 'Scroll / pinch · tune in Preferences'],
['Select multiple', 'Shift / Ctrl / ⌘ + click'],
['Select multiple', 'Ctrl / ⌘ + click · Shift + click in the viewport'],
['Select a range of parts', 'Shift + click in Parts'],
['Select all components', key('selectAll')],
['Deselect all', keys('deselect', 'cancel')],
['Copy / Cut / Paste components', keys('copy', 'cut', 'paste')],
Expand All @@ -652,12 +653,13 @@ function HelpDialog() {
['Pick pivot on model', `${key('pivot')} · click a surface`],
['Align / Joint / Measure', keys('align', 'joint', 'measure')],
['Front / Right / Top', keys('viewFront', 'viewRight', 'viewTop')],
['Toggle projection', key('projection')],
['Perspective / orthographic view', key('projection')],
['Undo / Redo', keys('undo', 'redo')],
['Save / Open', keys('save', 'open')],
['New assembly / Import', keys('new', 'import')],
['Export', key('export')],
['Duplicate', key('duplicate')],
['Group / Ungroup', keys('group', 'ungroup')],
['Delete unlocked parts', key('delete')],
['Finish / Cancel tool', keys('apply', 'cancel')],
['Exit camera tool', `${key('cancel')} (keeps picked pairs)`],
Expand Down
5 changes: 5 additions & 0 deletions src/components/EditorContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EyeOff,
Focus,
GitMerge,
Group,
Import,
Layers2,
Link2,
Expand All @@ -25,6 +26,7 @@ import {
ScanLine,
Scissors,
Trash2,
Ungroup,
UnlockKeyhole,
} from 'lucide-react';
import { contactBrush, activeBrush } from '../core/editor-brush';
Expand All @@ -49,6 +51,8 @@ const icons = {
duplicate: Copy,
rename: Pencil,
delete: Trash2,
group: Group,
ungroup: Ungroup,
move: Move3D,
rotate: Rotate3D,
scale: Scaling,
Expand Down Expand Up @@ -178,6 +182,7 @@ function OpenContextMenu({
? [
['cut', 'copy', 'paste', 'duplicate'],
['rename', 'delete'],
['group', 'ungroup'],
['focus', 'pivot', 'align', 'paint', 'joint', 'merge', 'inspect'],
['isolate', 'isolateNearby'],
['hide', 'hideOthers', unlocked ? 'lock' : 'unlock', 'showAll'],
Expand Down
Loading
Loading