Files
test/source/blender/blenkernel/BKE_compute_contexts.hh
Jacques Lucke 311ca3e6af Core: rename Session UUID to Session UID
`UUID` generally stands for "universally unique identifier". The session identifier that
we use is neither universally unique, nor does it follow the standard. Therefor, the term
"session uuid" is confusing and should be replaced.

In #116888 we briefly talked about a better name and ended up with "session uid".
The reason for "uid" instead of "id" is that the latter is a very overloaded term in Blender
already.

This patch changes all uses of "uuid" to "uid" where it's used in the context of a
"session uid". It's not always trivial to see whether a specific mention of "uuid" refers
to an actual uuid or something else. Therefore, I might have missed some renames.
I can't think of an automated way to differentiate the case.

BMesh also uses the term "uuid" sometimes in a the wrong context (e.g. `UUIDFaceStepItem`)
but there it also does not mean "session uid", so it's *not* changed by this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/117350
2024-01-22 13:47:13 +01:00

127 lines
3.1 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/**
* This file implements some specific compute contexts for concepts in Blender.
*/
#include <optional>
#include "BLI_compute_context.hh"
struct bNode;
struct bNodeTree;
namespace blender::bke {
class ModifierComputeContext : public ComputeContext {
private:
static constexpr const char *s_static_type = "MODIFIER";
/**
* Use modifier name instead of something like `session_uid` for now because:
* - It's more obvious that the name matches between the original and evaluated object.
* - We might want that the context hash is consistent between sessions in the future.
*/
std::string modifier_name_;
public:
ModifierComputeContext(const ComputeContext *parent, std::string modifier_name);
StringRefNull modifier_name() const
{
return modifier_name_;
}
private:
void print_current_in_line(std::ostream &stream) const override;
};
class GroupNodeComputeContext : public ComputeContext {
private:
static constexpr const char *s_static_type = "NODE_GROUP";
int32_t node_id_;
/**
* The caller node tree and group node are not always necessary or even available, but storing
* them here simplifies "walking up" the compute context to the parent node groups.
*/
const bNodeTree *caller_tree_ = nullptr;
const bNode *caller_group_node_ = nullptr;
public:
GroupNodeComputeContext(const ComputeContext *parent,
int32_t node_id,
const std::optional<ComputeContextHash> &cached_hash = {});
GroupNodeComputeContext(const ComputeContext *parent,
const bNode &node,
const bNodeTree &caller_tree);
int32_t node_id() const
{
return node_id_;
}
const bNode *caller_group_node() const
{
return caller_group_node_;
}
const bNodeTree *caller_tree() const
{
return caller_tree_;
}
private:
void print_current_in_line(std::ostream &stream) const override;
};
class SimulationZoneComputeContext : public ComputeContext {
private:
static constexpr const char *s_static_type = "SIMULATION_ZONE";
int32_t output_node_id_;
public:
SimulationZoneComputeContext(const ComputeContext *parent, int output_node_id);
SimulationZoneComputeContext(const ComputeContext *parent, const bNode &node);
int32_t output_node_id() const
{
return output_node_id_;
}
private:
void print_current_in_line(std::ostream &stream) const override;
};
class RepeatZoneComputeContext : public ComputeContext {
private:
static constexpr const char *s_static_type = "REPEAT_ZONE";
int32_t output_node_id_;
int iteration_;
public:
RepeatZoneComputeContext(const ComputeContext *parent, int32_t output_node_id, int iteration);
RepeatZoneComputeContext(const ComputeContext *parent, const bNode &node, int iteration);
int32_t output_node_id() const
{
return output_node_id_;
}
int iteration() const
{
return iteration_;
}
private:
void print_current_in_line(std::ostream &stream) const override;
};
} // namespace blender::bke