Add FreeCAD WebAssembly module probes
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled

This commit is contained in:
2026-08-22 09:11:12 +08:00
parent a6f251f657
commit 837f44197c
11 changed files with 1762 additions and 15 deletions

View File

@@ -630,9 +630,16 @@ void PropertyDistanceList::setPyObject(PyObject* value)
}
}
void PropertyDistanceList::Save(Base::Writer& writer) const
{
if (writer.isForceXML()) {
void PropertyDistanceList::Save(Base::Writer& writer) const
{
// Emscripten restores FCStd archives from a memory stream. Keep this small
// computed list in Document.xml so it does not require a second ZIP entry.
#ifdef FC_OS_EMSCRIPTEN
constexpr bool inlineXml = true;
#else
constexpr bool inlineXml = false;
#endif
if (writer.isForceXML() || inlineXml) {
writer.Stream() << writer.ind() << "<FloatList count=\"" << getSize() << "\">" << std::endl;
writer.incInd();
for (int i = 0; i < getSize(); i++) {
@@ -647,16 +654,27 @@ void PropertyDistanceList::Save(Base::Writer& writer) const
}
}
void PropertyDistanceList::Restore(Base::XMLReader& reader)
{
reader.readElement("FloatList");
std::string file(reader.getAttribute<const char*>("file"));
if (!file.empty()) {
// initiate a file read
reader.addFile(file.c_str(), this);
}
}
void PropertyDistanceList::Restore(Base::XMLReader& reader)
{
reader.readElement("FloatList");
if (reader.hasAttribute("file")) {
std::string file(reader.getAttribute<const char*>("file"));
if (!file.empty()) {
reader.addFile(file.c_str(), this);
}
return;
}
const int count = reader.hasAttribute("count") ? static_cast<int>(reader.getAttribute<long>("count")) : 0;
std::vector<float> values;
values.reserve(std::max(count, 0));
for (int i = 0; i < count; ++i) {
reader.readElement("F");
values.push_back(std::stof(reader.getAttribute<const char*>("v")));
}
reader.readEndElement("FloatList");
setValues(values);
}
void PropertyDistanceList::SaveDocFile(Base::Writer& writer) const
{