Blender V2.61 - r43446
|
#include <math.h>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_ID.h"
#include "BKE_library.h"
#include "BKE_depsgraph.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_scene.h"
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_report.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
#include "BLI_linklist.h"
#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"
Go to the source code of this file.
Functions | |
static void | createVertsTrisData (bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r) |
static int | buildNavMesh (const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris, struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh) |
static Object * | createRepresentation (bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base) |
static int | create_navmesh_exec (bContext *C, wmOperator *op) |
void | MESH_OT_navmesh_make (wmOperatorType *ot) |
static int | navmesh_face_copy_exec (bContext *C, wmOperator *op) |
void | MESH_OT_navmesh_face_copy (struct wmOperatorType *ot) |
static int | compare (const void *a, const void *b) |
static int | findFreeNavPolyIndex (EditMesh *em) |
static int | navmesh_face_add_exec (bContext *C, wmOperator *UNUSED(op)) |
void | MESH_OT_navmesh_face_add (struct wmOperatorType *ot) |
static int | navmesh_obmode_data_poll (bContext *C) |
static int | navmesh_obmode_poll (bContext *C) |
static int | navmesh_reset_exec (bContext *C, wmOperator *UNUSED(op)) |
void | MESH_OT_navmesh_reset (struct wmOperatorType *ot) |
static int | navmesh_clear_exec (bContext *C, wmOperator *UNUSED(op)) |
void | MESH_OT_navmesh_clear (struct wmOperatorType *ot) |
static int buildNavMesh | ( | const RecastData * | recastParams, |
int | nverts, | ||
float * | verts, | ||
int | ntris, | ||
int * | tris, | ||
struct recast_polyMesh ** | pmesh, | ||
struct recast_polyMeshDetail ** | dmesh | ||
) | [static] |
Definition at line 168 of file mesh_navmesh.c.
References RecastData::agentheight, RecastData::agentmaxclimb, RecastData::agentmaxslope, RecastData::agentradius, ceilf, RecastData::cellheight, RecastData::cellsize, RecastData::detailsampledist, RecastData::detailsamplemaxerror, RecastData::edgemaxerror, RecastData::edgemaxlen, floorf, MEM_callocN(), MEM_freeN(), NULL, RAD2DEG, RecastData::regionmergesize, RecastData::regionminsize, and RecastData::vertsperpoly.
Referenced by create_navmesh_exec().
static int compare | ( | const void * | a, |
const void * | b | ||
) | [static] |
Definition at line 537 of file mesh_navmesh.c.
Referenced by _softbody_calc_forces_slice_in_a_thread(), bgnwrite(), findFreeNavPolyIndex(), and softbody_calc_forces().
static int create_navmesh_exec | ( | bContext * | C, |
wmOperator * | op | ||
) | [static] |
Definition at line 426 of file mesh_navmesh.c.
References Scene::basact, BKE_report(), BLI_linklist_append(), BLI_linklist_free(), buildNavMesh(), createRepresentation(), createVertsTrisData(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_scene(), Scene::gm, MEM_freeN(), NULL, OB_BODY_TYPE_NAVMESH, OB_MESH, OPERATOR_CANCELLED, OPERATOR_FINISHED, GameData::recastData, wmOperator::reports, and RPT_ERROR.
Referenced by MESH_OT_navmesh_make().
static Object* createRepresentation | ( | bContext * | C, |
struct recast_polyMesh * | pmesh, | ||
struct recast_polyMeshDetail * | dmesh, | ||
Base * | base | ||
) | [static] |
Definition at line 292 of file mesh_navmesh.c.
References addfacelist(), addvertlist(), BKE_mesh_end_editmesh(), BKE_mesh_ensure_navmesh(), BKE_mesh_get_editmesh(), BLI_freelistN(), Object::body_type, CD_CALLOC, CD_RECAST, co, copy_v3_v3(), CTX_data_scene(), CustomData_add_layer_named(), CustomData_em_get(), DAG_id_tag_update(), Object::data, ED_object_add_type(), ED_object_enter_editmode(), ED_object_exit_editmode(), EditMesh::edges, EM_DO_UNDO, EM_free_index_arrays(), EM_FREEDATA, EM_get_vert_for_index(), EM_IGNORE_LAYER, EM_init_index_arrays(), EditMesh::faces, FALSE, EditMesh::fdata, ListBase::first, free_edgelist(), free_facelist(), free_vertlist(), Object::gameflag, i, Object::loc, NC_GEOM, NC_OBJECT, ND_DATA, ND_DRAW, NULL, OB_BODY_TYPE_NAVMESH, OB_COLLISION, OB_MESH, OB_NAVMESH, OB_RECALC_DATA, Base::object, p, rename_id(), Object::rot, rot, scene_select_base(), EditMesh::selected, SWAP, EditMesh::totvert, EditMesh::verts, WM_event_add_notifier(), and zero_v3().
Referenced by create_navmesh_exec().
static void createVertsTrisData | ( | bContext * | C, |
LinkNode * | obs, | ||
int * | nverts_r, | ||
float ** | verts_r, | ||
int * | ntris_r, | ||
int ** | tris_r | ||
) | [static] |
Definition at line 68 of file mesh_navmesh.c.
References BLI_linklist_append(), BLI_linklist_free(), CD_MASK_MESH, MVert::co, co, copy_v3_v3(), CTX_data_scene(), DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, i, LinkNode::link, MEM_mallocN(), mesh_create_derived_no_virtual(), mul_v3_m4v3(), LinkNode::next, NULL, Object::obmat, DerivedMesh::release, EditFace::v, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by create_navmesh_exec().
static int findFreeNavPolyIndex | ( | EditMesh * | em | ) | [static] |
Definition at line 542 of file mesh_navmesh.c.
References CD_RECAST, compare(), CustomData_em_get(), EditFace::data, EditMesh::faces, EditMesh::fdata, i, indices, ListBase::last, MEM_callocN(), MEM_freeN(), EditFace::prev, and EditMesh::totface.
Referenced by navmesh_face_add_exec().
void MESH_OT_navmesh_clear | ( | struct wmOperatorType * | ot | ) |
Definition at line 679 of file mesh_navmesh.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, navmesh_clear_exec(), navmesh_obmode_data_poll(), OPTYPE_REGISTER, OPTYPE_UNDO, and wmOperatorType::poll.
Referenced by ED_operatortypes_mesh().
void MESH_OT_navmesh_face_add | ( | struct wmOperatorType * | ot | ) |
Definition at line 602 of file mesh_navmesh.c.
References wmOperatorType::description, ED_operator_editmesh(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, navmesh_face_add_exec(), OPTYPE_REGISTER, OPTYPE_UNDO, and wmOperatorType::poll.
Referenced by ED_operatortypes_mesh().
void MESH_OT_navmesh_face_copy | ( | struct wmOperatorType * | ot | ) |
Definition at line 522 of file mesh_navmesh.c.
References wmOperatorType::description, ED_operator_editmesh(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, navmesh_face_copy_exec(), OPTYPE_REGISTER, OPTYPE_UNDO, and wmOperatorType::poll.
Referenced by ED_operatortypes_mesh().
void MESH_OT_navmesh_make | ( | wmOperatorType * | ot | ) |
Definition at line 471 of file mesh_navmesh.c.
References create_navmesh_exec(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, and OPTYPE_UNDO.
Referenced by ED_operatortypes_mesh().
void MESH_OT_navmesh_reset | ( | struct wmOperatorType * | ot | ) |
Definition at line 651 of file mesh_navmesh.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, navmesh_obmode_poll(), navmesh_reset_exec(), OPTYPE_REGISTER, OPTYPE_UNDO, and wmOperatorType::poll.
Referenced by ED_operatortypes_mesh().
static int navmesh_clear_exec | ( | bContext * | C, |
wmOperator * | UNUSEDop | ||
) | [static] |
Definition at line 666 of file mesh_navmesh.c.
References CD_RECAST, CustomData_free_layers(), DAG_id_tag_update(), Object::data, ED_object_active_context(), Mesh::fdata, Mesh::id, NC_GEOM, ND_DATA, OB_RECALC_DATA, OPERATOR_FINISHED, Mesh::totface, and WM_event_add_notifier().
Referenced by MESH_OT_navmesh_clear().
static int navmesh_face_add_exec | ( | bContext * | C, |
wmOperator * | UNUSEDop | ||
) | [static] |
Definition at line 573 of file mesh_navmesh.c.
References BKE_mesh_end_editmesh(), BKE_mesh_get_editmesh(), CD_RECAST, CTX_data_edit_object(), CustomData_em_get(), CustomData_has_layer(), DAG_id_tag_update(), Object::data, EditFace::data, EditFace::f, EditMesh::faces, EditMesh::fdata, findFreeNavPolyIndex(), ListBase::last, NC_GEOM, ND_DATA, OB_RECALC_DATA, OPERATOR_FINISHED, EditFace::prev, SELECT, and WM_event_add_notifier().
Referenced by MESH_OT_navmesh_face_add().
static int navmesh_face_copy_exec | ( | bContext * | C, |
wmOperator * | op | ||
) | [static] |
Definition at line 485 of file mesh_navmesh.c.
References BKE_mesh_end_editmesh(), BKE_mesh_get_editmesh(), BKE_report(), CD_RECAST, CTX_data_edit_object(), CustomData_em_get(), CustomData_has_layer(), DAG_id_tag_update(), Object::data, EditFace::data, EM_get_actFace(), EditFace::f, EditMesh::faces, EditMesh::fdata, ListBase::first, NC_GEOM, ND_DATA, EditFace::next, OB_RECALC_DATA, OPERATOR_FINISHED, wmOperator::reports, RPT_ERROR, SELECT, and WM_event_add_notifier().
Referenced by MESH_OT_navmesh_face_copy().
static int navmesh_obmode_data_poll | ( | bContext * | C | ) | [static] |
Definition at line 617 of file mesh_navmesh.c.
References CD_RECAST, CustomData_has_layer(), Object::data, ED_object_active_context(), FALSE, Mesh::fdata, Object::mode, OB_MESH, OB_MODE_OBJECT, and Object::type.
Referenced by MESH_OT_navmesh_clear().
static int navmesh_obmode_poll | ( | bContext * | C | ) | [static] |
Definition at line 627 of file mesh_navmesh.c.
References ED_object_active_context(), FALSE, Object::mode, OB_MESH, OB_MODE_OBJECT, TRUE, and Object::type.
Referenced by MESH_OT_navmesh_reset().
static int navmesh_reset_exec | ( | bContext * | C, |
wmOperator * | UNUSEDop | ||
) | [static] |
Definition at line 636 of file mesh_navmesh.c.
References BKE_mesh_ensure_navmesh(), CD_RECAST, CustomData_free_layers(), DAG_id_tag_update(), Object::data, ED_object_active_context(), Mesh::fdata, Mesh::id, NC_GEOM, ND_DATA, OB_RECALC_DATA, OPERATOR_FINISHED, Mesh::totface, and WM_event_add_notifier().
Referenced by MESH_OT_navmesh_reset().