Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0d68002
feat(dev): experimental 3MF output for Print shell model exports
NyleGarcia Nov 18, 2026
f36264b
feat(dev): experimental 3D print options skeleton for Print shell STL…
NyleGarcia Nov 18, 2026
e175f15
feat(dev): experimental Print shell export without weapons
NyleGarcia Nov 18, 2026
59cc45a
feat(print): scale placement, bed check and dropping tiny parts (expe…
NyleGarcia Nov 18, 2026
99aba9d
feat(print): simplify parts with quadric edge collapse (experimental)
NyleGarcia Nov 18, 2026
5ae28f1
feat(print): experimental voxel solid, thicken, hollow and pegs
NyleGarcia Nov 18, 2026
608b05b
feat(print): experimental split for the bed with alignment pin holes
NyleGarcia Nov 18, 2026
5dbe9fc
feat(print): experimental multicolor groups and one closed mesh per c…
NyleGarcia Nov 18, 2026
2209f31
Merge branch 'print/voxel' into feat/model-3mf
NyleGarcia Nov 18, 2026
aa7d2e7
Merge branch 'print/split' into feat/model-3mf
NyleGarcia Nov 18, 2026
bcbfd96
Merge branch 'print/color' into feat/model-3mf
NyleGarcia Nov 18, 2026
6659deb
Merge branch 'print/scale' into feat/model-3mf
NyleGarcia Nov 18, 2026
3732044
Merge branch 'print/simplify' into feat/model-3mf
NyleGarcia Nov 18, 2026
2b48288
Merge branch 'print/weapons' into feat/model-3mf
NyleGarcia Nov 18, 2026
f0a4eea
fix(print): integrate the experimental print steps
NyleGarcia Nov 19, 2026
c8195a4
fix(print): keep the model when the hollow wall is under one voxel; p…
NyleGarcia Nov 19, 2026
ef94ce1
fix(model): show the print step in export progress and give it most o…
NyleGarcia Nov 20, 2026
984a6a3
feat(explorer): fold record variants into one row with a Variant pick…
NyleGarcia Nov 20, 2026
777dbde
Merge remote-tracking branch 'origin/main' into feat/model-3mf
NyleGarcia Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion app/src-tauri/src/contract/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub use starorg_data::assets::audio::{
};
pub use starorg_data::assets::files::{DirPage, FileEntry, FileSearch, PreviewKind};
pub use starorg_data::assets::model::{ModelPaint, ModelPaints, ModelPreset};
pub use starorg_data::assets::print::{Hollow, PrintOptions, ScaleMode};

/// Shown next to every export button (and in the CLI help).
pub const PERSONAL_USE: &str =
Expand Down Expand Up @@ -175,7 +176,7 @@ pub struct AssetExportSoundsRequest {
pub wem: bool,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AssetExportModelRequest {
pub target: ChannelRef,
pub what: String,
Expand All @@ -185,6 +186,9 @@ pub struct AssetExportModelRequest {
pub lod: u32,
/// Also an STL next to the GLB.
pub stl: bool,
/// Also a 3MF next to the GLB (Print shell only, like the STL).
#[serde(default)]
pub three_mf: bool,
/// Export even with less free memory than the preset may need (after `needs-decision`).
pub force: bool,
/// Full only: the paint to wear, a [`ModelPaint::tag`] from `asset_model_paints`
Expand All @@ -194,6 +198,11 @@ pub struct AssetExportModelRequest {
/// Full only: StarBreaker's experimental layer materials too.
#[serde(default)]
pub layers: bool,
/// Print shell only: the experimental 3D print processing of the STL/3MF (every option
/// off by default; `no_weapons` changes the GLB too). Refused (`invalid`) when its options
/// do not go together ([`PrintOptions::validate`]).
#[serde(default)]
pub print: PrintOptions,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand Down
6 changes: 5 additions & 1 deletion app/src-tauri/src/contract/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub use starorg_core::dev::readable::{LabelKind, Readable};
pub use starorg_core::dev::record::{LocText, RecordHeader, RecordView};
pub use starorg_core::dev::sections::{
Change, FacetCounts, FacetValue, Filters, GroupHead, ListGroup, ListItem, ListPage, ListQuery,
Matching, SectionStats, SortKey, Stat,
Matching, SectionStats, SortKey, Stat, TreeOpts, VariantRef,
};

/// Records above this count get a size warning in the export dialog (7.4).
Expand Down Expand Up @@ -79,6 +79,10 @@ pub struct DevTreeRequest {
/// Sections view: hide AI, NPC, test and template variants (7.17).
#[serde(default)]
pub player_only: bool,
/// Sections view: one record leaf per readable name, its `count` the records it
/// stands for (0 when only itself).
#[serde(default)]
pub fold_variants: bool,
}

/// The item finder's list (7.17): a node of the Sections view (or every record), search
Expand Down
25 changes: 22 additions & 3 deletions app/src-tauri/src/contract/mock_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ pub const EXPORTS: &str = "/synthetic/exports";
pub const CACHE_DEFAULT: &str = "/synthetic/cache/assets";
pub const CACHE_OTHER: &str = "/synthetic/other-drive/asset-cache";
pub const CACHE_MAX: u64 = 2 * 1024 * 1024 * 1024;
/// The mock's STL and 3MF of a print-shell export: an AEGS_Javelin LOD 0's STL, and a 3MF a
/// quarter of it (an RSI_Skylark's 3MF was 0.25 of its STL).
pub const STL_BYTES: u64 = 183_149_634;
pub const THREE_MF_BYTES: u64 = 45_000_000;

/// Mock asset state (per backend).
#[derive(Debug, Default)]
Expand Down Expand Up @@ -1002,9 +1006,16 @@ impl AssetBackend for MockBackend {
preset: req.preset,
lod: starorg_data::assets::model::effective_lod(lod, &self.known_lods(&req.what)),
stl: req.stl,
three_mf: req.three_mf,
paint: req.paint.clone(),
layers: req.layers,
print: req.print.clone(),
};
if req.preset == ModelPreset::PrintShell
&& let Err(m) = o.print.validate()
{
return Err(AppError::new(ErrorCode::Invalid, m));
}
let key = format!("model:{}", o.cache_key(&req.what));
let held = self.cache_size(&key);
let bytes = held.unwrap_or(match req.preset {
Expand Down Expand Up @@ -1032,11 +1043,13 @@ impl AssetBackend for MockBackend {
"{EXPORTS}/{}",
starorg_data::assets::model::file_name(name, &o)
)),
files: 1 + req.stl as u32,
bytes: bytes + if req.stl { 183_149_634 } else { 0 },
files: 1 + req.stl as u32 + req.three_mf as u32,
bytes: bytes
+ if req.stl { STL_BYTES } else { 0 }
+ if req.three_mf { THREE_MF_BYTES } else { 0 },
cached: held.is_some(),
failed: Vec::new(),
note: None,
note: print_note(&req),
})
}

Expand Down Expand Up @@ -1230,3 +1243,9 @@ impl AssetBackend for MockBackend {
Ok(self.cache_view())
}
}

/// The mock's note for an export with print processing (as the real one's notes would read).
fn print_note(req: &AssetExportModelRequest) -> Option<String> {
(req.preset == ModelPreset::PrintShell && (req.stl || req.three_mf) && !req.print.is_default())
.then(|| "3D print processing (experimental) applied to the STL/3MF.".to_string())
}
21 changes: 15 additions & 6 deletions app/src-tauri/src/contract/mock_dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,14 +945,20 @@ pub fn catalogue_geometry(n: usize) -> Option<String> {
})
}

