Simplify node frame detach operators, based on T34670 by @julien.
* The `NODE_OT_parent_clear` operator has been removed. This was a very simplistic operator that detached every selected node, which is not very useful in case of hierarchical frames. The `NODE_OT_detach` operator only detaches the top parent nodes in the selection, keeping the hierarchy of selected nodes intact. * The `ALT+P` shortcut has been reassigned to the `NODE_OT_detach` operator which replaces the previous `NODE_OT_clear` mapping with similar behavior (also gives a menu entry shortcut now). * Shortcuts for `NODE_OT_detach_translate_attach` have been removed, due to crowded and messy keymap and unintuitive shortcut `ALT+F`. This macro operator is still registered, in case hardcore users want to make their own keymaps, but not mapped by default. Node keymaps may need some redesign in the future for these things.
This commit is contained in:
@@ -163,7 +163,6 @@ void NODE_OT_links_cut(struct wmOperatorType *ot);
|
||||
void NODE_OT_links_detach(struct wmOperatorType *ot);
|
||||
|
||||
void NODE_OT_parent_set(struct wmOperatorType *ot);
|
||||
void NODE_OT_parent_clear(struct wmOperatorType *ot);
|
||||
void NODE_OT_join(struct wmOperatorType *ot);
|
||||
void NODE_OT_attach(struct wmOperatorType *ot);
|
||||
void NODE_OT_detach(struct wmOperatorType *ot);
|
||||
|
@@ -111,7 +111,6 @@ void node_operatortypes(void)
|
||||
WM_operatortype_append(NODE_OT_output_file_move_active_socket);
|
||||
|
||||
WM_operatortype_append(NODE_OT_parent_set);
|
||||
WM_operatortype_append(NODE_OT_parent_clear);
|
||||
WM_operatortype_append(NODE_OT_join);
|
||||
WM_operatortype_append(NODE_OT_attach);
|
||||
WM_operatortype_append(NODE_OT_detach);
|
||||
@@ -147,6 +146,10 @@ void ED_operatormacros_node(void)
|
||||
RNA_boolean_set(mot->ptr, "release_confirm", true);
|
||||
WM_operatortype_macro_define(ot, "NODE_OT_attach");
|
||||
|
||||
/* Note: Currently not in a default keymap or menu due to messy keymaps
|
||||
* and tricky invoke functionality.
|
||||
* Kept around in case users want to make own shortcuts.
|
||||
*/
|
||||
ot = WM_operatortype_append_macro("NODE_OT_detach_translate_attach", "Detach and Move",
|
||||
"Detach nodes, move and attach to frame",
|
||||
OPTYPE_UNDO | OPTYPE_REGISTER);
|
||||
@@ -267,7 +270,7 @@ void node_keymap(struct wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "NODE_OT_duplicate_move_keep_inputs", DKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "NODE_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "NODE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "NODE_OT_detach", PKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "NODE_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "NODE_OT_hide_toggle", HKEY, KM_PRESS, 0, 0);
|
||||
|
@@ -1011,40 +1011,6 @@ void NODE_OT_parent_set(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ****************** Clear Parent ******************* */
|
||||
|
||||
static int node_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNodeTree *ntree = snode->edittree;
|
||||
bNode *node;
|
||||
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->flag & NODE_SELECT) {
|
||||
nodeDetachNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void NODE_OT_parent_clear(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Clear Parent";
|
||||
ot->description = "Detach selected nodes";
|
||||
ot->idname = "NODE_OT_parent_clear";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = node_parent_clear_exec;
|
||||
ot->poll = ED_operator_node_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ****************** Join Nodes ******************* */
|
||||
|
||||
/* tags for depth-first search */
|
||||
|
@@ -1106,9 +1106,6 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
|
||||
/* XXX release_confirm is set in the macro operator definition */
|
||||
WM_keymap_add_item(keymap, "NODE_OT_move_detach_links_release", EVT_TWEAK_A, KM_ANY, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0);
|
||||
|
||||
/* dettach and translate */
|
||||
WM_keymap_add_item(keymap, "NODE_OT_detach_translate_attach", FKEY, KM_PRESS, KM_ALT, 0);
|
||||
break;
|
||||
case SPACE_SEQ:
|
||||
WM_keymap_add_item(keymap, OP_SEQ_SLIDE, GKEY, KM_PRESS, 0, 0);
|
||||
|
Reference in New Issue
Block a user