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:
Diffstat (limited to 'source/blender/src/editipo.c')
-rw-r--r--source/blender/src/editipo.c106
1 files changed, 59 insertions, 47 deletions
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 09862636085..9a7f8e652a7 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -60,6 +60,7 @@
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_object_fluidsim.h"
#include "DNA_particle_types.h"
@@ -84,6 +85,7 @@
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_material.h"
+#include "BKE_modifier.h"
#include "BKE_particle.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
@@ -474,19 +476,41 @@ static void make_part_editipo(SpaceIpo *si)
}
// copied from make_seq_editipo
-static void make_fluidsim_editipo(SpaceIpo *si) // NT
+static void make_fluidsim_editipo(SpaceIpo *si, Object *ob) // NT
{
EditIpo *ei;
int a;
char *name;
- ei= si->editipo= MEM_callocN(FLUIDSIM_TOTIPO*sizeof(EditIpo), "fluidsim_editipo");
- si->totipo = FLUIDSIM_TOTIPO;
- for(a=0; a<FLUIDSIM_TOTIPO; a++) {
+ int numipos = FLUIDSIM_TOTIPO;
+ int ipo_start_index = 0;
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+ FluidsimSettings *fss= fluidmd->fss;
+
+ // we don't need all fluid ipos for all types! - dg
+ if(fss->type == OB_FLUIDSIM_CONTROL)
+ {
+ numipos = 4; // there are 4 fluid control ipos
+ ipo_start_index = 9;
+
+ }
+ else if(fss->type == OB_FLUIDSIM_DOMAIN)
+ {
+ numipos = 5; // there are 5 ipos for fluid domains
+ }
+ else
+ {
+ numipos = 4; // there are 4 for the rest
+ ipo_start_index = 5;
+ }
+
+ ei= si->editipo= MEM_callocN(numipos*sizeof(EditIpo), "fluidsim_editipo");
+ si->totipo = numipos;
+ for(a=ipo_start_index; a<ipo_start_index+numipos; a++) {
//fprintf(stderr,"FSINAME %d %d \n",a,fluidsim_ar[a], (int)(getname_fluidsim_ei(fluidsim_ar[a])) );
name = getname_fluidsim_ei(fluidsim_ar[a]);
strcpy(ei->name, name);
ei->adrcode= fluidsim_ar[a];
- ei->col= ipo_rainbow(a, FLUIDSIM_TOTIPO);
+ ei->col= ipo_rainbow(a, numipos);
ei->icu= find_ipocurve(si->ipo, ei->adrcode);
if(ei->icu) {
ei->flag = ei->icu->flag;
@@ -950,7 +974,7 @@ static void make_editipo(void)
else if(G.sipo->blocktype==ID_FLUIDSIM) {
if (ob) { // NT
ob->ipowin= ID_FLUIDSIM;
- make_fluidsim_editipo(G.sipo);
+ make_fluidsim_editipo(G.sipo, ob);
}
}
else if(G.sipo->blocktype==ID_PA) {
@@ -1170,10 +1194,14 @@ static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname
// }
}
else if(blocktype==ID_FLUIDSIM) {
- if(ob && ( ob->fluidsimFlag & OB_FLUIDSIM_ENABLE)) {
- FluidsimSettings *fss= ob->fluidsimSettings;
- *from= (ID *)ob;
- if(fss) *ipo= fss->ipo;
+ if(ob)
+ {
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+ if(fluidmd) {
+ FluidsimSettings *fss= fluidmd->fss;
+ *from= (ID *)ob;
+ if(fss) *ipo= fss->ipo;
+ }
}
}
else if(blocktype==ID_PA) {
@@ -1318,14 +1346,10 @@ void update_editipo_flags(void)
for(a=0; a<G.sipo->totipo; a++) {
if(ik->data[a]) {
if(ik->flag & 1) {
- ik->data[a]->f1 |= SELECT;
- ik->data[a]->f2 |= SELECT;
- ik->data[a]->f3 |= SELECT;
+ BEZ_SEL(ik->data[a]);
}
else {
- ik->data[a]->f1 &= ~SELECT;
- ik->data[a]->f2 &= ~SELECT;
- ik->data[a]->f3 &= ~SELECT;
+ BEZ_DESEL(ik->data[a]);
}
}
}
@@ -1423,7 +1447,7 @@ static short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt)
if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) {
/* middle points get an advantage */
temp= -3+abs(mval[0]- sco[0][0])+ abs(mval[1]- sco[0][1]);
- if( bezt1->f1 & 1) temp+=5;
+ if( bezt1->f1 & SELECT) temp+=5;
if(temp<dist) {
hpoint= 0;
*bezt= bezt1;
@@ -1514,18 +1538,18 @@ void mouse_select_ipo(void)
if(bezt) {
if(hand==1) {
if(BEZSELECTED(bezt)) {
- bezt->f1= bezt->f2= bezt->f3= 0;
+ BEZ_DESEL(bezt);
}
else {
- bezt->f1= bezt->f2= bezt->f3= SELECT;
+ BEZ_SEL(bezt);
}
}
else if(hand==0) {
- if(bezt->f1 & SELECT) bezt->f1= 0;
+ if(bezt->f1 & SELECT) bezt->f1 &= ~SELECT;
else bezt->f1= SELECT;
}
else {
- if(bezt->f3 & SELECT) bezt->f3= 0;
+ if(bezt->f3 & SELECT) bezt->f3 &= ~SELECT;
else bezt->f3= SELECT;
}
}
@@ -1535,7 +1559,7 @@ void mouse_select_ipo(void)
if(bezt) {
if(hand==1) {
- bezt->f1|= SELECT; bezt->f2|= SELECT; bezt->f3|= SELECT;
+ BEZ_SEL(bezt);
}
else if(hand==0) bezt->f1 |= SELECT;
else bezt->f3 |= SELECT;
@@ -1885,9 +1909,10 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char
}
else if (blocktype== ID_FLUIDSIM) {
Object *ob= (Object *)from;
-
- if (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
- FluidsimSettings *fss= ob->fluidsimSettings;
+
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+ if(fluidmd) {
+ FluidsimSettings *fss= fluidmd->fss;
if ((fss->ipo==NULL) && (add))
fss->ipo= add_ipo("FluidsimIpo", ID_FLUIDSIM);
@@ -2261,7 +2286,7 @@ void add_duplicate_editipo(void)
while(b--) {
*beztn= *bezt;
if(bezt->f2 & SELECT) {
- beztn->f1= beztn->f2= beztn->f3= 0;
+ BEZ_DESEL(beztn);
beztn++;
*beztn= *bezt;
}
@@ -3474,14 +3499,10 @@ void make_ipokey(void)
if(ik->data[a]) {
bezt= ik->data[a];
if(sel) {
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
+ BEZ_SEL(bezt);
}
else {
- bezt->f1 &= ~SELECT;
- bezt->f2 &= ~SELECT;
- bezt->f3 &= ~SELECT;
+ BEZ_DESEL(bezt);
}
}
}
@@ -3589,15 +3610,11 @@ void make_ipokey_transform(Object *ob, ListBase *lb, int sel)
icu= icu->next;
}
-
- ik= lb->first;
- while(ik) {
- /* map ipo-keys for drawing/editing if scaled ipo */
- if (NLA_IPO_SCALED) {
+ if (NLA_IPO_SCALED) {
+ for (ik= lb->first; ik; ik= ik->next) {
+ /* map ipo-keys for drawing/editing if scaled ipo */
ik->val= get_action_frame_inv(OBACT, ik->val);
}
-
- ik= ik->next;
}
}
@@ -4649,7 +4666,7 @@ void duplicate_ipo_keys(Ipo *ipo)
for (icu=ipo->curve.first; icu; icu=icu->next){
for (i=0; i<icu->totvert; i++){
/* If a key is selected */
- if (icu->bezt[i].f2 & 1){
+ if (icu->bezt[i].f2 & SELECT){
/* Expand the list */
newbezt = MEM_callocN(sizeof(BezTriple) * (icu->totvert+1), "beztriple");
memcpy (newbezt, icu->bezt, sizeof(BezTriple) * (i+1));
@@ -4659,15 +4676,10 @@ void duplicate_ipo_keys(Ipo *ipo)
MEM_freeN (icu->bezt);
icu->bezt=newbezt;
/* Unselect the current key*/
- icu->bezt[i].f1 &= ~ 1;
- icu->bezt[i].f2 &= ~ 1;
- icu->bezt[i].f3 &= ~ 1;
+ BEZ_DESEL(&icu->bezt[i]);
i++;
/* Select the copied key */
- icu->bezt[i].f1 |= 1;
- icu->bezt[i].f2 |= 1;
- icu->bezt[i].f3 |= 1;
-
+ BEZ_SEL(&icu->bezt[i]);
}
}
}