Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-12-30 14:25:15 +0300
committerTon Roosendaal <ton@blender.org>2005-12-30 14:25:15 +0300
commitd921d6be6f3b06cc49923d3546b4105ec9a247f4 (patch)
tree338f76791accc95999e2d94e2eabc85406389a59 /source/blender/src/interface.c
parent10d67f254c6ed61b395402294b91ffb3389c41a8 (diff)
Orange: daily noodle updates;
- Texture Node: now displays 'intensity values' in node too, and has input, and shows in buttons when activated in Node editor. (no browsing buttons yet...) - New: "Normal Node". This uses a new UI button, which allows to quickly input a normal vector, based on spherical coordinates. The Normal Node has optional vector input, and delivers a dot product then. This can be used as a blending factor between nodes, or for fake extra light in a certain direction. - New: "Geometry Node". This actually replaces the Input node. It offers all coordinates (vectors) as being the starting point for shading and for textures. Note: for preview render this doesn't give much different results yet... this is the start for real render support! - http://www.blender.org/bf/rt5.jpg The two new nodes in action - Bugfix: the "Block" button (which delivers popups) did not return a correct event when nothing happened (mouse moved out), which could cause mouse clicks to be passed on to the queue.
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r--source/blender/src/interface.c68
1 files changed, 65 insertions, 3 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 77d37ea57fe..f43917ea9dc 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -3209,7 +3209,6 @@ static void do_colorband_evt(ColorBand *coba)
}
}
-
static int ui_do_but_COLORBAND(uiBut *but)
{
ColorBand *coba= (ColorBand *)but->poin;
@@ -3279,6 +3278,66 @@ static int ui_do_but_COLORBAND(uiBut *but)
return but->retval;
}
+/* button is presumed square */
+/* if mouse moves outside of sphere, it does negative normal */
+static int ui_do_but_NORMAL(uiBut *but)
+{
+ float dx, dy, rad, radsq, mrad, *fp= (float *)but->poin;
+ int firsttime=1;
+ short mval[2], mvalo[2];
+
+ rad= 0.5f*(but->x2 - but->x1);
+ radsq= rad*rad;
+
+ uiGetMouse(mywinget(), mvalo);
+
+ while(get_mbut() & L_MOUSE) {
+
+ uiGetMouse(mywinget(), mval);
+
+ if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || firsttime) {
+ firsttime= 0;
+
+ dx= -but->x1-rad + (float)mval[0];
+ dy= -but->y1-rad + (float)mval[1];
+
+ mrad= dx*dx+dy*dy;
+ if(mrad < radsq) { /* inner circle */
+ fp[0]= dx;
+ fp[1]= dy;
+ fp[2]= sqrt( radsq-dx*dx-dy*dy );
+ }
+ else { /* outer circle */
+ float norx, nory;
+
+ mrad= sqrt(mrad); // veclen
+ norx= dx/mrad;
+ nory= dy/mrad;
+
+ dx= norx*(2.0f*rad - mrad);
+ dy= nory*(2.0f*rad - mrad);
+
+ mrad= dx*dx+dy*dy;
+ if(mrad < radsq) {
+ fp[0]= dx;
+ fp[1]= dy;
+ fp[2]= -sqrt( radsq-dx*dx-dy*dy );
+ }
+ }
+ Normalise(fp);
+
+ ui_draw_but(but);
+ ui_block_flush_back(but->block);
+
+ mvalo[0]= mval[0];
+ mvalo[1]= mval[1];
+ }
+ BIF_wait_for_statechange();
+ }
+
+ return but->retval;
+}
+
/* ************************************************ */
void uiSetButLock(int val, char *lockstr)
@@ -3476,6 +3535,9 @@ static int ui_do_button(uiBlock *block, uiBut *but, uiEvent *uevent)
case BUT_COLORBAND:
retval= ui_do_but_COLORBAND(but);
break;
+ case BUT_NORMAL:
+ retval= ui_do_but_NORMAL(but);
+ break;
#ifdef INTERNATIONAL
case CHARTAB:
@@ -4432,9 +4494,9 @@ int uiDoBlocks(ListBase *lb, int event)
}
block->in_use= 1; // bit awkward, but now we can detect if frontbuf flush should be set
- retval= ui_do_block(block, &uevent);
+ retval |= ui_do_block(block, &uevent); /* we 'or' because 2nd loop can return to here, and we we want 'out' to return */
block->in_use= 0;
- if(retval==UI_EXIT_LOOP) break;
+ if(retval & UI_EXIT_LOOP) break;
/* now a new block could be created for menus, this is
inserted in the beginning of a list */