Filtering highest file / folder version

   2975   7   3
User Avatar
Member
54 posts
Joined: Aug. 2010
Offline
Hey,

Painfully close on this but wondering what the intended workflow would be for processing highest values only.

As an example, i'm using a file pattern glob so that given a number of shots i can get all the hip files per shot - that gives me lots of useful info including an index based on file versions!

I'd like to then go forward with just the highest index. If it was geo i'd do an attrib promote to get the max and filter anything less - would the same logic but with a python script make most sense? or is there a more elegant solution i'm missing?

~Craig
~ Craig Tonks | CG Supervisor | Outpost VFX
User Avatar
Member
544 posts
Joined: Sept. 2012
Offline
Maybe try the “Filter by Expression” node, with an expression like @pdg_index < threshold ? That will get rid of workitems with index below that threshold. If it's some other attribute and not index, it would be just @whatever_attrname
- Ken Xu
User Avatar
Member
54 posts
Joined: Aug. 2010
Offline
Thanks Ken!

Theres two problems with that though:

1. I wont always know the largest index, so i need some attribute promote style way of finding the max. Which is possible for all work items at once, but…
2. the work items belong to different folders. So i need the threshold for each group / partition of items

Essentially looking at Partition by folder attribute, loop over all items in that group and get the max - then do filter by expression. I just havnt got my head around the python code to do it and pass everything back out correctly

Attribute promote on work items or by partitioned items would be a great addition in the future!
~ Craig Tonks | CG Supervisor | Outpost VFX
User Avatar
Member
603 posts
Joined: Sept. 2016
Offline
mrtonks
Attribute promote on work items or by partitioned items would be a great addition in the future!

Thanks for bringing it up, it's come up before and we certainly need to add something like that.
In the meantime I've attached a hip showing 2 ways to do it now with python.

Attachments:
attributepromote.hip (250.2 KB)

User Avatar
Member
54 posts
Joined: Aug. 2010
Offline
Great stuff i'll have a look at this this weekend! Thanks!
~ Craig Tonks | CG Supervisor | Outpost VFX
User Avatar
Member
54 posts
Joined: Aug. 2010
Offline
This is a great start Chris! So what i'm trying to do is that, butttt combined with partitioning by shot.

I've re-attached the file and added in a basic example of the work items having a “shot” string attribute - so we've hypothetically found all versions in these shots and want to chuck out all but the highest

Attachments:
attributepromote_cat.hiplc (253.6 KB)

~ Craig Tonks | CG Supervisor | Outpost VFX
User Avatar
Member
603 posts
Joined: Sept. 2016
Offline
Here you go. There are a few RFE in our backlog that will make this simpler, including an option ‘By Attribute’ to the partitioner Advanced/Sort Partition By parm

Attachments:
attributepromote_cat_2.hiplc (298.6 KB)

User Avatar
Staff
585 posts
Joined: May 2014
Offline
We've implemented some additional options on the partitioner nodes and work item expand so you no longer need a Python processor.

The partitioner can now sort its contents by Attribute, and can sort in either acsending or descending order. I've changed the Partition by Attribute in your file to sort by “version” in descending order, so the max version shot is the first element of the partition.

Additionally, the Work Item Expand now has a mode to clone the first N or last N items from an upstream partition. Rather than using a Python Processor, its now possible to use the work item expand to select the max version (first) work item from the partition by attribute.

I attached the updated file, which will work in the latest daily build of 17.5.
Edited by tpetrick - May 30, 2019 12:28:01

Attachments:
attributepromote_cat_2.hiplc (130.3 KB)

  • Quick Links