OverviewFilesCommitsIssuesDocsReleasesPeers

blender-bridge commits / 576aea3

Remove 100k vertex cap and fix SHM size detection on reconnect
- Remove arbitrary vert_count > 100000 cap in import — was rejecting 500k tri meshes. Keep only the data-fits-in-entry bounds check. - ShmRegion.open() now uses actual file size and derives region_size from layout (2 regions + 8MB tile ring) instead of using defaults. Prevents re-resize loop on reconnect when SHM was already grown. - Reconnect tile ring offset uses actual region size, not constant. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
576aea3a501c1bb741b001f48700d9af771dd520
by plankatron <fleeky@gmail.com> · 2026-03-04T02:54:00.000Z

Changed files (4) +17 -13

blender_addon/__init__.py +3 -4
……@@ -370,10 +370,9 @@ def _attempt_reconnect():
370370 _detector.register()
371371 _detector.set_resize_callback(_on_shm_resized)
372372
373 # Re-initialize tile baker
374 from .shm_protocol import REGION_SIZE
375 tile_ring_offset = REGION_SIZE * 2
376 tile_ring_size = TILE_RING_SIZE
373 # Re-initialize tile baker (use actual region size, not default)
374 tile_ring_offset = _shm._region_size * 2
375 tile_ring_size = _shm.size - tile_ring_offset
377376 _baker = TileBaker(_shm, tile_size=128, max_mips=8)
378377 _baker.init_ring_buffer(tile_ring_offset, tile_ring_size)
379378
blender_addon/shm_protocol.py +13 -8
……@@ -106,24 +106,29 @@ class ShmRegion:
106106 def open(self, name: str, size: int) -> bool:
107107 """Open an existing shared memory region (reader — will NOT unlink).
108108
109 If the SHM file is smaller than requested size, uses the actual
110 file size to avoid mmap ValueError.
109 Uses the actual file size and derives region_size from layout:
110 shm = region0 + region1 + 8MB_tile_ring → region_size = (actual - 8MB) / 2
111111 """
112112 self._name = name
113113 path = f"/dev/shm{name}"
114114 try:
115115 self._fd = os.open(path, os.O_RDWR)
116 # Check actual file size to handle version mismatch
116 # Use actual file size (handles resize and version mismatch)
117117 actual_size = os.fstat(self._fd).st_size
118 if actual_size < size:
118 if actual_size != size:
119119 print(
120 f"BlenderBridge: SHM size mismatch — expected {size}, "
121 f"got {actual_size}. Using actual size. "
122 f"Restart Godot with updated .so to fix."
120 f"BlenderBridge: SHM size {actual_size} "
121 f"(expected {size}), using actual."
123122 )
124 size = actual_size
123 size = actual_size
125124 self._mm = mmap.mmap(self._fd, size)
126125 self._size = size
126 # Derive region size from layout: 2 regions + 8 MB tile ring
127 tile_ring = 8 * 1024 * 1024
128 if size > tile_ring:
129 self._region_size = (size - tile_ring) // 2
130 else:
131 self._region_size = REGION_SIZE
127132 self._owner = False
128133 return True
129134 except OSError:
blender_bridge_addon.zip +0 -0
(no content changes — binary or rename)
src/blender_bridge.cpp +1 -1
……@@ -867,7 +867,7 @@ void BlenderBridge::import_changes(Node *root) {
867867 cursor += 4;
868868
869869 // Bounds check: ensure position data fits within the entry
870 if (vert_count > 100000 || cursor + vert_count * 12 > data_end) {
870 if (vert_count == 0 || cursor + vert_count * 12 > data_end) {
871871 UtilityFunctions::printerr("BlenderBridge: vert_count out of bounds: ", (int)vert_count);
872872 continue;
873873 }