July 24, 2021

Houdini 学习 Engine For Unity-Plugin API

Houdini 学习 Engine For Unity-Plugin API

官方文档

HEU分为三部分:

Asset layer

即资产创建以及参数获取和修改的操作,包含以下几个类:

官方提供了一个相关的实例文档
Plugins / HoudiniEngineUnity / Scripts / Examples / HEU_ExampleEvergreenQuery.cs

文档阅读笔记

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using HoudiniEngineUnity;

HEU_AssetDatabase.GetAssetFullPath

//Manages the asset database to store persistent assets such as materials, textures, asset data, etc. Wraps around Unity AssetDatabase. Only available in Editor. Probably not needed at runtime as data probably does not need to persist past session.
//Given relative path to an asset (with Assets/ in the path), this returns the full path to it.

HEU_SessionBase
//Base class for a Houdini Engine session. Contains functionality to interface with the Houdini Engine for a particular session.

HEU_SessionManager.GetOrCreateDefaultSession()
//Manages a session for Houdini Engine. Supports all types of sessions.
//获取或者创建有效会话


HEU_HAPIUtility.InstantiateHDA(evergreenFullPath, Vector3.zero, session, true);
//houdini引擎的工作,如创建hda,cook等。
//Load and instantiate an HDA asset in Unity and Houdini, for the asset located at given path.创建指定路径的hda

public static GameObject InstantiateHDA(string filePath, Vector3 initialPosition, HEU_SessionBase session, bool bBuildAsync)
FilePath文件路径 initialPosition 初始位置 获取会话 是否重载


HEU_EditorUtility.SelectObject(rootGO);
//Wrapper around Unity Editor functions.Unity编辑器函数的包装。
//选择物体 返回数组

HEU_HoudiniAsset houdiniAsset = QueryHoudiniAsset(rootGO);
//HEU_HoudiniAsset 资产组件
//QueryHoudiniAsset Shows how to get the HEU_HoudiniAsset component from a HDA root gameobject.

// Make sure the HDA is cooked before querying or changing its properties.
CookAsset(houdiniAsset);

// Example of querying and changing parms.
ChangeParmsAndCook(houdiniAsset);

// This will query objects, geometry, parts, and attributes in the asset.
QueryObjects(houdiniAsset);

// This will query the gravity attribute.
QueryAttribute(houdiniAsset, "EvergreenGenerator", "EvergreenGenerator1", 0, "Cd");

HEU_HoudiniAssetRoot
//The root object of a Houdini Engine asset. Used for organizing hierarchy, and more importantly displaying custom UI.

关于本文

本文作者 Master Gong Sheng, 许可由 CC BY-NC 4.0.