Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2007-11-27 01:09:57 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2007-11-27 01:09:57 +0300
commit7da56f4a9ba0bdd0cdcd40b8ca6e69d776d26abe (patch)
tree663c13aae5606937571ac1e7a4c77ca2866e75dd /source/blender/src/editipo.c
parent121dab1bcd9467bd8e11d0a82e83a1621758fd8e (diff)
parent770291b9ea1ec03d98b6bae4fd2a2d3f0091be41 (diff)
Particles
========= Merge of the famous particle patch by Janne Karhu, a full rewrite of the Blender particle system. This includes: - Emitter, Hair and Reactor particle types. - Newtonian, Keyed and Boids physics. - Various particle visualisation and rendering types. - Vertex group and texture control for various properties. - Interpolated child particles from parents. - Hair editing with combing, growing, cutting, .. . - Explode modifier. - Harmonic, Magnetic fields, and multiple falloff types. .. and lots of other things, some more info is here: http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc The new particle system cannot be backwards compatible. Old particle systems are being converted to the new system, but will require tweaking to get them looking the same as before. Point Cache =========== The new system to replace manual baking, based on automatic caching on disk. This is currently used by softbodies and the particle system. See the Cache API section on: http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint Documentation ============= These new features still need good docs for the release logs, help for this is appreciated.
Diffstat (limited to 'source/blender/src/editipo.c')
-rw-r--r--source/blender/src/editipo.c89
1 files changed, 88 insertions, 1 deletions
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 6a1f6d4d154..5873bb94732 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -62,6 +62,7 @@
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_object_fluidsim.h"
+#include "DNA_particle_types.h"
#include "DNA_screen_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
@@ -82,6 +83,7 @@
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_material.h"
+#include "BKE_particle.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
@@ -131,6 +133,7 @@ extern int ac_ar[];
extern int co_ar[];
extern int te_ar[];
extern int fluidsim_ar[]; // NT
+extern int part_ar[];
/* forwards */
#define IPOTHRESH 0.9
@@ -344,6 +347,22 @@ void editipo_changed(SpaceIpo *si, int doredraw)
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
+ else if(si->blocktype==ID_PA){
+ Object *ob=OBACT;
+ ParticleSystem *psys = ob->particlesystem.first;
+
+ /* find out if we need to initialize particles */
+ for(; psys; psys=psys->next) {
+ if(psys->part->ipo==si->ipo) {
+ ei= si->editipo;
+ for(a=0; a<si->totipo; a++, ei++)
+ if(ei->icu && ELEM3(ei->icu->adrcode,PART_EMIT_FREQ,PART_EMIT_LIFE,PART_EMIT_SIZE))
+ psys_flush_settings(psys->part,PSYS_INIT,1);
+ }
+ }
+ DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
+ allqueue(REDRAWVIEW3D, 0);
+ }
}
if(si->showkey) make_ipokey();
@@ -436,6 +455,49 @@ static void make_ob_editipo(Object *ob, SpaceIpo *si)
//fprintf(stderr,"FSIMAKE_OPBJ call %d \n", si->totipo);
}
+static void make_part_editipo(SpaceIpo *si)
+{
+ EditIpo *ei;
+ int a;
+ char *name;
+
+ if(si->from==0) return;
+
+ ei= si->editipo= MEM_callocN(PART_TOTIPO*sizeof(EditIpo), "editipo");
+
+ si->totipo= PART_TOTIPO;
+
+ for(a=0; a<PART_TOTIPO; a++) {
+ name = getname_part_ei(part_ar[a]);
+ strcpy(ei->name, name);
+ ei->adrcode= part_ar[a];
+
+ //if(ei->adrcode & MA_MAP1) {
+ // ei->adrcode-= MA_MAP1;
+ // ei->adrcode |= texchannel_to_adrcode(si->channel);
+ //}
+ //else {
+ // if(ei->adrcode==MA_MODE) ei->disptype= IPO_DISPBITS;
+ //}
+
+ ei->col= ipo_rainbow(a, PART_TOTIPO);
+
+ //len= strlen(ei->name);
+ //if(len) {
+ // if( ei->name[ len-1 ]=='R') ei->col= 0x5050FF;
+ // else if( ei->name[ len-1 ]=='G') ei->col= 0x50FF50;
+ // else if( ei->name[ len-1 ]=='B') ei->col= 0xFF7050;
+ //}
+
+ ei->icu= find_ipocurve(si->ipo, ei->adrcode);
+ if(ei->icu) {
+ ei->flag= ei->icu->flag;
+ }
+
+ ei++;
+ }
+}
+
// copied from make_seq_editipo
static void make_fluidsim_editipo(SpaceIpo *si) // NT
{
@@ -913,6 +975,12 @@ static void make_editipo(void)
make_fluidsim_editipo(G.sipo);
}
}
+ else if(G.sipo->blocktype==ID_PA) {
+ if (ob) {
+ ob->ipowin= ID_PA;
+ make_part_editipo(G.sipo);
+ }
+ }
if(G.sipo->editipo==0) return;
@@ -1097,6 +1165,13 @@ static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname
if(fss) *ipo= fss->ipo;
}
}
+ else if(blocktype==ID_PA) {
+ ParticleSystem *psys = psys_get_current(ob);
+ if(psys){
+ *from= (ID *)ob;
+ *ipo= psys->part->ipo;
+ }
+ }
}
/* called on each redraw, check if editipo data has to be remade */
@@ -1760,6 +1835,16 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname)
return fss->ipo;
}
}
+ else if(blocktype== ID_PA){
+ Object *ob= (Object *)from;
+ ParticleSystem *psys= psys_get_current(ob);
+ if(psys){
+ if(psys->part->ipo==0)
+ psys->part->ipo= add_ipo("ParticleIpo", ID_PA);
+ return psys->part->ipo;
+ }
+ return NULL;
+ }
}
break;
case ID_MA:
@@ -2942,7 +3027,9 @@ void common_insertkey(void)
if(event==4) {
insertkey(id, ID_OB, NULL, NULL, OB_PD_FFALL, 0);
}
-
+ if(event==5) {
+ insertkey(id, ID_OB, NULL, NULL, OB_PD_FMAXD, 0);
+ }
}
}
}