Finish Material, Sound and World adr conversion sections. Moving on to particle adr...
authorRoland Hess <me@harkyman.com>
Fri, 6 Feb 2009 17:32:57 +0000 (17:32 +0000)
committerRoland Hess <me@harkyman.com>
Fri, 6 Feb 2009 17:32:57 +0000 (17:32 +0000)
source/blender/blenkernel/intern/ipo.c

index 66af7a411d47342630395aaf58ec553cd76f1375..2f19f0b794b5710608cccfa283792393ef005307 100644 (file)
@@ -536,44 +536,53 @@ static char *material_adrcodes_to_paths (int adrcode, int *array_index)
                case MA_REF:
                        return "diffuse_reflection";
                
+               case MA_EMIT:
+                       return "emit";
+
+               case MA_AMB:
+                       return "ambient";
+
+               case MA_SPEC:
+                       return "specularity";
+
+               case MA_HARD:
+                       return "specular_hardness";
+               
+               case MA_SPTR:
+                       return "specular_opacity";
+
+               case MA_IOR:
+                       return "ior";
+
+               case MA_HASIZE:
+                       return "halo.size";
+
+               case MA_TRANSLU:
+                       return "translucency";
+
+               case MA_RAYM:
+                       return "raytrace_mirror.reflect";
+
+               case MA_FRESMIR:
+                       return "raytrace_mirror.fresnel";
+
+               case MA_FRESMIRI:
+                       return "raytrace_mirror.fresnel_fac";
+
+               case MA_FRESTRA:
+                       return "raytrace_transparency.fresnel";
+
+               case MA_FRESTRAI:
+                       return "raytrace_transparency.fresnel_fac";
+
+               case MA_ADD:
+                       return "halo.add";
                
                default: /* for now, we assume that the others were MTex channels */
                        return mtex_adrcodes_to_paths(adrcode, array_index);
        }
        
-       return NULL;
-       
-#if 0
-       case MA_EMIT:
-               poin= &(ma->emit); break;
-       case MA_AMB:
-               poin= &(ma->amb); break;
-       case MA_SPEC:
-               poin= &(ma->spec); break;
-       case MA_HARD:
-               poin= &(ma->har); *type= IPO_SHORT; break;
-       case MA_SPTR:
-               poin= &(ma->spectra); break;
-       case MA_IOR:
-               poin= &(ma->ang); break;
-       case MA_HASIZE:
-               poin= &(ma->hasize); break;
-       case MA_TRANSLU:
-               poin= &(ma->translucency); break;
-       case MA_RAYM:
-               poin= &(ma->ray_mirror); break;
-       case MA_FRESMIR:
-               poin= &(ma->fresnel_mir); break;
-       case MA_FRESMIRI:
-               poin= &(ma->fresnel_mir_i); break;
-       case MA_FRESTRA:
-               poin= &(ma->fresnel_tra); break;
-       case MA_FRESTRAI:
-               poin= &(ma->fresnel_tra_i); break;
-       case MA_ADD:
-               poin= &(ma->add); break;
-#endif
-       
+       return NULL;    
 }
 
 /* Camera Types */
@@ -657,6 +666,83 @@ static char *lamp_adrcodes_to_paths (int adrcode, int *array_index)
        return NULL;
 }
 
+/* Sound Types */
+static char *sound_adrcodes_to_paths (int adrcode, int *array_index)
+{
+       /* set array index like this in-case nothing sets it correctly  */
+       *array_index= 0;
+       
+       /* result depends on adrcode */
+       switch (adrcode) {
+
+               case SND_VOLUME:
+                       return "volume";
+               case SND_PITCH:
+                       return "pitch";
+       /* XXX Joshua -- I had wrapped panning in rna, but someone commented out, calling it "unused" */
+       /*      case SND_PANNING:
+                       return "panning"; */
+               case SND_ATTEN:
+                       return "attenuation";
+       }
+       
+       /* unrecognised adrcode, or not-yet-handled ones! */
+       return NULL;
+}
+
+/* World Types */
+static char *world_adrcodes_to_paths (int adrcode, int *array_index)
+{
+       /* set array index like this in-case nothing sets it correctly  */
+       *array_index= 0;
+       
+       /* result depends on adrcode */
+       switch (adrcode) {
+               case WO_HOR_R:
+                       *array_index= 0; return "horizon_color";
+               case WO_HOR_G:
+                       *array_index= 1; return "horizon_color";
+               case WO_HOR_B:
+                       *array_index= 2; return "horizon_color";
+               case WO_ZEN_R:
+                       *array_index= 0; return "zenith_color";
+               case WO_ZEN_G:
+                       *array_index= 1; return "zenith_color";
+               case WO_ZEN_B:
+                       *array_index= 2; return "zenith_color";
+               
+               case WO_EXPOS:
+                       return "exposure";
+               
+               case WO_MISI:
+                       return "mist.intensity";
+               case WO_MISTDI:
+                       return "mist.depth";
+               case WO_MISTSTA:
+                       return "mist.start";
+               case WO_MISTHI:
+                       return "mist.height";
+               
+       /*      Star Color is unused -- recommend removal */
+       /*      case WO_STAR_R:
+                       *array_index= 0; return "stars.color";
+               case WO_STAR_G:
+                       *array_index= 1; return "stars.color";
+               case WO_STAR_B:
+                       *array_index= 2; return "stars.color"; */
+               
+               case WO_STARDIST:
+                       return "stars.min_distance";
+               case WO_STARSIZE:
+                       return "stars.size";
+
+               default: /* for now, we assume that the others were MTex channels */
+                       return mtex_adrcodes_to_paths(adrcode, array_index);
+               }
+               
+       return NULL;    
+}
+
 /* ------- */
 
 /* Allocate memory for RNA-path for some property given a blocktype, adrcode, and 'root' parts of path
@@ -707,6 +793,12 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
                case ID_LA: /* lamp */
                        propname= lamp_adrcodes_to_paths(adrcode, &dummy_index);
                        break;
