use crate::controls::ArcballControls;
use crate::history::History;
use crate::pick::{self, PickOptions};
use crate::scene::RenderScene;
use crate::style::{Emphasis, RenderSettings};
use crate::view::ViewCamera;
use crate::widgets::{gizmo_camera, WidgetOverlay, WidgetRegistry};
use brep_kernel::HistoryRequest;
use std::collections::HashMap;
pub struct EngineState {
pub scene: RenderScene,
pub camera: ViewCamera,
pub controls: ArcballControls,
pub settings: RenderSettings,
pub emphasis: Emphasis,
pub widgets: WidgetRegistry,
pub history: History,
history_report: String,
pub metadata: crate::metadata::MetadataStore,
pub settings_generation: u64,
pub dirty: bool,
pub ref_select: Option<RefSelectState>,
pub selection_filter: SelectionFilter,
pub transform_gizmo: TransformArm,
sketch_edit: Option<SketchEdit>,
sketch_camera_locked: bool,
sketch_list_hover_active: bool,
notices: Vec<String>,
hidden_sketches: std::collections::HashSet<String>,
shown_sketch_ids: Vec<String>,
construction_frames: Vec<(String, brep_kernel::Frame)>,
sketch_profiles: Vec<(String, brep_kernel::SketchProfile)>,
sketch_axes: Vec<(String, brep_kernel::Axis)>,
hidden_datums: std::collections::HashSet<String>,
shown_datum_names: Vec<String>,
pub(crate) runner: Box<dyn crate::runner::HistoryRunner>,
run_generation: u64,
applied_generation: u64,
pub(crate) provenance: std::collections::HashMap<String, String>,
pub(crate) info_cache: std::collections::HashMap<String, String>,
pub(crate) pending_query: std::collections::HashMap<u64, (String, String)>,
pub(crate) next_query_id: u64,
}
#[derive(Debug, Clone, Default)]
pub struct RefSelectState {
pub feature_id: String,
pub path: Vec<String>,
pub label: String,
pub filter: Vec<String>,
pub multiple: bool,
pub names: Vec<String>,
pub restore_index: usize,
}
impl Default for EngineState {
fn default() -> Self {
Self {
scene: RenderScene::new(),
camera: ViewCamera::default(),
controls: ArcballControls::new(),
settings: RenderSettings::default(),
emphasis: Emphasis::default(),
widgets: WidgetRegistry::new(),
history: History::default(),
history_report: String::new(),
metadata: crate::metadata::MetadataStore::new(),
settings_generation: 1,
dirty: true,
ref_select: None,
selection_filter: SelectionFilter::default(),
transform_gizmo: TransformArm::default(),
sketch_edit: None,
sketch_camera_locked: true,
sketch_list_hover_active: false,
notices: Vec::new(),
hidden_sketches: std::collections::HashSet::new(),
shown_sketch_ids: Vec::new(),
construction_frames: Vec::new(),
sketch_profiles: Vec::new(),
sketch_axes: Vec::new(),
hidden_datums: std::collections::HashSet::new(),
shown_datum_names: Vec::new(),
runner: Box::new(crate::runner::InlineRunner::new()),
run_generation: 0,
applied_generation: 0,
provenance: std::collections::HashMap::new(),
info_cache: std::collections::HashMap::new(),
pending_query: std::collections::HashMap::new(),
next_query_id: 0,
}
}
}
impl EngineState {
pub fn new() -> Self {
Self::default()
}
fn pick_options(&self) -> PickOptions {
PickOptions {
double_sided: self.settings.pick_double_sided,
..PickOptions::default()
}
}
}
mod camera_widgets;
mod committed_sketches;
mod construction_datums;
mod expressions;
mod feature_dims;
mod history_ops;
mod model_io;
mod scene_query;
mod selection_filter;
mod selection_ux;
mod sketch_edit_ops;
mod sketch_input;
mod sketch_mode;
mod sketch_panel;
mod transform_gizmo;
pub use selection_filter::SelectionFilter;
pub use sketch_mode::{SketchDrag, SketchEdit};
pub use sketch_panel::{SketchConstraintAction, SketchEntityRow};
pub use transform_gizmo::{GizmoMode, TransformArm};
pub(crate) use transform_gizmo::rotate_euler_xyz_f64;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod sketch_mode_tests;