KINEFX Hierarchy "Path" Attribute

   1411   3   0
User Avatar
Member
6 posts
Joined: May 2016
Offline
Hello Magicians, I need to export a hierarchy "path" attribute in the KineFX using the @name attribute. I have created a hierarchy order by the id attribute. How to create a hierarchy "path" attr using "name" attr?

Attachments:
cloth_sim_transfer_v1.hip (592.8 KB)

User Avatar
Member
8832 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:
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
FX Supervisor
Method Studios, NY
User Avatar
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):

#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.
madebygeoff.com
User Avatar
Member
6 posts
Joined: May 2016
Offline
Thank you guys, all of your helps work like a charm

tamte's script is that's what I want.
getancestors function looks interesting. but I don't know how to use it. I'm still learning...
  • Quick Links