Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-04-15 18:06:12 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-04-15 18:28:10 +0400
commit09874df135888b89f51d7becaa369ebb1d1623c6 (patch)
treebccf5950d42963992adff95dbc3f00ed7db1cf16 /source/blender/compositor/intern/COM_ExecutionSystemHelper.h
parent28a829893c702918afc5ac1945a06eaefa611594 (diff)
Structural cleanup and improvements for the compositor.
Many parts of the compositor are unnecessarily complicated. This patch aims at reducing the complexity of writing nodes and making the code more transparent. == Separating Nodes and Operations == Currently these are both mixed in the same graph, even though they have very different purposes and are used at distinct stages in the compositing process. The patch introduces dedicated graph classes for nodes and for operations. This removes the need for a lot of special case checks (isOperation etc.) and explicit type casts. It simplifies the code since it becomes clear at every stage what type of node we are dealing with. The compiler can use static typing to avoid common bugs from mixing up these types and fewer runtime sanity checks are needed. == Simplified Node Conversion == Converting nodes to operations was previously based on "relinking", i.e. nodes would start with by mirroring links in the Blender DNA node trees, then add operations and redirect these links to them. This was very hard to follow in many cases and required a lot of attention to avoid invalid states. Now there is a helper class called the NodeConverter, which is passed to nodes and implements a much simpler API for this process. Nodes can add operations and explicit connections as before, but defining "external" links to the inputs/outputs of the original node now uses mapping instead of directly modifying link data. Input data (node graph) and result (operations graph) are cleanly separated. == Removed Redundant Data Structures == A few redundant data structures have been removed, notably the SocketConnection. These are only needed temporarily during graph construction. For executing the compositor operations it is perfectly sufficient to store only the direct input link pointers. A common pointer indirection is avoided this way (which might also give a little performance improvement). == Avoid virtual recursive functions == Recursive virtual functions are evil. They are very hard to follow during debugging. At least in the parts this patch is concerned with these functions have been replaced by a non-virtual recursive core function (which might then call virtual non-recursive functions if needed). See for example NodeOperationBuilder::group_operations.
Diffstat (limited to 'source/blender/compositor/intern/COM_ExecutionSystemHelper.h')
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.h126
1 files changed, 0 insertions, 126 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h b/source/blender/compositor/intern/COM_ExecutionSystemHelper.h
deleted file mode 100644
index ae9e75e0408..00000000000
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- */
-
-class ExecutionGroup;
-
-#ifndef _COM_ExecutionSystemHelper_h
-#define _COM_ExecutionSystemHelper_h
-
-#include "DNA_node_types.h"
-#include <vector>
-#include "COM_Node.h"
-#include "COM_SocketConnection.h"
-#include "BKE_text.h"
-#include "COM_ExecutionGroup.h"
-
-using namespace std;
-
-/**
- *
- */
-class ExecutionSystemHelper {
-
-public:
-
- /**
- * @brief add an bNodeTree to the nodes list and connections
- * @param system Execution system
- * @param nodes_start Starting index in the system's nodes list for nodes in this tree.
- * @param tree bNodeTree to add
- * @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
- */
- static void addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key);
-
- /**
- * @brief add an editor node to the system.
- * this node is converted to a Node instance.
- * and the converted node is returned
- *
- * @param b_node node to add
- * @return Node that represents the bNode or null when not able to convert.
- */
- static Node *addNode(vector<Node *>& nodes, bNode *b_node, bool isInActiveGroup, bool fast);
-
- /**
- * @brief Add a Node to a list
- *
- * @param nodes the list where the node needs to be added to
- * @param node the node to be added
- */
- static void addNode(vector<Node *>& nodes, Node *node);
-
- /**
- * @brief Add an operation to the operation list
- *
- * The id of the operation is updated.
- *
- * @param operations the list where the operation need to be added to
- * @param operation the operation to add
- */
- static void addOperation(vector<NodeOperation *> &operations, NodeOperation *operation);
-
- /**
- * @brief Add an ExecutionGroup to a list
- *
- * The id of the ExecutionGroup is updated.
- *
- * @param executionGroups the list where the executionGroup need to be added to
- * @param executionGroup the ExecutionGroup to add
- */
- static void addExecutionGroup(vector<ExecutionGroup *>& executionGroups, ExecutionGroup *executionGroup);
-
- /**
- * Find all Node Operations that needs to be executed.
- * @param rendering
- * the rendering parameter will tell what type of execution we are doing
- * false is editing, true is rendering
- */
- static void findOutputNodeOperations(vector<NodeOperation *> *result, vector<NodeOperation *>& operations, bool rendering);
-
- /**
- * @brief add a bNodeLink to the list of links
- * the bNodeLink will be wrapped in a SocketConnection
- *
- * @note Cyclic links will be ignored
- *
- * @param node_range list of possible nodes for lookup.
- * @param links list of links to add the bNodeLink to
- * @param bNodeLink the link to be added
- * @return the created SocketConnection or NULL
- */
- static SocketConnection *addNodeLink(NodeRange &node_range, vector<SocketConnection *>& links, bNodeLink *bNodeLink);
-
- /**
- * @brief create a new SocketConnection and add to a vector of links
- * @param links the vector of links
- * @param fromSocket the startpoint of the connection
- * @param toSocket the endpoint of the connection
- * @return the new created SocketConnection
- */
- static SocketConnection *addLink(vector<SocketConnection *>& links, OutputSocket *fromSocket, InputSocket *toSocket);
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionSystemHelper")
-#endif
-};
-
-#endif /* _COM_ExecutionSystemHelper_h */