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:
Diffstat (limited to 'intern/cycles/graph/node_type.cpp')
-rw-r--r--intern/cycles/graph/node_type.cpp38
1 files changed, 33 insertions, 5 deletions
diff --git a/intern/cycles/graph/node_type.cpp b/intern/cycles/graph/node_type.cpp
index dc879655d7f..7f68ae9c7c7 100644
--- a/intern/cycles/graph/node_type.cpp
+++ b/intern/cycles/graph/node_type.cpp
@@ -114,9 +114,15 @@ ustring SocketType::type_name(Type type)
return names[(int)type];
}
+bool SocketType::is_float3(Type type)
+{
+ return (type == COLOR || type == VECTOR || type == POINT || type == NORMAL);
+}
+
/* Node Type */
-NodeType::NodeType()
+NodeType::NodeType(Type type_)
+: type(type_)
{
}
@@ -137,7 +143,7 @@ void NodeType::register_input(ustring name, ustring ui_name, SocketType::Type ty
socket.enum_values = enum_values;
socket.node_type = node_type;
socket.flags = flags | extra_flags;
- inputs[name] = socket;
+ inputs.push_back(socket);
}
void NodeType::register_output(ustring name, ustring ui_name, SocketType::Type type)
@@ -151,7 +157,29 @@ void NodeType::register_output(ustring name, ustring ui_name, SocketType::Type t
socket.enum_values = NULL;
socket.node_type = NULL;
socket.flags = SocketType::LINKABLE;
- outputs[name] = socket;
+ outputs.push_back(socket);
+}
+
+const SocketType *NodeType::find_input(ustring name) const
+{
+ foreach(const SocketType& socket, inputs) {
+ if(socket.name == name) {
+ return &socket;
+ }
+ }
+
+ return NULL;
+}
+
+const SocketType *NodeType::find_output(ustring name) const
+{
+ foreach(const SocketType& socket, outputs) {
+ if(socket.name == name) {
+ return &socket;
+ }
+ }
+
+ return NULL;
}
/* Node Type Registry */
@@ -162,7 +190,7 @@ unordered_map<ustring, NodeType, ustringHash>& NodeType::types()
return _types;
}
-NodeType *NodeType::add(const char *name_, CreateFunc create_)
+NodeType *NodeType::add(const char *name_, CreateFunc create_, Type type_)
{
ustring name(name_);
@@ -172,7 +200,7 @@ NodeType *NodeType::add(const char *name_, CreateFunc create_)
return NULL;
}
- types()[name] = NodeType();
+ types()[name] = NodeType(type_);
NodeType *type = &types()[name];
type->name = name;