Prims and points have some order, which is different from the point number, so the order of wrangle by point does not suit me. I created wrangle (by detail) and used loops for make order.
There is new problem. Houdini doesn't change attribute and read the changing, so I used vector4 (x,y,z = x,y,z of Position) and w of vector4 is point number. I removed almost all the code, leaving only that does not work
//PART 1: (check the queue number of the point, and in the order
of the queue add vector4 to the array):
for (int pts_order = 0; pts_order<@numpt; pts_order ++) {
for (int j=0; j<@numpt; j++){
if (pts_order == point(0,“order”,j)){
vector4 pq;
pq.w = j;
vector pv = point(0,“P”,j);
pq.x = pv.x;
pq.y = pv.y;
pq.z = pv.z;
append(points, pq);
}
}
}
//PART 2 (the same cycle for primitive order
. For each primitive there is a group with its name. Each group contains points. We go through all points in turn and check for their presence in this group. first - attribute on all prims about what is the prim parent. I needn't change P of parent prim. then I make some changes in the position and rotation of the points, just to make at least something change.)
for (int prim_order=0; prim_order<100; prim_order++) {
for (int prim = 0; prim<@numprim; prim++) {
if ((prim(0, “order”, prim) == prim_order) && (prim != prim(0,“first”,prim))){
string grname = concat(“g_”, itoa(prim));
int ptsingr = expandpointgroup(0,grname);
foreach (vector4 pt; points) {
foreach (int ptingr; ptsingr){
if (pt.w == ptingr) {
//created a vector (Pv) from the first three values of the vector4 (pt)
vector Pv;
Pv.x = pt.x;
Pv.y = pt.y;
Pv.z = pt.z;
Pv = qrotate(quaternion(1, {0,1,0}), Pv);
Pv = Pv+1;
//reassembling vector 4 , pt.w without any changes
pt.x = Pv.x;
pt.y = Pv.y;
pt.z = Pv.z;
}
}
}
}
}
}
//PART 3 (assign value of vector4 to position)
foreach (vector4 pt; points) {
vector PV;
PV.x = pt.x;
PV.y = pt.y;
PV.z = pt.z;
setpointattrib(0,“P”,pt.w,PV,“set”);
}
I cannot use the solver as I need to quickly switch parts of the lowpoly model. And the solver requires resimulation every time I change a part of my model. Something with vector4 does not work. I checked for loops, if i just change position without using array with vector4 then everything works.
