Render R2: persist named render setups without re-evaluating geometry (#667)
render.settings.set saves validated named render setups (camera, output size, exposure, environment) as one undo step, and render.settings.get reads them back without applying a camera. When validated render settings are the only change, the engine keeps the evaluated model instead of rebuilding it. Setups are saved under design format 21; format-20 designs read as having none. Fixes #658; refs #620. Contributed by @0xlillith. Co-authored-by: lillith <[email protected]>
This commit is contained in:
1 parent
771a11feab
commit
289b521a65
22 files changed
+641
-16
No files matched your search
@@ -1614,6 +1614,9 @@ pub struct DesignLink {
|
||||
/// The document.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Document {
|
||||
/// Named, renderer-independent setups. Device/job state is never saved here.
|
||||
#[serde(default, skip_serializing_if = "crate::render_settings::RenderSettings::is_empty")]
|
||||
pub render: std::sync::Arc<crate::render_settings::RenderSettings>,
|
||||
#[serde(default = "default_format")]
|
||||
pub format: String,
|
||||
pub name: String,
|
||||
@@ -1828,6 +1831,7 @@ impl Default for Document {
|
||||
impl Document {
|
||||
pub fn new(name: &str) -> Self {
|
||||
Document {
|
||||
render: Default::default(),
|
||||
format: default_format(),
|
||||
name: name.into(),
|
||||
units: default_units(),
|
||||
@@ -1859,6 +1863,18 @@ impl Document {
|
||||
}
|
||||
}
|
||||
|
||||
/// A complete structural proof: no non-render field is allowed to differ. Keeping this
|
||||
/// comparison based on the whole Document also includes fields added in future versions.
|
||||
/// The clone/comparison is only needed when render intent actually differs.
|
||||
pub fn differs_only_in_render(&self, previous: &Document) -> bool {
|
||||
if std::sync::Arc::ptr_eq(&self.render, &previous.render) || self.render == previous.render || self.render.validate().is_err() {
|
||||
return false;
|
||||
}
|
||||
let mut normalized = previous.clone();
|
||||
normalized.render = self.render.clone();
|
||||
*self == normalized
|
||||
}
|
||||
|
||||
/// The colour a body is shown and exported in (sRGB as 0–1 fractions): its appearance,
|
||||
/// else its component's, else its material's look, else the colour it was imported with.
|
||||
/// (Faces may have their own: `face_looks`.)
|
||||
|
||||
Reference in new issue
Block a user