diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/node_add.c | 13 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index fd433b48a66..6cb45f8d318 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -71,13 +71,11 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx node = nodeAddStaticNode(C, snode->edittree, type); BLI_assert(node && node->typeinfo); - /* generics */ - node->locx = locx; - node->locy = locy + 60.0f; /* arbitrary... so its visible, (0,0) is top of node */ - nodeSetSelected(node, true); + /* Position mouse in node header. */ + node->locx = locx - NODE_DY * 1.5f / UI_DPI_FAC; + node->locy = locy + NODE_DY * 0.5f / UI_DPI_FAC; - node->locx = locx; - node->locy = locy + 60.0f; + nodeSetSelected(node, true); ntreeUpdateTree(bmain, snode->edittree); ED_node_set_active(bmain, snode->edittree, node); @@ -355,6 +353,9 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, const wmEvent *even UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &snode->cursor[0], &snode->cursor[1]); + snode->cursor[0] /= UI_DPI_FAC; + snode->cursor[1] /= UI_DPI_FAC; + if (RNA_struct_property_is_set(op->ptr, "filepath") || RNA_struct_property_is_set(op->ptr, "name")) return node_add_file_exec(C, op); else diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 1a18e886808..eb20f4e7175 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -943,10 +943,12 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event) int dir; if (node) { + float cursor[2]; + /* convert mouse coordinates to v2d space */ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], - &snode->cursor[0], &snode->cursor[1]); - dir = node->typeinfo->resize_area_func(node, snode->cursor[0], snode->cursor[1]); + &cursor[0], &cursor[1]); + dir = node->typeinfo->resize_area_func(node, cursor[0], cursor[1]); if (dir != 0) { node_resize_init(C, op, event, node, dir); return OPERATOR_RUNNING_MODAL; |