Triggering Houdini functions from script without recooking

   3529   5   0
User Avatar
Member
6 posts
Joined: Jan. 2019
Offline
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?
User Avatar
Member
571 posts
Joined: May 2017
Offline
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.
User Avatar
Member
6 posts
Joined: Jan. 2019
Offline
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!
User Avatar
Member
571 posts
Joined: May 2017
Offline
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.
User Avatar
Member
6 posts
Joined: Jan. 2019
Offline
Ok thanks for your help
User Avatar
Member
4 posts
Joined: Feb. 2016
Offline
mark, pressButton is here!
  • Quick Links