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:
authorTon Roosendaal <ton@blender.org>2013-09-05 17:03:03 +0400
committerTon Roosendaal <ton@blender.org>2013-09-05 17:03:03 +0400
commitdc8832ac92b3640f7dcb784086417da925c9e721 (patch)
tree439fc0393e8b2bbfefdb840e64264739df653297 /source/blender/editors/space_node/node_add.c
parent69b68ed867407538a9b231cabf3481cb1404b37f (diff)
Bugfix #35920
Adding a new node in Node Editor failed for "High DPI" (Only Mac retina now). - Py script for adding nodes was doing dpi magic, which it shouldn't. It has been replaced with a (temporary) API call to set the correct cursor location. (Thanks to Lukas T for helping here) - The SpaceNode->cursor[2] property now is *only* storing the coordinate in "adding new node space". Use of this has been removed from the code where possible, with as only exception the code to draw noodles while adding them. Special coder note: Nodes should respect the DPI value, and draw larger with larger buttons if you increase this size. The hack here is that this can only work nice if also the node positions are scaled accordingly. A better fix could be to check on scaling the node view itself for it. That then would also remove this Python API call that was added in this commit. However, that again might fight with how buttons layout code works now... needs some careful checking.
Diffstat (limited to 'source/blender/editors/space_node/node_add.c')
-rw-r--r--source/blender/editors/space_node/node_add.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 45b0272576a..00769975893 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -84,10 +84,6 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx
node->locy = locy + 60.0f; /* arbitrary... so its visible, (0,0) is top of node */
nodeSetSelected(node, TRUE);
- /* node location is mapped */
- locx /= UI_DPI_FAC;
- locy /= UI_DPI_FAC;
-
node->locx = locx;
node->locy = locy + 60.0f;
@@ -417,9 +413,8 @@ static int node_add_mask_poll(bContext *C)
return ED_operator_node_editable(C) && snode->nodetree->type == NTREE_COMPOSIT;
}
-static int node_add_mask_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int node_add_mask_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
ID *mask = NULL;
@@ -435,9 +430,6 @@ static int node_add_mask_invoke(bContext *C, wmOperator *op, const wmEvent *even
ED_preview_kill_jobs(C);
- /* 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]);
node = node_add_node(C, NULL, CMP_NODE_MASK, snode->cursor[0], snode->cursor[1]);
if (!node) {
@@ -462,7 +454,7 @@ void NODE_OT_add_mask(wmOperatorType *ot)
ot->idname = "NODE_OT_add_mask";
/* callbacks */
- ot->invoke = node_add_mask_invoke;
+ ot->exec = node_add_mask_exec;
ot->poll = node_add_mask_poll;
/* flags */