adobe / USD-Fileformat-plugins

A collection of USD fileformat plugins
312 stars 21 forks source link

error: conversion from 'GfVec3d' to non-scalar type 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f' requested #34

Closed zwillikon closed 3 weeks ago

zwillikon commented 2 months ago

When I try to compile USD-Fileformat-plugins against a current git master version of https://github.com/PixarAnimationStudios/OpenUSD it fails with error: conversion from 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d' to non-scalar type 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f' requested:

[ 54%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/layerWriteMaterialX.cpp.o
In file included from ./USD-Fileformat-plugins/utils/common.h:16,
                 from ./USD-Fileformat-plugins/utils/usdData.h:24,
                 from ./USD-Fileformat-plugins/utils/geometry.h:13,
                 from ./USD-Fileformat-plugins/utils/geometry.cpp:12:
./USD-Fileformat-plugins/utils/geometry.cpp: In function 'bool adobe::usd::fanTriangulate(const pxrInternal_v0_24_11__pxrReserved__::VtIntArray&, const pxrInternal_v0_24_11__pxrReserved__::VtIntArray&, ReverseIndex&, ReverseIndex&, pxrInternal_v0_24_11__pxrReserved__::VtIntArray&, pxrInternal_v0_24_11__pxrReserved__::VtIntArray&)':
./USD-Fileformat-plugins/utils/geometry.cpp:525:15: warning: format '%d' expects argument of type 'int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
  525 |               "fanTriangulate failed- Expected at least 3 face vertices, found: %d in array %d",
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  526 |               numFaceVertices,
  527 |               i);
      |               ~
      |               |
      |               size_t {aka long unsigned int}
