diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2009-01-12 03:00:59 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2009-01-12 03:00:59 +0300 |
commit | 85c4e8fd2a3e24d3c49e8c94e61eb94423fd2aca (patch) | |
tree | 5292878086fc1584db652addfeefb83b6dfe2432 /source/blender | |
parent | ab33f8f0c066e343eeb7d48f6b9f627e13e3cfe1 (diff) |
2.5 / Nodes
* add nodes through header menu (no way to link them yet, though ;)
Note: the adding needs to be properly operatorfied still.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_header.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 27 |
4 files changed, 49 insertions, 12 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index fc12e14efe4..8ac2289a4f4 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -321,6 +321,8 @@ static void set_node_imagepath(char *str) /* called from fileselect */ BLI_strncpy(((NodeImageFile *)node->storage)->name, str, sizeof( ((NodeImageFile *)node->storage)->name )); } +#endif /* 0 */ + static bNode *snode_get_editgroup(SpaceNode *snode) { bNode *gnode; @@ -332,6 +334,8 @@ static bNode *snode_get_editgroup(SpaceNode *snode) return gnode; } +#if 0 + /* node has to be of type 'render layers' */ /* is a bit clumsy copying renderdata here... scene nodes use render size of current render */ static void composite_node_render(SpaceNode *snode, bNode *node) @@ -785,6 +789,7 @@ void node_ungroup(SpaceNode *snode) } } +#endif /* 0 */ /* when links in groups change, inputs/outputs change, nodes added/deleted... */ static void snode_verify_groups(SpaceNode *snode) { @@ -798,6 +803,8 @@ static void snode_verify_groups(SpaceNode *snode) } +#if 0 + static void node_addgroup(SpaceNode *snode) { bNodeTree *ngroup; @@ -1772,6 +1779,8 @@ void snode_autoconnect(SpaceNode *snode, bNode *node_to, int flag) ntreeSolveOrder(snode->edittree); } +#endif /* 0 */ + /* can be called from menus too, but they should do own undopush and redraws */ bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy) { @@ -1784,7 +1793,7 @@ bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy) } else if(type>=NODE_GROUP_MENU) { if(snode->edittree!=snode->nodetree) { - error("Can not add a Group in a Group"); + // XXX error("Can not add a Group in a Group"); return NULL; } else { @@ -1814,8 +1823,9 @@ bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy) if(node->id) id_us_plus(node->id); - if(snode->nodetree->type==NTREE_COMPOSIT) - ntreeCompositForceHidden(snode->edittree, scene); // XXX was G.scene + // NODE_FIX_ME + // if(snode->nodetree->type==NTREE_COMPOSIT) + // ntreeCompositForceHidden(snode->edittree, scene); // XXX was G.scene NodeTagChanged(snode->edittree, node); } @@ -1828,6 +1838,8 @@ bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy) return node; } +#if 0 + void node_mute(SpaceNode *snode) { bNode *node; diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index d1ff055a06a..7ae0c8141f7 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -125,13 +125,12 @@ static uiBlock *node_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *ar void do_node_addmenu(bContext *C, void *arg, int event) { - #if 0 // XXX enable ScrArea *curarea= CTX_wm_area(C); SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); bNode *node; - float locx, locy; - short mval[2]; + //float locx, locy; + //short mval[2]; /* store selection in temp test flag */ for(node= snode->edittree->nodes.first; node; node= node->next) { @@ -139,17 +138,17 @@ void do_node_addmenu(bContext *C, void *arg, int event) else node->flag &= ~NODE_TEST; } - toolbox_mousepos(mval, 0 ); /* get initial mouse position */ - areamouseco_to_ipoco(G.v2d, mval, &locx, &locy); - node= node_add_node(snode, event, locx, locy); + // toolbox_mousepos(mval, 0 ); /* get initial mouse position */ + // areamouseco_to_ipoco(G.v2d, mval, &locx, &locy); + // NODE_FIX_ME + node= node_add_node(snode, event, 0.0, 0.0); /* uses test flag */ // XXX snode_autoconnect(snode, node, NODE_TEST); // XXX addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC); - BIF_undo_push("Add Node"); - #endif + // ED_undo_push("Add Node"); } static void node_make_addmenu(bContext *C, int nodeclass, uiBlock *block) diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 40fc72f97de..77a8626d101 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -67,6 +67,7 @@ void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode); /* node_edit.c */ bNode *next_node(bNodeTree *ntree); +bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy); void snode_set_context(SpaceNode *snode, Scene *scene); void scale_node(SpaceNode *snode, bNode *node); void snode_make_group_editable(SpaceNode *snode, bNode *gnode); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index bf028f374bd..1c91b8c3aad 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -104,6 +104,7 @@ static void node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short static int node_select_exec(bContext *C, wmOperator *op) { + wmWindow *window= CTX_wm_window(C); SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); ARegion *ar= CTX_wm_region(C); int select_type; @@ -122,8 +123,31 @@ static int node_select_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */ + + //WM_event_add_modal_handler(C, &window->handlers, op); - return OPERATOR_FINISHED; + return /*OPERATOR_RUNNING_MODAL;*/ OPERATOR_FINISHED; +} + +static int node_select_modal(bContext *C, wmOperator *op, wmEvent *event) +{ + /* execute the events */ + switch (event->type) { + case MOUSEMOVE: + printf("%d %d\n", event->x, event->y); + break; + case SELECTMOUSE: + //if (event->val==0) { + /* calculate overall delta mouse-movement for redo */ + printf("done translating\n"); + //WM_cursor_restore(CTX_wm_window(C)); + + return OPERATOR_FINISHED; + //} + break; + } + + return OPERATOR_RUNNING_MODAL; } static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event) @@ -184,6 +208,7 @@ void NODE_OT_select(wmOperatorType *ot) /* api callbacks */ ot->invoke= node_select_invoke; ot->poll= ED_operator_node_active; + ot->modal= node_select_modal; prop = RNA_def_property(ot->srna, "select_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_select_items); |