diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-03-16 09:37:30 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-03-16 09:43:17 +0300 |
commit | d49e7b82da67885aac5933e094ee217ff777ac03 (patch) | |
tree | 6ef994837bc165e76bd17aacb1f5296033f31c09 /source/blender/editors/include | |
parent | 269536d47ec5684a1c6018353120559be0ba2961 (diff) |
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/ED_clip.h | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_image.h | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_node.h | 5 | ||||
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 5 |
4 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 56494f87bfe..21d8a28e2c9 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -64,6 +64,10 @@ struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float *scale, float *angle); +bool ED_space_clip_get_position(struct SpaceClip *sc, + struct ARegion *ar, + int mval[2], + float fpos[2]); bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *region, int mval[2], diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index b139b0765a3..ec525806b81 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -53,6 +53,10 @@ void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage *sima); struct Mask *ED_space_image_get_mask(struct SpaceImage *sima); void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask); +bool ED_space_image_get_position(struct SpaceImage *sima, + struct ARegion *region, + int mval[2], + float fpos[2]); bool ED_space_image_color_sample( struct SpaceImage *sima, struct ARegion *region, int mval[2], float r_col[3], bool *r_is_data); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index ea2383457c2..67a50b83bd6 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -121,6 +121,11 @@ void ED_node_composite_job(const struct bContext *C, void ED_operatormacros_node(void); /* node_view.c */ +bool ED_space_node_get_position(struct Main *bmain, + struct SpaceNode *snode, + struct ARegion *region, + const int mval[2], + float fpos[2]); bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 5620d39ab16..d23daf7f0e3 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -2078,7 +2078,10 @@ void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool colors); -void uiTemplateCryptoPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname); +void uiTemplateCryptoPicker(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + int icon); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, |