Skip to content
9 changes: 9 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
10.7.x.x (relative to 10.7.0.0a4)
========

API
---

- MessageHandler : Added `msg()` overload that accepts a `fmt::format_string` and arguments.
- InternedString : Added specialisation for `fmt::formatter<InternedString>`.

Build
-----

- Requires `fmt` 9.1.0.

10.7.0.0a4 (relative to 10.7.0.0a3)
==========
Expand Down
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,8 @@ env.Append( LIBS = [
"OpenEXR" + env["OPENEXR_LIB_SUFFIX"],
# Link Windows zlib against static library to avoid potential conflicts
# with system provided version.
"z" if env["PLATFORM"] != "win32" else "zlibstatic"
"z" if env["PLATFORM"] != "win32" else "zlibstatic",
"fmt"
]
)

Expand Down
20 changes: 9 additions & 11 deletions contrib/IECoreAlembic/include/IECoreAlembic/PrimitiveReader.inl
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ void PrimitiveReader::readGeomParam( const T &param, const Alembic::Abc::ISample
{
IECore::msg(
IECore::Msg::Warning, "PrimitiveReader::convertArbGeomParam",
boost::format( "GeomParam \"%s\" on object \"%s\" has unsupported array extent %d" )
% param.getHeader().getName()
% param.getParent().getObject().getFullName()
% param.getArrayExtent()
"GeomParam \"{}\" on object \"{}\" has unsupported array extent {}",
param.getHeader().getName(),
param.getParent().getObject().getFullName(),
param.getArrayExtent()
);
return;
}
Expand Down Expand Up @@ -151,13 +151,11 @@ void PrimitiveReader::readGeomParam( const T &param, const Alembic::Abc::ISample
{
IECore::msg(
IECore::Msg::Warning, "PrimitiveReader::readGeomParam",
boost::format(
"Ignoring invalid primitive variable \"%s\" on object \"%s\" (size %d, expected %d)"
)
% primitiveVariableName
% param.getParent().getObject().getFullName()
% (pv.indices ? pv.indices->readable().size() : data->readable().size())
% primitive->variableSize( pv.interpolation )
"Ignoring invalid primitive variable \"{}\" on object \"{}\" (size {}, expected {})",
primitiveVariableName,
param.getParent().getObject().getFullName(),
(pv.indices ? pv.indices->readable().size() : data->readable().size()),
primitive->variableSize( pv.interpolation )
);
}
}
Expand Down
44 changes: 18 additions & 26 deletions contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@

#include "tbb/spin_mutex.h"

#include "fmt/format.h"

#include <memory>
#include <unordered_map>

Expand Down Expand Up @@ -171,7 +173,7 @@ class AlembicScene::AlembicReader : public AlembicIO
{
// Even though the default policy for IFactory is kThrowPolicy, this appears not to
// be applied when it fails to load an archive - instead it returns an invalid archive.
throw IECore::Exception( boost::str( boost::format( "Unable to open file \"%s\"" ) % fileName ) );
throw IECore::Exception( fmt::format( "Unable to open file \"{}\"", fileName ) );
}
}

Expand Down Expand Up @@ -441,7 +443,7 @@ class AlembicScene::AlembicReader : public AlembicIO
IECore::msg(
IECore::Msg::Warning,
"AlembicScene::readAttributeAtSample",
boost::format( "Unable to read attribute '%1%'" ) % name
"Unable to read attribute '{}'", name
);
return nullptr;
}
Expand Down Expand Up @@ -834,7 +836,7 @@ class AlembicScene::AlembicReader : public AlembicIO
IECore::msg(
IECore::Msg::Warning,
"AlembicScene::readAttributeAtSample",
boost::format( "Unsupported attribute type datatype: \"%1%\" extend:%2% interpretation:\"%3%\"" ) % pod % extent % getInterpretation()
"Unsupported attribute type datatype: \"{}\" extent:{} interpretation:\"{}\"", pod, extent, getInterpretation()
);

return nullptr;
Expand Down Expand Up @@ -1464,7 +1466,7 @@ class AlembicScene::AlembicWriter : public AlembicIO
}
else
{
throw IECore::Exception( boost::str( boost::format( "Unsupported data type : '%1%'" ) % transform->typeName() ) );
throw IECore::Exception( fmt::format( "Unsupported data type : '{}'", transform->typeName() ) );
}

