Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
180 lines
4.5 KiB
C++
180 lines
4.5 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2013 Blender Foundation. All rights reserved. */
|
|
|
|
/** \file
|
|
* \ingroup depsgraph
|
|
*
|
|
* Methods for constructing depsgraph
|
|
*/
|
|
|
|
#include "intern/builder/deg_builder_relations.h"
|
|
|
|
namespace blender::deg {
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/* Time source. */
|
|
|
|
TimeSourceKey::TimeSourceKey() : id(nullptr)
|
|
{
|
|
}
|
|
|
|
TimeSourceKey::TimeSourceKey(ID *id) : id(id)
|
|
{
|
|
}
|
|
|
|
string TimeSourceKey::identifier() const
|
|
{
|
|
return string("TimeSourceKey");
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Component.
|
|
|
|
ComponentKey::ComponentKey() : id(nullptr), type(NodeType::UNDEFINED), name("")
|
|
{
|
|
}
|
|
|
|
ComponentKey::ComponentKey(ID *id, NodeType type, const char *name)
|
|
: id(id), type(type), name(name)
|
|
{
|
|
}
|
|
|
|
string ComponentKey::identifier() const
|
|
{
|
|
const char *idname = (id) ? id->name : "<None>";
|
|
string result = string("ComponentKey(");
|
|
result += idname;
|
|
result += ", " + string(nodeTypeAsString(type));
|
|
if (name[0] != '\0') {
|
|
result += ", '" + string(name) + "'";
|
|
}
|
|
result += ')';
|
|
return result;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Operation.
|
|
|
|
OperationKey::OperationKey()
|
|
: id(nullptr),
|
|
component_type(NodeType::UNDEFINED),
|
|
component_name(""),
|
|
opcode(OperationCode::OPERATION),
|
|
name(""),
|
|
name_tag(-1)
|
|
{
|
|
}
|
|
|
|
OperationKey::OperationKey(ID *id, NodeType component_type, const char *name, int name_tag)
|
|
: id(id),
|
|
component_type(component_type),
|
|
component_name(""),
|
|
opcode(OperationCode::OPERATION),
|
|
name(name),
|
|
name_tag(name_tag)
|
|
{
|
|
}
|
|
|
|
OperationKey::OperationKey(
|
|
ID *id, NodeType component_type, const char *component_name, const char *name, int name_tag)
|
|
: id(id),
|
|
component_type(component_type),
|
|
component_name(component_name),
|
|
opcode(OperationCode::OPERATION),
|
|
name(name),
|
|
name_tag(name_tag)
|
|
{
|
|
}
|
|
|
|
OperationKey::OperationKey(ID *id, NodeType component_type, OperationCode opcode)
|
|
: id(id),
|
|
component_type(component_type),
|
|
component_name(""),
|
|
opcode(opcode),
|
|
name(""),
|
|
name_tag(-1)
|
|
{
|
|
}
|
|
|
|
OperationKey::OperationKey(ID *id,
|
|
NodeType component_type,
|
|
const char *component_name,
|
|
OperationCode opcode)
|
|
: id(id),
|
|
component_type(component_type),
|
|
component_name(component_name),
|
|
opcode(opcode),
|
|
name(""),
|
|
name_tag(-1)
|
|
{
|
|
}
|
|
|
|
OperationKey::OperationKey(
|
|
ID *id, NodeType component_type, OperationCode opcode, const char *name, int name_tag)
|
|
: id(id),
|
|
component_type(component_type),
|
|
component_name(""),
|
|
opcode(opcode),
|
|
name(name),
|
|
name_tag(name_tag)
|
|
{
|
|
}
|
|
|
|
OperationKey::OperationKey(ID *id,
|
|
NodeType component_type,
|
|
const char *component_name,
|
|
OperationCode opcode,
|
|
const char *name,
|
|
int name_tag)
|
|
: id(id),
|
|
component_type(component_type),
|
|
component_name(component_name),
|
|
opcode(opcode),
|
|
name(name),
|
|
name_tag(name_tag)
|
|
{
|
|
}
|
|
|
|
string OperationKey::identifier() const
|
|
{
|
|
string result = string("OperationKey(");
|
|
result += "type: " + string(nodeTypeAsString(component_type));
|
|
result += ", component name: '" + string(component_name) + "'";
|
|
result += ", operation code: " + string(operationCodeAsString(opcode));
|
|
if (name[0] != '\0') {
|
|
result += ", '" + string(name) + "'";
|
|
}
|
|
result += ")";
|
|
return result;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// RNA path.
|
|
|
|
RNAPathKey::RNAPathKey(ID *id, const char *path, RNAPointerSource source) : id(id), source(source)
|
|
{
|
|
/* Create ID pointer for root of path lookup. */
|
|
PointerRNA id_ptr;
|
|
RNA_id_pointer_create(id, &id_ptr);
|
|
/* Try to resolve path. */
|
|
int index;
|
|
if (!RNA_path_resolve_full(&id_ptr, path, &ptr, &prop, &index)) {
|
|
ptr = PointerRNA_NULL;
|
|
prop = nullptr;
|
|
}
|
|
}
|
|
|
|
RNAPathKey::RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop, RNAPointerSource source)
|
|
: id(id), ptr(ptr), prop(prop), source(source)
|
|
{
|
|
}
|
|
|
|
string RNAPathKey::identifier() const
|
|
{
|
|
const char *id_name = (id) ? id->name : "<No ID>";
|
|
const char *prop_name = (prop) ? RNA_property_identifier(prop) : "<No Prop>";
|
|
return string("RnaPathKey(") + "id: " + id_name + ", prop: '" + prop_name + "')";
|
|
}
|
|
|
|
} // namespace blender::deg
|