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
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
/* SPDX-FileCopyrightText: 2024 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "DNA_modifier_types.h"
|
|
|
|
#include "BKE_bake_items_paths.hh"
|
|
#include "BKE_packedFile.hh"
|
|
|
|
struct ReportList;
|
|
struct Main;
|
|
|
|
namespace blender::bke::bake {
|
|
|
|
NodesModifierPackedBake *pack_bake_from_disk(const BakePath &bake_path, ReportList *reports);
|
|
|
|
[[nodiscard]] bool unpack_bake_to_disk(const NodesModifierPackedBake &packed_bake,
|
|
const BakePath &bake_path,
|
|
ReportList *reports);
|
|
|
|
enum class PackGeometryNodesBakeResult {
|
|
NoDataFound,
|
|
PackedAlready,
|
|
Success,
|
|
};
|
|
|
|
PackGeometryNodesBakeResult pack_geometry_nodes_bake(Main &bmain,
|
|
ReportList *reports,
|
|
Object &object,
|
|
NodesModifierData &nmd,
|
|
NodesModifierBake &bake);
|
|
|
|
enum class UnpackGeometryNodesBakeResult {
|
|
BlendFileNotSaved,
|
|
NoPackedData,
|
|
Error,
|
|
Success,
|
|
};
|
|
|
|
UnpackGeometryNodesBakeResult unpack_geometry_nodes_bake(Main &bmain,
|
|
ReportList *reports,
|
|
Object &object,
|
|
NodesModifierData &nmd,
|
|
NodesModifierBake &bake,
|
|
ePF_FileStatus how);
|
|
|
|
} // namespace blender::bke::bake
|