bugfix/usd_material_color_space #113374
|
@ -477,37 +477,37 @@ void USDMaterialReader::set_principled_node_inputs(bNode *principled,
|
|||
((bNodeSocketValueFloat *)emission_strength_sock->default_value)->value = emission_strength;
|
||||
|
||||
if (pxr::UsdShadeInput specular_input = usd_shader.GetInput(usdtokens::specularColor)) {
|
||||
set_node_input(specular_input, principled, "Specular Tint", ntree, column, &context);
|
||||
set_node_input(specular_input, principled, "Specular Tint", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput metallic_input = usd_shader.GetInput(usdtokens::metallic)) {
|
||||
;
|
||||
set_node_input(metallic_input, principled, "Metallic", ntree, column, &context);
|
||||
set_node_input(metallic_input, principled, "Metallic", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput roughness_input = usd_shader.GetInput(usdtokens::roughness)) {
|
||||
set_node_input(roughness_input, principled, "Roughness", ntree, column, &context);
|
||||
set_node_input(roughness_input, principled, "Roughness", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput coat_input = usd_shader.GetInput(usdtokens::clearcoat)) {
|
||||
set_node_input(coat_input, principled, "Coat Weight", ntree, column, &context);
|
||||
set_node_input(coat_input, principled, "Coat Weight", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput coat_roughness_input = usd_shader.GetInput(usdtokens::clearcoatRoughness))
|
||||
{
|
||||
set_node_input(coat_roughness_input, principled, "Coat Roughness", ntree, column, &context);
|
||||
set_node_input(coat_roughness_input, principled, "Coat Roughness", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput opacity_input = usd_shader.GetInput(usdtokens::opacity)) {
|
||||
set_node_input(opacity_input, principled, "Alpha", ntree, column, &context);
|
||||
set_node_input(opacity_input, principled, "Alpha", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput ior_input = usd_shader.GetInput(usdtokens::ior)) {
|
||||
set_node_input(ior_input, principled, "IOR", ntree, column, &context);
|
||||
set_node_input(ior_input, principled, "IOR", ntree, column, &context, false);
|
||||
}
|
||||
|
||||
if (pxr::UsdShadeInput normal_input = usd_shader.GetInput(usdtokens::normal)) {
|
||||
set_node_input(normal_input, principled, "Normal", ntree, column, &context);
|
||||
set_node_input(normal_input, principled, "Normal", ntree, column, &context, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ void USDMaterialReader::convert_usd_uv_texture(const pxr::UsdShadeShader &usd_sh
|
|||
|
||||
/* Connect the texture image node "Vector" input. */
|
||||
if (pxr::UsdShadeInput st_input = usd_shader.GetInput(usdtokens::st)) {
|
||||
set_node_input(st_input, tex_image, "Vector", ntree, column, r_ctx);
|
||||
set_node_input(st_input, tex_image, "Vector", ntree, column, r_ctx, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -820,13 +820,13 @@ void USDMaterialReader::load_tex_image(const pxr::UsdShadeShader &usd_shader,
|
|||
color_space = usdtokens::auto_;
|
||||
}
|
||||
|
||||
if (ELEM(color_space, usdtokens::auto_)) {
|
||||
if (color_space == usdtokens::auto_) {
|
||||
CharlesWardlaw marked this conversation as resolved
Outdated
|
||||
/* If it's auto, determine whether to apply color correction based
|
||||
* on incoming connection (passed in from outer functions). */
|
||||
STRNCPY(image->colorspace_settings.name, is_color_corrected ? "sRGB" : "Non-Color");
|
||||
}
|
||||
|
||||
else if (ELEM(color_space, usdtokens::sRGB)) {
|
||||
else if (color_space == usdtokens::sRGB) {
|
||||
STRNCPY(image->colorspace_settings.name, "sRGB");
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class USDMaterialReader {
|
|||
bNodeTree *ntree,
|
||||
int column,
|
||||
NodePlacementContext *r_ctx,
|
||||
bool is_color_corrected = false) const;
|
||||
bool is_color_corrected) const;
|
||||
CharlesWardlaw marked this conversation as resolved
Outdated
Jesse Yurkovich
commented
The blender style guide says to keep the The blender style guide says to keep the `r_` parameters grouped last but that will obviously conflict with the optional param. I think I'm fine with just making this a required parameter all-up even if that causes the `set_node_input` calls to be a bit more verbose. `set_node_input` is really the only func that makes use of the optional-ness anyhow as the other functions will always provide the param in some form.
|
||||
|
||||
/**
|
||||
* Follow the connected source of the USD input to create corresponding inputs
|
||||
|
|
Loading…
Reference in New Issue
When comparing to just 1 item, you don't need to use the ELEM macro. Here and 1 other place just below this.