if( m_xformSampleTimes.size() && m_xformSampleTimes.back() >= time )
Expand Down Expand Up @@ -1536,13 +1538,10 @@ class AlembicScene::AlembicWriter : public AlembicIO
{
if( !haveXform() )
{
IECore::msg(IECore::MessageHandler::Level::Warning, __func__,
boost::str(
boost::format( "Cannot write attribute ( attribute name: '%1%', attribute type: '%2%', time: %3% ) at root. " ) %
name.string() %
attribute->typeName() %
time
)
IECore::msg(
IECore::MessageHandler::Level::Warning, __func__,
"Cannot write attribute (attribute name: '{}', attribute type: '{}', time: {}) at root.",
name, attribute->typeName(), time
);
return;
}
Expand All @@ -1557,9 +1556,8 @@ class AlembicScene::AlembicWriter : public AlembicIO
{
IECore::msg(
IECore::MessageHandler::Level::Warning, "AlembicScene::writeAttribute",
boost::format(
"Expected BoolData for attribute \"%s\" but got \"%s\"."
) % name % attribute->typeName()
"Expected BoolData for attribute \"{}\" but got \"{}\".",
name, attribute->typeName()
);
}
}
Expand Down Expand Up @@ -1761,17 +1759,11 @@ class AlembicScene::AlembicWriter : public AlembicIO
this->path( path );
pathToString( path, pathStr );
IECore::msg(
IECore::Msg::Warning,
"AlembicScene::writeAttribute",
boost::str(
boost::format( "Cannot write attribute ( attribute name: '%1%', attribute type: '%2%', time: %3% ) at location '%4%'. " ) %
name.string() %
attribute->typeName() %
time %
pathStr
)
);

IECore::Msg::Warning,
"AlembicScene::writeAttribute",
"Cannot write attribute (attribute name: '{}', attribute type: '{}', time: {}) at location '{}'.",
name, attribute->typeName(), time, pathStr
);
}

}
Expand Down Expand Up @@ -1801,7 +1793,7 @@ class AlembicScene::AlembicWriter : public AlembicIO
IECore::msg(
IECore::Msg::Warning,
"AlembicScene::writeObject",
boost::format( "Unsupported object type \"%1%\"" ) % object->typeName()
"Unsupported object type \"{}\"", object->typeName()
);
return;
}
Expand Down
10 changes: 4 additions & 6 deletions contrib/IECoreAlembic/src/IECoreAlembic/MeshReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,10 @@ class MeshReader : public PrimitiveReader
{
IECore::msg(
IECore::Msg::Warning, "PrimitiveReader::readGeomParam",
boost::format(
"Ignoring invalid \"uv\" property on object \"%1%\" (size %2%, expected %3%)"
)
% uvs.getParent().getObject().getFullName()
% ( indexData ? indexData->readable().size() : uvData->readable().size() )
% primitive->variableSize( primitiveVariable.interpolation )
"Ignoring invalid \"uv\" property on object \"{}\" (size {}, expected {})",
uvs.getParent().getObject().getFullName(),
( indexData ? indexData->readable().size() : uvData->readable().size() ),
primitive->variableSize( primitiveVariable.interpolation )
);
}
}
Expand Down
5 changes: 2 additions & 3 deletions contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ void PrimitiveReader::readArbGeomParams( const Alembic::Abc::ICompoundProperty &
{
msg(
Msg::Warning, "PrimitiveReader::convertArbGeomParams",
boost::format( "GeomParam \"%s\" on object \"%s\" has unsupported type" )
% header.getName()
% params.getObject().getFullName()
"GeomParam \"{}\" on object \"{}\" has unsupported type",
header.getName(), params.getObject().getFullName()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void PrimitiveWriter::writeArbGeomParams( const IECoreScene::Primitive *primitiv
}
break;
default :
IECore::msg( IECore::Msg::Warning, "PrimitiveWriter::writeArbGeomParams", boost::format( "Variable \"%1%\" has unsupported type \"%2%" ) % p.first % p.second.data->typeName() );
IECore::msg( IECore::Msg::Warning, "PrimitiveWriter::writeArbGeomParams", "Variable \"{}\" has unsupported type \"{}\"", p.first, p.second.data->typeName() );
break;
}
}
Expand Down
12 changes: 4 additions & 8 deletions contrib/IECoreUSD/src/IECoreUSD/CameraAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ IECore::ObjectPtr readCamera( pxr::UsdGeomCamera &camera, pxr::UsdTimeCode time,
{
IECore::msg(
IECore::Msg::Warning, "IECoreUSD::CameraAlgo",
boost::format( "Unsupported projection \"%1%\" reading \"%2%\" at time %3%" )
% projection
% camera.GetPrim().GetPath()
% ( time.GetValue() / camera.GetPrim().GetStage()->GetTimeCodesPerSecond() )
"Unsupported projection \"{}\" reading \"{}\" at time {}",
projection.GetString(), camera.GetPrim().GetPath().GetAsString(), ( time.GetValue() / camera.GetPrim().GetStage()->GetTimeCodesPerSecond() )
);
}

Expand Down Expand Up @@ -182,10 +180,8 @@ bool writeCamera( const IECoreScene::Camera *camera, const pxr::UsdStagePtr &sta
{
IECore::msg(
IECore::Msg::Warning, "IECoreUSD::CameraAlgo",
boost::format( "Unsupported projection \"%1%\" writing \"%2%\" at time %3%" )
% camera->getProjection()
% path
% ( time.GetValue() / stage->GetTimeCodesPerSecond() )
"Unsupported projection \"{}\" writing \"{}\" at time {}",
camera->getProjection(), path.GetAsString(), ( time.GetValue() / stage->GetTimeCodesPerSecond() )
);
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ IECore::ObjectPtr readBasisCurves( pxr::UsdGeomBasisCurves &curves, pxr::UsdTime
}
else
{
IECore::msg( IECore::Msg::Warning, "USDScene", boost::format( "Unsupported basis \"%1%\"" ) % usdBasis );
IECore::msg( IECore::Msg::Warning, "USDScene", "Unsupported basis \"{}\"", usdBasis.GetString() );
}
}

Expand All @@ -125,7 +125,7 @@ IECore::ObjectPtr readBasisCurves( pxr::UsdGeomBasisCurves &curves, pxr::UsdTime
}
else if( wrap != pxr::UsdGeomTokens->nonperiodic )
{
IECore::msg( IECore::Msg::Warning, "USDScene", boost::format( "Unsupported wrap \"%1%\"" ) % wrap );
IECore::msg( IECore::Msg::Warning, "USDScene", "Unsupported wrap \"{}\"", wrap.GetString() );
}

return readCurves( curves, time, basis, periodic, canceller );
Expand Down
10 changes: 6 additions & 4 deletions contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ IECORE_PUSH_DEFAULT_VISIBILITY
#include "pxr/usd/usdSkel/utils.h"
IECORE_POP_DEFAULT_VISIBILITY

#include "fmt/ostream.h"

using namespace std;
using namespace pxr;
using namespace IECore;
Expand All @@ -75,7 +77,7 @@ void IECoreUSD::PrimitiveAlgo::writePrimitiveVariable( const IECoreScene::Primit
}
else
{
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Invalid Interpolation for %1%" ) % primVar.GetPrimvarName() );
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "Invalid Interpolation for {}", primVar.GetPrimvarName().GetString() );
}

if ( usdInterpolation == pxr::UsdGeomTokens->constant )
Expand Down Expand Up @@ -215,7 +217,7 @@ void addPrimitiveVariableIfValid( IECoreScene::Primitive *primitive, const std::
{
if( !primitive->isPrimitiveVariableValid( primitiveVariable ) )
{
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Ignoring invalid primitive variable \"%1%\"" ) % source.GetPath().GetAsString() );
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "Ignoring invalid primitive variable \"{}\"", source.GetPath().GetAsString() );
return;
}

Expand All @@ -227,7 +229,7 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode
IECoreScene::PrimitiveVariable::Interpolation interpolation = IECoreUSD::PrimitiveAlgo::fromUSD( primVar.GetInterpolation() );
if( interpolation == IECoreScene::PrimitiveVariable::Invalid )
{
IECore::msg(IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Invalid Interpolation on %1%" ) % primVar.GetName().GetString() );
IECore::msg(IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "Invalid Interpolation on {}", primVar.GetName().GetString() );
return;
}

Expand All @@ -243,7 +245,7 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode
);
if( !data )
{
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "PrimVar: %1% type: %2% not supported - skipping" ) % primVar.GetName().GetString() % primVar.GetTypeName() );
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "PrimVar: {} type: {} not supported - skipping", primVar.GetName().GetString(), fmt::streamed( primVar.GetTypeName() ) );
return;
}

Expand Down
Loading