+
+               case ID_SO: /* sound */
+                       propname= sound_adrcodes_to_paths(adrcode, &dummy_index);
+
+               case ID_WO: /* world */
+                       propname= world_adrcodes_to_paths(adrcode, &dummy_index);
                        
                /* XXX problematic blocktypes */
                case ID_CU: /* curve */
@@ -1541,90 +1633,6 @@ void *get_ipo_poin (ID *id, IpoCurve *icu, int *type)
 
        /* data is divided into 'blocktypes' based on ID-codes */
        switch (GS(id->name)) {
-               case ID_WO: /* world channels -----------------------------  */
-               {
-                       World *wo= (World *)id;
-                       
-                       switch (icu->adrcode) {
-                       case WO_HOR_R:
-                               poin= &(wo->horr); break;
-                       case WO_HOR_G:
-                               poin= &(wo->horg); break;
-                       case WO_HOR_B:
-                               poin= &(wo->horb); break;
-                       case WO_ZEN_R:
-                               poin= &(wo->zenr); break;
-                       case WO_ZEN_G:
-                               poin= &(wo->zeng); break;
-                       case WO_ZEN_B:
-                               poin= &(wo->zenb); break;
-                       
-                       case WO_EXPOS:
-                               poin= &(wo->exposure); break;
-                       
-                       case WO_MISI:
-                               poin= &(wo->misi); break;
-                       case WO_MISTDI:
-                               poin= &(wo->mistdist); break;
-                       case WO_MISTSTA:
-                               poin= &(wo->miststa); break;
-                       case WO_MISTHI:
-                               poin= &(wo->misthi); break;
-                       
-                       case WO_STAR_R:
-                               poin= &(wo->starr); break;
-                       case WO_STAR_G:
-                               poin= &(wo->starg); break;
-                       case WO_STAR_B:
-                               poin= &(wo->starb); break;
-                       
-                       case WO_STARDIST:
-                               poin= &(wo->stardist); break;
-                       case WO_STARSIZE:
-                               poin= &(wo->starsize); break;
-                       }
-                       
-                       if (poin == NULL) {
-                               if (icu->adrcode & MA_MAP1) mtex= wo->mtex[0];
-                               else if (icu->adrcode & MA_MAP2) mtex= wo->mtex[1];
-                               else if (icu->adrcode & MA_MAP3) mtex= wo->mtex[2];
-                               else if (icu->adrcode & MA_MAP4) mtex= wo->mtex[3];
-                               else if (icu->adrcode & MA_MAP5) mtex= wo->mtex[4];
-                               else if (icu->adrcode & MA_MAP6) mtex= wo->mtex[5];
-                               else if (icu->adrcode & MA_MAP7) mtex= wo->mtex[6];
-                               else if (icu->adrcode & MA_MAP8) mtex= wo->mtex[7];
-                               else if (icu->adrcode & MA_MAP9) mtex= wo->mtex[8];
-                               else if (icu->adrcode & MA_MAP10) mtex= wo->mtex[9];
-                               else if (icu->adrcode & MA_MAP11) mtex= wo->mtex[10];
-                               else if (icu->adrcode & MA_MAP12) mtex= wo->mtex[11];
-                               else if (icu->adrcode & MA_MAP13) mtex= wo->mtex[12];
-                               else if (icu->adrcode & MA_MAP14) mtex= wo->mtex[13];
-                               else if (icu->adrcode & MA_MAP15) mtex= wo->mtex[14];
-                               else if (icu->adrcode & MA_MAP16) mtex= wo->mtex[15];
-                               else if (icu->adrcode & MA_MAP17) mtex= wo->mtex[16];
-                               else if (icu->adrcode & MA_MAP18) mtex= wo->mtex[17];
-                               
-                               if (mtex)
-                                       poin= give_mtex_poin(mtex, (icu->adrcode & (MA_MAP1-1)));
-                       }
-               }
-                       break;
-               case ID_SO: /* sound channels -----------------------------  */
-               {
-                       bSound *snd= (bSound *)id;
-                       
-                       switch (icu->adrcode) {
-                       case SND_VOLUME:
-                               poin= &(snd->volume); break;
-                       case SND_PITCH:
-                               poin= &(snd->pitch); break;
-                       case SND_PANNING:
-                               poin= &(snd->panning); break;
-                       case SND_ATTEN:
-                               poin= &(snd->attenuation); break;
-                       }
-               }
-                       break;
                case ID_PA: /* particle channels -----------------------------  */
                {
                        ParticleSettings *part= (ParticleSettings *)id;