Nodes Editor: Restored 'Show Cyclic Dependencies' Operator (CKEY)

This commit is contained in:
2009-11-20 21:17:17 +00:00
parent 03cfcc6007
commit d552c0ea5e
4 changed files with 41 additions and 31 deletions

View File

@@ -111,7 +111,7 @@ class NODE_MT_node(bpy.types.Menu):
layout.itemS()
layout.itemO("node.duplicate_move", text="Duplicate")
layout.itemO("node.duplicate_move")
layout.itemO("node.delete")
layout.itemS()
@@ -129,8 +129,10 @@ class NODE_MT_node(bpy.types.Menu):
# XXX
# layout.itemO("node.rename")
# layout.itemS()
# layout.itemO("node.show_cyclic_dependencies")
layout.itemS()
layout.itemO("node.show_cyclic_dependencies")
bpy.types.register(NODE_HT_header)
bpy.types.register(NODE_MT_view)

View File

@@ -2059,7 +2059,7 @@ static int node_hide_exec(bContext *C, wmOperator *op)
void NODE_OT_hide(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Hide Nodes";
ot->name= "Hide";
ot->description= "Toggle hiding of the nodes.";
ot->idname= "NODE_OT_hide";
@@ -2098,7 +2098,7 @@ static int node_mute_exec(bContext *C, wmOperator *op)
void NODE_OT_mute(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Mute Nodes";
ot->name= "Mute";
ot->description= "Toggle muting of the nodes.";
ot->idname= "NODE_OT_mute";
@@ -2157,6 +2157,33 @@ void NODE_OT_delete(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* ****************** Show Cyclic Dependencies Operator ******************* */
static int node_show_cycles_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode= CTX_wm_space_node(C);
/* this is just a wrapper around this call... */
ntreeSolveOrder(snode->edittree);
snode_handle_recalc(C, snode);
return OPERATOR_FINISHED;
}
void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Show Cyclic Dependencies";
ot->description= "Sort the nodes and show the cyclic dependencies between the nodes.";
ot->idname= "NODE_OT_show_cyclic_dependencies";
/* callbacks */
ot->exec= node_show_cycles_exec;
ot->poll= ED_operator_node_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
#if 0
@@ -2164,25 +2191,7 @@ void NODE_OT_delete(wmOperatorType *ot)
void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
{
SpaceNode *snode= spacedata;
bNode *actnode;
bNodeSocket *actsock;
unsigned short event= evt->event;
short val= evt->val, doredraw=0, fromlib= 0;
if(sa->win==0) return;
if(snode->nodetree==NULL) {
/* no other events should be handled, but floating panels still should get handled */
uiDoBlocks(&curarea->uiblocks, event, 1);
return;
}
if(val) {
if( node_uiDoBlocks(sa, event)!=UI_NOTHING ) event= 0;
fromlib= (snode->id && snode->id->lib);
switch(event) {
case CKEY: /* sort again, showing cyclics */
ntreeSolveOrder(snode->edittree);
@@ -2207,13 +2216,6 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
}
}
if(fromlib==-1)
error_libdata();
if(doredraw)
scrarea_queue_winredraw(sa);
if(doredraw==2)
scrarea_queue_headredraw(sa);
}
#endif

View File

@@ -82,6 +82,7 @@ void snode_composite_job(const struct bContext *C, ScrArea *sa);
bNode *node_tree_get_editgroup(bNodeTree *ntree);
void node_tree_verify_groups(bNodeTree *nodetree);
void snode_autoconnect(SpaceNode *snode, bNode *node_to, int flag);
int node_has_hidden_sockets(bNode *node);
void NODE_OT_duplicate(struct wmOperatorType *ot);
void NODE_OT_delete(struct wmOperatorType *ot);
@@ -98,6 +99,8 @@ void NODE_OT_group_edit(struct wmOperatorType *ot);
void NODE_OT_mute(struct wmOperatorType *ot);
void NODE_OT_hide(struct wmOperatorType *ot);
void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot);
// XXXXXX
// XXX from BSE_node.h

View File

@@ -61,6 +61,7 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_visibility_toggle);
WM_operatortype_append(NODE_OT_mute);
WM_operatortype_append(NODE_OT_hide);
WM_operatortype_append(NODE_OT_show_cyclic_dependencies);
WM_operatortype_append(NODE_OT_duplicate);
WM_operatortype_append(NODE_OT_delete);
@@ -80,7 +81,7 @@ void ED_operatormacros_node(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
@@ -123,6 +124,8 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_hide", HKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_mute", MKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_show_cyclic_dependencies", CKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_select_border", BKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_delete", XKEY, KM_PRESS, 0, 0);