Commit: fd309ffbe00cc6e0c127575ac35704d16860e468
Author: Antony Riakiotakis
Date:   Fri Jul 4 21:46:37 2014 +0300
https://developer.blender.org/rBfd309ffbe00cc6e0c127575ac35704d16860e468

More review points taken care of.

===================================================================

M       source/blender/blenkernel/BKE_DerivedMesh.h
M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenkernel/intern/cdderivedmesh.c
M       source/blender/blenkernel/intern/subsurf_ccg.c
M       source/blender/editors/sculpt_paint/paint_curve.c
M       source/blender/editors/sculpt_paint/paint_intern.h
M       source/blender/editors/sculpt_paint/paint_ops.c
M       source/blender/editors/transform/transform_conversions.c
M       source/blender/gpu/intern/gpu_buffers.c
M       source/blender/makesdna/DNA_material_types.h
M       source/blender/makesdna/DNA_scene_types.h

===================================================================

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h 
b/source/blender/blenkernel/BKE_DerivedMesh.h
index 6f4352d..2e7e14d 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -595,6 +595,8 @@ void DM_ensure_tessface(DerivedMesh *dm);
 void DM_update_tessface_data(DerivedMesh *dm);
 
 void DM_update_materials(DerivedMesh *dm, struct Object *ob);
