From 6528fcaeea6243c376699b987e1770ed155e19ae Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 6 Nov 2019 19:27:34 +0100 Subject: [PATCH 1/3] Fix T69845: OSL wrong texture node output for fixed vector value --- intern/cycles/render/osl.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 19d27a7ef46..889552f49cd 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -673,9 +673,6 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath) /* checks to untangle graphs */ if (node_skip_input(node, input)) continue; - /* already has default value assigned */ - else if (input->flags() & SocketType::DEFAULT_LINK_MASK) - continue; string param_name = compatible_name(node, input); const SocketType &socket = input->socket_type; From 5abd006c78597f4d3a87e04ca63c1cca367c10bd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 6 Nov 2019 20:03:22 +0100 Subject: [PATCH 2/3] Fix T70279: crash loading certain old, possibly corrupt files with nodes This test should not be needed and the cause is unclear, but better to avoid the crash. Possibly caused by files saved with development versions that had different node type IDs. --- .../blenloader/intern/versioning_cycles.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 2c4ba4a1102..5610222e85d 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -221,7 +221,7 @@ static void square_roughness_node_insert(bNodeTree *ntree) static void mapping_node_order_flip(bNode *node) { /* Flip euler order of mapping shader node */ - if (node->type == SH_NODE_MAPPING) { + if (node->type == SH_NODE_MAPPING && node->storage) { TexMapping *texmap = node->storage; float quat[4]; @@ -233,7 +233,7 @@ static void mapping_node_order_flip(bNode *node) static void vector_curve_node_remap(bNode *node) { /* Remap values of vector curve node from normalized to absolute values */ - if (node->type == SH_NODE_CURVE_VEC) { + if (node->type == SH_NODE_CURVE_VEC && node->storage) { CurveMapping *mapping = node->storage; mapping->flag &= ~CUMA_DO_CLIP; @@ -300,11 +300,11 @@ static void image_node_colorspace(bNode *node) } int color_space; - if (node->type == SH_NODE_TEX_IMAGE) { + if (node->type == SH_NODE_TEX_IMAGE && node->storage) { NodeTexImage *tex = node->storage; color_space = tex->color_space; } - else if (node->type == SH_NODE_TEX_ENVIRONMENT) { + else if (node->type == SH_NODE_TEX_ENVIRONMENT && node->storage) { NodeTexEnvironment *tex = node->storage; color_space = tex->color_space; } @@ -766,7 +766,7 @@ static void update_vector_math_node_average_operator(bNodeTree *ntree) static void update_noise_node_dimensions(bNodeTree *ntree) { for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEX_NOISE) { + if (node->type == SH_NODE_TEX_NOISE && node->storage) { NodeTexNoise *tex = (NodeTexNoise *)node->storage; tex->dimensions = 3; } @@ -923,7 +923,7 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree) static void update_musgrave_node_dimensions(bNodeTree *ntree) { for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEX_MUSGRAVE) { + if (node->type == SH_NODE_TEX_MUSGRAVE && node->storage) { NodeTexMusgrave *tex = (NodeTexMusgrave *)node->storage; tex->dimensions = 3; } @@ -951,7 +951,7 @@ static void update_musgrave_node_color_output(bNodeTree *ntree) static void update_voronoi_node_dimensions(bNodeTree *ntree) { for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEX_VORONOI) { + if (node->type == SH_NODE_TEX_VORONOI && node->storage) { NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; tex->dimensions = 3; } @@ -966,7 +966,7 @@ static void update_voronoi_node_dimensions(bNodeTree *ntree) static void update_voronoi_node_f3_and_f4(bNodeTree *ntree) { for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEX_VORONOI) { + if (node->type == SH_NODE_TEX_VORONOI && node->storage) { NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; if (ELEM(tex->feature, 2, 3)) { tex->feature = SHD_VORONOI_F2; @@ -1014,7 +1014,7 @@ static void update_voronoi_node_crackle(bNodeTree *ntree) bool need_update = false; for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEX_VORONOI) { + if (node->type == SH_NODE_TEX_VORONOI && node->storage) { NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; bNodeSocket *sockDistance = nodeFindSocket(node, SOCK_OUT, "Distance"); bNodeSocket *sockColor = nodeFindSocket(node, SOCK_OUT, "Color"); @@ -1106,7 +1106,7 @@ static void update_voronoi_node_coloring(bNodeTree *ntree) LISTBASE_FOREACH_BACKWARD_MUTABLE (bNodeLink *, link, &ntree->links) { bNode *node = link->fromnode; - if (node && node->type == SH_NODE_TEX_VORONOI) { + if (node && node->type == SH_NODE_TEX_VORONOI && node->storage) { NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; if (tex->coloring == 0) { bNodeSocket *sockColor = nodeFindSocket(node, SOCK_OUT, "Color"); @@ -1143,7 +1143,7 @@ static void update_voronoi_node_square_distance(bNodeTree *ntree) bool need_update = false; for (bNode *node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEX_VORONOI) { + if (node->type == SH_NODE_TEX_VORONOI && node->storage) { NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; bNodeSocket *sockDistance = nodeFindSocket(node, SOCK_OUT, "Distance"); if (tex->distance == SHD_VORONOI_EUCLIDEAN && From 85637311c28f49b55286d3287d4c7cefbcbca18a Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 6 Nov 2019 17:44:01 -0300 Subject: [PATCH 3/3] Viewport: Fix stereo 3d camera framings when pivot is not center MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As reported by Clément Foucault. This is a small thing but since we are refactoring the draw manager for the next blender is nice to have it fully working before the refactor for comparison. Note: Camera volume and render were both fine, the camera frame is the one thing that was not working. Also in toe-in the convergence plane is always facing the original camera orientation. It is a known small annoyance. --- source/blender/draw/modes/object_mode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index fe17019a5b5..781c7e6a488 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -2099,7 +2099,8 @@ static void camera_view3d_stereoscopy_display_extra(OBJECT_ShadingGroupList *sgl if (cam->stereo.convergence_mode == CAM_S3D_OFFAXIS) { const float shift_x = ((BKE_camera_multiview_shift_x(&scene->r, ob, viewnames[eye]) - cam->shiftx) * - (drawsize * scale[0] * fac)); + (drawsize * scale[0] * fac)) * + (cam->stereo.pivot == CAM_S3D_PIVOT_CENTER ? 1.0f : 2.0f); for (int i = 0; i < 4; i++) { cam->runtime.drw_corners[eye][i][0] += shift_x;