refactor(scene): group modules into role-based subfolders

Move the 30 flat modules under src/scene/ into six folders by role:
convert (entity→geometry), text (fonts/shaping), model (render models),
pick (hit-test/selection/grips/xclip), view (camera/transform/render),
cache (block + property caches). pipeline/ is unchanged.

Full path migration — all `scene::X` references become
`scene::<group>::X`, no compatibility re-exports. render.rs items that
were `pub(super)` (parent was scene) become `pub(in crate::scene)` to
keep their original scene-wide visibility.

No behavior change; build and tests are green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 11:33:46 +03:00
1 parent cd048165a9
commit 7fe7e0230d
160 files changed
+732 -715

No files matched your search

+21 -21
View File
@@ -523,8 +523,8 @@ impl OpenCADStudio {
for h in &dest {
if let Some(e) = self.tabs[i].scene.document.get_entity_mut(*h) {
e.as_entity_mut().set_layer(layer.clone());
crate::scene::dispatch::apply_color(e, color);
crate::scene::dispatch::apply_line_weight(e, lw);
crate::scene::view::dispatch::apply_color(e, color);
crate::scene::view::dispatch::apply_line_weight(e, lw);
e.common_mut().linetype = linetype.clone();
e.common_mut().linetype_scale = lt_scale;
}
@@ -553,7 +553,7 @@ impl OpenCADStudio {
.clone()
.into_iter()
.map(|mut entity| {
crate::scene::dispatch::apply_transform(&mut entity, &translate);
crate::scene::view::dispatch::apply_transform(&mut entity, &translate);
entity.common_mut().handle = acadrust::Handle::NULL;
self.tabs[i].scene.add_entity(entity)
})
@@ -1170,8 +1170,8 @@ impl OpenCADStudio {
} => {
use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject;
use crate::scene::truck_tess;
use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::convert::truck_tess;
use truck_modeling::builder;
use truck_modeling::Vector3 as TruckVec3;
@@ -1192,7 +1192,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1236,8 +1236,8 @@ impl OpenCADStudio {
} => {
use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject;
use crate::scene::truck_tess;
use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::convert::truck_tess;
use truck_modeling::builder;
use truck_modeling::{Point3, Rad, Vector3 as TruckVec3};
@@ -1270,7 +1270,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1311,8 +1311,8 @@ impl OpenCADStudio {
} => {
use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject;
use crate::scene::truck_tess;
use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::convert::truck_tess;
use truck_modeling::builder;
use truck_modeling::Vector3 as TruckVec3;
@@ -1355,7 +1355,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1372,7 +1372,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1404,7 +1404,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1421,7 +1421,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1460,8 +1460,8 @@ impl OpenCADStudio {
CmdResult::LoftEntities { handles, color } => {
use crate::entities::traits::EntityTypeOps;
use crate::modules::insert::solid3d_cmds::empty_solid3d;
use crate::scene::acad_to_truck::TruckObject;
use crate::scene::truck_tess;
use crate::scene::convert::acad_to_truck::TruckObject;
use crate::scene::convert::truck_tess;
use truck_modeling::builder;
// Collect wires from each profile.
@@ -1482,7 +1482,7 @@ impl OpenCADStudio {
}
let woff = self.tabs[i].scene.world_offset;
let result: Option<crate::scene::mesh_model::MeshModel> = (|| {
let result: Option<crate::scene::model::mesh_model::MeshModel> = (|| {
if wires.len() < 2 {
return None;
}
@@ -1511,7 +1511,7 @@ impl OpenCADStudio {
verts,
normals,
indices,
} => Some(crate::scene::mesh_model::MeshModel {
} => Some(crate::scene::model::mesh_model::MeshModel {
name: String::new(),
verts,
normals,
@@ -1552,8 +1552,8 @@ impl OpenCADStudio {
if let Some(mut model) = self.tabs[i].scene.hatches.get(&handle).cloned() {
// Update model fields
if !name.is_empty() {
use crate::scene::hatch_model::HatchPattern;
use crate::scene::hatch_patterns;
use crate::scene::model::hatch_model::HatchPattern;
use crate::scene::model::hatch_patterns;
model.name = name.clone();
if name.to_uppercase() == "SOLID" {
model.pattern = HatchPattern::Solid;
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::command::CadCommand;
use crate::linetypes;
use crate::modules::home::modify::refedit::RefEditSession;
use crate::scene::grip::GripEdit;
use crate::scene::pick::grip::GripEdit;
use crate::scene::GripDef;
use crate::scene::Scene;
use crate::snap::SnapResult;
+2 -2
View File
@@ -50,7 +50,7 @@ pub struct GripPopup {
pub handle: acadrust::Handle,
pub grip_id: usize,
pub anchor: iced::Point,
pub items: Vec<crate::scene::object::GripMenuItem>,
pub items: Vec<crate::scene::model::object::GripMenuItem>,
pub selected: usize,
}
@@ -62,7 +62,7 @@ pub struct GripPopup {
pub struct GripPendingValue {
pub handle: acadrust::Handle,
pub grip_id: usize,
pub action: crate::scene::object::GripMenuAction,
pub action: crate::scene::model::object::GripMenuAction,
pub label: &'static str,
}
+1 -1
View File
@@ -9,7 +9,7 @@ use truck_modeling::Solid;
use super::Message;
use crate::modules::model::boolean_cmd::BoolOp;
use crate::scene::model_solid::{self, Bool};
use crate::scene::model::model_solid::{self, Bool};
impl super::OpenCADStudio {
/// Commit a Model-tab solid: add its acadrust entity to the document, then
+2 -2
View File
@@ -323,8 +323,8 @@ pub fn visible_spans(raw: &str) -> Vec<(usize, usize)> {
// ── App-side editor driver ──────────────────────────────────────────────────
use crate::scene::tessellate;
use crate::scene::wire_model::WireModel;
use crate::scene::convert::tessellate;
use crate::scene::model::wire_model::WireModel;
use iced::widget::text_editor::{Action, Edit};
use std::sync::Arc;
+31 -31
View File
@@ -1,7 +1,7 @@
use super::helpers::{entity_type_key, entity_type_label, title_case_word};
use super::{OpenCADStudio, VARIES_LABEL};
use crate::linetypes;
use crate::scene::dispatch;
use crate::scene::view::dispatch;
use crate::ui;
use acadrust::{EntityType, Handle};
@@ -118,28 +118,28 @@ impl OpenCADStudio {
.collect();
if let Some(geom) = sections.last_mut() {
geom.props.push(crate::scene::object::Property {
geom.props.push(crate::scene::model::object::Property {
label: "Frozen Layers".to_string(),
field: "frozen_layers",
value: crate::scene::object::PropValue::EditText(
value: crate::scene::model::object::PropValue::EditText(
frozen_names.join(", "),
),
});
if !ucs_names.is_empty() {
geom.props.push(crate::scene::object::Property {
geom.props.push(crate::scene::model::object::Property {
label: "UCS Name".to_string(),
field: "vp_ucs_name",
value: crate::scene::object::PropValue::Choice {
value: crate::scene::model::object::PropValue::Choice {
selected: current_ucs,
options: ucs_names,
},
});
}
if !view_names.is_empty() {
geom.props.push(crate::scene::object::Property {
geom.props.push(crate::scene::model::object::Property {
label: "Named View".to_string(),
field: "vp_named_view",
value: crate::scene::object::PropValue::Choice {
value: crate::scene::model::object::PropValue::Choice {
selected: String::new(),
options: view_names,
},
@@ -167,7 +167,7 @@ impl OpenCADStudio {
if let Some(prop) =
geom.props.iter_mut().find(|p| p.field == "vscale_std")
{
prop.value = crate::scene::object::PropValue::Choice {
prop.value = crate::scene::model::object::PropValue::Choice {
selected,
options,
};
@@ -195,10 +195,10 @@ impl OpenCADStudio {
geom.props.iter_mut().find(|p| p.field == "style_name")
{
let current = match &prop.value {
crate::scene::object::PropValue::EditText(s) => s.clone(),
crate::scene::model::object::PropValue::EditText(s) => s.clone(),
_ => String::new(),
};
prop.value = crate::scene::object::PropValue::Choice {
prop.value = crate::scene::model::object::PropValue::Choice {
selected: current,
options: dim_style_names,
};
@@ -210,10 +210,10 @@ impl OpenCADStudio {
if !group_names.is_empty() {
let label = group_names.join(", ");
if let Some(general) = sections.first_mut() {
general.props.push(crate::scene::object::Property {
general.props.push(crate::scene::model::object::Property {
label: "Group".to_string(),
field: "group",
value: crate::scene::object::PropValue::ReadOnly(label),
value: crate::scene::model::object::PropValue::ReadOnly(label),
});
}
}
@@ -240,7 +240,7 @@ impl OpenCADStudio {
.iter()
.flat_map(|section| section.props.iter())
.filter_map(|prop| match &prop.value {
crate::scene::object::PropValue::Choice { options, .. } => Some((
crate::scene::model::object::PropValue::Choice { options, .. } => Some((
prop.field.to_string(),
iced::widget::combo_box::State::new(options.clone()),
)),
@@ -252,7 +252,7 @@ impl OpenCADStudio {
layer_combo: iced::widget::combo_box::State::new(layer_names.clone()),
linetype_combo: iced::widget::combo_box::State::new(linetype_items.clone()),
hatch_pattern_combo: iced::widget::combo_box::State::new(
crate::scene::hatch_patterns::names(),
crate::scene::model::hatch_patterns::names(),
),
lineweight_combo: iced::widget::combo_box::State::new(
ui::properties::lw_options(),
@@ -284,7 +284,7 @@ impl OpenCADStudio {
.iter()
.flat_map(|section| section.props.iter())
.filter_map(|prop| match &prop.value {
crate::scene::object::PropValue::Choice { options, .. } => Some((
crate::scene::model::object::PropValue::Choice { options, .. } => Some((
prop.field.to_string(),
iced::widget::combo_box::State::new(options.clone()),
)),
@@ -299,7 +299,7 @@ impl OpenCADStudio {
layer_combo: iced::widget::combo_box::State::new(layer_names.clone()),
linetype_combo: iced::widget::combo_box::State::new(linetype_items.clone()),
hatch_pattern_combo: iced::widget::combo_box::State::new(
crate::scene::hatch_patterns::names(),
crate::scene::model::hatch_patterns::names(),
),
lineweight_combo: iced::widget::combo_box::State::new(
ui::properties::lw_options(),
@@ -527,13 +527,13 @@ impl OpenCADStudio {
}
}
crate::scene::dispatch::apply_color(&mut entity, self.ribbon.active_color);
crate::scene::dispatch::apply_common_prop(
crate::scene::view::dispatch::apply_color(&mut entity, self.ribbon.active_color);
crate::scene::view::dispatch::apply_common_prop(
&mut entity,
"linetype",
&self.ribbon.active_linetype.clone(),
);
crate::scene::dispatch::apply_line_weight(&mut entity, self.ribbon.active_lineweight);
crate::scene::view::dispatch::apply_line_weight(&mut entity, self.ribbon.active_lineweight);
// CELTSCALE (header.current_entity_linetype_scale): new entities
// pick up the document's saved per-entity linetype scale. The user
// can override per entity later via the properties panel.
@@ -741,12 +741,12 @@ pub(super) fn build_selection_groups(
pub(super) fn aggregate_sections(
selected: &[(Handle, &EntityType)],
text_style_names: &[String],
) -> Vec<crate::scene::object::PropSection> {
) -> Vec<crate::scene::model::object::PropSection> {
if selected.is_empty() {
return vec![];
}
let mut all_sections: Vec<Vec<crate::scene::object::PropSection>> = selected
let mut all_sections: Vec<Vec<crate::scene::model::object::PropSection>> = selected
.iter()
.map(|(handle, entity)| dispatch::properties_sectioned(*handle, entity, text_style_names))
.collect();
@@ -759,15 +759,15 @@ pub(super) fn aggregate_sections(
}
fn merge_sections(
left: &[crate::scene::object::PropSection],
right: &[crate::scene::object::PropSection],
) -> Vec<crate::scene::object::PropSection> {
left: &[crate::scene::model::object::PropSection],
right: &[crate::scene::model::object::PropSection],
) -> Vec<crate::scene::model::object::PropSection> {
left.iter()
.filter_map(|section| {
let rhs = right
.iter()
.find(|candidate| candidate.title == section.title)?;
let props: Vec<crate::scene::object::Property> = section
let props: Vec<crate::scene::model::object::Property> = section
.props
.iter()
.filter_map(|prop| {
@@ -775,7 +775,7 @@ fn merge_sections(
.props
.iter()
.find(|candidate| candidate.field == prop.field)?;
Some(crate::scene::object::Property {
Some(crate::scene::model::object::Property {
label: prop.label.clone(),
field: prop.field,
value: merge_prop_value(&prop.value, &other.value),
@@ -785,7 +785,7 @@ fn merge_sections(
if props.is_empty() {
None
} else {
Some(crate::scene::object::PropSection {
Some(crate::scene::model::object::PropSection {
title: section.title.clone(),
props,
})
@@ -795,10 +795,10 @@ fn merge_sections(
}
fn merge_prop_value(
left: &crate::scene::object::PropValue,
right: &crate::scene::object::PropValue,
) -> crate::scene::object::PropValue {
use crate::scene::object::PropValue;
left: &crate::scene::model::object::PropValue,
right: &crate::scene::model::object::PropValue,
) -> crate::scene::model::object::PropValue {
use crate::scene::model::object::PropValue;
if left == right {
return left.clone();
+39 -39
View File
@@ -4,8 +4,8 @@ use super::helpers::{
};
use super::{Message, OpenCADStudio, POLY_START_DELAY_MS};
use crate::modules::ModuleEvent;
use crate::scene::grip::{find_hit_grip, find_hit_grip_paper, GripEdit};
use crate::scene::object::GripApply;
use crate::scene::pick::grip::{find_hit_grip, find_hit_grip_paper, GripEdit};
use crate::scene::model::object::GripApply;
use crate::scene::{
self, hover_id, Scene, TileEdgeOrient, VIEWCUBE_DRAW_PX, VIEWCUBE_PAD, VIEWCUBE_PX,
};
@@ -552,13 +552,13 @@ impl OpenCADStudio {
// STL gets the highest-resolution LOD (slot 0) so the
// exported geometry isn't downgraded by the view-dependent
// mesh LOD ladder used for rendering.
let meshes: Vec<crate::scene::mesh_model::MeshModel> = self.tabs[i]
let meshes: Vec<crate::scene::model::mesh_model::MeshModel> = self.tabs[i]
.scene
.meshes
.values()
.filter_map(|s| s.lods.first().cloned())
.collect();
let mesh_refs: Vec<&crate::scene::mesh_model::MeshModel> = meshes.iter().collect();
let mesh_refs: Vec<&crate::scene::model::mesh_model::MeshModel> = meshes.iter().collect();
match crate::io::stl::build_stl(&mesh_refs) {
Some(bytes) => match std::fs::write(&path, bytes) {
Ok(()) => self
@@ -603,13 +603,13 @@ impl OpenCADStudio {
Message::StepExportPath(Some(path)) => {
let i = self.active_tab;
// Export uses LOD 0 (full resolution); see StlExportPath above.
let meshes: Vec<crate::scene::mesh_model::MeshModel> = self.tabs[i]
let meshes: Vec<crate::scene::model::mesh_model::MeshModel> = self.tabs[i]
.scene
.meshes
.values()
.filter_map(|s| s.lods.first().cloned())
.collect();
let mesh_refs: Vec<&crate::scene::mesh_model::MeshModel> = meshes.iter().collect();
let mesh_refs: Vec<&crate::scene::model::mesh_model::MeshModel> = meshes.iter().collect();
match crate::io::step::build_step(&mesh_refs) {
Some(text) => match std::fs::write(&path, text.as_bytes()) {
Ok(()) => self
@@ -1435,7 +1435,7 @@ impl OpenCADStudio {
if let Some(e) = self.tabs[i].scene.document.get_entity_mut(h) {
e.apply_grip_menu(
gid,
crate::scene::object::GripMenuAction::RemoveLeader,
crate::scene::model::object::GripMenuAction::RemoveLeader,
);
}
self.tabs[i].scene.bump_geometry();
@@ -2121,7 +2121,7 @@ impl OpenCADStudio {
// Multi-functional grip hover: detect cursor sitting on a
// selected entity's grip and, after a dwell, open the
// popup menu. See scene::object::GripMenuItem.
// popup menu. See scene::model::object::GripMenuItem.
self.update_grip_hover(i, p);
let mut sel = self.tabs[i].scene.selection.borrow_mut();
@@ -2405,7 +2405,7 @@ impl OpenCADStudio {
};
let view_proj = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires = self.tabs[i].scene.hit_test_wires();
let hovered = scene::hit_test::click_hit(p, &all_wires[..], view_proj, bounds)
let hovered = scene::pick::hit_test::click_hit(p, &all_wires[..], view_proj, bounds)
.and_then(|s| Scene::handle_from_wire_name(s));
self.tabs[i].scene.set_hover_highlight(hovered);
} else {
@@ -2620,7 +2620,7 @@ impl OpenCADStudio {
p
} else if needs_entity {
let hover_handle =
scene::hit_test::click_hit(p, &all_wires[..], view_proj, bounds)
scene::pick::hit_test::click_hit(p, &all_wires[..], view_proj, bounds)
.and_then(|s| Scene::handle_from_wire_name(s))
.unwrap_or(acadrust::Handle::NULL);
let mut p = self.tabs[i]
@@ -3185,7 +3185,7 @@ impl OpenCADStudio {
{
let vp_mat2 = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires2 = self.tabs[i].scene.hit_test_wires();
let hit = scene::hit_test::click_hit(p, &all_wires2[..], vp_mat2, bounds)
let hit = scene::pick::hit_test::click_hit(p, &all_wires2[..], vp_mat2, bounds)
.and_then(|s| Scene::handle_from_wire_name(s));
if let Some(handle) = hit {
// Some commands (e.g. SS_CATCHMENT) need the entity
@@ -3374,7 +3374,7 @@ impl OpenCADStudio {
let crossing = box_crossing;
let all_wires = self.tabs[i].scene.hit_test_wires();
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let mut handles: Vec<Handle> = scene::hit_test::box_hit(
let mut handles: Vec<Handle> = scene::pick::hit_test::box_hit(
a,
p,
crossing,
@@ -3385,7 +3385,7 @@ impl OpenCADStudio {
.into_iter()
.filter_map(|s| Scene::handle_from_wire_name(s))
.collect();
handles.extend(scene::hit_test::box_hit_hatch(
handles.extend(scene::pick::hit_test::box_hit_hatch(
a,
p,
crossing,
@@ -3427,7 +3427,7 @@ impl OpenCADStudio {
self.tabs[i].scene.selection.borrow_mut().poly_last_crossing = crossing;
let all_wires = self.tabs[i].scene.hit_test_wires();
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let mut handles: Vec<Handle> = scene::hit_test::poly_hit(
let mut handles: Vec<Handle> = scene::pick::hit_test::poly_hit(
&poly_pts,
crossing,
&all_wires[..],
@@ -3437,7 +3437,7 @@ impl OpenCADStudio {
.into_iter()
.filter_map(|s| Scene::handle_from_wire_name(s))
.collect();
handles.extend(scene::hit_test::poly_hit_hatch(
handles.extend(scene::pick::hit_test::poly_hit_hatch(
&poly_pts,
crossing,
&self.tabs[i].scene.visible_hatches_for_click(),
@@ -3481,7 +3481,7 @@ impl OpenCADStudio {
// unchanged when off.
let mut handled_by_cycling = false;
if self.selection_cycling {
let cands: Vec<Handle> = scene::hit_test::click_hits_all(
let cands: Vec<Handle> = scene::pick::hit_test::click_hits_all(
p,
&all_wires[..],
vp_mat,
@@ -3500,10 +3500,10 @@ impl OpenCADStudio {
if !handled_by_cycling {
let hit =
scene::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
scene::pick::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
.and_then(|s| Scene::handle_from_wire_name(s))
.or_else(|| {
scene::hit_test::click_hit_hatch(
scene::pick::hit_test::click_hit_hatch(
p,
&self.tabs[i].scene.visible_hatches_for_click(),
vp_mat,
@@ -3513,7 +3513,7 @@ impl OpenCADStudio {
.or_else(|| {
// Block-internal hatch: resolve to the
// parent Insert (AutoCAD behaviour).
scene::hit_test::click_hit_insert_hatch(
scene::pick::hit_test::click_hit_insert_hatch(
p,
&self.tabs[i].scene.insert_hatches_for_click(),
vp_mat,
@@ -3561,7 +3561,7 @@ impl OpenCADStudio {
let crossing = box_crossing;
let all_wires = self.tabs[i].scene.hit_test_wires();
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let mut handles: Vec<Handle> = scene::hit_test::box_hit(
let mut handles: Vec<Handle> = scene::pick::hit_test::box_hit(
a,
p,
crossing,
@@ -3572,7 +3572,7 @@ impl OpenCADStudio {
.into_iter()
.filter_map(|s| Scene::handle_from_wire_name(s))
.collect();
handles.extend(scene::hit_test::box_hit_hatch(
handles.extend(scene::pick::hit_test::box_hit_hatch(
a,
p,
crossing,
@@ -3657,7 +3657,7 @@ impl OpenCADStudio {
};
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires = self.tabs[i].scene.hit_test_wires();
let hit = scene::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
let hit = scene::pick::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
.and_then(|s| Scene::handle_from_wire_name(s));
if let Some(handle) = hit {
// Any text-bearing entity opens its in-place editor
@@ -3712,7 +3712,7 @@ impl OpenCADStudio {
let hit_vp: Option<acadrust::Handle> = {
let vp_mat = self.tabs[i].scene.camera.borrow().view_proj(bounds);
let all_wires = self.tabs[i].scene.hit_test_wires();
scene::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
scene::pick::hit_test::click_hit(p, &all_wires[..], vp_mat, bounds)
.and_then(|s| Scene::handle_from_wire_name(s))
.and_then(|h| {
if let Some(AcadEntityType::Viewport(vp)) =
@@ -3981,7 +3981,7 @@ impl OpenCADStudio {
return Task::none();
};
use crate::entities::traits::EntityTypeOps;
use crate::scene::object::GripMenuAction;
use crate::scene::model::object::GripMenuAction;
if matches!(
item.action,
GripMenuAction::Stretch
@@ -4643,7 +4643,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "layer", &layer);
crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
}
}
self.tabs[i].dirty = true;
@@ -4669,7 +4669,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_color(entity, color);
crate::scene::view::dispatch::apply_color(entity, color);
}
}
self.tabs[i].dirty = true;
@@ -4706,7 +4706,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "linetype", &lt);
crate::scene::view::dispatch::apply_common_prop(entity, "linetype", &lt);
}
}
self.tabs[i].dirty = true;
@@ -4728,7 +4728,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for handle in handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_line_weight(entity, lw);
crate::scene::view::dispatch::apply_line_weight(entity, lw);
}
}
self.tabs[i].dirty = true;
@@ -4790,7 +4790,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "layer", &layer);
crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
}
}
self.invalidate_property_targets(i, &handles);
@@ -4807,7 +4807,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_color(entity, color);
crate::scene::view::dispatch::apply_color(entity, color);
}
}
self.invalidate_property_targets(i, &handles);
@@ -4826,7 +4826,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_line_weight(entity, lw);
crate::scene::view::dispatch::apply_line_weight(entity, lw);
}
}
self.invalidate_property_targets(i, &handles);
@@ -4843,7 +4843,7 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
crate::scene::dispatch::apply_common_prop(entity, "linetype", &lt);
crate::scene::view::dispatch::apply_common_prop(entity, "linetype", &lt);
}
}
self.invalidate_property_targets(i, &handles);
@@ -4857,7 +4857,7 @@ impl OpenCADStudio {
let i = self.active_tab;
let handles = self.property_target_handles(i);
if !handles.is_empty() {
use crate::scene::hatch_patterns;
use crate::scene::model::hatch_patterns;
if let Some(entry) = hatch_patterns::find(&name) {
self.push_undo_snapshot(i, "HATCHEDIT");
for &handle in &handles {
@@ -4867,7 +4867,7 @@ impl OpenCADStudio {
dxf.pattern = hatch_patterns::build_dxf_pattern(entry);
dxf.is_solid = matches!(
entry.gpu,
crate::scene::hatch_model::HatchPattern::Solid
crate::scene::model::hatch_model::HatchPattern::Solid
);
}
if let Some(model) = self.tabs[i].scene.hatches.get_mut(&handle) {
@@ -4891,9 +4891,9 @@ impl OpenCADStudio {
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
match field {
"invisible" => crate::scene::dispatch::toggle_invisible(entity),
"invisible" => crate::scene::view::dispatch::toggle_invisible(entity),
_ => {
crate::scene::dispatch::apply_geom_prop(entity, field, "toggle")
crate::scene::view::dispatch::apply_geom_prop(entity, field, "toggle")
}
}
}
@@ -4958,7 +4958,7 @@ impl OpenCADStudio {
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle)
{
crate::scene::dispatch::apply_geom_prop(entity, field, &value);
crate::scene::view::dispatch::apply_geom_prop(entity, field, &value);
}
}
}
@@ -5014,12 +5014,12 @@ impl OpenCADStudio {
{
match field {
"linetype_scale" | "transparency" => {
crate::scene::dispatch::apply_common_prop(
crate::scene::view::dispatch::apply_common_prop(
entity, field, &val,
);
}
_ => {
crate::scene::dispatch::apply_geom_prop(
crate::scene::view::dispatch::apply_geom_prop(
entity, field, &val,
);
}
+2 -2
View File
@@ -3,8 +3,8 @@ use super::document::{DynComponent, DynFieldEntry};
use super::helpers::grid_plane_from_camera;
use super::history::history_dropdown_labels;
use super::{Message, OpenCADStudio};
use crate::scene::grip::{grips_to_screen, grips_to_screen_paper};
use crate::scene::viewport_pane::ViewportPane;
use crate::scene::pick::grip::{grips_to_screen, grips_to_screen_paper};
use crate::scene::view::viewport_pane::ViewportPane;
use crate::scene::{VIEWCUBE_DRAW_PX, VIEWCUBE_PAD};
use crate::ui::overlay;
use iced::widget::{
+1 -1
View File
@@ -15,7 +15,7 @@ use acadrust::objects::BlockVisibilityParameter;
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use crate::scene::object::{GripDef, GripShape};
use crate::scene::model::object::{GripDef, GripShape};
use super::OpenCADStudio;
+3 -3
View File
@@ -5,8 +5,8 @@
// viewport events from main.rs and returns `CmdResult` tokens that tell
// the host what to do next.
use crate::scene::hatch_model::HatchModel;
use crate::scene::wire_model::WireModel;
use crate::scene::model::hatch_model::HatchModel;
use crate::scene::model::wire_model::WireModel;
use crate::scene::Scene;
use acadrust::{EntityType, Handle};
use glam::Vec3;
@@ -194,7 +194,7 @@ pub enum CmdResult {
/// Create a Solid3D placeholder entity + associated MeshModel.
/// `mesh_fn` is called with the entity's handle string to build the mesh.
CommitSolid3D {
mesh_fn: Box<dyn FnOnce(String) -> Option<crate::scene::mesh_model::MeshModel> + Send>,
mesh_fn: Box<dyn FnOnce(String) -> Option<crate::scene::model::mesh_model::MeshModel> + Send>,
},
/// Extrude the profile entity `handle` by `height` along Z.
ExtrudeEntity {
+14 -14
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::{SnapHint, TangentGeom};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::{SnapHint, TangentGeom};
const TAU: f64 = std::f64::consts::TAU;
@@ -21,13 +21,13 @@ fn to_truck(arc: &Arc) -> TruckEntity {
let normal = (arc.normal.x, arc.normal.y, arc.normal.z);
// Compute OCS basis vectors for this entity's normal.
let (ax, ay) = crate::scene::transform::ocs_axes(normal);
let (ax, ay) = crate::scene::view::transform::ocs_axes(normal);
let ccw_end = if ea >= sa { ea } else { ea + TAU };
let mid_a = sa + (ccw_end - sa) * 0.5;
// Arc centre in WCS.
let (cwx, cwy, cwz) = crate::scene::transform::ocs_point_to_wcs((cx, cy, cz), normal);
let (cwx, cwy, cwz) = crate::scene::view::transform::ocs_point_to_wcs((cx, cy, cz), normal);
// Arc points in WCS: centre_wcs + r*cos(a)*Ax + r*sin(a)*Ay
let arc_pt = |a: f64| {
@@ -198,8 +198,8 @@ fn apply_grip(arc: &mut Arc, grip_id: usize, apply: GripApply) {
}
fn apply_transform(arc: &mut Arc, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(arc, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(arc, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
@@ -227,8 +227,8 @@ impl crate::entities::traits::Grippable for Arc {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
match grip_id {
0 => vec![GripMenuItem {
label: "Stretch",
@@ -260,7 +260,7 @@ impl crate::entities::traits::Grippable for Arc {
],
}
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Radius / Arc Length / Lengthen all need a follow-up prompt;
// the actual edit happens in `apply_grip_menu_value`.
}
@@ -268,9 +268,9 @@ impl crate::entities::traits::Grippable for Arc {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::Radius => Some("New radius"),
A::ArcLength => Some("New arc length"),
@@ -282,10 +282,10 @@ impl crate::entities::traits::Grippable for Arc {
fn apply_grip_menu_value(
&mut self,
grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::Radius if value > 0.0 => self.radius = value,
A::ArcLength if value > 0.0 && self.radius > 1e-9 => {
+5 -4
View File
@@ -12,10 +12,11 @@ use crate::entities::text_support::{
MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::{lff, transform};
use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
use crate::scene::text::lff;
use crate::scene::view::transform;
// ── Shared helpers ────────────────────────────────────────────────────────────
+7 -7
View File
@@ -7,9 +7,9 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::{SnapHint, TangentGeom};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::{SnapHint, TangentGeom};
fn to_truck(circle: &Circle) -> TruckEntity {
let cx = circle.center.x;
@@ -18,8 +18,8 @@ fn to_truck(circle: &Circle) -> TruckEntity {
let r = circle.radius;
let normal = (circle.normal.x, circle.normal.y, circle.normal.z);
let (ax, ay) = crate::scene::transform::ocs_axes(normal);
let (cwx, cwy, cwz) = crate::scene::transform::ocs_point_to_wcs((cx, cy, cz), normal);
let (ax, ay) = crate::scene::view::transform::ocs_axes(normal);
let (cwx, cwy, cwz) = crate::scene::view::transform::ocs_point_to_wcs((cx, cy, cz), normal);
// Circle points in WCS: centre_wcs ± r * Ax and centre_wcs ± r * Ay
let pt = |da: (f64, f64, f64), db: (f64, f64, f64), s: f64| {
@@ -182,8 +182,8 @@ fn apply_grip(circle: &mut Circle, grip_id: usize, apply: GripApply) {
}
fn apply_transform(circle: &mut Circle, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(circle, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(circle, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
+1 -1
View File
@@ -1,6 +1,6 @@
use std::cell::Cell;
use crate::scene::object::{GripDef, GripShape, PropValue, Property};
use crate::scene::model::object::{GripDef, GripShape, PropValue, Property};
/// Linear / angular unit format pulled from the document header so the
/// per-thread properties pipeline can format values consistently without
+21 -21
View File
@@ -10,26 +10,26 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
fn base_props(base: &DimensionBase) -> Vec<crate::scene::object::Property> {
fn base_props(base: &DimensionBase) -> Vec<crate::scene::model::object::Property> {
vec![
crate::scene::object::Property {
crate::scene::model::object::Property {
label: "Text".into(),
field: "text",
value: crate::scene::object::PropValue::EditText(base.text.clone()),
value: crate::scene::model::object::PropValue::EditText(base.text.clone()),
},
crate::scene::object::Property {
crate::scene::model::object::Property {
label: "User Text".into(),
field: "user_text",
value: crate::scene::object::PropValue::EditText(
value: crate::scene::model::object::PropValue::EditText(
base.user_text.clone().unwrap_or_default(),
),
},
crate::scene::object::Property {
crate::scene::model::object::Property {
label: "Style".into(),
field: "style_name",
value: crate::scene::object::PropValue::EditText(base.style_name.clone()),
value: crate::scene::model::object::PropValue::EditText(base.style_name.clone()),
},
edit("Text X", "text_x", base.text_middle_point.x),
edit("Text Y", "text_y", base.text_middle_point.y),
@@ -135,7 +135,7 @@ fn linear_like_props(
first: acadrust::types::Vector3,
second: acadrust::types::Vector3,
definition: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> {
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("First X", "first_x", first.x),
edit("First Y", "first_y", first.y),
@@ -152,7 +152,7 @@ fn linear_like_props(
fn radius_like_props(
center: acadrust::types::Vector3,
point: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> {
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("Center X", "center_x", center.x),
edit("Center Y", "center_y", center.y),
@@ -168,7 +168,7 @@ fn angular_props(
first: acadrust::types::Vector3,
second: acadrust::types::Vector3,
definition: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> {
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("Vertex X", "vertex_x", vertex.x),
edit("Vertex Y", "vertex_y", vertex.y),
@@ -555,7 +555,7 @@ fn scale_point(p: &mut acadrust::types::Vector3, center: Vec3, factor: f32) {
}
fn mirror_point(p: &mut acadrust::types::Vector3, p1: Vec3, p2: Vec3) {
crate::scene::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
}
impl PropertyEditable for Dimension {
@@ -713,8 +713,8 @@ impl Grippable for Dimension {
self.base_mut().actual_measurement = self.measurement();
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let (dim_line_grip, text_grip) = match self {
Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3),
Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2),
@@ -775,8 +775,8 @@ impl Grippable for Dimension {
}
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let (_dim_line_grip, text_grip) = match self {
Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3),
Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2),
@@ -827,18 +827,18 @@ impl Grippable for Dimension {
// definition. Shared dim machinery (`ArrowKind`, `DimGeom`, `append_arrow`,
// arrow blocks, colour resolution, `add_segment` / `add_polyline`,
// `normalized_or`, `entity_z`, `offset_snap_pts`) lives in
// `scene::tessellate` and is reused by Leader / MultiLeader too.
// `scene::convert::tessellate` and is reused by Leader / MultiLeader too.
use acadrust::entities::{MText, Text};
use acadrust::tables::DimStyle;
use acadrust::types::{Color as AcadColor, Vector3};
use acadrust::{CadDocument, EntityType, Handle};
use crate::scene::tess_util::aci_to_rgba;
use crate::scene::tessellate::{
use crate::scene::convert::tess_util::aci_to_rgba;
use crate::scene::convert::tessellate::{
add_polyline, add_segment, append_arrow, arrow_from_block, normalized_or, ArrowKind, DimGeom,
};
use crate::scene::wire_model::{SnapHint, WireModel};
use crate::scene::model::wire_model::{SnapHint, WireModel};
pub trait DimensionTess {
fn tessellate(
@@ -1338,7 +1338,7 @@ fn resolve_pattern_by_handle(
.find(|lt| lt.handle == handle)
.map(|lt| lt.name.clone());
match name {
Some(n) => crate::scene::render::resolve_pattern(&doc.line_types, &n, scale),
Some(n) => crate::scene::view::render::resolve_pattern(&doc.line_types, &n, scale),
None => (0.0, [0.0; 8]),
}
}
+6 -6
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, BSplineCurve, Curve, Edge, KnotVec, Point3, Wire};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
const TAU: f64 = std::f64::consts::TAU;
@@ -218,14 +218,14 @@ fn apply_grip(ell: &mut Ellipse, grip_id: usize, apply: GripApply) {
}
fn apply_transform(ell: &mut Ellipse, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ell, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(ell, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.major_axis.x,
&mut entity.major_axis.y,
p1,
+13 -13
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, ro_prop as ro};
use crate::entities::traits::{FallbackTess, Grippable, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry};
use crate::scene::wire_model::SnapHint;
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::convert::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry};
use crate::scene::model::wire_model::SnapHint;
fn properties(h: &Hatch) -> PropSection {
let pattern_type = match h.pattern_type {
@@ -89,7 +89,7 @@ fn apply_geom_prop(h: &mut Hatch, field: &str, value: &str) {
}
fn apply_transform(h: &mut Hatch, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(h, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(h, t, |entity, p1, p2| {
// Delegate the mirror to acadrust's transform_hatch (via the Entity
// trait): it flips the boundary-arc direction flags, re-mirrors the
// stored angles and preserves the stored sweep — including the
@@ -97,7 +97,7 @@ fn apply_transform(h: &mut Hatch, t: &EntityTransform) {
// hand-rolled angle-swap here was only valid for ccw boundary arcs on
// an axis-aligned mirror line and went stale the moment those
// conventions were fixed upstream.
let t = crate::scene::transform::reflection_about_xy_line(p1, p2);
let t = crate::scene::view::transform::reflection_about_xy_line(p1, p2);
acadrust::entities::Entity::apply_transform(entity, &t);
});
}
@@ -282,8 +282,8 @@ impl Grippable for Hatch {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -304,7 +304,7 @@ impl Grippable for Hatch {
]
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Origin / Angle / Scale need a follow-up value — handled by
// `apply_grip_menu_value`.
}
@@ -312,9 +312,9 @@ impl Grippable for Hatch {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::HatchAngle => Some("Angle (deg)"),
A::HatchScale => Some("Scale"),
@@ -325,10 +325,10 @@ impl Grippable for Hatch {
fn apply_grip_menu_value(
&mut self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::HatchAngle => {
self.pattern_angle = value.to_radians();
@@ -350,7 +350,7 @@ impl FallbackTess for Hatch {
// Convert a 2D OCS hatch boundary point to WCS, then subtract world_offset.
let to_wcs = |x: f64, y: f64| -> [f32; 3] {
let (wx, wy, wz) =
crate::scene::transform::ocs_point_to_wcs((x, y, self.elevation), normal);
crate::scene::view::transform::ocs_point_to_wcs((x, y, self.elevation), normal);
[(wx - ox) as f32, (wy - oy) as f32, (wz - oz) as f32]
};
let mut pts: Vec<[f32; 3]> = Vec::new();
+8 -6
View File
@@ -6,9 +6,11 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, parse_f64, ro_prop as ro, square_grip};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::WireModel;
use crate::scene::{block_cache, render, tessellate};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::WireModel;
use crate::scene::cache::block_cache;
use crate::scene::convert::tessellate;
use crate::scene::view::render;
fn grips(ins: &Insert) -> Vec<GripDef> {
let p = glam::DVec3::new(ins.insert_point.x, ins.insert_point.y, ins.insert_point.z);
@@ -63,7 +65,7 @@ fn apply_grip(ins: &mut Insert, _grip_id: usize, apply: GripApply) {
}
fn apply_transform(ins: &mut Insert, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ins, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(ins, t, |entity, p1, p2| {
let dx = (p2.x - p1.x) as f64;
let dy = (p2.y - p1.y) as f64;
let len = (dx * dx + dy * dy).sqrt();
@@ -98,7 +100,7 @@ impl crate::entities::traits::FallbackTess for Insert {
fn fallback_geometry(
&self,
world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry {
) -> crate::scene::convert::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset;
let ip = Vec3::new(
(self.insert_point.x - ox) as f32,
@@ -114,7 +116,7 @@ impl crate::entities::traits::FallbackTess for Insert {
];
(
pts,
vec![(ip, crate::scene::wire_model::SnapHint::Insertion)],
vec![(ip, crate::scene::model::wire_model::SnapHint::Insertion)],
vec![],
vec![],
)
+16 -16
View File
@@ -5,9 +5,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::TangentGeom;
// ── TruckConvertible (used for snap/grip key-vertices) ─────────────────────
@@ -428,17 +428,17 @@ fn apply_geom_prop(leader: &mut Leader, field: &str, value: &str) {
// ── Transform ──────────────────────────────────────────────────────────────
fn apply_transform(leader: &mut Leader, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(leader, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(leader, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.block_offset.x,
&mut entity.block_offset.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.annotation_offset.x,
&mut entity.annotation_offset.y,
p1,
@@ -465,8 +465,8 @@ impl crate::entities::traits::Grippable for Leader {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n = self.vertices.len();
if grip_id == 0 {
// Arrow head — stretch only.
@@ -497,8 +497,8 @@ impl crate::entities::traits::Grippable for Leader {
}]
}
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -540,7 +540,7 @@ impl crate::entities::traits::Transformable for Leader {
/// Per-entity tessellation entry for `Leader`. Lives here so all leader
/// tess code stays alongside the entity definition. Cross-entity dim
/// machinery (arrow shapes, `DimGeom`) lives in `scene::tessellate` and
/// machinery (arrow shapes, `DimGeom`) lives in `scene::convert::tessellate` and
/// is reused via the dim arrow emitter so the leader matches the active
/// DIMSTYLE.
pub trait LeaderTess {
@@ -553,7 +553,7 @@ pub trait LeaderTess {
line_weight_px: f32,
world_offset: [f64; 3],
anno_scale: f32,
) -> crate::scene::wire_model::WireModel;
) -> crate::scene::model::wire_model::WireModel;
}
impl LeaderTess for Leader {
@@ -566,9 +566,9 @@ impl LeaderTess for Leader {
line_weight_px: f32,
world_offset: [f64; 3],
anno_scale: f32,
) -> crate::scene::wire_model::WireModel {
use crate::scene::tessellate::{append_arrow, arrow_from_block, ArrowKind, DimGeom};
use crate::scene::wire_model::WireModel;
) -> crate::scene::model::wire_model::WireModel {
use crate::scene::convert::tessellate::{append_arrow, arrow_from_block, ArrowKind, DimGeom};
use crate::scene::model::wire_model::WireModel;
let color = if selected {
WireModel::SELECTED
} else {
+15 -15
View File
@@ -6,18 +6,18 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::TangentGeom;
fn to_truck(line: &Line) -> TruckEntity {
let normal = (line.normal.x, line.normal.y, line.normal.z);
let (sx, sy, sz) = crate::scene::transform::ocs_point_to_wcs(
let (sx, sy, sz) = crate::scene::view::transform::ocs_point_to_wcs(
(line.start.x, line.start.y, line.start.z),
normal,
);
let (ex, ey, ez) =
crate::scene::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal);
crate::scene::view::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal);
let p0 = Point3::new(sx, sy, sz);
let p1 = Point3::new(ex, ey, ez);
let kv: Vec<[f64; 3]> = vec![[p0.x, p0.y, p0.z], [p1.x, p1.y, p1.z]];
@@ -134,13 +134,13 @@ fn apply_transform(line: &mut Line, t: &EntityTransform) {
));
}
EntityTransform::Rotate { center, angle_rad } => {
crate::scene::transform::apply_standard_transform(line, *center, *angle_rad);
crate::scene::view::transform::apply_standard_transform(line, *center, *angle_rad);
}
EntityTransform::Scale { center, factor } => {
crate::scene::transform::apply_standard_scale(line, *center, *factor);
crate::scene::view::transform::apply_standard_scale(line, *center, *factor);
}
EntityTransform::Mirror { p1, p2 } => {
crate::scene::transform::mirror_xy_line(line, *p1, *p2);
crate::scene::view::transform::mirror_xy_line(line, *p1, *p2);
}
}
}
@@ -158,8 +158,8 @@ impl crate::entities::traits::Grippable for Line {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
if grip_id == 2 {
vec![GripMenuItem {
label: "Stretch",
@@ -178,7 +178,7 @@ impl crate::entities::traits::Grippable for Line {
]
}
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Lengthen needs a follow-up distance — handled by
// `apply_grip_menu_value`.
}
@@ -186,9 +186,9 @@ impl crate::entities::traits::Grippable for Line {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::Lengthen => Some("Distance"),
_ => None,
@@ -198,10 +198,10 @@ impl crate::entities::traits::Grippable for Line {
fn apply_grip_menu_value(
&mut self,
grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
if !matches!(action, A::Lengthen) {
return;
}
+13 -13
View File
@@ -6,9 +6,9 @@ use crate::entities::common::{
edit_prop as edit, parse_f64, rectangle_grip, ro_prop as ro, square_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::TangentGeom;
const TAU: f64 = std::f64::consts::TAU;
@@ -120,7 +120,7 @@ fn to_truck(pline: &LwPolyline) -> TruckEntity {
// Convert OCS (x, y, elevation) to WCS Point3.
let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) {
crate::scene::transform::ocs_point_to_wcs((x, y, elev), normal)
crate::scene::view::transform::ocs_point_to_wcs((x, y, elev), normal)
};
let to_pt = |v: &LwVertex| -> Point3 {
let (wx, wy, wz) = to_wcs(v.location.x, v.location.y);
@@ -418,9 +418,9 @@ fn apply_grip(pline: &mut LwPolyline, grip_id: usize, apply: GripApply) {
}
fn apply_transform(pline: &mut LwPolyline, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(pline, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(pline, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.location.x, &mut v.location.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut v.location.x, &mut v.location.y, p1, p2);
// Bulge encodes which side the arc bows to; a reflection
// reverses it or every curved segment flips to the wrong side.
v.bulge = -v.bulge;
@@ -435,14 +435,14 @@ impl TruckConvertible for LwPolyline {
}
impl crate::entities::traits::Grippable for LwPolyline {
fn grips(&self) -> Vec<crate::scene::object::GripDef> {
fn grips(&self) -> Vec<crate::scene::model::object::GripDef> {
grips(self)
}
fn apply_grip(&mut self, grip_id: usize, apply: crate::scene::object::GripApply) {
fn apply_grip(&mut self, grip_id: usize, apply: crate::scene::model::object::GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n = self.vertices.len();
if grip_id < n {
// Vertex grip.
@@ -490,8 +490,8 @@ impl crate::entities::traits::Grippable for LwPolyline {
convert,
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::Stretch => {}
@@ -546,7 +546,7 @@ impl crate::entities::traits::PropertyEditable for LwPolyline {
fn geometry_properties(
&self,
_text_style_names: &[String],
) -> crate::scene::object::PropSection {
) -> crate::scene::model::object::PropSection {
properties(self)
}
fn apply_geom_prop(&mut self, field: &str, value: &str) {
+11 -11
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
// ── Face3D ────────────────────────────────────────────────────────────────────
@@ -160,14 +160,14 @@ impl PropertyEditable for Face3D {
impl Transformable for Face3D {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for corner in [
&mut entity.first_corner,
&mut entity.second_corner,
&mut entity.third_corner,
&mut entity.fourth_corner,
] {
crate::scene::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
}
});
}
@@ -322,9 +322,9 @@ impl PropertyEditable for PolygonMesh {
impl Transformable for PolygonMesh {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -472,9 +472,9 @@ impl PropertyEditable for PolyfaceMesh {
impl Transformable for PolyfaceMesh {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -631,9 +631,9 @@ impl PropertyEditable for Mesh {
impl Transformable for Mesh {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
}
});
}
+10 -10
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
impl TruckConvertible for MLine {
fn to_truck(&self, _document: &acadrust::CadDocument) -> Option<TruckEntity> {
@@ -149,8 +149,8 @@ impl Grippable for MLine {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -167,8 +167,8 @@ impl Grippable for MLine {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -274,16 +274,16 @@ impl PropertyEditable for MLine {
impl Transformable for MLine {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.position.x,
&mut v.position.y,
p1,
p2,
);
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.start_point.x,
&mut entity.start_point.y,
p1,
+12 -12
View File
@@ -7,9 +7,9 @@ use crate::entities::text_support::{
layout_mtext, resolve_text_style, GlyphBox, MTextRenderOpts, MTextVAnchor,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
fn attachment_str(a: &AttachmentPoint) -> &'static str {
match a {
@@ -327,8 +327,8 @@ fn apply_grip(t: &mut MText, grip_id: usize, apply: GripApply) {
}
fn apply_transform(t: &mut MText, tr: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
@@ -356,8 +356,8 @@ impl Grippable for MText {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
if grip_id == 0 {
// Insertion point
vec![
@@ -383,7 +383,7 @@ impl Grippable for MText {
}
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Rotate needs a follow-up angle handled by
// `apply_grip_menu_value`; Move-with-Text is the default drag.
}
@@ -391,9 +391,9 @@ impl Grippable for MText {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::RotateText => Some("Rotation (deg)"),
_ => None,
@@ -403,10 +403,10 @@ impl Grippable for MText {
fn apply_grip_menu_value(
&mut self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
if matches!(action, A::RotateText) {
self.rotation = value.to_radians();
}
+21 -21
View File
@@ -31,9 +31,9 @@ use crate::entities::common::{
center_grip, edit_prop as edit, ro_prop as ro, square_grip, triangle_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::{SnapHint, TangentGeom};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::{SnapHint, TangentGeom};
// ── TruckConvertible ────────────────────────────────────────────────────────
@@ -840,7 +840,7 @@ fn parse_attachment(s: &str) -> TextAttachmentType {
// ── Transform ──────────────────────────────────────────────────────────────
fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ml, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(ml, t, |entity, p1, p2| {
// Reflect every point on the leader (line points, connection points,
// break-point endpoints) AND every direction vector that drives the
// text orientation. Without the direction reflection text would keep
@@ -848,16 +848,16 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
for root in &mut entity.context.leader_roots {
for line in &mut root.lines {
for p in &mut line.points {
crate::scene::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
}
for bp in &mut line.break_points {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.start_point.x,
&mut bp.start_point.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.end_point.x,
&mut bp.end_point.y,
p1,
@@ -865,7 +865,7 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
);
}
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut root.connection_point.x,
&mut root.connection_point.y,
p1,
@@ -873,13 +873,13 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
);
reflect_xy_direction(&mut root.direction.x, &mut root.direction.y, p1, p2);
for bp in &mut root.break_points {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.start_point.x,
&mut bp.start_point.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.end_point.x,
&mut bp.end_point.y,
p1,
@@ -887,7 +887,7 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
);
}
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.context.text_location.x,
&mut entity.context.text_location.y,
p1,
@@ -916,7 +916,7 @@ fn reflect_xy_direction(dx: &mut f64, dy: &mut f64, p1: Vec3, p2: Vec3) {
let p2_rel = Vec3::new(p2.x - p1.x, p2.y - p1.y, 0.0);
let mut tip_x = *dx;
let mut tip_y = *dy;
crate::scene::transform::reflect_xy_point(&mut tip_x, &mut tip_y, zero, p2_rel);
crate::scene::view::transform::reflect_xy_point(&mut tip_x, &mut tip_y, zero, p2_rel);
*dx = tip_x;
*dy = tip_y;
}
@@ -936,8 +936,8 @@ impl crate::entities::traits::Grippable for MultiLeader {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n_vertices: usize = self
.context
.leader_roots
@@ -984,8 +984,8 @@ impl crate::entities::traits::Grippable for MultiLeader {
]
}
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
// Locate the (root, line) and vertex position owning this grip id.
let mut idx = 0usize;
let mut loc: Option<(usize, usize, acadrust::types::Vector3)> = None;
@@ -1063,7 +1063,7 @@ pub trait MultiLeaderTess {
world_offset: [f64; 3],
anno_scale: f32,
world_per_pixel: Option<f32>,
) -> Vec<crate::scene::wire_model::WireModel>;
) -> Vec<crate::scene::model::wire_model::WireModel>;
}
impl MultiLeaderTess for MultiLeader {
@@ -1077,11 +1077,11 @@ impl MultiLeaderTess for MultiLeader {
world_offset: [f64; 3],
anno_scale: f32,
world_per_pixel: Option<f32>,
) -> Vec<crate::scene::wire_model::WireModel> {
use crate::scene::tessellate::{
) -> Vec<crate::scene::model::wire_model::WireModel> {
use crate::scene::convert::tessellate::{
append_arrow, arrow_from_block, color_or_inherit, tessellate, ArrowKind, DimGeom,
};
use crate::scene::wire_model::{SnapHint, TangentGeom, WireModel};
use crate::scene::model::wire_model::{SnapHint, TangentGeom, WireModel};
use glam::Vec3;
let ml = self;
// line_color falls back to the entity colour when the MultiLeader's own
@@ -1110,7 +1110,7 @@ impl MultiLeaderTess for MultiLeader {
.map(|lt| lt.name.clone());
match name {
Some(n) => {
crate::scene::render::resolve_pattern(&document.line_types, &n, lt_scale)
crate::scene::view::render::resolve_pattern(&document.line_types, &n, lt_scale)
}
None => (0.0, [0.0; 8]),
}
+4 -4
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
fn to_truck(ole: &Ole2Frame) -> TruckEntity {
let x0 = ole.upper_left_corner.x;
@@ -184,7 +184,7 @@ impl crate::entities::traits::FallbackTess for Ole2Frame {
fn fallback_geometry(
&self,
world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry {
) -> crate::scene::convert::tess_util::FallbackGeometry {
// OLE objects carry a bounding rectangle in model space.
// Render a simple X-through-rectangle placeholder.
let [ox, oy, oz] = world_offset;
+6 -6
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, parse_f64, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
/// Resolve PDSIZE (negative = % of viewport, 0 = 5% default, positive = world).
/// We don't know the viewport height at tessellation time, so percentages and
@@ -93,7 +93,7 @@ fn point_glyph(cx: f64, cy: f64, z: f64, pdmode: i16, pdsize: f64) -> Vec<[f64;
fn to_truck(pt: &Point, document: &acadrust::CadDocument) -> TruckEntity {
let normal = (pt.normal.x, pt.normal.y, pt.normal.z);
let (wx, wy, wz) = crate::scene::transform::ocs_point_to_wcs(
let (wx, wy, wz) = crate::scene::view::transform::ocs_point_to_wcs(
(pt.location.x, pt.location.y, pt.location.z),
normal,
);
@@ -175,8 +175,8 @@ fn apply_grip(pt: &mut Point, _grip_id: usize, apply: GripApply) {
}
fn apply_transform(pt: &mut Point, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(pt, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(pt, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.location.x,
&mut entity.location.y,
p1,
+22 -22
View File
@@ -4,9 +4,9 @@ use truck_modeling::{builder, Edge, Point3, Wire};
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::TangentGeom;
// ── Polyline (old-style 3D heavy polyline) ────────────────────────────────────
@@ -69,8 +69,8 @@ impl Grippable for Polyline {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -87,8 +87,8 @@ impl Grippable for Polyline {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -148,9 +148,9 @@ impl PropertyEditable for Polyline {
impl Transformable for Polyline {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -184,7 +184,7 @@ fn tessellate_polyline2d(pl: &Polyline2D) -> TruckEntity {
let mut key_verts: Vec<[f64; 3]> = Vec::new();
let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) {
crate::scene::transform::ocs_point_to_wcs((x, y, elev), normal)
crate::scene::view::transform::ocs_point_to_wcs((x, y, elev), normal)
};
let to_pt = |v: &acadrust::entities::Vertex2D| -> Point3 {
let (wx, wy, wz) = to_wcs(v.location.x, v.location.y);
@@ -338,8 +338,8 @@ impl Grippable for Polyline2D {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -356,8 +356,8 @@ impl Grippable for Polyline2D {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
let elev = self.elevation;
match action {
@@ -467,9 +467,9 @@ impl PropertyEditable for Polyline2D {
impl Transformable for Polyline2D {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -556,8 +556,8 @@ impl Grippable for Polyline3D {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -574,8 +574,8 @@ impl Grippable for Polyline3D {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -669,9 +669,9 @@ impl PropertyEditable for Polyline3D {
impl Transformable for Polyline3D {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.position.x,
&mut v.position.y,
p1,
+6 -6
View File
@@ -3,8 +3,8 @@ use acadrust::entities::{RasterImage, Wipeout};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
// ── Shared geometry helpers ───────────────────────────────────────────────────
@@ -235,8 +235,8 @@ impl PropertyEditable for RasterImage {
impl Transformable for RasterImage {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
@@ -496,8 +496,8 @@ impl PropertyEditable for Wipeout {
impl Transformable for Wipeout {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
+6 -6
View File
@@ -3,8 +3,8 @@ use acadrust::entities::{Ray, XLine};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
/// Display length used when rendering semi-infinite / infinite lines.
const DISPLAY_EXTENT: f64 = 1_000_000.0;
@@ -126,8 +126,8 @@ impl PropertyEditable for Ray {
impl Transformable for Ray {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.base_point.x,
&mut entity.base_point.y,
p1,
@@ -263,8 +263,8 @@ impl PropertyEditable for XLine {
impl Transformable for XLine {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.base_point.x,
&mut entity.base_point.y,
p1,
+4 -4
View File
@@ -11,10 +11,10 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::transform;
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::view::transform;
use crate::scene::model::wire_model::SnapHint;
// ── Marker geometry ───────────────────────────────────────────────────────────
+5 -5
View File
@@ -10,9 +10,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
fn v3(v: &acadrust::types::Vector3) -> [f64; 3] {
[v.x, v.y, v.z]
@@ -147,14 +147,14 @@ impl PropertyEditable for Solid {
impl Transformable for Solid {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for corner in [
&mut entity.first_corner,
&mut entity.second_corner,
&mut entity.third_corner,
&mut entity.fourth_corner,
] {
crate::scene::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
}
});
}
+3 -3
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::entities::common::{center_grip, ro_prop as ro};
use crate::entities::traits::{Grippable, PropertyEditable};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
// ── shared helpers ────────────────────────────────────────────────────────────
@@ -260,8 +260,8 @@ impl PropertyEditable for Body {
// to repeat a three-arm `match entity` block at every callsite — the
// helpers below collapse those to a single call.
use crate::scene::mesh_model::MeshLodSet;
use crate::scene::solid3d_tess;
use crate::scene::model::mesh_model::MeshLodSet;
use crate::scene::convert::solid3d_tess;
use acadrust::{types::Vector3, EntityType};
/// `point_of_reference` of an ACIS-backed volume entity, if applicable.
+9 -9
View File
@@ -7,8 +7,8 @@ use truck_modeling::{
use crate::command::EntityTransform;
use crate::entities::common::{ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
fn to_truck(spl: &Spline) -> TruckEntity {
let n = spl.control_points.len();
@@ -141,12 +141,12 @@ fn apply_grip(spline: &mut Spline, grip_id: usize, apply: GripApply) {
}
fn apply_transform(spline: &mut Spline, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(spline, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(spline, t, |entity, p1, p2| {
for cp in &mut entity.control_points {
crate::scene::transform::reflect_xy_point(&mut cp.x, &mut cp.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut cp.x, &mut cp.y, p1, p2);
}
for fp in &mut entity.fit_points {
crate::scene::transform::reflect_xy_point(&mut fp.x, &mut fp.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut fp.x, &mut fp.y, p1, p2);
}
});
}
@@ -164,8 +164,8 @@ impl crate::entities::traits::Grippable for Spline {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -185,8 +185,8 @@ impl crate::entities::traits::Grippable for Spline {
},
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.control_points.len();
let min_cv = (self.degree as usize).saturating_add(1).max(2);
match action {
+7 -7
View File
@@ -7,10 +7,10 @@ use crate::entities::text_support::{
layout_mtext, MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::transform;
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::view::transform;
use crate::scene::model::wire_model::SnapHint;
fn v3(v: &acadrust::types::Vector3) -> Vec3 {
Vec3::new(v.x as f32, v.y as f32, v.z as f32)
@@ -335,9 +335,9 @@ pub fn tessellate_table(
entity_color: [f32; 4],
line_weight_px: f32,
world_offset: [f64; 3],
) -> Vec<crate::scene::wire_model::WireModel> {
use crate::scene::tess_util::aci_to_rgba;
use crate::scene::wire_model::WireModel;
) -> Vec<crate::scene::model::wire_model::WireModel> {
use crate::scene::convert::tess_util::aci_to_rgba;
use crate::scene::model::wire_model::WireModel;
use acadrust::types::Color;
use rustc_hash::FxHashMap as HashMap;
+15 -15
View File
@@ -7,10 +7,10 @@ use crate::entities::text_support::{
resolve_dxf_special_chars, resolve_text_style, text_local_bounds,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::lff;
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::text::lff;
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
fn text_halign_str(a: &acadrust::entities::TextHorizontalAlignment) -> &'static str {
use acadrust::entities::TextHorizontalAlignment::*;
@@ -50,7 +50,7 @@ fn sync_text_alignment_point(t: &mut Text) {
fn to_truck(t: &Text, document: &acadrust::CadDocument) -> TruckEntity {
let normal = (t.normal.x, t.normal.y, t.normal.z);
let (wsx, wsy, wsz) = crate::scene::transform::ocs_point_to_wcs(
let (wsx, wsy, wsz) = crate::scene::view::transform::ocs_point_to_wcs(
(
t.insertion_point.x,
t.insertion_point.y,
@@ -287,15 +287,15 @@ fn apply_grip(t: &mut Text, _grip_id: usize, apply: GripApply) {
}
fn apply_transform(t: &mut Text, tr: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
p2,
);
if let Some(ref mut a) = entity.alignment_point {
crate::scene::transform::reflect_xy_point(&mut a.x, &mut a.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut a.x, &mut a.y, p1, p2);
}
let dx = (p2.x - p1.x) as f64;
let dy = (p2.y - p1.y) as f64;
@@ -320,8 +320,8 @@ impl Grippable for Text {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -338,7 +338,7 @@ impl Grippable for Text {
]
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Move-with-Text falls through to Stretch (single grip moves
// the whole text); Rotate needs a follow-up angle handled by
// `apply_grip_menu_value`.
@@ -347,9 +347,9 @@ impl Grippable for Text {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::RotateText => Some("Rotation (deg)"),
_ => None,
@@ -359,10 +359,10 @@ impl Grippable for Text {
fn apply_grip_menu_value(
&mut self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
if matches!(action, A::RotateText) {
self.rotation = value.to_radians();
}
+3 -3
View File
@@ -1,9 +1,9 @@
use acadrust::types::aci_table::aci_to_rgb;
use acadrust::{CadDocument, EntityType};
use crate::scene::acad_to_truck::TextStroke;
use crate::scene::font_face::Face;
use crate::scene::lff;
use crate::scene::convert::acad_to_truck::TextStroke;
use crate::scene::text::font_face::Face;
use crate::scene::text::lff;
pub struct ResolvedTextStyle {
pub font_name: String,
+5 -4
View File
@@ -4,10 +4,11 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::{lff, transform};
use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
use crate::scene::text::lff;
use crate::scene::view::transform;
// ── GDT text parser ───────────────────────────────────────────────────────────
+9 -9
View File
@@ -1,11 +1,11 @@
use acadrust::{CadDocument, EntityType};
use crate::command::EntityTransform;
use crate::scene::acad_to_truck::TruckEntity;
use crate::scene::object::{
use crate::scene::convert::acad_to_truck::TruckEntity;
use crate::scene::model::object::{
GripApply, GripDef, GripMenuAction, GripMenuItem, PropSection,
};
use crate::scene::tess_util::FallbackGeometry;
use crate::scene::convert::tess_util::FallbackGeometry;
pub trait TruckConvertible {
fn to_truck(&self, document: &CadDocument) -> Option<TruckEntity>;
@@ -192,13 +192,13 @@ macro_rules! dispatch {
macro_rules! impl_entity_basics {
($T:ty) => {
impl $crate::entities::traits::Grippable for $T {
fn grips(&self) -> Vec<$crate::scene::object::GripDef> {
fn grips(&self) -> Vec<$crate::scene::model::object::GripDef> {
grips(self)
}
fn apply_grip(
&mut self,
grip_id: usize,
apply: $crate::scene::object::GripApply,
apply: $crate::scene::model::object::GripApply,
) {
apply_grip(self, grip_id, apply);
}
@@ -207,7 +207,7 @@ macro_rules! impl_entity_basics {
fn geometry_properties(
&self,
_text_style_names: &[String],
) -> $crate::scene::object::PropSection {
) -> $crate::scene::model::object::PropSection {
properties(self)
}
fn apply_geom_prop(&mut self, field: &str, value: &str) {
@@ -229,13 +229,13 @@ macro_rules! impl_entity_basics {
macro_rules! impl_entity_basics_with_text_styles {
($T:ty) => {
impl $crate::entities::traits::Grippable for $T {
fn grips(&self) -> Vec<$crate::scene::object::GripDef> {
fn grips(&self) -> Vec<$crate::scene::model::object::GripDef> {
grips(self)
}
fn apply_grip(
&mut self,
grip_id: usize,
apply: $crate::scene::object::GripApply,
apply: $crate::scene::model::object::GripApply,
) {
apply_grip(self, grip_id, apply);
}
@@ -244,7 +244,7 @@ macro_rules! impl_entity_basics_with_text_styles {
fn geometry_properties(
&self,
text_style_names: &[String],
) -> $crate::scene::object::PropSection {
) -> $crate::scene::model::object::PropSection {
properties(self, text_style_names)
}
fn apply_geom_prop(&mut self, field: &str, value: &str) {
+4 -4
View File
@@ -10,9 +10,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
// ── Helpers ───────────────────────────────────────────────────────────────────
@@ -224,7 +224,7 @@ impl PropertyEditable for Underlay {
impl Transformable for Underlay {
fn apply_transform(&mut self, t: &EntityTransform) {
use crate::scene::transform::reflect_xy_point;
use crate::scene::view::transform::reflect_xy_point;
match t {
EntityTransform::Translate(d) => {
self.insertion_point.x += d.x as f64;
+4 -4
View File
@@ -5,7 +5,7 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
// ── Standard scale options ────────────────────────────────────────────────
@@ -533,8 +533,8 @@ fn apply_grip(vp: &mut Viewport, grip_id: usize, apply: GripApply) {
}
fn apply_transform(vp: &mut Viewport, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(vp, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(vp, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
@@ -549,7 +549,7 @@ impl crate::entities::traits::FallbackTess for Viewport {
fn fallback_geometry(
&self,
world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry {
) -> crate::scene::convert::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset;
let cx = (self.center.x - ox) as f32;
let cy = (self.center.y - oy) as f32;
+1 -1
View File
@@ -4,7 +4,7 @@
// Quads are split into two triangles.
// Only the first object/group is imported (no multi-object support needed).
use crate::scene::mesh_model::MeshModel;
use crate::scene::model::mesh_model::MeshModel;
/// Parse OBJ text into a MeshModel.
/// Returns `None` if the file has no usable geometry.
+1 -1
View File
@@ -9,7 +9,7 @@
// drawing origin at the paper origin.
use crate::io::plot_style::PlotStyleTable;
use crate::scene::hatch_model::{HatchModel, HatchPattern};
use crate::scene::model::hatch_model::{HatchModel, HatchPattern};
use crate::scene::WireModel;
use printpdf::{
Color, Line, LineCapStyle, LineJoinStyle, LinePoint, Mm, Op, PaintMode, PdfDocument, PdfPage,
+1 -1
View File
@@ -9,7 +9,7 @@
use crate::io::pdf_export;
use crate::io::plot_style::PlotStyleTable;
use crate::scene::hatch_model::HatchModel;
use crate::scene::model::hatch_model::HatchModel;
use crate::scene::WireModel;
/// Render `wires` (plus hatch / wipeout fills) to a temp PDF and dispatch it
+1 -1
View File
@@ -12,7 +12,7 @@
// This produces larger-than-optimal files but is universally importable by
// CAD systems that accept AP203.
use crate::scene::mesh_model::MeshModel;
use crate::scene::model::mesh_model::MeshModel;
use std::fmt::Write as FmtWrite;
/// Build a STEP AP203 text representation from a slice of mesh models.
+1 -1
View File
@@ -11,7 +11,7 @@
use std::io::Write;
use crate::scene::mesh_model::MeshModel;
use crate::scene::model::mesh_model::MeshModel;
/// Build a binary STL byte buffer from a slice of mesh models.
/// Returns `None` if there are no triangles to export.
+1 -1
View File
@@ -7,7 +7,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_aligned.svg"));
+1 -1
View File
@@ -4,7 +4,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_angular.svg"));
+1 -1
View File
@@ -7,7 +7,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_diameter.svg"));
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_baseline.svg"));
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_continue.svg"));
+1 -1
View File
@@ -9,7 +9,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_jog.svg"));
+1 -1
View File
@@ -9,7 +9,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_tedit.svg"));
+1 -1
View File
@@ -17,7 +17,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/leader.svg"));
+1 -1
View File
@@ -4,7 +4,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_linear.svg"));
+1 -1
View File
@@ -12,7 +12,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mleader.svg"));
+1 -1
View File
@@ -12,7 +12,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── MLEADERADD ────────────────────────────────────────────────────────────────
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/mtext.svg"));
+1 -1
View File
@@ -15,7 +15,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub fn tool() -> ToolDef {
ToolDef {
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/qdim.svg"));
+1 -1
View File
@@ -4,7 +4,7 @@ use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_radius.svg"));
+1 -1
View File
@@ -14,7 +14,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/table.svg"));
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/text.svg"));
+1 -1
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/tolerance.svg"));
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct PasteCommand {
/// Wire models of the clipboard entities (used for preview).
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::{Arc as CadArc, EntityType};
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
const TAU: f32 = std::f32::consts::TAU;
+1 -1
View File
@@ -12,7 +12,7 @@ use acadrust::EntityType;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
enum Step {
Tag,
+1 -1
View File
@@ -14,7 +14,7 @@ use acadrust::{Circle, EntityType};
use crate::command::{CadCommand, CmdResult, DynField, TangentObject};
use crate::modules::home::defaults;
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
const TAU: f32 = std::f32::consts::TAU;
+1 -1
View File
@@ -10,7 +10,7 @@ use acadrust::{Ellipse, EntityType};
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
fn parse_f32(text: &str) -> Option<f32> {
+3 -3
View File
@@ -11,8 +11,8 @@
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
use crate::scene::hatch_model::{HatchModel, HatchPattern, PatFamily};
use crate::scene::wire_model::WireModel;
use crate::scene::model::hatch_model::{HatchModel, HatchPattern, PatFamily};
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
// ── Icons ──────────────────────────────────────────────────────────────────
@@ -92,7 +92,7 @@ impl HatchCommand {
fn make_hatch(&self, boundary: Vec<[f32; 2]>) -> HatchModel {
// Default: ANSI31 from catalog; fallback to a single 45° family.
let pat_name = "ANSI31";
let families = crate::scene::hatch_patterns::find(pat_name)
let families = crate::scene::model::hatch_patterns::find(pat_name)
.and_then(|e| {
if let HatchPattern::Pattern(f) = &e.gpu {
Some(f.clone())
+1 -1
View File
@@ -11,7 +11,7 @@ use acadrust::{EntityType, Line};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
// ── Ribbon definition ─────────────────────────────────────────────────────
+1 -1
View File
@@ -11,7 +11,7 @@ use acadrust::EntityType;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct MlineCommand {
points: Vec<Vec3>,
+1 -1
View File
@@ -8,7 +8,7 @@ use acadrust::{EntityType, Point as CadPoint};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
#[allow(dead_code)]
+1 -1
View File
@@ -16,7 +16,7 @@ use glam::{Vec2, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -12,7 +12,7 @@ use acadrust::EntityType;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct ImageCommand {
file_path: String,
+1 -1
View File
@@ -9,7 +9,7 @@ use acadrust::types::Vector3;
use acadrust::EntityType;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
const DISPLAY_EXTENT: f32 = 1_000_000.0;
+1 -1
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../../assets/icons/revcloud.svg"));
+1 -1
View File
@@ -16,7 +16,7 @@ use acadrust::{EntityType, LwPolyline};
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
const TAU: f32 = std::f32::consts::TAU;
+1 -1
View File
@@ -8,7 +8,7 @@ use acadrust::{EntityType, Spline};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
use glam::Vec3;
#[allow(dead_code)]
+1 -1
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../../assets/icons/wipeout.svg"));
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct GroupCommand {
handles: Vec<Handle>,
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct UngroupCommand;
+1 -1
View File
@@ -4,7 +4,7 @@
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct AreaCommand {
points: Vec<Vec3>,
+1 -1
View File
@@ -3,7 +3,7 @@
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct DistCommand {
first: Option<Vec3>,
+1 -1
View File
@@ -19,7 +19,7 @@ use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct LayMatchCommand {
dest_handles: Vec<Handle>,
+4 -4
View File
@@ -19,7 +19,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::home::defaults;
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Dropdown constants ─────────────────────────────────────────────────────
@@ -395,7 +395,7 @@ use std::f32::consts::TAU as FTAU;
/// chord and ignored the extrusion, so arc-segment paths came out mirrored.
fn lw_dense_pts(p: &acadrust::entities::LwPolyline) -> Vec<Vec3> {
use crate::entities::common::BulgeArc;
use crate::scene::transform::ocs_point_to_wcs;
use crate::scene::view::transform::ocs_point_to_wcs;
let verts = &p.vertices;
if verts.is_empty() {
@@ -547,7 +547,7 @@ impl ArrayPathCommand {
// (normal = -Z) are traced on the same side the renderer draws,
// matching `entities::arc::to_truck`. Sampling the raw centre +
// angle ignores the extrusion and lands on the mirrored arc.
use crate::scene::transform::{ocs_axes, ocs_point_to_wcs};
use crate::scene::view::transform::{ocs_axes, ocs_point_to_wcs};
let normal = (a.normal.x, a.normal.y, a.normal.z);
let (ax, ay) = ocs_axes(normal);
let (cx, cy, cz) =
@@ -570,7 +570,7 @@ impl ArrayPathCommand {
.collect()
}
EntityType::Circle(c) => {
use crate::scene::transform::{ocs_axes, ocs_point_to_wcs};
use crate::scene::view::transform::{ocs_axes, ocs_point_to_wcs};
let normal = (c.normal.x, c.normal.y, c.normal.z);
let (ax, ay) = ocs_axes(normal);
let (cx, cy, cz) =
+1 -1
View File
@@ -10,7 +10,7 @@ use acadrust::EntityType;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct AtteditCommand {
step: Step,
+1 -1
View File
@@ -20,7 +20,7 @@ use truck_modeling::base::{BoundedCurve, Cut};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -10,7 +10,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -19,7 +19,7 @@ const TAU: f64 = std::f64::consts::TAU;
use crate::command::{CadCommand, CmdResult};
use crate::modules::home::defaults;
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Dropdown constants ─────────────────────────────────────────────────────
+1 -1
View File
@@ -13,7 +13,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub fn tool() -> ToolDef {
ToolDef {
+1 -1
View File
@@ -23,7 +23,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::home::defaults;
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+2 -2
View File
@@ -128,7 +128,7 @@ impl CadCommand for RefCloseCommand {
/// Order: scale → rotate (around origin) → translate.
pub fn apply_insert_transform(entity: &mut EntityType, session: &RefEditSession) {
use crate::command::EntityTransform;
use crate::scene::dispatch;
use crate::scene::view::dispatch;
let origin = Vec3::ZERO;
@@ -170,7 +170,7 @@ pub fn apply_insert_transform(entity: &mut EntityType, session: &RefEditSession)
/// Order: un-translate → un-rotate → un-scale.
pub fn apply_insert_inverse_transform(entity: &mut EntityType, session: &RefEditSession) {
use crate::command::EntityTransform;
use crate::scene::dispatch;
use crate::scene::view::dispatch;
let origin = Vec3::ZERO;
+1 -1
View File
@@ -12,7 +12,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, DynField, EntityTransform};
use crate::modules::home::defaults;
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -18,7 +18,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::home::defaults;
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
#[allow(dead_code)]
pub fn tool() -> ToolDef {
+1 -1
View File
@@ -14,7 +14,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
#[allow(dead_code)]
pub fn tool() -> ToolDef {
+1 -1
View File
@@ -20,7 +20,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -10,7 +10,7 @@ use glam::Vec3;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
+1 -1
View File
@@ -25,7 +25,7 @@ use crate::modules::home::modify::spline_ops::{
t_to_rel,
};
use crate::modules::IconKind;
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
// ── Dropdown constants ─────────────────────────────────────────────────────
+1 -1
View File
@@ -17,7 +17,7 @@ use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::scene::wire_model::WireModel;
use crate::scene::model::wire_model::WireModel;
pub struct MatchPropCommand {
/// Source handle; NULL until phase 1 is complete.
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff. Show more