Commit: aeffaf75aba037271e843373a52a8022dceece65
Author: Campbell Barton
Date:   Thu Dec 6 16:52:49 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBaeffaf75aba037271e843373a52a8022dceece65

Fix knife project, add to mesh menu

===================================================================

M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/editors/mesh/editmesh_knife.c
M       source/blender/editors/mesh/editmesh_knife_project.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index e0f72e81096..10a403a6634 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -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")
diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index 2e442d97fad..7313469eda9 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -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,
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c 
b/source/blender/editors/mesh/editmesh_knife_project.c
index da8b8d217d7..1804eca4e5c 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -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)) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to