More SoftBody stuff:

- after grab/duplicate the softbody didn't get a reset signal
- added 'copy properties' for softbody settings
- duplicate object didn't copy softbody yet
This commit is contained in:
2005-04-16 15:06:02 +00:00
parent 7943f7990e
commit 07ef51cdb1
4 changed files with 29 additions and 10 deletions

View File

@@ -43,10 +43,12 @@ struct Object;
struct Camera;
struct BoundBox;
struct View3D;
struct SoftBody;
void clear_workob(void);
void copy_baseflags(void);
void copy_objectflags(void);
struct SoftBody *copy_softbody(struct SoftBody *sb);
void update_base_layer(struct Object *ob);
void free_object(struct Object *ob);
void unlink_object(struct Object *ob);

View File

@@ -745,6 +745,18 @@ void base_init_from_view3d(Base *base, View3D *v3d)
v3d->viewquat[0]= -v3d->viewquat[0];
}
SoftBody *copy_softbody(SoftBody *sb)
{
SoftBody *sbn;
sbn= MEM_dupallocN(sb);
sbn->totspring= sbn->totpoint= 0;
sbn->bpoint= NULL;
sbn->bspring= NULL;
sbn->ctime= 0.0f;
return sbn;
}
Object *copy_object(Object *ob)
{
@@ -785,7 +797,6 @@ Object *copy_object(Object *ob)
if (actcon)
obn->activecon = actcon;
if(ob->pd) obn->pd= MEM_dupallocN(ob->pd);
/* increase user numbers */
id_us_plus((ID *)obn->data);
@@ -794,7 +805,9 @@ Object *copy_object(Object *ob)
for(a=0; a<obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
obn->disp.first= obn->disp.last= NULL;
obn->soft= NULL;
if(ob->pd) obn->pd= MEM_dupallocN(ob->pd);
obn->soft= copy_softbody(ob->soft);
return obn;
}

View File

@@ -1269,7 +1269,7 @@ void sbFree(SoftBody *sb)
/* makes totally fresh start situation */
void sbObjectToSoftbody(Object *ob)
{
switch(ob->type) {
case OB_MESH:
mesh_to_softbody(ob);

View File

@@ -2430,6 +2430,8 @@ void copy_attr_menu()
if( give_parteff(ob) ) strcat(str, "|Particle Settings%x20");
if(ob->soft) strcat(str, "|Soft Body Settings%x23");
event= pupmenu(str);
if(event<= 0) return;
@@ -2602,7 +2604,7 @@ void copy_attr(short event)
makeDispList(base->object);
}
}
else if(event==22){
else if(event==22) {
/* Clear the constraints on the target */
free_constraints(&base->object->constraints);
free_constraint_channels(&base->object->constraintChannels);
@@ -2616,6 +2618,12 @@ void copy_attr(short event)
base->object->activecon = NULL;
}
else if(event==23) {
base->object->softflag= ob->softflag;
if(base->object->soft) sbFree(base->object->soft);
base->object->soft= copy_softbody(ob->soft);
}
}
}
base= base->next;
@@ -4368,7 +4376,6 @@ void special_aftertrans_update(char mode, int flip, short canceled, int keyflags
Base *base;
MetaBall *mb;
Curve *cu;
Ika *ika;
int doit,redrawipo=0;
@@ -4449,11 +4456,6 @@ void special_aftertrans_update(char mode, int flip, short canceled, int keyflags
where_is_object(ob);
if(ob->type==OB_IKA) {
ika= ob->data;
VecMat4MulVecfl(ika->effg, ob->obmat, ika->eff);
itterate_ika(ob);
}
if(ob->type==OB_ARMATURE && canceled) {
/* Unfortunately, sometimes when you escape
* a transform on an object that is the
@@ -4504,6 +4506,8 @@ void special_aftertrans_update(char mode, int flip, short canceled, int keyflags
makeDispList(ob);
}
if(ob->softflag & OB_SB_ENABLE) sbObjectReset(ob);
where_is_object(ob); /* always do, for track etc. */
/* Set autokey if necessary */