[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14875] branches/apricot: Apricot Branch: svn merge -r 14866:HEAD
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri May 16 23:38:52 CEST 2008
Revision: 14875
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14875
Author: blendix
Date: 2008-05-16 23:38:51 +0200 (Fri, 16 May 2008)
Log Message:
-----------
Apricot Branch: svn merge -r 14866:HEAD
Modified Paths:
--------------
branches/apricot/release/scripts/bpymodules/BPyAddMesh.py
branches/apricot/source/blender/blenkernel/intern/node.c
branches/apricot/source/blender/python/api2_2x/Node.c
branches/apricot/source/blender/src/interface.c
branches/apricot/source/blender/src/sequence.c
branches/apricot/source/blender/src/toolbox.c
branches/apricot/source/blender/src/transform.c
Modified: branches/apricot/release/scripts/bpymodules/BPyAddMesh.py
===================================================================
--- branches/apricot/release/scripts/bpymodules/BPyAddMesh.py 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/release/scripts/bpymodules/BPyAddMesh.py 2008-05-16 21:38:51 UTC (rev 14875)
@@ -92,11 +92,12 @@
ob_act.loc = cursor
+ me.calcNormals()
+
if is_editmode or Blender.Get('add_editmode'):
EditMode(1)
- else: # adding in object mode means we need to calc normals
- me.calcNormals()
+
Modified: branches/apricot/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/node.c 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/source/blender/blenkernel/intern/node.c 2008-05-16 21:38:51 UTC (rev 14875)
@@ -1993,8 +1993,7 @@
if(ntree->threadstack) {
for(a=0; a<BLENDER_MAX_THREADS; a++) {
for(nts=ntree->threadstack[a].first; nts; nts=nts->next)
- if(nts->stack)
- MEM_freeN(nts->stack);
+ if (nts->stack) MEM_freeN(nts->stack);
BLI_freelistN(&ntree->threadstack[a]);
}
Modified: branches/apricot/source/blender/python/api2_2x/Node.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/Node.c 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/source/blender/python/api2_2x/Node.c 2008-05-16 21:38:51 UTC (rev 14875)
@@ -919,6 +919,8 @@
int i;
short len, wanted_len;
+ if (!stack || !stack[idx]) return 0; /* no MaterialNode */
+
if (type == SOCK_VALUE) {
val = PyNumber_Float(value);
if (!val)
Modified: branches/apricot/source/blender/src/interface.c
===================================================================
--- branches/apricot/source/blender/src/interface.c 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/source/blender/src/interface.c 2008-05-16 21:38:51 UTC (rev 14875)
@@ -2114,7 +2114,7 @@
static int ui_do_but_NUM(uiBut *but)
{
- double value;
+ double value, butrange;
float deler, fstart, f, tempf, pressure;
int lvalue, temp, orig_x; /* , firsttime=1; */
short retval=0, qual, sx, mval[2], pos=0;
@@ -2128,7 +2128,8 @@
sx= mval[0];
orig_x = sx; /* Store so we can scale the rate of change by the dist the mouse is from its original xlocation */
- fstart= (value - but->min)/(but->max-but->min);
+ butrange= (but->max - but->min);
+ fstart= (butrange == 0.0)? 0.0f: value/butrange;
f= fstart;
temp= (int)value;
Modified: branches/apricot/source/blender/src/sequence.c
===================================================================
--- branches/apricot/source/blender/src/sequence.c 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/source/blender/src/sequence.c 2008-05-16 21:38:51 UTC (rev 14875)
@@ -1957,6 +1957,10 @@
se = give_tstripelem(seq, cfra);
+ if (!se) {
+ return se;
+ }
+
if (cfra_left == cfra_right ||
(s->flags & SEQ_SPEED_BLEND) == 0) {
test_and_auto_discard_ibuf(se);
Modified: branches/apricot/source/blender/src/toolbox.c
===================================================================
--- branches/apricot/source/blender/src/toolbox.c 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/source/blender/src/toolbox.c 2008-05-16 21:38:51 UTC (rev 14875)
@@ -2298,16 +2298,21 @@
/* Add the menu */
for (menu = generic_menu; menu->icon != -1; menu++) {
- if (menu->poin) {
- but=uiDefIconTextBlockBut(block, tb_makemenu, menu->poin, ICON_RIGHTARROW_THIN, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, "");
- uiButSetFlag(but, UI_MAKE_RIGHT);
+ if(strcmp(menu->name, "SEPR")==0) {
+ uiDefBut(block, SEPR, 0, "", mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 6, NULL, 0.0, 0.0, 0, 0, "");
+ ypos-=6;
+ } else {
+ if (menu->poin) {
+ but=uiDefIconTextBlockBut(block, tb_makemenu, menu->poin, ICON_RIGHTARROW_THIN, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, "");
+ uiButSetFlag(but, UI_MAKE_RIGHT);
- uiButSetFunc(but, store_main, (void *)+32, (void *)ypos);
- } else {
- /* TODO - add icon support */
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, NULL, 0.0, 0.0, 0, menu->retval, "");
+ uiButSetFunc(but, store_main, (void *)+32, (void *)ypos);
+ } else {
+ /* TODO - add icon support */
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, menu->name, mval[0]+tb_mainx,mval[1]+tb_mainy+ypos+5, dx, 19, NULL, 0.0, 0.0, 0, menu->retval, "");
+ }
+ ypos-=20;
}
- ypos-=20;
}
uiBlockSetButmFunc(block, menu->poin, NULL);
Modified: branches/apricot/source/blender/src/transform.c
===================================================================
--- branches/apricot/source/blender/src/transform.c 2008-05-16 21:34:22 UTC (rev 14874)
+++ branches/apricot/source/blender/src/transform.c 2008-05-16 21:38:51 UTC (rev 14875)
@@ -245,12 +245,12 @@
float InputDeltaAngle(TransInfo *t, short mval[2])
{
- double dx2 = t->center2d[0] - mval[0];
- double dy2 = t->center2d[1] - mval[1];
+ double dx2 = mval[0] - t->center2d[0];
+ double dy2 = mval[1] - t->center2d[1];
double B = sqrt(dx2*dx2+dy2*dy2);
- double dx1 = t->center2d[0] - t->imval[0];
- double dy1 = t->center2d[1] - t->imval[1];
+ double dx1 = t->imval[0] - t->center2d[0];
+ double dy1 = t->imval[1] - t->center2d[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
@@ -265,6 +265,28 @@
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+
+ /* If the angle is zero, because of lack of precision close to the 1.0 value in acos
+ * approximate the angle with the oposite side of the normalized triangle
+ * This is a good approximation here since the smallest acos value seems to be around
+ * 0.02 degree and lower values don't even have a 0.01% error compared to the approximation
+ * */
+ if (dphi == 0)
+ {
+ double dx, dy;
+
+ dx2 /= A;
+ dy2 /= A;
+
+ dx1 /= B;
+ dy1 /= B;
+
+ dx = dx1 - dx2;
+ dy = dy1 - dy2;
+
+ dphi = sqrt(dx*dx + dy*dy);
+ if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+ }
if(t->flag & T_SHIFT_MOD) dphi = dphi/30.0f;
More information about the Bf-blender-cvs
mailing list