Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect : Add new node for collecting arbitrary values #5424

Merged
merged 3 commits into from
Aug 23, 2023

Conversation

johnhaddon
Copy link
Member

Like CollectScenes, CollectImages and others, this allows the repeated collection of the same inputs across a range of contexts. Unlike the others, it is designed to collect completely generic values from any plug, outputting the results as arrays of values. This is all parallelised within a parallel_for across the range of contexts. We anticipate it being a useful utility node with a variety of uses. In the example below I'm using it to query scene attributes from a range of locations, presenting the results in a handy spreadsheet form - a sort of build-it-yourself scene inspector.

image

@johnhaddon johnhaddon self-assigned this Aug 16, 2023
Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! A lot of potential here for both ad-hoc and reusable scene inspection setups. A few minor comments inline, but nothing particularly stands out.

I can do a final review next week once those other changes you have pending are pushed...

include/Gaffer/Collect.h Outdated Show resolved Hide resolved
src/Gaffer/Collect.cpp Outdated Show resolved Hide resolved
python/GafferUI/CollectUI.py Show resolved Hide resolved
@@ -0,0 +1,122 @@
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2022, Cinesite VFX Ltd. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this say 2023?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, but I don't think so. Believe it or not, I started working on this on a train journey back in 2022, and pushed it to GitHub ("publishing" it) the same year.

// If `plug` is a supported type, downcasts it to its true type and
// calls `functor( plug, args )`. Otherwise, does nothing.
template<typename F>
void dispatchPlugFunction( const ValuePlug *plug, F &&functor )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think this might be useful elsewhere like IECore::dispatch? Perhaps this could be in PlugAlgo or similar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we might end up with something like that at some point - I did something similar in RandomChoice as well. A generic PlugAlgo function would be slightly different in that it would need to support all plug types though, and then Collect and RandomChoice would need to be adapted to filter out the ones they don't support. I expect we'll do that at some point, but I don't see any harm in waiting for another use case or two to see if it changes the requirements.

@johnhaddon
Copy link
Member Author

Thanks for the review Murray - I've pushed commits to address your comments, and replied to each comment pointing to the appropriate commit.

Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks John! Looks good to merge once the conflicts are sorted.

@johnhaddon johnhaddon merged commit 32c42d9 into GafferHQ:1.3_maintenance Aug 23, 2023
4 checks passed
@johnhaddon johnhaddon deleted the collect branch August 23, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants