[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38237] branches/soc-2011-tomato: Merging r38220 through r38236 from trunk into soc-2011-tomato
Sergey Sharybin
g.ulairi at gmail.com
Fri Jul 8 19:40:30 CEST 2011
Revision: 38237
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38237
Author: nazgul
Date: 2011-07-08 17:40:29 +0000 (Fri, 08 Jul 2011)
Log Message:
-----------
Merging r38220 through r38236 from trunk into soc-2011-tomato
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38220
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38236
Modified Paths:
--------------
branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.cpp
branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.h
branches/soc-2011-tomato/intern/iksolver/intern/IK_QTask.cpp
branches/soc-2011-tomato/source/blender/blenkernel/intern/softbody.c
branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c
branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_view.c
branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_object_force.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object_force.c
Property Changed:
----------------
branches/soc-2011-tomato/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/blender:36831-38219
+ /trunk/blender:36831-38236
Modified: branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.cpp
===================================================================
--- branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.cpp 2011-07-08 15:58:00 UTC (rev 38236)
+++ branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.cpp 2011-07-08 17:40:29 UTC (rev 38237)
@@ -59,6 +59,7 @@
m_d_theta.newsize(dof);
m_d_theta_tmp.newsize(dof);
+ m_d_norm_weight.newsize(dof);
m_norm.newsize(dof);
m_norm = 0.0;
@@ -111,11 +112,13 @@
m_beta[id+2] = v.z();
}
-void IK_QJacobian::SetDerivatives(int id, int dof_id, const MT_Vector3& v)
+void IK_QJacobian::SetDerivatives(int id, int dof_id, const MT_Vector3& v, MT_Scalar norm_weight)
{
m_jacobian[id][dof_id] = v.x()*m_weight_sqrt[dof_id];
m_jacobian[id+1][dof_id] = v.y()*m_weight_sqrt[dof_id];
m_jacobian[id+2][dof_id] = v.z()*m_weight_sqrt[dof_id];
+
+ m_d_norm_weight[dof_id] = norm_weight;
}
void IK_QJacobian::Invert()
@@ -429,7 +432,7 @@
MT_Scalar mx = 0.0, dtheta_abs;
for (i = 0; i < m_d_theta.size(); i++) {
- dtheta_abs = MT_abs(m_d_theta[i]);
+ dtheta_abs = MT_abs(m_d_theta[i]*m_d_norm_weight[i]);
if (dtheta_abs > mx)
mx = dtheta_abs;
}
Modified: branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.h
===================================================================
--- branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.h 2011-07-08 15:58:00 UTC (rev 38236)
+++ branches/soc-2011-tomato/intern/iksolver/intern/IK_QJacobian.h 2011-07-08 17:40:29 UTC (rev 38237)
@@ -56,7 +56,7 @@
// Iteratively called
void SetBetas(int id, int size, const MT_Vector3& v);
- void SetDerivatives(int id, int dof_id, const MT_Vector3& v);
+ void SetDerivatives(int id, int dof_id, const MT_Vector3& v, MT_Scalar norm_weight);
void Invert();
@@ -89,6 +89,7 @@
/// the vector of computed angle changes
TVector m_d_theta;
+ TVector m_d_norm_weight;
/// space required for SVD computation
Modified: branches/soc-2011-tomato/intern/iksolver/intern/IK_QTask.cpp
===================================================================
--- branches/soc-2011-tomato/intern/iksolver/intern/IK_QTask.cpp 2011-07-08 15:58:00 UTC (rev 38236)
+++ branches/soc-2011-tomato/intern/iksolver/intern/IK_QTask.cpp 2011-07-08 17:40:29 UTC (rev 38237)
@@ -95,10 +95,10 @@
MT_Vector3 axis = seg->Axis(i)*m_weight;
if (seg->Translational())
- jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis);
+ jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis, 1e2);
else {
MT_Vector3 pa = p.cross(axis);
- jacobian.SetDerivatives(m_id, seg->DoFId()+i, pa);
+ jacobian.SetDerivatives(m_id, seg->DoFId()+i, pa, 1e0);
}
}
}
@@ -147,10 +147,10 @@
for (i = 0; i < seg->NumberOfDoF(); i++) {
if (seg->Translational())
- jacobian.SetDerivatives(m_id, seg->DoFId()+i, MT_Vector3(0, 0, 0));
+ jacobian.SetDerivatives(m_id, seg->DoFId()+i, MT_Vector3(0, 0, 0), 1e2);
else {
MT_Vector3 axis = seg->Axis(i)*m_weight;
- jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis);
+ jacobian.SetDerivatives(m_id, seg->DoFId()+i, axis, 1e0);
}
}
}
@@ -202,10 +202,10 @@
axis *= /*segment->Mass()**/m_total_mass_inv;
if (segment->Translational())
- jacobian.SetDerivatives(m_id, segment->DoFId()+i, axis);
+ jacobian.SetDerivatives(m_id, segment->DoFId()+i, axis, 1e2);
else {
MT_Vector3 pa = axis.cross(p);
- jacobian.SetDerivatives(m_id, segment->DoFId()+i, pa);
+ jacobian.SetDerivatives(m_id, segment->DoFId()+i, pa, 1e0);
}
}
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/softbody.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/softbody.c 2011-07-08 15:58:00 UTC (rev 38236)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/softbody.c 2011-07-08 17:40:29 UTC (rev 38237)
@@ -75,6 +75,7 @@
#include "BKE_curve.h"
#include "BKE_effect.h"
#include "BKE_global.h"
+#include "BKE_modifier.h"
#include "BKE_softbody.h"
#include "BKE_DerivedMesh.h"
#include "BKE_pointcache.h"
@@ -289,21 +290,24 @@
-static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
+static ccd_Mesh *ccd_mesh_make(Object *ob)
{
+ CollisionModifierData *cmd;
ccd_Mesh *pccd_M = NULL;
ccdf_minmax *mima =NULL;
MFace *mface=NULL;
float v[3],hull;
int i;
+ cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+
/* first some paranoia checks */
- if (!dm) return NULL;
- if (!dm->getNumVerts(dm) || !dm->getNumFaces(dm)) return NULL;
+ if (!cmd) return NULL;
+ if (!cmd->numverts || !cmd->numfaces) return NULL;
pccd_M = MEM_mallocN(sizeof(ccd_Mesh),"ccd_Mesh");
- pccd_M->totvert = dm->getNumVerts(dm);
- pccd_M->totface = dm->getNumFaces(dm);
+ pccd_M->totvert = cmd->numverts;
+ pccd_M->totface = cmd->numfaces;
pccd_M->savety = CCD_SAVETY;
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
@@ -314,12 +318,10 @@
hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
/* alloc and copy verts*/
- pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
- /* and determine the ortho BB on the fly */
+ pccd_M->mvert = MEM_dupallocN(cmd->xnew);
+ /* note that xnew coords are already in global space, */
+ /* determine the ortho BB */
for(i=0; i < pccd_M->totvert; i++){
- mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
-
/* evaluate limits */
VECCOPY(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
@@ -332,7 +334,7 @@
}
/* alloc and copy faces*/
- pccd_M->mface = dm->dupFaceArray(dm);
+ pccd_M->mface = MEM_dupallocN(cmd->mfaces);
/* OBBs for idea1 */
pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
@@ -386,19 +388,22 @@
}
return pccd_M;
}
-static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
+static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
{
- ccdf_minmax *mima =NULL;
+ CollisionModifierData *cmd;
+ ccdf_minmax *mima =NULL;
MFace *mface=NULL;
float v[3],hull;
int i;
+ cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+
/* first some paranoia checks */
- if (!dm) return ;
- if (!dm->getNumVerts(dm) || !dm->getNumFaces(dm)) return ;
+ if (!cmd) return ;
+ if (!cmd->numverts || !cmd->numfaces) return ;
- if ((pccd_M->totvert != dm->getNumVerts(dm)) ||
- (pccd_M->totface != dm->getNumFaces(dm))) return;
+ if ((pccd_M->totvert != cmd->numverts) ||
+ (pccd_M->totface != cmd->numfaces)) return;
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
@@ -411,12 +416,10 @@
if(pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
pccd_M->mprevvert = pccd_M->mvert;
/* alloc and copy verts*/
- pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
- /* and determine the ortho BB on the fly */
+ pccd_M->mvert = MEM_dupallocN(cmd->xnew);
+ /* note that xnew coords are already in global space, */
+ /* determine the ortho BB */
for(i=0; i < pccd_M->totvert; i++){
- mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
-
/* evaluate limits */
VECCOPY(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
@@ -555,21 +558,8 @@
/*+++ only with deflecting set */
if(ob->pd && ob->pd->deflect && BLI_ghash_lookup(hash, ob) == NULL) {
- DerivedMesh *dm= NULL;
-
- if(ob->softflag & OB_SB_COLLFINAL) /* so maybe someone wants overkill to collide with subsurfed */
- dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
- else
- dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
-
- if(dm){
- ccd_Mesh *ccdmesh = ccd_mesh_make(ob, dm);
- BLI_ghash_insert(hash, ob, ccdmesh);
-
- /* we did copy & modify all we need so give 'em away again */
- dm->release(dm);
-
- }
+ ccd_Mesh *ccdmesh = ccd_mesh_make(ob);
+ BLI_ghash_insert(hash, ob, ccdmesh);
}/*--- only with deflecting set */
}/* mesh && layer*/
@@ -595,21 +585,9 @@
/*+++ only with deflecting set */
if(ob->pd && ob->pd->deflect) {
- DerivedMesh *dm= NULL;
-
- if(ob->softflag & OB_SB_COLLFINAL) { /* so maybe someone wants overkill to collide with subsurfed */
- dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
- } else {
- dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
- }
- if(dm){
- ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash,ob);
- if (ccdmesh)
- ccd_mesh_update(ob,ccdmesh,dm);
-
- /* we did copy & modify all we need so give 'em away again */
- dm->release(dm);
- }
+ ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash,ob);
+ if (ccdmesh)
+ ccd_mesh_update(ob,ccdmesh);
}/*--- only with deflecting set */
}/* mesh && layer*/
Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2011-07-08 15:58:00 UTC (rev 38236)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2011-07-08 17:40:29 UTC (rev 38237)
@@ -4880,7 +4880,6 @@
else if(sl->spacetype==SPACE_FILE) {
SpaceFile *sfile= (SpaceFile *)sl;
sfile->files= NULL;
- sfile->params= NULL;
sfile->op= NULL;
sfile->layout= NULL;
sfile->folders_prev= NULL;
@@ -5504,7 +5503,7 @@
sfile->files= NULL;
sfile->layout= NULL;
sfile->op= NULL;
- sfile->params= NULL;
+ sfile->params= newdataadr(fd, sfile->params);
}
}
Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c 2011-07-08 15:58:00 UTC (rev 38236)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c 2011-07-08 17:40:29 UTC (rev 38237)
@@ -2104,7 +2104,11 @@
writestruct(wd, DATA, "SpaceButs", 1, sl);
}
else if(sl->spacetype==SPACE_FILE) {
+ SpaceFile *sfile= (SpaceFile *)sl;
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list