获取HEU_HoudiniAssetRoot的参数
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HoudiniEngineUnity;
public class TestHoudiniModel : MonoBehaviour
{
// 获取HoudiniAssetRoot脚本组件
public HEU_HoudiniAssetRoot assetRoot;
// 获取脚本组件上的Asset
private HEU_HoudiniAsset asset;
// 得到Asset里的参数对象
private HEU_Parameters parameters;
// Start is called before the first frame update
void Start()
{
this.asset = this.assetRoot.HoudiniAsset;
this.parameters = this.asset.Parameters;
string result;
// 获取名字叫CurveCoordinates的参数,并把值获取出来
this.parameters.GetStringParameterValue("CurveCoordinates", out result);
Debug.Log(result);
}
// Update is called once per frame
void Update()
{
}
设置HEU_HoudiniAssetRoot的参数和应用参数渲染结果
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HoudiniEngineUnity;
public class TestHoudiniModel : MonoBehaviour
{
// 获取HoudiniAssetRoot脚本组件
public HEU_HoudiniAssetRoot assetRoot;
// 获取脚本组件上的Asset
private HEU_HoudiniAsset asset;
// 得到Asset里的参数对象
private HEU_Parameters parameters;
// Start is called before the first frame update
void Start()
{
this.asset = this.assetRoot.HoudiniAsset;
this.parameters = this.asset.Parameters;
// 设置名字叫CurveCoordinates的参数
this.parameters.SetStringParameterValue("CurveCoordinates", "0,0,8 0,5,8 0,5,-2 0,2,-2");
// 调用渲染,含义详见如下
this.asset.RequestCook(true, true, false, true);
}
// Update is called once per frame
void Update()
{
}
RequestCook
方法在Houdini Engine for Unity中用于触发一个烘焙操作。该方法有四个布尔类型的参数,它们的含义如下:
public void RequestCook(bool bCheckParameters, bool bAsync, bool bSkipCookCheck, bool bUploadParameters)
-
bCheckParameters
: 此参数表示在触发烘焙之前是否检查参数的更改。如果设为true
,Houdini Engine 将检查参数是否有改动,并且只有在检测到参数有改动时才会进行烘焙操作。如果设为false
,则无论参数是否改变,都会直接进行烘焙操作。 -
bAsync
: 此参数表示烘焙操作是否异步进行。如果设为true
,烘焙操作将在一个新的线程中进行,允许你的应用程序在等待烘焙完成的同时继续执行其他任务。如果设为false
,烘焙操作将在当前线程上进行,并且会阻塞其他操作,直到烘焙完成。 -
bSkipCookCheck
: 此参数表示是否跳过检查当前是否正在进行烘焙操作。如果设为true
,将不会检查是否有正在进行的烘焙操作,直接开始新的烘焙。如果设为false
,则在开始新的烘焙前会检查是否有正在进行的烘焙操作,如果有,则新的烘焙请求将会等待当前烘焙操作完成后再开始。 -
bUploadParameters
: 此参数表示是否在烘焙之前上传参数到Houdini。如果设为true
,在烘焙开始前会将当前的参数上传到Houdini。如果设为false
,则不会上传参数。
根据你的需要,你可以设置这些参数的值来改变 RequestCook
方法的行为。