Huge commit, but not much features... had to shuffle a lot of code around.

Main target was cleanup of editconstraint.c and removal of the ugly
ob->activecon (active constraint channel), which was set by the "Show"
button in the Constraint Panel.
Better is to introduce an 'Active Constraint' itself, which stores in
the Constraint itself. By using this setting, and by checking the active
Bone, the UI can update reliably now. This only shows now in IpoWindow
btw (for constraint ipos). The active Constraint is drawn in the Buttons
with a slightly brighter backdrop. Any action in that Panel selects a
constraint now (even click in backdrop).

So now we have pose channels & constraint channels nicely behaving. Now the
darn Action channels... :)

Further in this commit:

- interface.c: Button ROUNDBOX now does button callback too.
               Button NUMSLI didn't do the callback on a click only

- Cleaned up include files in yafray, got annoyed it compiled over all the
  time.

- removed unused variables from Constraint struct
This commit is contained in:
Ton Roosendaal 2005-08-24 20:18:03 +00:00
parent bc3f228bc9
commit dfb654ba60
21 changed files with 473 additions and 529 deletions

@ -46,8 +46,8 @@ void *new_constraint_data (short type);
void evaluate_constraint (struct bConstraint *constraint, struct Object *ob, short ownertype, void *ownerdata, float targetmat[][4]);
void free_constraints (struct ListBase *conlist);
void copy_constraints (struct ListBase *dst, struct ListBase *src);
void *copy_constraint_channels (ListBase *dst, ListBase *src);
struct bConstraintChannel *clone_constraint_channels (struct ListBase *dst, struct ListBase *src, struct bConstraintChannel *oldact);
void copy_constraint_channels (ListBase *dst, ListBase *src);
void clone_constraint_channels (struct ListBase *dst, struct ListBase *src);
void relink_constraints (struct ListBase *list);
void free_constraint_data (struct bConstraint *con);

@ -118,7 +118,6 @@ void make_local_action(bAction *act)
if(ob->id.lib==0) {
ob->action = actn;
ob->activecon = NULL;
actn->id.us++;
act->id.us--;
}

@ -193,10 +193,9 @@ void relink_constraints (struct ListBase *list)
}
}
void *copy_constraint_channels (ListBase *dst, ListBase *src)
void copy_constraint_channels (ListBase *dst, ListBase *src)
{
bConstraintChannel *dchan, *schan;
bConstraintChannel *newact=NULL;
dst->first=dst->last=NULL;
duplicatelist(dst, src);
@ -204,25 +203,18 @@ void *copy_constraint_channels (ListBase *dst, ListBase *src)
for (dchan=dst->first, schan=src->first; dchan; dchan=dchan->next, schan=schan->next){
dchan->ipo = copy_ipo(schan->ipo);
}
return newact;
}
bConstraintChannel *clone_constraint_channels (ListBase *dst, ListBase *src, bConstraintChannel *oldact)
void clone_constraint_channels (ListBase *dst, ListBase *src)
{
bConstraintChannel *dchan, *schan;
bConstraintChannel *newact=NULL;
dst->first=dst->last=NULL;
duplicatelist(dst, src);
for (dchan=dst->first, schan=src->first; dchan; dchan=dchan->next, schan=schan->next){
id_us_plus((ID *)dchan->ipo);
if (schan==oldact)
newact=dchan;
}
return newact;
}
void copy_constraints (ListBase *dst, ListBase *src)

