set attrib type (without knowing the type ahead of time?)

   979   4   1
User Avatar
Member
1189 posts
Joined: 4月 2017
オフライン
Hi!

I have 2 geos. One with all the attributes, the other without any attributes (was sculpted in another software). Both have identical vertex count/order.

I'm trying to use a "for" loop in vex to transfer each attributes on primitives. I can get the type with the attribtype function but I don't know what function to apply the attribut type I just found.
string attribA = chs("attribute_A");
string attribB = chs("attribute_B");
string attribC = chs("attribute_C");
string attribD = chs("attribute_D");
string attribE = chs("attribute_E");
string attribF = chs("attribute_F");
string attribG = chs("attribute_G");
string attribH = chs("attribute_H");
string allAttribs[] = array(attribA, attribB, attribC, 
attribD, attribE, attribF, attribG, attribH);
//
int len = len(allAttribs);
for(int i=0; i<len; i++)
    {
    string curattrib = allAttribs[i];
    if(curattrib != "")
        {
        int foundType = attribtype(1, "prim", curattrib);
        //how to use foundType to set the attribute ??
        }
    }
User Avatar
Member
9432 posts
Joined: 7月 2007
オンライン
You use it in an if statement and then for each type assign to compatible variable process however you need

However I usually try to use Attribue Copy or Attribute Interpolate etc to deal with multiple attribs especially when copying, I'd use VEX just to figure out the point index or id attribute in case they have different point counts/order
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
1189 posts
Joined: 4月 2017
オフライン
AHH! Attribute Copy does exactly what I want. Super!

Thank you!

-Olivier
Edited by olivierth - 2025年2月18日 09:25:16
User Avatar
Member
546 posts
Joined: 11月 2016
オフライン
Also, I think in your case copying the P point position from the sculpted geo to the geo with the attributes would be faster.
User Avatar
Member
1189 posts
Joined: 4月 2017
オフライン
DOH! Why didn't I think of that...

Thanks Tanto, that's why you're the boss!
Edited by olivierth - 2025年2月18日 12:57:51
  • Quick Links