@@ -409,9 +409,15 @@ SOP_OpenVDB_Combine::cookMySop(OP_Context& context)
409409 UT_String aGridName = aIt.getPrimitiveName (/* default=*/ " A" );
410410 UT_String bGridName = bIt.getPrimitiveName (/* default=*/ " B" );
411411
412+ // Name the output grid after the A grid, except (see below) if the A grid is unused.
413+ UT_String outGridName = aIt.getPrimitiveName ();
414+
412415 hvdb::GridPtr outGrid;
413416
414417 while (true ) {
418+ // If the A grid is unused, name the output grid after the most recent B grid.
419+ if (!needA) outGridName = bIt.getPrimitiveName ();
420+
415421 outGrid = combineGrids (op, aGrid, bGrid, aGridName, bGridName, resample);
416422
417423 // When not flattening, quit after one pass.
@@ -432,9 +438,7 @@ SOP_OpenVDB_Combine::cookMySop(OP_Context& context)
432438 if (outGrid) {
433439 // Add a new VDB primitive for the output grid to the output gdp.
434440 GU_PrimVDB::buildFromGrid (*gdp, outGrid,
435- /* copyAttrsFrom=*/ needA ? aVdb : bVdb,
436- /* copyGridNameFrom=*/ needA ? aGridName.toStdString ().c_str ()
437- : bGridName.toStdString ().c_str ());
441+ /* copyAttrsFrom=*/ needA ? aVdb : bVdb, outGridName);
438442
439443 // Remove the A grid from the output gdp.
440444 if (aVdb) gdp->destroyPrimitive (*aVdb, /* andPoints=*/ true );
@@ -923,7 +927,8 @@ SOP_OpenVDB_Combine::combineGrids(Operation op,
923927 compOp.bGridName = bGridName;
924928 compOp.interrupt = hvdb::Interrupter ();
925929
926- int success = UTvdbProcessTypedGrid (UTvdbGetGridType (needA ? *aGrid : *bGrid), aGrid, compOp);
930+ int success = UTvdbProcessTypedGridTopology (
931+ UTvdbGetGridType (needA ? *aGrid : *bGrid), aGrid, compOp);
927932 if (!success || !compOp.outGrid ) {
928933 std::ostringstream ostr;
929934 ostr << " grids " << aGridName << " and " << bGridName
0 commit comments