diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_modifier.py | 4 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_game.py | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/CMakeLists.txt | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/SConscript | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c (renamed from source/blender/editors/object/object_navmesh.c) | 42 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/CMakeLists.txt | 10 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 5 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 6 |
10 files changed, 52 insertions, 53 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 98466b41c2e..d2d4c263d50 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -380,8 +380,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop(md, "mirror_object", text="") def NAVMESH(self, layout, ob, md): - layout.operator("object.assign_navpolygon") - layout.operator("object.assign_new_navpolygon") + layout.operator("mesh.assign_navpolygon") + layout.operator("mesh.assign_new_navpolygon") def MULTIRES(self, layout, ob, md): layout.row().prop(md, "subdivision_type", expand=True) diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 8cb73d2449b..7650e7b6ee1 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -412,7 +412,7 @@ class SCENE_PT_game_navmesh(SceneButtonsPanel, bpy.types.Panel): rd = context.scene.game_settings.recast_data - layout.operator("object.create_navmesh", text='Build navigation mesh') + layout.operator("mesh.create_navmesh", text='Build navigation mesh') col = layout.column() col.label(text="Rasterization:") diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 02a25a2a122..f45f706b892 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -52,4 +52,16 @@ set(SRC mesh_intern.h ) +if(WITH_GAMEENGINE) + add_definitions(-DWITH_GAMEENGINE) + + list(APPEND INC + ../../../../extern/recastnavigation + ) + + list(APPEND SRC + mesh_navmesh.c + ) +endif() + blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index b992ae5f04c..24c63a5dc54 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -15,4 +15,10 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] +if env['WITH_BF_GAMEENGINE']: + incs += ' #/extern/recastnavigation' + defs.append('WITH_GAMEENGINE') +else: + sources.remove('mesh_navmesh.c') + env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), [], libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4d620424b0a..6dce92bf07b 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -40,6 +40,7 @@ struct bContext; struct wmOperatorType; struct wmOperator; +struct ViewContext; /* ******************** editface.c */ @@ -64,7 +65,7 @@ extern struct EditEdge *addedgelist(EditMesh *em, struct EditVert *v1, struct Ed extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges); extern struct EditEdge *findedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2); -void em_setup_viewcontext(struct bContext *C, ViewContext *vc); +void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); void MESH_OT_separate(struct wmOperatorType *ot); @@ -169,7 +170,7 @@ void MESH_OT_solidify(struct wmOperatorType *ot); void MESH_OT_select_nth(struct wmOperatorType *ot); -extern EditEdge *findnearestedge(ViewContext *vc, int *dist); +extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist); void editmesh_select_by_material(EditMesh *em, int index); void EM_recalc_normal_direction(EditMesh *em, int inside, int select); /* makes faces righthand turning */ void EM_select_more(EditMesh *em); @@ -185,7 +186,7 @@ void faceloop_select(EditMesh *em, EditEdge *startedge, int select); * if 0, unselected vertice are given the bias * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased */ -extern EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short strict); +extern EditVert *findnearestvert(struct ViewContext *vc, int *dist, short sel, short strict); /* ******************* editmesh_tools.c */ @@ -256,5 +257,10 @@ void MESH_OT_drop_named_image(struct wmOperatorType *ot); void MESH_OT_edgering_select(struct wmOperatorType *ot); void MESH_OT_loopcut(struct wmOperatorType *ot); +/* ******************* mesh_navmesh.c */ +void MESH_OT_create_navmesh(struct wmOperatorType *ot); +void MESH_OT_assign_navpolygon(struct wmOperatorType *ot); +void MESH_OT_assign_new_navpolygon(struct wmOperatorType *ot); + #endif // MESH_INTERN_H diff --git a/source/blender/editors/object/object_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 413d8757be2..2b64fb24e78 100644 --- a/source/blender/editors/object/object_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -54,21 +54,16 @@ #include "ED_object.h" #include "ED_mesh.h" +#include "ED_screen.h" #include "RNA_access.h" #include "WM_api.h" #include "WM_types.h" +#include "mesh_intern.h" #include "recast-capi.h" -/*mesh/mesh_intern.h */ -extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example); -extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges); -extern void free_vertlist(EditMesh *em, ListBase *edve); -extern void free_edgelist(EditMesh *em, ListBase *lb); -extern void free_facelist(EditMesh *em, ListBase *lb); - static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r) { MVert *mvert; @@ -108,8 +103,8 @@ static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float } //create data - verts = MEM_mallocN(sizeof(float)*3*nverts, "verts"); - tris = MEM_mallocN(sizeof(int)*3*ntris, "faces"); + verts = MEM_mallocN(sizeof(float)*3*nverts, "createVertsTrisData verts"); + tris = MEM_mallocN(sizeof(int)*3*ntris, "createVertsTrisData faces"); basenverts = 0; tri = tris; @@ -253,7 +248,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts } // Allocate array that can hold triangle flags. - triflags = MEM_callocN(sizeof(unsigned char)*ntris, "triflags"); + triflags = MEM_callocN(sizeof(unsigned char)*ntris, "buildNavMesh triflags"); // Find triangles which are walkable based on their slope and rasterize them. recast_markWalkableTriangles(RAD2DEG(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags); @@ -520,15 +515,18 @@ static int create_navmesh_exec(bContext *C, wmOperator *UNUSED(op)) buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh); createRepresentation(C, pmesh, dmesh, navmeshBase); + MEM_freeN(verts); + MEM_freeN(tris); + return OPERATOR_FINISHED; } -void OBJECT_OT_create_navmesh(wmOperatorType *ot) +void MESH_OT_create_navmesh(wmOperatorType *ot) { /* identifiers */ ot->name= "Create navigation mesh"; ot->description= "Create navigation mesh for selected objects"; - ot->idname= "OBJECT_OT_create_navmesh"; + ot->idname= "MESH_OT_create_navmesh"; /* api callbacks */ ot->exec= create_navmesh_exec; @@ -537,14 +535,6 @@ void OBJECT_OT_create_navmesh(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int assign_navpolygon_poll(bContext *C) -{ - Object *ob= (Object *)CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - if (!ob || !ob->data) - return 0; - return (((Mesh*)ob->data)->edit_mesh != NULL); -} - static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -584,15 +574,15 @@ static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot) +void MESH_OT_assign_navpolygon(struct wmOperatorType *ot) { /* identifiers */ ot->name= "Assign polygon index"; ot->description= "Assign polygon index to face by active face"; - ot->idname= "OBJECT_OT_assign_navpolygon"; + ot->idname= "MESH_OT_assign_navpolygon"; /* api callbacks */ - ot->poll = assign_navpolygon_poll; + ot->poll= ED_operator_editmesh; ot->exec= assign_navpolygon_exec; /* flags */ @@ -668,15 +658,15 @@ static int assign_new_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot) +void MESH_OT_assign_new_navpolygon(struct wmOperatorType *ot) { /* identifiers */ ot->name= "Assign new polygon index"; ot->description= "Assign new polygon index to face"; - ot->idname= "OBJECT_OT_assign_new_navpolygon"; + ot->idname= "MESH_OT_assign_new_navpolygon"; /* api callbacks */ - ot->poll = assign_navpolygon_poll; + ot->poll= ED_operator_editmesh; ot->exec= assign_new_navpolygon_exec; /* flags */ diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 282eeef906f..f44f7fbb8d5 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -151,6 +151,12 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_solidify); WM_operatortype_append(MESH_OT_select_nth); + +#ifdef WITH_GAMEENGINE + WM_operatortype_append(MESH_OT_create_navmesh); + WM_operatortype_append(MESH_OT_assign_navpolygon); + WM_operatortype_append(MESH_OT_assign_new_navpolygon); +#endif } #if 0 /* UNUSED, remove? */ diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index b0b4f9dc0eb..c78c9fddbe8 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -58,16 +58,6 @@ set(SRC object_intern.h ) -if(WITH_GAMEENGINE) - list(APPEND INC - ../../../../extern/recastnavigation - ) - - list(APPEND SRC - object_navmesh.c - ) -endif() - if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 434111c1227..7bb98f4aeb1 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -225,10 +225,5 @@ void OBJECT_OT_group_remove(struct wmOperatorType *ot); /* object_bake.c */ void OBJECT_OT_bake_image(wmOperatorType *ot); -/* object_navmesh.cpp */ -void OBJECT_OT_create_navmesh(struct wmOperatorType *ot); -void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot); -void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot); - #endif /* ED_OBJECT_INTERN_H */ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index a9cb0423739..5a2437b1911 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -214,12 +214,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_bake_image); WM_operatortype_append(OBJECT_OT_drop_named_material); - -#ifdef WITH_GAMEENGINE - WM_operatortype_append(OBJECT_OT_create_navmesh); - WM_operatortype_append(OBJECT_OT_assign_navpolygon); - WM_operatortype_append(OBJECT_OT_assign_new_navpolygon); -#endif } |