Commit: 6e7f3aaa8293df2653c21383b2537bf7b6d29147
Author: Nicholas Bishop
Date:   Mon Jan 19 16:01:32 2015 +0100
Branches: cycles-ptex-08
https://developer.blender.org/rB6e7f3aaa8293df2653c21383b2537bf7b6d29147

Temporary change to add-vcol operator to also add Ptex loop layer

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

M       source/blender/editors/mesh/mesh_data.c

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

diff --git a/source/blender/editors/mesh/mesh_data.c 
b/source/blender/editors/mesh/mesh_data.c
index 152d055..34a9669 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -449,6 +449,26 @@ int ED_mesh_color_add(Mesh *me, const char *name, const 
bool active_set)
                        CustomData_add_layer_named(&me->fdata, CD_MCOL, 
CD_DEFAULT, NULL, me->totface, name);
                }
 
+               /* TODO */
+               {
+                       MPtexLoop *data = 
CustomData_add_layer_named(&me->ldata, CD_PTEX_LOOP, CD_DEFAULT, NULL, 
me->totloop, name);
+                       int i, j;
+                       int cur_ptex_id = 0;
+                       for (i = 0; i < me->totpoly; i++) {
+                               const MPoly *p = &me->mpoly[i];
+                               const bool constant = p->totloop == 4;
+                               for (j = 0; j < p->totloop; j++) {
+                                       data[p->loopstart + j].id = cur_ptex_id;
+                                       if (!constant) {
+                                               cur_ptex_id++;
+                                       }
+                               }
+                               if (constant) {
+                                       cur_ptex_id++;
+                               }
+                       }
+               }
+
                if (active_set || layernum == 0) {
                        CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, 
layernum);
                        CustomData_set_layer_active(&me->fdata, CD_MCOL, 
layernum);

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

Reply via email to