svn merge ^/trunk/blender -r46300:46330
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Mon, 7 May 2012 01:04:52 +0000 (01:04 +0000)
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Mon, 7 May 2012 01:04:52 +0000 (01:04 +0000)
69 files changed:
1  2 
intern/cycles/kernel/kernel_camera.h
source/blender/blenkernel/BKE_text.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenlib/intern/uvproject.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/collada/AnimationImporter.cpp
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/collada/MeshImporter.cpp
source/blender/collada/SkinInfo.cpp
source/blender/collada/collada_utils.cpp
source/blender/editors/animation/keyframing.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/editarmature.c
source/blender/editors/curve/editfont.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/render/render_opengl.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_uv.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_info/info_ops.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/intern/gpu_draw.c
source/blender/makesdna/DNA_curve_types.h
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_space.c
source/blender/modifiers/intern/MOD_boolean_util.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_mask.c
source/blender/modifiers/intern/MOD_uvproject.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/intern/wm_operators.c

index e4b10f6151c51ccda00c30326cf6be28a5c28633,220ebec13ce1707220f57e54bb98dc6bf6b3ae43..aed26f5e852d8898fcf3608a205782d56cef1a5d
@@@ -132,17 -132,44 +132,45 @@@ __device void camera_sample_orthographi
  #endif
  }
  
 -/* Panorama Camera */
 +/* Environment Camera */
  
- __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
+ __device float3 panorama_to_direction(KernelGlobals *kg, float u, float v)
+ {
+       switch(kernel_data.cam.panorama_type) {
+               case PANORAMA_EQUIRECTANGULAR:
+                       return equirectangular_to_direction(u, v);
+               case PANORAMA_FISHEYE_EQUIDISTANT:
+                       return fisheye_to_direction(u, v, kernel_data.cam.fisheye_fov);
+               case PANORAMA_FISHEYE_EQUISOLID:
+               default:
+                       return fisheye_equisolid_to_direction(u, v, kernel_data.cam.fisheye_lens, kernel_data.cam.fisheye_fov, kernel_data.cam.sensorwidth, kernel_data.cam.sensorheight);
+       }
+ }
+ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
  {
        Transform rastertocamera = kernel_data.cam.rastertocamera;
        float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
  
        /* create ray form raster position */
        ray->P = make_float3(0.0f, 0.0f, 0.0f);
 +      ray->D = equirectangular_to_direction(Pcamera.x, Pcamera.y);
  
+ #ifdef __CAMERA_CLIPPING__
+       /* clipping */
+       ray->t = kernel_data.cam.cliplength;
+ #else
+       ray->t = FLT_MAX;
+ #endif
+       ray->D = panorama_to_direction(kg, Pcamera.x, Pcamera.y);
+       /* indicates ray should not receive any light, outside of the lens */
+       if(len_squared(ray->D) == 0.0f) {
+               ray->t = 0.0f;
+               return;
+       }
        /* transform ray from camera to world */
        Transform cameratoworld = kernel_data.cam.cameratoworld;
  
        ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f);
  
        Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
-       ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
+       ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
  
        Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
-       ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
- #endif
+       ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
  
 +#ifdef __CAMERA_CLIPPING__
 +      /* clipping */
 +      ray->t = kernel_data.cam.cliplength;
 +#else
 +      ray->t = FLT_MAX;
  #endif
  }
  
