Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_node/node_view.c')
-rw-r--r--source/blender/editors/space_node/node_view.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index 9a13032b0bc..7023a3ebd18 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -58,7 +58,7 @@
/* **************** View All Operator ************** */
int space_node_view_flag(
- bContext *C, SpaceNode *snode, ARegion *ar, const int node_flag, const int smooth_viewtx)
+ bContext *C, SpaceNode *snode, ARegion *region, const int node_flag, const int smooth_viewtx)
{
bNode *node;
rctf cur_new;
@@ -67,8 +67,8 @@ int space_node_view_flag(
int tot = 0;
bool has_frame = false;
- oldwidth = BLI_rctf_size_x(&ar->v2d.cur);
- oldheight = BLI_rctf_size_y(&ar->v2d.cur);
+ oldwidth = BLI_rctf_size_x(&region->v2d.cur);
+ oldheight = BLI_rctf_size_y(&region->v2d.cur);
oldasp = oldwidth / oldheight;
@@ -114,7 +114,7 @@ int space_node_view_flag(
BLI_rctf_scale(&cur_new, 1.1f);
}
- UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
+ UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx);
}
return (tot != 0);
@@ -122,7 +122,7 @@ int space_node_view_flag(
static int node_view_all_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -130,7 +130,7 @@ static int node_view_all_exec(bContext *C, wmOperator *op)
snode->xof = 0;
snode->yof = 0;
- if (space_node_view_flag(C, snode, ar, 0, smooth_viewtx)) {
+ if (space_node_view_flag(C, snode, region, 0, smooth_viewtx)) {
return OPERATOR_FINISHED;
}
else {
@@ -155,11 +155,11 @@ void NODE_OT_view_all(wmOperatorType *ot)
static int node_view_selected_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
- if (space_node_view_flag(C, snode, ar, NODE_SELECT, smooth_viewtx)) {
+ if (space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx)) {
return OPERATOR_FINISHED;
}
else {
@@ -192,7 +192,7 @@ typedef struct NodeViewMove {
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
NodeViewMove *nvm = op->customdata;
switch (event->type) {
@@ -207,7 +207,7 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e
CLAMP(snode->xof, nvm->xmin, nvm->xmax);
CLAMP(snode->yof, nvm->ymin, nvm->ymax);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
break;
@@ -230,7 +230,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
NodeViewMove *nvm;
Image *ima;
ImBuf *ibuf;
@@ -251,10 +251,10 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *
nvm->mvalo[0] = event->mval[0];
nvm->mvalo[1] = event->mval[1];
- nvm->xmin = -(ar->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
- nvm->xmax = (ar->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
- nvm->ymin = -(ar->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
- nvm->ymax = (ar->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
+ nvm->xmin = -(region->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
+ nvm->xmax = (region->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
+ nvm->ymin = -(region->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
+ nvm->ymax = (region->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
BKE_image_release_ibuf(ima, ibuf, lock);
@@ -290,11 +290,11 @@ void NODE_OT_backimage_move(wmOperatorType *ot)
static int backimage_zoom_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float fac = RNA_float_get(op->ptr, "factor");
snode->zoom *= fac;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
@@ -323,7 +323,7 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Image *ima;
ImBuf *ibuf;
@@ -342,8 +342,8 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- facx = 1.0f * (ar->sizex - pad) / (ibuf->x * snode->zoom);
- facy = 1.0f * (ar->sizey - pad) / (ibuf->y * snode->zoom);
+ facx = 1.0f * (region->sizex - pad) / (ibuf->x * snode->zoom);
+ facy = 1.0f * (region->sizey - pad) / (ibuf->y * snode->zoom);
BKE_image_release_ibuf(ima, ibuf, lock);
@@ -352,7 +352,7 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
snode->xof = 0;
snode->yof = 0;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
@@ -396,14 +396,14 @@ typedef struct ImageSampleInfo {
int color_manage;
} ImageSampleInfo;
-static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
+static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
{
Scene *scene = CTX_data_scene(C);
ImageSampleInfo *info = arg_info;
if (info->draw) {
ED_image_draw_info(scene,
- ar,
+ region,
info->color_manage,
false,
info->channels,
@@ -421,7 +421,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
* And here we've got recursion in the comments tips...
*/
bool ED_space_node_color_sample(
- Main *bmain, SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3])
+ Main *bmain, SpaceNode *snode, ARegion *region, int mval[2], float r_col[3])
{
void *lock;
Image *ima;
@@ -445,8 +445,8 @@ bool ED_space_node_color_sample(
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
const float *fp;
@@ -479,7 +479,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ImageSampleInfo *info = op->customdata;
void *lock;
Image *ima;
@@ -500,8 +500,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
+ 0.0f);
+ fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
+ 0.0f);
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
const float *fp;
@@ -583,7 +585,7 @@ static void sample_exit(bContext *C, wmOperator *op)
static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ImageSampleInfo *info;
if (!ED_node_is_compositor(snode) || !(snode->flag & SNODE_BACKDRAW)) {
@@ -591,9 +593,9 @@ static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
- info->art = ar->type;
+ info->art = region->type;
info->draw_handle = ED_region_draw_cb_activate(
- ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
+ region->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
op->customdata = info;
sample_apply(C, op, event);