Houdini & Vex

Terminology

Shortcuts

  • Align nodes : a + move mouse with L click

How to create HDA and work on it

  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 study]

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

[ Vex & 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
...
@attr_name = value; # if the type is not specified here, it mean that it is float
f@attr_name = value;
s@path = replace(tar_path, "this_string", "to_string");

String functions

  • Strings
  • Examples ```vex 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

```python
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("/")

[ Foreach loop ]

  1. Feedback each iteration vs Merge each iteration

    • Feedback each iteration : 말그대로, 매 iteration 마다, input 대상을 갱신 하면서 횟수만큼 하고자 하는 logic을 적용

    • Merge each iteration : 횟수만큼 input 대상을 복사해서 각 대상에 logic을 적용.

    • Comparision

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

      before after
      img 3)
      ex_feedback_iteration
      img 4)
      ex_feedback_iteration
    • img 1-4

      1. img 1
        • foreach_feedback
      2. img 2
        • foreach_feedback
      3. img 3
        • ex_feedback_iteration
      4. img 4
        • ex_feedback_iteration

results matching ""

    No results matching ""