Fix missing subsurface IOR/Anisotropy socket after refactor in c2ab47e

This commit is contained in:
2021-11-30 22:05:42 +01:00
parent 221b7b27fc
commit 247f37f765
2 changed files with 16 additions and 5 deletions

View File

@@ -169,17 +169,16 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat,
static void node_shader_update_principled(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
int distribution = node->custom1;
int sss_method = node->custom2;
const int distribution = node->custom1;
const int sss_method = node->custom2;
for (sock = node->inputs.first; sock; sock = sock->next) {
for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) {
if (STREQ(sock->name, "Transmission Roughness")) {
nodeSetSocketAvailability(ntree, sock, distribution == SHD_GLOSSY_GGX);
}
if (STR_ELEM(sock->name, "Subsurface IOR", "Subsurface Anisotropy")) {
nodeSetSocketAvailability(ntree, sock, sss_method == SHD_SUBSURFACE_BURLEY);
nodeSetSocketAvailability(ntree, sock, sss_method != SHD_SUBSURFACE_BURLEY);
}
}
}

View File

@@ -67,6 +67,17 @@ static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat,
mat, node, "node_subsurface_scattering", in, out, GPU_constant(&node->sss_id));
}
static void node_shader_update_subsurface_scattering(bNodeTree *ntree, bNode *node)
{
const int sss_method = node->custom1;
for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) {
if (STR_ELEM(sock->name, "IOR", "Anisotropy")) {
nodeSetSocketAvailability(ntree, sock, sss_method != SHD_SUBSURFACE_BURLEY);
}
}
}
/* node type definition */
void register_node_type_sh_subsurface_scattering(void)
{
@@ -80,6 +91,7 @@ void register_node_type_sh_subsurface_scattering(void)
node_type_init(&ntype, node_shader_init_subsurface_scattering);
node_type_storage(&ntype, "", NULL, NULL);
node_type_gpu(&ntype, node_shader_gpu_subsurface_scattering);
node_type_update(&ntype, node_shader_update_subsurface_scattering);
nodeRegisterType(&ntype);
}