Previously, it was only possible to bake to disk with geometry nodes. This patch adds support for storing the baked data directly in the .blend file. By default, new bakes are stored in the .blend file now. Whether a new bake should be packed or stored on disk can be configured in two places: in the properties of the bake node and in the bake panel of the modifier. These settings don't affect existing bakes, only the next bake. To unpack or pack an individual bake, there is a new operator button next to the bake button. The icon and the label below indicate where the bake is currently stored. The label now also contains the size of the bake. To unpack or pack all bakes, the `File > External Data > Pack Resources / Unpack Resources` operators can be used. The unpack operator also has a new title that mentions the number if individual files separate from the number of bakes. This works better than just listing a number of files because a bake can consist of many files. Pull Request: https://projects.blender.org/blender/blender/pulls/124230
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
#include "BLI_string_ref.hh"
|
|
#include "BLI_sub_frame.hh"
|
|
#include "BLI_vector.hh"
|
|
|
|
namespace blender::bke::bake {
|
|
|
|
struct MetaFile {
|
|
SubFrame frame;
|
|
std::string path;
|
|
};
|
|
|
|
struct BakePath {
|
|
/** Path to the directory containing the meta data per frame. */
|
|
std::string meta_dir;
|
|
/**
|
|
* Path to the directory that contains the binary data. Could be shared between multiple bakes
|
|
* to reduce memory consumption.
|
|
*/
|
|
std::string blobs_dir;
|
|
/**
|
|
* Folder that is allowed to be deleted when the bake is deleted and it doesn't contain anything
|
|
* else. Typically, this contains the meta and blob directories.
|
|
*/
|
|
std::optional<std::string> bake_dir;
|
|
|
|
static BakePath from_single_root(StringRefNull root_dir);
|
|
};
|
|
|
|
std::string frame_to_file_name(const SubFrame &frame);
|
|
std::optional<SubFrame> file_name_to_frame(const StringRef file_name);
|
|
|
|
Vector<MetaFile> find_sorted_meta_files(const StringRefNull meta_dir);
|
|
|
|
} // namespace blender::bke::bake
|