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:
authorKevin Dietrich <kevin.dietrich@mailoo.org>2014-04-02 13:40:29 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-04-02 13:53:44 +0400
commitcb7cfd3ab6be1cfba96cb2070ac60d224126f1ea (patch)
treeec8de38de655c8fe74835eabc7f9c68e20df322a /intern/cycles/render
parent288147334ce81cf0be533c15f3698b88ef7c63f3 (diff)
Cycles: add dedicated UV Map node, easier to find and has convenient auto complete.
Fixes T37954. Reviewed By: brecht, dingto Differential Revision: https://developer.blender.org/D230
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/nodes.cpp56
-rw-r--r--intern/cycles/render/nodes.h9
2 files changed, 65 insertions, 0 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index f10b956a482..908acb3e6aa 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2328,6 +2328,62 @@ void TextureCoordinateNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_texture_coordinate");
}
+UVMapNode::UVMapNode()
+: ShaderNode("uvmap")
+{
+ attribute = "";
+ from_dupli = false;
+
+ add_output("UV", SHADER_SOCKET_POINT);
+}
+
+void UVMapNode::attributes(Shader *shader, AttributeRequestSet *attributes)
+{
+ if(shader->has_surface) {
+ if(!from_dupli) {
+ if(!output("UV")->links.empty()) {
+ if (attribute != "")
+ attributes->add(attribute);
+ else
+ attributes->add(ATTR_STD_UV);
+ }
+ }
+ }
+
+ ShaderNode::attributes(shader, attributes);
+}
+
+void UVMapNode::compile(SVMCompiler& compiler)
+{
+ ShaderOutput *out = output("UV");
+ NodeType texco_node = NODE_TEX_COORD;
+ NodeType attr_node = NODE_ATTR;
+ int attr;
+
+ if(!out->links.empty()) {
+ if(from_dupli) {
+ compiler.stack_assign(out);
+ compiler.add_node(texco_node, NODE_TEXCO_DUPLI_UV, out->stack_offset);
+ }
+ else {
+ if (attribute != "")
+ attr = compiler.attribute(attribute);
+ else
+ attr = compiler.attribute(ATTR_STD_UV);
+
+ compiler.stack_assign(out);
+ compiler.add_node(attr_node, attr, out->stack_offset, NODE_ATTR_FLOAT3);
+ }
+ }
+}
+
+void UVMapNode::compile(OSLCompiler& compiler)
+{
+ compiler.parameter("from_dupli", from_dupli);
+ compiler.parameter("name", attribute.c_str());
+ compiler.add(this, "node_uv_map");
+}
+
/* Light Path */
LightPathNode::LightPathNode()
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 497a367a2a6..31caf9507eb 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -350,6 +350,15 @@ public:
bool from_dupli;
};
+class UVMapNode : public ShaderNode {
+public:
+ SHADER_NODE_CLASS(UVMapNode)
+ void attributes(Shader *shader, AttributeRequestSet *attributes);
+
+ ustring attribute;
+ bool from_dupli;
+};
+
class LightPathNode : public ShaderNode {
public:
SHADER_NODE_CLASS(LightPathNode)