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
path: root/intern
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2021-08-18 00:47:05 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2021-08-18 00:47:05 +0300
commitaf0e775c525c638a5a40e7767ee74cf5a305c044 (patch)
tree0b9860c1840d03da1c45e4ba3b99eef0f9e66600 /intern
parent96f5f20d53e4234b89d471a64f52002c838d85fa (diff)
parent23132fcdc136d1238d9980c2a9bf6d058e846cc7 (diff)
Merge branch 'master' into cycles_procedural_api
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_particles.cpp2
-rw-r--r--intern/cycles/render/graph.cpp4
-rw-r--r--intern/cycles/render/nodes.cpp20
-rw-r--r--intern/cycles/render/shader.h8
4 files changed, 21 insertions, 13 deletions
diff --git a/intern/cycles/blender/blender_particles.cpp b/intern/cycles/blender/blender_particles.cpp
index ae43dae4dc1..206ee24a093 100644
--- a/intern/cycles/blender/blender_particles.cpp
+++ b/intern/cycles/blender/blender_particles.cpp
@@ -71,7 +71,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
Particle pa;
pa.index = persistent_id[0];
- pa.age = b_scene.frame_current() - b_pa.birth_time();
+ pa.age = b_scene.frame_current_final() - b_pa.birth_time();
pa.lifetime = b_pa.lifetime();
pa.location = get_float3(b_pa.location());
pa.rotation = get_float4(b_pa.rotation());
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index cdaa878e830..e9da48b624d 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -158,13 +158,13 @@ void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes)
foreach (ShaderInput *input, inputs) {
if (!input->link) {
if (input->flags() & SocketType::LINK_TEXTURE_GENERATED) {
- if (shader->has_surface)
+ if (shader->has_surface_link())
attributes->add(ATTR_STD_GENERATED);
if (shader->has_volume)
attributes->add(ATTR_STD_GENERATED_TRANSFORM);
}
else if (input->flags() & SocketType::LINK_TEXTURE_UV) {
- if (shader->has_surface)
+ if (shader->has_surface_link())
attributes->add(ATTR_STD_UV);
}
}
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 42cba342bf8..795166bcf4c 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -350,7 +350,7 @@ void ImageTextureNode::attributes(Shader *shader, AttributeRequestSet *attribute
#ifdef WITH_PTEX
/* todo: avoid loading other texture coordinates when using ptex,
* and hide texture coordinate socket in the UI */
- if (shader->has_surface && string_endswith(filename, ".ptx")) {
+ if (shader->has_surface_link() && string_endswith(filename, ".ptx")) {
/* ptex */
attributes->add(ATTR_STD_PTEX_FACE_ID);
attributes->add(ATTR_STD_PTEX_UV);
@@ -552,7 +552,7 @@ ImageParams EnvironmentTextureNode::image_params() const
void EnvironmentTextureNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
#ifdef WITH_PTEX
- if (shader->has_surface && string_endswith(filename, ".ptx")) {
+ if (shader->has_surface_link() && string_endswith(filename, ".ptx")) {
/* ptex */
attributes->add(ATTR_STD_PTEX_FACE_ID);
attributes->add(ATTR_STD_PTEX_UV);
@@ -2319,7 +2319,7 @@ AnisotropicBsdfNode::AnisotropicBsdfNode() : BsdfNode(get_node_type())
void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface) {
+ if (shader->has_surface_link()) {
ShaderInput *tangent_in = input("Tangent");
if (!tangent_in->link)
@@ -2843,7 +2843,7 @@ bool PrincipledBsdfNode::has_surface_bssrdf()
void PrincipledBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface) {
+ if (shader->has_surface_link()) {
ShaderInput *tangent_in = input("Tangent");
if (!tangent_in->link)
@@ -3684,7 +3684,7 @@ GeometryNode::GeometryNode() : ShaderNode(get_node_type())
void GeometryNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface) {
+ if (shader->has_surface_link()) {
if (!output("Tangent")->links.empty()) {
attributes->add(ATTR_STD_GENERATED);
}
@@ -3830,7 +3830,7 @@ TextureCoordinateNode::TextureCoordinateNode() : ShaderNode(get_node_type())
void TextureCoordinateNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface) {
+ if (shader->has_surface_link()) {
if (!from_dupli) {
if (!output("Generated")->links.empty())
attributes->add(ATTR_STD_GENERATED);
@@ -4388,7 +4388,7 @@ HairInfoNode::HairInfoNode() : ShaderNode(get_node_type())
void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface) {
+ if (shader->has_surface_link()) {
ShaderOutput *intercept_out = output("Intercept");
if (!intercept_out->links.empty())
@@ -6744,7 +6744,7 @@ NormalMapNode::NormalMapNode() : ShaderNode(get_node_type())
void NormalMapNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface && space == NODE_NORMAL_MAP_TANGENT) {
+ if (shader->has_surface_link() && space == NODE_NORMAL_MAP_TANGENT) {
if (attribute.empty()) {
attributes->add(ATTR_STD_UV_TANGENT);
attributes->add(ATTR_STD_UV_TANGENT_SIGN);
@@ -6838,7 +6838,7 @@ TangentNode::TangentNode() : ShaderNode(get_node_type())
void TangentNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface) {
+ if (shader->has_surface_link()) {
if (direction_type == NODE_TANGENT_UVMAP) {
if (attribute.empty())
attributes->add(ATTR_STD_UV_TANGENT);
@@ -7021,7 +7021,7 @@ void VectorDisplacementNode::constant_fold(const ConstantFolder &folder)
void VectorDisplacementNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
- if (shader->has_surface && space == NODE_NORMAL_MAP_TANGENT) {
+ if (shader->has_surface_link() && space == NODE_NORMAL_MAP_TANGENT) {
if (attribute.empty()) {
attributes->add(ATTR_STD_UV_TANGENT);
attributes->add(ATTR_STD_UV_TANGENT_SIGN);
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 50c8bed4669..c65cac351a4 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -154,6 +154,14 @@ class Shader : public Node {
void tag_update(Scene *scene);
void tag_used(Scene *scene);
+ /* Return true when either of the surface or displacement socket of the output node is linked.
+ * This should be used to ensure that surface attributes are also requested even when only the
+ * displacement socket is linked. */
+ bool has_surface_link() const
+ {
+ return has_surface || has_displacement;
+ }
+
bool need_update_geometry() const;
};