@@ -1978,15 +1978,15 @@ FHoudiniEngineUtils::IsValidNodeId(HAPI_NodeId NodeId)
1978
1978
*/
1979
1979
1980
1980
bool
1981
- FHoudiniEngineUtils::GetHoudiniAssetName (const HAPI_NodeId& AssetNodeId , FString& NameString)
1981
+ FHoudiniEngineUtils::GetHoudiniAssetName (HAPI_NodeId InNodeId , FString& NameString)
1982
1982
{
1983
1983
TRACE_CPUPROFILER_EVENT_SCOPE (FHoudiniEngineUtils::GetHoudiniAssetName);
1984
1984
1985
- if (AssetNodeId < 0 )
1985
+ if (InNodeId < 0 )
1986
1986
return false ;
1987
1987
1988
1988
HAPI_AssetInfo AssetInfo;
1989
- if (FHoudiniApi::GetAssetInfo (FHoudiniEngine::Get ().GetSession (), AssetNodeId , &AssetInfo) == HAPI_RESULT_SUCCESS)
1989
+ if (FHoudiniApi::GetAssetInfo (FHoudiniEngine::Get ().GetSession (), InNodeId , &AssetInfo) == HAPI_RESULT_SUCCESS)
1990
1990
{
1991
1991
FHoudiniEngineString HoudiniEngineString (AssetInfo.nameSH );
1992
1992
return HoudiniEngineString.ToFString (NameString);
@@ -1995,7 +1995,7 @@ FHoudiniEngineUtils::GetHoudiniAssetName(const HAPI_NodeId& AssetNodeId, FString
1995
1995
{
1996
1996
// If the node is not an asset, return the node name
1997
1997
HAPI_NodeInfo NodeInfo;
1998
- if (FHoudiniApi::GetNodeInfo (FHoudiniEngine::Get ().GetSession (), AssetNodeId , &NodeInfo) == HAPI_RESULT_SUCCESS)
1998
+ if (FHoudiniApi::GetNodeInfo (FHoudiniEngine::Get ().GetSession (), InNodeId , &NodeInfo) == HAPI_RESULT_SUCCESS)
1999
1999
{
2000
2000
FHoudiniEngineString HoudiniEngineString (NodeInfo.nameSH );
2001
2001
return HoudiniEngineString.ToFString (NameString);
@@ -2006,20 +2006,26 @@ FHoudiniEngineUtils::GetHoudiniAssetName(const HAPI_NodeId& AssetNodeId, FString
2006
2006
}
2007
2007
2008
2008
bool
2009
- FHoudiniEngineUtils::GetAssetPreset (const HAPI_NodeId& AssetNodeId , TArray<int8>& PresetBuffer)
2009
+ FHoudiniEngineUtils::GetAssetPreset (HAPI_NodeId InNodeId , TArray<int8>& PresetBuffer)
2010
2010
{
2011
2011
TRACE_CPUPROFILER_EVENT_SCOPE (FHoudiniEngineUtils::GetAssetPreset);
2012
2012
PresetBuffer.Empty ();
2013
2013
2014
+ // See if param presets usage is disabled
2015
+ const UHoudiniRuntimeSettings* HoudiniRuntimeSettings = GetDefault<UHoudiniRuntimeSettings>();
2016
+ bool bEnabled = HoudiniRuntimeSettings ? HoudiniRuntimeSettings->bUsePresetsForParameters : true ;
2017
+ if (!bEnabled)
2018
+ return false ;
2019
+
2014
2020
HAPI_NodeId NodeId;
2015
2021
HAPI_AssetInfo AssetInfo;
2016
2022
if (HAPI_RESULT_SUCCESS == FHoudiniApi::GetAssetInfo (
2017
- FHoudiniEngine::Get ().GetSession (), AssetNodeId , &AssetInfo))
2023
+ FHoudiniEngine::Get ().GetSession (), InNodeId , &AssetInfo))
2018
2024
{
2019
2025
NodeId = AssetInfo.nodeId ;
2020
2026
}
2021
2027
else
2022
- NodeId = AssetNodeId ;
2028
+ NodeId = InNodeId ;
2023
2029
2024
2030
if (NodeId < 0 )
2025
2031
return false ;
@@ -2037,6 +2043,34 @@ FHoudiniEngineUtils::GetAssetPreset(const HAPI_NodeId& AssetNodeId, TArray<int8>
2037
2043
return true ;
2038
2044
}
2039
2045
2046
+ bool
2047
+ FHoudiniEngineUtils::SetAssetPreset (HAPI_NodeId InNodeId, const TArray<int8>& PresetBuffer)
2048
+ {
2049
+ TRACE_CPUPROFILER_EVENT_SCOPE (FHoudiniEngineUtils::SetAssetPreset);
2050
+ if (InNodeId < 0 )
2051
+ return false ;
2052
+
2053
+ // See if param presets usage is disabled
2054
+ const UHoudiniRuntimeSettings* HoudiniRuntimeSettings = GetDefault<UHoudiniRuntimeSettings>();
2055
+ bool bEnabled = HoudiniRuntimeSettings ? HoudiniRuntimeSettings->bUsePresetsForParameters : true ;
2056
+ if (!bEnabled)
2057
+ return false ;
2058
+
2059
+ // If we have stored parameter preset - restore them
2060
+ HAPI_Result Res = FHoudiniApi::SetPreset (
2061
+ FHoudiniEngine::Get ().GetSession (),
2062
+ InNodeId,
2063
+ HAPI_PRESETTYPE_BINARY,
2064
+ " hapi" ,
2065
+ (char *)(PresetBuffer.GetData ()),
2066
+ PresetBuffer.Num ());
2067
+
2068
+ if (Res != HAPI_RESULT_SUCCESS)
2069
+ return false ;
2070
+
2071
+ return true ;
2072
+ }
2073
+
2040
2074
bool
2041
2075
FHoudiniEngineUtils::HapiGetAbsNodePath (const HAPI_NodeId& InNodeId, FString& OutPath)
2042
2076
{
@@ -2096,7 +2130,7 @@ FHoudiniEngineUtils::HapiGetNodePath(const FHoudiniGeoPartObject& InHGPO, FStrin
2096
2130
FString NodePathTemp;
2097
2131
if (InHGPO.AssetId == InHGPO.GeoId )
2098
2132
{
2099
- HAPI_NodeId AssetNodeId = -1 ;
2133
+ HAPI_NodeId NodeId = -1 ;
2100
2134
2101
2135
// This is a SOP asset, just return the asset name in this case
2102
2136
HAPI_AssetInfo AssetInfo;
@@ -2105,18 +2139,18 @@ FHoudiniEngineUtils::HapiGetNodePath(const FHoudiniGeoPartObject& InHGPO, FStrin
2105
2139
FHoudiniEngine::Get ().GetSession (), InHGPO.AssetId , &AssetInfo))
2106
2140
{
2107
2141
// Get the asset info node id
2108
- AssetNodeId = AssetInfo.nodeId ;
2142
+ NodeId = AssetInfo.nodeId ;
2109
2143
}
2110
2144
else
2111
2145
{
2112
2146
// Not an asset, just use the node id directly
2113
- AssetNodeId = InHGPO.AssetId ;
2147
+ NodeId = InHGPO.AssetId ;
2114
2148
}
2115
2149
2116
2150
HAPI_NodeInfo AssetNodeInfo;
2117
2151
FHoudiniApi::NodeInfo_Init (&AssetNodeInfo);
2118
2152
if (HAPI_RESULT_SUCCESS == FHoudiniApi::GetNodeInfo (
2119
- FHoudiniEngine::Get ().GetSession (), AssetNodeId , &AssetNodeInfo))
2153
+ FHoudiniEngine::Get ().GetSession (), NodeId , &AssetNodeInfo))
2120
2154
{
2121
2155
if (FHoudiniEngineString::ToFString (AssetNodeInfo.nameSH , NodePathTemp))
2122
2156
{
0 commit comments