Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Bantle <hairbat@yahoo.com>2007-06-04 23:18:19 +0400
committerGeoffrey Bantle <hairbat@yahoo.com>2007-06-04 23:18:19 +0400
commitba958bea0f4b49f87644fdf02cbc2ebba826a6b8 (patch)
treec77b55535bcedafc71b11e279c9c00f5256f7d31 /source/blender/src/editmesh.c
parentd5ee6fc865f16bd3abe1ad7d2fe6aa0be43576a9 (diff)
-> Custom Properties for Mesh entities
In order to give import/export script authors the ability to add properties to inidividual faces, vertices and edges in the same manner as they are able to do with ID structures three new custom data types have been added to blender for floats, integers and strings. Things to note: -Since property Layers are custom data, they are added to all verts, edges or faces at once. -Only one property layer for each unique property name may exist. In other words, you cannot have a float layer as well as an integer layer both with the same name. -No user interface for this exists at the moment. The following methods and attributes have been added to the Blender.Mesh Python module and it's object types: ->MVert/Edge/FaceSeq: addPropertyLayer(name, type) removePropertyLayer(name) renamePropertyLayer(original name, new name) properties(readonly list.) ->MVert/Edge/Face getProperty(name) setProperty(name, value) ->Mesh module PropertyTypes (readonly dictionary)
Diffstat (limited to 'source/blender/src/editmesh.c')
-rw-r--r--source/blender/src/editmesh.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index 9b0811bf788..fe6708f5959 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -859,6 +859,7 @@ void make_editMesh()
else {
MEdge *medge= me->medge;
+ CustomData_copy(&me->edata, &em->edata, CD_MASK_EDITMESH, CD_CALLOC, 0);
/* make edges */
for(a=0; a<me->totedge; a++, medge++) {
eed= addedgelist(evlist[medge->v1], evlist[medge->v2], NULL);
@@ -873,6 +874,7 @@ void make_editMesh()
if(medge->flag & ME_HIDE) eed->h |= 1;
if(G.scene->selectmode==SCE_SELECT_EDGE)
EM_select_edge(eed, eed->f & SELECT); // force edge selection to vertices, seems to be needed ...
+ CustomData_to_em_block(&me->edata,&em->edata, a, &eed->data);
}
}
@@ -1014,6 +1016,7 @@ void load_editMesh(void)
me->totface= G.totface;
CustomData_copy(&em->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert);
+ CustomData_copy(&em->edata, &me->edata, CD_MASK_MESH, CD_CALLOC, me->totedge);
CustomData_copy(&em->fdata, &me->fdata, CD_MASK_MESH, CD_CALLOC, me->totface);
CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, mvert, me->totvert);
@@ -1071,7 +1074,8 @@ void load_editMesh(void)
if(eed->h & 1) medge->flag |= ME_HIDE;
medge->crease= (char)(255.0*eed->crease);
-
+ CustomData_from_em_block(&em->edata, &me->edata, eed->data, a);
+
eed->tmp.l = a++;
medge++;
@@ -1823,7 +1827,7 @@ typedef struct UndoMesh {
short selectmode;
RetopoPaintData *retopo_paint_data;
char retopo_mode;
- CustomData vdata, fdata;
+ CustomData vdata, edata, fdata;
EM_MultiresUndo *mru;
} UndoMesh;
@@ -1839,6 +1843,7 @@ static void free_undoMesh(void *umv)
if(um->selected) MEM_freeN(um->selected);
if(um->retopo_paint_data) retopo_free_paint_data(um->retopo_paint_data);
CustomData_free(&um->vdata, um->totvert);
+ CustomData_free(&um->edata, um->totedge);
CustomData_free(&um->fdata, um->totface);
if(um->mru) {
--um->mru->users;
@@ -1881,6 +1886,7 @@ static void *editMesh_to_undoMesh(void)
if(um->totsel) esec= um->selected= MEM_callocN(um->totsel*sizeof(EditSelectionC), "allselections");
if(um->totvert) CustomData_copy(&em->vdata, &um->vdata, CD_MASK_EDITMESH, CD_CALLOC, um->totvert);
+ if(um->totedge) CustomData_copy(&em->edata, &um->edata, CD_MASK_EDITMESH, CD_CALLOC, um->totedge);
if(um->totface) CustomData_copy(&em->fdata, &um->fdata, CD_MASK_EDITMESH, CD_CALLOC, um->totface);
/* now copy vertices */
@@ -1909,6 +1915,8 @@ static void *editMesh_to_undoMesh(void)
eedc->crease= (short)(eed->crease*255.0);
eedc->fgoni= eed->fgoni;
eed->tmp.l = a; /*store index*/
+ CustomData_from_em_block(&em->edata, &um->edata, eed->data, a);
+
}
/* copy faces */
@@ -2000,9 +2008,11 @@ static void undoMesh_to_editMesh(void *umv)
#endif
CustomData_free(&em->vdata, 0);
+ CustomData_free(&em->edata, 0);
CustomData_free(&em->fdata, 0);
CustomData_copy(&um->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
+ CustomData_copy(&um->edata, &em->edata, CD_MASK_EDITMESH, CD_CALLOC, 0);
CustomData_copy(&um->fdata, &em->fdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
/* now copy vertices */
@@ -2030,6 +2040,7 @@ static void undoMesh_to_editMesh(void *umv)
eed->sharp= eedc->sharp;
eed->fgoni= eedc->fgoni;
eed->crease= ((float)eedc->crease)/255.0;
+ CustomData_to_em_block(&um->edata, &em->edata, a, &eed->data);
}
/* copy faces */