+struct MTFace *DM_active_paint_uvlayer(DerivedMesh *dm, int mat_nr);
+
 /** interpolates vertex data from the vertices indexed by src_indices in the
  * source mesh using the given weights and stores the result in the vertex
  * indexed by dest_index in the dest mesh
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 25cd1a8..3b24acc 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -37,6 +37,7 @@
 
 #include "DNA_cloth_types.h"
 #include "DNA_key_types.h"
+#include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
@@ -509,6 +510,28 @@ void DM_update_materials(DerivedMesh *dm, Object *ob)
        }
 }
 
+MTFace *DM_active_paint_uvlayer(DerivedMesh *dm, int mat_nr)
+{
+       MTFace *tf_base;
+
+       BLI_assert(mat_nr < dm->totmat);
+
+       if (dm->mat[mat_nr] && dm->mat[mat_nr]->texpaintslot &&
+           
dm->mat[mat_nr]->texpaintslot[dm->mat[mat_nr]->paint_active_slot].uvname[0])
+       {
+               tf_base = CustomData_get_layer_named(&dm->faceData, CD_MTFACE,
+                                                    
dm->mat[mat_nr]->texpaintslot[dm->mat[mat_nr]->paint_active_slot].uvname);
+               /* This can fail if we have changed the name in the UV layer 
list and have assigned the old name in the material
+                        * texture slot.*/
+               if (!tf_base)
+                       tf_base = CustomData_get_layer(&dm->faceData, 
CD_MTFACE);
+       }
+       else {
+               tf_base = CustomData_get_layer(&dm->faceData, CD_MTFACE);
+       }
+
+       return tf_base;
+}
 
 void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask)
 {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c 
b/source/blender/blenkernel/intern/cdderivedmesh.c
index b921dd1..3340422 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -737,19 +737,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 
                        if (uvflag & DM_DRAW_USE_TEXPAINT_UV) {
                                if (mf->mat_nr != mat_nr_cache) {
-                                       if (dm->totmat > 1) {
-                                               int mat_i = mf->mat_nr;
-                                               if (dm->mat[mat_i] && 
dm->mat[mat_i]->texpaintslot &&
-                                                   
dm->mat[mat_i]->texpaintslot[dm->mat[mat_i]->paint_active_slot].uvname[0])
-                                               {
-                                                       tf_base = 
CustomData_get_layer_named(&dm->faceData, CD_MTFACE,
-                                                                               
             
dm->mat[mat_i]->texpaintslot[dm->mat[mat_i]->paint_active_slot].uvname);
-                                               }
-                                               else
-                                                       tf_base = 
CustomData_get_layer(&dm->faceData, CD_MTFACE);
-                                       }
-                                       else
-                                               tf_base = 
CustomData_get_layer(&dm->faceData, CD_MTFACE);
+                                       tf_base = DM_active_paint_uvlayer(dm, 
mf->mat_nr);
 
                                        mat_nr_cache = mf->mat_nr;
                                }
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index 9f74809..0247e59 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2349,20 +2349,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
                /* texture painting, handle the correct uv layer here */
                if (flag & DM_DRAW_USE_TEXPAINT_UV) {
                        if (mat_nr != mat_nr_cache) {
-                               if (dm->totmat > 1) {
-                                       if (dm->mat[mat_nr] && 
dm->mat[mat_nr]->texpaintslot &&
-                                           
dm->mat[mat_nr]->texpaintslot[dm->mat[mat_nr]->paint_active_slot].uvname[0])
-                                       {
-                                               tf_base = 
CustomData_get_layer_named(&dm->faceData, CD_MTFACE,
-                                                                               
     dm->mat[mat_nr]->texpaintslot[dm->mat[mat_nr]->paint_active_slot].uvname);
-                                       }
-                                       else {
-                                               tf_base = 
CustomData_get_layer(&dm->faceData, CD_MTFACE);
-                                       }
-                               }
-                               else {
-                                       tf_base = 
CustomData_get_layer(&dm->faceData, CD_MTFACE);
-                               }
+                               tf_base = DM_active_paint_uvlayer(dm, mat_nr);
 
                                mat_nr_cache = mat_nr;
                        }
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c 
b/source/blender/editors/sculpt_paint/paint_curve.c
index b3748d5..99d7463 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -51,14 +51,14 @@
 #include "paint_intern.h"
 
 
-int paintcurve_poll(bContext *C)
+int paint_curve_poll(bContext *C)
 {
        Object *ob = CTX_data_active_object(C);
        Paint *p;
        RegionView3D *rv3d = CTX_wm_region_view3d(C);
        SpaceImage *sima;
 
-       if (rv3d && !(ob && (ob->mode & OB_MODE_ALL_PAINT)))
+       if (rv3d && !(ob && ((ob->mode & OB_MODE_ALL_PAINT) != 0)))
                return false;
 
        sima = CTX_wm_space_image(C);
@@ -185,7 +185,7 @@ void PAINTCURVE_OT_new(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = paintcurve_new_exec;
-       ot->poll = paintcurve_poll;
+       ot->poll = paint_curve_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -275,7 +275,7 @@ void PAINTCURVE_OT_add_point(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = paintcurve_add_point_invoke;
        ot->exec = paintcurve_add_point_exec;
-       ot->poll = paintcurve_poll;
+       ot->poll = paint_curve_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -356,7 +356,7 @@ void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = paintcurve_delete_point_exec;
-       ot->poll = paintcurve_poll;
+       ot->poll = paint_curve_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -478,7 +478,7 @@ void PAINTCURVE_OT_select(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = paintcurve_select_point_invoke;
        ot->exec = paintcurve_select_point_exec;
-       ot->poll = paintcurve_poll;
+       ot->poll = paint_curve_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -530,7 +530,7 @@ void PAINTCURVE_OT_draw(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = paintcurve_draw_exec;
-       ot->poll = paintcurve_poll;
+       ot->poll = paint_curve_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h 
b/source/blender/editors/sculpt_paint/paint_intern.h
index d1d0282..97ed1c8 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -223,8 +223,10 @@ void PAINT_OT_face_select_reveal(struct wmOperatorType 
*ot);
 
 void PAINT_OT_vert_select_all(struct wmOperatorType *ot);
 void PAINT_OT_vert_select_ungrouped(struct wmOperatorType *ot);
+
 int vert_paint_poll(struct bContext *C);
 int mask_paint_poll(struct bContext *C);
+int paint_curve_poll(struct bContext *C);
 
 int facemask_paint_poll(struct bContext *C);
 void flip_v3_v3(float out[3], const float in[3], const char symm);
@@ -267,7 +269,6 @@ void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot);
 void PAINT_OT_mask_lasso_gesture(struct wmOperatorType *ot);
 
 /* paint_curve.c */
-int paintcurve_poll(struct bContext *C);
 void PAINTCURVE_OT_new(struct wmOperatorType *ot);
 void PAINTCURVE_OT_add_point(struct wmOperatorType *ot);
 void PAINTCURVE_OT_delete_point(struct wmOperatorType *ot);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c 
b/source/blender/editors/sculpt_paint/paint_ops.c
index a1f958a..b829f3b 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1258,7 +1258,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        int i;
        
        keymap = WM_keymap_find(keyconf, "Curve", 0, 0);
-       keymap->poll = paintcurve_poll;
+       keymap->poll = paint_curve_poll;
 
        paint_keymap_curve(keymap);
 
diff --git a/source/blender/editors/transform/transform_conversions.c 
b/source/blender/editors/transform/transform_conversions.c
index d9e3b4f..702b290 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -6802,7 +6802,6 @@ static void MaskPointToTransData(Scene *scene, 
MaskSplinePoint *point,
        }
 }
 
-
 static void createTransMaskingData(bContext *C, TransInfo *t)
 {
        Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/gpu/intern/gpu_buffers.c 
b/source/blender/gpu/intern/gpu_buffers.c
index 6a71397..d660b32 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -859,18 +859,7 @@ static void GPU_buffer_copy_uv_texpaint(DerivedMesh *dm, 
float *varray, int *ind
        mtface_base = MEM_mallocN(totmaterial * sizeof(*mtface_base), 
"texslots");
 
        for (i = 0; i < totmaterial; i++) {
-               if (dm->mat[i] && dm->mat[i]->texpaintslot &&
-                   
dm->mat[i]->texpaintslot[dm->mat[i]->paint_active_slot].uvname[0])
-               {
-                       mtface_base[i] = 
CustomData_get_layer_named(&dm->faceData, CD_MTFACE,
-                                                                   
dm->mat[i]->texpaintslot[dm->mat[i]->paint_active_slot].uvname);
-                       /* This can fail if we have changed the name in the UV 
layer list and have assigned the old name in the material
-                        * texture slot.*/
-                       if (!mtface_base[i])
-                               mtface_base[i] = 
CustomData_get_layer(&dm->faceData, CD_MTFACE);
-               }
-               else
-                       mtface_base[i] = CustomData_get_layer(&dm->faceData, 
CD_MTFACE);
+               mtface_base[i] = DM_active_paint_uvlayer(dm, i);
        }
 
        stencil = CustomData_get_stencil_layer(&dm->faceData, CD_MTFACE);
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 0d53a86..4c0903d 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -85,7 +85,7 @@ typedef struct GameSettings {
 
 typedef struct TexPaintSlot {
        struct Image *ima; /* image to be painted on */
-       char uvname[64]; /* customdata index for uv layer */
+       char uvname[64]; /* customdata index for uv layer, MAX_NAME*/
 } TexPaintSlot;
 
 typedef struct Material {
@@ -142,13 +142,6 @@ typedef struct Material {
        /* mapping */
        char mapflag, pad;
 
-       /* texture painting */
-       short paint_active_slot;
-       short paint_clone_slot;
-       int tot_slots;
-       struct TexPaintSlot *texpaintslot; /* cached slot for painting. Make 
sure to r

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to