synched with trunk at revision 30243
[blender.git] / source / blender / blenloader / intern / readfile.c
index 3162714..41be946 100644 (file)
@@ -3614,6 +3614,11 @@ static void lib_link_object(FileData *fd, Main *main)
                                        arma->target= newlibadr(fd, ob->id.lib, arma->target);
                                        arma->subtarget= newlibadr(fd, ob->id.lib, arma->subtarget);
                                }
+                               else if(act->type==ACT_STEERING) {
+                                       bSteeringActuator *steeringa = act->data; 
+                                       steeringa->target = newlibadr(fd, ob->id.lib, steeringa->target);
+                                       steeringa->navmesh = newlibadr(fd, ob->id.lib, steeringa->navmesh);
+                               }
                                act= act->next;
                        }
                        
@@ -10953,8 +10958,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                tex->saturation= 1.0f;
                }
 
+               //set defaults for recast data
+               {
+                       Scene *sce;
+                       for(sce = main->scene.first; sce; sce = sce->id.next)
+                       {
+                               if(sce->unit.scale_length == 0.0f)
+                                       sce->unit.scale_length= 1.0f;
+                               if(sce->gm.recastData.cellsize == 0.0f)
+                                       sce->gm.recastData.cellsize = 0.3f;
+                               if(sce->gm.recastData.cellheight == 0.0f)
+                                       sce->gm.recastData.cellheight = 0.2f;
+                               if(sce->gm.recastData.agentmaxslope == 0.0f)
+                                       sce->gm.recastData.agentmaxslope = M_PI/4;
+                               if(sce->gm.recastData.agentmaxclimb == 0.0f)
+                                       sce->gm.recastData.agentmaxclimb = 0.9f;
+                               if(sce->gm.recastData.agentheight == 0.0f)
+                                       sce->gm.recastData.agentheight = 2.0f;
+                               if(sce->gm.recastData.agentradius == 0.0f)
+                                       sce->gm.recastData.agentradius = 0.6f;
+                               if(sce->gm.recastData.edgemaxlen == 0.0f)
+                                       sce->gm.recastData.edgemaxlen = 12.0f;
+                               if(sce->gm.recastData.edgemaxerror == 0.0f)
+                                       sce->gm.recastData.edgemaxerror = 1.3f;
+                               if(sce->gm.recastData.regionminsize == 0.0f)
+                                       sce->gm.recastData.regionminsize = 50.f;
+                               if(sce->gm.recastData.regionmergesize == 0.0f)
+                                       sce->gm.recastData.regionmergesize = 20.f;
+                               if(sce->gm.recastData.vertsperpoly<3)
+                                       sce->gm.recastData.vertsperpoly = 6;
+                               if(sce->gm.recastData.detailsampledist == 0.0f)
+                                       sce->gm.recastData.detailsampledist = 6.0f;
+                               if(sce->gm.recastData.detailsamplemaxerror == 0.0f)
+                                       sce->gm.recastData.detailsamplemaxerror = 1.0f;
+                       }                       
+               }
        }
-
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
 
@@ -11837,6 +11876,11 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
                        bArmatureActuator *arma= act->data;
                        expand_doit(fd, mainvar, arma->target);
                }
+               else if(act->type==ACT_STEERING) {
+                       bSteeringActuator *sta= act->data;
+                       expand_doit(fd, mainvar, sta->target);
+                       expand_doit(fd, mainvar, sta->navmesh);
+               }
                act= act->next;
        }