Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-07-27BlenRead: Add GHash-based search for already read linked IDs.Bastien Montagne
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading to quickly find already read linked IDs. Without that, search would use string-based search over list of linked data, which becomes extremely slow and inneficient in cases where a lot of IDs are linked from a same library. See also {T89194}. Extrem-usecase reported in T89194 is now about 4 times faster in linked data reading (about 2 times faster for the whole .blend file loading). More normal cases (like Sprites studio production files) have barely measurable speed improvements, a few percents at best. NOTE: `main_idmap` API was extended to support insertion and removal of IDs from the mapping, avoids having to re-create the whole thing several time during libraries expansion in readcode. Differential Revision: https://developer.blender.org/D11757
2021-07-23Cleanup: code comments punctuation / spacingCampbell Barton
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-06-28Cleanup: repeated terms in code comments & error messagesCampbell Barton
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-23Readfile: use CLOG instead of printf's.Bastien Montagne
Note that this commit uses a second LogRef (`blo.readfile.undo`) for undo specific meassages. Allows to use `--log "*undo*"` cli option to match all undo reporting. Also did some minor tweaks to some reports on the way.
2021-06-23Revert "Revert "Enhanced stats/reports for blendfile reading.""Bastien Montagne
This reverts commit rB3a48147b8ab92, and fixes the issues with linking etc. Change compared to previous buggy commit (rBf8d219dfd4c31) is that new `BlendFileReadReports` reports are now passed to the lowest level function generating the `FileData` (`filedata_new()`), which ensures (and asserts) that all code using it does have a valid non-NULL pointer to a `BlendFileReadReport` data. Sorry for the noise, it's always when you think a change is trivial and do not test it well enough that you end up doing those kind of mistakes...
2021-06-22Cleanup: Spelling MistakesLeon Zandman
This patch fixes many minor spelling mistakes, all in comments or console output. Mostly contractions like can't, won't, don't, its/it's, etc. Differential Revision: https://developer.blender.org/D11663 Reviewed by Harley Acheson
2021-06-22Revert "Enhanced stats/reports for blendfile reading."Brecht Van Lommel
This change crashes library linking operators, related tests and probably more. This reverts commit f8d219dfd4c31a918e33cb715472d91a5cd3fd51. Ref D11583
2021-06-22Enhanced stats/reports for blendfile reading.Bastien Montagne
Add direct user feedback (as a warning report) to user when recursive resync of overrides was needed. And some timing (as CLOG logs) about main readfile process steps. This is essentially adding a new BlendFileReadReport structure that wraps BKE_reports list, and adds some extra info (some timing, some info about overrides and (recursive) resync, etc.).
2021-06-10Cleanup: move endian values from BKE_global into BLI_endian_definesCampbell Barton
This change was prompted by D6408 which moves thumbnail extraction into a shared function that happens use these endian defines but only links blenlib. There is no need for these defines to be associated with globals so move into their own header.
2021-06-04BlenLoad: Ensure linked IDs are properly sorted.Bastien Montagne
So far, linked IDs were not properly sorted at all, only the ones explicitely linked from WM code would be, but any indirectly linked data-blocks would end up in some random order in their lists. While not ideal, this is not a huge issue in itself, but it had bad side-effects, e.g. causing (recursive) resync of overrides to happen in random order, leading to mismatches between name indices of newly-generated override IDs and the one existings e.g. And in general, it is much better to be consistent here. Note that the file sub-version is bumped for this commit, since some sorting (the directly linked IDs which we keep a reference to) should never need to be re-done after relevant doversion process.
2021-05-06Cleanup: VSE: move functions from incorrect fileRichard Antalik
`SEQ_recursive_apply` and `SEQ_seqbase_recursive_apply` were incorrectly refactored into `iterator.c` file, but they aren't part and don't use sequencer iterator. Functions are moved to `utils.c` file.
2021-05-04Fix T87489: Text Data-Blocks get deleted on Recursive PurgeSebastian Parborg
Text data block were not considered special in the recursive purge function. So they would get deleted if they had no actual users. To fix this we instead make text data block use "fake user" so that addon authors can specify script files that should be removed if nothing is using it anymore. Per default, new text object have "fake user" set. So functionality wise, the user has to explicitly specify that they want the text object to be purge-able. Reviewed By: Bastien Differential Revision: http://developer.blender.org/D10983
2021-04-20Core: Add do_versions file for 3.0Falk David
Differential Revision: https://developer.blender.org/D11030
2021-04-15Spreadsheet: breadcrumbs and node pinningJacques Lucke
This introduces a context path to the spreadsheet editor, which contains information about what data is shown in the spreadsheet. The context path (breadcrumbs) can reference a specific node in a node group hierarchy. During object evaluation, the geometry nodes modifier checks what data is currently requested by visible spreadsheets and stores the corresponding geometry sets separately for later access. The context path can be updated by the user explicitely, by clicking on the new icon in the header of nodes. Under some circumstances, the context path is updated automatically based on Blender's context. This patch also consolidates the "Node" and "Final" object evaluation mode to just "Evaluated". Based on the current context path, either the final geometry set of an object will be displayed, or the data at a specific node. The new preview icon in geometry nodes now behaves more like a toggle. It can be clicked again to clear the context path in an open spreadsheet editor. Previously, only an object could be pinned in the spreadsheet editor. Now it is possible to pin the entire context path. That allows two different spreadsheets to display geometry data from two different nodes. The breadcrumbs in the spreadsheet header can be collapsed by clicking on the arrow icons. It's not ideal but works well for now. This might be changed again, if we get a data set region on the left. Differential Revision: https://developer.blender.org/D10931
2021-03-25Fix T86853: Critical bug in write code of CacheFile ID.Bastien Montagne
CacheFile writing code would not write generic ID data (call for it has been missing since the initial commit, rB61050f75b13e). While potentially affecting other areas (mostly CustomProperties/IDProperties), this was a critical failure for liboverrides. Also added some workaround code to allow opening broken files (though the override of the CacheFile data-block will be lost).
2021-03-15LibOverride: Add checks to address some degenerate blend file casesBastien Montagne
Attempt to work around some full-corruption cases created at the studio. Not clear how those were created, so not really fixing anything here, just detecting and 'solving' as best as possible some high corruption of local overrides. This is good to have in general anyway, might help prevent further corruption to happen too.
2021-03-15Cleanup: rename G_FILE_RECOVER -> G_FILE_RECOVER_READCampbell Barton
No functional changes, make room for a write equivalent.
2021-03-12Cleanup: const warningCampbell Barton
2021-03-12Fix heap buffer overflow appending/linking from a blend fileSybren A. Stüvel
Add new function `blo_bhead_is_id_valid_type()` to correctly check the blend file block type. File block type codes have four bytes, and two of those are only in use when these blocks contain ID datablocks (like `"OB\0\0"`). However, there are other types defined in `BLO_blend_defs.h` that have four bytes, like `TEST`, `ENDB`, etc. The function `BKE_idtype_idcode_is_valid(short idcode)` was used to check for ID datablocks while reading a blend file. This only takes a 2-byte parameter, and thus its result is invalid for the 4-byte codes. For `TEST` blocks, it would actually consider it a `TE` block, which is a valid identifier for a Texture. This caused the heap buffer overflow, as the datablock is not a valid ID, and thus the bytes that were expected to form an ID name actually encode something completely different. Reviewed By: mont29 Differential Revision: https://developer.blender.org/D10703
2021-03-11Fix (unreported): crash on undo when using pinned id in spreadsheetJacques Lucke
Now the behavior is the same as in the properties editor, as far as I can tell.
2021-03-08PyAPI: add bpy.types.BlendFile.temp_data for temporary library loadingCampbell Barton
This adds support for creating a `BlendFile` (internally called `Main`), which is limited to a context. Temporary data can now be created which can then use `.libraries.load()` the same as with `bpy.data`. To prevent errors caused by mixing the temporary ID's with data in `bpy.data` they are tagged as temporary so they can't be assigned to properties, however they can be passed as arguments to functions. Reviewed By: mont29, sybren Ref D10612
2021-03-08readfile: add id_tag_extra argumentCampbell Barton
This allows adding ID tags when linking/loading data. This is needed to implement loading non 'G.main' ID data-blocks, see D10612.
2021-03-08Cleanup: rename offs to offsetCampbell Barton
2021-03-04Cleanup: Main `foreach ID` code: Remove `MAX_LIBARRAY` and improve comments.Bastien Montagne
The `MAX_LIBARRAY` define was an annoying doublon to the `INDEX_ID_MAX` enum value now defined in `DNA_ID.h`, and it is no more useful. And comments were somewhat outdated. Also added an explanation about chosen order for the `INDEX_ID_<IDTYPE>` order.
2021-02-27Fix T86028: Crash when loading file with missing libraries.Bastien Montagne
Regression from rB53d13b6f5387c68.
2021-02-26UX: Readfile: Libraries error messages: avoid wall of warnings.Bastien Montagne
When a lot of libraries or linked IDs were missing/not found when loading a .blend file, Blender used to show one warning report for each missing item, potentially covering the user's screen with a giant unuable popup. Now it will instead generate a single warning with amount of missing lib files and linked IDs. Each missing item is still reported individually, but only as `INFO`, so it will still show up in the console or Info editor.
2021-02-24Fix T85947: Missing check of master collection for objects being instanced.Bastien Montagne
`object_in_any_collection` used during linking/appending to check whether an object is already instanced by at least one collection, was not taking into account embedded master collections from scenes.
2021-02-13Cleanup: spellingCampbell Barton
2021-02-09Cleanup: spellingCampbell Barton
2021-02-08Fix (studio-reported) crash in readfile code.Bastien Montagne
Essentially, `lib_link_all` would perform some post-processing over data in given `bmain` that **may** fail when not all data from all libraries has been properly loaded yet. This happens when `lib_link_all` is called from `read_libraries`, where the bmains are split by libraries. Now those post-processing is put into its own utils function, which asserts that it is only called on a merged bmain. Bonus point, this will avoid re-runing those not-so-cheap operations more than once on the same data. Reproducible in r1442 of Sprite repository when opening `pro/animation_test/rex/performance/rex_crowdcamping/rex_crowdcamping.lighting.blend` NOTE: Not so sure why we have to call `lib_link_all` several times (once for each library, and then once on the whole merged bmain, including local IDs then). So that it can get called for libs while we still have that specific .blend file handle around? In any case, the overhead here is minimal since we do ensure a data-block is never lib-linked more than once, so this is not a serious concern right now. Differential Revision: https://developer.blender.org/D10307
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2021-02-05Cleanup/refactor: Undosys: Get rid of the magic values for undo direction.Bastien Montagne
Move `eUndoStepDir` to `BKE_undo_system.h` and use its values everywhere. Note that this also introduce the `STEP_INVALID` value in that enum. Finally, kept the matching struct members in some lower-level readfile code as an `int` to avoid having to include `BKE_undo_system.h` in a lot of unrelated files.
2021-01-15Use mmap() IO for reading uncompressed .blendsLukas Stockner
Instead of submitting tons of tiny IO syscalls, we can speed things up significantly by `mmap`ing the .blend file into virtual memory and directly accessing it. In my local testing, this speeds up loading the Dweebs file with all its linked files from 19sec to 10sec (on Linux). As far as I can see, this should be supported on Linux, OSX and BSD. For Windows, a second code path uses `CreateFileMapping` and `MapViewOfFile` to achieve the same result. Reviewed By: mont29, brecht Differential Revision: https://developer.blender.org/D8246
2020-12-19Cleanup: Split SEQ_sequencer.h fileRichard Antalik
2020-12-19Cleanup: Rename BKE_sequencer functionsRichard Antalik
API functions get SEQ_ prefix. Intern functions get seq_ prefix Functions also have appropriate category included in name.
2020-12-15Asset System: Prepare File Browser backend for the Asset BrowserJulian Eisel
The Asset Browser will be a sub-editor of the File Browser. This prepares the File Browser code for that. **File-Lists** * Support loading assets with metadata read from external files into the file-list. * New main based file-list type, for the "Current File" asset library. * Refresh file-list when switching between browse modes or asset libraries. * Support empty file-lists (asset library with no assets). * Store file previews as icons, so scripts can reference them via icon-id. See previous commit. **Space Data** * Introduce "browse mode" to differeniate between file and asset browsing. * Add `FileAssetSelectParams` to `SpaceFile`, with `FileSelectParams` as base. Makes sure data is separated between asset and file browsing when switching between them. The active params can be obtained through `ED_fileselect_get_active_params()`. * `FileAssetSelectParams` stores the currently visible asset library ID. * Introduce file history abstraction so file and asset browsing can keep a separate history (previous and next directories). **General** * Option to only show asset data-blocks while file browsing (not exposed here). * Add "active_file" context member, so scripts can get and display info about the active file. * Add "active_id" context member, so `ED_OT_lib_id_load_custom_preview` can set a custom ID preview. (Only for "Current File" asset library) * Expose some of `FileDirEntry` in RNA as (non-editable). That way scripts can obtain name, preview icon and asset-data. Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1 project milestone on developer.blender.org. Differential Revision: https://developer.blender.org/D9724 Reviewed by: Bastien Montagne
2020-12-15Asset System: Support custom asset library paths through PreferencesJulian Eisel
One of the core design aspects of the Asset Browser is that users can "mount" custom asset libraries via the Preferences. Currently an asset library is just a directory with one or more .blend files in it. We could easily support a single .blend file as asset library as well (rather than a directory). It's just disabled currently. Note that in earlier designs, asset libraries were called repositories. Idea is simple: In Preferences > File Paths, you can create custom libraries, by setting a name and selecting a path. The name is ensured to be unique. If the name or path are empty, the Asset Browser will not show it in the list of available asset libraries. The library path is not checked for validity, the Asset Browser will allow selecting invalid libraries, but show a message instead of the file list, to help the user understand what's going on. Of course the actual Asset Browser UI is not part of this commit, it's in one of the following ones. {F9497950} Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1 project milestone on developer.blender.org. Differential Revision: https://developer.blender.org/D9722 Reviewed by: Brecht Van Lommel, Hans Goudey
2020-12-15Asset System: Data-block asset metadata storage, reading and APIJulian Eisel
Asset metadata is what turns a regular data-block into an asset. It is a small data-structure, but a key part of the technical design of the asset system. The design foresees that asset data-blocks store an `ID.asset_data` pointer of type `AssetMetaData`. This data **must not** have dependencies on other data-blocks or data-block data, it must be an independent unit. That way we can read asset-metadata from .blends without reading anything else from the file. The Asset Browser will use this metadata (together with the data-block name, preview and file path) to represent assets in the file list. Includes: * New `ID.asset_data` for asset metadata. * Asset tags, description and custom properties. * BKE code to manage asset meta-data and asset tags. * Code to read asset data from files, without reading IDs. * RNA for asset metadata (including tags) Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1 project milestone on developer.blender.org. Differential Revision: https://developer.blender.org/D9716 Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-15Cleanup: reduce indirect DNA header inclusionCampbell Barton
Remove DNA headers, using forward declarations where possible. Also removed duplicate header, header including it's self and unnecessary inclusion of libc system headers from BKE header.
2020-12-04Cleanup: Move Outliner runtime hash into internal runtime struct, out of DNAJulian Eisel
This way Outliner internal data stays internal, non-Outliner code will not be able to access and mess with this. Further it allows us to use the real type (rather than `void *`), change the type to a C++ container if needed and slightly reduces the size for every Outliner stored in files. Slightly changed how we set the `SO_TREESTORE_REBUILD` for this, but it should effectively behave the same way as before.
2020-11-06Cleanup: remove unused includes in readfile.c and writefile.cJacques Lucke
2020-11-06Cleanup: fix naming and remove unnecessary codeJacques Lucke
2020-11-06Refactor: move Screen .blend data read to blenkernelJacques Lucke
Ref T76372.
2020-11-06Refactor: move Ipo .blend I/O to IDTypeInfo callbacksJacques Lucke
2020-11-06Refactor: move Object .blend I/O to IDTypeInfo callbacksJacques Lucke
2020-11-06Refactor: move Pose .blend I/O to blenkernelJacques Lucke
Ref T76372.
2020-11-06Refactor: move Constraint .blend I/O to blenkernelJacques Lucke
Ref T76372.
2020-11-06Refactor: move MotionPath .blend I/O to blenkernelJacques Lucke
Ref T76372.