diff options
author | Sv. Lockal <lockalsash@gmail.com> | 2013-07-22 23:24:39 +0400 |
---|---|---|
committer | Sv. Lockal <lockalsash@gmail.com> | 2013-07-22 23:24:39 +0400 |
commit | 6e98932e90df7575f371f492f31b0f7f9da713fa (patch) | |
tree | 1ff30a64d02ec57782a54ec56423e4027158ec39 /source/blender/editors/space_node/space_node.c | |
parent | 02b0c227fef8432221b432c813174171e80c4c7a (diff) |
Allow creation of mask nodes in compositor with drag&drop of mask datablocks
Also remove superfluous "deselect all" operation in drag&drop for images
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index f12f7743429..922912fa540 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -635,7 +635,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; @@ -649,6 +649,23 @@ static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUS return 0; } +static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +{ + if (drag->type == WM_DRAG_ID) { + ID *id = (ID *)drag->poin; + if (GS(id->name) == ID_MSK) + return 1; + } + return 0; +} + +static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop) +{ + ID *id = (ID *)drag->poin; + + RNA_string_set(drop->ptr, "name", id->name + 2); +} + static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop) { ID *id = (ID *)drag->poin; @@ -666,7 +683,8 @@ static void node_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW); - WM_dropbox_add(lb, "NODE_OT_add_file", node_drop_poll, node_id_path_drop_copy); + WM_dropbox_add(lb, "NODE_OT_add_file", node_ima_drop_poll, node_id_path_drop_copy); + WM_dropbox_add(lb, "NODE_OT_add_mask", node_mask_drop_poll, node_id_drop_copy); } |