- Action Modifier; paths now support Speed curve.
authorTon Roosendaal <ton@blender.org>
Wed, 8 Nov 2006 10:51:27 +0000 (10:51 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 8 Nov 2006 10:51:27 +0000 (10:51 +0000)
  http://download.blender.org/demo/test/2.43/0001_0150_speed.avi
  By default the Speed maps in the range 0-100 frames, since there's
  not an actual time relationship here.

  IMPORTANT: this didn't work before, and default Curve Paths have a
  speed Ipo, so past saved scenes will work different now!

- Speed curve points are now drawn on the 3D path as well. With select
  info for selected points, if Curve Object is active.

- Duplicating Objects with NLA ActionModifiers now also correctly copies
  object pointers, so a duplicate works as expected.

source/blender/blenkernel/intern/lattice.c
source/blender/src/drawobject.c
source/blender/src/editipo.c
source/blender/src/editobject.c

index d751169d115bc0eed4c281fc03c3ca062ffea9b2..813cd428ab53d2adedf8282e34e8fc8e067cca2a 100644 (file)
@@ -44,6 +44,7 @@
 #include "BLI_arithb.h"
 
 #include "DNA_armature_types.h"
+#include "DNA_ipo_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
@@ -61,6 +62,7 @@
 #include "BKE_deform.h"
 #include "BKE_displist.h"
 #include "BKE_global.h"
+#include "BKE_ipo.h"
 #include "BKE_key.h"
 #include "BKE_lattice.h"
 #include "BKE_library.h"
@@ -563,6 +565,13 @@ static float *calc_curve_deform(Object *par, float *co, short axis, CurveDeform
                        fac= (cd->dloc[index])/(cu->path->totdist) + (co[index]-cd->dmin[index])/(cu->path->totdist);
        }
        
+       /* we want the ipo to work on the default 100 frame range, because there's no  
+          actual time involved in path position */
+       if(cu->ipo) {
+               fac*= 100.0f;
+               if(calc_ipo_spec(cu->ipo, CU_SPEED, &fac)==0)
+                       fac/= 100.0;
+       }
        
        if( where_on_path_deform(par, fac, loc, dir)) { /* returns OK */
                float q[4], mat[3][3];
index 69f15f212dd04c63b9dfa24d502e01df0065db04..fe33dcc317e550d3a19e9fbf722ab762d2f08dc0 100644 (file)
@@ -3144,6 +3144,37 @@ static void drawnurb(Base *base, Nurb *nurb, int dt)
        if(G.vd->zbuf) glEnable(GL_DEPTH_TEST); 
 }
 
+/* draw points on curve speed handles */
+static void curve_draw_speed(Object *ob)
+{
+       Curve *cu= ob->data;
+       IpoCurve *icu;
+       BezTriple *bezt;
+       float loc[4], dir[3];
+       int a;
+       
+       if(cu->ipo==NULL)
+               return;
+       
+       icu= cu->ipo->curve.first; 
+       if(icu==NULL || icu->totvert<2)
+               return;
+       
+       glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
+       bglBegin(GL_POINTS);
+
+       for(a=0, bezt= icu->bezt; a<icu->totvert; a++, bezt++) {
+               if( where_on_path(ob, bezt->vec[1][1], loc, dir)) {
+                       BIF_ThemeColor((bezt->f2 & SELECT) && ob==OBACT?TH_VERTEX_SELECT:TH_VERTEX);
+                       bglVertex3fv(loc);
+               }
+       }
+
+       glPointSize(1.0);
+       bglEnd();
+}
+
+
 static void tekentextcurs(void)
 {
        cpack(0);
@@ -4110,9 +4141,12 @@ void draw_object(Base *base, int flag)
                        }
                        else if(dt==OB_BOUNDBOX) 
                                draw_bounding_volume(ob);
-                       else if(boundbox_clip(ob->obmat, cu->bb)) 
+                       else if(boundbox_clip(ob->obmat, cu->bb)) {
                                empty_object= drawDispList(base, dt);
-
+                               
+                               if(cu->path)
+                                       curve_draw_speed(ob);
+                       }                       
                        break;
                case OB_MBALL:
                        if(ob==G.obedit) 
index 0ea16bb64cb975137919e6f11ae4aa60ae67fa19..1201f316786bfc4026d2fa9b1aa7013a8e45708f 100644 (file)
@@ -1519,6 +1519,9 @@ void mouse_select_ipo(void)
                ob= OBACT;
                if(ob && (ob->ipoflag & OB_DRAWKEY)) allqueue(REDRAWVIEW3D, 0);
        }
+       /* points inside of curve are drawn selected too */
+       if(G.sipo->blocktype==ID_CU)
+               allqueue(REDRAWVIEW3D, 0);
        
        getmouseco_areawin(mval);
        xo= mval[0]; 
index d81ab555e49f4372566c26a189864a6b1107bf41..f2ed963dfb5b80b8d2a660f7230f13fcdc055194 100644 (file)
@@ -4467,6 +4467,7 @@ void adduplicate(int mode, int dupflag)
        ID *id;
        Ipo *ipo;
        bConstraintChannel *chan;
+       bActionStrip *strip;
        int a, didit;
        
        if(G.scene->id.lib) return;
@@ -4679,6 +4680,11 @@ void adduplicate(int mode, int dupflag)
                        ID_NEW(base->object->parent);
                        ID_NEW(base->object->track);
                        
+                       for(strip= base->object->nlastrips.first; strip; strip= strip->next) {
+                               bActionModifier *amod;
+                               for(amod= strip->modifiers.first; amod; amod= amod->next)
+                                       ID_NEW(amod->ob);
+                       }
                }
                base= base->next;
        }