@ -413,6 +413,8 @@ int exist_object(Object *obtest)
{
Object *ob;
if(obtest==NULL) return 0;
ob= G.main->object.first;
while(ob) {
if(ob==obtest) return 1;
@ -784,7 +786,6 @@ Object *copy_object(Object *ob)
Object *obn;
ModifierData *md;
int a;
bConstraintChannel *actcon;
obn= copy_libblock(ob);
@ -819,11 +820,7 @@ Object *copy_object(Object *ob)
copy_nlastrips(&obn->nlastrips, &ob->nlastrips);
copy_constraints (&obn->constraints, &ob->constraints);
actcon = clone_constraint_channels (&obn->constraintChannels, &ob->constraintChannels, ob->activecon);
/* If the active constraint channel was in this list, update it */
if (actcon)
obn->activecon = actcon;
clone_constraint_channels (&obn->constraintChannels, &ob->constraintChannels);
/* increase user numbers */
id_us_plus((ID *)obn->data);
@ -1531,6 +1528,8 @@ void solve_constraints (Object *ob, short obtype, void *obdata, float ctime)
for (con = ob->constraints.first; con; con=con->next) {
// inverse kinematics is solved seperate
if (con->type==CONSTRAINT_TYPE_KINEMATIC) continue;
// and this we can skip completely
if (con->flag & CONSTRAINT_DISABLE) continue;
/* Clear accumulators if necessary*/
if (clear) {
@ -1542,8 +1541,6 @@ void solve_constraints (Object *ob, short obtype, void *obdata, float ctime)
memset(asize, 0, sizeof(float)*3);
}
/* Check this constraint only if it has some enforcement */
if (!(con->flag & CONSTRAINT_DISABLE)) {
enf = con->enforce; // value from ipos (from action channels)
/* Get the targetmat */
@ -1567,7 +1564,6 @@ void solve_constraints (Object *ob, short obtype, void *obdata, float ctime)
}
aquat[0]+=(quat[0])*enf;
Mat4CpyMat4(lastmat, focusmat);
}
/* If the next constraint is not the same type (or there isn't one),
* then evaluate the accumulator & request a clear */

@ -2145,8 +2145,6 @@ static void lib_link_object(FileData *fd, Main *main)
ob->ipo= newlibadr_us(fd, ob->id.lib, ob->ipo);
ob->action = newlibadr_us(fd, ob->id.lib, ob->action);
// ob->activecon = newglobadr(fd, ob->activecon);
poin= ob->data;
ob->data= newlibadr_us(fd, ob->id.lib, ob->data);
@ -2326,8 +2324,6 @@ static void direct_link_object(FileData *fd, Object *ob)
link_list(fd, &ob->nlastrips);
link_list(fd, &ob->constraintChannels);
ob->activecon = newdataadr(fd, ob->activecon);
direct_link_scriptlink(fd, &ob->scriptlink);
ob->mat= newdataadr(fd, ob->mat);

@ -38,27 +38,18 @@ struct Object;
struct bConstraint;
struct bConstraintChannel;
typedef struct ConstraintElement{
struct ConstraintElement *next, *prev;
struct ConstraintElement *parent;
Object *ob;
int flag;
const char *substring;
void *subdata;
} ConstraintElement;
struct bConstraint *add_new_constraint(short type);
struct bConstraintChannel *add_new_constraint_channel(const char *name);
struct bConstraint * add_new_constraint(char type);
void add_influence_key_to_constraint (struct bConstraint *con);
void add_constraint_to_object(struct bConstraint *con, struct Object *ob);
void add_constraint_to_client(struct bConstraint *con);
struct ListBase *get_constraint_client_channels (int forcevalid);
struct ListBase *get_constraint_client(char *name, short *clienttype, void** clientdata);
struct ListBase *get_active_constraints(struct Object *ob);
struct bConstraint *get_active_constraint(struct Object *ob);
struct ListBase *get_active_constraint_channels (struct Object *ob, int forcevalid);
struct bConstraintChannel *get_active_constraint_channel(struct Object *ob);
void object_test_constraints(struct Object *owner);
char *get_con_subtarget_name(struct bConstraint *constraint,
struct Object *target);
char *get_con_subtarget_name(struct bConstraint *con, struct Object *target);
#endif

@ -35,6 +35,7 @@
struct Object;
struct bPoseChannel;
void enter_posemode(void);
void exit_posemode(void);
@ -42,6 +43,7 @@ void exit_posemode(void);
// sets chan->flag to POSE_KEY if bone selected
void set_pose_keys(struct Object *ob);
struct bPoseChannel *get_active_posechannel (struct Object *ob);
/* tools */
void pose_select_constraint_target(void);

@ -544,11 +544,7 @@ enum B_SOUND_BUTTONS {
/* *********************** */
#define B_CONSTRAINTBUTS 3300
enum {
B_CONSTRAINT_REDRAW = 3201,
B_CONSTRAINT_DEL,
B_CONSTRAINT_TEST,
B_CONSTRAINT_CHANGETYPE,
B_CONSTRAINT_CHANGENAME,
B_CONSTRAINT_TEST = 3201,
B_CONSTRAINT_CHANGETARGET,
B_CONSTRAINT_ADD_NULL,
B_CONSTRAINT_ADD_KINEMATIC,

@ -40,6 +40,7 @@
struct Action;
/* channels reside in Object or Action (ListBase) constraintChannels */
typedef struct bConstraintChannel{
struct bConstraintChannel *next, *prev;
Ipo *ipo;
@ -50,17 +51,12 @@ typedef struct bConstraintChannel{
typedef struct bConstraint{
struct bConstraint *next, *prev;
void *data; /* Constraint data (a valid constraint type) */
char type; /* Constraint type */
char otype; /* Old type - for menu callbacks */
short type; /* Constraint type */
short flag; /* Flag */
short reserved1;
char name[30]; /* Constraint name */
float enforce;
float time;
float offset[3]; /* Target location offset */
float orient[3]; /* Target orientation offset */
float roll[3]; /* Target roll offset (needed?) */
} bConstraint;
/* Single-target subobject constraints */
@ -173,44 +169,47 @@ typedef struct bStretchToConstraint{
/* bConstraint.flag */
#define CONSTRAINT_EXPAND 0x00000001
#define CONSTRAINT_DONE 0x00000002
#define CONSTRAINT_DISABLE 0x00000004
#define CONSTRAINT_LOOPTESTED 0x00000008
/* expand for UI */
#define CONSTRAINT_EXPAND 0x01
/* pre-check for illegal object name or bone name */
#define CONSTRAINT_DISABLE 0x04
/* flags 0x2 and 0x8 were used in past, skip this */
/* to indicate which Ipo should be shown, maybe for 3d access later too */
#define CONSTRAINT_ACTIVE 0x10
/* bConstraintChannel.flag */
#define CONSTRAINT_CHANNEL_SELECT 0x00000001
#define CONSTRAINT_CHANNEL_SELECT 0x01
/* bLocateLikeConstraint.flag */
#define LOCLIKE_X 0x00000001
#define LOCLIKE_Y 0x00000002
#define LOCLIKE_Z 0x00000004
#define LOCSPACE 0x00000008
#define LOCLIKE_X 0x01
#define LOCLIKE_Y 0x02
#define LOCLIKE_Z 0x04
#define LOCSPACE 0x08
/* Axis flags */
#define LOCK_X 0x00000000
#define LOCK_Y 0x00000001
#define LOCK_Z 0x00000002
#define LOCK_X 0x00
#define LOCK_Y 0x01
#define LOCK_Z 0x02
#define UP_X 0x00000000
#define UP_Y 0x00000001
#define UP_Z 0x00000002
#define UP_X 0x00
#define UP_Y 0x01
#define UP_Z 0x02
#define TRACK_X 0x00000000
#define TRACK_Y 0x00000001
#define TRACK_Z 0x00000002
#define TRACK_nX 0x00000003
#define TRACK_nY 0x00000004
#define TRACK_nZ 0x00000005
#define TRACK_X 0x00
#define TRACK_Y 0x01
#define TRACK_Z 0x02
#define TRACK_nX 0x03
#define TRACK_nY 0x04
#define TRACK_nZ 0x05
#define VOLUME_XZ 0x00000000
#define VOLUME_X 0x00000001
#define VOLUME_Z 0x00000002
#define NO_VOLUME 0x00000003
#define VOLUME_XZ 0x00
#define VOLUME_X 0x01
#define VOLUME_Z 0x02
#define NO_VOLUME 0x03
#define PLANE_X 0x00000000
#define PLANE_Y 0x00000001
#define PLANE_Z 0x00000002
#define PLANE_X 0x00
#define PLANE_Y 0x01
#define PLANE_Z 0x02
/* bKinematicConstraint->flag */
#define CONSTRAINT_IK_TIP 1

@ -93,14 +93,13 @@ typedef struct Object {
struct bPose *pose;
void *data;
struct bConstraintChannel *activecon;
ListBase constraintChannels;
ListBase effect;
ListBase network;
ListBase disp;
ListBase defbase;
ListBase modifiers; /* list of ModifierData structures */
struct Material **mat;
/* rot en drot have to be together! (transform('r' en 's')) */
@ -190,7 +189,7 @@ typedef struct Object {
LBuf lbuf;
LBuf port;
float toonedge, smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
float pad3, smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
struct DerivedMesh *derivedDeform, *derivedFinal;
} Object;

@ -57,24 +57,23 @@
#include "BSE_filesel.h"
#include "BSE_headerbuttons.h"
#include "BIF_butspace.h"
#include "BDR_editcurve.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_graphics.h"
#include "BIF_interface.h"
#include "BIF_keyval.h"
#include "BIF_mainqueue.h"
#include "BIF_mywindow.h"
#include "BIF_poseobject.h"
#include "BIF_resources.h"
#include "BIF_screen.h"
#include "BIF_mywindow.h"
#include "BIF_space.h"
#include "BIF_glutil.h"
#include "BIF_interface.h"
#include "BIF_toolbox.h"
#include "BDR_editcurve.h"
#include "BDR_drawobject.h"
//#include "BIF_editsca.h"
#include "BIF_butspace.h"
#include "mydevice.h"
#include "blendef.h"
@ -140,14 +139,57 @@ float prlen=0.0;
/* ********************* CONSTRAINT ***************************** */
static void activate_constraint_ipo_func (void *arg1v, void *unused)
static void constraint_active_func(void *ob_v, void *con_v)
{
Object *ob= OBACT;
bConstraint *con = arg1v;
Object *ob= ob_v;
bConstraint *con;
ListBase *lb;
/* lets be nice and escape if its active already */
if(con_v) {
con= con_v;
if(con->flag & CONSTRAINT_ACTIVE) return;
}
lb= get_active_constraints(ob);
for(con= lb->first; con; con= con->next) {
if(con==con_v) con->flag |= CONSTRAINT_ACTIVE;
else con->flag &= ~CONSTRAINT_ACTIVE;
}
/* make sure ipowin and buttons shows it */
if(ob->ipowin==IPO_CO) {
allqueue(REDRAWIPO, IPO_CO);
allspace(REMAKEIPO, 0);
allqueue(REDRAWNLA, 0);
}
allqueue(REDRAWBUTSOBJECT, 0);
}
static void add_constraint_to_active(Object *ob, bConstraint *con)
{
ListBase *list;
list = get_active_constraints(ob);
if (list) {
unique_constraint_name(con, list);
BLI_addtail(list, con);
con->flag |= CONSTRAINT_ACTIVE;
for(con= con->prev; con; con= con->prev)
con->flag &= ~CONSTRAINT_ACTIVE;
}
}
static void enable_constraint_ipo_func (void *ob_v, void *con_v)
{
Object *ob= ob_v;
bConstraint *con = con_v;
bConstraintChannel *chan;
ListBase *conbase;
conbase = get_constraint_client_channels(1);
conbase = get_active_constraint_channels(ob, 1); // 1 == create
if (!conbase)
return;
@ -157,7 +199,8 @@ static void activate_constraint_ipo_func (void *arg1v, void *unused)
if (!chan){
/* Add a new constraint channel */
chan = add_new_constraint_channel(con->name);
chan = MEM_callocN(sizeof(bConstraintChannel), "constraintChannel");
strcpy(chan->name, con->name);
BLI_addtail(conbase, chan);
}
@ -166,25 +209,23 @@ static void activate_constraint_ipo_func (void *arg1v, void *unused)
chan->ipo = add_ipo(con->name, IPO_CO);
}
/* Make this the active channel */
ob->activecon = chan;
/* make sure ipowin shows it */
ob->ipowin= IPO_CO;
allqueue(REDRAWIPO, IPO_CO);
allspace(REMAKEIPO, 0);
allqueue(REDRAWNLA, 0);
}
static void add_influence_key_to_constraint_func (void *arg1v, void *unused)
static void add_influence_key_to_constraint_func (void *ob_v, void *con_v)
{
Object *ob= OBACT;
bConstraint *con = arg1v;
Object *ob= ob_v;
bConstraint *con = con_v;
bConstraintChannel *chan;
ListBase *conbase;
IpoCurve *icu;
conbase = get_constraint_client_channels(1); // 1=make
conbase = get_active_constraint_channels(ob, 1); // 1=make
if (!conbase)
return;
@ -194,7 +235,8 @@ static void add_influence_key_to_constraint_func (void *arg1v, void *unused)
if (!chan){
/* Add a new constraint channel */
chan = add_new_constraint_channel(con->name);
chan = MEM_callocN(sizeof(bConstraintChannel), "constraintChannel");
strcpy(chan->name, con->name);
BLI_addtail(conbase, chan);
}
@ -207,9 +249,6 @@ static void add_influence_key_to_constraint_func (void *arg1v, void *unused)
icu= get_ipocurve(NULL, IPO_CO, CO_ENFORCE, chan->ipo);
insert_vert_ipo(icu, CFRA, con->enforce);
/* Make this the active channel */
ob->activecon = chan;
/* make sure ipowin shows it */
ob->ipowin= IPO_CO;
allqueue(REDRAWIPO, IPO_CO);
@ -220,90 +259,46 @@ static void add_influence_key_to_constraint_func (void *arg1v, void *unused)
}
static void del_constraint_func (void *arg1v, void *arg2v)
static void del_constraint_func (void *ob_v, void *con_v)
{
bConstraint *con= arg1v;
Object *ob;
ListBase *lb= arg2v;
ob=OBACT;
if (ob->activecon && !strcmp(ob->activecon->name, con->name))
ob->activecon = NULL;
bConstraint *con= con_v;
bConstraintChannel *chan;
ListBase *lb;
/* remove ipo channel */
lb= get_active_constraint_channels(ob_v, 0);
if(lb) {
chan = find_constraint_channel(lb, con->name);
if(chan) {
if(chan->ipo) chan->ipo->id.us--;
BLI_freelinkN(lb, chan);
}
}
/* remove constraint itself */
lb= get_active_constraints(ob_v);
free_constraint_data (con);
BLI_freelinkN(lb, con);
constraint_active_func(ob_v, NULL);
BIF_undo_push("Delete constraint");
allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWIPO, 0);
}
static void verify_constraint_name_func (void *data, void *data2_unused)
static void verify_constraint_name_func (void *ob_v, void *con_v)
{
ListBase *conlist;
bConstraint *con;
char ownerstr[64];
short type;
bConstraint *con= con_v;
con = (bConstraint*) data;
if (!con)
return;
conlist = get_constraint_client(ownerstr, &type, NULL);
conlist = get_active_constraints(ob_v);
unique_constraint_name (con, conlist);
}
constraint_active_func(ob_v, con);
static void constraint_changed_func (void *data, void *data2_unused)
{
bConstraint *con = (bConstraint*) data;
if (con->type == con->otype)
return;
free_constraint_data (con);
con->data = new_constraint_data(con->type);
}
static void move_constraint_func (void *datav, void *data2_unused)
{
bConstraint *constraint_to_move= datav;
int val;
ListBase *conlist;
char ownerstr[64];
short type;
bConstraint *curCon, *con, *neighbour;
val= pupmenu("Move up%x1|Move down %x2");
con = constraint_to_move;
if(val>0) {
conlist = get_constraint_client(ownerstr, &type, NULL);
for (curCon = conlist->first; curCon; curCon = curCon->next){
if (curCon == con){
/* Move up */
if (val == 1 && con->prev){
neighbour = con->prev;
BLI_remlink(conlist, neighbour);
BLI_insertlink(conlist, con, neighbour);
}
/* Move down */
else if (val == 2 && con->next){
neighbour = con->next;
BLI_remlink (conlist, con);
BLI_insertlink(conlist, neighbour, con);
}
break;
}
}
}
}
static void get_constraint_typestring (char *str, bConstraint *con)
@ -377,7 +372,7 @@ static void constraint_moveUp(void *ob_v, void *con_v)
ListBase *conlist;
if(constr->prev) {
conlist = get_constraint_client(NULL, NULL, NULL);
conlist = get_active_constraints(ob_v);
for(con= conlist->first; con; con= con->next) {
if(con==constr) {
BLI_remlink(conlist, con);
@ -395,7 +390,7 @@ static void constraint_moveDown(void *ob_v, void *con_v)
ListBase *conlist;
if(constr->next) {
conlist = get_constraint_client(NULL, NULL, NULL);
conlist = get_active_constraints(ob_v);
for(con= conlist->first; con; con= con->next) {
if(con==constr) {
BLI_remlink(conlist, con);
@ -408,12 +403,16 @@ static void constraint_moveDown(void *ob_v, void *con_v)
}
static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, short *xco, short *yco, short type)
static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, short *xco, short *yco)
{
Object *ob= OBACT;
uiBut *but;
char typestr[64];
short height, width = 265;
int curCol;
int curCol, rb_col;
/* unless button has own callback, it adds this callback to button */
uiBlockSetFunc(block, constraint_active_func, ob, con);
get_constraint_typestring (typestr, con);
@ -423,19 +422,20 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
uiBlockSetEmboss(block, UI_EMBOSSN);
/* rounded header */
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-1, width+30, 22, NULL, 5.0, 0.0,
(con->flag & CONSTRAINT_EXPAND)?3:15 , -20, "");
rb_col= (con->flag & CONSTRAINT_ACTIVE)?10:-10;
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-1, width+30, 22, NULL, 5.0, 0.0,
(con->flag & CONSTRAINT_EXPAND)?3:15 , rb_col-20, "");
/* open/close */
uiDefIconButBitS(block, ICONTOG, CONSTRAINT_EXPAND, B_CONSTRAINT_REDRAW, ICON_DISCLOSURE_TRI_RIGHT, *xco-10, *yco, 20, 20, &con->flag, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Constraint");
uiDefIconButBitS(block, ICONTOG, CONSTRAINT_EXPAND, B_CONSTRAINT_TEST, ICON_DISCLOSURE_TRI_RIGHT, *xco-10, *yco, 20, 20, &con->flag, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Constraint");
/* up down */
uiBlockSetEmboss(block, UI_EMBOSS);
but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_UP, *xco+width-50, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack");
uiButSetFunc(but, constraint_moveUp, NULL, con);
uiButSetFunc(but, constraint_moveUp, ob, con);
but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_DOWN, *xco+width-50+20, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack");
uiButSetFunc(but, constraint_moveDown, NULL, con);
uiButSetFunc(but, constraint_moveDown, ob, con);
if (con->flag & CONSTRAINT_EXPAND) {
@ -453,13 +453,10 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
*/
uiBlockSetEmboss(block, UI_EMBOSS);
but = uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(but, constraint_changed_func, con, NULL);
con->otype = con->type;
but = uiDefBut(block, TEX, B_CONSTRAINT_REDRAW, "", *xco+120, *yco, 85, 18, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name");
uiButSetFunc(but, verify_constraint_name_func, con, NULL);
but = uiDefBut(block, TEX, B_CONSTRAINT_TEST, "", *xco+120, *yco, 85, 18, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name");
uiButSetFunc(but, verify_constraint_name_func, ob, con);
}
else{
uiBlockSetEmboss(block, UI_EMBOSSN);
@ -471,19 +468,17 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
else
BIF_ThemeColor(curCol);
but = uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(but, move_constraint_func, con, NULL);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
but = uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, *xco+120, *yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiButSetFunc(but, move_constraint_func, con, NULL);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, *xco+120, *yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, "");
}
uiBlockSetCol(block, TH_AUTO);
uiBlockSetEmboss(block, UI_EMBOSSN);
but = uiDefIconBut(block, BUT, B_CONSTRAINT_DEL, ICON_X, *xco+262, *yco, 19, 19, list, 0.0, 0.0, 0.0, 0.0, "Delete constraint");
uiButSetFunc(but, del_constraint_func, con, list);
but = uiDefIconBut(block, BUT, B_CONSTRAINT_CHANGETARGET, ICON_X, *xco+262, *yco, 19, 19, list, 0.0, 0.0, 0.0, 0.0, "Delete constraint");
uiButSetFunc(but, del_constraint_func, ob, con);
uiBlockSetEmboss(block, UI_EMBOSS);
@ -500,7 +495,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bArmature *arm;
height = 88;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -538,7 +533,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bArmature *arm;
height = 66;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -568,7 +563,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bArmature *arm;
height = 46;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -591,7 +586,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bArmature *arm;
height = 66;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -606,11 +601,11 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
strcpy (data->subtarget, "");
uiBlockEndAlign(block);
uiDefButBitS(block, TOG, CONSTRAINT_IK_TIP, B_CONSTRAINT_REDRAW, "Use Tip", *xco+((width/2)-117), *yco-42, 80, 18, &data->flag, 0, 0, 0, 0, "Include Bone's tip als last element in Chain");
uiDefButBitS(block, TOG, CONSTRAINT_IK_TIP, B_CONSTRAINT_TEST, "Use Tip", *xco+((width/2)-117), *yco-42, 80, 18, &data->flag, 0, 0, 0, 0, "Include Bone's tip als last element in Chain");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_CONSTRAINT_REDRAW, "Tolerance:", *xco+((width/2)-117), *yco-64, 120, 18, &data->tolerance, 0.0001f, 1.0, 0.0, 0.0, "Maximum distance to target after solving");
uiDefButS(block, NUM, B_CONSTRAINT_REDRAW, "Iterations:", *xco+((width/2)+3), *yco-64, 120, 18, &data->iterations, 1, 10000, 0.0, 0.0, "Maximum number of solving iterations");
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Tolerance:", *xco+((width/2)-117), *yco-64, 120, 18, &data->tolerance, 0.0001f, 1.0, 0.0, 0.0, "Maximum distance to target after solving");
uiDefButS(block, NUM, B_CONSTRAINT_TEST, "Iterations:", *xco+((width/2)+3), *yco-64, 120, 18, &data->iterations, 1, 10000, 0.0, 0.0, "Maximum number of solving iterations");
uiBlockEndAlign(block);
}
@ -621,7 +616,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bArmature *arm;
height = 66;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -640,20 +635,20 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", *xco+12, *yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+39, *yco-64,17,18, &data->reserved1, 12.0, 0.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Y", *xco+56, *yco-64,17,18, &data->reserved1, 12.0, 1.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+73, *yco-64,17,18, &data->reserved1, 12.0, 2.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-X", *xco+90, *yco-64,24,18, &data->reserved1, 12.0, 3.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-Y", *xco+114, *yco-64,24,18, &data->reserved1, 12.0, 4.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-Z", *xco+138, *yco-64,24,18, &data->reserved1, 12.0, 5.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+39, *yco-64,17,18, &data->reserved1, 12.0, 0.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+56, *yco-64,17,18, &data->reserved1, 12.0, 1.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+73, *yco-64,17,18, &data->reserved1, 12.0, 2.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X", *xco+90, *yco-64,24,18, &data->reserved1, 12.0, 3.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y", *xco+114, *yco-64,24,18, &data->reserved1, 12.0, 4.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z", *xco+138, *yco-64,24,18, &data->reserved1, 12.0, 5.0, 0, 0, "The axis that points to the target object");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", *xco+174, *yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+204, *yco-64,17,18, &data->reserved2, 13.0, 0.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Y", *xco+221, *yco-64,17,18, &data->reserved2, 13.0, 1.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+238, *yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+204, *yco-64,17,18, &data->reserved2, 13.0, 0.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+221, *yco-64,17,18, &data->reserved2, 13.0, 1.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "The axis that points upward");
uiBlockEndAlign(block);
}
break;
@ -662,7 +657,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bLockTrackConstraint *data = con->data;
bArmature *arm;
height = 66;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -681,20 +676,20 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", *xco+12, *yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Y", *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-X", *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-Y", *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-Z", *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X", *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y", *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points to the target object");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z", *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points to the target object");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Lock:", *xco+166, *yco-64, 38, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+204, *yco-64,17,18, &data->lockflag, 13.0, 0.0, 0, 0, "The axis that is locked");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Y", *xco+221, *yco-64,17,18, &data->lockflag, 13.0, 1.0, 0, 0, "The axis that is locked");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+238, *yco-64,17,18, &data->lockflag, 13.0, 2.0, 0, 0, "The axis that is locked");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+204, *yco-64,17,18, &data->lockflag, 13.0, 0.0, 0, 0, "The axis that is locked");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+221, *yco-64,17,18, &data->lockflag, 13.0, 1.0, 0, 0, "The axis that is locked");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->lockflag, 13.0, 2.0, 0, 0, "The axis that is locked");
uiBlockEndAlign(block);
}
break;
@ -703,7 +698,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bFollowPathConstraint *data = con->data;
height = 66;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -714,25 +709,25 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
but=uiDefButBitI(block, TOG, 1, B_CONSTRAINT_TEST, "CurveFollow", *xco+39, *yco-44, 100, 18, &data->followflag, 0, 24, 0, 0, "Object will follow the heading and banking of the curve");
/* Draw Offset number button */
uiDefButF(block, NUM, B_CONSTRAINT_REDRAW, "Offset:", *xco+155, *yco-44, 100, 18, &data->offset, -9000, 9000, 100.0, 0.0, "Offset from the position corresponding to the time frame");
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Offset:", *xco+155, *yco-44, 100, 18, &data->offset, -9000, 9000, 100.0, 0.0, "Offset from the position corresponding to the time frame");
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Fw:", *xco+12, *yco-64, 27, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Y", *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-X", *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-Y", *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"-Z", *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X", *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y", *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points forward along the path");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z", *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points forward along the path");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", *xco+174, *yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+204, *yco-64,17,18, &data->upflag, 13.0, 0.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Y", *xco+221, *yco-64,17,18, &data->upflag, 13.0, 1.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+238, *yco-64,17,18, &data->upflag, 13.0, 2.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+204, *yco-64,17,18, &data->upflag, 13.0, 0.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y", *xco+221, *yco-64,17,18, &data->upflag, 13.0, 1.0, 0, 0, "The axis that points upward");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->upflag, 13.0, 2.0, 0, 0, "The axis that points upward");
uiBlockEndAlign(block);
}
break;
@ -742,7 +737,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
bArmature *arm;
height = 105;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,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, "");
@ -761,32 +756,32 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
uiBlockBeginAlign(block);
uiDefButF(block,BUTM,B_CONSTRAINT_REDRAW,"R",*xco, *yco-60,20,18,&(data->orglength),0.0,0,0,0,"Recalculate RLenght");
uiDefButF(block,NUM,B_CONSTRAINT_REDRAW,"Rest Length:",*xco+18, *yco-60,237,18,&(data->orglength),0.0,100,0.5,0.5,"Lenght at Rest Position");
uiDefButF(block,BUTM,B_CONSTRAINT_TEST,"R",*xco, *yco-60,20,18,&(data->orglength),0.0,0,0,0,"Recalculate RLenght");
uiDefButF(block,NUM,B_CONSTRAINT_TEST,"Rest Length:",*xco+18, *yco-60,237,18,&(data->orglength),0.0,100,0.5,0.5,"Lenght at Rest Position");
uiBlockEndAlign(block);
uiDefButF(block,NUM,B_CONSTRAINT_REDRAW,"Volume Variation:",*xco+18, *yco-82,237,18,&(data->bulge),0.0,100,0.5,0.5,"Factor between volume variation and stretching");
uiDefButF(block,NUM,B_CONSTRAINT_TEST,"Volume Variation:",*xco+18, *yco-82,237,18,&(data->bulge),0.0,100,0.5,0.5,"Factor between volume variation and stretching");
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Vol:",*xco+14, *yco-104,30,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"XZ", *xco+44, *yco-104,30,18, &data->volmode, 12.0, 0.0, 0, 0, "Keep Volume: Scaling X & Z");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+74, *yco-104,20,18, &data->volmode, 12.0, 1.0, 0, 0, "Keep Volume: Scaling X");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+94, *yco-104,20,18, &data->volmode, 12.0, 2.0, 0, 0, "Keep Volume: Scaling Z");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"NONE", *xco+114, *yco-104,50,18, &data->volmode, 12.0, 3.0, 0, 0, "Ignore Volume");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"XZ", *xco+44, *yco-104,30,18, &data->volmode, 12.0, 0.0, 0, 0, "Keep Volume: Scaling X & Z");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+74, *yco-104,20,18, &data->volmode, 12.0, 1.0, 0, 0, "Keep Volume: Scaling X");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+94, *yco-104,20,18, &data->volmode, 12.0, 2.0, 0, 0, "Keep Volume: Scaling Z");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"NONE", *xco+114, *yco-104,50,18, &data->volmode, 12.0, 3.0, 0, 0, "Ignore Volume");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefBut(block, LABEL, B_CONSTRAINT_TEST,"Plane:",*xco+175, *yco-104,40,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X", *xco+215, *yco-104,20,18, &data->plane, 12.0, 0.0, 0, 0, "Keep X axis");
uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z", *xco+235, *yco-104,20,18, &data->plane, 12.0, 2.0, 0, 0, "Keep Z axis");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X", *xco+215, *yco-104,20,18, &data->plane, 12.0, 0.0, 0, 0, "Keep X axis");
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+235, *yco-104,20,18, &data->plane, 12.0, 2.0, 0, 0, "Keep Z axis");
uiBlockEndAlign(block);
}
break;
case CONSTRAINT_TYPE_NULL:
{
height = 17;
uiDefBut(block, ROUNDBOX, 0, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, 0, "");
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+30,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
}
break;
@ -800,14 +795,13 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
if (con->type!=CONSTRAINT_TYPE_NULL) {
uiBlockBeginAlign(block);
uiDefButF(block, NUMSLI, B_CONSTRAINT_REDRAW, "Influence ", *xco, *yco, 197, 20, &(con->enforce), 0.0, 1.0, 0.0, 0.0, "Amount of influence this constraint will have on the final solution");
but = uiDefBut(block, BUT, B_CONSTRAINT_REDRAW, "Show", *xco+200, *yco, 45, 20, 0, 0.0, 1.0, 0.0, 0.0, "Show this constraint's ipo in the object's Ipo window");
/* If this is on an object, add the constraint to the object */
uiButSetFunc (but, activate_constraint_ipo_func, con, NULL);
/* If this is on a bone, add the constraint to the action (if any) */
but = uiDefBut(block, BUT, B_CONSTRAINT_REDRAW, "Key", *xco+245, *yco, 40, 20, 0, 0.0, 1.0, 0.0, 0.0, "Add an influence keyframe to the constraint");
uiDefButF(block, NUMSLI, B_CONSTRAINT_TEST, "Influence ", *xco, *yco, 197, 20, &(con->enforce), 0.0, 1.0, 0.0, 0.0, "Amount of influence this constraint will have on the final solution");
but = uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Show", *xco+200, *yco, 45, 20, 0, 0.0, 1.0, 0.0, 0.0, "Show constraint's ipo in the Ipo window, adds a channel if not there");
/* If this is on an object or bone, add ipo channel the constraint */
uiButSetFunc (but, enable_constraint_ipo_func, ob, con);
but = uiDefBut(block, BUT, B_CONSTRAINT_TEST, "Key", *xco+245, *yco, 40, 20, 0, 0.0, 1.0, 0.0, 0.0, "Add an influence keyframe to the constraint");
/* Add a keyframe to the influence IPO */
uiButSetFunc (but, add_influence_key_to_constraint_func, con, NULL);
uiButSetFunc (but, add_influence_key_to_constraint_func, ob, con);
uiBlockEndAlign(block);
(*yco)-=24;
} else {
@ -818,14 +812,12 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
static uiBlock *add_constraintmenu(void *arg_unused)
{
Object *ob= OBACT;
uiBlock *block;
ListBase *conlist;
char ownerstr[64];
short type;
short yco= 0;
conlist = get_constraint_client(ownerstr, &type, NULL);
conlist = get_active_constraints(ob);
block= uiNewBlock(&curarea->uiblocks, "add_constraintmenu", UI_EMBOSSP, UI_HELV, curarea->win);
@ -842,8 +834,7 @@ static uiBlock *add_constraintmenu(void *arg_unused)
uiDefBut(block, BUTM, B_CONSTRAINT_ADD_STRETCHTO,"Stretch To", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
if (type==TARGET_BONE) {
if (ob->flag & OB_POSEMODE) {
uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefBut(block, BUTM, B_CONSTRAINT_ADD_KINEMATIC,"IK Solver", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
@ -864,16 +855,10 @@ void do_constraintbuts(unsigned short event)
{
Object *ob= OBACT;
object_test_constraints(ob);
switch(event) {
case B_CONSTRAINT_CHANGENAME:
case B_CONSTRAINT_TEST:
case B_CONSTRAINT_REDRAW:
case B_CONSTRAINT_CHANGETYPE:
break; // no handling
case B_CONSTRAINT_DEL:
case B_CONSTRAINT_CHANGETARGET:
if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
DAG_scene_sort(G.scene);
@ -884,7 +869,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_NULL);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -894,7 +879,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -904,7 +889,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_TRACKTO);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -914,7 +899,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_ROTLIKE);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -924,7 +909,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_LOCLIKE);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -934,7 +919,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_ACTION);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -944,7 +929,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_LOCKTRACK);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -954,7 +939,7 @@ void do_constraintbuts(unsigned short event)
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_FOLLOWPATH);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
}
break;
@ -962,7 +947,7 @@ void do_constraintbuts(unsigned short event)
{
bConstraint *con;
con = add_new_constraint(CONSTRAINT_TYPE_STRETCHTO);
add_constraint_to_client(con);
add_constraint_to_active(ob, con);
BIF_undo_push("Add constraint");
}
@ -972,6 +957,8 @@ void do_constraintbuts(unsigned short event)
break;
}
object_test_constraints(ob);
if(ob->pose) update_pose_constraint_flags(ob->pose);
if(ob->type==OB_ARMATURE) DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
@ -984,10 +971,11 @@ void do_constraintbuts(unsigned short event)
static void object_panel_constraint(void)
{
uiBlock *block;
Object *ob= OBACT;
ListBase *conlist;
bConstraint *curcon;
short xco, yco, type;
char ownerstr[64];
short xco, yco;
char str[64];
block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Constraints", "Object", 640, 0, 318, 204)==0) return;
@ -996,31 +984,24 @@ static void object_panel_constraint(void)
/* so first we make it default height */
uiNewPanelHeight(block, 204);
if(G.obedit==OBACT) return;
if(G.obedit==OBACT) return; // ??
conlist = get_constraint_client(ownerstr, &type, NULL);
conlist = get_active_constraints(OBACT);
if (conlist) {
uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint");
/* print active object or bone */
{
short type;
void *data=NULL;
char str[64];
str[0]= 0;
get_constraint_client(NULL, &type, &data);
if (data && type==TARGET_BONE){
sprintf(str, "To Bone: %s", ((Bone*)data)->name);
if (ob->flag & OB_POSEMODE){
bPoseChannel *pchan= get_active_posechannel(ob);
if(pchan) sprintf(str, "To Bone: %s", pchan->name);
}
else if(OBACT) {
Object *ob= OBACT;
else {
sprintf(str, "To Object: %s", ob->id.name+2);
}
uiDefBut(block, LABEL, 1, str, 150, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Displays Active Object or Bone name");
}
/* Go through the list of constraints and draw them */
xco = 10;
@ -1028,7 +1009,7 @@ static void object_panel_constraint(void)
for (curcon = conlist->first; curcon; curcon=curcon->next) {
/* Draw default constraint header */
draw_constraint(block, conlist, curcon, &xco, &yco, type);
draw_constraint(block, conlist, curcon, &xco, &yco);
}
if(yco < 0) uiNewPanelHeight(block, 204-yco);

@ -1847,23 +1847,6 @@ int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
}
}
/* signal update to ipo window */
if(ob->ipowin==IPO_CO) {
bConstraintChannel *chan;
ListBase *conbase;
conbase = get_constraint_client_channels(0);
if (conbase) {
for(chan= conbase->first; chan; chan= chan->next) {
if(chan->ipo)
break;
}
/* Make this the active channel */
ob->activecon = chan;
}
else ob->activecon = NULL;
}
/* in weightpaint we select the associated vertex group too */
if(G.f & G_WEIGHTPAINT) {
if(nearBone->flag & BONE_ACTIVE) {
@ -1873,7 +1856,7 @@ int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWIPO, 0); /* To force action ipo update */
allqueue(REDRAWIPO, 0); /* To force action/constraint ipo update */
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWOOPS, 0);

@ -56,6 +56,7 @@
#include "BIF_editaction.h"
#include "BIF_editarmature.h"
#include "BIF_editconstraint.h"
#include "BIF_poseobject.h"
#include "BIF_interface.h"
#include "BIF_screen.h"
#include "BIF_toolbox.h"
@ -64,34 +65,10 @@
#include "nla.h"
/* called by buttons to find a bone to display/edit values for */
static bPoseChannel *get_active_posechannel (void)
ListBase *get_active_constraint_channels (Object *ob, int forcevalid)
{
Object *ob= OBACT;
bPoseChannel *pchan;
bArmature *arm;
arm = get_armature(OBACT);
if (!arm)
return NULL;
/* find for active */
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone && (pchan->bone->flag & BONE_ACTIVE))
return pchan;
}
return NULL;
}
ListBase *get_constraint_client_channels (int forcevalid)
{
Object *ob;
char ipstr[64];
ob=OBACT;
if (!ob)
return NULL;
@ -100,7 +77,7 @@ ListBase *get_constraint_client_channels (int forcevalid)
bActionChannel *achan;
bPoseChannel *pchan;
pchan = get_active_posechannel();
pchan = get_active_posechannel(ob);
if (pchan) {
/* Make sure we have an action */
@ -135,49 +112,87 @@ ListBase *get_constraint_client_channels (int forcevalid)
return &ob->constraintChannels;
}
ListBase *get_constraint_client(char *name, short *clientType, void **clientdata)
{
Object *ob;
ListBase *list;
ob=OBACT;
if (clientType)
*clientType = -1;
/* if object in posemode, active bone constraints, else object constraints */
ListBase *get_active_constraints(Object *ob)
{
ListBase *list;
if (!ob)
return NULL;
list = &ob->constraints;
/* Prep the object's constraint channels */
if (clientType)
*clientType = TARGET_OBJECT;
if (name)
strcpy (name, ob->id.name+2);
if (ob->flag & OB_POSEMODE) {
bPoseChannel *pchan;
pchan = get_active_posechannel();
if (pchan) {
/* Is the bone the client? */
if (clientType)
*clientType = TARGET_BONE;
if (clientdata)
*clientdata = pchan->bone;
if (name)
sprintf (name, "%s>>%s", name, pchan->name);
pchan = get_active_posechannel(ob);
if (pchan)
list = &pchan->constraints;
}
}
return list;
}
bConstraint * add_new_constraint(char type)
/* single constraint */
bConstraint *get_active_constraint(Object *ob)
{
ListBase *lb= get_active_constraints(ob);
if(lb) {
bConstraint *con;
for(con= lb->first; con; con=con->next)
if(con->flag & CONSTRAINT_ACTIVE)
return con;
}
return NULL;
}
/* single channel, for ipo */
bConstraintChannel *get_active_constraint_channel(Object *ob)
{
bConstraint *con;
bConstraintChannel *chan;
if (ob->flag & OB_POSEMODE) {
if(ob->action) {
bPoseChannel *pchan;
pchan = get_active_posechannel(ob);
if(pchan) {
for(con= pchan->constraints.first; con; con= con->next)
if(con->flag & CONSTRAINT_ACTIVE)
break;
if(con) {
bActionChannel *achan = get_named_actionchannel(ob->action, pchan->name);
if(achan) {
for(chan= achan->constraintChannels.first; chan; chan= chan->next)
if(!strcmp(chan->name, con->name))
break;
return chan;
}
}
}
}
}
else {
for(con= ob->constraints.first; con; con= con->next)
if(con->flag & CONSTRAINT_ACTIVE)
break;
if(con) {
for(chan= ob->constraintChannels.first; chan; chan= chan->next)
if(!strcmp(chan->name, con->name))
break;
return chan;
}
}
return NULL;
}
bConstraint *add_new_constraint(short type)
{
bConstraint *con;
@ -197,86 +212,65 @@ void add_constraint_to_object(bConstraint *con, Object *ob)
{
ListBase *list;
list = &ob->constraints;
if (list)
{
if (list) {
unique_constraint_name(con, list);
BLI_addtail(list, con);
con->flag |= CONSTRAINT_ACTIVE;
for(con= con->prev; con; con= con->prev)
con->flag &= ~CONSTRAINT_ACTIVE;
}
}
void add_constraint_to_client(bConstraint *con)
{
ListBase *list;
short type;
list = get_constraint_client(NULL, &type, NULL);
if (list)
{
unique_constraint_name(con, list);
BLI_addtail(list, con);
}
}
bConstraintChannel *add_new_constraint_channel(const char* name)
{
bConstraintChannel *chan = NULL;
chan = MEM_callocN(sizeof(bConstraintChannel), "constraintChannel");
strcpy(chan->name, name);
return chan;
}
void add_influence_key_to_constraint (bConstraint *con){
printf("doesn't do anything yet\n");
}
char *get_con_subtarget_name(bConstraint *constraint, Object *target)
char *get_con_subtarget_name(bConstraint *con, Object *target)
{
/*
* If the target for this constraint is target, return a pointer
* to the name for this constraints subtarget ... NULL otherwise
*/
switch (constraint->type) {
switch (con->type) {
case CONSTRAINT_TYPE_ACTION:
{
bActionConstraint *data = constraint->data;
bActionConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
case CONSTRAINT_TYPE_LOCLIKE:
{
bLocateLikeConstraint *data = constraint->data;
bLocateLikeConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
case CONSTRAINT_TYPE_ROTLIKE:
{
bRotateLikeConstraint *data = constraint->data;
bRotateLikeConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
case CONSTRAINT_TYPE_KINEMATIC:
{
bKinematicConstraint *data = constraint->data;
bKinematicConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
case CONSTRAINT_TYPE_TRACKTO:
{
bTrackToConstraint *data = constraint->data;
bTrackToConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
case CONSTRAINT_TYPE_LOCKTRACK:
{
bLockTrackConstraint *data = constraint->data;
bLockTrackConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
case CONSTRAINT_TYPE_STRETCHTO:
{
bStretchToConstraint *data = constraint->data;
bStretchToConstraint *data = con->data;
if (data->tar==target) return data->subtarget;
}
break;
@ -286,7 +280,7 @@ char *get_con_subtarget_name(bConstraint *constraint, Object *target)
*/
{
/*
* bFollowPathConstraint *data = constraint->data;
* bFollowPathConstraint *data = con->data;
*/
return NULL;
}
@ -354,6 +348,7 @@ static void test_constraints (Object *owner, const char* substring)
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -371,6 +366,7 @@ static void test_constraints (Object *owner, const char* substring)
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -388,6 +384,7 @@ static void test_constraints (Object *owner, const char* substring)
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -404,6 +401,7 @@ static void test_constraints (Object *owner, const char* substring)
bKinematicConstraint *data = curcon->data;
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -420,6 +418,7 @@ static void test_constraints (Object *owner, const char* substring)
bTrackToConstraint *data = curcon->data;
if (!exist_object(data->tar)) {
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -445,6 +444,7 @@ static void test_constraints (Object *owner, const char* substring)
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -471,6 +471,7 @@ static void test_constraints (Object *owner, const char* substring)
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
@ -488,10 +489,12 @@ static void test_constraints (Object *owner, const char* substring)
if (!exist_object(data->tar)){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
if (data->tar->type != OB_CURVE){
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
break;
}
if (data->upflag==data->trackflag){

@ -92,6 +92,7 @@
#include "BIF_butspace.h"
#include "BIF_editaction.h"
#include "BIF_editconstraint.h"
#include "BIF_editkey.h"
#include "BIF_editseq.h"
#include "BIF_editview.h"
@ -562,9 +563,12 @@ Ipo *get_ipo_to_edit(ID **from)
if(last_seq) return last_seq->ipo;
}
else if(G.sipo->blocktype==IPO_CO){
if (ob && ob->activecon){
if (ob) {
bConstraintChannel *chan= get_active_constraint_channel(ob);
if(chan) {
*from= (ID*) ob;
return ob->activecon->ipo;
return chan->ipo;
}
}
}
else if(G.sipo->blocktype==ID_AC) {
@ -1793,100 +1797,104 @@ Ipo *get_ipo(ID *from, short type, int make)
World *wo;
Lamp *la;
Camera *ca;
Ipo *ipo= 0;
Ipo *ipo= NULL;
bAction *act;
if( type==ID_OB) {
ob= (Object *)from;
if(ob->id.lib) return 0;
if(ob->id.lib) return NULL;
ipo= ob->ipo;
if(make && ipo==0) ipo= ob->ipo= add_ipo("ObIpo", ID_OB);
if(make && ipo==NULL) ipo= ob->ipo= add_ipo("ObIpo", ID_OB);
}
else if( type==IPO_CO){
ob= (Object *)from;
if(ob->id.lib) return 0;
bConstraintChannel *chan;
if (ob->activecon){
ipo= ob->activecon->ipo;
if(make && ipo==0) ipo= ob->activecon->ipo= add_ipo("CoIpo", IPO_CO);
ob= (Object *)from;
if(ob->id.lib) return NULL;
chan= get_active_constraint_channel(ob);
if (chan){
ipo= chan->ipo;
if(make && ipo==NULL) ipo= chan->ipo= add_ipo("CoIpo", IPO_CO);
}
}
else if( type==ID_AC) {
act= (bAction *)from;
if (!act->achan) return 0;
if (act->id.lib) return 0;
if (!act->achan) return NULL;
if (act->id.lib) return NULL;
ipo= act->achan->ipo;
/* This should never happen */
if(make && ipo==0) ipo= act->achan->ipo= add_ipo("AcIpo", ID_AC);
if(make && ipo==NULL) ipo= act->achan->ipo= add_ipo("AcIpo", ID_AC);
}
else if( type==ID_MA) {
ma= (Material *)from;
if(ma->id.lib) return 0;
if(ma->id.lib) return NULL;
ipo= ma->ipo;
if(make && ipo==0) ipo= ma->ipo= add_ipo("MatIpo", ID_MA);
if(make && ipo==NULL) ipo= ma->ipo= add_ipo("MatIpo", ID_MA);
}
else if( type==ID_TE) {
tex= (Tex *)from;
if(tex->id.lib) return 0;
if(tex->id.lib) return NULL;
ipo= tex->ipo;
if(make && ipo==0) ipo= tex->ipo= add_ipo("TexIpo", ID_TE);
if(make && ipo==NULL) ipo= tex->ipo= add_ipo("TexIpo", ID_TE);
}
else if( type==ID_SEQ) {
seq= (Sequence *)from;
if((seq->type & SEQ_EFFECT)||(seq->type == SEQ_SOUND)) {
ipo= seq->ipo;
if(make && ipo==0) ipo= seq->ipo= add_ipo("SeqIpo", ID_SEQ);
if(make && ipo==NULL) ipo= seq->ipo= add_ipo("SeqIpo", ID_SEQ);
}
else return 0;
else return NULL;
}
else if( type==ID_CU) {
cu= (Curve *)from;
if(cu->id.lib) return 0;
if(cu->id.lib) return NULL;
ipo= cu->ipo;
if(make && ipo==0) ipo= cu->ipo= add_ipo("CuIpo", ID_CU);
if(make && ipo==NULL) ipo= cu->ipo= add_ipo("CuIpo", ID_CU);
}
else if( type==ID_KE) {
key= (Key *)from;
if(key->id.lib) return 0;
if(key->id.lib) return NULL;
ipo= key->ipo;
if(make && ipo==0) ipo= key->ipo= add_ipo("KeyIpo", ID_KE);
if(make && ipo==NULL) ipo= key->ipo= add_ipo("KeyIpo", ID_KE);
}
else if( type==ID_WO) {
wo= (World *)from;
if(wo->id.lib) return 0;
if(wo->id.lib) return NULL;
ipo= wo->ipo;
if(make && ipo==0) ipo= wo->ipo= add_ipo("WoIpo", ID_WO);
if(make && ipo==NULL) ipo= wo->ipo= add_ipo("WoIpo", ID_WO);
}
else if( type==ID_LA) {
la= (Lamp *)from;
if(la->id.lib) return 0;
if(la->id.lib) return NULL;
ipo= la->ipo;
if(make && ipo==0) ipo= la->ipo= add_ipo("LaIpo", ID_LA);
if(make && ipo==NULL) ipo= la->ipo= add_ipo("LaIpo", ID_LA);
}
else if( type==ID_CA) {
ca= (Camera *)from;
if(ca->id.lib) return 0;
if(ca->id.lib) return NULL;
ipo= ca->ipo;
if(make && ipo==0) ipo= ca->ipo= add_ipo("CaIpo", ID_CA);
if(make && ipo==NULL) ipo= ca->ipo= add_ipo("CaIpo", ID_CA);
}
else if( type==ID_SO) {
bSound *snd= (bSound *)from;
if(snd->id.lib) return 0;
if(snd->id.lib) return NULL;
ipo= snd->ipo;
if(make && ipo==0) ipo= snd->ipo= add_ipo("SndIpo", ID_SO);
if(make && ipo==NULL) ipo= snd->ipo= add_ipo("SndIpo", ID_SO);
}
else return 0;
else return NULL;
return ipo;
}

@ -1764,10 +1764,6 @@ void delete_nlachannels(void){
nextchan = conchan->next;
if (conchan->flag & CONSTRAINT_CHANNEL_SELECT){
/* If we're the active constraint, unlink us */
if (conchan==base->object->activecon)
base->object->activecon = NULL;
if (conchan->ipo)
conchan->ipo->id.us--;
BLI_freelinkN(&base->object->constraintChannels, conchan);

@ -2769,9 +2769,7 @@ void copy_attr(short event)
if (U.dupflag& USER_DUP_IPO)
copy_constraint_channels(&base->object->constraintChannels, &ob->constraintChannels);
else
clone_constraint_channels (&base->object->constraintChannels, &ob->constraintChannels, NULL);
base->object->activecon = NULL;
clone_constraint_channels (&base->object->constraintChannels, &ob->constraintChannels);
}
else if(event==23) {
base->object->softflag= ob->softflag;
@ -3623,7 +3621,6 @@ void single_obdata_users(int flag)
}
else {
ob->action= copy_action(ob->action);
ob->activecon=NULL;
id->us--;
id->newid=(ID *)ob->action;
}
@ -4105,7 +4102,6 @@ void adduplicate(int noTrans)
ID_NEW_US(obn->action)
else{
obn->action= copy_action(obn->action);
obn->activecon=NULL;
}
id->us--;
}

@ -281,7 +281,7 @@ int std_libbuttons(uiBlock *block, short xco, short yco,
if(ob==NULL) {
if(G.sipo->blocktype!=ID_SEQ && G.sipo->blocktype!=ID_WO) {
id= NULL;
idwasnul= 0;
idwasnul= NULL;
}
}
}
@ -657,7 +657,7 @@ void do_global_buttons(unsigned short event)
ob= OBACT;
id= 0; /* id at null for texbrowse */
id= NULL; /* id at null for texbrowse */
switch(event) {
@ -829,7 +829,7 @@ void do_global_buttons(unsigned short event)
if(mtex) {
if(mtex->tex) mtex->tex->id.us--;
MEM_freeN(mtex);
ma->mtex[ ma->texact ]= 0;
ma->mtex[ ma->texact ]= NULL;
allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWIPO, 0);
BIF_preview_changed(G.buts);
@ -843,7 +843,7 @@ void do_global_buttons(unsigned short event)
if(mtex) {
if(mtex->tex) mtex->tex->id.us--;
MEM_freeN(mtex);
wrld->mtex[ wrld->texact ]= 0;
wrld->mtex[ wrld->texact ]= NULL;
allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWIPO, 0);
BIF_preview_changed(G.buts);
@ -857,7 +857,7 @@ void do_global_buttons(unsigned short event)
if(mtex) {
if(mtex->tex) mtex->tex->id.us--;
MEM_freeN(mtex);
la->mtex[ la->texact ]= 0;
la->mtex[ la->texact ]= NULL;
allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWIPO, 0);
BIF_preview_changed(G.buts);
@ -874,7 +874,7 @@ void do_global_buttons(unsigned short event)
id= G.buts->lockpoin;
if(event==B_EXTEXBROWSE) {
id= 0;
id= NULL;
ma= give_current_material(ob, ob->actcol);
if(ma) {
mtex= ma->mtex[ ma->texact ];
@ -891,7 +891,7 @@ void do_global_buttons(unsigned short event)
}
else {
id= 0;
id= NULL;
ma= give_current_material(ob, ob->actcol);
if(ma) {
@ -988,7 +988,6 @@ void do_global_buttons(unsigned short event)
act= (bAction *)idtest;
ob->action= act;
ob->activecon=NULL;
id_us_plus(idtest);
if(id) id->us--;
@ -1043,7 +1042,7 @@ void do_global_buttons(unsigned short event)
nr= GS(from->name);
if(nr==ID_OB){
if (G.sipo->blocktype==IPO_CO)
idtest= (ID *)add_ipo("CoIpo", IPO_CO); /* BLEARGH! */
idtest= (ID *)add_ipo("CoIpo", IPO_CO); /* constraint channel is no ID data... */
else
idtest= (ID *)add_ipo("ObIpo", nr);
}
@ -1057,7 +1056,7 @@ void do_global_buttons(unsigned short event)
else if(nr==ID_CA) idtest= (ID *)add_ipo("CaIpo", nr);
else if(nr==ID_SO) idtest= (ID *)add_ipo("SndIpo", nr);
else if(nr==ID_AC) idtest= (ID *)add_ipo("ActIpo", nr);
else error("Warn bugs@blender.nl!");
else error("Warn bugtracker!");
}
idtest->us--;
}
@ -1065,12 +1064,15 @@ void do_global_buttons(unsigned short event)
ipo= (Ipo *)idtest;
if (ipo->blocktype==IPO_CO){
((Object*)from)->activecon->ipo = ipo;
bConstraintChannel *chan= get_active_constraint_channel((Object*)from);
if(chan) {
chan->ipo = ipo;
id_us_plus(idtest);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
}
}
else if(ipo->blocktype==ID_OB) {
( (Object *)from)->ipo= ipo;
id_us_plus(idtest);
@ -1155,25 +1157,27 @@ void do_global_buttons(unsigned short event)
ipo->id.us--;
if(ipo->blocktype==ID_OB) ( (Object *)from)->ipo= 0;
else if(ipo->blocktype==ID_MA) ( (Material *)from)->ipo= 0;
else if(ipo->blocktype==ID_TE) ( (Tex *)from)->ipo= 0;
else if(ipo->blocktype==ID_SEQ) ( (Sequence *)from)->ipo= 0;
else if(ipo->blocktype==ID_CU) ( (Curve *)from)->ipo= 0;
else if(ipo->blocktype==ID_KE) ( (Key *)from)->ipo= 0;
else if(ipo->blocktype==ID_WO) ( (World *)from)->ipo= 0;
else if(ipo->blocktype==ID_LA) ( (Lamp *)from)->ipo= 0;
else if(ipo->blocktype==ID_WO) ( (World *)from)->ipo= 0;
else if(ipo->blocktype==ID_CA) ( (Camera *)from)->ipo= 0;
else if(ipo->blocktype==ID_SO) ( (bSound *)from)->ipo= 0;
if(ipo->blocktype==ID_OB) ( (Object *)from)->ipo= NULL;
else if(ipo->blocktype==ID_MA) ( (Material *)from)->ipo= NULL;
else if(ipo->blocktype==ID_TE) ( (Tex *)from)->ipo= NULL;
else if(ipo->blocktype==ID_SEQ) ( (Sequence *)from)->ipo= NULL;
else if(ipo->blocktype==ID_CU) ( (Curve *)from)->ipo= NULL;
else if(ipo->blocktype==ID_KE) ( (Key *)from)->ipo= NULL;
else if(ipo->blocktype==ID_WO) ( (World *)from)->ipo= NULL;
else if(ipo->blocktype==ID_LA) ( (Lamp *)from)->ipo= NULL;
else if(ipo->blocktype==ID_WO) ( (World *)from)->ipo= NULL;
else if(ipo->blocktype==ID_CA) ( (Camera *)from)->ipo= NULL;
else if(ipo->blocktype==ID_SO) ( (bSound *)from)->ipo= NULL;
else if(ipo->blocktype==ID_AC) {
bAction *act = (bAction*) from;
bActionChannel *chan =
get_hilighted_action_channel((bAction*)from);
BLI_freelinkN (&act->chanbase, chan);
}
else if(ipo->blocktype==IPO_CO) ((Object *)from)->activecon->ipo= 0;
else if(ipo->blocktype==IPO_CO) {
bConstraintChannel *chan= get_active_constraint_channel((Object*)from);
if(chan) chan->ipo= NULL;
}
else error("Warn bugtracker!");
editipo_changed(G.sipo, 1); /* doredraw */
@ -1226,7 +1230,7 @@ void do_global_buttons(unsigned short event)
case B_WORLDDELETE:
if(G.scene->world) {
G.scene->world->id.us--;
G.scene->world= 0;
G.scene->world= NULL;
BIF_undo_push("Unlink World");
allqueue(REDRAWBUTSSHADING, 0);
@ -1237,7 +1241,7 @@ void do_global_buttons(unsigned short event)
case B_WTEXBROWSE:
if(G.buts->texnr== -2) {
id= 0;
id= NULL;
wrld= G.scene->world;
if(wrld) {
mtex= wrld->mtex[ wrld->texact ];
@ -1253,7 +1257,7 @@ void do_global_buttons(unsigned short event)
}
else {
id= 0;
id= NULL;
wrld= G.scene->world;
if(wrld) {
@ -1338,7 +1342,7 @@ void do_global_buttons(unsigned short event)
if(ob->type!=OB_LAMP) return;
if(G.buts->texnr== -2) {
id= 0;
id= NULL;
la= ob->data;
mtex= la->mtex[ la->texact ];
if(mtex) id= (ID *)mtex->tex;
@ -1352,7 +1356,7 @@ void do_global_buttons(unsigned short event)
}
else {
id= 0;
id= NULL;
la= ob->data;
mtex= la->mtex[ la->texact ];
@ -1391,7 +1395,7 @@ void do_global_buttons(unsigned short event)
break;
case B_IMAGEDELETE:
G.sima->image= 0;
G.sima->image= NULL;
image_changed(G.sima, 0);
BIF_undo_push("Unlink Image");
allqueue(REDRAWIMAGE, 0);
@ -1744,7 +1748,6 @@ void do_global_buttons2(short event)
if(act->id.us>1) {
if(okee("Single user")) {
ob->action=copy_action(act);
ob->activecon=NULL;
act->id.us--;
allqueue(REDRAWACTION, 0);
}
@ -1997,9 +2000,11 @@ void do_global_buttons2(short event)
else if(ipo->blocktype==ID_WO) ((World *)idfrom)->ipo= copy_ipo(ipo);
else if(ipo->blocktype==ID_CA) ((Camera *)idfrom)->ipo= copy_ipo(ipo);
else if(ipo->blocktype==ID_SO) ((bSound *)idfrom)->ipo= copy_ipo(ipo);
else if(ipo->blocktype==ID_AC) get_hilighted_action_channel((bAction *)idfrom)->ipo= copy_ipo(ipo);
else if(ipo->blocktype==IPO_CO) ((Object *)idfrom)->activecon->ipo= copy_ipo(ipo);
else error("Warn ton!");
else if(ipo->blocktype==ID_AC)
get_hilighted_action_channel((bAction *)idfrom)->ipo= copy_ipo(ipo);
else if(ipo->blocktype==IPO_CO)
get_active_constraint_channel((Object*)idfrom)->ipo= copy_ipo(ipo);
else error("Warn bugtracker!");
ipo->id.us--;
allqueue(REDRAWIPO, 0);

@ -2086,6 +2086,7 @@ static int ui_do_but_SLI(uiBut *but)
ui_set_but_val(but, tempf);
}
uibut_do_func(but);
}
ui_check_but(but);
ui_draw_but(but);
@ -2864,6 +2865,7 @@ static int ui_do_button(uiBlock *block, uiBut *but, uiEvent *uevent)
if(uevent->val) retval= ui_do_but_NUMSLI(but);
break;
case ROUNDBOX:
case LABEL:
if(uevent->val) retval= ui_do_but_LABEL(but);
break;

@ -507,7 +507,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
temod->name = "Modifiers";
for (index=0,md=ob->modifiers.first; md; index++,md=md->next) {
TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index);
if(te) te->name= md->name;
te->name= md->name;
if (md->type==eModifierType_Lattice) {
outliner_add_element(soops, &te->subtree, ((LatticeModifierData*) md)->object, te, TSE_MODIFIER_OB, 0);

@ -148,6 +148,22 @@ void exit_posemode(void)
scrarea_queue_headredraw(curarea);
}
/* called by buttons to find a bone to display/edit values for */
bPoseChannel *get_active_posechannel (Object *ob)
{
bPoseChannel *pchan;
/* find active */
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone && (pchan->bone->flag & BONE_ACTIVE))
return pchan;
}
return NULL;
}
void pose_select_constraint_target(void)
{
Object *ob= OBACT;

@ -8,32 +8,16 @@ extern "C" {
#include "MEM_guardedalloc.h"
#include "IMB_imbuf_types.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
#include "DNA_effect_types.h"
#include "DNA_group_types.h"
#include "DNA_image_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_radio_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
#include "DNA_vfont_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "BKE_global.h"