@volter/blender-engine 0.1.41 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser/session.py
CHANGED
|
@@ -1768,12 +1768,20 @@ class Session:
|
|
|
1768
1768
|
if not os.path.exists(self.document):
|
|
1769
1769
|
return {"document": relative_path, "opened": False}
|
|
1770
1770
|
bpy.ops.wm.open_mainfile(filepath=self.document)
|
|
1771
|
+
size = os.path.getsize(self.document)
|
|
1772
|
+
# THE STAGED COPY GOES ONCE BLENDER HAS READ IT. It sits in the engine's heap (WasmFS keeps
|
|
1773
|
+
# file data in linear memory) and nothing reads it again: the load took everything into
|
|
1774
|
+
# Blender's own memory, packed pictures included, and the next save writes the path anew.
|
|
1775
|
+
# Freed before the first present, its bytes serve that present's evaluation instead of
|
|
1776
|
+
# raising the heap's high-water mark by the file's size (307 MB for the Stoneguard file).
|
|
1777
|
+
# The worker still holds the host's stamp for it, so it is not staged in again.
|
|
1778
|
+
os.remove(self.document)
|
|
1771
1779
|
self.present()
|
|
1772
1780
|
# The load did not dirty anything: what is in memory IS the file.
|
|
1773
1781
|
self.save_due = False
|
|
1774
1782
|
return {"document": relative_path, "opened": True,
|
|
1775
1783
|
"objects": len(bpy.data.objects),
|
|
1776
|
-
"size":
|
|
1784
|
+
"size": size}
|
|
1777
1785
|
|
|
1778
1786
|
def mark_changed(self):
|
|
1779
1787
|
"""A request that can change the model ran: the next present carries
|
|
@@ -1493,9 +1493,22 @@ export class BlenderRuntimeView {
|
|
|
1493
1493
|
// is ahead of this presenter — a page reloaded under a still-running
|
|
1494
1494
|
// session — and saying so by name is what makes it re-send the frame
|
|
1495
1495
|
// in full (`dispatch.mts`, `runtime_present`).
|
|
1496
|
-
|
|
1496
|
+
// AND AT THAT REVISION: the frame names every mesh with the revision the engine holds
|
|
1497
|
+
// it at, so it is a whole manifest of what this presenter should hold, and a resident
|
|
1498
|
+
// geometry at another revision has drifted from the engine (a present the session
|
|
1499
|
+
// recorded that never landed here). Refusing it by name is the same resync as a mesh
|
|
1500
|
+
// not held at all: the session drops its record and re-sends in full.
|
|
1501
|
+
const resident = this.meshes.get(id)?.signature;
|
|
1502
|
+
if (
|
|
1503
|
+
this.frame?.session === next.session &&
|
|
1504
|
+
resident !== undefined &&
|
|
1505
|
+
(resident === `revision:${data.revision}` || !resident.startsWith('revision:'))
|
|
1506
|
+
)
|
|
1507
|
+
continue;
|
|
1497
1508
|
throw new Error(
|
|
1498
|
-
|
|
1509
|
+
resident === undefined
|
|
1510
|
+
? `${UNKNOWN_GEOMETRY}: the presenter does not hold runtime mesh ${id} (store ${data.store}, revision ${data.revision})`
|
|
1511
|
+
: `${UNKNOWN_GEOMETRY}: the presenter holds runtime mesh ${id} at ${resident}, not revision ${data.revision}`,
|
|
1499
1512
|
);
|
|
1500
1513
|
}
|
|
1501
1514
|
const drawn = 'hash' in data;
|