[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60425] trunk/blender/source/blender/ blenkernel/intern/mesh.c: Followup to r60416, we need to get cdlayers from bmesh everywhere! sorry...
Bastien Montagne
montagne29 at wanadoo.fr
Sun Sep 29 17:09:48 CEST 2013
Revision: 60425
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60425
Author: mont29
Date: 2013-09-29 15:09:48 +0000 (Sun, 29 Sep 2013)
Log Message:
-----------
Followup to r60416, we need to get cdlayers from bmesh everywhere! sorry...
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60416
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/mesh.c
Modified: trunk/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh.c 2013-09-29 14:57:47 UTC (rev 60424)
+++ trunk/blender/source/blender/blenkernel/intern/mesh.c 2013-09-29 15:09:48 UTC (rev 60425)
@@ -673,48 +673,61 @@
bool BKE_mesh_uv_cdlayer_rename(Mesh *me, const char *old_name, const char *new_name, bool do_tessface)
{
- CustomData *pdata = &me->pdata, *ldata = &me->ldata, *fdata = &me->fdata;
- const int pidx_start = CustomData_get_layer_index(pdata, CD_MTEXPOLY);
- const int lidx_start = CustomData_get_layer_index(ldata, CD_MLOOPUV);
- const int fidx_start = do_tessface ? CustomData_get_layer_index(fdata, CD_MTFACE) : -1;
- int pidx, lidx, fidx;
+ CustomData *pdata, *ldata, *fdata;
+ if (me->edit_btmesh) {
+ pdata = &me->edit_btmesh->bm->pdata;
+ ldata = &me->edit_btmesh->bm->ldata;
+ /* No tessellated data in BMesh! */
+ fdata = NULL;
+ do_tessface = false;
+ }
+ else {
+ pdata = &me->pdata;
+ ldata = &me->ldata;
+ fdata = &me->fdata;
+ do_tessface = (do_tessface && fdata->totlayer);
+ }
- do_tessface = (do_tessface && fdata->totlayer && !me->edit_btmesh);
- pidx = CustomData_get_named_layer(pdata, CD_MTEXPOLY, old_name);
- lidx = CustomData_get_named_layer(ldata, CD_MLOOPUV, old_name);
- fidx = do_tessface ? CustomData_get_named_layer(fdata, CD_MTFACE, old_name) : -1;
+ {
+ const int pidx_start = CustomData_get_layer_index(pdata, CD_MTEXPOLY);
+ const int lidx_start = CustomData_get_layer_index(ldata, CD_MLOOPUV);
+ const int fidx_start = do_tessface ? CustomData_get_layer_index(fdata, CD_MTFACE) : -1;
+ int pidx = CustomData_get_named_layer(pdata, CD_MTEXPOLY, old_name);
+ int lidx = CustomData_get_named_layer(ldata, CD_MLOOPUV, old_name);
+ int fidx = do_tessface ? CustomData_get_named_layer(fdata, CD_MTFACE, old_name) : -1;
- /* None of those cases should happen, in theory!
- * Note this assume we have the same number of mtexpoly, mloopuv and mtface layers!
- */
- if (pidx == -1) {
- if (lidx == -1) {
- if (fidx == -1) {
- /* No layer found with this name! */
- return false;
+ /* None of those cases should happen, in theory!
+ * Note this assume we have the same number of mtexpoly, mloopuv and mtface layers!
+ */
+ if (pidx == -1) {
+ if (lidx == -1) {
+ if (fidx == -1) {
+ /* No layer found with this name! */
+ return false;
+ }
+ else {
+ lidx = lidx_start + (fidx - fidx_start);
+ }
}
- else {
- lidx = lidx_start + (fidx - fidx_start);
+ pidx = pidx_start + (lidx - lidx_start);
+ }
+ else {
+ if (lidx == -1) {
+ lidx = lidx_start + (pidx - pidx_start);
}
+ if (fidx == -1 && do_tessface) {
+ fidx = fidx_start + (pidx - pidx_start);
+ }
}
- pidx = pidx_start + (lidx - lidx_start);
- }
- else {
- if (lidx == -1) {
+#if 0
+ /* For now, we do not consider mismatch in indices (i.e. same name leading to (relative) different indices). */
+ else if ((pidx - pidx_start) != (lidx - lidx_start)) {
lidx = lidx_start + (pidx - pidx_start);
}
- if (fidx == -1 && do_tessface) {
- fidx = fidx_start + (pidx - pidx_start);
- }
- }
-#if 0
- /* For now, we do not consider mismatch in indices (i.e. same name leading to (relative) different indices). */
- else if ((pidx - pidx_start) != (lidx - lidx_start)) {
- lidx = lidx_start + (pidx - pidx_start);
- }
#endif
- return BKE_mesh_uv_cdlayer_rename_index(me, pidx, lidx, fidx, new_name, do_tessface);
+ return BKE_mesh_uv_cdlayer_rename_index(me, pidx, lidx, fidx, new_name, do_tessface);
+ }
}
void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3])
More information about the Bf-blender-cvs
mailing list