|
Blender V5.3
|
#include <writefile.hh>
Public Attributes | |
| std::shared_ptr< dna::pointers::PointersInDNA > | sdna_pointers |
| Map< const void *, uint64_t > | pointer_map |
| Set< uint64_t > | used_ids |
| uint64_t | next_id_hint = 0 |
Definition at line 26 of file writefile.hh.
| uint64_t blender::WriteDataStableAddressIDs::next_id_hint = 0 |
The next stable address id is derived from this. This is modified in two cases:
When creating the new address id, keep in mind that this may be 0 and it may collide with previous hints.
Definition at line 76 of file writefile.hh.
Referenced by blender::get_address_id_for_undo(), blender::get_address_id_int(), and blender::mywrite_id_begin().
Maps each runtime-pointer to a unique identifier that's written in the .blend file.
Currently, for regular blendfile writing, no pointers are ever removed from this map during writing of a single file. Correctness wise, this is fine. However, when some data-blocks write temporary addresses, those may be reused across IDs while actually pointing to different data. This can break address id stability in some situations. In the future this could be improved by clearing such temporary pointers before writing the next data-block.
In undo case, only a very small sub-set of 'generated' addresses (temp data generated for writefile only) is added to this mapping, most pointers are written as-is (since their addresses are always stable in undo context: if unchanged, address remains the same). The mapping is also cleared after every ID writing, to allow temp allocated data to re-use the same source address across different IDs. The generated address ids will always be unique though (see also used_ids description below).
Definition at line 49 of file writefile.hh.
Referenced by blender::BlendStructWriterVoid::generated_ptr(), blender::get_address_id_int(), blender::mywrite_id_end(), and blender::prepare_stable_data_block_ids().
| std::shared_ptr<dna::pointers::PointersInDNA> blender::WriteDataStableAddressIDs::sdna_pointers |
Knows which DNA members are pointers. Those members are overridden when serializing the .blend file to get more stable pointer identifiers.
Definition at line 31 of file writefile.hh.
Referenced by blender::BlendStructWriterVoid::generated_ptr(), blender::writedata_new(), and blender::writestruct_at_address_nr().
Contains all the #pointer_map.values() ever generated during a writefile operation.
This is used to make sure that the same id is never reused for a different pointer. While this is technically allowed in .blend files (when the pointers are local data of different objects), we currently don't always know what type a pointer points to when writing it. So we can't determine if a pointer is local or not.
Note that in undo (memfile) case, this set is not reset after every ID writing, to ensure that all generated address ids remain unique across a whole blend-file writing operation.
Definition at line 61 of file writefile.hh.
Referenced by blender::get_next_stable_address_id().