Removed all calls to object_wave in code, and moved it into the
mesh_modifier() in deform.c. Now wave works on top of hooks, before lattice/curve deform and armature. But together!
This commit is contained in:
@@ -60,7 +60,7 @@ void init_mv_jit(float *jit, int num,int seed2);
|
|||||||
void give_mesh_mvert(struct Mesh *me, int nr, float *co, short *no,int seed2);
|
void give_mesh_mvert(struct Mesh *me, int nr, float *co, short *no,int seed2);
|
||||||
void build_particle_system(struct Object *ob);
|
void build_particle_system(struct Object *ob);
|
||||||
void calc_wave_deform(struct WaveEff *wav, float ctime, float *co);
|
void calc_wave_deform(struct WaveEff *wav, float ctime, float *co);
|
||||||
void object_wave(struct Object *ob);
|
int object_wave(struct Object *ob);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
#include "BKE_object.h"
|
#include "BKE_object.h"
|
||||||
#include "BKE_scene.h"
|
#include "BKE_scene.h"
|
||||||
#include "BKE_effect.h"
|
|
||||||
#include "BKE_curve.h"
|
#include "BKE_curve.h"
|
||||||
#include "BKE_font.h"
|
#include "BKE_font.h"
|
||||||
|
|
||||||
@@ -345,10 +344,6 @@ static void setup_app_data(BlendFileData *bfd, char *filename)
|
|||||||
Curve *cu= ob->data;
|
Curve *cu= ob->data;
|
||||||
if(cu->nurb.first==0) text_to_curve(ob, 0);
|
if(cu->nurb.first==0) text_to_curve(ob, 0);
|
||||||
}
|
}
|
||||||
else if(ob->type==OB_MESH) {
|
|
||||||
makeDispList(ob);
|
|
||||||
if(ob->effect.first) object_wave(ob);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!G.background) {
|
if (!G.background) {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "DNA_curve_types.h"
|
#include "DNA_curve_types.h"
|
||||||
|
#include "DNA_effect_types.h"
|
||||||
#include "DNA_lattice_types.h"
|
#include "DNA_lattice_types.h"
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_meshdata_types.h"
|
#include "DNA_meshdata_types.h"
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
#include "BKE_curve.h"
|
#include "BKE_curve.h"
|
||||||
#include "BKE_deform.h"
|
#include "BKE_deform.h"
|
||||||
#include "BKE_displist.h"
|
#include "BKE_displist.h"
|
||||||
|
#include "BKE_effect.h"
|
||||||
#include "BKE_lattice.h"
|
#include "BKE_lattice.h"
|
||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
|
|
||||||
@@ -209,6 +211,7 @@ int mesh_modifier(Object *ob, char mode)
|
|||||||
|
|
||||||
/* conditions if it's needed */
|
/* conditions if it's needed */
|
||||||
if(ob->hooks.first);
|
if(ob->hooks.first);
|
||||||
|
else if(ob->effect.first); // weak... particles too
|
||||||
else if(ob->parent && ob->parent->type==OB_LATTICE);
|
else if(ob->parent && ob->parent->type==OB_LATTICE);
|
||||||
else if(ob->parent && ob->partype==PARSKEL);
|
else if(ob->parent && ob->partype==PARSKEL);
|
||||||
else return 0;
|
else return 0;
|
||||||
@@ -231,6 +234,8 @@ int mesh_modifier(Object *ob, char mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ob->effect.first) done |= object_wave(ob);
|
||||||
|
|
||||||
/* deform: input mesh, output ob dl_verts. is used by subsurf */
|
/* deform: input mesh, output ob dl_verts. is used by subsurf */
|
||||||
done |= object_deform(ob);
|
done |= object_deform(ob);
|
||||||
|
|
||||||
@@ -251,6 +256,7 @@ int mesh_modifier(Object *ob, char mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else { // end
|
else { // end
|
||||||
if(mvert) {
|
if(mvert) {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
#include "DNA_meta_types.h"
|
#include "DNA_meta_types.h"
|
||||||
#include "DNA_curve_types.h"
|
#include "DNA_curve_types.h"
|
||||||
|
#include "DNA_effect_types.h"
|
||||||
#include "DNA_listBase.h"
|
#include "DNA_listBase.h"
|
||||||
#include "DNA_lamp_types.h"
|
#include "DNA_lamp_types.h"
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
@@ -1759,8 +1760,6 @@ void makeDispList(Object *ob)
|
|||||||
mesh_modifier(ob, 's');
|
mesh_modifier(ob, 's');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ob->effect.first) object_wave(ob);
|
|
||||||
|
|
||||||
if (mesh_uses_displist(me)) { /* subsurf */
|
if (mesh_uses_displist(me)) { /* subsurf */
|
||||||
DispListMesh *dlm;
|
DispListMesh *dlm;
|
||||||
|
|
||||||
@@ -1782,6 +1781,7 @@ void makeDispList(Object *ob)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ob!=G.obedit) mesh_modifier(ob, 'e');
|
if(ob!=G.obedit) mesh_modifier(ob, 'e');
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(ob->type==OB_MBALL) {
|
else if(ob->type==OB_MBALL) {
|
||||||
|
|
||||||
@@ -2395,7 +2395,16 @@ void test_all_displists(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ob->type==OB_MESH) {
|
else if(ob->type==OB_MESH) {
|
||||||
if(ob->effect.first) object_wave(ob);
|
if(ob->effect.first) {
|
||||||
|
Effect *eff= ob->effect.first;
|
||||||
|
while(eff) {
|
||||||
|
if(eff->type==EFF_WAVE) {
|
||||||
|
freedisplist_object(ob);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eff= eff->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(ob!=G.obedit) {
|
if(ob!=G.obedit) {
|
||||||
if(( ((Mesh *)(ob->data))->key )||(ob->effect.first))
|
if(( ((Mesh *)(ob->data))->key )||(ob->effect.first))
|
||||||
freedisplist_object(ob); //makeDispList(ob);
|
freedisplist_object(ob); //makeDispList(ob);
|
||||||
|
|||||||
@@ -1424,14 +1424,16 @@ void calc_wave_deform(WaveEff *wav, float ctime, float *co)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void object_wave(Object *ob)
|
/* return 1 if deformed
|
||||||
|
Note: it works on mvert now, so assumes to be callied in modifier stack \
|
||||||
|
*/
|
||||||
|
int object_wave(Object *ob)
|
||||||
{
|
{
|
||||||
WaveEff *wav;
|
WaveEff *wav;
|
||||||
DispList *dl;
|
|
||||||
Mesh *me;
|
Mesh *me;
|
||||||
MVert *mvert;
|
MVert *mvert;
|
||||||
float *fp, ctime;
|
float ctime;
|
||||||
int a, first;
|
int a;
|
||||||
|
|
||||||
/* is there a wave */
|
/* is there a wave */
|
||||||
wav= ob->effect.first;
|
wav= ob->effect.first;
|
||||||
@@ -1439,19 +1441,13 @@ void object_wave(Object *ob)
|
|||||||
if(wav->type==EFF_WAVE) break;
|
if(wav->type==EFF_WAVE) break;
|
||||||
wav= wav->next;
|
wav= wav->next;
|
||||||
}
|
}
|
||||||
if(wav==0) return;
|
if(wav==NULL) return 0;
|
||||||
|
|
||||||
if(ob->type==OB_MESH) {
|
if(ob->type==OB_MESH) {
|
||||||
|
|
||||||
ctime= bsystem_time(ob, 0, (float)G.scene->r.cfra, 0.0);
|
ctime= bsystem_time(ob, 0, (float)G.scene->r.cfra, 0.0);
|
||||||
first= 1;
|
|
||||||
|
|
||||||
me= ob->data;
|
me= ob->data;
|
||||||
dl= find_displist_create(&ob->disp, DL_VERTS);
|
|
||||||
|
|
||||||
if(dl->verts) MEM_freeN(dl->verts);
|
|
||||||
dl->nr= me->totvert;
|
|
||||||
dl->verts= MEM_mallocN(3*sizeof(float)*me->totvert, "wave");
|
|
||||||
|
|
||||||
wav= ob->effect.first;
|
wav= ob->effect.first;
|
||||||
while(wav) {
|
while(wav) {
|
||||||
@@ -1462,15 +1458,13 @@ void object_wave(Object *ob)
|
|||||||
if(wav->damp==0) wav->damp= 10.0f;
|
if(wav->damp==0) wav->damp= 10.0f;
|
||||||
|
|
||||||
mvert= me->mvert;
|
mvert= me->mvert;
|
||||||
fp= dl->verts;
|
|
||||||
|
|
||||||
for(a=0; a<me->totvert; a++, mvert++, fp+=3) {
|
for(a=0; a<me->totvert; a++, mvert++) {
|
||||||
if(first) VECCOPY(fp, mvert->co);
|
calc_wave_deform(wav, ctime, mvert->co);
|
||||||
calc_wave_deform(wav, ctime, fp);
|
|
||||||
}
|
}
|
||||||
first= 0;
|
|
||||||
}
|
}
|
||||||
wav= wav->next;
|
wav= wav->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1268,14 +1268,6 @@ static void init_render_mesh(Object *ob)
|
|||||||
|
|
||||||
if(me->key) do_puno= 1;
|
if(me->key) do_puno= 1;
|
||||||
|
|
||||||
if(ob->effect.first) {
|
|
||||||
Effect *eff= ob->effect.first;
|
|
||||||
while(eff) {
|
|
||||||
if(eff->type==EFF_WAVE) do_puno= 1;
|
|
||||||
eff= eff->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(me->orco==0) {
|
if(me->orco==0) {
|
||||||
need_orco= 0;
|
need_orco= 0;
|
||||||
for(a=1; a<=ob->totcol; a++) {
|
for(a=1; a<=ob->totcol; a++) {
|
||||||
|
|||||||
@@ -1337,7 +1337,7 @@ void do_effects_panels(unsigned short event)
|
|||||||
while(eff) {
|
while(eff) {
|
||||||
if(eff->flag & SELECT) {
|
if(eff->flag & SELECT) {
|
||||||
if(eff->type==EFF_PARTICLE) build_particle_system(ob);
|
if(eff->type==EFF_PARTICLE) build_particle_system(ob);
|
||||||
else if(eff->type==EFF_WAVE) object_wave(ob);
|
else if(eff->type==EFF_WAVE) freedisplist(&ob->disp);
|
||||||
}
|
}
|
||||||
eff= eff->next;
|
eff= eff->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3911,6 +3911,7 @@ void draw_object(Base *base)
|
|||||||
if(ob->disp.first==NULL) {
|
if(ob->disp.first==NULL) {
|
||||||
if(ob->parent && ob->partype==PARSKEL) makeDispList(ob);
|
if(ob->parent && ob->partype==PARSKEL) makeDispList(ob);
|
||||||
else if(ob->hooks.first) makeDispList(ob);
|
else if(ob->hooks.first) makeDispList(ob);
|
||||||
|
else if(ob->effect.first) makeDispList(ob);
|
||||||
else if(me->disp.first==NULL && mesh_uses_displist(me)) makeDispList(ob);
|
else if(me->disp.first==NULL && mesh_uses_displist(me)) makeDispList(ob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user