Hello team, I encountered a weird error when building blender[1] with upstream patch[2] for USD support: ld.gold: fatal error: /usr/lib64: pread failed: Is a directory Can someone investigate the problem? I included the patch for testing purpose. Reference: [1] https://src.fedoraproject.org/rpms/blender/blob/rawhide/f/blender.spec [2] https://developer.blender.org/D14184
Thanks in advance. -- Luya Tshimbalanga Fedora Design Team Fedora Design Suite maintainer |
diff --git a/source/blender/io/usd/intern/usd_reader_light.cc b/source/blender/io/usd/intern/usd_reader_light.cc --- a/source/blender/io/usd/intern/usd_reader_light.cc +++ b/source/blender/io/usd/intern/usd_reader_light.cc @@ -9,8 +9,6 @@ #include "DNA_light_types.h" #include "DNA_object_types.h" -#include <pxr/usd/usdLux/light.h> - #include <pxr/usd/usdLux/diskLight.h> #include <pxr/usd/usdLux/distantLight.h> #include <pxr/usd/usdLux/rectLight.h> @@ -40,14 +38,17 @@ if (!prim_) { return; } +#if PXR_VERSION >= 2111 + pxr::UsdLuxLightAPI light_api(prim_); +#else + pxr::UsdLuxLight light_api(prim_); +#endif - pxr::UsdLuxLight light_prim(prim_); - - if (!light_prim) { + if (!light_api) { return; } - pxr::UsdLuxShapingAPI shaping_api(light_prim); + pxr::UsdLuxShapingAPI shaping_api; /* Set light type. */ @@ -63,6 +64,8 @@ else if (prim_.IsA<pxr::UsdLuxSphereLight>()) { blight->type = LA_LOCAL; + shaping_api = pxr::UsdLuxShapingAPI(prim_); + if (shaping_api && shaping_api.GetShapingConeAngleAttr().IsAuthored()) { blight->type = LA_SPOT; } @@ -73,7 +76,7 @@ /* Set light values. */ - if (pxr::UsdAttribute intensity_attr = light_prim.GetIntensityAttr()) { + if (pxr::UsdAttribute intensity_attr = light_api.GetIntensityAttr()) { float intensity = 0.0f; if (intensity_attr.Get(&intensity, motionSampleTime)) { blight->energy = intensity * this->import_params_.light_intensity_scale; @@ -92,14 +95,14 @@ light_prim.GetDiffuseAttr().Get(&diffuse, motionSampleTime); #endif - if (pxr::UsdAttribute spec_attr = light_prim.GetSpecularAttr()) { + if (pxr::UsdAttribute spec_attr = light_api.GetSpecularAttr()) { float spec = 0.0f; if (spec_attr.Get(&spec, motionSampleTime)) { blight->spec_fac = spec; } } - if (pxr::UsdAttribute color_attr = light_prim.GetColorAttr()) { + if (pxr::UsdAttribute color_attr = light_api.GetColorAttr()) { pxr::GfVec3f color; if (color_attr.Get(&color, motionSampleTime)) { blight->r = color[0]; diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc --- a/source/blender/io/usd/intern/usd_reader_stage.cc +++ b/source/blender/io/usd/intern/usd_reader_stage.cc @@ -18,7 +18,13 @@ #include <pxr/usd/usdGeom/nurbsCurves.h> #include <pxr/usd/usdGeom/scope.h> #include <pxr/usd/usdGeom/xform.h> -#include <pxr/usd/usdLux/light.h> + +#if PXR_VERSION >= 2111 +# include <pxr/usd/usdLux/boundableLightBase.h> +# include <pxr/usd/usdLux/nonboundableLightBase.h> +#else +# include <pxr/usd/usdLux/light.h> +#endif #include <iostream> @@ -55,7 +61,12 @@ if (params_.import_meshes && prim.IsA<pxr::UsdGeomMesh>()) { return new USDMeshReader(prim, params_, settings_); } +#if PXR_VERSION >= 2111 + if (params_.import_lights && (prim.IsA<pxr::UsdLuxBoundableLightBase>() || + prim.IsA<pxr::UsdLuxNonboundableLightBase>())) { +#else if (params_.import_lights && prim.IsA<pxr::UsdLuxLight>()) { +#endif return new USDLightReader(prim, params_, settings_); } if (params_.import_volumes && prim.IsA<pxr::UsdVolVolume>()) { @@ -82,7 +93,11 @@ if (prim.IsA<pxr::UsdGeomMesh>()) { return new USDMeshReader(prim, params_, settings_); } +#if PXR_VERSION >= 2111 + if (prim.IsA<pxr::UsdLuxBoundableLightBase>() || prim.IsA<pxr::UsdLuxNonboundableLightBase>()) { +#else if (prim.IsA<pxr::UsdLuxLight>()) { +#endif return new USDLightReader(prim, params_, settings_); } if (prim.IsA<pxr::UsdVolVolume>()) { diff --git a/source/blender/io/usd/intern/usd_reader_xform.cc b/source/blender/io/usd/intern/usd_reader_xform.cc --- a/source/blender/io/usd/intern/usd_reader_xform.cc +++ b/source/blender/io/usd/intern/usd_reader_xform.cc @@ -131,7 +131,7 @@ return false; } - if (prim_.IsInMaster()) { + if (prim_.IsInPrototype()) { /* We don't consider prototypes to be root prims, * because we never want to apply global scaling * or rotations to the prototypes themselves. */ diff --git a/source/blender/io/usd/intern/usd_writer_light.cc b/source/blender/io/usd/intern/usd_writer_light.cc --- a/source/blender/io/usd/intern/usd_writer_light.cc +++ b/source/blender/io/usd/intern/usd_writer_light.cc @@ -33,7 +33,12 @@ pxr::UsdTimeCode timecode = get_export_time_code(); Light *light = static_cast<Light *>(context.object->data); - pxr::UsdLuxLight usd_light; +#if PXR_VERSION >= 2111 + pxr::UsdLuxLightAPI usd_light_api; +#else + pxr::UsdLuxLight usd_light_api; + +#endif switch (light->type) { case LA_AREA: @@ -42,21 +47,33 @@ case LA_AREA_ELLIPSE: { /* An ellipse light will deteriorate into a disk light. */ pxr::UsdLuxDiskLight disk_light = pxr::UsdLuxDiskLight::Define(stage, usd_path); disk_light.CreateRadiusAttr().Set(light->area_size, timecode); - usd_light = disk_light; +#if PXR_VERSION >= 2111 + usd_light_api = disk_light.LightAPI(); +#else + usd_light_api = disk_light; +#endif break; } case LA_AREA_RECT: { pxr::UsdLuxRectLight rect_light = pxr::UsdLuxRectLight::Define(stage, usd_path); rect_light.CreateWidthAttr().Set(light->area_size, timecode); rect_light.CreateHeightAttr().Set(light->area_sizey, timecode); - usd_light = rect_light; +#if PXR_VERSION >= 2111 + usd_light_api = rect_light.LightAPI(); +#else + usd_light_api = rect_light; +#endif break; } case LA_AREA_SQUARE: { pxr::UsdLuxRectLight rect_light = pxr::UsdLuxRectLight::Define(stage, usd_path); rect_light.CreateWidthAttr().Set(light->area_size, timecode); rect_light.CreateHeightAttr().Set(light->area_size, timecode); - usd_light = rect_light; +#if PXR_VERSION >= 2111 + usd_light_api = rect_light.LightAPI(); +#else + usd_light_api = rect_light; +#endif break; } } @@ -64,12 +81,23 @@ case LA_LOCAL: { pxr::UsdLuxSphereLight sphere_light = pxr::UsdLuxSphereLight::Define(stage, usd_path); sphere_light.CreateRadiusAttr().Set(light->area_size, timecode); - usd_light = sphere_light; +#if PXR_VERSION >= 2111 + usd_light_api = sphere_light.LightAPI(); +#else + usd_light_api = sphere_light; +#endif break; } - case LA_SUN: - usd_light = pxr::UsdLuxDistantLight::Define(stage, usd_path); + case LA_SUN: { + pxr::UsdLuxDistantLight distant_light = pxr::UsdLuxDistantLight::Define(stage, usd_path); + /* TODO(makowalski): set angle attribute here. */ +#if PXR_VERSION >= 2111 + usd_light_api = distant_light.LightAPI(); +#else + usd_light_api = distant_light; +#endif break; + } default: BLI_assert_msg(0, "is_supported() returned true for unsupported light type"); } @@ -85,10 +113,10 @@ else { usd_intensity = light->energy / 100.0f; } - usd_light.CreateIntensityAttr().Set(usd_intensity, timecode); + usd_light_api.CreateIntensityAttr().Set(usd_intensity, timecode); - usd_light.CreateColorAttr().Set(pxr::GfVec3f(light->r, light->g, light->b), timecode); - usd_light.CreateSpecularAttr().Set(light->spec_fac, timecode); + usd_light_api.CreateColorAttr().Set(pxr::GfVec3f(light->r, light->g, light->b), timecode); + usd_light_api.CreateSpecularAttr().Set(light->spec_fac, timecode); } } // namespace blender::io::usd diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -162,7 +162,7 @@ created_shader = create_usd_preview_shader(usd_export_context, usd_material, input_node); preview_surface.CreateInput(input_spec.input_name, input_spec.input_type) - .ConnectToSource(created_shader, input_spec.source_name); + .ConnectToSource(created_shader.ConnectableAPI(), input_spec.source_name); } else if (input_spec.set_default_value) { /* Set hardcoded value. */ @@ -216,7 +216,7 @@ shader.CreateInput(usdtokens::metallic, pxr::SdfValueTypeNames->Float).Set(material->metallic); /* Connect the shader and the material together. */ - usd_material.CreateSurfaceOutput().ConnectToSource(shader, usdtokens::surface); + usd_material.CreateSurfaceOutput().ConnectToSource(shader.ConnectableAPI(), usdtokens::surface); } /* Return USD Preview Surface input map singleton. */ @@ -292,12 +292,12 @@ uv_shader.CreateInput(usdtokens::varname, pxr::SdfValueTypeNames->Token) .Set(pxr::TfToken(uv_set)); usd_tex_shader.CreateInput(usdtokens::st, pxr::SdfValueTypeNames->Float2) - .ConnectToSource(uv_shader, usdtokens::result); + .ConnectToSource(uv_shader.ConnectableAPI(), usdtokens::result); } else { uv_shader.CreateInput(usdtokens::varname, pxr::SdfValueTypeNames->Token).Set(default_uv); usd_tex_shader.CreateInput(usdtokens::st, pxr::SdfValueTypeNames->Float2) - .ConnectToSource(uv_shader, usdtokens::result); + .ConnectToSource(uv_shader.ConnectableAPI(), usdtokens::result); } } @@ -312,7 +312,7 @@ if (uv_shader.GetPrim().IsValid()) { uv_shader.CreateInput(usdtokens::varname, pxr::SdfValueTypeNames->Token).Set(default_uv); usd_tex_shader.CreateInput(usdtokens::st, pxr::SdfValueTypeNames->Float2) - .ConnectToSource(uv_shader, usdtokens::result); + .ConnectToSource(uv_shader.ConnectableAPI(), usdtokens::result); } } } @@ -487,7 +487,7 @@ case SH_NODE_BSDF_DIFFUSE: case SH_NODE_BSDF_PRINCIPLED: { shader.CreateIdAttr(pxr::VtValue(usdtokens::preview_surface)); - material.CreateSurfaceOutput().ConnectToSource(shader, usdtokens::surface); + material.CreateSurfaceOutput().ConnectToSource(shader.ConnectableAPI(), usdtokens::surface); break; }
_______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure