Search - User list
Full Version: Triggering Houdini functions from script without recooking
Root » Houdini Engine for Unity » Triggering Houdini functions from script without recooking
Hugecalf
Our Houdini asset has a button to save the paint data related to the terrain height to disk.
Currently we've got our project set up so that when the artist who is designing the level presses ctrl + s triggers a save of the Unity scene and also triggers a button press on the ‘Save Paint data’ button on the Houdini asset.

HEU_HoudiniAsset houdiniAsset = GetHoudiniAsset();
HEU_Parameters parameters = houdiniAsset.Parameters;
HEU_ParameterData saveGridButtonParam = parameters.GetParameter("execute");
saveGridButtonParam._intValues[0] = saveGridButtonParam._intValues[0] == 0 ? 1 : 0;
houdiniAsset.RequestCook(bCheckParametersChanged: true, bAsync: false, bSkipCookCheck: false, bUploadParameters: true);

The problem we have is that to trigger the button press you have to recook the asset, and because our asset can become extremely large - it can take anywhere from 30 - 60 seconds to recook the asset. If we were to click the button ‘Save Paint data’, the time taken to save the data is a fraction of that time.

Is there a way to trigger the functions inside of the Houdini asset to run without recooking the entire asset?
seelan
When you call RequestCook with bUploadParameters set to true, it uploads the parm values, which triggers the button script. I wonder if it will trigger directly just by uploading the parm value, instead of calling RequestCook. You can test this by following code:

HEU_Parameters parameters = houdiniAsset.Parameters;
HEU_ParameterData saveGridButtonParam = parameters.GetParameter("execute");
saveGridButtonParam._intValues[0] = saveGridButtonParam._intValues[0] == 0 ? 1 : 0;

// Set parm directly
HEU_SessionBase session = houdiniAsset.GetAssetSession(true);
session.SetParamIntValue(houdiniAsset.AssetID, saveGridButtonParam._name, 0, saveGridButtonParam._intValues[0]);

You might still have to cook later to use the HDA, but if you are just doing this through code, it might be okay.
Hugecalf
Yeah that's worked… You are a life saver!

I'm now trying to update a string parameter in the same way but it's not refreshing on the asset. Do you know how to do that by chance?

Many thanks!
seelan
You'll have to cook the asset if you want to see the update on the UI. That's how its designed as otherwise we can get into pretty bad state between the asset in Houdini and its representation in Unity.
Hugecalf
Ok thanks for your help
iJasonLee
mark, pressButton is here!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB