diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-14 22:26:11 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-14 22:26:11 +0300 |
commit | 029bbb3489c247252491a6ab9ba5a231513f86df (patch) | |
tree | 6061980d4115501ac9977a9a69f49f949eec2788 /source/blender/editors/mesh/editmesh.c | |
parent | 0d05b2c76750661124bfe80f9171a68ea10e9dfb (diff) |
2.5
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.
Test: ctrl+0 adds plane, or ctrl+9 adds grid.
Notes for Shul:
- i've added a transform function, which gets correctly passed
on to the add_prim function, should work for all object
transforms. Only the code inside add_prim might be needed
to check (it uses 4x4 mat now, not a 3x3)
- The old code with buttons has been ifdeffed out, check for
user input and make it rna properties, which get read
in the exec(), and handed over to the add_prim. Set them
default now to the values from old buttons.
- Operator naming is preferred lower case, I gave this
a new name.
- check a bit on formatting code, but don't use the old code
as example! Look also at ED_keymap_mesh() for example.
Diffstat (limited to 'source/blender/editors/mesh/editmesh.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 412929b64fb..c791d4e604f 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1022,7 +1022,7 @@ void load_editMesh(Scene *scene, Object *ob) ClothModifierData *clmd; PTCacheID pid; float *fp, *newkey, *oldkey, nor[3], cacheco[3], cachemat[4][4]; - int i, a, ototvert, totedge=0, cacheedit= 0; + int i, a, ototvert, cacheedit= 0; /* this one also tests of edges are not in faces: */ /* eed->f2==0: not in face, f2==1: draw it */ @@ -1031,19 +1031,17 @@ void load_editMesh(Scene *scene, Object *ob) /* eve->f2 : being used in vertexnormals */ edge_drawflags(em); - eed= em->edges.first; - while(eed) { - totedge++; - eed= eed->next; - } + G.totvert= BLI_countlist(&em->verts); + G.totedge= BLI_countlist(&em->edges); + G.totface= BLI_countlist(&em->faces); /* new Vertex block */ if(G.totvert==0) mvert= NULL; else mvert= MEM_callocN(G.totvert*sizeof(MVert), "loadeditMesh vert"); /* new Edge block */ - if(totedge==0) medge= NULL; - else medge= MEM_callocN(totedge*sizeof(MEdge), "loadeditMesh edge"); + if(G.totedge==0) medge= NULL; + else medge= MEM_callocN(G.totedge*sizeof(MEdge), "loadeditMesh edge"); /* new Face block */ if(G.totface==0) mface= NULL; @@ -1064,7 +1062,7 @@ void load_editMesh(Scene *scene, Object *ob) /* add new custom data */ me->totvert= G.totvert; - me->totedge= totedge; + me->totedge= G.totedge; me->totface= G.totface; CustomData_copy(&em->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert); @@ -2096,21 +2094,24 @@ void EM_init_index_arrays(EditMesh *em, int forVert, int forEdge, int forFace) int i; if (forVert) { - g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*G.totvert, "em_v_arr"); + int tot= BLI_countlist(&em->verts); + g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*tot, "em_v_arr"); for (i=0,eve=em->verts.first; eve; i++,eve=eve->next) g_em_vert_array[i] = eve; } if (forEdge) { - g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*G.totedge, "em_e_arr"); + int tot= BLI_countlist(&em->edges); + g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*tot, "em_e_arr"); for (i=0,eed=em->edges.first; eed; i++,eed=eed->next) g_em_edge_array[i] = eed; } if (forFace) { - g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*G.totface, "em_f_arr"); + int tot= BLI_countlist(&em->faces); + g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*tot, "em_f_arr"); for (i=0,efa=em->faces.first; efa; i++,efa=efa->next) g_em_face_array[i] = efa; |