doxygen: blender/blenkernel tagged.
[blender.git] / source / blender / blenkernel / intern / ipo.c
index a040c27caa04aaab224ea1253765dc9413b53fa1..92098d59e0e3624f7c1ee9b3699da2daf4b072cd 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/blenkernel/intern/ipo.c
+ *  \ingroup bke
+ */
+
+
 /* NOTE:
  *
  * This file is no longer used to provide tools for the depreceated IPO system. Instead, it
 #include "BLI_math.h" /* windows needs for M_PI */
 #include "BLI_blenlib.h"
 #include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
 
-#include "BKE_utildefines.h"
 
+#include "BKE_ipo.h"
 #include "BKE_animsys.h"
 #include "BKE_action.h"
 #include "BKE_fcurve.h"
@@ -314,7 +320,7 @@ static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
 
 /* ShapeKey types 
  * NOTE: as we don't have access to the keyblock where the data comes from (for now), 
- *             we'll just use numerical indicies for now... 
+ *             we'll just use numerical indices for now... 
  */
 static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
 {
@@ -708,6 +714,11 @@ static const char *world_adrcodes_to_paths (int adrcode, int *array_index)
                        *array_index= 1; return "stars.color";
                case WO_STAR_B:
                        *array_index= 2; return "stars.color"; */
+               case WO_STAR_R:
+               case WO_STAR_G:
+               case WO_STAR_B:
+                       printf("WARNING: WO_STAR_R/G/B deprecated\n");
+                       return NULL;
                
                case WO_STARDIST:
                        return "stars.min_distance";
@@ -797,7 +808,7 @@ static const char *particle_adrcodes_to_paths (int adrcode, int *array_index)
  *             - array_index                   - index in property's array (if applicable) to use
  *             - return                                - the allocated path...
  */
-static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence * seq, int *array_index)
+static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence *seq, int *array_index)
 {
        DynStr *path= BLI_dynstr_new();
        const char *propname=NULL;
@@ -913,8 +924,17 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
                sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
        }
        else if (actname && actname[0]) {
-               /* Pose-Channel */
-               sprintf(buf, "pose.bones[\"%s\"]", actname);
+               if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
+                       /* Actionified "Object" IPO's... no extra path stuff needed */
+               }
+               else if ((blocktype == ID_KE) && strcmp(actname, "Shape")==0) {
+                       /* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
+                       strcpy(buf, "data.shape_keys");
+               }
+               else {
+                       /* Pose-Channel */
+                       sprintf(buf, "pose.bones[\"%s\"]", actname);
+               }
        }
        else if (constname && constname[0]) {
                /* Constraint in Object */
@@ -922,8 +942,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
        }
        else if (seq) {
                /* Sequence names in Scene */
-               sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", 
-                       seq->name+2);
+               sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
        }
        else
                strcpy(buf, ""); /* empty string */
@@ -1320,20 +1339,17 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
                                        }
                                }
                                
-                               /* correct values for sequencer curves,
-                                  that were not locked to frame */
-
-                               if (seq && 
-                                   (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
+                               /* correct values for sequencer curves, that were not locked to frame */
+                               if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
                                        double mul= (seq->enddisp-seq->startdisp)/100.0f;
                                        double offset= seq->startdisp;
                                        
                                        dst->vec[0][0] *= mul;
                                        dst->vec[0][0] += offset;
-
+                                       
                                        dst->vec[1][0] *= mul;
                                        dst->vec[1][0] += offset;
-
+                                       
                                        dst->vec[2][0] *= mul;
                                        dst->vec[2][0] += offset;
                                }
@@ -1480,7 +1496,7 @@ static void action_to_animato (ID *id, bAction *act, ListBase *groups, ListBase
  * This assumes that AnimData has been added already. Separation of drivers
  * from animation data is accomplished here too...
  */
-static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], Sequence * seq)
+static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq)
 {
        AnimData *adt= BKE_animdata_from_id(id);
        ListBase anim = {NULL, NULL};
@@ -1511,8 +1527,12 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[],
                if (G.f & G_DEBUG) printf("\thas anim \n");
                /* try to get action */
                if (adt->action == NULL) {
-                       adt->action= add_empty_action("ConvData_Action"); // XXX we need a better name for this
-                       if (G.f & G_DEBUG) printf("\t\tadded new action \n");
+                       char nameBuf[MAX_ID_NAME];
+                       
+                       BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name+2);
+                       
+                       adt->action= add_empty_action(nameBuf);
+                       if (G.f & G_DEBUG) printf("\t\tadded new action - '%s' \n", nameBuf);
                }
                
                /* add F-Curves to action */
@@ -1868,7 +1888,7 @@ void do_versions_ipos_to_animato(Main *main)
                                   to different DNA variables later 
                                   (semi-hack (tm) )
                                */
-                               switch(seq->type) {
+                               switch (seq->type) {
                                        case SEQ_IMAGE:
                                        case SEQ_META:
                                        case SEQ_SCENE: