Transfer Point Positions based on attribute
7866 4 0- eldiren
- Member
- 50 posts
- Joined: May 2015
- Offline
I have a mesh with a primitive group and another mesh where I've extracted that primitive group and done some work on it (in say Zbrush). The primitive group is part of a greater mesh. What I've done is created an attribute called pindex which is assigned the point number. when I do a delete node using my primitive group my pindex maintains the original point number value. Then I attribute copied that to my modified zbrush mesh since both topologies match. So far so good. Here's where things get murky for me. I want to use some form of a loop to check if pindex matches the pointnum from the original geometry upstream. Then I want to change the P vector so it matches the modified geometry. I thought to do this with a point VOP and perhaps a for loop vop, but I never get a value of true indicating that pointnum is equal to pindex. In the for loop vop I basically imported pindex from my second input (that's where I plugged in my modified geo), and ran a compare against ptnum. Anyone have any hints or maybe an even better way to go about this?
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
AttribWrangle in Point mode:
int numpt2 = npoints(@OpInput2);
for (int i = 0; i < numpt2; i++)
{
int ID;
getattribute(@OpInput2, ID, “point”, “id”, i, 0);
if (i@ptnum == ID)
{
vector newPos;
getattribute(@OpInput2, newPos, “point”, “P”, i, 0);
v@P = newPos;
}
}
You could do the same in Detail mode and loop only thru second input points and modify P of first input point that you find with ID attribute from second input. It could be faster that way.
int numpt2 = npoints(@OpInput2);
for (int i = 0; i < numpt2; i++)
{
int ID;
getattribute(@OpInput2, ID, “point”, “id”, i, 0);
if (i@ptnum == ID)
{
vector newPos;
getattribute(@OpInput2, newPos, “point”, “P”, i, 0);
v@P = newPos;
}
}
You could do the same in Detail mode and loop only thru second input points and modify P of first input point that you find with ID attribute from second input. It could be faster that way.
- eldiren
- Member
- 50 posts
- Joined: May 2015
- Offline
- tamte
- Member
- 8594 posts
- Joined: July 2007
- Offline
- eldiren
- Member
- 50 posts
- Joined: May 2015
- Offline
-
- Quick Links