https://www.sidefx.com/docs/unreal/_parameters.html#ParametersFile [www.sidefx.com]
The document explain paths relative to unreal project are converted to absolute paths in Houdini. But in my test, it turns out that it's relative to UE4Editor.exe but not current unreal project.
For example I have a test.bgeo in my ue project directory which is "D:/HoudiniFiles/UeProjects/Project7/". What I expected is I can just type "test.bgeo" in file parameter of houdini_bgeo_import(a hda contained by houdini engine plugin) and It will be converted to "D:/HoudiniFiles/UeProjects/Project7/test.bgeo". However, what really happens is It was converted to "D:/unreal/UE_4.26/Engine/Binaries/Win64/test.bgeo", which is the directory of UE4Editor. Although it is exactly how unreal engine deal with relative path, this doesn't correspond to the documents.
People would place their project wherever they like and these path problems make transfering project terrible. In some topics, I see a methord which is manually declaring project path on HDA. Is there any way to solve this by editing source code of houdini engine?
Problem with using relative path in HDA parameter in ue4
2637 1 0- evianaive
- Member
- 10 posts
- Joined: April 2020
- Offline
- evianaive
- Member
- 10 posts
- Joined: April 2020
- Offline
I thought the source code of updating relative path part start from line 3760 in "HoudiniEngine/Source/HoudiniEngineEditor/HoudiniParameterDetails.cpp"
auto UpdateCheckRelativePath = (const FString & PickedPath)
{
UHoudiniAssetComponent* HoudiniAssetComponent = Cast<UHoudiniAssetComponent>(MainParam->GetOuter());
if (MainParam->GetOuter() && !PickedPath.IsEmpty() && FPaths::IsRelative(PickedPath))
{
// Check if the path is relative to the UE4 project
FString AbsolutePath = FPaths::ConvertRelativePathToFull(PickedPath);
if (FPaths::FileExists(AbsolutePath))
{
return AbsolutePath;
}
// Check if the path is relative to the asset
if (HoudiniAssetComponent && !HoudiniAssetComponent->IsPendingKill())
{
if (HoudiniAssetComponent->HoudiniAsset && !HoudiniAssetComponent->HoudiniAsset->IsPendingKill())
{
FString AssetFilePath = FPaths::GetPath(HoudiniAssetComponent->HoudiniAsset->AssetFileName);
if (FPaths::FileExists(AssetFilePath))
{
FString UpdatedFileWidgetPath = FPaths::Combine(*AssetFilePath, *PickedPath);
if (FPaths::FileExists(UpdatedFileWidgetPath))
{
return UpdatedFileWidgetPath;
}
}
}
}
}
return PickedPath;
};
auto UpdateCheckRelativePath = (const FString & PickedPath)
{
UHoudiniAssetComponent* HoudiniAssetComponent = Cast<UHoudiniAssetComponent>(MainParam->GetOuter());
if (MainParam->GetOuter() && !PickedPath.IsEmpty() && FPaths::IsRelative(PickedPath))
{
// Check if the path is relative to the UE4 project
FString AbsolutePath = FPaths::ConvertRelativePathToFull(PickedPath);
if (FPaths::FileExists(AbsolutePath))
{
return AbsolutePath;
}
// Check if the path is relative to the asset
if (HoudiniAssetComponent && !HoudiniAssetComponent->IsPendingKill())
{
if (HoudiniAssetComponent->HoudiniAsset && !HoudiniAssetComponent->HoudiniAsset->IsPendingKill())
{
FString AssetFilePath = FPaths::GetPath(HoudiniAssetComponent->HoudiniAsset->AssetFileName);
if (FPaths::FileExists(AssetFilePath))
{
FString UpdatedFileWidgetPath = FPaths::Combine(*AssetFilePath, *PickedPath);
if (FPaths::FileExists(UpdatedFileWidgetPath))
{
return UpdatedFileWidgetPath;
}
}
}
}
}
return PickedPath;
};
-
- Quick Links