feat(block): BEDIT block editor as a dedicated space tab (#261)
Selecting a block and running BEDIT (command, ribbon button, or a double-click on the block) opens a block-editor "space" tab, named after the block, alongside Model/Layout in the status bar. The tab draws ONLY the block record's own entities in block-local coordinates; edits are live on the definition, so every INSERT updates. Save Block / Discard buttons (side toolbar) finish the session; Discard restores the on-entry snapshot. Space switching is locked while a block is open, and BEDIT and REFEDIT are mutually exclusive. Implementation: a Scene.block_edit_block override at the top of current_layout_block_handle scopes render/pick/new-entity ownership to the edited block while current_layout stays "Model" (so the pervasive Model-vs-paper code keeps model behaviour). The model render/pick paths that hardcoded model_space_block_handle (wire tile set, hatch render + pick, block-instance meshes) are made binding-aware so the block isolation actually takes effect and model content does not leak in. Entering fits the camera to the block (fit_all already scopes via the binding). Renaming the block tab renames the block itself — new Scene::rename_block re-keys the record, updates the Block marker and repoints every INSERT reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
a4fc34c6a2
commit
3548de332c
8 changed files with 435 additions and 18 deletions
|
|
@ -1097,6 +1097,15 @@ impl OpenCADStudio {
|
|||
}
|
||||
}
|
||||
|
||||
// BEDIT block editor: right-edge Save Block / Discard toolbar (#261).
|
||||
if tab.block_edit.is_some() && !tab.is_start {
|
||||
if let Some(tb) = crate::ui::side_toolbar::view(
|
||||
&crate::modules::draw::modify::block_edit::block_edit_tools(),
|
||||
) {
|
||||
viewport_stack = viewport_stack.push(tb);
|
||||
}
|
||||
}
|
||||
|
||||
// Quick Properties: compact floating property panel on selection,
|
||||
// anchored at the canvas top-left so it doesn't track the cursor.
|
||||
if self.quick_properties && !tab.is_start {
|
||||
|
|
@ -1328,8 +1337,19 @@ impl OpenCADStudio {
|
|||
self.polar_popup_open,
|
||||
self.dyn_input,
|
||||
self.snapper.otrack_enabled,
|
||||
tab.scene.layout_names(),
|
||||
tab.scene.current_layout.clone(),
|
||||
{
|
||||
// In a BEDIT block editor, show the block as an extra
|
||||
// active space tab alongside Model/layouts. (#261)
|
||||
let mut names = tab.scene.layout_names();
|
||||
if let Some(be) = &tab.block_edit {
|
||||
names.push(be.block_name.clone());
|
||||
}
|
||||
names
|
||||
},
|
||||
tab.block_edit
|
||||
.as_ref()
|
||||
.map(|be| be.block_name.clone())
|
||||
.unwrap_or_else(|| tab.scene.current_layout.clone()),
|
||||
self.layout_rename_state.as_ref(),
|
||||
tab.scene.first_viewport_scale(),
|
||||
tab.scene.viewport_count(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue