From b75142850dcb3626bb0206629becd87610d2ffcf Mon Sep 17 00:00:00 2001 From: Adrian Popescu Date: Tue, 31 Jan 2023 12:00:33 -0500 Subject: [PATCH] Build graph fix (#8311) - Fixed Constraints' value not being updated --- src/App/PropertyExpressionEngine.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/App/PropertyExpressionEngine.cpp b/src/App/PropertyExpressionEngine.cpp index 6990f4234c5d..df9163262b1c 100644 --- a/src/App/PropertyExpressionEngine.cpp +++ b/src/App/PropertyExpressionEngine.cpp @@ -316,8 +316,8 @@ void PropertyExpressionEngine::Restore(Base::XMLReader &reader) * @brief Update graph structure with given path and expression. * @param path Path * @param expression Expression to query for dependencies - * @param nodes Map with nodes of graph - * @param revNodes Reverse map of nodes + * @param nodes Map with nodes of graph, including dependencies of 'expression' + * @param revNodes Reverse map of the nodes, containing only the given paths, without dependencies. * @param edges Edges in graph */ @@ -518,8 +518,8 @@ struct cycle_detector : public boost::dfs_visitor<> { /** * @brief Build a graph of all expressions in \a exprs. * @param exprs Expressions to use in graph - * @param revNodes Map from int to ObjectIndentifer - * @param g Graph to update + * @param revNodes Map from int[nodeid] to ObjectIndentifer. + * @param g Graph to update. May contain additional nodes than in revNodes, because of outside dependencies. */ void PropertyExpressionEngine::buildGraph(const ExpressionMap & exprs, @@ -548,7 +548,7 @@ void PropertyExpressionEngine::buildGraph(const ExpressionMap & exprs, } // Create graph - g = DiGraph(revNodes.size()); + g = DiGraph(nodes.size()); // Add edges to graph for (std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) @@ -586,6 +586,8 @@ std::vector PropertyExpressionEngine::computeEvaluationOr topological_sort(g, std::back_inserter(c)); for (std::vector::iterator i = c.begin(); i != c.end(); ++i) { + // we return the evaluation order for our properties, not the dependencies + // the topo sort will contain node ids for both our props and their deps if (revNodes.find(*i) != revNodes.end()) evaluationOrder.push_back(revNodes[*i]); }