32 #include "RNA_prototypes.h"
104 if (eye->
ptr.
type == &RNA_CompositorNodeCryptomatteV2) {
113 const char *display_device;
158 const int render_layer_name_len =
BLI_strnlen(render_layer->
name,
sizeof(render_layer->
name));
159 if (strncmp(prefix, render_layer->
name, render_layer_name_len) != 0) {
163 const int prefix_len = strlen(prefix);
164 if (prefix_len <= render_layer_name_len + 1) {
169 const char *render_pass_name_prefix = render_layer_name_len ?
170 prefix + 1 + render_layer_name_len :
174 if (
STRPREFIX(render_pass->name, render_pass_name_prefix) &&
175 !
STREQLEN(render_pass->name, render_pass_name_prefix,
sizeof(render_pass->name))) {
177 const int x = (int)(fpos[0] * render_pass->rectx);
178 const int y = (int)(fpos[1] * render_pass->recty);
179 const int offset = 4 * (
y * render_pass->rectx +
x);
181 r_col[0] = render_pass->rect[
offset];
193 bool success =
false;
220 bool success =
false;
264 float fpos[2] = {-1.0f, -1.0};
265 switch (
area->spacetype) {
287 if (fpos[0] < 0.0f || fpos[1] < 0.0f || fpos[0] >= 1.0f || fpos[1] >= 1.0f) {
457 switch (event->
val) {
462 const bool is_undo = eye->
is_undo;
542 ot->
idname =
"UI_OT_eyedropper_color";
543 ot->
description =
"Sample a color from the Blender window to store in a property";
struct Scene * CTX_data_scene(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct bScreen * CTX_wm_screen(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
bool BKE_cryptomatte_find_name(const struct CryptomatteSession *session, float encoded_hash, char *r_name, int name_len)
void BKE_cryptomatte_free(struct CryptomatteSession *session)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
#define CMP_CRYPTOMATTE_SRC_RENDER
#define CMP_CRYPTOMATTE_SRC_IMAGE
struct ScrArea struct ScrArea * BKE_screen_find_area_xy(struct bScreen *screen, int spacetype, const int xy[2]) ATTR_NONNULL(1
struct ARegion * BKE_area_find_region_xy(struct ScrArea *area, int regiontype, const int xy[2]) ATTR_NONNULL(3)
#define LISTBASE_FOREACH(type, var, list)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define STREQLEN(a, b, n)
bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *region, const int mval[2], float r_col[3])
bool ED_space_clip_get_position(struct SpaceClip *sc, struct ARegion *region, int mval[2], float fpos[2])
bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *region, const int mval[2], float r_col[3], bool *r_is_data)
bool ED_space_image_get_position(struct SpaceImage *sima, struct ARegion *region, int mval[2], float fpos[2])
bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, const int mval[2], float r_col[3])
bool ED_space_node_get_position(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, const int mval[2], float fpos[2])
void ED_region_tag_redraw(struct ARegion *region)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], struct ColorManagedDisplay *display)
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], struct ColorManagedDisplay *display)
struct ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
void UI_context_active_but_clear(struct bContext *C, struct wmWindow *win, struct ARegion *region)
uiBut * UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
bool UI_but_flag_is_set(uiBut *but, int flag)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
static bool eyedropper_init(bContext *C, wmOperator *op)
static bool eyedropper_cryptomatte_sample_fl(bContext *C, Eyedropper *eye, const int m_xy[2], float r_col[3])
static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3])
static void eyedropper_cancel(bContext *C, wmOperator *op)
static void eyedropper_exit(bContext *C, wmOperator *op)
static bool eyedropper_cryptomatte_sample_renderlayer_fl(RenderLayer *render_layer, const char *prefix, const float fpos[2], float r_col[3])
void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
get the color from the screen.
static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static bool eyedropper_cryptomatte_sample_render_fl(const bNode *node, const char *prefix, const float fpos[2], float r_col[3])
void UI_OT_eyedropper_color(wmOperatorType *ot)
struct Eyedropper Eyedropper
static void eyedropper_draw_cb(const wmWindow *window, void *arg)
static bool eyedropper_poll(bContext *C)
static bool eyedropper_cryptomatte_sample_image_fl(const bNode *node, NodeCryptomatte *crypto, const char *prefix, const float fpos[2], float r_col[3])
static int eyedropper_exec(bContext *C, wmOperator *op)
static void eyedropper_color_sample_text_update(bContext *C, Eyedropper *eye, const int m_xy[2])
static void eyedropper_color_sample(bContext *C, Eyedropper *eye, const int m_xy[2])
@ EYE_MODAL_SAMPLE_CONFIRM
void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name)
void datadropper_win_area_find(const struct bContext *C, const int mval[2], int r_mval[2], struct wmWindow **r_win, struct ScrArea **r_area)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
CryptomatteSession * ntreeCompositCryptomatteSession(const Scene *scene, bNode *node)
void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, const bNode *node, char *r_prefix, size_t prefix_len)
RenderResult * RE_AcquireResultRead(Render *re)
Render * RE_GetSceneRender(const Scene *scene)
RenderLayer * RE_GetRenderLayer(RenderResult *rr, const char *name)
void RE_ReleaseResult(Render *re)
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
struct ColorManagedDisplay * display
struct CryptomatteSession * cryptomatte_session
char sample_text[MAX_NAME]
void * draw_handle_sample_text
ColorManagedDisplaySettings display_settings
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
void WM_draw_cb_exit(wmWindow *win, void *handle)
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const struct wmWindow *, void *), void *customdata)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
#define ISMOUSE_MOTION(event_type)
void WM_window_pixel_sample_read(const wmWindowManager *wm, const wmWindow *win, const int pos[2], float r_col[3])