84
84
node->locy = locy + 60.0f; /* arbitrary... so its visible, (0,0) is top of node */
85
85
nodeSetSelected(node, TRUE);
87
/* node location is mapped */
92
88
node->locy = locy + 60.0f;
410
404
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign");
407
/* ****************** Add Mask Node Operator ******************* */
409
static int node_add_mask_poll(bContext *C)
411
SpaceNode *snode = CTX_wm_space_node(C);
413
return ED_operator_node_editable(C) && snode->nodetree->type == NTREE_COMPOSIT;
416
static int node_add_mask_exec(bContext *C, wmOperator *op)
418
SpaceNode *snode = CTX_wm_space_node(C);
422
/* check input variables */
423
char name[MAX_ID_NAME - 2];
424
RNA_string_get(op->ptr, "name", name);
425
mask = BKE_libblock_find_name(ID_MSK, name);
427
BKE_reportf(op->reports, RPT_ERROR, "Mask '%s' not found", name);
428
return OPERATOR_CANCELLED;
431
ED_preview_kill_jobs(C);
433
node = node_add_node(C, NULL, CMP_NODE_MASK, snode->cursor[0], snode->cursor[1]);
436
BKE_report(op->reports, RPT_WARNING, "Could not add a mask node");
437
return OPERATOR_CANCELLED;
443
snode_notify(C, snode);
444
snode_dag_update(C, snode);
446
return OPERATOR_FINISHED;
449
void NODE_OT_add_mask(wmOperatorType *ot)
452
ot->name = "Add Mask Node";
453
ot->description = "Add a mask node to the current node editor";
454
ot->idname = "NODE_OT_add_mask";
457
ot->exec = node_add_mask_exec;
458
ot->poll = node_add_mask_poll;
461
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
463
RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Datablock name to assign");
413
466
/********************** New node tree operator *********************/
415
468
static int new_node_tree_exec(bContext *C, wmOperator *op)