Files
test2/source/blender/blenkernel/BKE_bake_items.hh
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00

91 lines
2.0 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BKE_geometry_set.hh"
namespace blender::bke {
/**
* A "bake item" contains the baked data of e.g. one node socket at one frame. Typically, multiple
* bake items form the entire baked state for one frame.
*
* Bake items can be serialized. Also see `BKE_bake_items_serialize.hh`.
*/
class BakeItem {
public:
virtual ~BakeItem() = default;
};
class GeometryBakeItem : public BakeItem {
public:
GeometrySet geometry;
GeometryBakeItem(GeometrySet geometry);
/**
* Removes parts of the geometry that can't be stored in the simulation state:
* - Anonymous attributes can't be stored because it is not known which of them will or will not
* be used in the future.
* - Materials can't be stored directly, because they are linked ID data blocks that can't be
* restored from baked data currently.
*/
static void cleanup_geometry(GeometrySet &geometry);
};
/**
* References a field input/output that becomes an attribute as part of the simulation state.
* The attribute is actually stored in a #GeometryBakeItem, so this just references
* the attribute's name.
*/
class AttributeBakeItem : public BakeItem {
private:
std::string name_;
public:
AttributeBakeItem(std::string name) : name_(std::move(name)) {}
StringRefNull name() const
{
return name_;
}
};
/** Storage for a single value of a trivial type like `float`, `int`, etc. */
class PrimitiveBakeItem : public BakeItem {
private:
const CPPType &type_;
void *value_;
public:
PrimitiveBakeItem(const CPPType &type, const void *value);
~PrimitiveBakeItem();
const void *value() const
{
return value_;
}
const CPPType &type() const
{
return type_;
}
};
class StringBakeItem : public BakeItem {
private:
std::string value_;
public:
StringBakeItem(std::string value);
StringRefNull value() const
{
return value_;
}
};
} // namespace blender::bke