OverviewFilesCommitsIssuesDocsReleasesPeers

blender-bridge commits / 4a7220f

Dedup texture registration to prevent infinite re-register loop
VirtualTexture::register_texture() now returns the existing ID if a texture with the same name is already active, instead of always allocating a new one. Prevents ID explosion on reconnect cycles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4a7220f57319940447fcd896affa1e15fe8a1f5f
by plankatron <fleeky@gmail.com> · 2026-03-04T02:44:32.000Z

Changed files (1) +8 -0

src/virtual_texture.cpp +8 -0
……@@ -92,6 +92,14 @@ int VirtualTexture::get_mip_levels() const { return _mip_levels; }
9292// ── Texture registration ──────────────────────────────────────────────────────
9393
9494int VirtualTexture::register_texture(const String &name, int width, int height) {
95 // Dedup: return existing ID if already registered with same name
96 for (auto &tex : _textures) {
97 if (tex.active && tex.name == name) {
98 UtilityFunctions::print("VirtualTexture: Reusing texture '", name, "' id=", tex.id);
99 return tex.id;
100 }
101 }
102
95103 int id = _next_texture_id++;
96104 RegisteredTexture tex;
97105 tex.id = id;