Skip to content

Commit

Permalink
Extensive usage of OccHandle and makeOccHandle()
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed Apr 30, 2024
1 parent c1fa59b commit 5711be4
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion src/app/dialog_inspect_xde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ static QTreeWidgetItem* createPropertyTreeItem(const QString& text, const OccHan
else if (imgTexture->DataBuffer() && !imgTexture->DataBuffer()->IsEmpty()) {
// Texture is provided by some embedded data
item->setText(1, DialogInspectXde::tr("<data>"));
const Handle(NCollection_Buffer)& buff = imgTexture->DataBuffer();
const OccHandle<NCollection_Buffer>& buff = imgTexture->DataBuffer();
item->setImage(1, QByteArray::fromRawData(reinterpret_cast<const char*>(buff->Data()), buff->Size()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/widget_clip_planes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void WidgetClipPlanes::createPlaneCappingTexture()
const QByteArray fileContents = file.readAll();
const QByteArray filenameUtf8 = file.fileName().toUtf8();
auto fileContentsData = reinterpret_cast<const Standard_Byte*>(fileContents.constData());
OccHandle<Image_AlienPixMap> imageCapping = new Image_AlienPixMap;
auto imageCapping = makeOccHandle<Image_AlienPixMap>();
imageCapping->Load(fileContentsData, fileContents.size(), filenameUtf8.constData());
m_textureCapping = new GraphicsTexture2D(imageCapping);
m_textureCapping->EnableModulate();
Expand Down
14 changes: 7 additions & 7 deletions src/app/widget_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ WidgetGrid::WidgetGrid(GraphicsViewPtr viewPtr, QWidget* parent)
m_ui(new Ui_WidgetGrid),
m_viewPtr(viewPtr)
{
const Handle_V3d_Viewer& viewer = viewPtr->Viewer();
const OccHandle<V3d_Viewer>& viewer = viewPtr->Viewer();

// Intial configuration
m_ui->setupUi(this);
Expand Down Expand Up @@ -128,7 +128,7 @@ WidgetGrid::WidgetGrid(GraphicsViewPtr viewPtr, QWidget* parent)
m_ui->combo_Plane->setCurrentIndex(3);

// Install grid draw mode
Handle_Aspect_Grid gridAspect = GraphicsUtils::V3dViewer_grid(viewer);
OccHandle<Aspect_Grid> gridAspect = GraphicsUtils::V3dViewer_grid(viewer);
if (gridAspect) {
if (gridAspect->DrawMode() == Aspect_GDM_Lines)
m_ui->combo_DrawMode->setCurrentIndex(0);
Expand Down Expand Up @@ -248,7 +248,7 @@ const gp_Ax2& WidgetGrid::toPlaneAxis(int comboBoxItemIndex)

void WidgetGrid::activateGrid(bool on)
{
const Handle_V3d_Viewer& viewer = m_viewPtr->Viewer();
const OccHandle<V3d_Viewer>& viewer = m_viewPtr->Viewer();
if (on) {
viewer->ActivateGrid(
toGridType(m_ui->combo_Type->currentIndex()),
Expand All @@ -269,7 +269,7 @@ void WidgetGrid::applyGridParams()
auto fnCorrectedGridStep = [](double gridStep) {
return !qFuzzyIsNull(gridStep) ? gridStep : 0.01;
};
const Handle_V3d_Viewer& viewer = m_viewPtr->Viewer();
const OccHandle<V3d_Viewer>& viewer = m_viewPtr->Viewer();
auto gridType = toGridType(m_ui->combo_Type->currentIndex());
if (gridType == Aspect_GT_Rectangular) {
viewer->SetRectangularGridValues(
Expand All @@ -295,7 +295,7 @@ void WidgetGrid::applyGridParams()

void WidgetGrid::applyGridGraphicsParams()
{
const Handle_V3d_Viewer& viewer = m_viewPtr->Viewer();
const OccHandle<V3d_Viewer>& viewer = m_viewPtr->Viewer();
auto gridType = toGridType(m_ui->combo_Type->currentIndex());
if (gridType == Aspect_GT_Rectangular) {
viewer->SetRectangularGridGraphicValues(
Expand All @@ -316,7 +316,7 @@ void WidgetGrid::applyGridGraphicsParams()

void WidgetGrid::chooseGridColor(GridColorType colorType)
{
const Handle_V3d_Viewer& viewer = m_viewPtr->Viewer();
const OccHandle<V3d_Viewer>& viewer = m_viewPtr->Viewer();
auto gridColors = GraphicsUtils::V3dViewer_gridColors(viewer);
// Helper function to apply some base/tenth grid color
auto fnApplyGridColor = [=](const Quantity_Color& color) {
Expand Down Expand Up @@ -356,7 +356,7 @@ void WidgetGrid::chooseGridColor(GridColorType colorType)

void WidgetGrid::enableGridColorTenth(bool on)
{
const Handle_V3d_Viewer& viewer = m_viewPtr->Viewer();
const OccHandle<V3d_Viewer>& viewer = m_viewPtr->Viewer();
m_ui->label_ColorTenth->setEnabled(on);
m_ui->btn_ColorTenth->setEnabled(on);
auto gridColors = GraphicsUtils::V3dViewer_gridColors(viewer);
Expand Down
2 changes: 1 addition & 1 deletion src/app/widget_gui_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ WidgetGuiDocument::WidgetGuiDocument(GuiDocument* guiDoc, QWidget* parent)
m_widgetBtns = this->createWidgetPanelContainer(widgetBtnsContents);

auto gfxScene = m_guiDoc->graphicsScene();
gfxScene->signalRedrawRequested.connectSlot([=](const Handle_V3d_View& view) {
gfxScene->signalRedrawRequested.connectSlot([=](const OccHandle<V3d_View>& view) {
if (view == m_qtOccView->v3dView())
m_qtOccView->redraw();
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/widget_occ_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ QWidgetOccView* QWidgetOccView::create(const OccHandle<V3d_View>& view, QWidget*
void QWidgetOccView::showEvent(QShowEvent*)
{
if (this->v3dView()->Window().IsNull()) {
OccHandle<Aspect_Window> hWnd = new OcctWindow(this);
auto hWnd = makeOccHandle<OcctWindow>(this);
this->v3dView()->SetWindow(hWnd);
if (!hWnd->IsMapped())
hWnd->Map();
Expand Down
2 changes: 1 addition & 1 deletion src/app/widget_occ_view_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool QOpenGLWidgetOccView_isCoreProfile()

void QOpenGLWidgetOccView_createOpenGlContext(std::function<void(Aspect_RenderingContext)> fnCallback)
{
OccHandle<OpenGl_Context> glCtx = new OpenGl_Context;
auto glCtx = makeOccHandle<OpenGl_Context>();
if (!glCtx->Init(QOpenGLWidgetOccView_isCoreProfile())) {
Message::SendFail() << "Error: OpenGl_Context is unable to wrap OpenGL context";
return;
Expand Down
5 changes: 3 additions & 2 deletions src/base/brep_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ bool BRepUtils::isGeometric(const TopoDS_Face& face)
}

void BRepUtils::computeMesh(
const TopoDS_Shape& shape, const OccBRepMeshParameters& params, TaskProgress* progress)
const TopoDS_Shape& shape, const OccBRepMeshParameters& params, TaskProgress* progress
)
{
#if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 5, 0)
OccHandle<Message_ProgressIndicator> indicator = new OccProgressIndicator(progress);
auto indicator = makeOccHandle<OccProgressIndicator>(progress);
BRepMesh_IncrementalMesh mesher(shape, params, TKernelUtils::start(indicator));
#else
BRepMesh_IncrementalMesh mesher(shape, params);
Expand Down
2 changes: 1 addition & 1 deletion src/base/brep_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct BRepUtils {
static void addShape(TopoDS_Shape* ptrTargetShape, const TopoDS_Shape& shape);

// Creates a non-geometric TopoDS_Edge wrapping 'polygon'
static TopoDS_Edge makeEdge(const Handle(Poly_Polygon3D)& polygon);
static TopoDS_Edge makeEdge(const OccHandle<Poly_Polygon3D>& polygon);

// Creates a non-geometric TopoDS_Face wrapping triangulation 'mesh'
static TopoDS_Face makeFace(const OccHandle<Poly_Triangulation>& mesh);
Expand Down
6 changes: 2 additions & 4 deletions src/base/string_conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ template<> struct StringConv<std::string_view, TCollection_AsciiString> {
// std::string_view -> Handle(TCollection_HAsciiString)
template<> struct StringConv<std::string_view, OccHandle<TCollection_HAsciiString>> {
static auto to(std::string_view str) {
OccHandle<TCollection_HAsciiString> hnd = new TCollection_HAsciiString(to_OccAsciiString(str));
return hnd;
return makeOccHandle<TCollection_HAsciiString>(to_OccAsciiString(str));
}
};

Expand Down Expand Up @@ -179,8 +178,7 @@ template<> struct StringConv<std::string, TCollection_AsciiString> {
// std::string -> Handle(TCollection_HAsciiString)
template<> struct StringConv<std::string, OccHandle<TCollection_HAsciiString>> {
static auto to(const std::string& str) {
OccHandle<TCollection_HAsciiString> hnd = new TCollection_HAsciiString(str.c_str());
return hnd;
return makeOccHandle<TCollection_HAsciiString>(str.c_str());
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ static void initGui(GuiApplication* guiApp)
return;

guiApp->setAutomaticDocumentMapping(false); // GuiDocument objects aren't needed
setFunctionCreateGraphicsDriver([]() -> OccHandle<Graphic3d_GraphicDriver> {
return new OpenGl_GraphicDriver(GraphicsUtils::AspectDisplayConnection_create());
setFunctionCreateGraphicsDriver([]{
return makeOccHandle<OpenGl_GraphicDriver>(GraphicsUtils::AspectDisplayConnection_create());
});
guiApp->addGraphicsObjectDriver(std::make_unique<GraphicsShapeObjectDriver>());
guiApp->addGraphicsObjectDriver(std::make_unique<GraphicsMeshObjectDriver>());
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/graphics_create_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using FunctionCreateGraphicsDriver = std::function<OccHandle<Graphic3d_GraphicDr
static FunctionCreateGraphicsDriver& getFunctionCreateGraphicsDriver()
{
static FunctionCreateGraphicsDriver fn = []{
return new OpenGl_GraphicDriver(new Aspect_DisplayConnection);
return makeOccHandle<OpenGl_GraphicDriver>(new Aspect_DisplayConnection);
};
return fn;
}
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/graphics_mesh_object_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ GraphicsObjectPtr GraphicsMeshObjectDriver::createObject(const TDF_Label& label)
}

if (polyTri) {
OccHandle<MeshVS_Mesh> object = new MeshVS_Mesh;
auto object = makeOccHandle<MeshVS_Mesh>();
object->SetDataSource(new GraphicsMeshDataSource(polyTri));
// meshVisu->AddBuilder(..., false); -> No selection
if (!spanNodeColor.empty()) {
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/graphics_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Internal {

static OccHandle<V3d_Viewer> createOccViewer()
{
OccHandle<V3d_Viewer> viewer = new V3d_Viewer(graphicsCreateDriver());
auto viewer = makeOccHandle<V3d_Viewer>(graphicsCreateDriver());
viewer->SetDefaultViewSize(1000.);
viewer->SetDefaultViewProj(V3d_XposYnegZpos);
viewer->SetComputedMode(true);
Expand Down Expand Up @@ -176,7 +176,7 @@ void GraphicsScene::redraw()
this->signalRedrawRequested.send(itView.Value());
}

void GraphicsScene::redraw(const Handle_V3d_View& view)
void GraphicsScene::redraw(const OccHandle<V3d_View>& view)
{
if (d->m_isRedrawBlocked)
return;
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/graphics_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GraphicsScene {
void eraseObject(const GraphicsObjectPtr& object);

void redraw();
void redraw(const Handle_V3d_View& view);
void redraw(const OccHandle<V3d_View>& view);
bool isRedrawBlocked() const;
void blockRedraw(bool on);

Expand Down Expand Up @@ -106,7 +106,7 @@ class GraphicsScene {
// Signals
Signal<> signalSelectionChanged;
Signal<> signalSelectionModeChanged;
Signal<const Handle_V3d_View&> signalRedrawRequested;
Signal<const OccHandle<V3d_View>&> signalRedrawRequested;

private:
AIS_InteractiveContext* aisContextPtr() const;
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/graphics_shape_object_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ GraphicsObjectPtr GraphicsShapeObjectDriver::createObject(const TDF_Label& label
object->SetMaterial(Graphic3d_NOM_PLASTER);
object->Attributes()->SetFaceBoundaryDraw(true);
object->Attributes()->SetFaceBoundaryAspect(
new Prs3d_LineAspect(Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.)
new Prs3d_LineAspect(Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.)
);
object->Attributes()->SetIsoOnTriangulation(true);
//object->Attributes()->SetShadingModel(Graphic3d_TypeOfShadingModel_Pbr, true/*overrideDefaults*/);
Expand Down
8 changes: 4 additions & 4 deletions src/graphics/graphics_view_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace Mayo {
// a "redraw requested" signal
class GraphicsViewPtr {
public:
GraphicsViewPtr(GraphicsScene* scene, const Handle_V3d_View& view)
GraphicsViewPtr(GraphicsScene* scene, const OccHandle<V3d_View>& view)
: m_scene(scene),
m_view(view)
{}

const Handle_V3d_View& v3dView() const {
const OccHandle<V3d_View>& v3dView() const {
return m_view;
}

Expand All @@ -34,11 +34,11 @@ class GraphicsViewPtr {
m_scene->redraw(m_view);
}

const Handle_V3d_View& operator->() const { return m_view; }
const OccHandle<V3d_View>& operator->() const { return m_view; }

private:
GraphicsScene* m_scene = nullptr;
Handle_V3d_View m_view;
OccHandle<V3d_View> m_view;
};

} // namespace Mayo
23 changes: 12 additions & 11 deletions src/gui/gui_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace Internal {

static OccHandle<AIS_Trihedron> createOriginTrihedron()
{
OccHandle<Geom_Axis2Placement> axis = new Geom_Axis2Placement(gp::XOY());
OccHandle<AIS_Trihedron> aisTrihedron = new AIS_Trihedron(axis);
auto axis = makeOccHandle<Geom_Axis2Placement>(gp::XOY());
auto aisTrihedron = makeOccHandle<AIS_Trihedron>(axis);
aisTrihedron->SetDatumDisplayMode(Prs3d_DM_WireFrame);
aisTrihedron->SetDrawArrows(false);
aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(2.5);
Expand All @@ -50,7 +50,7 @@ static OccHandle<AIS_Trihedron> createOriginTrihedron()
//aisTrihedron->SetTextColor(Quantity_NOC_GRAY40);
aisTrihedron->SetSize(60);
aisTrihedron->SetTransformPersistence(
new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, axis->Ax2().Location())
new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, axis->Ax2().Location())
);
aisTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost);
aisTrihedron->SetInfiniteState(true);
Expand Down Expand Up @@ -90,13 +90,13 @@ GuiDocument::GuiDocument(const DocumentPtr& doc, GuiApplication* guiApp)
m_v3dView->ChangeRenderingParams().NbMsaaSamples = 4;
m_v3dView->ChangeRenderingParams().CollectedStats = Graphic3d_RenderingParams::PerfCounters_Extended;
m_v3dView->ChangeRenderingParams().StatsPosition = new Graphic3d_TransformPers(
Graphic3d_TMF_2d, Aspect_TOTP_RIGHT_UPPER, Graphic3d_Vec2i(20, 20)
Graphic3d_TMF_2d, Aspect_TOTP_RIGHT_UPPER, Graphic3d_Vec2i(20, 20)
);
// 3D view - Set gradient background
m_v3dView->SetBgGradientColors(
GuiDocument::defaultGradientBackground().color1,
GuiDocument::defaultGradientBackground().color2,
GuiDocument::defaultGradientBackground().fillStyle
GuiDocument::defaultGradientBackground().color1,
GuiDocument::defaultGradientBackground().color2,
GuiDocument::defaultGradientBackground().fillStyle
);
//m_v3dView->SetShadingModel(Graphic3d_TOSM_PBR);

Expand Down Expand Up @@ -419,10 +419,11 @@ void GuiDocument::setViewTrihedronMode(ViewTrihedronMode mode)
aisViewCube->SetFontHeight(12);
aisViewCube->SetAxesLabels("", "", "");
aisViewCube->SetTransformPersistence(
new Graphic3d_TransformPers(
Graphic3d_TMF_TriedronPers,
m_viewTrihedronCorner,
Graphic3d_Vec2i(85, 85))
new Graphic3d_TransformPers(
Graphic3d_TMF_TriedronPers,
m_viewTrihedronCorner,
Graphic3d_Vec2i(85, 85)
)
);
m_gfxScene.addObject(aisViewCube);
//aisViewCube->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_RED2);
Expand Down
4 changes: 2 additions & 2 deletions src/io_dxf/io_dxf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ void DxfReader::Internal::OnReadMText(const Dxf_MTEXT& text)
const gp_Ax3 locText(pt, extDir, xAxisDir);
Font_BRepTextBuilder brepTextBuilder;
#if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 5, 0)
OccHandle<Font_TextFormatter> textFormat = new Font_TextFormatter;
auto textFormat = makeOccHandle<Font_TextFormatter>();
textFormat->SetupAlignment(hAlign, vAlign);
textFormat->Append(occTextStr, *brepFont.FTFont());
/* Font_TextFormatter computes weird ResultWidth() so wrapping is currently broken
Expand Down Expand Up @@ -956,7 +956,7 @@ OccHandle<Geom_BSplineCurve> DxfReader::Internal::createInterpolationSpline(cons
const auto iNumPoints = CppUtils::safeStaticCast<int>(spline.fitPoints.size());

// Handle poles
Handle_TColgp_HArray1OfPnt fitpoints = new TColgp_HArray1OfPnt(1, iNumPoints);
auto fitpoints = makeOccHandle<TColgp_HArray1OfPnt>(1, iNumPoints);
for (const DxfCoords& pnt : spline.fitPoints) {
const auto iPnt = CppUtils::safeStaticCast<int>(&pnt - &spline.fitPoints.front());
fitpoints->ChangeValue(iPnt + 1) = gp_Pnt{pnt.x, pnt.y, pnt.z};
Expand Down
2 changes: 1 addition & 1 deletion src/io_image/io_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ OccHandle<Image_AlienPixMap> ImageWriter::createImage(GuiDocument* guiDoc, const

OccHandle<Image_AlienPixMap> ImageWriter::createImage(OccHandle<V3d_View> view)
{
OccHandle<Image_AlienPixMap> pixmap = new Image_AlienPixMap;
auto pixmap = makeOccHandle<Image_AlienPixMap>();
V3d_ImageDumpOptions dumpOptions;
dumpOptions.BufferType = Graphic3d_BT_RGB;
view->Window()->Size(dumpOptions.Width, dumpOptions.Height);
Expand Down
2 changes: 1 addition & 1 deletion src/io_occ/io_occ_base_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TDF_LabelSequence OccBaseMeshReader::transfer(DocumentPtr doc, TaskProgress* pro
this->applyParameters();
m_reader.SetDocument(doc);
const TDF_LabelSequence seqMark = doc->xcaf().topLevelFreeShapes();
OccHandle<Message_ProgressIndicator> indicator = new OccProgressIndicator(progress);
auto indicator = makeOccHandle<OccProgressIndicator>(progress);
m_reader.Perform(m_filepath.u8string().c_str(), TKernelUtils::start(indicator));
return doc->xcaf().diffTopLevelFreeShapes(seqMark);
}
Expand Down
13 changes: 7 additions & 6 deletions src/io_occ/io_occ_brep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ bool OccBRepReader::readFile(const FilePath& filepath, TaskProgress* progress)
m_shape.Nullify();
m_baseFilename = filepath.stem();
BRep_Builder brepBuilder;
OccHandle<Message_ProgressIndicator> indicator = new OccProgressIndicator(progress);
auto indicator = makeOccHandle<OccProgressIndicator>(progress);
return BRepTools::Read(
m_shape,
filepath.u8string().c_str(),
brepBuilder,
TKernelUtils::start(indicator));
m_shape,
filepath.u8string().c_str(),
brepBuilder,
TKernelUtils::start(indicator)
);
}

TDF_LabelSequence OccBRepReader::transfer(DocumentPtr doc, TaskProgress* /*progress*/)
Expand Down Expand Up @@ -79,7 +80,7 @@ bool OccBRepWriter::transfer(Span<const ApplicationItem> appItems, TaskProgress*

bool OccBRepWriter::writeFile(const FilePath& filepath, TaskProgress* progress)
{
OccHandle<Message_ProgressIndicator> indicator = new OccProgressIndicator(progress);
auto indicator = makeOccHandle<OccProgressIndicator>(progress);
return BRepTools::Write(m_shape, filepath.u8string().c_str(), TKernelUtils::start(indicator));
}

Expand Down
4 changes: 2 additions & 2 deletions src/io_occ/io_occ_caf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool cafGenericReadFile(CafReaderType& reader, const FilePath& filepath, TaskPro
template<typename CafReaderType>
TDF_LabelSequence cafGenericReadTransfer(CafReaderType& reader, DocumentPtr doc, TaskProgress* progress)
{
OccHandle<Message_ProgressIndicator> indicator = new OccProgressIndicator(progress);
auto indicator = makeOccHandle<OccProgressIndicator>(progress);
const TDF_LabelSequence seqMark = doc->xcaf().topLevelFreeShapes();
OccHandle<TDocStd_Document> stdDoc = doc;
#if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 5, 0)
Expand All @@ -53,7 +53,7 @@ TDF_LabelSequence cafGenericReadTransfer(CafReaderType& reader, DocumentPtr doc,
template<typename CafWriterType>
bool cafGenericWriteTransfer(CafWriterType& writer, Span<const ApplicationItem> appItems, TaskProgress* progress)
{
OccHandle<Message_ProgressIndicator> indicator = new OccProgressIndicator(progress);
auto indicator = makeOccHandle<OccProgressIndicator>(progress);
#if OCC_VERSION_HEX < OCC_VERSION_CHECK(7, 5, 0)
Private::cafFinderProcess(writer)->SetProgress(indicator);
auto _ = gsl::finally([&]{ Private::cafFinderProcess(writer)->SetProgress(nullptr); });
Expand Down
2 changes: 1 addition & 1 deletion src/io_occ/io_occ_gltf_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool OccGltfWriter::writeFile(const FilePath& filepath, TaskProgress* progress)
if (!m_document)
return false;

OccHandle<Message_ProgressIndicator> occProgress = new OccProgressIndicator(progress);
auto occProgress = makeOccHandle<OccProgressIndicator>(progress);
const bool isBinary = m_params.format == Format::Binary;
RWGltf_CafWriter writer(filepath.u8string().c_str(), isBinary);
writer.ChangeCoordinateSystemConverter().SetInputCoordinateSystem(m_params.inputCoordinateSystem);
Expand Down
Loading

0 comments on commit 5711be4

Please sign in to comment.