KINEFX Hierarchy "Path" Attribute
2525 5 0-
- Hastur
- Member
- 6 posts
- Joined: May 2016
- Offline
-
- tamte
- Member
- 9271 posts
- Joined: July 2007
- Offline
since your "hierarchies" are a single primitive lines (no branching and no individual prim segments) you can possibly just do this in Primitive Wrangle:
be aware though that some of your curves are reversed so their hierarchy flows bottom to top
string path = ""; int pts[] = primpoints(0, @primnum); foreach(int pt; pts){ string name = point(0, "name", pt); path += "/" + name; setpointattrib(0, "path", pt, path); }
be aware though that some of your curves are reversed so their hierarchy flows bottom to top
Edited by tamte - Jan. 16, 2023 14:19:48
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- made-by-geoff
- Member
- 84 posts
- Joined: July 2018
- Offline
I'm not in front of my workstation at the moment, but if you load up the kinefx modules in VEX (start your code with):
There's a command called getancestors() that lets you find the point numbers of all ancestors of the input pt number.
From there you can build your string by modifying Tomas' script above.
It's overkill in this case, but the benefit is that it will work in other setups where you have branching.
#include <kinefx.h>
There's a command called getancestors() that lets you find the point numbers of all ancestors of the input pt number.
int[] getancestors(int geo; int pt; int maxdepth)
From there you can build your string by modifying Tomas' script above.
It's overkill in this case, but the benefit is that it will work in other setups where you have branching.
-
- Hastur
- Member
- 6 posts
- Joined: May 2016
- Offline
-
- GeordieM
- Member
- 16 posts
- Joined: Nov. 2013
- Offline
I just had the same issue. Here's a script using kinefx.h you can put in a point wrangle, assumes you already have the bone names in a name attrib:
#include <kinefx.h> // Get all parent joints of the current point int ancestors[] = getancestors(0, @ptnum, 10); // Create a string array to hold all names in the hierarchy. // The size is the number of parents plus the current point itself. string names[]; resize(names, len(ancestors) + 1); // Loop through the parents and store their names in the array for(int i = 0; i < len(ancestors); i++) { names[i] = point(0, "name", ancestors[i]); } // Add the current point's name to the very end of the array names[-1] = point(0, "name", @ptnum); // Join all the names in the array into a single string, // separated by a forward slash. This correctly handles all cases // and will not produce a leading slash. s@path = join(names, "/");
-
- wallasaurus
- Member
- 1 posts
- Joined: Jan. 2019
- Offline
-
- Quick Links