Simple merge
index 906757bdd6287201288469f04dc7582aa1d74c48,bfefc1f0cd97fc36f20e1275df1bf8ca5ffdf439..f4879b8d851527be34f9c9aef362e023216dfde8
@@@ -169,11 -169,13 +169,11 @@@ Curve *BKE_curve_add(const char *name, 
        cu->smallcaps_scale= 0.75f;
        cu->twist_mode= CU_TWIST_MINIMUM;       // XXX: this one seems to be the best one in most cases, at least for curve deform...
        cu->type= type;
 -      cu->bevfac1= 0.0f;
 -      cu->bevfac2= 1.0f;
        
-       cu->bb= unit_boundbox();
+       cu->bb= BKE_boundbox_alloc_unit();
        
        if (type==OB_FONT) {
-               cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= get_builtin_font();
+               cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= BKE_vfont_builtin_get();
                cu->vfont->id.us+=4;
                cu->str= MEM_mallocN(12, "str");
                BLI_strncpy(cu->str, "Text", 12);
index d2219484ff4ec0ab57df7e13d4fd79c6840af6e1,849dbd83366b9c156f4c1e23bffd9f8725898a35..964a20659e07d4975dfbc5527c9a1c340a1e1893
@@@ -430,9 -430,9 +430,9 @@@ static MovieClip *movieclip_alloc(cons
  {
        MovieClip *clip;
  
-       clip = alloc_libblock(&G.main->movieclip, ID_MC, name);
+       clip = BKE_libblock_alloc(&G.main->movieclip, ID_MC, name);
  
 -      clip->aspx = clip->aspy = 1.0f;
 +      clip->aspx = clip->aspy= 1.0f;
  
        BKE_tracking_init_settings(&clip->tracking);
  
index 2cfacbcf03493428155ebe639cda26128e1c08d7,14f23032dd91971361974867bbaec805f5133780..c04fdc4f4109c0d092240db6ba56e47227290cb9
@@@ -792,7 -772,10 +772,7 @@@ Object *BKE_object_add_only_object(int 
  {
        Object *ob;
  
-       ob= alloc_libblock(&G.main->object, ID_OB, name);
 -      if(!name)
 -              name = get_obdata_defname(type);
 -
+       ob= BKE_libblock_alloc(&G.main->object, ID_OB, name);
  
        /* default object vars */
        ob->type= type;
index 864260833a6b36703a12dc962c4bbe4bae144c49,37d7cc06fe74f6d7582a61492d8524c3cc4c3a3a..2526bd058576b0bb71752c56b202d5d39b8e07f3
@@@ -886,10 -886,8 +886,10 @@@ void BKE_scene_base_deselect_all(Scene 
        }
  }
  
- void scene_select_base(Scene *sce, Base *selbase)
+ void BKE_scene_base_select(Scene *sce, Base *selbase)
  {
 +      scene_deselect_all(sce);
 +
        selbase->flag |= SELECT;
        selbase->object->flag= selbase->flag;
  
index 89621cdf48dc130e219f3ddfc0c78e17d5681b5a,a630084e79d0eb85fad90ae2e8a17b2cf70bab5f..31229c76869409dc9439b080fb1e28831054923e
@@@ -133,12 -133,12 +133,12 @@@ void BLI_uvproject_from_view(float targ
  
  /* 'rotmat' can be obedit->obmat when uv project is used.
   * 'winx' and 'winy' can be from scene->r.xsch/ysch */
UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy)
ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy)
  {
-       UvCameraInfo uci;
+       ProjCameraInfo uci;
        Camera *camera = ob->data;
  
 -      uci.do_pano = (camera->type == CAM_PANO);
 +      uci.do_pano = (camera->flag & CAM_PANORAMA);
        uci.do_persp = (camera->type == CAM_PERSP);
  
        uci.camangle = focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
index 6a66f1fb8172e8fdc7c40b0e58bd0ca8a56c819c,195057817dddb729d90a5637bfd493d32ee9b39f..3180245eac1bc4497fb911320d9df22cabdae6bf
@@@ -1753,11 -1770,9 +1753,9 @@@ bool AnimationImporter::calc_joint_pare
  Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job)
  {
        if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) {
 -              Object *job = bc_add_object(scene, OB_EMPTY, (char*)get_joint_name(node));
 +              Object *job = add_object(scene, OB_EMPTY);
  
-               rename_id((ID*)&job->id, (char*)get_joint_name(node));
-               job->lay = object_in_scene(job, scene)->lay = 2;
+               job->lay = BKE_scene_base_find(scene, job)->lay = 2;
  
                mul_v3_fl(job->size, 0.5f);
                job->recalc |= OB_RECALC_OB;
index d6cc35deca7637a78c12bf9e123abe50b4f21663,ca1f2d2f1be16a769f88e9a36d04f117c3fd0f02..5560a80f68ecbe9b4b56111705af5190fafaa889
@@@ -957,7 -962,8 +957,7 @@@ bool MeshImporter::write_geometry(cons
        }
        
        const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
-       Mesh *me = add_mesh((char*)str_geom_id.c_str());
+       Mesh *me = BKE_mesh_add((char*)str_geom_id.c_str());
 -      me->id.us--; // is already 1 here, but will be set later in set_mesh
  
        // store the Mesh pointer to link it later with an Object
        this->uid_mesh_map[mesh->getUniqueId()] = me;
Simple merge
index 8d2dfc8dbfa81ade43588add49340087e9040061,09c7ecd6b488c58de5188bb65afc0d5e8ce76e5f..81b418b51f5824b3ca4bac359ffad4c5301d201b
@@@ -3306,46 -3374,10 +3306,46 @@@ static void sculpt_restore_mesh(Sculpt 
        /* Restore the mesh before continuing with anchored stroke */
        if ((brush->flag & BRUSH_ANCHORED) ||
            (brush->sculpt_tool == SCULPT_TOOL_GRAB &&
-            brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
+            BKE_brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
            (brush->flag & BRUSH_RESTORE_MESH))
        {
 -              paint_mesh_restore_co(sd, ss);
 +              StrokeCache *cache = ss->cache;
 +              int i;
 +
 +              PBVHNode **nodes;
 +              int n, totnode;
 +
 +              BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
 +
 +              #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
 +              for (n = 0; n < totnode; n++) {
 +                      SculptUndoNode *unode;
 +                      
 +                      unode = sculpt_undo_get_node(nodes[n]);
 +                      if (unode) {
 +                              PBVHVertexIter vd;
 +
 +                              BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 +                                      copy_v3_v3(vd.co, unode->co[vd.i]);
 +                                      if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
 +                                      else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
 +
 +                                      if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 +                              }
 +                              BLI_pbvh_vertex_iter_end;
 +
 +                              BLI_pbvh_node_mark_update(nodes[n]);
 +                      }
 +              }
 +
 +              if (ss->face_normals) {
 +                      float *fn = ss->face_normals;
 +                      for (i = 0; i < ss->totpoly; ++i, fn += 3)
 +                              copy_v3_v3(fn, cache->face_norms[i]);
 +              }
 +
 +              if (nodes)
 +                      MEM_freeN(nodes);
        }
  }
  
index 4545c498fed7009832ae2fa6654817f70454469b,95441600d77d8e8b8e81bf9f84ed2078e26f12fb..5d2791daf87cd0e5ce7032c10610837e51eaf4f0
@@@ -205,10 -205,10 +205,10 @@@ void HC_relaxation_iteration_uv(BMEditM
                if ((dist = dot_v2v2(diff, diff)) <= radius) {
                        UvElement *element;
                        float strength;
-                       strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
+                       strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
  
 -                      sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter));
 -                      sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter));
 +                      sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter));
 +                      sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter));
  
                        for (element = sculptdata->uv[i].element; element; element = element->next) {
                                MLoopUV *luv;
@@@ -269,10 -269,10 +269,10 @@@ static void laplacian_relaxation_iterat
                if ((dist = dot_v2v2(diff, diff)) <= radius) {
                        UvElement *element;
                        float strength;
-                       strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
+                       strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
  
 -                      sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0];
 -                      sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1];
 +                      sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0];
 +                      sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1];
  
                        for (element = sculptdata->uv[i].element; element; element = element->next) {
                                MLoopUV *luv;
@@@ -344,11 -344,11 +344,11 @@@ static void uv_sculpt_stroke_apply(bCon
                        if ((dist = dot_v2v2(diff, diff)) <= radius) {
                                UvElement *element;
                                float strength;
-                               strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
+                               strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
                                normalize_v2(diff);
  
 -                              sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f;
 -                              sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001f;
 +                              sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001;
 +                              sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001;
  
                                for (element = sculptdata->uv[i].element; element; element = element->next) {
                                        MLoopUV *luv;
Simple merge
index 80a3b70d8e32d83fb364d1035e8be5c11b0fec4e,ef8cf24987c1bb78fe1aee648bae4bf3a500b153..df9a4f2d0171d5e98c62677068a500bf734d508e
@@@ -193,9 -193,9 +193,9 @@@ static DerivedMesh *uvprojectModifier_d
                if (projectors[i].ob->type == OB_CAMERA) {
                        
                        cam = (Camera *)projectors[i].ob->data;
 -                      if (cam->type == CAM_PANO) {
 +                      if (cam->flag & CAM_PANORAMA) {
-                               projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy);
-                               project_camera_info_scale(projectors[i].uci, scax, scay);
+                               projectors[i].uci= BLI_uvproject_camera_info(projectors[i].ob, NULL, aspx, aspy);
+                               BLI_uvproject_camera_info_scale(projectors[i].uci, scax, scay);
                                free_uci= 1;
                        }
                        else {