Group from materialpath

   1738   4   1
User Avatar
Member
9 posts
Joined: Aug. 2019
Offline
Hey, I'm trying to group primitives on an imported tree FBX using the material shop path. I've done this before in a previous version, and for some reason, I can't figure out what I'm doing wrong. No matter how I select them, and whether I try to group/blast/delete, use this selection to do anything, nothing seems to work.

I can select them using “Display group and attribute list” and my group sop recognizes it, then fills in the @shop_materialpath for me. However the group for all selected primitives is still 0? If I try to delete these faces, the same thing, I get no results.

Any help would be super appreciated, let me know if I can provide any more information.

EDIT: It seems this problem is related to the specific FBX's I'm trying to do this to. Is it the syntax of the material path that is causing an issue maybe?
Edited by Kronso - May 11, 2020 23:59:45

Attachments:
shop_materialpath.jpg (581.4 KB)

tamte
Member
5704 posts
Joined: July 2007
Offline
hard to say without a file, but in your specific case try this in Prim Wrangle
string group = split(s@shop_materialpath, "_")[-1];
setprimgroup(0, group, @primnum, 1);
it should create all 5 groups for you
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
9 posts
Joined: Aug. 2019
Offline
Wow, perfect. Thanks so much Tomas, I have a feeling this'll save me a looottt of time in the future!
User Avatar
Member
2 posts
Joined: Oct. 2020
Offline
tamte
hard to say without a file, but in your specific case try this in Prim Wrangle
string group = split(s@shop_materialpath, "_")[-1];
setprimgroup(0, group, @primnum, 1);
it should create all 5 groups for you

Sorry, can you explain this more? I'm trying to do the same thing and I don't get it.
tamte
Member
5704 posts
Joined: July 2007
Offline
remiller91
Sorry, can you explain this more? I'm trying to do the same thing and I don't get it.

let's consider a single primitive with shop_materialpath attibute value of "a_b_c_twigs" (jsut to use pervious example)

then
- split(s@shop_materialpath, "_") outtputs array of strings using "_" as a separator so: {"a", "b", "c", "twigs"}
- next. [-1]is a syntax to pick last element from this array so: "twigs"
and assigns it to string variable called group
- and last line, setprimgroup(), just assigns the current primitive to a group of that name, so in this case group called "twigs", it will create such group if it doesnt exist

if used in Prim Wrangle, this runs for all primitives and assigns each of them to a group based on it's value of shop_materialpath atribute
Edited by tamte - Sept. 15, 2021 15:25:16
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links