Skip to content

Commit

Permalink
- Fixed an issue that caused landscape inputs to trigger unnecessary …
Browse files Browse the repository at this point in the history
…checkouts when reading landscape data.
  • Loading branch information
dpernuit committed Mar 10, 2023
1 parent 12766f3 commit 51d9107
Showing 1 changed file with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions Source/HoudiniEngine/Private/UnrealLandscapeTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ FUnrealLandscapeTranslator::CreateMeshOrPointsFromLandscape(

if(!FHoudiniEngineUtils::HapiCookNode(InputNodeId, nullptr, true))
return false;
/*
HAPI_CookOptions CookOptions = FHoudiniEngine::GetDefaultCookOptions();
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CookNode(
FHoudiniEngine::Get().GetSession(), InputNodeId, &CookOptions), false);
*/

//--------------------------------------------------------------------------------------------------
// 2. Set the part info
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -263,13 +259,6 @@ FUnrealLandscapeTranslator::CreateMeshOrPointsFromLandscape(
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo(
FHoudiniEngine::Get().GetSession(), DisplayGeoInfo.nodeId), false);

// TODO: Remove me!
/*
HAPI_CookOptions CookOptions = FHoudiniEngine::GetDefaultCookOptions();
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CookNode(
FHoudiniEngine::Get().GetSession(), InputNodeId, &CookOptions), false);
*/

return FHoudiniEngineUtils::HapiCookNode(InputNodeId, nullptr, true);
}

Expand Down Expand Up @@ -498,11 +487,6 @@ FUnrealLandscapeTranslator::CreateHeightfieldFromLandscape(
*/

// Finally, cook the Heightfield node
/*
HAPI_CookOptions CookOptions = FHoudiniEngine::GetDefaultCookOptions();
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CookNode(
FHoudiniEngine::Get().GetSession(), HeightFieldId, &CookOptions), false);
*/
if(!FHoudiniEngineUtils::HapiCookNode(HeightFieldId, nullptr, true))
return false;

Expand Down Expand Up @@ -722,8 +706,9 @@ FUnrealLandscapeTranslator::CreateHeightfieldFromLandscapeComponent(
*/

// Finally, cook the Heightfield node
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CookNode(
FHoudiniEngine::Get().GetSession(), HeightFieldId, nullptr), false);
if (!FHoudiniEngineUtils::HapiCookNode(HeightFieldId, nullptr, true))
return false;

return true;
}

Expand Down Expand Up @@ -968,6 +953,9 @@ FUnrealLandscapeTranslator::GetLandscapeData(

// Extracting the uint16 values from the landscape
FLandscapeEditDataInterface LandscapeEdit(LandscapeInfo);
// Ensure we're not triggering a checkout, as we're just reading data
LandscapeEdit.SetShouldDirtyPackage(false);

HeightData.AddZeroed(XSize * YSize);
LandscapeEdit.GetHeightDataFast(MinX, MinY, MaxX, MaxY, HeightData.GetData(), 0);

Expand Down Expand Up @@ -1198,13 +1186,6 @@ FUnrealLandscapeTranslator::CreateHeightfieldInputNode(

// Cook it
return FHoudiniEngineUtils::HapiCookNode(HeightfieldNodeId, nullptr, true);
/*
HAPI_CookOptions CookOptions = FHoudiniEngine::GetDefaultCookOptions();
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CookNode(
FHoudiniEngine::Get().GetSession(), HeightfieldNodeId, &CookOptions), false);
return true;
*/
}

bool
Expand All @@ -1216,11 +1197,6 @@ FUnrealLandscapeTranslator::SetHeightfieldData(
const FString& HeightfieldName)
{
// Cook the node to get proper infos on it
/*
HAPI_CookOptions CookOptions = FHoudiniEngine::GetDefaultCookOptions();
HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CookNode(
FHoudiniEngine::Get().GetSession(), VolumeNodeId, &CookOptions), false);
*/
if(!FHoudiniEngineUtils::HapiCookNode(VolumeNodeId, nullptr, true))
return false;

Expand Down Expand Up @@ -1455,6 +1431,9 @@ FUnrealLandscapeTranslator::GetLandscapeLayerData(

// extracting the uint8 values from the layer
FLandscapeEditDataInterface LandscapeEdit(LandscapeInfo);
// Ensure we're not triggering a checkout, as we're just reading data
LandscapeEdit.SetShouldDirtyPackage(false);

LayerData.AddZeroed(XSize * YSize);
LandscapeEdit.GetWeightDataFast(LayerInfo, MinX, MinY, MaxX, MaxY, LayerData.GetData(), 0);

Expand Down

0 comments on commit 51d9107

Please sign in to comment.