./USD-Fileformat-plugins/utils/geometry.cpp: In function 'void adobe::usd::transformMesh(Mesh&, const pxrInternal_v0_24_11__pxrReserved__::GfMatrix4d&)':
./USD-Fileformat-plugins/utils/geometry.cpp:1135:62: error: no match for 'operator=' (operand types are 'pxrInternal_v0_24_11__pxrReserved__::VtArray<pxrInternal_v0_24_11__pxrReserved__::GfVec3f>::ElementType' {aka 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f'} and 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d')
 1135 |         mesh.points[i] = modelMatrix.Transform(mesh.points[i]);
      |                                                              ^
In file included from /usr/include/pxr/base/gf/vec3d.h:301,
                 from /usr/include/pxr/base/gf/matrix3d.h:21,
                 from /usr/include/pxr/usd/sdf/types.h:28,
                 from /usr/include/pxr/usd/pcp/site.h:14,
                 from /usr/include/pxr/usd/pcp/types.h:12,
                 from /usr/include/pxr/usd/pcp/node.h:12,
                 from /usr/include/pxr/usd/pcp/dynamicFileFormatContext.h:12,
                 from ./USD-Fileformat-plugins/utils/common.h:17:
/usr/include/pxr/base/gf/vec3f.h:45:7: note: candidate: 'constexpr pxrInternal_v0_24_11__pxrReserved__::GfVec3f& pxrInternal_v0_24_11__pxrReserved__::GfVec3f::operator=(const pxrInternal_v0_24_11__pxrReserved__::GfVec3f&)'
   45 | class GfVec3f
      |       ^~~~~~~
/usr/include/pxr/base/gf/vec3f.h:45:7: note:   no known conversion for argument 1 from 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d' to 'const pxrInternal_v0_24_11__pxrReserved__::GfVec3f&'
/usr/include/pxr/base/gf/vec3f.h:45:7: note: candidate: 'constexpr pxrInternal_v0_24_11__pxrReserved__::GfVec3f& pxrInternal_v0_24_11__pxrReserved__::GfVec3f::operator=(pxrInternal_v0_24_11__pxrReserved__::GfVec3f&&)'
/usr/include/pxr/base/gf/vec3f.h:45:7: note:   no known conversion for argument 1 from 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d' to 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f&&'
./USD-Fileformat-plugins/utils/geometry.cpp:1142:70: error: no match for 'operator=' (operand types are 'pxrInternal_v0_24_11__pxrReserved__::VtArray<pxrInternal_v0_24_11__pxrReserved__::GfVec3f>::ElementType' {aka 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f'} and 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d')
 1142 |         mesh.normals.values[i] = normalMatrix * mesh.normals.values[i];
      |                                                                      ^
/usr/include/pxr/base/gf/vec3f.h:45:7: note: candidate: 'constexpr pxrInternal_v0_24_11__pxrReserved__::GfVec3f& pxrInternal_v0_24_11__pxrReserved__::GfVec3f::operator=(const pxrInternal_v0_24_11__pxrReserved__::GfVec3f&)'
   45 | class GfVec3f
      |       ^~~~~~~
/usr/include/pxr/base/gf/vec3f.h:45:7: note:   no known conversion for argument 1 from 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d' to 'const pxrInternal_v0_24_11__pxrReserved__::GfVec3f&'
/usr/include/pxr/base/gf/vec3f.h:45:7: note: candidate: 'constexpr pxrInternal_v0_24_11__pxrReserved__::GfVec3f& pxrInternal_v0_24_11__pxrReserved__::GfVec3f::operator=(pxrInternal_v0_24_11__pxrReserved__::GfVec3f&&)'
/usr/include/pxr/base/gf/vec3f.h:45:7: note:   no known conversion for argument 1 from 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d' to 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f&&'
./USD-Fileformat-plugins/utils/geometry.cpp:1149:40: error: conversion from 'pxrInternal_v0_24_11__pxrReserved__::GfVec3d' to non-scalar type 'pxrInternal_v0_24_11__pxrReserved__::GfVec3f' requested
 1149 |         GfVec3f tangentXYZ = rotMatrix * GfVec3f(tangent[0], tangent[1], tangent[2]);
      |                              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [utils/CMakeFiles/fileformatUtils.dir/build.make:118: utils/CMakeFiles/fileformatUtils.dir/geometry.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
./USD-Fileformat-plugins/utils/layerRead.cpp: In function 'bool adobe::usd::readMeshOrPoints(ReadLayerContext&, const pxrInternal_v0_24_11__pxrReserved__::UsdPrim&, int)':
./USD-Fileformat-plugins/utils/layerRead.cpp:560:24: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  560 |     const std::string& path = prim.GetPrimInPrototype().GetPath().GetString();
      |                        ^~~~
./USD-Fileformat-plugins/utils/layerRead.cpp:560:76: note: the temporary was destroyed at the end of the full expression 'pxrInternal_v0_24_11__pxrReserved__::UsdObject::GetPath() const().pxrInternal_v0_24_11__pxrReserved__::SdfPath::GetString()'
  560 |     const std::string& path = prim.GetPrimInPrototype().GetPath().GetString();
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
./USD-Fileformat-plugins/utils/layerRead.cpp: In function 'bool adobe::usd::readImage(ReadLayerContext&, const pxrInternal_v0_24_11__pxrReserved__::SdfAssetPath&, int&)':
./USD-Fileformat-plugins/utils/layerRead.cpp:861:24: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  861 |     const std::string& absPath = path.GetResolvedPath().empty()
      |                        ^~~~~~~
./USD-Fileformat-plugins/utils/layerRead.cpp:863:59: note: the temporary was destroyed at the end of the full expression 'pxrInternal_v0_24_11__pxrReserved__::ArResolver::Resolve(const std::string&) const((* &(& path)->pxrInternal_v0_24_11__pxrReserved__::SdfAssetPath::GetAssetPath())).pxrInternal_v0_24_11__pxrReserved__::ArResolvedPath::operator const std::string&()'
  863 |                                    : path.GetResolvedPath();
      |                                                           ^
In file included from /usr/include/c++/14.2.1/bits/basic_string.h:57,
                 from /usr/include/c++/14.2.1/string:54,
                 from /usr/include/pxr/base/tf/hash.h:18,
                 from /usr/include/pxr/base/tf/token.h:19,
                 from /usr/include/pxr/base/tf/staticTokens.h:58,
                 from ./USD-Fileformat-plugins/utils/common.h:14,
                 from ./USD-Fileformat-plugins/utils/usdData.h:24,
                 from ./USD-Fileformat-plugins/utils/layerRead.h:14,
                 from ./USD-Fileformat-plugins/utils/layerRead.cpp:12:
In member function '_CharT* std::basic_string<_CharT, _Traits, _Alloc>::_M_data() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]',
    inlined from 'std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_M_rep() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/14.2.1/bits/cow_string.h:338:51,
    inlined from 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/14.2.1/bits/cow_string.h:538:9,
    inlined from 'pxrInternal_v0_24_11__pxrReserved__::ArResolvedPath::ArResolvedPath(const std::string&)' at /usr/include/pxr/usd/ar/resolvedPath.h:27:11,
    inlined from 'bool adobe::usd::readImage(ReadLayerContext&, const pxrInternal_v0_24_11__pxrReserved__::SdfAssetPath&, int&)' at ./USD-Fileformat-plugins/utils/layerRead.cpp:883:77:
/usr/include/c++/14.2.1/bits/cow_string.h:330:29: warning: dangling pointer to an unnamed temporary may be used [-Wdangling-pointer=]
  330 |       { return  _M_dataplus._M_p; }
      |                             ^~~~
./USD-Fileformat-plugins/utils/layerRead.cpp: In function 'bool adobe::usd::readImage(ReadLayerContext&, const pxrInternal_v0_24_11__pxrReserved__::SdfAssetPath&, int&)':
./USD-Fileformat-plugins/utils/layerRead.cpp:862:69: note: unnamed temporary defined here
  862 |                                    ? PXR_NS::ArGetResolver().Resolve(path.GetAssetPath())
      |                                                                     ^

compiler: GCC 14.2.1, may try with various LLVM's if requested

kwblackstone commented 1 month ago

thanks for reporting this, it will be fixed in the next release

kwblackstone commented 3 weeks ago

fixed in v1.0.9