Revision: 39115
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39115
Author:   jwilkins
Date:     2011-08-07 02:32:12 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
Revision: 30822
Author: nicholasbishop
Date: 9:06:42 PM, Tuesday, July 27, 2010
Message:
== VPaint ==

* Removed some code cruft and out of date comments

----
Modified : 
/branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c

--
jwilkins:

This update original deleted the VPaintData structure, but I am keeping it 
because I had added a couple of fields to it for BrushLib.  It may still go 
away in the future as I settle more closely on the final implementation of the 
BrushLib integration.

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c  
2011-08-07 02:08:02 UTC (rev 39114)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c  
2011-08-07 02:32:12 UTC (rev 39115)
@@ -1522,31 +1522,9 @@
 
 /* ********************** vertex paint operator ******************* */
 
-/* Implementation notes:
-
-Operator->invoke()
-  - validate context (add mcol)
-  - create customdata storage
-  - call paint once (mouse click)
-  - add modal handler 
-
-Operator->modal()
-  - for every mousemove, apply vertex paint
-  - exit on mouse release, free customdata
-       (return OPERATOR_FINISHED also removes handler and operator)
-
-For future:
-  - implement a stroke event (or mousemove with past positons)
-  - revise whether op->customdata should be added in object, in set_vpaint
-
-*/
-
 typedef struct VPaintData {
        float color[4];
        float fac;
-       int *indexar;
-       float *vertexcosnos;
-       float vpimat[3][3];
 } VPaintData;
 
 void paint_raycast_cb(PBVHNode *node, PaintRaycastData *data, float *tmin)
@@ -1709,32 +1687,36 @@
                }
        }
 
-static void vpaint_nodes_faces(struct VPaint *vp, struct PaintStroke *stroke,
-                              MFace *mface, MVert *mvert,
-                              CustomData *vdata, CustomData *fdata,
-                              int *face_indices, int totface, float center[3],
-                              float radius)
+static void vpaint_nodes_faces(
+       struct VPaint *vp,
+       struct PaintStroke *stroke,
+       struct MFace *mface,
+       struct MVert *mvert,
+       struct CustomData *vdata,
+       struct CustomData *fdata,
+       int *face_indices,
+       int totface,
+       float center[3],
+       float radius)
 {
        float radius_squared = radius*radius;
        MCol *mcol;
        int pmask_totlayer, pmask_first_layer;
        int i, j;
 
-               mcol = CustomData_get_layer(fdata, CD_MCOL);
+       mcol = CustomData_get_layer(fdata, CD_MCOL);
        pmask_totlayer = CustomData_number_of_layers(vdata, CD_PAINTMASK);
        pmask_first_layer = CustomData_get_layer_index(vdata, CD_PAINTMASK);
 
-               for(i = 0; i < totface; ++i) {
-                       int face_index = face_indices[i];
-                       MFace *f = mface + face_index;
-                       int S = f->v4 ? 4 : 3;
+       for(i = 0; i < totface; ++i) {
+               int face_index = face_indices[i];
+               MFace *f = mface + face_index;
+               int S = f->v4 ? 4 : 3;
 
-                       for(j = 0; j < S; ++j) {
-                               int vndx = (&f->v1)[j];
-                               int cndx = face_index*4 + j;
-                               float *co = mvert[vndx].co;
-                       //unsigned int *col = (unsigned int*)(mcol + cndx);
-                       //unsigned int *orig_col = (unsigned int*)(orig + cndx);
+               for(j = 0; j < S; ++j) {
+                       int vndx = (&f->v1)[j];
+                       int cndx = face_index*4 + j;
+                       float *co = mvert[vndx].co;
                        float fcol[4];
                        float mask;
 
@@ -1743,12 +1725,22 @@
                        fcol[2] = mcol[cndx].r / 255.0f;
                        fcol[3] = mcol[cndx].a / 255.0f;
 
-                       mask = paint_mask_from_vertex(vdata, vndx,
-                                                     pmask_totlayer,
-                                                     pmask_first_layer);
+                       mask=
+                               paint_mask_from_vertex(
+                                       vdata,
+                                       vndx,
+                                       pmask_totlayer,
+                                       pmask_first_layer);
 
-                       vpaint_paint_coord(vp, stroke, co, fcol, center,
-                                          radius, radius_squared, mask);
+                       vpaint_paint_coord(
+                               vp,
+                               stroke,
+                               co,
+                               fcol,
+                               center,
+                               radius,
+                               radius_squared,
+                               mask);
 
                        mcol[cndx].b = fcol[0] * 255.0f;
                        mcol[cndx].g = fcol[1] * 255.0f;
@@ -2076,12 +2068,6 @@
 
 static void free_mode_data(struct VPaintData *vpd)
 {
-       if (vpd->vertexcosnos)
-               MEM_freeN(vpd->vertexcosnos);
-
-       if (vpd->indexar)
-               MEM_freeN(vpd->indexar);
-
        MEM_freeN(vpd);
 }
 
@@ -2151,12 +2137,10 @@
        VPaint *vp= ts->vpaint;
        struct VPaintData *vpd;
        struct Object *ob= CTX_data_active_object(C);
-       const ViewContext *vc = paint_stroke_view_context(stroke);
        Scene *scene = CTX_data_scene(C);
        Brush *brush= paint_brush(&(CTX_data_tool_settings(C)->vpaint->paint));
        DerivedMesh *dm;
        Mesh *me;
-       float mat[4][4], imat[4][4];
 
        paint_cache_init(
                CTX_wm_manager(C),
@@ -2180,22 +2164,25 @@
        vpd= MEM_callocN(sizeof(struct VPaintData), "VPaintData");
        paint_stroke_set_mode_data(stroke, vpd);
 
-       vpd->vertexcosnos= mesh_get_mapped_verts_nors(vc->scene, ob);
-
        /* for filtering */
        copy_vpaint_prev(vp, (unsigned int *)me->mcol, me->totface);
 
-       /* some old cruft to sort out later */
-       mul_m4_m4m4(mat, ob->obmat, vc->rv3d->viewmat);
-       invert_m4_m4(imat, mat);
-       copy_m3_m4(vpd->vpimat, imat);
+       dm=
+               mesh_get_derived_final(
+                       scene,
+                       ob,
+                       CD_MASK_BAREMESH|CD_MASK_MCOL);
 
-       dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH|CD_MASK_MCOL);
-               ob->paint->pbvh = dm->getPBVH(ob, dm);
+       ob->paint->pbvh = dm->getPBVH(ob, dm);
 
        paint_tex_init(C);
 
-       paint_bspace_init(C, stroke, vpaint_stroke_get_location, 
paint_stroke_mouse(stroke), brush_size(brush));
+       paint_bspace_init(
+               C,
+               stroke,
+               vpaint_stroke_get_location,
+               paint_stroke_mouse(stroke),
+               brush_size(brush));
 }
 
 static void vpaint_stroke_apply(

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to