diff --git a/Source/HoudiniEngine/Private/HoudiniAnimationTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniAnimationTranslator.cpp index d77a5c6507..ee61aeb359 100644 --- a/Source/HoudiniEngine/Private/HoudiniAnimationTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniAnimationTranslator.cpp @@ -380,6 +380,8 @@ FHoudiniAnimationTranslator::GetFbxCustomAttributes( //Creates SkelatalMesh and Skeleton Assets and Packages, and adds them to OutputObjects bool FHoudiniAnimationTranslator::CreateAnimationFromMotionClip(UHoudiniOutput* InOutput, const TArray& HGPOs, const FHoudiniPackageParams& InPackageParams, UObject* InOuterComponent) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniAnimationTranslator::CreateAnimationFromMotionClip); + if (HGPOs.Num() == 0) { HOUDINI_LOG_WARNING(TEXT("Could not translate MotionClip. No Geo Part Objects.")); diff --git a/Source/HoudiniEngine/Private/HoudiniDataTableTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniDataTableTranslator.cpp index 7cf9fa5427..f57569c2b1 100644 --- a/Source/HoudiniEngine/Private/HoudiniDataTableTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniDataTableTranslator.cpp @@ -402,6 +402,8 @@ FHoudiniDataTableTranslator::BuildDataTable( UHoudiniOutput* CurOutput, FHoudiniPackageParams& PackageParams) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniDataTableTranslator::BuildDataTable); + DeletePreviousOutput(CurOutput); int32 GeoId = HGPO.GeoId; diff --git a/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp b/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp index db9f2a0f27..16fdaa1d61 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp +++ b/Source/HoudiniEngine/Private/HoudiniEngineManager.cpp @@ -503,6 +503,8 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) { case EHoudiniAssetState::NeedInstantiation: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-NeedInstantiation); + // Do nothing unless the HAC has been updated if (HAC->NeedUpdate()) { @@ -525,6 +527,8 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::NewHDA: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-NewHDA); + // Update parameters. Since there is no instantiated node yet, this will only fetch the defaults from // the asset definition. FHoudiniParameterTranslator::UpdateParameters(HAC); @@ -538,6 +542,8 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::PreInstantiation: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-PreInstantiation); + // Only proceed forward if we don't need to wait for our input HoudiniAssets to finish cooking/instantiating if (HAC->NeedsToWaitForInputHoudiniAssets()) break; @@ -603,7 +609,8 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) } case EHoudiniAssetState::Instantiating: - { + { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-Instantiating); EHoudiniAssetState NewState = EHoudiniAssetState::Instantiating; if (UpdateInstantiating(HAC, NewState)) { @@ -620,6 +627,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::PreCook: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-PreCook); // Only proceed forward if we don't need to wait for our input // HoudiniAssets to finish cooking/instantiating if (HAC->NeedsToWaitForInputHoudiniAssets()) @@ -670,6 +678,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::Cooking: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-Cooking); EHoudiniAssetState NewState = EHoudiniAssetState::Cooking; bool state = UpdateCooking(HAC, NewState); if (state) @@ -687,6 +696,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::PostCook: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-PostCook); // Handle PostCook EHoudiniAssetState NewState = EHoudiniAssetState::None; bool bSuccess = HAC->bLastCookSuccess; @@ -709,12 +719,15 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::PreProcess: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-PreProcess); StartTaskAssetProcess(HAC); break; } case EHoudiniAssetState::Processing: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-Processing); + UpdateProcess(HAC); HAC->HandleOnPostOutputProcessing(); @@ -725,6 +738,8 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::None: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-None); + // Update world inputs if we have any FHoudiniInputTranslator::UpdateWorldInputs(HAC); @@ -794,6 +809,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::NeedRebuild: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-NeedRebuild); if (!bIsNodeSyncComponent) { // Do not delete nodes for NodeSync components! @@ -806,6 +822,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::NeedDelete: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-NeedDelete); if (!bIsNodeSyncComponent) { // Do not delete nodes for NodeSync components! @@ -821,6 +838,7 @@ FHoudiniEngineManager::ProcessComponent(UHoudiniAssetComponent* HAC) case EHoudiniAssetState::Deleting: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineManager::ProcessComponent-Deleting); break; } } @@ -854,7 +872,7 @@ FHoudiniEngineManager::StartTaskAssetInstantiation(UHoudiniAsset* HoudiniAsset, } // Handle hda files that contain multiple assets - TArray< HAPI_StringHandle > AssetNames; + TArray AssetNames; if (!FHoudiniEngineUtils::GetSubAssetNames(AssetLibraryId, AssetNames)) { HOUDINI_LOG_ERROR(TEXT("Cancelling asset instantiation - unable to retrieve asset names.")); diff --git a/Source/HoudiniEngine/Private/HoudiniEngineString.cpp b/Source/HoudiniEngine/Private/HoudiniEngineString.cpp index de1ae0b23c..fb7ddeefb8 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngineString.cpp +++ b/Source/HoudiniEngine/Private/HoudiniEngineString.cpp @@ -82,6 +82,8 @@ FHoudiniEngineString::HasValidId() const bool FHoudiniEngineString::ToStdString(std::string& String, const HAPI_Session* InSession) const { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineString::ToStdString); + String = ""; // Null string ID / zero should be considered invalid diff --git a/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp b/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp index d472852fe5..daf9a5d065 100755 --- a/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp +++ b/Source/HoudiniEngine/Private/HoudiniEngineUtils.cpp @@ -1229,6 +1229,8 @@ FHoudiniEngineUtils::GatherLandscapeInputs( UHoudiniAssetComponent* HAC, TArray& AllInputLandscapes) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherLandscapeInputs); + if (!IsValid(HAC)) return; @@ -1528,6 +1530,7 @@ FHoudiniEngineUtils::LoadLibHAPI(FString & StoredLibHAPILocation) bool FHoudiniEngineUtils::IsInitialized() { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::IsInitialized); if (!FHoudiniApi::IsHAPIInitialized()) return false; @@ -1706,6 +1709,8 @@ FHoudiniEngineUtils::LoadHoudiniAsset(const UHoudiniAsset * HoudiniAsset, HAPI_A // Lambda to detect license issues auto CheckLicenseValid = [&AssetFileName](const HAPI_Result& Result) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::LoadHoudiniAsset - CheckLicenseValid); + // HoudiniEngine acquires a license when creating/loading a node, not when creating a session if (Result >= HAPI_RESULT_NO_LICENSE_FOUND && Result < HAPI_RESULT_ASSET_INVALID) { @@ -1730,6 +1735,8 @@ FHoudiniEngineUtils::LoadHoudiniAsset(const UHoudiniAsset * HoudiniAsset, HAPI_A // Lambda to load an HDA from file auto LoadAssetFromFile = [&Result, &OutAssetLibraryId](const FString& InAssetFileName) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::LoadHoudiniAsset - LoadAssetFromFile); + // Load the asset from file. std::string AssetFileNamePlain; FHoudiniEngineUtils::ConvertUnrealString(InAssetFileName, AssetFileNamePlain); @@ -1741,6 +1748,8 @@ FHoudiniEngineUtils::LoadHoudiniAsset(const UHoudiniAsset * HoudiniAsset, HAPI_A // Lambda to load an HDA from memory auto LoadAssetFromMemory = [&Result, &OutAssetLibraryId](const UHoudiniAsset* InHoudiniAsset) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::LoadHoudiniAsset - LoadAssetFromMemory); + // Load the asset from the cached memory buffer Result = FHoudiniApi::LoadAssetLibraryFromMemory( FHoudiniEngine::Get().GetSession(), @@ -1833,6 +1842,8 @@ FHoudiniEngineUtils::GetSubAssetNames( const HAPI_AssetLibraryId& AssetLibraryId, TArray< HAPI_StringHandle >& OutAssetNames) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GetSubAssetNames); + if (AssetLibraryId < 0) return false; @@ -1940,6 +1951,8 @@ FHoudiniEngineUtils::IsValidNodeId(HAPI_NodeId NodeId) bool FHoudiniEngineUtils::GetHoudiniAssetName(const HAPI_NodeId& AssetNodeId, FString& NameString) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GetHoudiniAssetName); + if (AssetNodeId < 0) return false; @@ -2018,6 +2031,8 @@ FHoudiniEngineUtils::HapiGetAbsNodePath(const HAPI_NodeId& InNodeId, FString& Ou bool FHoudiniEngineUtils::HapiGetNodePath(const HAPI_NodeId& InNodeId, const HAPI_NodeId& InRelativeToNodeId, FString& OutPath) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::HapiGetNodePath); + // Retrieve Path to the given Node, relative to the other given Node if ((InNodeId < 0) || (InRelativeToNodeId < 0)) return false; @@ -2100,6 +2115,8 @@ FHoudiniEngineUtils::HapiGetNodePath(const FHoudiniGeoPartObject& InHGPO, FStrin bool FHoudiniEngineUtils::HapiGetObjectInfos(const HAPI_NodeId& InNodeId, TArray& OutObjectInfos, TArray& OutObjectTransforms) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::HapiGetObjectInfos); + HAPI_NodeInfo NodeInfo; FHoudiniApi::NodeInfo_Init(&NodeInfo); HOUDINI_CHECK_ERROR_RETURN(FHoudiniApi::GetNodeInfo( @@ -2211,6 +2228,8 @@ FHoudiniEngineUtils::HapiGetObjectInfos(const HAPI_NodeId& InNodeId, TArray& AllObjectIds, const HAPI_NodeId& InRootNodeId, const HAPI_NodeId& InChildNodeId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::IsObjNodeFullyVisible); + // Walk up the hierarchy from child to root. // If any node in that hierarchy is not in the "AllObjectIds" set, the OBJ node is considered to // be hidden. @@ -2289,6 +2308,7 @@ FHoudiniEngineUtils::IsSopNode(const HAPI_NodeId& NodeId) bool FHoudiniEngineUtils::ContainsSopNodes(const HAPI_NodeId& NodeId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::ContainsSopNodes); int ChildCount = 0; HOUDINI_CHECK_ERROR_RETURN( FHoudiniApi::ComposeChildNodeList( @@ -2339,15 +2359,23 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( // Get the AssetInfo HAPI_AssetInfo AssetInfo; - FHoudiniApi::AssetInfo_Init(&AssetInfo); - bool bAssetInfoResult = HAPI_RESULT_SUCCESS == FHoudiniApi::GetAssetInfo( - FHoudiniEngine::Get().GetSession(), AssetId, &AssetInfo); + bool bAssetInfoResult = false; + { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-GetAssetInfo); + FHoudiniApi::AssetInfo_Init(&AssetInfo); + bAssetInfoResult = HAPI_RESULT_SUCCESS == FHoudiniApi::GetAssetInfo( + FHoudiniEngine::Get().GetSession(), AssetId, &AssetInfo); + } // Get the Asset NodeInfo HAPI_NodeInfo AssetNodeInfo; - FHoudiniApi::NodeInfo_Init(&AssetNodeInfo); - HAPI_Result NodeResult = FHoudiniApi::GetNodeInfo( - FHoudiniEngine::Get().GetSession(), AssetId, &AssetNodeInfo); + HAPI_Result NodeResult = HAPI_RESULT_FAILURE; + { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-GetNodeInfo); + FHoudiniApi::NodeInfo_Init(&AssetNodeInfo); + NodeResult = FHoudiniApi::GetNodeInfo( + FHoudiniEngine::Get().GetSession(), AssetId, &AssetNodeInfo); + } if (HAPI_RESULT_SUCCESS != NodeResult) { @@ -2379,6 +2407,7 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( int32 EditableNodeCount = 0; if (bAssetHasChildren) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-ComposeChildNodeList); HOUDINI_CHECK_ERROR(FHoudiniApi::ComposeChildNodeList( FHoudiniEngine::Get().GetSession(), AssetId, HAPI_NODETYPE_SOP, HAPI_NODEFLAGS_EDITABLE, @@ -2389,6 +2418,7 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( // of whether the subnet is considered visible or not. if (EditableNodeCount > 0) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-GetComposedChildNodeList); TArray EditableNodeIds; EditableNodeIds.SetNumUninitialized(EditableNodeCount); HOUDINI_CHECK_ERROR(FHoudiniApi::GetComposedChildNodeList( @@ -2397,6 +2427,7 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( for (int32 nEditable = 0; nEditable < EditableNodeCount; nEditable++) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-GetEditableGeoInfo); HAPI_GeoInfo CurrentEditableGeoInfo; FHoudiniApi::GeoInfo_Init(&CurrentEditableGeoInfo); HOUDINI_CHECK_ERROR(FHoudiniApi::GetGeoInfo( @@ -2451,6 +2482,7 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( TSet AllObjectIds; if (bUseOutputFromSubnets) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-GetComposedChildNodeList2); int NumObjSubnets; TArray ObjectIds; HOUDINI_CHECK_ERROR_RETURN( @@ -2464,6 +2496,7 @@ FHoudiniEngineUtils::GatherAllAssetOutputs( ), false); + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherAllAssetOutputs-GetComposedChildNodeList2); ObjectIds.SetNumUninitialized(NumObjSubnets); HOUDINI_CHECK_ERROR_RETURN( FHoudiniApi::GetComposedChildNodeList( @@ -2556,6 +2589,8 @@ bool FHoudiniEngineUtils::GatherImmediateOutputGeoInfos(const HAPI_NodeId& InNod TSet& OutForceNodesCook ) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GatherImmediateOutputGeoInfos); + TSet GatheredNodeIds; // NOTE: This function assumes that the incoming node is a Geometry container that contains immediate @@ -2856,8 +2891,8 @@ FHoudiniEngineUtils::TranslateUnrealTransform(const FTransform& UnrealTransform, void FHoudiniEngineUtils::TranslateUnrealTransform( - const FTransform & UnrealTransform, - HAPI_TransformEuler & HapiTransformEuler) + const FTransform& UnrealTransform, + HAPI_TransformEuler& HapiTransformEuler) { FHoudiniApi::TransformEuler_Init(&HapiTransformEuler); @@ -3014,6 +3049,7 @@ FHoudiniEngineUtils::UploadHACTransform(UHoudiniAssetComponent* HAC) bool FHoudiniEngineUtils::HapiSetAssetTransform(const HAPI_NodeId& AssetId, const FTransform & Transform) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::HapiSetAssetTransform); if (AssetId < 0) return false; @@ -3066,6 +3102,8 @@ FHoudiniEngineUtils::HapiGetParentNodeId(const HAPI_NodeId& NodeId) void FHoudiniEngineUtils::AssignUniqueActorLabelIfNeeded(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::AssignUniqueActorLabelIfNeeded); + if (!IsValid(HAC)) return; @@ -6132,12 +6170,18 @@ FHoudiniEngineUtils::GetGenericAttributeList( bool -FHoudiniEngineUtils::GetGenericPropertiesAttributes(const HAPI_NodeId& InGeoNodeId, const HAPI_PartId& InPartId, - const bool InbFindDetailAttributes, const int32& InFirstValidPrimIndex, const int32& InFirstValidVertexIndex, const int32& InFirstValidPointIndex, +FHoudiniEngineUtils::GetGenericPropertiesAttributes( + const HAPI_NodeId& InGeoNodeId, + const HAPI_PartId& InPartId, + const bool InbFindDetailAttributes, + const int32& InFirstValidPrimIndex, + const int32& InFirstValidVertexIndex, + const int32& InFirstValidPointIndex, TArray& OutPropertyAttributes) { - int32 FoundCount = 0; + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::GetGenericPropertiesAttributes); + int32 FoundCount = 0; // List all the generic property detail attributes ... if (InbFindDetailAttributes) { @@ -6177,6 +6221,7 @@ FHoudiniEngineUtils::UpdateGenericPropertiesAttributes( const bool bInDeferPostEditChangePropertyCalls, const FHoudiniGenericAttribute::FFindPropertyFunctionType& InProcessFunction) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::UpdateGenericPropertiesAttributes); if (!IsValid(InObject)) return false; @@ -6942,6 +6987,8 @@ FHoudiniEngineUtils::CreateNode( int32 FHoudiniEngineUtils::HapiGetCookCount(const HAPI_NodeId& InNodeId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniEngineUtils::HapiGetCookCount); + // To reduce the "cost" of the call on big HDAs - limit or search to non bypassed SOP/OBJ nodes int32 CookCount = -1; if (HAPI_RESULT_FAILURE == FHoudiniApi::GetTotalCookCount( diff --git a/Source/HoudiniEngine/Private/HoudiniGeometryCollectionTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniGeometryCollectionTranslator.cpp index 2295485a70..4379b118e8 100755 --- a/Source/HoudiniEngine/Private/HoudiniGeometryCollectionTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniGeometryCollectionTranslator.cpp @@ -30,6 +30,8 @@ FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutput const FHoudiniPackageParams& InPackageParams, UWorld * InWorld) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniGeometryCollectionTranslator::SetupGeometryCollectionComponentFromOutputs); + USceneComponent* ParentComponent = Cast(InOuterComponent); if (!ParentComponent) return; diff --git a/Source/HoudiniEngine/Private/HoudiniHandleTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniHandleTranslator.cpp index ded9853e37..26135c311f 100755 --- a/Source/HoudiniEngine/Private/HoudiniHandleTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniHandleTranslator.cpp @@ -43,6 +43,8 @@ bool FHoudiniHandleTranslator::BuildHandles(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniHandleTranslator::BuildHandles); + if (!IsValid(HAC)) return false; diff --git a/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp index 73bd4171f8..931ee416e5 100755 --- a/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp @@ -128,6 +128,8 @@ struct FHoudiniMoveTracker bool FHoudiniInputTranslator::UpdateInputs(UHoudiniAssetComponent* HAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::UpdateInputs); + if (!IsValid(HAC)) return false; @@ -151,6 +153,8 @@ FHoudiniInputTranslator::BuildAllInputs( TArray& Inputs, TArray& Parameters) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInputTranslator::BuildAllInputs); + // Ensure the asset has a valid node ID if (AssetId < 0) { diff --git a/Source/HoudiniEngine/Private/HoudiniInstanceTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniInstanceTranslator.cpp index 3aefa58d59..774683e3ec 100755 --- a/Source/HoudiniEngine/Private/HoudiniInstanceTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniInstanceTranslator.cpp @@ -207,6 +207,7 @@ FHoudiniInstanceTranslator::CreateAllInstancersFromHoudiniOutputs( const FHoudiniPackageParams& InPackageParms, const TMap* InPreBuiltInstancedOutputPartData) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniInstanceTranslator::CreateAllInstancersFromHoudiniOutputs); int FoliageTypeCount = 0; USceneComponent* ParentComponent = Cast(InOuterComponent); diff --git a/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp index 9d9805e7e5..c023de368f 100644 --- a/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniLandscapeSplineTranslator.cpp @@ -65,6 +65,7 @@ FHoudiniLandscapeSplineTranslator::ProcessLandscapeSplineOutput( const FHoudiniPackageParams& InPackageParams, TMap>& InClearedLayers) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniLandscapeSplineTranslator::ProcessLandscapeSplineOutput); if (!IsValid(InOutput)) return false; diff --git a/Source/HoudiniEngine/Private/HoudiniLandscapeTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniLandscapeTranslator.cpp index 5f8a633b9b..f980c34ad2 100755 --- a/Source/HoudiniEngine/Private/HoudiniLandscapeTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniLandscapeTranslator.cpp @@ -76,6 +76,8 @@ FHoudiniLandscapeTranslator::ProcessLandscapeOutput( FHoudiniClearedEditLayers& ClearedLayers, TArray& OutCreatedPackages) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniLandscapeTranslator::ProcessLandscapeOutput); + UHoudiniAssetComponent* HAC = FHoudiniEngineUtils::GetOuterHoudiniAssetComponent(InOutput); //------------------------------------------------------------------------------------------------------------------------------ diff --git a/Source/HoudiniEngine/Private/HoudiniMeshTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniMeshTranslator.cpp index 625487cddb..5d1a85b26a 100755 --- a/Source/HoudiniEngine/Private/HoudiniMeshTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniMeshTranslator.cpp @@ -100,6 +100,8 @@ FHoudiniMeshTranslator::CreateAllMeshesAndComponentsFromHoudiniOutput( bool bInTreatExistingMaterialsAsUpToDate, bool bInDestroyProxies) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniMeshTranslator::CreateAllMeshesAndComponentsFromHoudiniOutput); + if (!IsValid(InOutput)) return false; @@ -172,6 +174,8 @@ FHoudiniMeshTranslator::CreateOrUpdateAllComponents( bool bInDestroyProxies, bool bInApplyGenericProperties) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniMeshTranslator::CreateOrUpdateAllComponents); + if (!IsValid(InOutput)) return false; @@ -700,6 +704,8 @@ FHoudiniMeshTranslator::CreateStaticMeshFromHoudiniGeoPartObject( const FMeshBuildSettings& InSMBuildSettings, bool bInTreatExistingMaterialsAsUpToDate) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniMeshTranslator::CreateStaticMeshFromHoudiniGeoPartObject); + // If we're not forcing the rebuild // No need to recreate something that hasn't changed if (!InForceRebuild && !InHGPO.bHasGeoChanged && !InHGPO.bHasPartChanged && InOutputObjects.Num() > 0) diff --git a/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp index a11eedd4d6..dab6eab41a 100755 --- a/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniOutputTranslator.cpp @@ -90,6 +90,8 @@ FHoudiniOutputTranslator::UpdateOutputs( const bool& bInForceUpdate, bool& bOutHasHoudiniStaticMeshOutput) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniOutputTranslator::UpdateOutputs); + if (!IsValid(HAC)) return false; @@ -2616,6 +2618,8 @@ FHoudiniOutputTranslator::ClearAndRemoveOutputs(UHoudiniAssetComponent *InHAC, T void FHoudiniOutputTranslator::ClearOutput(UHoudiniOutput* Output) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniOutputTranslator::ClearOutput); + switch (Output->GetType()) { case EHoudiniOutputType::Landscape: diff --git a/Source/HoudiniEngine/Private/HoudiniPDGManager.cpp b/Source/HoudiniEngine/Private/HoudiniPDGManager.cpp index 7f3b638ae8..babb5fd90c 100755 --- a/Source/HoudiniEngine/Private/HoudiniPDGManager.cpp +++ b/Source/HoudiniEngine/Private/HoudiniPDGManager.cpp @@ -63,6 +63,7 @@ FHoudiniPDGManager::~FHoudiniPDGManager() bool FHoudiniPDGManager::InitializePDGAssetLink(UHoudiniAssetComponent* InHAC) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniPDGManager::InitializePDGAssetLink); if (!IsValid(InHAC)) return false; @@ -213,6 +214,8 @@ FHoudiniPDGManager::UpdatePDGAssetLink(UHoudiniPDGAssetLink* PDGAssetLink) bool FHoudiniPDGManager::PopulateTOPNetworks(UHoudiniPDGAssetLink* PDGAssetLink, bool bInZeroWorkItemTallys) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniPDGManager::PopulateTOPNetworks); + // Find all TOP networks from linked HDA, as well as the TOP nodes within, and populate internal state. if (!IsValid(PDGAssetLink)) return false; @@ -449,6 +452,7 @@ bool FHoudiniPDGManager::PopulateTOPNodes( const TArray& InTopNodeIDs, UTOPNetwork* InTOPNetwork, UHoudiniPDGAssetLink* InPDGAssetLink, bool bInZeroWorkItemTallys) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniPDGManager::PopulateTOPNodes); if (!IsValid(InPDGAssetLink)) return false; @@ -2226,6 +2230,8 @@ EHoudiniBGEOCommandletStatus FHoudiniPDGManager::UpdateAndGetBGEOCommandletStatu bool FHoudiniPDGManager::IsPDGAsset(const HAPI_NodeId& InAssetId) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniPDGManager::IsPDGAsset); + if (InAssetId < 0) return false; diff --git a/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp index 5f45b8aadb..e140e718a2 100755 --- a/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniParameterTranslator.cpp @@ -2706,6 +2706,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) { case EHoudiniParameterType::Float: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue-Float); UHoudiniParameterFloat* FloatParam = Cast(InParam); if (!IsValid(FloatParam)) { @@ -2726,6 +2727,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::Int: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - Int); UHoudiniParameterInt* IntParam = Cast(InParam); if (!IsValid(IntParam)) { @@ -2746,6 +2748,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::String: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - String); UHoudiniParameterString* StringParam = Cast(InParam); if (!IsValid(StringParam)) { @@ -2770,6 +2773,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::IntChoice: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - IntChoice); UHoudiniParameterChoice* ChoiceParam = Cast(InParam); if (!IsValid(ChoiceParam)) return false; @@ -2783,6 +2787,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) ChoiceParam->GetNodeId(), &IntValue, ChoiceParam->GetValueIndex(), ChoiceParam->GetTupleSize()), false); } break; + case EHoudiniParameterType::StringChoice: { UHoudiniParameterChoice* ChoiceParam = Cast(InParam); @@ -2793,6 +2798,8 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) if (ChoiceParam->IsStringChoice()) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - StringChoice); + // Set the parameter's string value. std::string ConvertedString = TCHAR_TO_UTF8(*(ChoiceParam->GetStringValue())); HOUDINI_CHECK_ERROR_RETURN( FHoudiniApi::SetParmStringValue( @@ -2801,6 +2808,8 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) } else { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - StringChoice - Int); + // Set the parameter's int value. int32 IntValue = ChoiceParam->GetIntValueIndex(); HOUDINI_CHECK_ERROR_RETURN( FHoudiniApi::SetParmIntValues( @@ -2812,6 +2821,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::Color: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - Color); UHoudiniParameterColor* ColorParam = Cast(InParam); if (!IsValid(ColorParam)) return false; @@ -2830,6 +2840,8 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::Button: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - Button); + UHoudiniParameterButton* ButtonParam = Cast(InParam); if (!ButtonParam) return false; @@ -2848,6 +2860,8 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::ButtonStrip: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - Strip); + UHoudiniParameterButtonStrip* ButtonStripParam = Cast(InParam); if (!ButtonStripParam) return false; @@ -2862,6 +2876,8 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::Toggle: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - Toggle); + UHoudiniParameterToggle* ToggleParam = Cast(InParam); if (!ToggleParam) return false; @@ -2880,8 +2896,9 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::FileGeo: case EHoudiniParameterType::FileImage: { - UHoudiniParameterFile* FileParam = Cast(InParam); + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - File); + UHoudiniParameterFile* FileParam = Cast(InParam); if (!UploadDirectoryPath(FileParam)) return false; } @@ -2889,6 +2906,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::MultiParm: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - MultiParm); if (!UploadMultiParmValues(InParam)) return false; } @@ -2897,6 +2915,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::FloatRamp: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - FloatRamp); if (!UploadRampParameter(InParam)) return false; } @@ -2904,6 +2923,7 @@ FHoudiniParameterTranslator::UploadParameterValue(UHoudiniParameter* InParam) case EHoudiniParameterType::ColorRamp: { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniParameterTranslator::UploadParameterValue - ColorRamp); if (!UploadRampParameter(InParam)) return false; } diff --git a/Source/HoudiniEngine/Private/HoudiniSkeletalMeshTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniSkeletalMeshTranslator.cpp index 7b26eca672..9a963977ff 100644 --- a/Source/HoudiniEngine/Private/HoudiniSkeletalMeshTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniSkeletalMeshTranslator.cpp @@ -1113,6 +1113,8 @@ FHoudiniSkeletalMeshTranslator::ProcessSkeletalMeshOutputs( TMap& InAllOutputMaterials, UObject* InOuterComponent) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniSkeletalMeshTranslator::ProcessSkeletalMeshOutputs); + if (!IsValid(InOutput)) return false; diff --git a/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp index 2b7d41aa0a..afbb660f92 100755 --- a/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniSplineTranslator.cpp @@ -1516,6 +1516,7 @@ FHoudiniSplineTranslator::HapiCreateCurveInputNode( UHoudiniSplineComponent* FHoudiniSplineTranslator::CreateHoudiniSplineComponentFromHoudiniEditableNode(const int32 & GeoId, const FString & PartName, UObject* OuterComponent) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniSplineTranslator::CreateHoudiniSplineComponentFromHoudiniEditableNode); if (GeoId < 0) return nullptr; @@ -2122,6 +2123,7 @@ FHoudiniSplineTranslator::CreateOutputSplinesFromHoudiniGeoPartObject( bool FHoudiniSplineTranslator::CreateAllSplinesFromHoudiniOutput(UHoudiniOutput* InOutput, UObject* InOuterComponent) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniSplineTranslator::CreateAllSplinesFromHoudiniOutput); if (!IsValid(InOutput)) return false; diff --git a/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp b/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp index e36b97e6eb..b6fd95d634 100755 --- a/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp +++ b/Source/HoudiniEngineRuntime/Private/HoudiniAssetComponent.cpp @@ -2429,6 +2429,8 @@ UHoudiniAssetComponent::SetStaticMeshGenerationProperties(UStaticMesh* InStaticM void UHoudiniAssetComponent::UpdatePhysicsState() { + TRACE_CPUPROFILER_EVENT_SCOPE(UHoudiniAssetComponent::UpdatePhysicsState); + // Update physics representation right away. RecreatePhysicsState(); diff --git a/Source/HoudiniEngineRuntime/Private/HoudiniGenericAttribute.cpp b/Source/HoudiniEngineRuntime/Private/HoudiniGenericAttribute.cpp index b2571af959..540dce2855 100755 --- a/Source/HoudiniEngineRuntime/Private/HoudiniGenericAttribute.cpp +++ b/Source/HoudiniEngineRuntime/Private/HoudiniGenericAttribute.cpp @@ -372,6 +372,8 @@ FHoudiniGenericAttribute::UpdatePropertyAttributeOnObject( TArray* OutChangedProperties, const FFindPropertyFunctionType& InFindPropertyFunction) { + TRACE_CPUPROFILER_EVENT_SCOPE(FHoudiniGenericAttribute::UpdatePropertyAttributeOnObject); + if (!IsValid(InObject)) return false;