Files
test2/tests/files/invalid_blendfiles/README.md
Sergey Sharybin bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00

1.2 KiB


Invalid Blendfiles


This folder contains blendfiles that are known to be invalid (either from unknown reasons, or on purpose).

This file gathers as much information as possible about each of them.

invalid_ca_la_id_code.blend

This file was generated from a default startup scene, by altering the written IDcode of Camera and Lamp data-blocks, with the following patch:

--- a/source/blender/blenloader/intern/writefile.cc
+++ b/source/blender/blenloader/intern/writefile.cc
@@ -1894,7 +1894,14 @@ void BLO_write_struct_list_by_name(BlendWriter *writer, const char *struct_name,
 
 void blo_write_id_struct(BlendWriter *writer, int struct_id, const void *id_address, const ID *id)
 {
-  writestruct_at_address_nr(writer->wd, GS(id->name), struct_id, 1, id_address, id);
+  int filecode = GS(id->name);
+  if (filecode == ID_CA) {
+    filecode = MAKE_ID2('!', '?');
+  }
+  else if (filecode == ID_LA) {
+    filecode = BLEND_MAKE_ID('!', '?', 'L', 'A');
+  }
+  writestruct_at_address_nr(writer->wd, filecode, struct_id, 1, id_address, id);
 }
 
 int BLO_get_struct_id_by_name(const BlendWriter *writer, const char *struct_name)