From 6f1c0ba2cd4dffc66c44d598b80e9e5cdc6fa4e1 Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Fri, 11 Feb 2022 12:10:30 -0500 Subject: [PATCH] Version 2 - When using the "Pack before merge" option on inputs, the plugin now uses the origin for the pivot location instead of the centroid. --- Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp b/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp index 91b4d320c1..3d4937a20e 100755 --- a/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp +++ b/Source/HoudiniEngine/Private/HoudiniInputTranslator.cpp @@ -945,6 +945,7 @@ FHoudiniInputTranslator::UpdatePackBeforeMerge(UHoudiniInput* InInput) bool bSuccess = true; const std::string sPack = "pack"; + const std::string sPivot = "pivot"; // We'll be going through each input object plugged in the input's merge node // and change the pack parameter there @@ -970,6 +971,12 @@ FHoudiniInputTranslator::UpdatePackBeforeMerge(UHoudiniInput* InInput) FHoudiniEngine::Get().GetSession(), InputObjectNodeId, sPack.c_str(), 0, nPackValue)) bSuccess = false; + + // Change the pivot parameter on the object merge to "origin" + if (HAPI_RESULT_SUCCESS != FHoudiniApi::SetParmIntValue( + FHoudiniEngine::Get().GetSession(), InputObjectNodeId, + sPivot.c_str(), 0, 0)) + bSuccess = false; } }