From a4086d3a34c11feb1225357cca9b11d99c768bfe Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Tue, 9 Jul 2024 17:41:00 -0400 Subject: [PATCH] - Optimized/delayed calls to UpdateEditorProperties: they are now limited to a maximum of once per component/per manager tick. This reduces unnecessary calls (non selected HDAs) or duplicate calls to the function. - Added extra profiler macros the plugin code. - Wrapped calls to CommitGeo in a FHoudiniEngineUtils function that automates scoped profiling. --- .../HoudiniEngine/Private/HoudiniEngine.cpp | 10 ++- .../Private/HoudiniEngineManager.cpp | 29 ++++-- .../Private/HoudiniEngineUtils.cpp | 21 +++++ .../Private/HoudiniEngineUtils.h | 3 + .../Private/HoudiniInputTranslator.cpp | 89 +++++++++++++++++-- .../HoudiniLandscapeSplineTranslator.cpp | 3 +- .../Private/HoudiniOutputTranslator.cpp | 7 +- .../Private/HoudiniParameterTranslator.cpp | 62 ++++++++----- .../Private/HoudiniSplineTranslator.cpp | 6 +- .../Private/UnrealAnimationTranslator.cpp | 17 +--- .../Private/UnrealBrushTranslator.cpp | 2 +- .../Private/UnrealDataTableTranslator.cpp | 5 +- .../Private/UnrealFoliageTypeTranslator.cpp | 6 +- .../UnrealGeometryCollectionTranslator.cpp | 9 +- .../Private/UnrealInstanceTranslator.cpp | 3 +- .../UnrealLandscapeSplineTranslator.cpp | 4 +- .../Private/UnrealLandscapeTranslator.cpp | 31 ++----- .../Private/UnrealLevelInstanceTranslator.cpp | 12 +-- .../Private/UnrealMeshTranslator.cpp | 28 +++--- .../Private/UnrealObjectInputUtils.cpp | 4 + .../Private/UnrealSkeletalMeshTranslator.cpp | 12 +-- .../Private/UnrealSplineTranslator.cpp | 2 +- .../Private/HoudiniAssetComponent.cpp | 5 +- .../Private/HoudiniAssetComponent.h | 5 ++ .../Private/HoudiniLandscapeRuntimeUtils.cpp | 2 + 25 files changed, 248 insertions(+), 129 deletions(-) diff --git a/Source/HoudiniEngine/Private/HoudiniEngine.cpp b/Source/HoudiniEngine/Private/HoudiniEngine.cpp index 8cd0e696ad..2371ce66d0 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngine.cpp +++ b/Source/HoudiniEngine/Private/HoudiniEngine.cpp @@ -1423,6 +1423,8 @@ FHoudiniEngine::FinishTaskSlateNotification(const FText& InText) bool FHoudiniEngine::UpdateCookingNotification(const FText& InText, const bool bExpireAndFade) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngine::UpdateCookingNotification); + #if WITH_EDITOR TimeSinceLastPersistentNotification = 0.0; @@ -1445,13 +1447,17 @@ bool FHoudiniEngine::UpdateCookingNotification(const FText& InText, const bool b if (HoudiniBrush.IsValid()) Info.Image = HoudiniBrush.Get(); - - CookingNotificationPtr = FSlateNotificationManager::Get().AddNotification(Info); + { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngine::UpdateCookingNotification__AddNotification); + CookingNotificationPtr = FSlateNotificationManager::Get().AddNotification(Info); + } } TSharedPtr NotificationItem = CookingNotificationPtr.Pin(); if (NotificationItem.IsValid()) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngine::UpdateCookingNotification__UpdateNotification); + // Update the persistent notification. NotificationItem->SetText(InText); diff --git a/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp b/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp index 3c0a05ae11..17c1b1e30c 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp +++ b/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp @@ -354,6 +354,15 @@ FHoudiniEngineManager::Tick(float DeltaTime) // Update the tick time for this component CurrentComponent->LastTickTime = dNow; } + + // See if we need to update this HDA's details panel + if (CurrentComponent->bNeedToUpdateEditorProperties) + { + // Only do an update if the HAC is selected + if(CurrentComponent->IsOwnerSelected()) + FHoudiniEngineUtils::UpdateEditorProperties(true); + CurrentComponent->bNeedToUpdateEditorProperties = false; + } } // Handle Asset delete @@ -483,7 +492,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) { // Trigger a details panel update if the Houdini asset actor is selected if (HAC->IsOwnerSelected()) - FHoudiniEngineUtils::UpdateEditorProperties(true); + HAC->bNeedToUpdateEditorProperties = true; // Finished refreshing UI of one HDA. FHoudiniEngine::Get().RefreshUIDisplayedWhenPauseCooking(); @@ -652,7 +661,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) if(!bCookStarted) { // Just refresh editor properties? - FHoudiniEngineUtils::UpdateEditorProperties(true); + HAC->bNeedToUpdateEditorProperties = true; // TODO: Check! update state? HAC->SetAssetState(EHoudiniAssetState::None); @@ -881,6 +890,8 @@ FHoudiniEngineManager::StartTaskAssetInstantiation(UHoudiniAsset* HoudiniAsset, bool FHoudiniEngineManager::UpdateInstantiating(UHoudiniAssetComponent* HAC, EHoudiniAssetState& NewState ) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::UpdateInstantiating); + check(HAC); // Will return true if the asset's state need to be updated @@ -1059,6 +1070,8 @@ FHoudiniEngineManager::StartTaskAssetCooking( bool bOutputTemplateGeos, FGuid& OutTaskGUID) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::StartTaskAssetCooking); + // Make sure we have a valid session before attempting anything if (!FHoudiniEngine::Get().GetSession()) return false; @@ -1294,8 +1307,8 @@ FHoudiniEngineManager::PostCook(UHoudiniAssetComponent* HAC, const bool& bSucces FHoudiniEngine::Get().UpdateCookingNotification(FText::FromString(DisplayName + " :\nFinished processing outputs"), true); - // Trigger a details panel update - FHoudiniEngineUtils::UpdateEditorProperties(true); + // Indicate we want to trigger a details panel update + HAC->bNeedToUpdateEditorProperties = true; // If any outputs have HoudiniStaticMeshes, and if timer based refinement is enabled on the HAC, // set the RefineMeshesTimer and ensure BuildStaticMeshesForAllHoudiniStaticMeshes is bound to @@ -1328,8 +1341,8 @@ FHoudiniEngineManager::PostCook(UHoudiniAssetComponent* HAC, const bool& bSucces if (bNeedsToTriggerViewportUpdate && GEditor) { - // We need to manually update the vieport with HoudiniMeshProxies - // if not, modification made in H with the two way debugger wont be visible in Unreal until the vieports gets focus + // We need to manually update the viewport with HoudiniMeshProxies + // if not, modification made in H with the two way debugger wont be visible in Unreal until the viewports gets focus GEditor->RedrawAllViewports(false); } @@ -1361,6 +1374,8 @@ FHoudiniEngineManager::UpdateProcess(UHoudiniAssetComponent* HAC) bool FHoudiniEngineManager::StartTaskAssetRebuild(const HAPI_NodeId& InAssetId, FGuid& OutTaskGUID) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::StartTaskAssetRebuild); + // Check this HAC doesn't already have a running task if (OutTaskGUID.IsValid()) return false; @@ -1389,6 +1404,8 @@ FHoudiniEngineManager::StartTaskAssetRebuild(const HAPI_NodeId& InAssetId, FGuid bool FHoudiniEngineManager::StartTaskAssetDelete(const HAPI_NodeId& InNodeId, FGuid& OutTaskGUID, bool bShouldDeleteParent) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::StartTaskAssetDelete); + if (InNodeId < 0) return false; diff --git a/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp b/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp index 01392bbf9c..75532428ab 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp +++ b/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp @@ -1653,6 +1653,8 @@ FHoudiniEngineUtils::LocateLibHAPIInRegistry( bool FHoudiniEngineUtils::LoadHoudiniAsset(const UHoudiniAsset * HoudiniAsset, HAPI_AssetLibraryId& OutAssetLibraryId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::LoadHoudiniAsset); + OutAssetLibraryId = -1; if (!IsValid(HoudiniAsset)) @@ -2326,6 +2328,8 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( const bool bOutputTemplatedGeos, TArray& OutOutputNodes) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs); + OutOutputNodes.Empty(); // Ensure the asset has a valid node ID @@ -2978,6 +2982,8 @@ FHoudiniEngineUtils::ConvertHoudiniRotEulerToUnrealVector(const TArray& I bool FHoudiniEngineUtils::UploadHACTransform(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::UploadHACTransform); + if (!HAC || !HAC->bUploadTransformsToHoudiniEngine) return false; @@ -3196,6 +3202,8 @@ FHoudiniEngineUtils::UpdateEditorProperties(const bool bInForceFullUpdate) void FHoudiniEngineUtils::UpdateBlueprintEditor(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::UpdateBlueprintEditor); + if (!IsInGameThread()) { // We need to be in the game thread to trigger editor properties update @@ -3214,6 +3222,8 @@ void FHoudiniEngineUtils::UpdateBlueprintEditor(UHoudiniAssetComponent* HAC) void FHoudiniEngineUtils::UpdateEditorProperties_Internal(const bool bInForceFullUpdate) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::UpdateEditorProperties_Internal); + #if WITH_EDITOR #define HOUDINI_USE_DETAILS_FOCUS_HACK 1 @@ -6928,6 +6938,8 @@ FHoudiniEngineUtils::CreateNode( const HAPI_Bool& bInCookOnCreation, HAPI_NodeId* OutNewNodeId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::CreateNode); + // Call HAPI::CreateNode HAPI_Result Result = FHoudiniApi::CreateNode( FHoudiniEngine::Get().GetSession(), @@ -7725,6 +7737,13 @@ FHoudiniEngineUtils::MoveActorToLevel(AActor* InActor, ULevel* InDesiredLevel) return true; } +HAPI_Result +FHoudiniEngineUtils::HapiCommitGeo(const HAPI_NodeId& InNodeId) +{ + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::HapiCommitGeo); + return FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), InNodeId); +} + bool FHoudiniEngineUtils::HapiCookNode(const HAPI_NodeId& InNodeId, HAPI_CookOptions* InCookOptions, const bool& bWaitForCompletion) { @@ -7784,6 +7803,8 @@ FHoudiniEngineUtils::HapiCookNode(const HAPI_NodeId& InNodeId, HAPI_CookOptions* HAPI_Result FHoudiniEngineUtils::CreateInputNode(const FString& InNodeLabel, HAPI_NodeId& OutNodeId, const int32 InParentNodeId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::CreateInputNode); + HAPI_NodeId NodeId = -1; HAPI_Session const* const Session = FHoudiniEngine::Get().GetSession(); diff --git a/Source/HoudiniEngine/Private/HoudiniEngineUtils.h b/Source/HoudiniEngine/Private/HoudiniEngineUtils.h index be7c36130f..6b97529fa8 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngineUtils.h +++ b/Source/HoudiniEngine/Private/HoudiniEngineUtils.h @@ -98,6 +98,9 @@ struct HOUDINIENGINE_API FHoudiniEngineUtils // if bWaitForCompletion is true, this call will be blocking until the cook is finished static bool HapiCookNode(const HAPI_NodeId& InNodeId, HAPI_CookOptions* InCookOptions = nullptr, const bool& bWaitForCompletion = false); + // Wrapper for CommitGeo - adds a profiler scope wrapper + static HAPI_Result HapiCommitGeo(const HAPI_NodeId& InNodeId); + // Return a specified HAPI status string. static const FString GetStatusString(HAPI_StatusType status_type, HAPI_StatusVerbosity verbosity); diff --git a/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp index 4eb4f1f505..d042004ca4 100755 --- a/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp @@ -401,6 +401,8 @@ FHoudiniInputTranslator::BuildAllInputs( bool FHoudiniInputTranslator::DisconnectInput(UHoudiniInput* InputToDestroy, const EHoudiniInputType& InputType) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::DisconnectInput); + if (!IsValid(InputToDestroy)) return false; @@ -434,6 +436,8 @@ FHoudiniInputTranslator::DisconnectInput(UHoudiniInput* InputToDestroy, const EH bool FHoudiniInputTranslator::DestroyInputNodes(UHoudiniInput* InputToDestroy, const EHoudiniInputType& InputType) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::DestroyInputNodes); + if (!IsValid(InputToDestroy)) return false; @@ -628,6 +632,8 @@ FHoudiniInputTranslator::GetDefaultInputTypeFromLabel(const FString& InputName) bool FHoudiniInputTranslator::ChangeInputType(UHoudiniInput* InInput, const bool& bForce) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::ChangeInputType); + if (!IsValid(InInput)) return false; @@ -759,6 +765,8 @@ FHoudiniInputTranslator::SetDefaultAssetFromHDA(UHoudiniInput* Input, bool& bOut bool FHoudiniInputTranslator::UploadChangedInputs(UHoudiniAssetComponent * HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UploadChangedInputs); + if (!IsValid(HAC)) return false; @@ -854,6 +862,8 @@ FHoudiniInputTranslator::UploadChangedInputs(UHoudiniAssetComponent * HAC) bool FHoudiniInputTranslator::UpdateInputProperties(UHoudiniInput* InInput) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UpdateInputProperties); + bool bSucess = UpdateTransformType(InInput); bSucess &= UpdatePackBeforeMerge(InInput); @@ -1040,6 +1050,8 @@ FHoudiniInputTranslator::UpdateTransformOffset(UHoudiniInput* InInput) bool FHoudiniInputTranslator::UploadInputData(UHoudiniInput* InInput, const FTransform & InActorTransform) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UploadInputData); + if (!IsValid(InInput)) return false; @@ -1258,6 +1270,8 @@ FHoudiniInputTranslator::UploadInputData(UHoudiniInput* InInput, const FTransfor bool FHoudiniInputTranslator::UploadInputTransform(UHoudiniInput* InInput) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UploadInputTransform); + if (!IsValid(InInput)) return false; @@ -1335,6 +1349,8 @@ FHoudiniInputTranslator::UploadHoudiniInputObject( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UploadHoudiniInputObject); + if (!InInput || !InInputObject) return false; @@ -1967,6 +1983,8 @@ FHoudiniInputTranslator::UploadHoudiniInputTransform( bool FHoudiniInputTranslator::HapiCreateInputNodeForObject(const FString& InObjNodeName, UHoudiniInputObject* InObject) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForObject); + if (!InObject) return false; @@ -2052,8 +2070,7 @@ FHoudiniInputTranslator::HapiCreateInputNodeForObject(const FString& InObjNodeNa } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), InputNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InputNodeId), false); return true; } @@ -2088,6 +2105,8 @@ FHoudiniInputTranslator::HapiCreateOrUpdateGeoObjectMergeAndSetTransform( const FTransform& InTransform, const int32& InTransformType) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateOrUpdateGeoObjectMergeAndSetTransform); + if (!FHoudiniEngineUtils::IsHoudiniNodeValid(InNodeToObjectMerge)) return false; @@ -2159,6 +2178,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForStaticMesh( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForStaticMesh); + if (!IsValid(InObject)) return false; @@ -2268,6 +2289,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForReference( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForReference); + if (!IsValid(InObject)) return false; @@ -2331,6 +2354,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForActorReference( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForActorReference); + if (!IsValid(InActorObject)) return false; @@ -2832,8 +2857,7 @@ FHoudiniInputTranslator::HapiCreateInputNodeForActorReference( } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NewNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NewNodeId), false); FUnrealObjectInputHandle OutHandle; { @@ -2870,6 +2894,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForAnimation( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForAnimation); + if (!IsValid(InObject)) return false; @@ -2965,6 +2991,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForSkeletalMesh( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForSkeletalMesh); + if (!IsValid(InObject)) return false; @@ -3054,6 +3082,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForSkeletalMeshComponent( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForSkeletalMeshComponent); + if (!IsValid(InObject)) return false; @@ -3226,6 +3256,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForGeometryCollection( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForGeometryCollection); + if (!IsValid(InObject)) return false; @@ -3333,6 +3365,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForGeometryCollectionComponent( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForGeometryCollectionComponent); + if (!IsValid(InObject)) return false; @@ -3442,6 +3476,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForSceneComponent( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForSceneComponent); + if (!IsValid(InObject)) return false; @@ -3471,6 +3507,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForStaticMeshComponent( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForStaticMeshComponent); + if (!IsValid(InObject)) return false; @@ -3674,6 +3712,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForSplineMeshComponents( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForSplineMeshComponents); + if (!IsValid(InParentActorObject)) return false; @@ -3811,6 +3851,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForInstancedStaticMeshComponent( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForInstancedStaticMeshComponent); + if (!IsValid(InObject)) return false; @@ -3870,6 +3912,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForSplineComponent( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForSplineComponent); + if (!IsValid(InObject)) return false; @@ -3912,6 +3956,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForHoudiniSplineComponent( UHoudiniInputHoudiniSplineComponent* InObject, const FHoudiniInputObjectSettings& InInputSettings) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForHoudiniSplineComponent); + if (!IsValid(InObject)) return false; @@ -3948,6 +3994,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForHoudiniAssetComponent( UHoudiniInputHoudiniAsset* InObject, const FHoudiniInputObjectSettings& InInputSettings) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForHoudiniAssetComponent); + if (!IsValid(InObject)) return false; @@ -4078,6 +4126,8 @@ FHoudiniInputTranslator::HapiCreateInputNodesForActorComponents( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodesForActorComponents); + if (!IsValid(InInput)) return false; @@ -4129,7 +4179,7 @@ FHoudiniInputTranslator::HapiCreateInputNodesForActorComponents( // Commit the geo if needed if(bNeedCommit) - FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), CurComponent->GetInputNodeId()); + FHoudiniEngineUtils::HapiCommitGeo(CurComponent->GetInputNodeId()); } else { @@ -4174,6 +4224,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForActor( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForActor); + if (!IsValid(InInput)) return false; @@ -4283,6 +4335,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForBP( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForBP); + if (!IsValid(InInput)) return false; @@ -4358,6 +4412,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForLandscapeSplinesComponent( TSet& OutHandles, const bool bInInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForLandscapeSplinesComponent); + if (!IsValid(InObject)) return false; @@ -4435,6 +4491,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForLevelInstance( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForLevelInstance); + if (!IsValid(InObject) || !IsValid(InInput)) return false; @@ -4507,6 +4565,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForPackedLevelActor( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForPackedLevelActor); + if (!IsValid(InObject) || !IsValid(InInput)) return false; @@ -4582,6 +4642,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForLandscape( TSet& OutHandles, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForLandscape); + if (!IsValid(InObject)) return false; @@ -4635,6 +4697,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForBrush( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForBrush); + if (!IsValid(InObject)) return false; @@ -4670,6 +4734,8 @@ bool FHoudiniInputTranslator::HapiCreateInputNodeForCamera( const FString& InNodeName, UHoudiniInputCameraComponent* InInputObject, const FHoudiniInputObjectSettings& InInputSettings) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForCamera); + if (!IsValid(InInputObject)) return false; @@ -4728,6 +4794,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForCamera( bool FHoudiniInputTranslator::UpdateLoadedInputs(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UpdateLoadedInputs); + if (!IsValid(HAC)) return false; @@ -4761,6 +4829,8 @@ FHoudiniInputTranslator::UpdateLoadedInputs(UHoudiniAssetComponent* HAC) bool FHoudiniInputTranslator::UpdateWorldInputs(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UpdateWorldInputs); + if (!IsValid(HAC)) return false; @@ -5206,8 +5276,7 @@ FHoudiniInputTranslator::CreateInputNodeForReference( } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NewNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NewNodeId), false); InputNodeId = NewNodeId; return true; @@ -5226,6 +5295,8 @@ bool FHoudiniInputTranslator::CreateInputNodeForReference( const bool& bImportAsReferenceMaterialEnabled, const TArray& MaterialReferences) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::CreateInputNodeForReference); + // The identifier to the node in the input system FString FinalInputNodeName = InputNodeName; HAPI_NodeId ParentNodeId = -1; @@ -5302,6 +5373,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForDataTable( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForDataTable); + if (!IsValid(InInputObject)) return false; @@ -5367,6 +5440,8 @@ FHoudiniInputTranslator::HapiCreateInputNodeForFoliageType_InstancedStaticMesh( const FHoudiniInputObjectSettings& InInputSettings, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::HapiCreateInputNodeForFoliageType_InstancedStaticMesh); + if (!IsValid(InObject)) return false; diff --git a/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp index cc05c08937..a7c3950015 100644 --- a/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp @@ -408,7 +408,8 @@ FHoudiniLandscapeSplineTranslator::ProcessLandscapeSplineOutput( // saves the level. InOutput->MarkPackageDirty(); - FHoudiniEngineUtils::UpdateEditorProperties(true); + if(IsValid(HAC) && HAC->IsOwnerSelected()) + HAC->bNeedToUpdateEditorProperties = true; return true; } diff --git a/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp index ec756c2522..8d7d841d0c 100755 --- a/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp @@ -787,6 +787,8 @@ FHoudiniOutputTranslator::BuildStaticMeshesOnHoudiniProxyMeshOutputs(UHoudiniAss bool FHoudiniOutputTranslator::UpdateLoadedOutputs(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniOutputTranslator::UpdateLoadedOutputs); + HAPI_NodeId & AssetId = HAC->AssetId; // Retrieve information about each object contained within our asset. @@ -1002,6 +1004,8 @@ FHoudiniOutputTranslator::UploadChangedEditableOutput( UHoudiniAssetComponent* HAC, const bool& bInForceUpdate) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniOutputTranslator::UploadChangedEditableOutput); + if (!IsValid(HAC)) return false; @@ -2273,10 +2277,11 @@ FHoudiniOutputTranslator::BuildAllOutputs( bool FHoudiniOutputTranslator::UpdateChangedOutputs(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniOutputTranslator::UpdateChangedOutputs); + if (!IsValid(HAC)) return false; - UObject* OuterComponent = HAC; FHoudiniPackageParams PackageParams; diff --git a/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp index c8dbcaa536..1f8ad51514 100755 --- a/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp @@ -104,8 +104,8 @@ FHoudiniParameterTranslator::UpdateParameters(UHoudiniAssetComponent* HAC) // Replace with the new parameters HAC->Parameters = NewParameters; - // Update the details panel after the parameter changes/updates - FHoudiniEngineUtils::UpdateEditorProperties(true); + // Indicate we want to update the details panel after the parameter changes/updates + HAC->bNeedToUpdateEditorProperties = true; } @@ -115,6 +115,8 @@ FHoudiniParameterTranslator::UpdateParameters(UHoudiniAssetComponent* HAC) bool FHoudiniParameterTranslator::OnPreCookParameters(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::OnPreCookParameters); + // Call OnPreCook for all parameters. // Parameters can use this to ensure that any cached / non-cooking state is properly // synced before the cook starts (Looking at you, ramp parameters!) @@ -133,6 +135,8 @@ FHoudiniParameterTranslator::OnPreCookParameters(UHoudiniAssetComponent* HAC) bool FHoudiniParameterTranslator::UpdateLoadedParameters(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateLoadedParameters); + if (!IsValid(HAC)) return false; @@ -212,8 +216,8 @@ FHoudiniParameterTranslator::UpdateLoadedParameters(UHoudiniAssetComponent* HAC) // Simply replace with the new parameters HAC->Parameters = NewParameters; - // Update the details panel after the parameter changes/updates - FHoudiniEngineUtils::UpdateEditorProperties(true); + // Indicate we want to update the details panel after the parameter changes/updates + HAC->bNeedToUpdateEditorProperties = true; } return true; @@ -230,6 +234,8 @@ FHoudiniParameterTranslator::BuildAllParameters( const UHoudiniAsset* InHoudiniAsset, const FString& InHoudiniAssetName) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::BuildAllParameters); + // Ensure the asset has a valid node ID const bool bIsAssetValid = IsValid(InHoudiniAsset); if (AssetId < 0 && !bIsAssetValid) @@ -1310,6 +1316,8 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( const TArray* DefaultStringValues, const TArray* DefaultChoiceValues) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo); + if (!IsValid(HoudiniParameter)) return false; @@ -1377,6 +1385,8 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( || ParmType == EHoudiniParameterType::Toggle || ParmType == EHoudiniParameterType::Color)) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Expr); + // See if the parm has an expression int32 TupleIdx = ParmInfo.intValuesIndex; bool bHasExpression = false; @@ -1418,6 +1428,8 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( // Get parameter tags. if (bHasValidNodeId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Tags); + int32 TagCount = HoudiniParameter->GetTagCount(); for (int32 Idx = 0; Idx < TagCount; ++Idx) { @@ -1460,6 +1472,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( { case EHoudiniParameterType::Button: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Button); UHoudiniParameterButton* HoudiniParameterButton = Cast(HoudiniParameter); if (IsValid(HoudiniParameterButton)) { @@ -1470,6 +1483,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::ButtonStrip: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__ButtonStrip); UHoudiniParameterButtonStrip* HoudiniParameterButtonStrip = Cast(HoudiniParameter); if (IsValid(HoudiniParameterButtonStrip)) { @@ -1547,6 +1561,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Color: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Color); UHoudiniParameterColor* HoudiniParameterColor = Cast(HoudiniParameter); if (IsValid(HoudiniParameterColor)) { @@ -1594,6 +1609,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::ColorRamp: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__ColorRamp); UHoudiniParameterRampColor* HoudiniParameterRampColor = Cast(HoudiniParameter); if (IsValid(HoudiniParameterRampColor)) { @@ -1604,6 +1620,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( break; case EHoudiniParameterType::FloatRamp: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__FloatRamp); UHoudiniParameterRampFloat* HoudiniParameterRampFloat = Cast(HoudiniParameter); if (IsValid(HoudiniParameterRampFloat)) { @@ -1618,6 +1635,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::FileGeo: case EHoudiniParameterType::FileImage: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Files); UHoudiniParameterFile* HoudiniParameterFile = Cast(HoudiniParameter); if (IsValid(HoudiniParameterFile)) { @@ -1702,6 +1720,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Float: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Float); UHoudiniParameterFloat* HoudiniParameterFloat = Cast(HoudiniParameter); if (IsValid(HoudiniParameterFloat)) { @@ -1866,6 +1885,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Folder: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Folder); UHoudiniParameterFolder* HoudiniParameterFolder = Cast(HoudiniParameter); if (IsValid(HoudiniParameterFolder)) { @@ -1878,6 +1898,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::FolderList: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__FolderList); UHoudiniParameterFolderList* HoudiniParameterFolderList = Cast(HoudiniParameter); if (IsValid(HoudiniParameterFolderList)) { @@ -1889,30 +1910,14 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Input: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Input); // Inputs parameters are just stored, and handled separately by UHoudiniInputs UHoudiniParameterOperatorPath* HoudiniParameterOperatorPath = Cast(HoudiniParameter); if (IsValid(HoudiniParameterOperatorPath)) { - /* // DO NOT CREATE A DUPLICATE INPUT HERE! // Inputs are created by the input translator, and will be tied to this parameter there - UHoudiniInput * NewInput = NewObject< UHoudiniInput >( - HoudiniParameterOperatorPath, - UHoudiniInput::StaticClass()); - - UHoudiniAssetComponent *ParentHAC = Cast(HoudiniParameterOperatorPath->GetOuter()); - if (!ParentHAC) - return false; - - if (!IsValid(NewInput)) - return false; - - // Set the nodeId - NewInput->SetAssetNodeId(ParentHAC->GetAssetId()); - NewInput->SetInputType(EHoudiniInputType::Geometry); - HoudiniParameterOperatorPath->HoudiniInputs.Add(NewInput); - */ // Set the valueIndex HoudiniParameterOperatorPath->SetValueIndex(ParmInfo.stringValuesIndex); } @@ -1921,6 +1926,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Int: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Int); UHoudiniParameterInt* HoudiniParameterInt = Cast(HoudiniParameter); if (IsValid(HoudiniParameterInt)) { @@ -2041,6 +2047,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::IntChoice: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__IntChoice); UHoudiniParameterChoice* HoudiniParameterIntChoice = Cast(HoudiniParameter); if (IsValid(HoudiniParameterIntChoice)) { @@ -2169,6 +2176,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::StringChoice: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__StringChoice); UHoudiniParameterChoice* HoudiniParameterStringChoice = Cast(HoudiniParameter); if (IsValid(HoudiniParameterStringChoice)) { @@ -2280,6 +2288,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Label: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Label); UHoudiniParameterLabel* HoudiniParameterLabel = Cast(HoudiniParameter); if (IsValid(HoudiniParameterLabel)) { @@ -2330,6 +2339,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::MultiParm: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__MultiParm); UHoudiniParameterMultiParm* HoudiniParameterMulti = Cast(HoudiniParameter); if (IsValid(HoudiniParameterMulti)) { @@ -2372,6 +2382,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Separator: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Sep); UHoudiniParameterSeparator* HoudiniParameterSeparator = Cast(HoudiniParameter); if (IsValid(HoudiniParameterSeparator)) { @@ -2388,6 +2399,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::String: case EHoudiniParameterType::StringAssetRef: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__String); UHoudiniParameterString* HoudiniParameterString = Cast(HoudiniParameter); if (IsValid(HoudiniParameterString)) { @@ -2457,6 +2469,7 @@ FHoudiniParameterTranslator::UpdateParameterFromInfo( case EHoudiniParameterType::Toggle: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UpdateParameterFromInfo__Toggle); UHoudiniParameterToggle* HoudiniParameterToggle = Cast(HoudiniParameter); if (IsValid(HoudiniParameterToggle)) { @@ -2669,6 +2682,7 @@ FHoudiniParameterTranslator::UploadChangedParameters( UHoudiniAssetComponent * H bool FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue); if (!IsValid(InParam)) return false; @@ -2896,6 +2910,8 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) bool FHoudiniParameterTranslator::RevertParameterToDefault(UHoudiniParameter* InParam) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::RevertParameterToDefault); + if (!IsValid(InParam)) return false; @@ -2983,6 +2999,8 @@ bool FHoudiniParameterTranslator::SyncMultiParmValuesAtLoad( UHoudiniParameter* InParam, TArray& OldParams, const int32& InAssetId, const HAPI_AssetInfo& AssetInfo) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::SyncMultiParmValuesAtLoad); + UHoudiniParameterMultiParm* MultiParam = Cast(InParam); if (!IsValid(MultiParam)) return false; @@ -3418,6 +3436,8 @@ FHoudiniParameterTranslator::GetMultiParmInstanceStartIdx(const HAPI_AssetInfo& bool FHoudiniParameterTranslator::RevertRampParameters(TMap & InRampParams, const int32 & AssetId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::RevertRampParameters); + if (InRampParams.Num() <= 0) return true; diff --git a/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp index 41cecac129..10e516f126 100755 --- a/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp @@ -439,6 +439,8 @@ FHoudiniSplineTranslator::HapiUpdateNodeForHoudiniSplineComponent( UHoudiniSplineComponent* HoudiniSplineComponent, bool bInAddRotAndScaleAttributes) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniSplineTranslator::HapiUpdateNodeForHoudiniSplineComponent); + if (!IsValid(HoudiniSplineComponent)) return true; @@ -1434,8 +1436,7 @@ FHoudiniSplineTranslator::HapiCreateCurveInputNodeForDataLegacy( } // Finally, commit the geo ... - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), CurveNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(CurveNodeId), false); // And cook it with refinement enabled CookOptions.refineCurveToLinear = true; @@ -2227,6 +2228,7 @@ FHoudiniSplineTranslator::CreateAllSplinesFromHoudiniOutput(UHoudiniOutput* InOu InOutput->SetOutputObjects(NewOutputObjects); + // TODO: remove and delay editor propreties update FHoudiniEngineUtils::UpdateEditorProperties(true); return true; diff --git a/Source/HoudiniEngine/Private/UnrealAnimationTranslator.cpp b/Source/HoudiniEngine/Private/UnrealAnimationTranslator.cpp index 58ecfb3c2a..ca25106e63 100644 --- a/Source/HoudiniEngine/Private/UnrealAnimationTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealAnimationTranslator.cpp @@ -186,8 +186,7 @@ FUnrealAnimationTranslator::HapiCreateInputNodeForAnimation( if (FUnrealAnimationTranslator::SetAnimationDataOnNode(Animation, NewNodeId)) { // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NewNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NewNodeId), false); //Create Output Node HAPI_NodeId OutputNodeId; @@ -306,24 +305,12 @@ FUnrealAnimationTranslator::HapiCreateInputNodeForAnimation( } // Connect output to detail wrangle (build_clipinfo) - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::ConnectNodeInput( FHoudiniEngine::Get().GetSession(), OutputNodeId, 0, DetailWrangleNodeId, 0), false); - //HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - // FHoudiniEngine::Get().GetSession(), AttribWrangleNodeId), false); - - //HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - // FHoudiniEngine::Get().GetSession(), PackNodeId), false); - - //HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - // FHoudiniEngine::Get().GetSession(), OutputNodeId), false); - - FHoudiniEngineUtils::HapiCookNode(AttribWrangleNodeId, nullptr, true); FHoudiniEngineUtils::HapiCookNode(PackNodeId, nullptr, true); - } { @@ -332,8 +319,6 @@ FUnrealAnimationTranslator::HapiCreateInputNodeForAnimation( OutHandle = Handle; } - - return true; } diff --git a/Source/HoudiniEngine/Private/UnrealBrushTranslator.cpp b/Source/HoudiniEngine/Private/UnrealBrushTranslator.cpp index 2af1e9ef9d..074917cb59 100755 --- a/Source/HoudiniEngine/Private/UnrealBrushTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealBrushTranslator.cpp @@ -445,7 +445,7 @@ bool FUnrealBrushTranslator::CreateInputNodeForBrush( return false; } - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), InputNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InputNodeId), false); { FUnrealObjectInputHandle Handle; diff --git a/Source/HoudiniEngine/Private/UnrealDataTableTranslator.cpp b/Source/HoudiniEngine/Private/UnrealDataTableTranslator.cpp index 6d84da5ce6..bf75df6655 100644 --- a/Source/HoudiniEngine/Private/UnrealDataTableTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealDataTableTranslator.cpp @@ -808,10 +808,7 @@ bool FUnrealDataTableTranslator::CreateInputNodeForDataTable( } } - - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), InputNodeId), false); - + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InputNodeId), false); if (!FHoudiniEngineUtils::HapiCookNode(InputNodeId, nullptr, true)) return false; diff --git a/Source/HoudiniEngine/Private/UnrealFoliageTypeTranslator.cpp b/Source/HoudiniEngine/Private/UnrealFoliageTypeTranslator.cpp index 556b9abffd..c3e42439bd 100755 --- a/Source/HoudiniEngine/Private/UnrealFoliageTypeTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealFoliageTypeTranslator.cpp @@ -78,8 +78,7 @@ FUnrealFoliageTypeTranslator::HapiCreateInputNodeForFoliageType_InstancedStaticM const int32 PartId = 0; CreateHoudiniFoliageTypeAttributes(InFoliageType, InputObjectNodeId, PartId, HAPI_ATTROWNER_DETAIL); - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), InputObjectNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InputObjectNodeId), false); } return bSuccess; @@ -133,8 +132,7 @@ bool FUnrealFoliageTypeTranslator::CreateInputNodeForReference( constexpr int32 PartId = 0; if (CreateHoudiniFoliageTypeAttributes(InFoliageType, InInputNodeId, PartId, HAPI_ATTROWNER_POINT)) { - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), InInputNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InInputNodeId), false); return true; } diff --git a/Source/HoudiniEngine/Private/UnrealGeometryCollectionTranslator.cpp b/Source/HoudiniEngine/Private/UnrealGeometryCollectionTranslator.cpp index 042feb839a..3b2ff52c13 100755 --- a/Source/HoudiniEngine/Private/UnrealGeometryCollectionTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealGeometryCollectionTranslator.cpp @@ -252,10 +252,8 @@ FUnrealGeometryCollectionTranslator::SetGeometryCollectionAttributesForPart( HOUDINI_CHECK_RETURN(Accessor.SetAttributeUniqueData(AttributeInfo, InName), false); } - // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), InNodeId), false); - + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InNodeId), false); + return true; } @@ -886,8 +884,7 @@ FUnrealGeometryCollectionTranslator::UploadGeometryCollection( AddGeometryCollectionDetailAttributes(GeometryCollectionObject, GeometryNodeId, Part.id, Part, InName, GeometryCollectionComponent); // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), GeometryNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(GeometryNodeId), false); // Connect the LOD node to the merge node. HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::ConnectNodeInput( diff --git a/Source/HoudiniEngine/Private/UnrealInstanceTranslator.cpp b/Source/HoudiniEngine/Private/UnrealInstanceTranslator.cpp index 805423454a..fa52075c0b 100755 --- a/Source/HoudiniEngine/Private/UnrealInstanceTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealInstanceTranslator.cpp @@ -331,8 +331,7 @@ FUnrealInstanceTranslator::HapiCreateInputNodeForInstancer( HOUDINI_CHECK_RETURN(Accessor.SetAttributeData(AttributeInfoScale, Scales), false); // Commit the instance point geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), InstancesNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(InstancesNodeId), false); } // Connect the mesh to the copytopoints node's second input diff --git a/Source/HoudiniEngine/Private/UnrealLandscapeSplineTranslator.cpp b/Source/HoudiniEngine/Private/UnrealLandscapeSplineTranslator.cpp index 6c893ea426..6ddf622829 100644 --- a/Source/HoudiniEngine/Private/UnrealLandscapeSplineTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealLandscapeSplineTranslator.cpp @@ -838,7 +838,7 @@ FUnrealLandscapeSplineTranslator::CreateInputNodeForLandscapeSplines( if (bNeedToCommit) { // We successfully added tags to the geo, so we need to commit the changes - if (HAPI_RESULT_SUCCESS != FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), OutNodeId)) + if (HAPI_RESULT_SUCCESS != FHoudiniEngineUtils::HapiCommitGeo(OutNodeId)) HOUDINI_LOG_WARNING(TEXT("Could not create groups for the landscape spline input's tags!")); // And cook it with refinement disabled (we want to strictly keep the control points and segments as they are) @@ -952,7 +952,7 @@ FUnrealLandscapeSplineTranslator::CreateInputNodeForLandscapeSplinesControlPoint if (bNeedToCommit) { // We successfully added tags to the geo, so we need to commit the changes - if (HAPI_RESULT_SUCCESS != FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), OutNodeId)) + if (HAPI_RESULT_SUCCESS != FHoudiniEngineUtils::HapiCommitGeo(OutNodeId)) HOUDINI_LOG_WARNING(TEXT("Could not commit landscape spline control point geo!")); HAPI_CookOptions CookOptions = FHoudiniEngine::GetDefaultCookOptions(); diff --git a/Source/HoudiniEngine/Private/UnrealLandscapeTranslator.cpp b/Source/HoudiniEngine/Private/UnrealLandscapeTranslator.cpp index 855f0b1362..f60f14467b 100755 --- a/Source/HoudiniEngine/Private/UnrealLandscapeTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealLandscapeTranslator.cpp @@ -269,9 +269,8 @@ FUnrealLandscapeTranslator::CreateMeshOrPointsFromLandscape( */ // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), DisplayGeoInfo.nodeId), false); - + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(DisplayGeoInfo.nodeId), false); + return FHoudiniEngineUtils::HapiCookNode(InputNodeId, nullptr, true); } @@ -348,8 +347,7 @@ FUnrealLandscapeTranslator::CreateHeightfieldFromLandscape( ApplyAttributesToHeightfieldNode(HeightId, PartId, LandscapeProxy); // Commit the height volume - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), HeightId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(HeightId), false); //-------------------------------------------------------------------------------------------------- // Add Data Layers and HLODS @@ -502,8 +500,7 @@ FUnrealLandscapeTranslator::CreateHeightfieldFromLandscape( ApplyAttributesToHeightfieldNode(LandscapeLayerNodeId, 0, LandscapeProxy); // Commit the volume's geo - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), LandscapeLayerNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(LandscapeLayerNodeId), false); } } @@ -727,8 +724,7 @@ FUnrealLandscapeTranslator::CreateHeightfieldFromLandscapeComponent( ApplyAttributesToHeightfieldNode(HeightId, PartId, LandscapeProxy); // Commit the height volume - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), HeightId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(HeightId), false); //-------------------------------------------------------------------------------------------------- // 5. Extract and convert all the layers to HF masks @@ -736,18 +732,6 @@ FUnrealLandscapeTranslator::CreateHeightfieldFromLandscapeComponent( if (!SendTargetLayersToHoudini(LandscapeProxy, HeightFieldId, PartId, MergeId, MaskId, Options, HeightfieldVolumeInfo, XSize, YSize, MergeInputIndex)) return false; - /* - // Commented out! As we now center the landscape transform in FHoudiniEngineRuntimeUtils::CalculateHoudiniLandscapeTransform() - if ( CreatedHeightfieldNode ) - { - // Since HF are centered but landscape arent, we need to set the HF's center parameter - // Do it only once after creating the Heightfield node - FHoudiniApi::SetParmFloatValue(FHoudiniEngine::Get().GetSession(), HeightFieldId, "t", 0, CenterOffset.X); - FHoudiniApi::SetParmFloatValue(FHoudiniEngine::Get().GetSession(), HeightFieldId, "t", 1, 0.0); - FHoudiniApi::SetParmFloatValue(FHoudiniEngine::Get().GetSession(), HeightFieldId, "t", 2, CenterOffset.Y); - } - */ - // Finally, cook the Heightfield node if (!FHoudiniEngineUtils::HapiCookNode(HeightFieldId, nullptr, true)) return false; @@ -2440,7 +2424,8 @@ FUnrealLandscapeTranslator::CreateVolumeLayer(ALandscapeProxy* LandscapeProxy, ApplyAttributesToHeightfieldNode(LayerVolumeNodeId, PartId, LandscapeProxy); // Commit the volume's geo - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), LayerVolumeNodeId), -1); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(LayerVolumeNodeId), -1); + return LayerVolumeNodeId; } @@ -2545,7 +2530,7 @@ bool FUnrealLandscapeTranslator::SendCombinedTargetLayersToHoudini( ApplyAttributesToHeightfieldNode(MaskId, PartId, LandscapeProxy); // Commit the mask volume's geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), MaskId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(MaskId), false); } return true; diff --git a/Source/HoudiniEngine/Private/UnrealLevelInstanceTranslator.cpp b/Source/HoudiniEngine/Private/UnrealLevelInstanceTranslator.cpp index eaa9c17e5a..b051bc8a18 100644 --- a/Source/HoudiniEngine/Private/UnrealLevelInstanceTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealLevelInstanceTranslator.cpp @@ -164,7 +164,8 @@ bool FUnrealLevelInstanceTranslator::AddStringPointAttribute(HAPI_NodeId NodeId, FHoudiniHapiAccessor Accessor(NodeId, 0, Name); HOUDINI_CHECK_RETURN(Accessor.SetAttributeData(AttributeInfo, Data), false); - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), NodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NodeId), false); + return true; } @@ -184,11 +185,13 @@ bool FUnrealLevelInstanceTranslator::AddFloatPointAttribute(HAPI_NodeId NodeId, HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::AddAttribute(FHoudiniEngine::Get().GetSession(),NodeId,0,Name, &AttributeInfo), false); HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::SetAttributeFloatData(FHoudiniEngine::Get().GetSession(), NodeId, 0, Name, &AttributeInfo, Data, 0, Count), false); - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), NodeId), false); + + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NodeId), false); + return true; } -void FUnrealLevelInstanceTranslator::CreateAttributeData(HAPI_NodeId NodeId, ALevelInstance * LevelInstance) +void FUnrealLevelInstanceTranslator::CreateAttributeData(HAPI_NodeId NodeId, ALevelInstance* LevelInstance) { constexpr int NumInstances = 1; TArray Positions; @@ -220,8 +223,7 @@ void FUnrealLevelInstanceTranslator::CreateAttributeData(HAPI_NodeId NodeId, ALe AddStringPointAttribute(NodeId, HAPI_UNREAL_ATTRIB_ACTOR_PATH, ActorPaths); AddStringPointAttribute(NodeId, HAPI_UNREAL_ATTRIB_LEVEL_INSTANCE_NAME, ActorLevels); - FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), NodeId); - + FHoudiniEngineUtils::HapiCommitGeo(NodeId); } diff --git a/Source/HoudiniEngine/Private/UnrealMeshTranslator.cpp b/Source/HoudiniEngine/Private/UnrealMeshTranslator.cpp index 77aabdf006..334cc29a05 100755 --- a/Source/HoudiniEngine/Private/UnrealMeshTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealMeshTranslator.cpp @@ -96,6 +96,8 @@ FUnrealMeshTranslator::HapiCreateInputNodeForStaticMesh( const bool& bExportMaterialParameters /*= false*/, const bool& bForceReferenceInputNodeCreation /*= false*/) { + TRACE_CPUPROFILER_EVENT_SCOPE(FUnrealMeshTranslator::HapiCreateInputNodeForStaticMesh); + // If we don't have a static mesh there's nothing to do. if (!IsValid(StaticMesh)) return false; @@ -1035,8 +1037,7 @@ FUnrealMeshTranslator::CreateInputNodeForMeshSockets( OutSocketsNodeId, 0, HAPI_GROUPTYPE_POINT, SocketGroupStr, GroupArray.GetData(), 0, NumSockets), false); // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), OutSocketsNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(OutSocketsNodeId), false); return true; } @@ -1743,8 +1744,7 @@ FUnrealMeshTranslator::CreateInputNodeForRawMesh( } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NodeId), false); return true; } @@ -2554,8 +2554,7 @@ FUnrealMeshTranslator::CreateInputNodeForStaticMeshLODResources( } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NodeId), false); return true; } @@ -2584,6 +2583,8 @@ FUnrealMeshTranslator::CreateInputNodeForMeshDescription( UStaticMesh const* const StaticMesh, UStaticMeshComponent const* const StaticMeshComponent) { + TRACE_CPUPROFILER_EVENT_SCOPE(FUnrealMeshTranslator::CreateInputNodeForMeshDescription); + if (!IsValid(StaticMesh)) return false; @@ -2782,9 +2783,7 @@ FUnrealMeshTranslator::CreateInputNodeForMeshDescription( // ---------------------------------------------------------------------------------------------------------------- // Commit the geo // ---------------------------------------------------------------------------------------------------------------- - // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NodeId), false); return true; } @@ -2812,6 +2811,8 @@ FUnrealMeshTranslator::CreateAndPopulateMeshPartFromMeshDescription( const bool bCommitGeo, HAPI_PartInfo& OutPartInfo) { + TRACE_CPUPROFILER_EVENT_SCOPE(FUnrealMeshTranslator::CreateAndPopulateMeshPartFromMeshDescription); + H_SCOPED_FUNCTION_TIMER(); AActor* ParentActor = MeshComponent ? MeshComponent->GetOwner() : nullptr; @@ -3649,12 +3650,8 @@ FUnrealMeshTranslator::CreateAndPopulateMeshPartFromMeshDescription( if (bCommitGeo) { - - H_SCOPED_FUNCTION_STATIC_LABEL("COMIT GEO"); - // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NodeId), false); } OutPartInfo = Part; @@ -4512,8 +4509,7 @@ FUnrealMeshTranslator::CreateInputNodeForCollider( ColliderFaceCounts, ColliderNodeId, 0), false); // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), ColliderNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(ColliderNodeId), false); OutNodeId = ColliderNodeId; diff --git a/Source/HoudiniEngine/Private/UnrealObjectInputUtils.cpp b/Source/HoudiniEngine/Private/UnrealObjectInputUtils.cpp index ccb218b10f..59b3e55996 100644 --- a/Source/HoudiniEngine/Private/UnrealObjectInputUtils.cpp +++ b/Source/HoudiniEngine/Private/UnrealObjectInputUtils.cpp @@ -333,6 +333,8 @@ FUnrealObjectInputUtils::BuildMeshInputObjectIdentifiers( FUnrealObjectInputIdentifier& OutReferenceNode, TArray& OutPerOptionIdentifiers) { + TRACE_CPUPROFILER_EVENT_SCOPE(FUnrealObjectInputUtils::BuildMeshInputObjectIdentifiers); + FUnrealObjectInputOptions DefaultOptions; DefaultOptions.bImportAsReference = false; DefaultOptions.bImportAsReferenceRotScaleEnabled = false; @@ -687,6 +689,8 @@ FUnrealObjectInputUtils::CreateOrUpdateReferenceInputMergeNode( const bool bInConnectReferencedNodes, const bool& bInputNodesCanBeDeleted) { + TRACE_CPUPROFILER_EVENT_SCOPE(FUnrealObjectInputUtils::CreateOrUpdateReferenceInputMergeNode); + // Identifier must be valid and for a reference node if (!InIdentifier.IsValid() || InIdentifier.GetNodeType() != EUnrealObjectInputNodeType::Reference) return false; diff --git a/Source/HoudiniEngine/Private/UnrealSkeletalMeshTranslator.cpp b/Source/HoudiniEngine/Private/UnrealSkeletalMeshTranslator.cpp index a42a059722..0241c04fce 100644 --- a/Source/HoudiniEngine/Private/UnrealSkeletalMeshTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealSkeletalMeshTranslator.cpp @@ -1152,8 +1152,7 @@ FUnrealSkeletalMeshTranslator::SetSkeletalMeshDataOnNodeFromMeshDescription( } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NewNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NewNodeId), false); return true; } @@ -1598,8 +1597,7 @@ FUnrealSkeletalMeshTranslator::SetSkeletalMeshDataOnNodeFromSourceModel( } // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), NewNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(NewNodeId), false); return true; } @@ -1915,8 +1913,7 @@ FUnrealSkeletalMeshTranslator::CreateInputNodeForSkeletalMeshSockets( OutSocketsNodeId, 0, HAPI_GROUPTYPE_POINT, SocketGroupStr, GroupArray.GetData(), 0, NumSockets), false); // Commit the geo. - HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::CommitGeo( - FHoudiniEngine::Get().GetSession(), OutSocketsNodeId), false); + HOUDINI_CHECK_ERROR_RETURN(FHoudiniEngineUtils::HapiCommitGeo(OutSocketsNodeId), false); return true; } @@ -2252,8 +2249,7 @@ FUnrealSkeletalMeshTranslator::CreateInputNodeForCapturePose( //---------------------------------------- // End of capture pose translation //---------------------------------------- - - FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), NewNodeId); + FHoudiniEngineUtils::HapiCommitGeo(NewNodeId); { FUnrealObjectInputHandle Handle; diff --git a/Source/HoudiniEngine/Private/UnrealSplineTranslator.cpp b/Source/HoudiniEngine/Private/UnrealSplineTranslator.cpp index 608c717853..b2387994d5 100755 --- a/Source/HoudiniEngine/Private/UnrealSplineTranslator.cpp +++ b/Source/HoudiniEngine/Private/UnrealSplineTranslator.cpp @@ -211,7 +211,7 @@ FUnrealSplineTranslator::CreateInputNodeForSplineComponent( if (NeedToCommit) { // We successfully added tags to the geo, so we need to commit the changes - if (HAPI_RESULT_SUCCESS != FHoudiniApi::CommitGeo(FHoudiniEngine::Get().GetSession(), CreatedInputNodeId)) + if (HAPI_RESULT_SUCCESS != FHoudiniEngineUtils::HapiCommitGeo(CreatedInputNodeId)) HOUDINI_LOG_WARNING(TEXT("Could not create groups for the spline input's tags!")); // And cook it with refinement enabled diff --git a/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp b/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp index d24721f95a..3ce2f697ad 100755 --- a/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp +++ b/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp @@ -263,6 +263,8 @@ UHoudiniAssetComponent::UHoudiniAssetComponent(const FObjectInitializer & Object // Initialize the default SM Build settings with the plugin's settings default values StaticMeshBuildSettings = FHoudiniEngineRuntimeUtils::GetDefaultMeshBuildSettings(); + + bNeedToUpdateEditorProperties = false; } UHoudiniAssetComponent::~UHoudiniAssetComponent() @@ -566,6 +568,8 @@ UHoudiniAssetComponent::GetTemporaryCookFolderOrDefault() const bool UHoudiniAssetComponent::NeedUpdate() const { + TRACE_CPUPROFILER_EVENT_SCOPE(UHoudiniAssetComponent::NeedUpdate); + if (AssetState != DebugLastAssetState) { DebugLastAssetState = AssetState; @@ -813,7 +817,6 @@ UHoudiniAssetComponent::NeedsToWaitForInputHoudiniAssets() continue; EHoudiniInputType CurrentInputType = CurrentInput->GetInputType(); - if (!CurrentInput->IsAssetInput()) continue; diff --git a/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.h b/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.h index 7f3604a242..c3e1ecc1db 100755 --- a/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.h +++ b/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.h @@ -635,6 +635,11 @@ class HOUDINIENGINERUNTIME_API UHoudiniAssetComponent : public UPrimitiveCompone UPROPERTY() bool bLandscapeUseTempLayers; + + // Indicates whether or not this component should update the editor's UI + // This is to prevent successive calls of the function for the same HDAs + UPROPERTY(Transient, DuplicateTransient) + bool bNeedToUpdateEditorProperties; #endif protected: diff --git a/Source/HoudiniEngineRuntime/Private/HoudiniLandscapeRuntimeUtils.cpp b/Source/HoudiniEngineRuntime/Private/HoudiniLandscapeRuntimeUtils.cpp index 1360b7a434..f0a6650f0d 100644 --- a/Source/HoudiniEngineRuntime/Private/HoudiniLandscapeRuntimeUtils.cpp +++ b/Source/HoudiniEngineRuntime/Private/HoudiniLandscapeRuntimeUtils.cpp @@ -42,6 +42,8 @@ void FHoudiniLandscapeRuntimeUtils::DeleteLandscapeCookedData(UHoudiniOutput* InOutput) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniLandscapeRuntimeUtils::DeleteLandscapeCookedData); + TSet LandscapesToDelete; TArray OutputObjectsToDelete; TMap& OutputObjects = InOutput->GetOutputObjects();