[Bf-blender-cvs] [7142b97] master: 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.

Monique Dewanchand noreply at git.blender.org
Sat Jan 18 18:28:22 CET 2014


Commit: 7142b970853f209f6c43319b7f862bcbdbea3728
Author: Monique Dewanchand
Date:   Sat Jan 18 18:20:21 2014 +0100
https://developer.blender.org/rB7142b970853f209f6c43319b7f862bcbdbea3728

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.

===================================================================

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_conversions.c

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 68fe1c4..59cb050 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -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;
 		}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 1e70529..5df6952 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -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
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 8c3fa77..0eddb68 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -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) {




More information about the Bf-blender-cvs mailing list