Hi, Maybe someone missed this cool update and didn't point it out in the release notes, but in H20.5 it's now possible to define your types directly in the AttribWrangle snippet.
#include <math.h>#outer // {// This code will be placed outside of the generated functionstructPoint{floatx, y;
floatdist(constPointother){returnsqrt(pow(other.x - x, 2) + pow(other.y - y, 2));
}};
structRectangle{Pointp1, p2;
floatarea(){returnabs((p1.x - p2.x) * (p1.y - p2.y));
}floatperimeter(){return2 * (abs(p1.x - p2.x) + abs(p1.y - p2.y));
}}#endouter // }// This code will be in the function.Pointpt1 = Point(0,0);
Pointpt2 = Point(1,2);
@dist = pt1->dist(pt2);
Rectanglerect = Rectangle(pt1, pt2);
@area = rect->area();
@perimeter = rect->perimeter();
Coding is black magic for me, but iam curious about it and specially interested in new possibilities compared with previous version. I love Houdinis endless power
oldteapot7 Can you explain it in more detail please?
Coding is black magic for me, but iam curious about it and specially interested in new possibilities compared with previous version. I love Houdinis endless power
In Vex you can define struct, which is like several variables grouped together. However, there was a caveat: you couldn't define a new struct in Attribute Wrangle. You had to define it in an external file. Since Attribute Wrangle is where most people use VEX, it was rather inconvenient to define struct.
Now you can do it. It technically doesn't open new possibilities, just more convenient than before.