Make it possible to hide/unhide a node during node transform operations.
During drag the H key can be used to toggle the hide flag of the selected nodes. This makes it easier to 'attach' nodes to available links in narrow places.
This commit is contained in:
parent
90283843e3
commit
7142b97085
Notes:
blender-bot
2023-02-14 09:17:57 +01:00
Referenced by commitda8c6360b1
, Revert7142b97085
(transform toggle node hiding)
|
@ -1438,6 +1438,13 @@ int transformEvent(TransInfo *t, const wmEvent *event)
|
|||
handled = true;
|
||||
}
|
||||
break;
|
||||
case HKEY:
|
||||
if (t->spacetype == SPACE_NODE) {
|
||||
t->flag ^= T_TOGGLE_HIDDEN;
|
||||
t->redraw |= TREDRAW_HARD;
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -424,6 +424,7 @@ typedef struct TransInfo {
|
|||
|
||||
/* alternative transformation. used to add offset to tracking markers */
|
||||
#define T_ALT_TRANSFORM (1 << 24)
|
||||
#define T_TOGGLE_HIDDEN (1 << 25) /* node editor: toggle state of the hidden flags */
|
||||
|
||||
/* TransInfo->modifiers */
|
||||
#define MOD_CONSTRAINT_SELECT 0x01
|
||||
|
@ -472,6 +473,7 @@ typedef struct TransInfo {
|
|||
#define TD_MOVEHANDLE2 (1 << 18)
|
||||
#define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */
|
||||
#define TD_PBONE_LOCAL_MTX_C (1 << 20) /* same as above but for a child bone */
|
||||
#define TD_HIDDEN (1 << 21) /* for hide toggling node editor */
|
||||
|
||||
/* transsnap->status */
|
||||
#define SNAP_FORCED 1
|
||||
|
|
|
@ -2375,6 +2375,7 @@ cleanup:
|
|||
void flushTransNodes(TransInfo *t)
|
||||
{
|
||||
const float dpi_fac = UI_DPI_FAC;
|
||||
bool hidden_state;
|
||||
int a;
|
||||
TransData *td;
|
||||
TransData2D *td2d;
|
||||
|
@ -2393,6 +2394,17 @@ void flushTransNodes(TransInfo *t)
|
|||
node->locx = td2d->loc[0] / dpi_fac;
|
||||
node->locy = td2d->loc[1] / dpi_fac;
|
||||
#endif
|
||||
/* update node hidden state with transform data TD_HIDDEN + transformInfo T_TOGGLE_HIDDEN */
|
||||
hidden_state = (td->flag & TD_HIDDEN) > 0;
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
hidden_state ^= (t->flag & T_TOGGLE_HIDDEN) > 0;
|
||||
}
|
||||
|
||||
if (hidden_state) {
|
||||
node->flag |= NODE_HIDDEN;
|
||||
} else {
|
||||
node->flag &= ~NODE_HIDDEN;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle intersection with noodles */
|
||||
|
@ -5987,6 +5999,9 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node, const
|
|||
td->ext = NULL; td->val = NULL;
|
||||
|
||||
td->flag |= TD_SELECTED;
|
||||
if(node->flag & NODE_HIDDEN){
|
||||
td->flag |= TD_HIDDEN;
|
||||
}
|
||||
td->dist = 0.0;
|
||||
|
||||
unit_m3(td->mtx);
|
||||
|
@ -6021,6 +6036,8 @@ static void createTransNodeData(bContext *UNUSED(C), TransInfo *t)
|
|||
|
||||
/* nodes dont support PET and probably never will */
|
||||
t->flag &= ~T_PROP_EDIT_ALL;
|
||||
/* initial: do not toggle hidden */
|
||||
t->flag &= ~T_TOGGLE_HIDDEN;
|
||||
|
||||
/* set transform flags on nodes */
|
||||
for (node = snode->edittree->nodes.first; node; node = node->next) {
|
||||
|
|
Loading…
Reference in New Issue