Cleanup: Depsgraph: Avoid transative includes and type aliases
Instead of the monolothic `depsgraph_type.hh` header that includes most types used in the despgraph, just add includes where they are actually necessary. Also remove the `using` keywords for `std` types. The lack of specificity isn't considered good practice nowadays. Removing unnecessary transitive includes can help improve compile times because the time spent parsing headers decreases. Using the "include what you use" pattern makes futher improvements much easier too, since it the path to further reduce transitive includes becomes much clearer. Pull Request: https://projects.blender.org/blender/blender/pulls/133749
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "BKE_anim_data.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_path.hh"
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_set.hh"
|
||||
@@ -18,6 +18,7 @@
|
||||
struct ID;
|
||||
struct PointerRNA;
|
||||
struct PropertyRNA;
|
||||
struct StructRNA;
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
|
||||
@@ -165,8 +165,8 @@ void solve_cycles(CyclesSolverState *state)
|
||||
OperationNode *to = (OperationNode *)rel->to;
|
||||
eCyclicCheckVisitedState to_state = get_node_visited_state(to);
|
||||
if (to_state == NODE_IN_STACK) {
|
||||
string cycle_str = " " + to->full_identifier() + " depends on\n " +
|
||||
node->full_identifier() + " via '" + rel->name + "'\n";
|
||||
std::string cycle_str = " " + to->full_identifier() + " depends on\n " +
|
||||
node->full_identifier() + " via '" + rel->name + "'\n";
|
||||
StackEntry *current = entry;
|
||||
while (current->node != to) {
|
||||
BLI_assert(current != nullptr);
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace blender::deg {
|
||||
/** \name Time source
|
||||
* \{ */
|
||||
|
||||
string TimeSourceKey::identifier() const
|
||||
std::string TimeSourceKey::identifier() const
|
||||
{
|
||||
return string("TimeSourceKey");
|
||||
return std::string("TimeSourceKey");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -30,14 +30,14 @@ string TimeSourceKey::identifier() const
|
||||
/** \name Component
|
||||
* \{ */
|
||||
|
||||
string ComponentKey::identifier() const
|
||||
std::string ComponentKey::identifier() const
|
||||
{
|
||||
const char *idname = (id) ? id->name : "<None>";
|
||||
string result = string("ComponentKey(");
|
||||
std::string result = std::string("ComponentKey(");
|
||||
result += idname;
|
||||
result += ", " + string(nodeTypeAsString(type));
|
||||
result += ", " + std::string(nodeTypeAsString(type));
|
||||
if (name[0] != '\0') {
|
||||
result += ", '" + string(name) + "'";
|
||||
result += ", '" + std::string(name) + "'";
|
||||
}
|
||||
result += ')';
|
||||
return result;
|
||||
@@ -49,14 +49,14 @@ string ComponentKey::identifier() const
|
||||
/** \name Operation
|
||||
* \{ */
|
||||
|
||||
string OperationKey::identifier() const
|
||||
std::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));
|
||||
std::string result = std::string("OperationKey(");
|
||||
result += "type: " + std::string(nodeTypeAsString(component_type));
|
||||
result += ", component name: '" + std::string(component_name) + "'";
|
||||
result += ", operation code: " + std::string(operationCodeAsString(opcode));
|
||||
if (name[0] != '\0') {
|
||||
result += ", '" + string(name) + "'";
|
||||
result += ", '" + std::string(name) + "'";
|
||||
}
|
||||
result += ")";
|
||||
return result;
|
||||
@@ -98,11 +98,11 @@ RNAPathKey::RNAPathKey(const PointerRNA &target_prop,
|
||||
}
|
||||
}
|
||||
|
||||
string RNAPathKey::identifier() const
|
||||
std::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 + "')";
|
||||
return std::string("RnaPathKey(") + "id: " + id_name + ", prop: '" + prop_name + "')";
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "intern/builder/deg_builder_rna.h"
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "intern/node/deg_node_component.hh"
|
||||
#include "intern/node/deg_node_id.hh"
|
||||
#include "intern/node/deg_node_operation.hh"
|
||||
@@ -26,7 +25,7 @@ namespace blender::deg {
|
||||
struct TimeSourceKey {
|
||||
TimeSourceKey() = default;
|
||||
|
||||
string identifier() const;
|
||||
std::string identifier() const;
|
||||
};
|
||||
|
||||
struct ComponentKey {
|
||||
@@ -36,7 +35,7 @@ struct ComponentKey {
|
||||
{
|
||||
}
|
||||
|
||||
string identifier() const;
|
||||
std::string identifier() const;
|
||||
|
||||
const ID *id = nullptr;
|
||||
NodeType type = NodeType::UNDEFINED;
|
||||
@@ -106,7 +105,7 @@ struct OperationKey {
|
||||
OperationKey(const OperationKey &other) = default;
|
||||
OperationKey &operator=(const OperationKey &other) = default;
|
||||
|
||||
string identifier() const;
|
||||
std::string identifier() const;
|
||||
|
||||
const ID *id = nullptr;
|
||||
NodeType component_type = NodeType::UNDEFINED;
|
||||
@@ -159,8 +158,8 @@ struct PersistentOperationKey : public OperationKey {
|
||||
PersistentOperationKey &operator=(const PersistentOperationKey &other) = delete;
|
||||
|
||||
private:
|
||||
string component_name_storage_;
|
||||
string name_storage_;
|
||||
std::string component_name_storage_;
|
||||
std::string name_storage_;
|
||||
};
|
||||
|
||||
struct RNAPathKey {
|
||||
@@ -170,7 +169,7 @@ struct RNAPathKey {
|
||||
RNAPointerSource source);
|
||||
RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop, RNAPointerSource source);
|
||||
|
||||
string identifier() const;
|
||||
std::string identifier() const;
|
||||
|
||||
ID *id;
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "intern/builder/deg_builder_nodes.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -760,7 +761,7 @@ void DepsgraphNodeBuilder::build_object(int base_index,
|
||||
if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) {
|
||||
build_object_flags(base_index, object, linked_state);
|
||||
}
|
||||
id_node->linked_state = max(id_node->linked_state, linked_state);
|
||||
id_node->linked_state = std::max(id_node->linked_state, linked_state);
|
||||
id_node->is_visible_on_build |= is_visible;
|
||||
id_node->has_base |= (base_index != -1);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "DEG_depsgraph.hh"
|
||||
#include "DEG_depsgraph_build.hh"
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "intern/eval/deg_eval_copy_on_write.h"
|
||||
#include "intern/node/deg_node.hh"
|
||||
#include "intern/node/deg_node_component.hh"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "intern/builder/deg_builder.h"
|
||||
#include "intern/depsgraph.hh"
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "intern/node/deg_node.hh"
|
||||
#include "intern/node/deg_node_component.hh"
|
||||
#include "intern/node/deg_node_operation.hh"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "intern/builder/deg_builder_relations_drivers.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
@@ -116,7 +117,7 @@ static bool is_reachable(const Node *const from, const Node *const to)
|
||||
|
||||
/* Perform a graph walk from 'to' towards its incoming connections.
|
||||
* Walking from 'from' towards its outgoing connections is 10x slower on the Spring rig. */
|
||||
deque<const Node *> queue;
|
||||
std::deque<const Node *> queue;
|
||||
Set<const Node *> seen;
|
||||
queue.push_back(to);
|
||||
while (!queue.empty()) {
|
||||
@@ -167,7 +168,7 @@ void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node)
|
||||
}
|
||||
|
||||
/* Mapping from RNA prefix -> set of driver descriptors: */
|
||||
Map<string, Vector<DriverDescriptor>> driver_groups;
|
||||
Map<std::string, Vector<DriverDescriptor>> driver_groups;
|
||||
|
||||
PointerRNA id_ptr = RNA_id_pointer_create(id_orig);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_constraint.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_prototypes.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* \ingroup depsgraph
|
||||
*/
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "intern/builder/deg_builder_remove_noop.h"
|
||||
|
||||
#include "intern/node/deg_node.hh"
|
||||
@@ -14,7 +16,6 @@
|
||||
#include "intern/debug/deg_debug.h"
|
||||
#include "intern/depsgraph.hh"
|
||||
#include "intern/depsgraph_relation.hh"
|
||||
#include "intern/depsgraph_type.hh"
|
||||
|
||||
#include "DEG_depsgraph_debug.hh"
|
||||
|
||||
@@ -53,7 +54,7 @@ static inline bool is_removable_relation(const Relation *relation)
|
||||
|
||||
void deg_graph_remove_unused_noops(Depsgraph *graph)
|
||||
{
|
||||
deque<OperationNode *> queue;
|
||||
std::deque<OperationNode *> queue;
|
||||
|
||||
for (OperationNode *node : graph->operations) {
|
||||
if (is_unused_noop(node)) {
|
||||
|
||||
@@ -393,7 +393,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
|
||||
|
||||
RNANodeQueryIDData *RNANodeQuery::ensure_id_data(const ID *id)
|
||||
{
|
||||
unique_ptr<RNANodeQueryIDData> &id_data = id_data_map_.lookup_or_add_cb(
|
||||
std::unique_ptr<RNANodeQueryIDData> &id_data = id_data_map_.lookup_or_add_cb(
|
||||
id, [&]() { return std::make_unique<RNANodeQueryIDData>(id); });
|
||||
return id_data.get();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class RNANodeQuery {
|
||||
DepsgraphBuilder *builder_;
|
||||
|
||||
/* Indexed by an ID, returns RNANodeQueryIDData associated with that ID. */
|
||||
Map<const ID *, unique_ptr<RNANodeQueryIDData>> id_data_map_;
|
||||
Map<const ID *, std::unique_ptr<RNANodeQueryIDData>> id_data_map_;
|
||||
|
||||
/* Construct identifier of the node which corresponds given configuration
|
||||
* of RNA property. */
|
||||
|
||||
@@ -52,7 +52,7 @@ void AbstractBuilderPipeline::build_step_sanity_check()
|
||||
void AbstractBuilderPipeline::build_step_nodes()
|
||||
{
|
||||
/* Generate all the nodes in the graph first */
|
||||
unique_ptr<DepsgraphNodeBuilder> node_builder = construct_node_builder();
|
||||
std::unique_ptr<DepsgraphNodeBuilder> node_builder = construct_node_builder();
|
||||
node_builder->begin_build();
|
||||
build_nodes(*node_builder);
|
||||
node_builder->end_build();
|
||||
@@ -61,7 +61,7 @@ void AbstractBuilderPipeline::build_step_nodes()
|
||||
void AbstractBuilderPipeline::build_step_relations()
|
||||
{
|
||||
/* Hook up relationships between operations - to determine evaluation order. */
|
||||
unique_ptr<DepsgraphRelationBuilder> relation_builder = construct_relation_builder();
|
||||
std::unique_ptr<DepsgraphRelationBuilder> relation_builder = construct_relation_builder();
|
||||
relation_builder->begin_build();
|
||||
build_relations(*relation_builder);
|
||||
relation_builder->build_copy_on_write_relations();
|
||||
@@ -94,12 +94,12 @@ void AbstractBuilderPipeline::build_step_finalize()
|
||||
deg_graph_->need_update_relations = false;
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphNodeBuilder> AbstractBuilderPipeline::construct_node_builder()
|
||||
std::unique_ptr<DepsgraphNodeBuilder> AbstractBuilderPipeline::construct_node_builder()
|
||||
{
|
||||
return std::make_unique<DepsgraphNodeBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphRelationBuilder> AbstractBuilderPipeline::construct_relation_builder()
|
||||
std::unique_ptr<DepsgraphRelationBuilder> AbstractBuilderPipeline::construct_relation_builder()
|
||||
{
|
||||
return std::make_unique<DepsgraphRelationBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "deg_builder_cache.h"
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
|
||||
struct Depsgraph;
|
||||
struct Main;
|
||||
struct Scene;
|
||||
@@ -45,8 +43,8 @@ class AbstractBuilderPipeline {
|
||||
ViewLayer *view_layer_;
|
||||
DepsgraphBuilderCache builder_cache_;
|
||||
|
||||
virtual unique_ptr<DepsgraphNodeBuilder> construct_node_builder();
|
||||
virtual unique_ptr<DepsgraphRelationBuilder> construct_relation_builder();
|
||||
virtual std::unique_ptr<DepsgraphNodeBuilder> construct_node_builder();
|
||||
virtual std::unique_ptr<DepsgraphRelationBuilder> construct_relation_builder();
|
||||
|
||||
virtual void build_step_sanity_check();
|
||||
void build_step_nodes();
|
||||
|
||||
@@ -47,12 +47,12 @@ AllObjectsBuilderPipeline::AllObjectsBuilderPipeline(::Depsgraph *graph)
|
||||
{
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphNodeBuilder> AllObjectsBuilderPipeline::construct_node_builder()
|
||||
std::unique_ptr<DepsgraphNodeBuilder> AllObjectsBuilderPipeline::construct_node_builder()
|
||||
{
|
||||
return std::make_unique<AllObjectsNodeBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphRelationBuilder> AllObjectsBuilderPipeline::construct_relation_builder()
|
||||
std::unique_ptr<DepsgraphRelationBuilder> AllObjectsBuilderPipeline::construct_relation_builder()
|
||||
{
|
||||
return std::make_unique<AllObjectsRelationBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ class AllObjectsBuilderPipeline : public ViewLayerBuilderPipeline {
|
||||
AllObjectsBuilderPipeline(::Depsgraph *graph);
|
||||
|
||||
protected:
|
||||
unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
std::unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
std::unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
};
|
||||
|
||||
} // namespace blender::deg
|
||||
|
||||
@@ -34,12 +34,12 @@ CompositorBuilderPipeline::CompositorBuilderPipeline(::Depsgraph *graph, bNodeTr
|
||||
deg_graph_->is_render_pipeline_depsgraph = true;
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphNodeBuilder> CompositorBuilderPipeline::construct_node_builder()
|
||||
std::unique_ptr<DepsgraphNodeBuilder> CompositorBuilderPipeline::construct_node_builder()
|
||||
{
|
||||
return std::make_unique<CompositorDepsgraphNodeBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphRelationBuilder> CompositorBuilderPipeline::construct_relation_builder()
|
||||
std::unique_ptr<DepsgraphRelationBuilder> CompositorBuilderPipeline::construct_relation_builder()
|
||||
{
|
||||
return std::make_unique<CompositorDepsgraphRelationBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ class CompositorBuilderPipeline : public AbstractBuilderPipeline {
|
||||
CompositorBuilderPipeline(::Depsgraph *graph, bNodeTree *nodetree);
|
||||
|
||||
protected:
|
||||
unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
std::unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
std::unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
|
||||
void build_nodes(DepsgraphNodeBuilder &node_builder) override;
|
||||
void build_relations(DepsgraphRelationBuilder &relation_builder) override;
|
||||
|
||||
@@ -91,13 +91,14 @@ FromCollectionBuilderPipeline::FromCollectionBuilderPipeline(::Depsgraph *graph,
|
||||
}
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphNodeBuilder> FromCollectionBuilderPipeline::construct_node_builder()
|
||||
std::unique_ptr<DepsgraphNodeBuilder> FromCollectionBuilderPipeline::construct_node_builder()
|
||||
{
|
||||
return std::make_unique<DepsgraphFromCollectionIDsNodeBuilder>(
|
||||
bmain_, deg_graph_, &builder_cache_, ids_);
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphRelationBuilder> FromCollectionBuilderPipeline::construct_relation_builder()
|
||||
std::unique_ptr<DepsgraphRelationBuilder> FromCollectionBuilderPipeline::
|
||||
construct_relation_builder()
|
||||
{
|
||||
return std::make_unique<DepsgraphFromCollectionIDsRelationBuilder>(
|
||||
bmain_, deg_graph_, &builder_cache_, ids_);
|
||||
|
||||
@@ -29,8 +29,8 @@ class FromCollectionBuilderPipeline : public AbstractBuilderPipeline {
|
||||
FromCollectionBuilderPipeline(::Depsgraph *graph, Collection *collection);
|
||||
|
||||
protected:
|
||||
unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
std::unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
std::unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
|
||||
void build_nodes(DepsgraphNodeBuilder &node_builder) override;
|
||||
void build_relations(DepsgraphRelationBuilder &relation_builder) override;
|
||||
|
||||
@@ -81,12 +81,12 @@ FromIDsBuilderPipeline::FromIDsBuilderPipeline(::Depsgraph *graph, Span<ID *> id
|
||||
{
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphNodeBuilder> FromIDsBuilderPipeline::construct_node_builder()
|
||||
std::unique_ptr<DepsgraphNodeBuilder> FromIDsBuilderPipeline::construct_node_builder()
|
||||
{
|
||||
return std::make_unique<DepsgraphFromIDsNodeBuilder>(bmain_, deg_graph_, &builder_cache_, ids_);
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphRelationBuilder> FromIDsBuilderPipeline::construct_relation_builder()
|
||||
std::unique_ptr<DepsgraphRelationBuilder> FromIDsBuilderPipeline::construct_relation_builder()
|
||||
{
|
||||
return std::make_unique<DepsgraphFromIDsRelationBuilder>(
|
||||
bmain_, deg_graph_, &builder_cache_, ids_);
|
||||
|
||||
@@ -29,8 +29,8 @@ class FromIDsBuilderPipeline : public AbstractBuilderPipeline {
|
||||
FromIDsBuilderPipeline(::Depsgraph *graph, Span<ID *> ids);
|
||||
|
||||
protected:
|
||||
unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
std::unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
std::unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
|
||||
void build_nodes(DepsgraphNodeBuilder &node_builder) override;
|
||||
void build_relations(DepsgraphRelationBuilder &relation_builder) override;
|
||||
|
||||
@@ -33,12 +33,12 @@ RenderBuilderPipeline::RenderBuilderPipeline(::Depsgraph *graph) : AbstractBuild
|
||||
deg_graph_->is_render_pipeline_depsgraph = true;
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphNodeBuilder> RenderBuilderPipeline::construct_node_builder()
|
||||
std::unique_ptr<DepsgraphNodeBuilder> RenderBuilderPipeline::construct_node_builder()
|
||||
{
|
||||
return std::make_unique<RenderDepsgraphNodeBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
unique_ptr<DepsgraphRelationBuilder> RenderBuilderPipeline::construct_relation_builder()
|
||||
std::unique_ptr<DepsgraphRelationBuilder> RenderBuilderPipeline::construct_relation_builder()
|
||||
{
|
||||
return std::make_unique<RenderDepsgraphRelationBuilder>(bmain_, deg_graph_, &builder_cache_);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ class RenderBuilderPipeline : public AbstractBuilderPipeline {
|
||||
RenderBuilderPipeline(::Depsgraph *graph);
|
||||
|
||||
protected:
|
||||
unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
std::unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;
|
||||
std::unique_ptr<DepsgraphRelationBuilder> construct_relation_builder() override;
|
||||
|
||||
void build_nodes(DepsgraphNodeBuilder &node_builder) override;
|
||||
void build_relations(DepsgraphRelationBuilder &relation_builder) override;
|
||||
|
||||
@@ -57,7 +57,7 @@ bool terminal_do_color()
|
||||
return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
|
||||
}
|
||||
|
||||
string color_for_pointer(const void *pointer)
|
||||
std::string color_for_pointer(const void *pointer)
|
||||
{
|
||||
if (!terminal_do_color()) {
|
||||
return "";
|
||||
@@ -66,15 +66,15 @@ string color_for_pointer(const void *pointer)
|
||||
BLI_hash_pointer_to_color(pointer, &r, &g, &b);
|
||||
char buffer[64];
|
||||
SNPRINTF(buffer, TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
|
||||
return string(buffer);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
string color_end()
|
||||
std::string color_end()
|
||||
{
|
||||
if (!terminal_do_color()) {
|
||||
return "";
|
||||
}
|
||||
return string(TRUECOLOR_ANSI_COLOR_FINISH);
|
||||
return std::string(TRUECOLOR_ANSI_COLOR_FINISH);
|
||||
}
|
||||
|
||||
} // namespace blender::deg
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BKE_global.hh" // IWYU pragma: keep
|
||||
#include <string>
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "BKE_global.hh" // IWYU pragma: keep
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
@@ -28,7 +28,7 @@ class DepsgraphDebug {
|
||||
|
||||
/* Name of this dependency graph (is used for debug prints, helping to distinguish graphs
|
||||
* created for different view layer). */
|
||||
string name;
|
||||
std::string name;
|
||||
|
||||
protected:
|
||||
/* Maximum number of counters used to calculate frame rate of depsgraph update. */
|
||||
@@ -62,7 +62,7 @@ class DepsgraphDebug {
|
||||
} while (0)
|
||||
|
||||
bool terminal_do_color();
|
||||
string color_for_pointer(const void *pointer);
|
||||
string color_end();
|
||||
std::string color_for_pointer(const void *pointer);
|
||||
std::string color_end();
|
||||
|
||||
} // namespace blender::deg
|
||||
|
||||
@@ -328,7 +328,7 @@ static void deg_debug_graphviz_node_single(DotExportContext &ctx,
|
||||
const Node *node,
|
||||
dot::Cluster *parent_cluster)
|
||||
{
|
||||
string name = node->identifier();
|
||||
std::string name = node->identifier();
|
||||
|
||||
dot::Node &dot_node = ctx.digraph.new_node(name);
|
||||
ctx.nodes_map.add_new(node, &dot_node);
|
||||
@@ -347,7 +347,7 @@ static dot::Cluster °_debug_graphviz_node_cluster_create(DotExportContext &ct
|
||||
const Node *node,
|
||||
dot::Cluster *parent_cluster)
|
||||
{
|
||||
string name = node->identifier();
|
||||
std::string name = node->identifier();
|
||||
dot::Cluster &cluster = ctx.digraph.new_cluster(name);
|
||||
cluster.set_parent_cluster(parent_cluster);
|
||||
cluster.attributes.set("fontname", deg_debug_graphviz_fontname);
|
||||
|
||||
@@ -60,14 +60,14 @@ bool stat_entry_comparator(const StatsEntry &a, const StatsEntry &b)
|
||||
return a.time > b.time;
|
||||
}
|
||||
|
||||
string gnuplotify_id_code(const string &name)
|
||||
std::string gnuplotify_id_code(const std::string &name)
|
||||
{
|
||||
return string("") + name[0] + name[1];
|
||||
return std::string("") + name[0] + name[1];
|
||||
}
|
||||
|
||||
string gnuplotify_name(const string &name)
|
||||
std::string gnuplotify_name(const std::string &name)
|
||||
{
|
||||
string result;
|
||||
std::string result;
|
||||
const int length = name.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
const char ch = name[i];
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "intern/debug/deg_debug.h"
|
||||
#include "intern/depsgraph.hh"
|
||||
#include "intern/depsgraph_relation.hh"
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "intern/node/deg_node_component.hh"
|
||||
#include "intern/node/deg_node_id.hh"
|
||||
#include "intern/node/deg_node_time.hh"
|
||||
@@ -222,13 +221,13 @@ void DEG_stats_simple(const Depsgraph *graph,
|
||||
}
|
||||
}
|
||||
|
||||
static deg::string depsgraph_name_for_logging(Depsgraph *depsgraph)
|
||||
static std::string depsgraph_name_for_logging(Depsgraph *depsgraph)
|
||||
{
|
||||
const char *name = DEG_debug_name_get(depsgraph);
|
||||
if (name[0] == '\0') {
|
||||
return "";
|
||||
}
|
||||
return "[" + deg::string(name) + "]: ";
|
||||
return "[" + std::string(name) + "]: ";
|
||||
}
|
||||
|
||||
void DEG_debug_print_begin(Depsgraph *depsgraph)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* Implementation of Querying and Filtering API's
|
||||
*/
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
@@ -25,7 +27,7 @@ namespace deg = blender::deg;
|
||||
namespace blender::deg {
|
||||
namespace {
|
||||
|
||||
using TraversalQueue = deque<OperationNode *>;
|
||||
using TraversalQueue = std::deque<OperationNode *>;
|
||||
|
||||
using DEGForeachOperation = void (*)(OperationNode *, void *);
|
||||
|
||||
|
||||
@@ -399,13 +399,13 @@ void graph_id_tag_update_single_flag(Main *bmain,
|
||||
deg_graph_id_tag_legacy_compat(bmain, graph, id, tag, update_source);
|
||||
}
|
||||
|
||||
string stringify_append_bit(const string &str, IDRecalcFlag tag)
|
||||
std::string stringify_append_bit(const std::string &str, IDRecalcFlag tag)
|
||||
{
|
||||
const char *tag_name = DEG_update_tag_as_string(tag);
|
||||
if (tag_name == nullptr) {
|
||||
return str;
|
||||
}
|
||||
string result = str;
|
||||
std::string result = str;
|
||||
if (!result.empty()) {
|
||||
result += ", ";
|
||||
}
|
||||
@@ -413,12 +413,12 @@ string stringify_append_bit(const string &str, IDRecalcFlag tag)
|
||||
return result;
|
||||
}
|
||||
|
||||
string stringify_update_bitfield(uint flags)
|
||||
std::string stringify_update_bitfield(uint flags)
|
||||
{
|
||||
if (flags == 0) {
|
||||
return "LEGACY_0";
|
||||
}
|
||||
string result;
|
||||
std::string result;
|
||||
uint current_flag = flags;
|
||||
/* Special cases to avoid ALL flags form being split into
|
||||
* individual bits. */
|
||||
|
||||
@@ -14,38 +14,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <cstdint>
|
||||
|
||||
/* TODO(sergey): Ideally we'll just use char* and statically allocated strings
|
||||
* to avoid any possible overhead caused by string (re)allocation/formatting. */
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
struct Depsgraph;
|
||||
struct CustomData_MeshMasks;
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
/* Commonly used types. */
|
||||
using std::deque;
|
||||
using std::optional;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
using std::unique_ptr;
|
||||
|
||||
/* Commonly used functions. */
|
||||
using std::make_pair;
|
||||
using std::max;
|
||||
using std::to_string;
|
||||
|
||||
/* Function bindings. */
|
||||
using std::function;
|
||||
using namespace std::placeholders;
|
||||
#define function_bind std::bind
|
||||
|
||||
/* Source of the dependency graph node update tag.
|
||||
*
|
||||
* NOTE: This is a bit mask, so accumulation of sources is possible.
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "intern/eval/deg_eval_flush.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_task.h"
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -27,7 +29,6 @@
|
||||
#include "intern/debug/deg_debug.h"
|
||||
#include "intern/depsgraph.hh"
|
||||
#include "intern/depsgraph_relation.hh"
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "intern/depsgraph_update.hh"
|
||||
#include "intern/node/deg_node.hh"
|
||||
#include "intern/node/deg_node_component.hh"
|
||||
@@ -62,7 +63,7 @@ enum {
|
||||
COMPONENT_STATE_DONE = 2,
|
||||
};
|
||||
|
||||
using FlushQueue = deque<OperationNode *>;
|
||||
using FlushQueue = std::deque<OperationNode *>;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
AnimationValueBackup::AnimationValueBackup(const string &rna_path, int array_index, float value)
|
||||
AnimationValueBackup::AnimationValueBackup(const std::string &rna_path,
|
||||
int array_index,
|
||||
float value)
|
||||
: rna_path(rna_path), array_index(array_index), value(value)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include <string>
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
struct ID;
|
||||
|
||||
namespace blender::deg {
|
||||
|
||||
@@ -21,7 +21,7 @@ struct Depsgraph;
|
||||
class AnimationValueBackup {
|
||||
public:
|
||||
AnimationValueBackup() = default;
|
||||
AnimationValueBackup(const string &rna_path, int array_index, float value);
|
||||
AnimationValueBackup(const std::string &rna_path, int array_index, float value);
|
||||
|
||||
AnimationValueBackup(const AnimationValueBackup &other) = default;
|
||||
AnimationValueBackup(AnimationValueBackup &&other) noexcept = default;
|
||||
@@ -29,7 +29,7 @@ class AnimationValueBackup {
|
||||
AnimationValueBackup &operator=(const AnimationValueBackup &other) = default;
|
||||
AnimationValueBackup &operator=(AnimationValueBackup &&other) = default;
|
||||
|
||||
string rna_path;
|
||||
std::string rna_path;
|
||||
int array_index;
|
||||
float value;
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ void ObjectRuntimeBackup::restore_to_object(Object *object)
|
||||
void ObjectRuntimeBackup::restore_modifier_runtime_data(Object *object)
|
||||
{
|
||||
LISTBASE_FOREACH (ModifierData *, modifier_data, &object->modifiers) {
|
||||
optional<ModifierDataBackup> backup = modifier_runtime_data.pop_try(
|
||||
std::optional<ModifierDataBackup> backup = modifier_runtime_data.pop_try(
|
||||
modifier_data->persistent_uid);
|
||||
if (backup.has_value()) {
|
||||
modifier_data->runtime = backup->runtime;
|
||||
@@ -177,7 +177,7 @@ void ObjectRuntimeBackup::restore_pose_channel_runtime_data(Object *object)
|
||||
if (object->pose != nullptr) {
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
|
||||
const SessionUID &session_uid = pchan->runtime.session_uid;
|
||||
optional<bPoseChannel_Runtime> runtime = pose_channel_runtime_data.pop_try(session_uid);
|
||||
std::optional<bPoseChannel_Runtime> runtime = pose_channel_runtime_data.pop_try(session_uid);
|
||||
if (runtime.has_value()) {
|
||||
pchan->runtime = *runtime;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_session_uid_types.h"
|
||||
|
||||
@@ -15,7 +17,6 @@
|
||||
|
||||
#include "BLI_map.hh"
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
#include "intern/eval/deg_eval_runtime_backup_modifier.h"
|
||||
|
||||
struct Object;
|
||||
@@ -42,7 +43,7 @@ class ObjectRuntimeBackup {
|
||||
void restore_pose_channel_runtime_data(Object *object);
|
||||
|
||||
bke::ObjectRuntime runtime;
|
||||
optional<LightLinkingRuntime> light_linking_runtime;
|
||||
std::optional<LightLinkingRuntime> light_linking_runtime;
|
||||
short base_flag;
|
||||
unsigned short base_local_view_bits;
|
||||
Map<int, ModifierDataBackup> modifier_runtime_data;
|
||||
|
||||
@@ -296,9 +296,9 @@ Node::~Node()
|
||||
}
|
||||
}
|
||||
|
||||
string Node::identifier() const
|
||||
std::string Node::identifier() const
|
||||
{
|
||||
return string(nodeTypeAsString(type)) + " : " + name;
|
||||
return std::string(nodeTypeAsString(type)) + " : " + name;
|
||||
}
|
||||
|
||||
NodeClass Node::get_class() const
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
@@ -175,7 +177,7 @@ struct Node {
|
||||
* have relationships between these nodes. */
|
||||
using Relations = Vector<Relation *>;
|
||||
|
||||
string name; /* Identifier - mainly for debugging purposes. */
|
||||
std::string name; /* Identifier - mainly for debugging purposes. */
|
||||
NodeType type; /* Structural type of node. */
|
||||
Relations inlinks; /* Nodes which this one depends on. */
|
||||
Relations outlinks; /* Nodes which depend on this one. */
|
||||
@@ -192,7 +194,7 @@ struct Node {
|
||||
virtual ~Node();
|
||||
|
||||
/** Generic identifier for Depsgraph Nodes. */
|
||||
virtual string identifier() const;
|
||||
virtual std::string identifier() const;
|
||||
|
||||
virtual void init(const ID * /*id*/, const char * /*subdata*/) {}
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode, const char *
|
||||
{
|
||||
}
|
||||
|
||||
string ComponentNode::OperationIDKey::identifier() const
|
||||
std::string ComponentNode::OperationIDKey::identifier() const
|
||||
{
|
||||
const string codebuf = to_string(int(opcode));
|
||||
const std::string codebuf = std::to_string(int(opcode));
|
||||
return "OperationIDKey(" + codebuf + ", " + name + ")";
|
||||
}
|
||||
|
||||
@@ -88,10 +88,10 @@ ComponentNode::~ComponentNode()
|
||||
delete operations_map;
|
||||
}
|
||||
|
||||
string ComponentNode::identifier() const
|
||||
std::string ComponentNode::identifier() const
|
||||
{
|
||||
const string type_name = type_get_factory(type)->type_name();
|
||||
const string name_part = name[0] ? (string(" '") + name + "'") : "";
|
||||
const std::string type_name = type_get_factory(type)->type_name();
|
||||
const std::string name_part = name[0] ? (std::string(" '") + name + "'") : "";
|
||||
|
||||
return "[" + type_name + "]" + name_part + " : " +
|
||||
"(affects_visible_id: " + (affects_visible_id ? "true" : "false") + ")";
|
||||
|
||||
@@ -37,7 +37,7 @@ struct ComponentNode : public Node {
|
||||
OperationIDKey(OperationCode opcode);
|
||||
OperationIDKey(OperationCode opcode, const char *name, int name_tag);
|
||||
|
||||
string identifier() const;
|
||||
std::string identifier() const;
|
||||
bool operator==(const OperationIDKey &other) const;
|
||||
uint64_t hash() const;
|
||||
};
|
||||
@@ -49,7 +49,7 @@ struct ComponentNode : public Node {
|
||||
/** Initialize 'component' node - from pointer data given. */
|
||||
void init(const ID *id, const char *subdata) override;
|
||||
|
||||
string identifier() const override;
|
||||
std::string identifier() const override;
|
||||
|
||||
/* Find an existing operation, if requested operation does not exist nullptr will be returned.
|
||||
* See #add_operation for the meaning and examples of #name and #name_tag.
|
||||
|
||||
@@ -129,12 +129,12 @@ void IDNode::destroy()
|
||||
id_orig = nullptr;
|
||||
}
|
||||
|
||||
string IDNode::identifier() const
|
||||
std::string IDNode::identifier() const
|
||||
{
|
||||
char orig_ptr[24], cow_ptr[24];
|
||||
SNPRINTF(orig_ptr, "%p", id_orig);
|
||||
SNPRINTF(cow_ptr, "%p", id_cow);
|
||||
return string(nodeTypeAsString(type)) + " : " + name + " (orig: " + orig_ptr +
|
||||
return std::string(nodeTypeAsString(type)) + " : " + name + " (orig: " + orig_ptr +
|
||||
", eval: " + cow_ptr + ", is_visible_on_build " +
|
||||
(is_visible_on_build ? "true" : "false") + ")";
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ struct IDNode : public Node {
|
||||
~IDNode() override;
|
||||
void destroy();
|
||||
|
||||
string identifier() const override;
|
||||
std::string identifier() const override;
|
||||
|
||||
ComponentNode *find_component(NodeType type, const char *name = "") const;
|
||||
ComponentNode *add_component(NodeType type, const char *name = "");
|
||||
|
||||
@@ -209,14 +209,14 @@ const char *operationCodeAsString(OperationCode opcode)
|
||||
|
||||
OperationNode::OperationNode() : name_tag(-1), flag(0) {}
|
||||
|
||||
string OperationNode::identifier() const
|
||||
std::string OperationNode::identifier() const
|
||||
{
|
||||
return string(operationCodeAsString(opcode)) + "(" + name + ")";
|
||||
return std::string(operationCodeAsString(opcode)) + "(" + name + ")";
|
||||
}
|
||||
|
||||
string OperationNode::full_identifier() const
|
||||
std::string OperationNode::full_identifier() const
|
||||
{
|
||||
string owner_str = owner->owner->name;
|
||||
std::string owner_str = owner->owner->name;
|
||||
if (owner->type == NodeType::BONE || !owner->name.empty()) {
|
||||
owner_str += "/" + owner->name;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "intern/node/deg_node.hh"
|
||||
|
||||
#include "intern/depsgraph_type.hh"
|
||||
@@ -20,7 +23,7 @@ struct ComponentNode;
|
||||
|
||||
/* Evaluation Operation for atomic operation */
|
||||
/* XXX: move this to another header that can be exposed? */
|
||||
using DepsEvalOperationCb = function<void(::Depsgraph *)>;
|
||||
using DepsEvalOperationCb = std::function<void(::Depsgraph *)>;
|
||||
|
||||
/* Identifiers for common operations (as an enum). */
|
||||
enum class OperationCode {
|
||||
@@ -245,12 +248,12 @@ enum OperationFlag {
|
||||
struct OperationNode : public Node {
|
||||
OperationNode();
|
||||
|
||||
string identifier() const override;
|
||||
std::string identifier() const override;
|
||||
/**
|
||||
* Full node identifier, including owner name.
|
||||
* used for logging and debug prints.
|
||||
*/
|
||||
string full_identifier() const;
|
||||
std::string full_identifier() const;
|
||||
|
||||
void tag_update(Depsgraph *graph, eUpdateSource source) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user