forked from 1b-agent/opencadstudio-upstream
Cargo: codec 1ca7d33 (acadrust 0.6.0 sync), kernel 7fb0abb, graph d7908a8
The codec now carries upstream acadrust 0.6.0 (foldhash, thiserror 2, MLINE / legacy class / layer handle fixes). Its new Spline::dwg_scenario is serde-skipped, so the Python plugin's generated entity records could not name it; they now take such fields from the type's Default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fafb1758c1
commit
2dfa9f3f2a
6 files changed
+30
-22
No files matched your search
@@ -693,6 +693,14 @@ fn gen_struct(name: &str, info: &TypeInfo, registry: &TypeRegistry, required: &[
|
||||
.map(|field| format!("\"{field}\""))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
// Fields the codec keeps out of serde (`#[serde(skip)]`) are invisible to
|
||||
// the traced registry; entity records default them through their own
|
||||
// `Default` instead of failing to construct.
|
||||
let rest = if info.fields.iter().any(|f| f.type_id.as_str() == "EntityCommon") {
|
||||
" ..Default::default()\n"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
for f in &info.fields {
|
||||
if f.type_id.as_str() == "EntityCommon" {
|
||||
// A sub-record's own common data (layer, XDATA, handles) is not part
|
||||
@@ -750,14 +758,16 @@ fn dict_to_{snake}(value: PyObjectRef, vm: &VirtualMachine) -> PyResult<{path}>
|
||||
return Err(vm.new_value_error(format!("{name} needs {{required}}")));
|
||||
}}
|
||||
}}
|
||||
#[allow(clippy::needless_update)]
|
||||
Ok({path} {{
|
||||
{from_dict_fields} }})
|
||||
{from_dict_fields}{rest} }})
|
||||
}}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn default_{snake}() -> {path} {{
|
||||
#[allow(clippy::needless_update)]
|
||||
{path} {{
|
||||
{default_fields} }}
|
||||
{default_fields}{rest} }}
|
||||
}}
|
||||
|
||||
"#
|
||||
|
||||
Reference in new issue
Block a user