Page MenuHome

floorpatchsticky.txt

Authored By
Roland Hess (harkyman)
Nov 13 2013, 1:08 PM
Size
14 KB
Subscribers
None

floorpatchsticky.txt

Index: source/blender/blenkernel/intern/constraint.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/constraint.c,v
retrieving revision 1.32
diff -u -r1.32 constraint.c
--- source/blender/blenkernel/intern/constraint.c 27 Aug 2005 12:48:44 -0000 1.32
+++ source/blender/blenkernel/intern/constraint.c 6 Sep 2005 15:56:12 -0000
@@ -140,6 +140,14 @@
ID_NEW(data->tar);
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data;
+ data = con->data;
+
+ ID_NEW(data->tar);
+ }
+ break;
case CONSTRAINT_TYPE_LOCKTRACK:
{
bLockTrackConstraint *data;
@@ -272,6 +280,13 @@
return 1;
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = con->data;
+ if (data->tar)
+ return 1;
+ }
+ break;
case CONSTRAINT_TYPE_ACTION:
{
bActionConstraint *data = con->data;
@@ -339,6 +354,13 @@
return data->tar;
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = con->data;
+ *subtarget= data->subtarget;
+ return data->tar;
+ }
+ break;
case CONSTRAINT_TYPE_LOCKTRACK:
{
bLockTrackConstraint *data = con->data;
@@ -510,6 +532,23 @@
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data;
+ data = MEM_callocN(sizeof(bMinMaxConstraint), "minmaxConstraint");
+
+
+ data->minmaxflag = TRACK_Z;
+ data->offset = 0.0;
+ data->cachea = 0.0;
+ data->cacheb = 0.0;
+ data->sticky = 0;
+ data->stuck = 0;
+
+ result = data;
+
+ }
+ break;
case CONSTRAINT_TYPE_ROTLIKE:
{
bRotateLikeConstraint *data;
@@ -801,6 +840,18 @@
Mat4One (mat);
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = (bMinMaxConstraint*)con->data;
+
+ if (data->tar){
+ constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
+ valid=1;
+ }
+ else
+ Mat4One (mat);
+ }
+ break;
case CONSTRAINT_TYPE_ROTLIKE:
{
bRotateLikeConstraint *data;
@@ -993,6 +1044,156 @@
{
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data;
+
+ data = constraint->data;
+
+ switch (data->minmaxflag){
+
+ case TRACK_X:
+ {
+ if (targetmat[3][0] > (ob->obmat[3][0]-data->offset))
+ {
+ ob->obmat[3][0] = targetmat[3][0] + data->offset;
+ if (data->sticky==1)
+ {
+ if (data->stuck==1)
+ {
+ ob->obmat[3][1]=data->cachea;
+ ob->obmat[3][2]=data->cacheb;
+ } else {
+ data->cachea=ob->obmat[3][1];
+ data->cacheb=ob->obmat[3][2];
+ data->stuck = 1;
+ }
+ }
+ } else {
+ data->stuck=0;
+ }
+ }
+ break;
+ case TRACK_Y:
+ {
+ if (targetmat[3][1] > (ob->obmat[3][1]-data->offset))
+ {
+ ob->obmat[3][1] = targetmat[3][1] + data->offset;
+ if (data->sticky==1)
+ {
+ if (data->stuck==1)
+ {
+ ob->obmat[3][0]=data->cachea;
+ ob->obmat[3][2]=data->cacheb;
+ } else {
+ data->cachea=ob->obmat[3][0];
+ data->cacheb=ob->obmat[3][2];
+ data->stuck = 1;
+ }
+ }
+ } else {
+ data->stuck=0;
+ }
+ }
+ break;
+ case TRACK_Z:
+ {
+ if (targetmat[3][2] > (ob->obmat[3][2]-data->offset))
+ {
+ ob->obmat[3][2] = targetmat[3][2] + data->offset;
+ if (data->sticky==1)
+ {
+ if (data->stuck==1)
+ {
+ ob->obmat[3][0]=data->cachea;
+ ob->obmat[3][1]=data->cacheb;
+ } else {
+ data->cachea=ob->obmat[3][0];
+ data->cacheb=ob->obmat[3][1];
+ data->stuck = 1;
+ }
+
+ }
+ } else {
+ data->stuck=0;
+ }
+ }
+ break;
+
+ case TRACK_nX:
+ {
+ if (targetmat[3][0] < (ob->obmat[3][0]+data->offset))
+ {
+ ob->obmat[3][0] = targetmat[3][0] - data->offset;
+ if (data->sticky==1)
+ {
+ if (data->stuck==1)
+ {
+ ob->obmat[3][1]=data->cachea;
+ ob->obmat[3][2]=data->cacheb;
+ } else {
+ data->cachea=ob->obmat[3][1];
+ data->cacheb=ob->obmat[3][2];
+ data->stuck = 1;
+ }
+ }
+ } else {
+ data->stuck=0;
+ }
+ }
+ break;
+ case TRACK_nY:
+ {
+ if (targetmat[3][1] < (ob->obmat[3][1]+ data->offset))
+ {
+ ob->obmat[3][1] = targetmat[3][1] - data->offset;
+ if (data->sticky==1)
+ {
+ if (data->stuck==1)
+ {
+ ob->obmat[3][0]=data->cachea;
+ ob->obmat[3][2]=data->cacheb;
+ } else {
+ data->cachea=ob->obmat[3][0];
+ data->cacheb=ob->obmat[3][2];
+ data->stuck = 1;
+ }
+ }
+ } else {
+ data->stuck=0;
+ }
+ }
+ break;
+ case TRACK_nZ:
+ {
+ if (targetmat[3][2] < (ob->obmat[3][2]+data->offset))
+ {
+ ob->obmat[3][2] = targetmat[3][2] - data->offset;
+ if (data->sticky==1)
+ {
+ if (data->stuck==1)
+ {
+ ob->obmat[3][0]=data->cachea;
+ ob->obmat[3][1]=data->cacheb;
+ } else {
+ data->cachea=ob->obmat[3][0];
+ data->cacheb=ob->obmat[3][1];
+ data->stuck = 1;
+ }
+ }
+ } else {
+ data->stuck=0;
+ }
+
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+ break;
case CONSTRAINT_TYPE_TRACKTO:
{
bTrackToConstraint *data;
@@ -1502,4 +1703,4 @@
printf ("Error: Unknown constraint type\n");
break;
}
-}
+}
\ No newline at end of file
Index: source/blender/blenloader/intern/readfile.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenloader/intern/readfile.c,v
retrieving revision 1.185
diff -u -r1.185 readfile.c
--- source/blender/blenloader/intern/readfile.c 3 Sep 2005 16:20:33 -0000 1.185
+++ source/blender/blenloader/intern/readfile.c 6 Sep 2005 15:56:13 -0000
@@ -1320,6 +1320,13 @@
data->tar = newlibadr(fd, id->lib, data->tar);
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data;
+ data = ((bMinMaxConstraint*)con->data);
+ data->tar = newlibadr(fd, id->lib, data->tar);
+ }
+ break;
case CONSTRAINT_TYPE_LOCKTRACK:
{
bLockTrackConstraint *data;
@@ -5275,6 +5282,12 @@
case CONSTRAINT_TYPE_TRACKTO:
{
bTrackToConstraint *data = (bTrackToConstraint*)curcon->data;
+ expand_doit(fd, mainvar, data->tar);
+ break;
+ }
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = (bMinMaxConstraint*)curcon->data;
expand_doit(fd, mainvar, data->tar);
break;
}
Index: source/blender/blenloader/intern/writefile.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenloader/intern/writefile.c,v
retrieving revision 1.56
diff -u -r1.56 writefile.c
--- source/blender/blenloader/intern/writefile.c 24 Aug 2005 20:37:25 -0000 1.56
+++ source/blender/blenloader/intern/writefile.c 6 Sep 2005 15:56:13 -0000
@@ -612,6 +612,9 @@
case CONSTRAINT_TYPE_STRETCHTO:
writestruct(wd, DATA, "bStretchToConstraint", 1, con->data);
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ writestruct(wd, DATA, "bMinMaxConstraint", 1, con->data);
+ break;
default:
break;
}
Index: source/blender/include/butspace.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/butspace.h,v
retrieving revision 1.53
diff -u -r1.53 butspace.h
--- source/blender/include/butspace.h 29 Aug 2005 12:46:07 -0000 1.53
+++ source/blender/include/butspace.h 6 Sep 2005 15:56:13 -0000
@@ -552,6 +552,7 @@
B_CONSTRAINT_ADD_NULL,
B_CONSTRAINT_ADD_KINEMATIC,
B_CONSTRAINT_ADD_TRACKTO,
+ B_CONSTRAINT_ADD_MINMAX,
B_CONSTRAINT_ADD_ROTLIKE,
B_CONSTRAINT_ADD_LOCLIKE,
B_CONSTRAINT_ADD_ACTION,
Index: source/blender/makesdna/DNA_constraint_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_constraint_types.h,v
retrieving revision 1.18
diff -u -r1.18 DNA_constraint_types.h
--- source/blender/makesdna/DNA_constraint_types.h 28 Aug 2005 12:23:05 -0000 1.18
+++ source/blender/makesdna/DNA_constraint_types.h 6 Sep 2005 15:56:13 -0000
@@ -93,6 +93,17 @@
char subtarget[32];
} bLocateLikeConstraint;
+typedef struct bMinMaxConstraint{
+ Object *tar;
+ int minmaxflag;
+ float offset;
+ int sticky;
+ int stuck;
+ float cachea;
+ float cacheb;
+ char subtarget[32];
+} bMinMaxConstraint;
+
typedef struct bActionConstraint{
Object *tar;
short type;
@@ -168,6 +179,7 @@
#define CONSTRAINT_TYPE_LOCKTRACK 13 /* New Tracking constraint that locks an axis in place - theeth */
#define CONSTRAINT_TYPE_DISTANCELIMIT 14
#define CONSTRAINT_TYPE_STRETCHTO 15 /* claiming this to be mine :) is in tuhopuu bjornmose */
+#define CONSTRAINT_TYPE_MINMAX 16 /* floor constraint */
/* bConstraint.flag */
Index: source/blender/src/buttons_object.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_object.c,v
retrieving revision 1.112
diff -u -r1.112 buttons_object.c
--- source/blender/src/buttons_object.c 3 Sep 2005 10:50:21 -0000 1.112
+++ source/blender/src/buttons_object.c 6 Sep 2005 15:56:13 -0000
@@ -313,6 +313,9 @@
case CONSTRAINT_TYPE_TRACKTO:
strcpy (str, "Track To");
return;
+ case CONSTRAINT_TYPE_MINMAX:
+ strcpy (str, "Floor");
+ return;
case CONSTRAINT_TYPE_KINEMATIC:
strcpy (str, "IK Solver");
return;
@@ -353,6 +356,8 @@
return TH_BUT_SETTING1;
case CONSTRAINT_TYPE_LOCLIKE:
return TH_BUT_POPUP;
+ case CONSTRAINT_TYPE_MINMAX:
+ return TH_BUT_POPUP;
case CONSTRAINT_TYPE_ACTION:
return TH_BUT_ACTION;
case CONSTRAINT_TYPE_LOCKTRACK:
@@ -656,6 +661,44 @@
uiBlockEndAlign(block);
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = con->data;
+ bArmature *arm;
+
+ height = 66;
+ uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
+
+ uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
+
+ uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Offset:", *xco, *yco-44, 100, 18, &data->offset, -100, 100, 100.0, 0.0, "Offset from the position of the object center");
+
+ /* Draw target parameters */
+ uiBlockBeginAlign(block);
+ uiDefIDPoinBut(block, test_obpoin_but, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object");
+
+ arm = get_armature(data->tar);
+ if (arm){
+ but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
+ }
+ else
+ strcpy (data->subtarget, "");
+ uiBlockEndAlign(block);
+
+ but=uiDefButBitI(block, TOG, 1, B_CONSTRAINT_TEST, "Sticky", *xco, *yco-24, 54, 18, &data->sticky, 0, 24, 0, 0, "Immobilize object while constrained");
+
+ uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Max/Min:", *xco-8, *yco-64, 54, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+51, *yco-64,17,18, &data->minmaxflag, 12.0, 0.0, 0, 0, "Will not pass below X of target");
+ uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+67, *yco-64,17,18, &data->minmaxflag, 12.0, 1.0, 0, 0, "Will not pass below Y of target");
+ uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+85, *yco-64,17,18, &data->minmaxflag, 12.0, 2.0, 0, 0, "Will not pass below Z of target");
+ uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X", *xco+102, *yco-64,24,18, &data->minmaxflag, 12.0, 3.0, 0, 0, "Will not pass above X of target");
+ uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y", *xco+126, *yco-64,24,18, &data->minmaxflag, 12.0, 4.0, 0, 0, "Will not pass above Y of target");
+ uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z", *xco+150, *yco-64,24,18, &data->minmaxflag, 12.0, 5.0, 0, 0, "Will not pass above Z of target");
+ uiBlockEndAlign(block);
+ }
+ break;
case CONSTRAINT_TYPE_LOCKTRACK:
{
bLockTrackConstraint *data = con->data;
@@ -831,6 +874,7 @@
uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefBut(block, BUTM, B_CONSTRAINT_ADD_TRACKTO,"Track To", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
+ uiDefBut(block, BUTM, B_CONSTRAINT_ADD_MINMAX,"Floor", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefBut(block, BUTM, B_CONSTRAINT_ADD_LOCKTRACK,"Locked Track", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefBut(block, BUTM, B_CONSTRAINT_ADD_FOLLOWPATH,"Follow Path", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -893,6 +937,16 @@
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_TRACKTO);
+ add_constraint_to_active(ob, con);
+
+ BIF_undo_push("Add constraint");
+ }
+ break;
+ case B_CONSTRAINT_ADD_MINMAX:
+ {
+ bConstraint *con;
+
+ con = add_new_constraint(CONSTRAINT_TYPE_MINMAX);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
Index: source/blender/src/editconstraint.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editconstraint.c,v
retrieving revision 1.26
diff -u -r1.26 editconstraint.c
--- source/blender/src/editconstraint.c 28 Aug 2005 12:23:06 -0000 1.26
+++ source/blender/src/editconstraint.c 6 Sep 2005 15:56:14 -0000
@@ -260,6 +260,12 @@
if (data->tar==target) return data->subtarget;
}
break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = con->data;
+ if (data->tar==target) return data->subtarget;
+ }
+ break;
case CONSTRAINT_TYPE_LOCKTRACK:
{
bLockTrackConstraint *data = con->data;
@@ -361,6 +367,24 @@
case CONSTRAINT_TYPE_LOCLIKE:
{
bLocateLikeConstraint *data = curcon->data;
+
+ if (!exist_object(data->tar)){
+ data->tar = NULL;
+ curcon->flag |= CONSTRAINT_DISABLE;
+ break;
+ }
+
+ if ( (data->tar == owner) &&
+ (!get_named_bone(get_armature(owner),
+ data->subtarget))) {
+ curcon->flag |= CONSTRAINT_DISABLE;
+ break;
+ }
+ }
+ break;
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = curcon->data;
if (!exist_object(data->tar)){
data->tar = NULL;

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
49/26/6a8bb6b292d2d8fda4d85ded6383

Event Timeline