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:
authorJulian Eisel <eiseljulian@gmail.com>2015-08-01 17:16:16 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-08-01 18:23:32 +0300
commit31bf82c17d780660160ebf4e1a4be004b8933b9d (patch)
tree9e886260807491d68fb3ece56ee27b491525936b /source/blender/editors
parentfa1945c9e52e7afea9db20447335b9b4e108de2f (diff)
Node Editor: A bunch of new utility functions
Needed for node insert offset (Auto-offset in UI), but kept separate so people notice it without having to check insert offset commit (not for commit ratio of course ;) )
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/node_draw.c6
-rw-r--r--source/blender/editors/space_node/node_intern.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 34efba00b86..28afeefae0b 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -308,6 +308,12 @@ void node_to_view(struct bNode *node, float x, float y, float *rx, float *ry)
*ry *= UI_DPI_FAC;
}
+void node_to_updated_rect(struct bNode *node, rctf *r_rect)
+{
+ node_to_view(node, node->offsetx, node->offsety, &r_rect->xmin, &r_rect->ymax);
+ node_to_view(node, node->offsetx + node->width, node->offsety - node->height, &r_rect->xmax, &r_rect->ymin);
+}
+
void node_from_view(struct bNode *node, float x, float y, float *rx, float *ry)
{
x /= UI_DPI_FAC;
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index b15e9025a82..6b1d947bfca 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -84,6 +84,7 @@ void drawnodespace(const bContext *C, ARegion *ar);
void node_set_cursor(struct wmWindow *win, struct SpaceNode *snode, float cursor[2]);
/* DPI scaled coords */
void node_to_view(struct bNode *node, float x, float y, float *rx, float *ry);
+void node_to_updated_rect(struct bNode *node, rctf *r_rect);
void node_from_view(struct bNode *node, float x, float y, float *rx, float *ry);
/* node_buttons.c */
@@ -225,7 +226,8 @@ extern const char *node_context_dir[];
#define NODE_DYS (U.widget_unit / 2)
#define NODE_DY U.widget_unit
#define NODE_SOCKDY (0.08f * U.widget_unit)
-#define NODE_WIDTH(node) (node->width * UI_DPI_FAC)
+#define NODE_WIDTH(node) (node->width * UI_DPI_FAC)
+#define NODE_HEIGHT(node) (node->height * UI_DPI_FAC)
#define NODE_MARGIN_X (0.75f * U.widget_unit)
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
#define NODE_LINK_RESOL 12