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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-29 12:20:10 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-29 21:30:16 +0300
commiteac7ed8d047457564033f1547fea9a912ff0d9b7 (patch)
treebd9673d71e1d597bd84af276507d535420b69d1a /intern/cycles/graph/node_type.h
parent7cd18dda7d5d952829e6024ee9798ce77a1dede0 (diff)
Code refactor: minor node and node type utility functions and changes.
Diffstat (limited to 'intern/cycles/graph/node_type.h')
-rw-r--r--intern/cycles/graph/node_type.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h
index 82ddd29da33..20816f634cd 100644
--- a/intern/cycles/graph/node_type.h
+++ b/intern/cycles/graph/node_type.h
@@ -21,6 +21,7 @@
#include "util_map.h"
#include "util_param.h"
#include "util_string.h"
+#include "util_vector.h"
CCL_NAMESPACE_BEGIN
@@ -94,13 +95,19 @@ struct SocketType
static size_t max_size();
static ustring type_name(Type type);
static void *zero_default_value();
+ static bool is_float3(Type type);
};
/* Node Type */
struct NodeType
{
- explicit NodeType();
+ enum Type {
+ NONE,
+ SHADER
+ };
+
+ explicit NodeType(Type type = NONE);
~NodeType();
void register_input(ustring name, ustring ui_name, SocketType::Type type,
@@ -110,15 +117,18 @@ struct NodeType
int flags = 0, int extra_flags = 0);
void register_output(ustring name, ustring ui_name, SocketType::Type type);
+ const SocketType *find_input(ustring name) const;
+ const SocketType *find_output(ustring name) const;
+
typedef Node *(*CreateFunc)(const NodeType *type);
- typedef unordered_map<ustring, SocketType, ustringHash> SocketMap;
ustring name;
- SocketMap inputs;
- SocketMap outputs;
+ Type type;
+ std::vector<SocketType> inputs;
+ std::vector<SocketType> outputs;
CreateFunc create;
- static NodeType *add(const char *name, CreateFunc create);
+ static NodeType *add(const char *name, CreateFunc create, Type type = NONE);
static const NodeType *find(ustring name);
static unordered_map<ustring, NodeType, ustringHash>& types();
};