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

COM_Node.h « intern « compositor « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2666d0a698058a9d21b3de40402b17d1c4aaa691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * 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
 */

#ifndef _COM_Node_h
#define _COM_Node_h

#include "COM_NodeBase.h"
#include "COM_InputSocket.h"
#include "COM_OutputSocket.h"
#include "COM_CompositorContext.h"
#include "DNA_node_types.h"
#include "BKE_text.h"
#include <vector>
#include <string>

using namespace std;

class Node;
class NodeOperation;
class ExecutionSystem;

typedef vector<Node*> NodeList;
typedef NodeList::iterator NodeIterator;
typedef pair<NodeIterator, NodeIterator> NodeRange;

/**
  * My node documentation.
  */
class Node:public NodeBase {
private:
	/**
	  * @brief stores the reference to the SDNA bNode struct
	  */
	bNode *editorNode;

public:
	Node(bNode *editorNode, bool create_sockets=true);
	
	/**
	  * @brief get the reference to the SDNA bNode struct
	  */
	bNode *getbNode();
	
	/**
	  * @brief convert node to operation
	  *
	  * @todo this must be described furter
	  *
	  * @param system the ExecutionSystem where the operations need to be added
	  * @param context reference to the CompositorContext
	  */
	virtual void convertToOperations(ExecutionSystem *system, CompositorContext * context) =0;
	
	/**
	  * this method adds a SetValueOperation as input of the input socket.
	  * This can only be used from the convertToOperation method. all other usages are not allowed
	  */
	void addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
	
	/**
	  * this method adds a SetColorOperation as input of the input socket.
	  * This can only be used from the convertToOperation method. all other usages are not allowed
	  */
	void addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
	
	/**
	  * this method adds a SetVectorOperation as input of the input socket.
	  * This can only be used from the convertToOperation method. all other usages are not allowed
	  */
	void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
	
	/**
	  * Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
	  * @return the new created link
	  */
	SocketConnection *addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket);
	
	/**
	  * is this node a group node.
	  */
	virtual bool isGroupNode() const { return false; }
	/**
	  * is this node a proxy node.
	  */
	virtual bool isProxyNode() const { return false; }
	
	/**
	  * @brief find the InputSocket by bNodeSocket
	  *
	  * @param socket
	  */
	InputSocket *findInputSocketBybNodeSocket(bNodeSocket *socket);
	
	/**
	  * @brief find the OutputSocket by bNodeSocket
	  *
	  * @param socket
	  */
	OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket);
protected:
	
	Node();
	
	void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority);
	void addPreviewOperation(ExecutionSystem *system, OutputSocket *inputSocket, int priority);
	
	bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
	bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
private:
};

#endif