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 Toenne <lukas.toenne@googlemail.com>2013-03-18 20:34:57 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-03-18 20:34:57 +0400
commit4638e5f99a9ba59ad0b8a1fd52b12e876480b9e8 (patch)
tree2444f12b4612440f44cf02835cdf5951b6564e92 /source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
parent7bfef29f2f2a1b262d28abdc6e30fcd9c1f1caad (diff)
Merge of the PyNodes branch (aka "custom nodes") into trunk.
PyNodes opens up the node system in Blender to scripters and adds a number of UI-level improvements. === Dynamic node type registration === Node types can now be added at runtime, using the RNA registration mechanism from python. This enables addons such as render engines to create a complete user interface with nodes. Examples of how such nodes can be defined can be found in my personal wiki docs atm [1] and as a script template in release/scripts/templates_py/custom_nodes.py [2]. === Node group improvements === Each node editor now has a tree history of edited node groups, which allows opening and editing nested node groups. The node editor also supports pinning now, so that different spaces can be used to edit different node groups simultaneously. For more ramblings and rationale see (really old) blog post on code.blender.org [3]. The interface of node groups has been overhauled. Sockets of a node group are no longer displayed in columns on either side, but instead special input/output nodes are used to mirror group sockets inside a node tree. This solves the problem of long node lines in groups and allows more adaptable node layout. Internal sockets can be exposed from a group by either connecting to the extension sockets in input/output nodes (shown as empty circle) or by adding sockets from the node property bar in the "Interface" panel. Further details such as the socket name can also be changed there. [1] http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes [2] http://projects.blender.org/scm/viewvc.php/trunk/blender/release/scripts/templates_py/custom_nodes.py?view=markup&root=bf-blender [3] http://code.blender.org/index.php/2012/01/improving-node-group-interface-editing/
Diffstat (limited to 'source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp')
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp66
1 files changed, 26 insertions, 40 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
index 506bd42ace3..ad396e053f2 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
@@ -26,7 +26,6 @@
#include <stdio.h>
#include "PIL_time.h"
-#include "BKE_node.h"
#include "COM_Converter.h"
#include "COM_NodeOperation.h"
@@ -39,18 +38,25 @@
#include "COM_ReadBufferOperation.h"
#include "COM_ViewerBaseOperation.h"
-void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
+extern "C" {
+#include "BKE_node.h"
+}
+
+void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key)
{
vector<Node *>& nodes = system.getNodes();
vector<SocketConnection *>& links = system.getConnections();
- const bNode *activeGroupNode = system.getContext().getActivegNode();
- bool isActiveGroup = activeGroupNode == groupnode;
/* add all nodes of the tree to the node list */
bNode *node = (bNode *)tree->nodes.first;
while (node != NULL) {
+ /* XXX TODO replace isActiveGroup by a more accurate check, all visible editors should do this! */
+ bool isActiveGroup = true;
Node *nnode = addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation());
- nnode->setbNodeGroup(groupnode);
+ if (nnode) {
+ nnode->setbNodeTree(tree);
+ nnode->setInstanceKey(BKE_node_instance_key(parent_key, tree, node));
+ }
node = node->next;
}
@@ -81,8 +87,10 @@ void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup, bool fast)
{
Node *node = Converter::convert(b_node, fast);
- node->setIsInActiveGroup(inActiveGroup);
- addNode(nodes, node);
+ if (node) {
+ node->setIsInActiveGroup(inActiveGroup);
+ addNode(nodes, node);
+ }
return node;
}
void ExecutionSystemHelper::addOperation(vector<NodeOperation *>& operations, NodeOperation *operation)
@@ -109,43 +117,21 @@ void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation *> *re
static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
{
- if (bnode != NULL) {
- for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- if (node->getbNode() == bnode)
- return node->findInputSocketBybNodeSocket(bsocket);
- }
- }
- else {
- for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- if (node->isProxyNode()) {
- InputSocket *proxySocket = node->getInputSocket(0);
- if (proxySocket->getbNodeSocket() == bsocket)
- return proxySocket;
- }
- }
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
+ Node *node = *it;
+ InputSocket *input = node->findInputSocketBybNodeSocket(bsocket);
+ if (input)
+ return input;
}
return NULL;
}
static OutputSocket *find_output(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
{
- if (bnode != NULL) {
- for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- if (node->getbNode() == bnode)
- return node->findOutputSocketBybNodeSocket(bsocket);
- }
- }
- else {
- for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
- Node *node = *it;
- if (node->isProxyNode()) {
- OutputSocket *proxySocket = node->getOutputSocket(0);
- if (proxySocket->getbNodeSocket() == bsocket)
- return proxySocket;
- }
- }
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
+ Node *node = *it;
+ OutputSocket *output = node->findOutputSocketBybNodeSocket(bsocket);
+ if (output)
+ return output;
}
return NULL;
}
@@ -190,7 +176,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
tot = system->getNodes().size();
for (int i = 0; i < tot; i++) {
node = system->getNodes()[i];
- printf("// NODE: %s\r\n", node->getbNode()->typeinfo->name);
+ printf("// NODE: %s\r\n", node->getbNode()->typeinfo->ui_name);
}
tot = system->getOperations().size();
for (int i = 0; i < tot; i++) {