美文网首页
【Houdini】VEX之 四 阵列

【Houdini】VEX之 四 阵列

作者: _More | 来源:发表于2023-05-29 09:30 被阅读0次

阵列array

 float farray[ ] = {1.2,2.3,3.4};

string sarray[ ] = {"A","B","C","D"};

 vector varray[ ] = {{1,2,3},{2,3,4},{3,4,5}};

使用变量时,阵列按如下方式写:

 float fval = 2.5; string sval = "A";

vector vval = {1,2,3};

float farray[ ] = array(fval,2.3,3.4);

string sarray[ ] = array(sval,"B","C","D");

vector varray[ ] = array(vval,{2,3,4},{3,4,5});

最后将阵列数据存储

 f[]@fvals = farrary;

 s[]@svals = sarrary;

v[]@vvals = varrary;

 或者

 setdetailattrib(0,"fvals",farrary);

setdetailattrib(0,"svals",sarrary);

 setdetailattrib(0,"vvals",varrary);

得到相同的结果

阵列枚举

float values[] = {1.1,2.3.5,3,4};

int index = chi("index");

@p.x = values[index];


x轴位置信息取值为索引index 0-3 控制的阵列value对应第1-4的元素

在阵列中添加元素

push (arrary,item);

给阵列arrary 中添加元素item

在阵列中删除元素

removevalue(valunes,1)

removeindex(values,0)

f[]@vals = values;

阵列数据类型转换

vector vvals[] = {1,2,3};

float vals[] = set(vvals);

f[]@val = vals;

阵列长度

float arrays[] = {1.1,2.2,3.3,4.4};

int arrlen = len(arrays);

i@len = arrlen;

相关文章

网友评论

      本文标题:【Houdini】VEX之 四 阵列

      本文链接:https://www.haomeiwen.com/subject/jocibrtx.html