diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-28 10:34:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-28 10:34:13 +0400 |
commit | 7f9b650cedddcc7150e5a0f284af000451a21a34 (patch) | |
tree | ea051fb77d00e0f2cc49559e144ecc01ff385a02 /source/blender/editors/mesh | |
parent | 388a364bc90480d32a04968f4a2d09d99840a131 (diff) |
fix for usability issue - navmesh would create the new object on the first layer, rather then the layer of the source object(s).
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 9bcbce6aa83..8d5bfe624fd 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -56,7 +56,8 @@ #include "recast-capi.h" -static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r) +static void createVertsTrisData(bContext *C, LinkNode *obs, + int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay) { MVert *mvert; int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces; @@ -91,6 +92,8 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float if (mf->v4) ntris += 1; } + + *r_lay |= ob->lay; } /* create data */ @@ -295,7 +298,8 @@ static bool buildNavMesh(const RecastData *recastParams, int nverts, float *vert return true; } -static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base) +static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, + Base *base, unsigned int lay) { float co[3], rot[3]; BMEditMesh *em; @@ -316,7 +320,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, if (createob) { /* create new object */ - obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); + obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, lay); } else { obedit = base->object; @@ -452,15 +456,16 @@ static int navmesh_create_exec(bContext *C, wmOperator *op) struct recast_polyMesh *pmesh = NULL; struct recast_polyMeshDetail *dmesh = NULL; bool ok; + unsigned int lay = 0; int nverts = 0, ntris = 0; int *tris = 0; float *verts = NULL; - createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris); + createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay); BLI_linklist_free(obs, NULL); if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) { - createRepresentation(C, pmesh, dmesh, navmeshBase); + createRepresentation(C, pmesh, dmesh, navmeshBase, lay); } MEM_freeN(verts); |