/// What catalogue row `r` reads as in game: an AI copy reads as the ship it copies (`Alpha
/// Kestrel`; the ` PU AI CIV` suffix is the record name's only), so the finder folds them.
fn catalogue_display(r: &CatRow) -> &'static str {
r.5.strip_suffix(" PU AI CIV").unwrap_or(r.5)
}

fn catalogue_facts(r: &CatRow) -> Option<Facts> {
let some = |s: &str| (!s.is_empty()).then(|| s.to_string());
(r.0 == E).then(|| Facts {
item_type: some(r.1),
sub_type: some(r.2),
size: (r.3 > 0).then_some(r.3),
manufacturer: some(r.4),
display: some(r.5),
display: some(catalogue_display(r)),
grade: some(r.7),
class: some(r.8),
model: r.9,
Expand Down Expand Up @@ -1098,12 +1104,12 @@ fn build_core() -> MockCore {
"_Type_": "SItemDefinition",
"Type": r.1, "SubType": r.2, "Size": r.3, "Grade": r.7,
"Manufacturer": r.4,
"Localization": { "Name": r.5 },
"Localization": { "Name": catalogue_display(r) },
},
}],
})
} else {
json!({ "_Type_": r.0, "displayName": r.5 })
json!({ "_Type_": r.0, "displayName": catalogue_display(r) })
};
values.push(json!({
"_RecordName_": format!("{}.{name}", r.0),
Expand Down Expand Up @@ -1651,13 +1657,16 @@ impl DevBackend for MockBackend {
fn dev_tree(&self, req: DevTreeRequest) -> CmdResult<TreePage> {
let c = self.explorer(&req.target)?;
if req.root == TreeRoot::Section {
return Ok(c.sections.tree(
return Ok(c.sections.tree_with(
&c.index,
&req.node,
req.offset as usize,
(req.limit as usize).min(MAX_PAGE),
req.main_only,
req.player_only,
TreeOpts {
main_only: req.main_only,
player_only: req.player_only,
fold_variants: req.fold_variants,
},
));
}
Ok(c.index.tree(
Expand Down
82 changes: 66 additions & 16 deletions app/src-tauri/src/contract/real/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! the archive index, while a model exports, and while the first sounds request reads the
//! DataCore and the Wwise index, so none of these peaks overlap an extraction.

use super::dev::{Worker, WorkerKey, lock_or};
use super::dev::{Worker, WorkerKey, lock_or, worker_error};
use super::dialogs::FileFilter;
use super::{RealBackend, err, internal, io};
use crate::contract::Progress;
Expand Down Expand Up @@ -134,6 +134,11 @@ fn export_result(path: Option<String>, files: u32, bytes: u64, cached: bool) ->
}
}

/// The print processing's notes as one line (`None` without any).
fn print_note(notes: &[String]) -> Option<String> {
(!notes.is_empty()).then(|| notes.join(" "))
}

fn preview_key(path: &str) -> String {
starorg_data::assets::norm_path(path).to_ascii_lowercase()
}
Expand Down Expand Up @@ -332,7 +337,11 @@ impl RealBackend {
let mut j = lock_or(&cell);
j.steps = p.total.max(1);
let label = if unit == "%" {
format!("{label} {} %", p.done * 100 / p.total.max(1))
let pct = p.done * 100 / p.total.max(1);
match p.stage.as_deref() {
Some(s) => format!("{label} {pct} % · {s}"),
None => format!("{label} {pct} %"),
}
} else {
format!("{} of {} {unit}", p.done, p.total)
};
Expand Down Expand Up @@ -919,9 +928,14 @@ impl AssetBackend for RealBackend {
preset: req.preset,
lod: model::effective_lod(asked, &self.known_lods(&key, &req.what)),
stl: req.stl,
three_mf: req.three_mf,
paint: req.paint.clone(),
layers: req.layers,
print: req.print.clone(),
};
if o.preset == model::ModelPreset::PrintShell {
o.print.validate().map_err(|m| err(ErrorCode::Invalid, m))?;
}
let name = if req.name.is_empty() {
&req.what
} else {
Expand Down Expand Up @@ -972,20 +986,54 @@ impl AssetBackend for RealBackend {
let n = std::fs::copy(&hit, &out).map_err(io)?;
let mut files = 1;
let mut bytes = n;
if o.stl {
let mut notes = Vec::new();
if (o.stl || o.three_mf) && model::print_memory(&o) == 0 {
// A plain conversion (no voxel solid): cheap enough to do here.
let glb = std::fs::read(&hit).map_err(io)?;
let (_, len) =
starorg_data::assets::stl::glb_file_to_stl(&glb, &out.with_extension("stl"))
.map_err(|e| err(ErrorCode::Internal, e.message))?;
files += 1;
let m = starorg_data::assets::print::write_meshes(&glb, &out, &o)
.map_err(|e| worker_error(&e.into()))?;
let (n, len) = m.files_bytes();
files += n;
bytes += len;
notes = m.notes;
} else if o.stl || o.three_mf {
// The voxel steps take seconds to minutes and GBs: a fresh worker under the
// memory cap, with progress and cancel, on the copy just made.
let _x = wait_lock(&self.dirs().extract_lock())?;
let w = self.spawn_asset(&ch, &key)?;
let r = self.asset_stream(
&w,
&ch.name,
&format!("Processing model {name} for printing"),
&AssetRequest::PrintModel {
glb: out.clone(),
options: o.clone(),
out: out.clone(),
},
"%",
progress,
);
w.stop();
drop(_x);
let d: model::PrintDone = serde_json::from_value(r?).map_err(internal)?;
let (n, len) = starorg_data::assets::print::files_bytes(&d.meshes);
files += n;
bytes += len;
notes = d.notes;
self.log(
LogLevel::Info,
Some(JobKind::Dev),
Some(&ch.name),
&format!(
"Processed cached model {name} for printing ({} ms, peak memory {} MB)",
d.ms,
d.peak_rss.map(|b| b / 1_048_576).unwrap_or(0)
),
);
}
return Ok(export_result(
Some(out.display().to_string()),
files,
bytes,
true,
));
let mut r = export_result(Some(out.display().to_string()), files, bytes, true);
r.note = print_note(&notes);
return Ok(r);
}
// A fresh worker: the export's memory goes back to the OS when it stops.
let _x = wait_lock(&self.dirs().extract_lock())?;
Expand Down Expand Up @@ -1024,9 +1072,11 @@ impl AssetBackend for RealBackend {
d.peak_rss.map(|b| b / 1_048_576).unwrap_or(0)
),
);
let files = 1 + d.stl_path.is_some() as u32;
let bytes = d.bytes + d.stl_bytes.unwrap_or(0);
Ok(export_result(Some(d.path), files, bytes, false))
let (n, len) = starorg_data::assets::print::files_bytes(&d.meshes);
let (files, bytes) = (1 + n, d.bytes + len);
let mut r = export_result(Some(d.path), files, bytes, false);
r.note = print_note(&d.notes);
Ok(r)
}

fn asset_model_info(&self, req: AssetModelInfoRequest) -> CmdResult<AssetModelInfo> {
Expand Down
3 changes: 2 additions & 1 deletion app/src-tauri/src/contract/real/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub(super) fn lock_or<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {
m.lock().unwrap_or_else(|p| p.into_inner())
}

fn worker_error(e: &starorg_data::devworker::ReplyError) -> AppError {
pub(super) fn worker_error(e: &starorg_data::devworker::ReplyError) -> AppError {
let code = match e.code.as_str() {
"not-found" => ErrorCode::NotFound,
"invalid" => ErrorCode::Invalid,
Expand Down Expand Up @@ -1217,6 +1217,7 @@ impl DevBackend for RealBackend {
limit: req.limit.min(MAX_PAGE as u32),
main_only: req.main_only,
player_only: req.player_only,
fold_variants: req.fold_variants,
})
}

Expand Down
Loading
Loading