[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47283] branches/soc-2012-sushi/source/ blender: Check if all faces are triangle

Campbell Barton ideasman42 at gmail.com
Fri Jun 1 00:07:17 CEST 2012


note: theres no need to use , BM_VERTS_OF_FACE here, just check f->len

On Thu, May 31, 2012 at 11:56 PM, Michael Fox <mfoxdogg at gmail.com> wrote:
> Ok its no my place to comment, but why not use the underlying tessfaces
> structure, instead of using the top structure, that way the user don't
> have to tesselate their mesh by hand, and granted most scanned models
> are tris, but saying "tri's only" really limits the usability of this tool
>
> On 01/06/12 01:52, Alexander Pinzon wrote:
>> Revision: 47283
>>            http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47283
>> Author:   apinzonf
>> Date:     2012-05-31 15:52:18 +0000 (Thu, 31 May 2012)
>> Log Message:
>> -----------
>>   Check if all faces are triangle
>>
>> Modified Paths:
>> --------------
>>      branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c
>>      branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c
>>
>> Modified: branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c
>> ===================================================================
>> --- branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c     2012-05-31 15:37:44 UTC (rev 47282)
>> +++ branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c     2012-05-31 15:52:18 UTC (rev 47283)
>> @@ -59,6 +59,7 @@
>>       NLContext *context;
>>       float lambda = BMO_slot_float_get(op, "lambda");
>>       float we;
>> +     int i;
>>
>>       init_index(bm);
>>
>> @@ -69,8 +70,13 @@
>>               nlSolverParameteri(NL_NB_ROWS, bm->totvert);
>>               nlSolverParameteri(NL_NB_RIGHT_HAND_SIDES, 3);
>>               nlBegin(NL_SYSTEM);
>> +
>> +             for(i=0; i<bm->totvert; i++){
>> +                     nlLockVariable(i);
>> +             }
>>               BMO_ITER (v,&siter, bm, op, "verts", BM_VERT) {
>>                       m_vertex_id = BM_elem_index_get(v);
>> +                     nlUnlockVariable(m_vertex_id);
>>                       nlSetVariable(0,m_vertex_id, v->co[0]);
>>                       nlSetVariable(1,m_vertex_id, v->co[1]);
>>                       nlSetVariable(2,m_vertex_id, v->co[2]);
>> @@ -148,10 +154,8 @@
>>                       int vc_id = BM_elem_index_get(vf[vc]);
>>                       wa = lambda*cotan_weight(vf[vb]->co, vf[vc]->co, vf[va]->co);
>>                       nlMatrixAdd(vid, vc_id, -wa);
>> -                     //nlMatrixAdd(vid, vid, wa);
>>                       wa = lambda*cotan_weight(vf[vc]->co, vf[va]->co, vf[vb]->co);
>>                       nlMatrixAdd(vid, vb_id, -wa);
>> -                     //nlMatrixAdd(vid, vid, wa);
>>               }
>>       }
>>   }
>>
>> Modified: branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c
>> ===================================================================
>> --- branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c      2012-05-31 15:37:44 UTC (rev 47282)
>> +++ branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c      2012-05-31 15:52:18 UTC (rev 47283)
>> @@ -1604,6 +1604,23 @@
>>       int i, repeat;
>>       float clipdist = 0.0f;
>>       float lambda = 0.1f;
>> +     BMIter fiter;
>> +     BMIter viter;
>> +     BMFace *f;
>> +     BMVert *v;
>> +     int count;
>> +
>> +     /* Check if all faces are triangles     */
>> +     BM_ITER_MESH (f,&fiter, em->bm, BM_FACES_OF_MESH) {
>> +             count = 0;
>> +             BM_ITER_ELEM(v,&viter, f, BM_VERTS_OF_FACE){
>> +                     count = count + 1;
>> +             }
>> +             if(count>3){
>> +                     BKE_report(op->reports, RPT_WARNING, "Selected faces must be triangles");
>> +                     return OPERATOR_CANCELLED;
>> +             }
>> +     }
>>
>>       /* mirror before smooth */
>>       if (((Mesh *)obedit->data)->editflag&  ME_EDIT_MIRROR_X) {
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list