Skip to content

Commit 1a64bff

Browse files
committed
- Parameter presets are now only applied upon rebuilding an HDA.
This fixes an issue where changing a parameter just after loading a level would cause parameters to revert to their previous value the first time.
1 parent 4eb61e1 commit 1a64bff

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

Source/HoudiniEngine/Private/HoudiniEngineManager.cpp

+12-13
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC)
856856
// We want to check again for PDG after a rebuild
857857
HAC->bIsPDGAssetLinkInitialized = false;
858858

859-
HAC->MarkAsNeedCook();
859+
//HAC->MarkAsNeedCook();
860860
HAC->SetAssetState(EHoudiniAssetState::PreInstantiation);
861861
break;
862862
}
@@ -1270,29 +1270,28 @@ FHoudiniEngineManager::PreCook(UHoudiniAssetComponent* HAC)
12701270

12711271
if (HAC->HasBeenLoaded() || HAC->IsParameterDefinitionUpdateNeeded())
12721272
{
1273-
bool bPresetSuccess = false;
12741273
if (!HAC->ParameterPresetBuffer.IsEmpty())
12751274
{
1276-
TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::PreCook-SetPreset);
1275+
// Only apply parameters presets for rebuilds, not after a param change
1276+
if (HAC->HasRebuildBeenRequested())
1277+
{
1278+
TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::PreCook-SetPreset);
1279+
FHoudiniEngineUtils::SetAssetPreset(HAC->GetAssetId(), HAC->ParameterPresetBuffer);
1280+
}
12771281

1278-
// If we have stored parameter preset - restore them
1279-
if(FHoudiniEngineUtils::SetAssetPreset(HAC->GetAssetId(), HAC->ParameterPresetBuffer))
1280-
bPresetSuccess = true;
1282+
// We don't want to apply param presets after loading a level
1283+
// Clean it up until next cook
1284+
HAC->ParameterPresetBuffer.Empty();
12811285
}
12821286

1283-
if(!bPresetSuccess)
1287+
// Nothing to do for Node Sync Components!
1288+
if (!HAC->IsA<UHoudiniNodeSyncComponent>())
12841289
{
12851290
// This will sync parameter definitions but not upload values to HAPI or fetch values for existing parameters
12861291
// in Unreal. It will creating missing parameters in Unreal.
12871292
FHoudiniParameterTranslator::UpdateLoadedParameters(HAC);
12881293
HAC->bParameterDefinitionUpdateNeeded = false;
12891294
}
1290-
else
1291-
{
1292-
// We've successfully applied the parameter presets
1293-
// Clean it up until next cook
1294-
HAC->ParameterPresetBuffer.Empty();
1295-
}
12961295
}
12971296

12981297
// Upload the changed/parameters back to HAPI

0 commit comments

Comments
 (0)