Houdini

Main

Vex

Hscript

HDA (Houdini Digital Asset)

Python

VDB

Other user’s post

Terminology

Shortcuts

  • Align nodes in Network Editor : a + drag with left mouse button

How to Create HDA

  1. create what you want to put hda_001
  2. click create subnet from selection hda_002
  3. keep working on the hda, saving the node type hda_003

Case Studies

Get SOP info from first input

  • SOP level에서 LOP net을 만들고 이것을 감싸는 HDA를 만들었을때, 해당 HDA의 첫번째 input으로 들어오는 SOP object를 LOP network의 SOP import 노드의 SOP path parameter로 들고 오고싶어, 어떻게 SOP path parameter에 expression을 넣어야해 ?? get_sop_from_first_input_001

Save metadata in detail category

  • HDA를 만든다고 할때, python으로 query한 string값의 metadata를 detail 항목으로 저장하고 싶다할때, 어떻게 python 코드를 작성해야돼 ? save_metadata_in_detail_001

Replace file extension in parameter expression

  `strreplace(chs("../../../../lostworldlavaextbvine04a/alembic2/fileName"), ".abc", ".usda")`

Note: strreplace() here is an Hscript expression function (used inside backtick expansion in parameter fields), not a VEX function. The VEX equivalent is replace().

Fetch a parameter value from another node

  1. Create a custom parameter
  2. Put the other node’s path into the parameter
  3. Evaluate the parameter value as a node reference — parm_obj.evalAsNode()

how_to_fetch

Build Assembly asset in LOP network

Entire_Designe

  1. [SOP import node] Import sop object
  2. [Configure Prim / Configure Layer] Set kinds and purpose at Configure Prim, after that, Cache out the SOP object by setting Save Path parameter
    • Save_path_of_configureLayer
  3. Following that, Add the usd layer as a reference.
  4. Create VariantSet, and add each usd layer under the VariantSet
  5. Add Proxy layer as a payload, And Save model version information in a form of custom metadata

Foreach — feedback vs merge

  • Feedback each iteration : 말그대로, 매 iteration 마다, input 대상을 갱신 하면서 횟수만큼 하고자 하는 logic을 적용. 하나의 대상에 반복 작업을 누적할 때 사용.

  • Merge each iteration : 횟수만큼 input 대상을 복사해서 각 대상에 logic을 적용. 복수의 결과를 병렬적으로 만들 때 사용.

  • Comparison

    Category Feedback Merge
    Example img 1)
    foreach_feedback
    img 2)
    foreach_feedback
    Explanation input 대상이 하나이기 때문에 10 번 iteration 이후에도 primitive가 1개임을 알 수 있음 input 대상을 10 번 복사 해서 각각 subdive를 적용하기 때문에, 10 개의 primitive가 각각 한번씩만 subdivide된것을 볼 수 있음
  • Specific example of Feedback each iteration

    before after
    img 3)
    ex_feedback_iteration
    img 4)
    ex_feedback_iteration

Foreach — debug and test loop

Vex and Expression Syntax

Vex Data types

Attribute types

// floats and integers
f@myfloat = 12.234; // float, vex assumes float if you don't specify prefix. Good if you're lazy, bad if you forget and mis-assign things!
i@myint = 5; // integer

// vectors
u@myvector2 = {0.6, 0.5}; // vector2 (2 floats)
v@myvector = {1,2,3}; // vector (3 floats)
p@myquat = {0,0,0,1}; // quaternion / vector4 / 4 floats

// matricies
2@mymatrix2 = {1,2,3,4}; // matrix2 (2x2 floats)
3@mymatrix3 = {1,2,3,4,5,6,7,8,9}; // matrix3 (3x3 floats)
4@mymatrix4 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; // matrix (4x4 floats)

// strings and dictionaries
s@mystring = 'a string'; // string
d@mydict = {}; // dict, can only instantiate as empty type
d@mydict['key'] = 'value'; // can set values once instantiated

Read Attribute

Write Attribute

  • assign value to @attribute_name
// if the type prefix is omitted, VEX assumes float
@attr_name = value;
f@attr_name = value;
s@path = replace(tar_path, "this_string", "to_string");

String functions

  • Strings
  • Examples

    string str = "abcdef abcdef abcdef";
    
    // Returns "abcghi abcghi abcghi"
    string new_str = replace(str, "def", "ghi");
    
    // Replaces up to 2 occurrences of the string "def".
    // Returns "abcghi abcghi abcdef"
    new_str = replace(str, "def", "ghi", 2);
    

Python Cases

Get point or prim attributes

tar_node = cur_node.parm("tar_parm_name").evalAsNode()
geo = tar_node.geometry()
prims_info = geo.prims()
first_element = None
if prims_info == ():
    first_element = geo.points()[0]
else:
    first_element = geo.prims()[0]
path_value = first_element.attribValue("path")
split_val = path_value.split("/")

results matching ""

    No results matching ""