.blend files saved with 2.75a contain multiple file chunks (BHead) with same pointer address #45471
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#45471
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Windows 7 SP1 64bit
Radeon HD 5400 1GB
Blender Version
Broken: 2.75a
Worked: 2.74
Short description of error
.blend files saved with 2.75a contain multiple file chunks (BHead) with the same pointer address.
I'm loading the .blend files from Java Game.
Exact steps for others to reproduce the error
Save .blend file in 2.75a
Parse the BHead entries and you will find duplicates.
All duplicate chunks are type DATA with a size of 520 bytes and appears to be UV data. Somehow blender knows which one to use but I can't figure out how.
Resave .blend file in 2.74 and there are no duplicates and everything works fine.
armor.blend
Changed status to: 'Open'
Added subscriber: @pquiring
#45918 was marked as duplicate of this issue
I tried 2.75 (without the a) and same problem.
I've tried using the first or last occurrence of the duplicate data chunks but the results are always corrupt.
Thanks.
The duplicate chunks are all CustomDataLayer structs (DNA# 454 in the example provided).
Added subscribers: @ThomasDinges, @ideasman42, @Sergey
Can you please check?
I have 50 models (.blend files) in my project. The models with only 1 object had no problem. But any other model with multiple objects seems to cause this issue.
Added subscriber: @mont29
Do we have a tool (like a py script or so) to easily print out a .blend file structure? Otherwise, could be worth adding this (should not be too hard, given the work already done for BAM, I hope?).
@mont29, you can use blendfile.py which was originally written for BlenderAID and then updated to latest .blend in BAM. See https://developer.blender.org/diffusion/BAM/browse/master/bam/blend/
I've stripped down my .blend loader and made it print out each BHead as it loads are stores them into a HashMap keyed by the oldptr value. It's a java app but I've included it compiled.
Just run "java -jar blenderFileParse.jar armor.blend"
The output is also included in armor.txt
What I find strange is that blender seems to be unaffected by these duplicate BHeads. I can open the file in blender and everything is okay (even in v2.74). Somehow in readfile.c the qsort() and oldnewmap_liblookup() function are getting the correct BHead data, possibly by chance.
blenderFileParse.zip
Ok, I’ll try to understand this tomorrow
I think I found the answer. In readfile.c there is a function called oldnewmap_lookup_and_inc() that I think handles the case where multiple BHead chunks contain the same old pointer. It uses a lasthit field to remember which one it used and uses them in order.
This sucks, now I can't store the BHead's in a HashMap keyed on the old pointer.
2.74 doesn't rely on these duplicate entries but 2.75 does. Why? It's really confusing.
You should update the "mystery_of_the_blend.html" to indicate that BHead's can contain duplicate entries and are used in the order they were saved.
Sorry to bother you.
Thanks.
Yeah, was coming to the same conclusion about why it works in Blender - but this is brittle and dangerous… Could break virtually anytime by a small change in some unrelated part of read code, imho.
The issue comes from writing CDLayers, in
write_meshes()
we make temp copy of cdlayers (to strip out temp layers we do not want to save), and we end up saving those temp copies' addresses, instead of original ones, which are guaranteed to be unique (temp copies can reuse same mem across meshes).Should not be that hard to fix, I’m on it.
Ya, I've modified my code to support reading these duplicates properly. It wasn't easy. The dups have to be read in the order they are in file but in the reverse order of the objects in their linked list order and not in the order the objects are in the file (get that?)
Anyways, thanks for helping.
This issue was referenced by
ff3d535bc2
Changed status from 'Open' to: 'Resolved'
Added subscribers: @Psy-Fi, @Blendify, @TheOnlyJoey