Fix knife project, add to mesh menu

This commit is contained in:
Campbell Barton 2018-12-06 16:52:49 +11:00
parent 6c19412ad1
commit aeffaf75ab
Notes: blender-bot 2023-02-14 04:40:28 +01:00
Referenced by issue #58829, Knife Project Tool
3 changed files with 17 additions and 5 deletions

View File

@ -2754,6 +2754,7 @@ class VIEW3D_MT_edit_mesh(Menu):
layout.menu("VIEW3D_MT_edit_mesh_extrude")
layout.operator("mesh.split")
layout.operator("mesh.bisect")
layout.operator("mesh.knife_project")
if with_bullet:
layout.operator("mesh.convex_hull")

View File

@ -54,8 +54,6 @@
#include "BKE_editmesh_bvh.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
@ -76,6 +74,9 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "mesh_intern.h" /* own include */
/* detect isolated holes and fill them */
@ -2601,7 +2602,12 @@ static void knifetool_init_bmbvh(KnifeTool_OpData *kcd)
{
BM_mesh_elem_index_ensure(kcd->em->bm, BM_VERT);
kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(kcd->vc.depsgraph, kcd->em, kcd->scene, NULL);
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(kcd->vc.depsgraph, &kcd->scene->id);
Object *obedit_eval = (Object *)DEG_get_evaluated_id(kcd->vc.depsgraph, &kcd->em->ob->id);
BMEditMesh *em_eval = BKE_editmesh_from_object(obedit_eval);
kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(
kcd->vc.depsgraph, em_eval, scene_eval, NULL);
kcd->bmbvh = BKE_bmbvh_new_from_editmesh(
kcd->em,

View File

@ -44,6 +44,7 @@
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_define.h"
#include "RNA_access.h"
@ -67,8 +68,12 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C, Scene *scene,
bool me_eval_needs_free;
if (ob->type == OB_MESH || ob->runtime.mesh_eval) {
me_eval = (ob->runtime.mesh_eval ?
ob->runtime.mesh_eval : mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH));
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
me_eval = ob_eval->runtime.mesh_eval;
if (me_eval == NULL) {
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
}
me_eval_needs_free = false;
}
else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {