Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2009-09-16 21:43:09 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-09-16 21:43:09 +0400
commitdeebf4f8f0d79169a0e6c2a391670419b6492bfe (patch)
tree2a0aaf4042aa78e9d1d835f4544e07c6123e67a9 /source/blender/editors/mesh
parent6b0679a3999d8e5abc60730f523879eadbedcd8f (diff)
merge with 2.5/trunk at r23271
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/bmesh_select.c51
-rw-r--r--source/blender/editors/mesh/bmesh_selecthistory.c2
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c147
-rw-r--r--source/blender/editors/mesh/bmeshutils.c10
-rw-r--r--source/blender/editors/mesh/editmesh.c168
-rw-r--r--source/blender/editors/mesh/editmesh_add.c69
-rw-r--r--source/blender/editors/mesh/editmesh_loop.c19
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c556
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c273
-rw-r--r--source/blender/editors/mesh/mesh_intern.h3
-rw-r--r--source/blender/editors/mesh/mesh_layers.c88
-rw-r--r--source/blender/editors/mesh/mesh_ops.c26
-rw-r--r--source/blender/editors/mesh/meshtools.c3
13 files changed, 499 insertions, 916 deletions
diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c
index d425f3af6d1..cc88d537eeb 100644
--- a/source/blender/editors/mesh/bmesh_select.c
+++ b/source/blender/editors/mesh/bmesh_select.c
@@ -39,8 +39,6 @@ BMEditMesh_mods.c, UI level access, no geometry changes
#include "MEM_guardedalloc.h"
-#include "MTC_matrixops.h"
-
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
@@ -364,7 +362,6 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, int x, int y
static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int index)
{
BMEditMesh *em= (BMEditMesh *)handle;
- BMIter iter;
BMVert *eve = BMIter_AtIndex(em->bm, BM_VERTS_OF_MESH, NULL, index-1);
if(eve && BM_TestHFlag(eve, BM_SELECT)) return 0;
@@ -548,7 +545,8 @@ static void findnearestface__doClosest(void *userData, BMFace *efa, int x, int y
}
}
}
-static BMFace *EDBM_findnearestface(ViewContext *vc, int *dist)
+
+BMFace *EDBM_findnearestface(ViewContext *vc, int *dist)
{
if(vc->v3d->drawtype>OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
@@ -669,7 +667,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
- float thresh = scene->toolsettings->select_thresh;
+ float thresh = CTX_data_tool_settings(C)->select_thresh;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%d thresh=%f", BM_SELECT, type, thresh);
@@ -688,8 +686,8 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* dependencies graph and notification stuff */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -721,7 +719,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
- float thresh = scene->toolsettings->select_thresh;
+ float thresh = CTX_data_tool_settings(C)->select_thresh;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%d thresh=%f", BM_SELECT, type, thresh);
@@ -741,8 +739,8 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* dependencies graph and notification stuff */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -773,7 +771,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
- float thresh = scene->toolsettings->select_thresh;
+ float thresh = CTX_data_tool_settings(C)->select_thresh;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%d thresh=%f", BM_SELECT, type, thresh);
@@ -794,8 +792,8 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
EDBM_selectmode_flush(em);
/* dependencies graph and notification stuff */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -1091,7 +1089,7 @@ static int loop_multiselect(bContext *C, wmOperator *op)
MEM_freeN(edarray);
// if (EM_texFaceCheck())
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
EM_EndBMEditMesh(obedit->data, em);
#endif
@@ -1161,7 +1159,7 @@ static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring
EDBM_selectmode_flush(em);
// if (EM_texFaceCheck())
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit);
}
}
@@ -1245,7 +1243,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
EDBM_store_selection(em, eed);
/* force drawmode for mesh */
- switch (vc.scene->toolsettings->edge_mode) {
+ switch (CTX_data_tool_settings(C)->edge_mode) {
case EDGE_MODE_TAG_SEAM:
me->drawflag |= ME_DRAWSEAMS;
@@ -1261,9 +1259,8 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
break;
}
- DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
}
#endif
}
@@ -1362,7 +1359,7 @@ void mouse_mesh(bContext *C, short mval[2], short extend)
}
}
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit);
}
static void EDBM_strip_selections(BMEditMesh *em)
@@ -1541,7 +1538,7 @@ static int select_inverse_mesh_exec(bContext *C, wmOperator *op)
EDBM_select_swap(em);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1592,12 +1589,12 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
/*if(limit) {
int retval= select_linked_limited_invoke(&vc, 0, sel);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return retval;
}*/
if( unified_findnearest(&vc, &eve, &eed, &efa)==0 ) {
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_CANCELLED;
}
@@ -1620,7 +1617,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
BMW_End(&walker);
EDBM_select_flush(em, SCE_SELECT_VERTEX);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1675,7 +1672,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
EDBM_select_flush(em, SCE_SELECT_VERTEX);
V_FREE(verts);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1717,7 +1714,7 @@ static int select_more(bContext *C, wmOperator *op)
if (!EDBM_FinishOp(em, &bmop, op, 1))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1754,7 +1751,7 @@ static int select_less(bContext *C, wmOperator *op)
if (!EDBM_FinishOp(em, &bmop, op, 1))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/bmesh_selecthistory.c b/source/blender/editors/mesh/bmesh_selecthistory.c
index 31703adf807..88276069ec2 100644
--- a/source/blender/editors/mesh/bmesh_selecthistory.c
+++ b/source/blender/editors/mesh/bmesh_selecthistory.c
@@ -35,8 +35,6 @@
#include "MEM_guardedalloc.h"
-#include "MTC_matrixops.h"
-
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index eb369531e03..9b26450cd1e 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -99,7 +99,7 @@ static void add_normal_aligned(float *nor, float *add)
static int subdivide_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
int cuts= RNA_int_get(op->ptr,"number_cuts");
@@ -114,13 +114,13 @@ static int subdivide_exec(bContext *C, wmOperator *op)
BM_esubdivideflag(obedit, em->bm, BM_SELECT,
smooth, fractal,
- scene->toolsettings->editbutflag|flag,
+ ts->editbutflag|flag,
cuts, 0, RNA_enum_get(op->ptr, "quadcorner"),
RNA_boolean_get(op->ptr, "tess_single_edge"),
RNA_boolean_get(op->ptr, "gridfill"));
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -545,9 +545,9 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
EDBM_RecalcNormals(em);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
return OPERATOR_FINISHED;
}
@@ -661,7 +661,7 @@ static int mesh_extrude_region_exec(bContext *C, wmOperator *op)
EDBM_Extrude_Mesh(obedit, em, op, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -677,8 +677,8 @@ static int mesh_extrude_region_invoke(bContext *C, wmOperator *op, wmEvent *even
tmode = EDBM_Extrude_edge(obedit, em, BM_SELECT, nor);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
RNA_enum_set(op->ptr, "proportional", 0);
RNA_boolean_set(op->ptr, "mirror", 0);
@@ -720,7 +720,7 @@ static int mesh_extrude_verts_exec(bContext *C, wmOperator *op)
EDBM_Extrude_verts_indiv(em, op, BM_SELECT, nor);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -736,8 +736,8 @@ static int mesh_extrude_verts_invoke(bContext *C, wmOperator *op, wmEvent *event
tmode = EDBM_Extrude_verts_indiv(em, op, BM_SELECT, nor);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
RNA_enum_set(op->ptr, "proportional", 0);
RNA_boolean_set(op->ptr, "mirror", 0);
@@ -779,7 +779,7 @@ static int mesh_extrude_edges_exec(bContext *C, wmOperator *op)
EDBM_Extrude_edges_indiv(em, op, BM_SELECT, nor);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -795,8 +795,8 @@ static int mesh_extrude_edges_invoke(bContext *C, wmOperator *op, wmEvent *event
tmode = EDBM_Extrude_edges_indiv(em, op, BM_SELECT, nor);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
RNA_enum_set(op->ptr, "proportional", 0);
RNA_boolean_set(op->ptr, "mirror", 0);
@@ -838,7 +838,7 @@ static int mesh_extrude_faces_exec(bContext *C, wmOperator *op)
EDBM_Extrude_face_indiv(em, op, BM_SELECT, nor);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -854,8 +854,8 @@ static int mesh_extrude_faces_invoke(bContext *C, wmOperator *op, wmEvent *event
tmode = EDBM_Extrude_face_indiv(em, op, BM_SELECT, nor);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
RNA_enum_set(op->ptr, "proportional", 0);
RNA_boolean_set(op->ptr, "mirror", 0);
@@ -1020,7 +1020,7 @@ static int toggle_select_all_exec(bContext *C, wmOperator *op)
EDBM_toggle_select_all(em);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1146,8 +1146,8 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
}
//retopo_do_all();
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
- DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data);
+ DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA);
return OPERATOR_FINISHED;
}
@@ -1167,7 +1167,7 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int delete_mesh(Object *obedit, wmOperator *op, int event, Scene *scene)
+static int delete_mesh(bContext *C, Object *obedit, wmOperator *op, int event, Scene *scene)
{
BMEditMesh *bem = ((Mesh*)obedit->data)->edit_btmesh;
@@ -1219,7 +1219,8 @@ static int delete_mesh(Object *obedit, wmOperator *op, int event, Scene *scene)
return OPERATOR_CANCELLED;
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1241,9 +1242,9 @@ static int delete_mesh_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
- delete_mesh(obedit, op, RNA_enum_get(op->ptr, "type"), scene);
+ delete_mesh(C, obedit, op, RNA_enum_get(op->ptr, "type"), scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1284,8 +1285,8 @@ static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
if (!EDBM_FinishOp(em, &bmop, op, 1))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
return OPERATOR_FINISHED;
}
@@ -1333,9 +1334,9 @@ static int mesh_selection_type_exec(bContext *C, wmOperator *op)
}
EDBM_selectmode_set(em);
- CTX_data_scene(C)->toolsettings->selectmode = em->selectmode;
+ CTX_data_tool_settings(C)->selectmode = em->selectmode;
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return OPERATOR_FINISHED;
}
@@ -1390,8 +1391,8 @@ static int editbmesh_mark_seam(bContext *C, wmOperator *op)
}
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1440,8 +1441,8 @@ static int editbmesh_mark_sharp(bContext *C, wmOperator *op)
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1479,8 +1480,8 @@ static int editbmesh_vert_connect(bContext *C, wmOperator *op)
len = BMO_GetSlot(&bmop, "edgeout")->len;
BMO_Finish_Op(bm, &bmop);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1514,8 +1515,8 @@ static int editbmesh_edge_split(bContext *C, wmOperator *op)
len = BMO_GetSlot(&bmop, "outsplit")->len;
BMO_Finish_Op(bm, &bmop);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1555,8 +1556,8 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op)
if (!EDBM_FinishOp(em, &bmop, op, 1))
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -1596,8 +1597,8 @@ static int flip_normals(bContext *C, wmOperator *op)
if (!EDBM_CallOpf(em, op, "reversefaces facaes=%hf", BM_SELECT))
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1679,8 +1680,8 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
if (!EDBM_FinishOp(em, &bmop, op, 1))
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1740,8 +1741,8 @@ static int pin_mesh_exec(bContext *C, wmOperator *op)
EDBM_pin_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1799,8 +1800,8 @@ static int unpin_mesh_exec(bContext *C, wmOperator *op)
EDBM_unpin_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1863,8 +1864,8 @@ static int hide_mesh_exec(bContext *C, wmOperator *op)
EDBM_hide_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1917,8 +1918,8 @@ static int reveal_mesh_exec(bContext *C, wmOperator *op)
EDBM_reveal_mesh(em);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1950,8 +1951,8 @@ static int normals_make_consistent_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "inside"))
EDBM_CallOpf(em, op, "reversefaces faces=%hf", BM_SELECT);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2017,8 +2018,8 @@ static int do_smooth_vertex(bContext *C, wmOperator *op)
//BMESH_TODO: need to handle the x-axis editing option here properly.
//should probably make a helper function for that? I dunno.
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2081,8 +2082,8 @@ static int bm_test_exec(bContext *C, wmOperator *op)
BMW_End(&walker);
#endif
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2130,8 +2131,8 @@ static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
mesh_set_smooth_faces(em, 1);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2159,8 +2160,8 @@ static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *op)
mesh_set_smooth_faces(em, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2211,8 +2212,8 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op)
/* dependencies graph and notification stuff */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2236,8 +2237,8 @@ static int mesh_reverse_uvs(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* dependencies graph and notification stuff */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
/* we succeeded */
return OPERATOR_FINISHED;
@@ -2295,8 +2296,8 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
#endif
@@ -2354,8 +2355,8 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
#endif
return OPERATOR_FINISHED;
@@ -2534,8 +2535,8 @@ static int merge_exec(bContext *C, wmOperator *op)
if(!status)
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2641,8 +2642,8 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op)
}
*/
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c
index 9682515f6c7..ec08297a675 100644
--- a/source/blender/editors/mesh/bmeshutils.c
+++ b/source/blender/editors/mesh/bmeshutils.c
@@ -247,7 +247,7 @@ int EDBM_CallOpfSilent(BMEditMesh *em, char *fmt, ...)
return EDBM_FinishOp(em, &bmop, NULL, 0);
}
-void EDBM_MakeEditBMesh(Scene *scene, Object *ob)
+void EDBM_MakeEditBMesh(ToolSettings *ts, Scene *scene, Object *ob)
{
Mesh *me = ob->data;
EditMesh *em;
@@ -263,7 +263,7 @@ void EDBM_MakeEditBMesh(Scene *scene, Object *ob)
}
me->edit_btmesh = BMEdit_Create(bm);
- me->edit_btmesh->selectmode = scene->toolsettings->selectmode;
+ me->edit_btmesh->selectmode = ts->selectmode;
}
void EDBM_LoadEditBMesh(Scene *scene, Object *ob)
@@ -400,6 +400,12 @@ void EDBM_select_flush(BMEditMesh *em, int selectmode)
em->bm->selectmode = em->selectmode;
}
+/*BMESH_TODO*/
+void EDBM_deselect_flush(BMEditMesh *em)
+{
+}
+
+
void EDBM_selectmode_flush(BMEditMesh *em)
{
em->bm->selectmode = em->selectmode;
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index d8bcf43e978..d2fd5a309e1 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -706,78 +706,6 @@ static void edge_drawflags(Mesh *me, EditMesh *em)
}
}
-static int editmesh_pointcache_edit(Scene *scene, Object *ob, int totvert, PTCacheID *pid_p, float mat[][4], int load)
-{
- Cloth *cloth;
- SoftBody *sb;
- ClothModifierData *clmd;
- PTCacheID pid, tmpid;
- int cfra= (int)scene->r.cfra, found= 0;
-
- pid.cache= NULL;
-
- /* check for cloth */
- if(modifiers_isClothEnabled(ob)) {
- clmd= (ClothModifierData*)modifiers_findByType(ob, eModifierType_Cloth);
- cloth= clmd->clothObject;
-
- BKE_ptcache_id_from_cloth(&tmpid, ob, clmd);
-
- /* verify vertex count and baked status */
- if(cloth && (totvert == cloth->numverts)) {
- if((tmpid.cache->flag & PTCACHE_BAKED) && (tmpid.cache->flag & PTCACHE_BAKE_EDIT)) {
- pid= tmpid;
-
- if(load && (pid.cache->flag & PTCACHE_BAKE_EDIT_ACTIVE))
- found= 1;
- }
- }
- }
-
- /* check for softbody */
- if(!found && ob->soft) {
- sb= ob->soft;
-
- BKE_ptcache_id_from_softbody(&tmpid, ob, sb);
-
- /* verify vertex count and baked status */
- if(sb->bpoint && (totvert == sb->totpoint)) {
- if((tmpid.cache->flag & PTCACHE_BAKED) && (tmpid.cache->flag & PTCACHE_BAKE_EDIT)) {
- pid= tmpid;
-
- if(load && (pid.cache->flag & PTCACHE_BAKE_EDIT_ACTIVE))
- found= 1;
- }
- }
- }
-
- /* if not making editmesh verify editing was active for this point cache */
- if(load) {
- if(found)
- pid.cache->flag &= ~PTCACHE_BAKE_EDIT_ACTIVE;
- else
- return 0;
- }
-
- /* check if we have cache for this frame */
- if(pid.cache && BKE_ptcache_id_exist(&pid, cfra)) {
- *pid_p = pid;
-
- if(load) {
- Mat4CpyMat4(mat, ob->obmat);
- }
- else {
- pid.cache->editframe= cfra;
- pid.cache->flag |= PTCACHE_BAKE_EDIT_ACTIVE;
- Mat4Invert(mat, ob->obmat); /* ob->imat is not up to date */
- }
-
- return 1;
- }
-
- return 0;
-}
-
/* turns Mesh into editmesh */
EditMesh *make_editMesh(Scene *scene, Object *ob)
{
@@ -791,11 +719,8 @@ EditMesh *make_editMesh(Scene *scene, Object *ob)
EditFace *efa;
EditEdge *eed;
EditSelection *ese;
- PTCacheID pid;
- Cloth *cloth;
- SoftBody *sb;
- float cacheco[3], cachemat[4][4], *co;
- int tot, a, cacheedit= 0, eekadoodle= 0;
+ float *co;
+ int tot, a, eekadoodle= 0;
em= MEM_callocN(sizeof(EditMesh), "editmesh");
@@ -815,26 +740,10 @@ EditMesh *make_editMesh(Scene *scene, Object *ob)
CustomData_copy(&me->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
mvert= me->mvert;
- cacheedit= editmesh_pointcache_edit(scene, ob, tot, &pid, cachemat, 0);
-
evlist= (EditVert **)MEM_mallocN(tot*sizeof(void *),"evlist");
for(a=0; a<tot; a++, mvert++) {
- if(cacheedit) {
- if(pid.type == PTCACHE_TYPE_CLOTH) {
- cloth= ((ClothModifierData*)pid.calldata)->clothObject;
- VECCOPY(cacheco, cloth->verts[a].x)
- }
- else if(pid.type == PTCACHE_TYPE_SOFTBODY) {
- sb= (SoftBody*)pid.calldata;
- VECCOPY(cacheco, sb->bpoint[a].pos)
- }
-
- Mat4MulVecfl(cachemat, cacheco);
- co= cacheco;
- }
- else
- co= mvert->co;
+ co= mvert->co;
eve= addvertlist(em, co, NULL);
evlist[a]= eve;
@@ -957,12 +866,6 @@ EditMesh *make_editMesh(Scene *scene, Object *ob)
if (EM_get_actFace(em, 0)==NULL) {
EM_set_actFace(em, em->faces.first ); /* will use the first face, this is so we alwats have an active face */
}
-
- /* vertex coordinates change with cache edit, need to recalc */
- if(cacheedit)
- recalc_editnormals(em);
-
- return em;
}
/* makes Mesh out of editmesh */
@@ -977,12 +880,8 @@ void load_editMesh(Scene *scene, Object *ob, EditMesh *em)
EditFace *efa, *efa_act;
EditEdge *eed;
EditSelection *ese;
- SoftBody *sb;
- Cloth *cloth;
- ClothModifierData *clmd;
- PTCacheID pid;
- float *fp, *newkey, *oldkey, nor[3], cacheco[3], cachemat[4][4];
- int i, a, ototvert, cacheedit= 0;
+ float *fp, *newkey, *oldkey, nor[3];
+ int i, a, ototvert;
/* this one also tests of edges are not in faces: */
/* eed->f2==0: not in face, f2==1: draw it */
@@ -1036,48 +935,8 @@ void load_editMesh(Scene *scene, Object *ob, EditMesh *em)
eve= em->verts.first;
a= 0;
- /* check for point cache editing */
- cacheedit= editmesh_pointcache_edit(scene, ob, em->totvert, &pid, cachemat, 1);
-
while(eve) {
- if(cacheedit) {
- if(pid.type == PTCACHE_TYPE_CLOTH) {
- clmd= (ClothModifierData*)pid.calldata;
- cloth= clmd->clothObject;
-
- /* assign position */
- VECCOPY(cacheco, cloth->verts[a].x)
- VECCOPY(cloth->verts[a].x, eve->co);
- Mat4MulVecfl(cachemat, cloth->verts[a].x);
-
- /* find plausible velocity, not physical correct but gives
- * nicer results when commented */
- VECSUB(cacheco, cloth->verts[a].x, cacheco);
- VecMulf(cacheco, clmd->sim_parms->stepsPerFrame*10.0f);
- VECADD(cloth->verts[a].v, cloth->verts[a].v, cacheco);
- }
- else if(pid.type == PTCACHE_TYPE_SOFTBODY) {
- sb= (SoftBody*)pid.calldata;
-
- /* assign position */
- VECCOPY(cacheco, sb->bpoint[a].pos)
- VECCOPY(sb->bpoint[a].pos, eve->co);
- Mat4MulVecfl(cachemat, sb->bpoint[a].pos);
-
- /* changing velocity for softbody doesn't seem to give
- * good results? */
-#if 0
- VECSUB(cacheco, sb->bpoint[a].pos, cacheco);
- VecMulf(cacheco, sb->minloops*10.0f);
- VECADD(sb->bpoint[a].vec, sb->bpoint[a].pos, cacheco);
-#endif
- }
-
- if(oldverts)
- VECCOPY(mvert->co, oldverts[a].co)
- }
- else
- VECCOPY(mvert->co, eve->co);
+ VECCOPY(mvert->co, eve->co);
mvert->mat_nr= 32767; /* what was this for, halos? */
@@ -1101,10 +960,6 @@ void load_editMesh(Scene *scene, Object *ob, EditMesh *em)
eve= eve->next;
mvert++;
}
-
- /* write changes to cache */
- if(cacheedit)
- BKE_ptcache_write_cache(&pid, pid.cache->editframe);
/* the edges */
a= 0;
@@ -1370,7 +1225,7 @@ void load_editMesh(Scene *scene, Object *ob, EditMesh *em)
void remake_editMesh(Scene *scene, Object *ob)
{
make_editMesh(scene, ob);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
BIF_undo_push("Undo all changes");
}
@@ -1480,8 +1335,8 @@ static int mesh_separate_selected(Scene *scene, Base *editbase)
/* hashedges are invalid now, make new! */
editMesh_set_hash(em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- DAG_object_flush_update(scene, basenew->object, OB_RECALC_DATA);
+ DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
+ DAG_id_flush_update(&basenew->object->id, OB_RECALC_DATA);
BKE_mesh_end_editmesh(me, em);
@@ -1514,6 +1369,8 @@ static int mesh_separate_material(Scene *scene, Base *editbase)
/* return 1: success */
static int mesh_separate_loose(Scene *scene, Base *editbase)
{
+ return 0;
+#if 0
Mesh *me;
EditMesh *em;
int doit= 1;
@@ -1542,6 +1399,7 @@ static int mesh_separate_loose(Scene *scene, Base *editbase)
BKE_mesh_end_editmesh(me, em);
return 1;
+#endif
}
@@ -1559,7 +1417,7 @@ static int mesh_separate_exec(bContext *C, wmOperator *op)
retval= mesh_separate_loose(scene, base);
if(retval) {
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, base->object);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index fbeb1636114..b84ba39fc8e 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -223,9 +223,8 @@ static int make_fgon_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
if( make_fgon(em, op, 1) ) {
- DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -256,9 +255,8 @@ static int clear_fgon_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
if( make_fgon(em, op, 0) ) {
- DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -546,7 +544,7 @@ void addfaces_from_edgenet(EditMesh *em)
EM_select_flush(em);
-// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// XXX DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op)
@@ -569,7 +567,7 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op)
len = BMO_GetSlot(&bmop, "edgeout")->len;
ok = EDBM_FinishOp(bem, &bmop, op, 1);
- if (!ok) return OPERATOR_CANCELLED;
+ if (!ok) return;
if (len) return;
}
@@ -590,7 +588,7 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op)
len = BMO_GetSlot(&bmop, "regionout")->len;
ok = EDBM_FinishOp(bem, &bmop, op, 1);
- if (!ok) return OPERATOR_CANCELLED;
+ if (!ok) return;
if (len) return;
}
@@ -617,7 +615,7 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op)
EM_select_edge(eed, 1);
BKE_mesh_end_editmesh(me, em);
- // XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ // XXX DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
return;
}
else if(amount > 4) {
@@ -712,7 +710,6 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op)
BKE_mesh_end_editmesh(me, em);
}
-
/* ************************ primitives ******************* */
// HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
@@ -1208,7 +1205,6 @@ static float new_primitive_matrix(bContext *C, float primmat[][4])
static int add_primitive_plane_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1218,8 +1214,8 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_PLANE, mat, 4, 0, 0, dia, 0.0f, 0, 1);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1241,7 +1237,6 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot)
static int add_primitive_cube_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1251,8 +1246,8 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_CUBE, mat, 4, 0, 0, dia, 1.0f, 1, 1);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1274,7 +1269,6 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot)
static int add_primitive_circle_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1284,8 +1278,8 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_CIRCLE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 0.0f, 0,
RNA_boolean_get(op->ptr, "fill"));
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1312,7 +1306,6 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1322,8 +1315,8 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia,
RNA_float_get(op->ptr, "depth"), 1, 1);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1350,7 +1343,6 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
static int add_primitive_tube_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1360,8 +1352,8 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia,
RNA_float_get(op->ptr, "depth"), 1, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1388,7 +1380,6 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot)
static int add_primitive_cone_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1398,8 +1389,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia,
RNA_float_get(op->ptr, "depth"), 0, RNA_boolean_get(op->ptr, "cap_end"));
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1428,7 +1419,6 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
static int add_primitive_grid_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1438,8 +1428,8 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_GRID, mat, RNA_int_get(op->ptr, "x_subdivisions"),
RNA_int_get(op->ptr, "y_subdivisions"), 0, dia, 0.0f, 0, 1);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1466,7 +1456,6 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float mat[4][4];
@@ -1474,8 +1463,8 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_MONKEY, mat, 0, 0, 2, 0.0f, 0.0f, 0, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1497,7 +1486,6 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1507,8 +1495,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_UVSPHERE, mat, RNA_int_get(op->ptr, "rings"),
RNA_int_get(op->ptr, "segments"), 0, dia, 0.0f, 0, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1535,7 +1523,6 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
float dia, mat[4][4];
@@ -1545,8 +1532,8 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
make_prim(obedit, PRIM_ICOSPHERE, mat, 0, 0,
RNA_int_get(op->ptr, "subdivisions"), dia, 0.0f, 0, 0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
index 7e741831133..9109d72b6dc 100644
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ b/source/blender/editors/mesh/editmesh_loop.c
@@ -60,6 +60,7 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
+#include "BKE_report.h"
#include "BKE_utildefines.h"
#include "BKE_tessmesh.h"
@@ -201,6 +202,7 @@ static void edgering_sel(EditMesh *em, EditEdge *startedge, int select, int prev
}
}
}
+
void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
{
#if 0
@@ -392,7 +394,7 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
EM_selectmode_set(em);
}
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
return;
#endif
}
@@ -784,7 +786,6 @@ static float bm_seg_intersect(BMEdge *e, CutCurve *c, int len, char mode,
static int knife_cut_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
BMEditMesh *em= (((Mesh *)obedit->data))->edit_btmesh;
BMesh *bm = em->bm;
@@ -800,6 +801,10 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
int len=0, isected, flag, i;
short numcuts=1, mode= RNA_int_get(op->ptr, "type");
+ /* edit-object needed for matrix, and ar->regiondata for projections to work */
+ if (ELEM3(NULL, obedit, ar, ar->regiondata))
+ return OPERATOR_CANCELLED;
+
if (bm->totvertsel < 2) {
error("No edges are selected to operate on");
return OPERATOR_CANCELLED;;
@@ -863,20 +868,14 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
V_FREE(edges);
V_FREE(percents);
- //if (mode==KNIFE_MIDPOINT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE, 1, SUBDIV_SELECT_ORIG);
- //else if (mode==KNIFE_MULTICUT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE, numcuts, SUBDIV_SELECT_ORIG);
- //else esubdivideflag(obedit, em, SELECT, 0, B_KNIFE|B_PERCENTSUBD, 1, SUBDIV_SELECT_ORIG);
-
BLI_ghash_free(gh, NULL, (GHashValFreeFP)WMEM_freeN);
-
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
-
void MESH_OT_knife_cut(wmOperatorType *ot)
{
PropertyRNA *prop;
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index b38f35ed529..b240896ec9c 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -39,7 +39,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "MEM_guardedalloc.h"
-#include "MTC_matrixops.h"
+
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -130,7 +130,7 @@ void EM_automerge(int update)
// if (len) {
// em->totvert -= len; /* saves doing a countall */
// if (update) {
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
// }
// }
// }
@@ -330,7 +330,14 @@ int EM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads)
}
+static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int index)
+{
+ EditMesh *em= (EditMesh *)handle;
+ EditVert *eve = BLI_findlink(&em->verts, index-1);
+ if(eve && (eve->f & SELECT)) return 0;
+ return 1;
+}
/* ******************************************* */
int mesh_layers_menu_charlen(CustomData *data, int type)
@@ -455,7 +462,7 @@ void EM_mesh_copy_edge(EditMesh *em, short type)
}
if (change) {
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
}
@@ -583,7 +590,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
}
if (change) {
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
}
@@ -713,7 +720,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type)
}
if (change) {
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
}
@@ -1034,7 +1041,7 @@ static int loop_multiselect(bContext *C, wmOperator *op)
MEM_freeN(edarray);
// if (EM_texFaceCheck())
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -1060,173 +1067,147 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
}
#endif
-/* ***************** MAIN MOUSE SELECTION ************** */
-
-
-/* ************************************************** */
-
-/* *********** select linked ************* */
-
-/* for use with selectconnected_delimit_mesh only! */
-#define is_edge_delimit_ok(eed) ((eed->tmp.l == 1) && (eed->seam==0))
-#define is_face_tag(efa) is_edge_delimit_ok(efa->e1) || is_edge_delimit_ok(efa->e2) || is_edge_delimit_ok(efa->e3) || (efa->v4 && is_edge_delimit_ok(efa->e4))
-
-#define face_tag(efa)\
-if(efa->v4) efa->tmp.l= efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= efa->e4->tmp.l= 1;\
-else efa->tmp.l= efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= 1;
-
-/* all - 1) use all faces for extending the selection 2) only use the mouse face
-* sel - 1) select 0) deselect
-* */
+/* ************************* */
+/* ************************* */
-/* legacy warning, this function combines too much :) */
-static int select_linked_limited_invoke(ViewContext *vc, short all, short sel)
+/* swap is 0 or 1, if 1 it hides not selected */
+void EM_hide_mesh(EditMesh *em, int swap)
{
-#if 0 //BMESH_TODO
- EditMesh *em= vc->em;
- EditFace *efa;
- EditEdge *eed;
EditVert *eve;
- short done=1, change=0;
+ EditEdge *eed;
+ EditFace *efa;
+ int a;
- if(em->faces.first==0) return OPERATOR_CANCELLED;
+ if(em==NULL) return;
+
+ /* hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
+ /* - vertex hidden, always means edge is hidden too
+ - edge hidden, always means face is hidden too
+ - face hidden, only set face hide
+ - then only flush back down what's absolute hidden
+ */
+ if(em->selectmode & SCE_SELECT_VERTEX) {
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ if((eve->f & SELECT)!=swap) {
+ eve->f &= ~SELECT;
+ eve->h= 1;
+ }
+ }
- /* flag all edges+faces as off*/
- for(eed= em->edges.first; eed; eed= eed->next)
- eed->tmp.l=0;
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ if(eed->v1->h || eed->v2->h) {
+ eed->h |= 1;
+ eed->f &= ~SELECT;
+ }
+ }
- for(efa= em->faces.first; efa; efa= efa->next) {
- efa->tmp.l = 0;
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ if(efa->e1->h & 1 || efa->e2->h & 1 || efa->e3->h & 1 || (efa->e4 && efa->e4->h & 1)) {
+ efa->h= 1;
+ efa->f &= ~SELECT;
+ }
+ }
}
-
- if (all) {
- // XXX verts?
+ else if(em->selectmode & SCE_SELECT_EDGE) {
+
for(eed= em->edges.first; eed; eed= eed->next) {
- if(eed->f & SELECT)
- eed->tmp.l= 1;
+ if((eed->f & SELECT)!=swap) {
+ eed->h |= 1;
+ EM_select_edge(eed, 0);
+ }
}
+
for(efa= em->faces.first; efa; efa= efa->next) {
-
- if (efa->f & SELECT) {
- face_tag(efa);
- } else {
- efa->tmp.l = 0;
+ if(efa->e1->h & 1 || efa->e2->h & 1 || efa->e3->h & 1 || (efa->e4 && efa->e4->h & 1)) {
+ efa->h= 1;
+ efa->f &= ~SELECT;
}
}
- }
+ }
else {
- if( unified_findnearest(vc, &eve, &eed, &efa) ) {
-
- if(efa) {
- efa->tmp.l = 1;
- face_tag(efa);
- }
- else if(eed)
- eed->tmp.l= 1;
- else {
- for(eed= em->edges.first; eed; eed= eed->next)
- if(eed->v1==eve || eed->v2==eve)
- break;
- eed->tmp.l= 1;
+
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ if((efa->f & SELECT)!=swap) {
+ efa->h= 1;
+ EM_select_face(efa, 0);
}
}
- else
- return OPERATOR_FINISHED;
}
- while(done==1) {
- done= 0;
- /* simple algo - select all faces that have a selected edge
- * this intern selects the edge, repeat until nothing is left to do */
+ /* flush down, only whats 100% hidden */
+ for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
+ for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0;
+
+ if(em->selectmode & SCE_SELECT_FACE) {
for(efa= em->faces.first; efa; efa= efa->next) {
- if ((efa->tmp.l == 0) && (!efa->h)) {
- if (is_face_tag(efa)) {
- face_tag(efa);
- done= 1;
- }
+ if(efa->h) a= 1; else a= 2;
+ efa->e1->f1 |= a;
+ efa->e2->f1 |= a;
+ efa->e3->f1 |= a;
+ if(efa->e4) efa->e4->f1 |= a;
+ /* When edges are not delt with in their own loop, we need to explicitly re-selct select edges that are joined to unselected faces */
+ if (swap && (em->selectmode == SCE_SELECT_FACE) && (efa->f & SELECT)) {
+ EM_select_face(efa, 1);
}
}
}
- for(efa= em->faces.first; efa; efa= efa->next) {
- if (efa->tmp.l) {
- if (sel) {
- if (!(efa->f & SELECT)) {
- EM_select_face(efa, 1);
- change = 1;
- }
- } else {
- if (efa->f & SELECT) {
- EM_select_face(efa, 0);
- change = 1;
- }
- }
+ if(em->selectmode >= SCE_SELECT_EDGE) {
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ if(eed->f1==1) eed->h |= 1;
+ if(eed->h & 1) a= 1; else a= 2;
+ eed->v1->f1 |= a;
+ eed->v2->f1 |= a;
}
}
-
- if (!change)
- return OPERATOR_CANCELLED;
-
- if (!sel) /* make sure de-selecting faces didnt de-select the verts/edges connected to selected faces, this is common with boundries */
- for(efa= em->faces.first; efa; efa= efa->next)
- if (efa->f & SELECT)
- EM_select_face(efa, 1);
-
- // if (EM_texFaceCheck())
-#endif
- return OPERATOR_FINISHED;
-}
-#undef is_edge_delimit_ok
-#undef is_face_tag
-#undef face_tag
+ if(em->selectmode >= SCE_SELECT_VERTEX) {
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ if(eve->f1==1) eve->h= 1;
+ }
+ }
+
+ em->totedgesel= em->totfacesel= em->totvertsel= 0;
+// if(EM_texFaceCheck())
-/* ************************* */
+ // DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+}
-void selectconnected_mesh_all(EditMesh *em)
+void EM_reveal_mesh(EditMesh *em)
{
- EditVert *v1,*v2;
+ EditVert *eve;
EditEdge *eed;
- short done=1, toggle=0;
-
- if(em->edges.first==0) return;
+ EditFace *efa;
- while(done==1) {
- done= 0;
-
- toggle++;
- if(toggle & 1) eed= em->edges.first;
- else eed= em->edges.last;
-
- while(eed) {
- v1= eed->v1;
- v2= eed->v2;
- if(eed->h==0) {
- if(v1->f & SELECT) {
- if( (v2->f & SELECT)==0 ) {
- v2->f |= SELECT;
- done= 1;
- }
- }
- else if(v2->f & SELECT) {
- if( (v1->f & SELECT)==0 ) {
- v1->f |= SELECT;
- done= 1;
- }
- }
- }
- if(toggle & 1) eed= eed->next;
- else eed= eed->prev;
+ if(em==NULL) return;
+
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ if(eve->h) {
+ eve->h= 0;
+ eve->f |= SELECT;
+ }
+ }
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ if(eed->h & 1) {
+ eed->h &= ~1;
+ if(em->selectmode & SCE_SELECT_VERTEX);
+ else EM_select_edge(eed, 1);
+ }
+ }
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ if(efa->h) {
+ efa->h= 0;
+ if(em->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_VERTEX));
+ else EM_select_face(efa, 1);
}
}
-
- /* now use vertex select flag to select rest */
- EM_select_flush(em);
-
- // if (EM_texFaceCheck())
-}
-/* ************************* */
+ EM_fgon_flags(em); /* redo flags and indices for fgons */
+ EM_selectmode_flush(em);
+
+// if (EM_texFaceCheck())
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+}
int select_by_number_vertices_exec(bContext *C, wmOperator *op)
{
@@ -1257,7 +1238,7 @@ int select_by_number_vertices_exec(bContext *C, wmOperator *op)
}
}
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1383,7 +1364,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op)
// if (EM_texFaceCheck())
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); //TODO is this needed ?
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -1551,7 +1532,7 @@ static int select_linked_flat_faces_exec(bContext *C, wmOperator *op)
select_linked_flat_faces(em, op, RNA_float_get(op->ptr, "sharpness"));
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -1652,7 +1633,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op)
select_non_manifold(em, op);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -1675,7 +1656,16 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot)
static int bmesh_test_exec(bContext *C, wmOperator *op)
{
- return OPERATOR_FINISHED;
+ return OPERATOR_CANCELLED;
+}
+/* ******************** (de)select all operator **************** */
+
+void EM_toggle_select_all(EditMesh *em) /* exported for UV */
+{
+ if(EM_nvertices_selected(em))
+ EM_clear_flag_all(em, SELECT);
+ else
+ EM_set_flag_all(em, SELECT);
}
void MESH_OT_bmesh_test(wmOperatorType *ot)
@@ -1687,8 +1677,107 @@ void MESH_OT_bmesh_test(wmOperatorType *ot)
/* api callbacks */
ot->exec= bmesh_test_exec;
ot->poll= ED_operator_editmesh;
+}
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+/* ******************** **************** */
+void EM_select_more(EditMesh *em)
+{
+ EditVert *eve;
+ EditEdge *eed;
+ EditFace *efa;
+
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ if(eve->f & SELECT) eve->f1= 1;
+ else eve->f1 = 0;
+ }
+
+ /* set f1 flags in vertices to select 'more' */
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ if(eed->h==0) {
+ if (eed->v1->f & SELECT)
+ eed->v2->f1 = 1;
+ if (eed->v2->f & SELECT)
+ eed->v1->f1 = 1;
+ }
+ }
+
+ /* new selected edges, but not in facemode */
+ if(em->selectmode <= SCE_SELECT_EDGE) {
+
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ if(eed->h==0) {
+ if(eed->v1->f1 && eed->v2->f1) EM_select_edge(eed, 1);
+ }
+ }
+ }
+ /* new selected faces */
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ if(efa->h==0) {
+ if(efa->v1->f1 && efa->v2->f1 && efa->v3->f1 && (efa->v4==NULL || efa->v4->f1))
+ EM_select_face(efa, 1);
+ }
+ }
+}
+
+void EM_select_less(EditMesh *em)
+{
+ EditEdge *eed;
+ EditFace *efa;
+
+ if(em->selectmode <= SCE_SELECT_EDGE) {
+ /* eed->f1 == 1: edge with a selected and deselected vert */
+
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ eed->f1= 0;
+ if(eed->h==0) {
+
+ if ( !(eed->v1->f & SELECT) && (eed->v2->f & SELECT) )
+ eed->f1= 1;
+ if ( (eed->v1->f & SELECT) && !(eed->v2->f & SELECT) )
+ eed->f1= 1;
+ }
+ }
+
+ /* deselect edges with flag set */
+ for(eed= em->edges.first; eed; eed= eed->next) {
+ if (eed->h==0 && eed->f1 == 1) {
+ EM_select_edge(eed, 0);
+ }
+ }
+ EM_deselect_flush(em);
+
+ }
+ else {
+ /* deselect faces with 1 or more deselect edges */
+ /* eed->f1 == mixed selection edge */
+ for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0;
+
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ if(efa->h==0) {
+ if(efa->f & SELECT) {
+ efa->e1->f1 |= 1;
+ efa->e2->f1 |= 1;
+ efa->e3->f1 |= 1;
+ if(efa->e4) efa->e4->f1 |= 1;
+ }
+ else {
+ efa->e1->f1 |= 2;
+ efa->e2->f1 |= 2;
+ efa->e3->f1 |= 2;
+ if(efa->e4) efa->e4->f1 |= 2;
+ }
+ }
+ }
+ for(efa= em->faces.first; efa; efa= efa->next) {
+ if(efa->h==0) {
+ if(efa->e1->f1==3 || efa->e2->f1==3 || efa->e3->f1==3 || (efa->e4 && efa->e4->f1==3)) {
+ EM_select_face(efa, 0);
+ }
+ }
+ }
+ EM_selectmode_flush(em);
+
+ }
}
static void selectrandom_mesh(EditMesh *em, float perc) /* randomly selects a user-set % of vertices/edges/faces */
@@ -1740,7 +1829,7 @@ static int mesh_select_random_exec(bContext *C, wmOperator *op)
selectrandom_mesh(em, RNA_float_get(op->ptr,"percent"));
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -1791,32 +1880,6 @@ void EM_deselect_by_material(EditMesh *em, int index)
EM_selectmode_flush(em);
}
-static void mesh_selection_type(Scene *scene, EditMesh *em, int val)
-{
- if(val>0) {
- if(val==1) {
- em->selectmode= SCE_SELECT_VERTEX;
- EM_selectmode_set(em);
- }
- else if(val==2) {
- //if(ctrl) EM_convertsel(em, em->selectmode, SCE_SELECT_EDGE);
- em->selectmode= SCE_SELECT_EDGE;
- EM_selectmode_set(em);
- }
-
- else{
- //if((ctrl)) EM_convertsel(em, em->selectmode, SCE_SELECT_FACE);
- em->selectmode= SCE_SELECT_FACE;
- EM_selectmode_set(em);
- }
-
- /* note, em stores selectmode to be able to pass it on everywhere without scene,
- this is only until all select modes and toolsettings are settled more */
- scene->toolsettings->selectmode= em->selectmode;
-// if (EM_texFaceCheck())
- }
-}
-
/* **************** NORMALS ************** */
/* XXX value of select is messed up, it means two things */
void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning */
@@ -2024,7 +2087,7 @@ void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning *
recalc_editnormals(em);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
waitcursor(0);
}
@@ -2202,141 +2265,6 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
}
/* **************** VERTEX DEFORMS *************** */
-
-/*scene is needed for some tool settings*/
-static void smooth_vertex(EditMesh *em, Object *obedit, Scene *scene)
-{
- EditVert *eve, *eve_mir = NULL;
- EditEdge *eed;
- float *adror, *adr, fac;
- float fvec[3];
- int teller=0;
- ModifierData *md;
-
- if(em==NULL) {
- return OPERATOR_CANCELLED;
- }
-
- /* count */
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) teller++;
- eve= eve->next;
- }
-
- if(teller==0) {
- BKE_mesh_end_editmesh(obedit->data, em);
- return OPERATOR_CANCELLED;
- }
-
- adr=adror= (float *)MEM_callocN(3*sizeof(float *)*teller, "vertsmooth");
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- eve->tmp.p = (void*)adr;
- eve->f1= 0;
- eve->f2= 0;
- adr+= 3;
- }
- eve= eve->next;
- }
-
- /* if there is a mirror modifier with clipping, flag the verts that
- * are within tolerance of the plane(s) of reflection
- */
- for(md=obedit->modifiers.first; md; md=md->next) {
- if(md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- if(mmd->flag & MOD_MIR_CLIPPING) {
- for (eve= em->verts.first; eve; eve= eve->next) {
- if(eve->f & SELECT) {
-
- switch(mmd->axis){
- case 0:
- if (fabs(eve->co[0]) < mmd->tolerance)
- eve->f2 |= 1;
- break;
- case 1:
- if (fabs(eve->co[1]) < mmd->tolerance)
- eve->f2 |= 2;
- break;
- case 2:
- if (fabs(eve->co[2]) < mmd->tolerance)
- eve->f2 |= 4;
- break;
- }
- }
- }
- }
- }
- }
-
- eed= em->edges.first;
- while(eed) {
- if( (eed->v1->f & SELECT) || (eed->v2->f & SELECT) ) {
- fvec[0]= (eed->v1->co[0]+eed->v2->co[0])/2.0;
- fvec[1]= (eed->v1->co[1]+eed->v2->co[1])/2.0;
- fvec[2]= (eed->v1->co[2]+eed->v2->co[2])/2.0;
-
- if((eed->v1->f & SELECT) && eed->v1->f1<255) {
- eed->v1->f1++;
- VecAddf(eed->v1->tmp.p, eed->v1->tmp.p, fvec);
- }
- if((eed->v2->f & SELECT) && eed->v2->f1<255) {
- eed->v2->f1++;
- VecAddf(eed->v2->tmp.p, eed->v2->tmp.p, fvec);
- }
- }
- eed= eed->next;
- }
-
- eve= em->verts.first;
- while(eve) {
- if(eve->f & SELECT) {
- if(eve->f1) {
-
- if (scene->toolsettings->editbutflag & B_MESH_X_MIRROR) {
- eve_mir= editmesh_get_x_mirror_vert(obedit, em, eve->co);
- }
-
- adr = eve->tmp.p;
- fac= 0.5/(float)eve->f1;
-
- eve->co[0]= 0.5*eve->co[0]+fac*adr[0];
- eve->co[1]= 0.5*eve->co[1]+fac*adr[1];
- eve->co[2]= 0.5*eve->co[2]+fac*adr[2];
-
-
- /* clip if needed by mirror modifier */
- if (eve->f2) {
- if (eve->f2 & 1) {
- eve->co[0]= 0.0f;
- }
- if (eve->f2 & 2) {
- eve->co[1]= 0.0f;
- }
- if (eve->f2 & 4) {
- eve->co[2]= 0.0f;
- }
- }
-
- if (eve_mir) {
- eve_mir->co[0]=-eve->co[0];
- eve_mir->co[1]= eve->co[1];
- eve_mir->co[2]= eve->co[2];
- }
-
- }
- eve->tmp.p= NULL;
- }
- eve= eve->next;
- }
- MEM_freeN(adror);
-
- recalc_editnormals(em);
-}
-
void vertexnoise(Object *obedit, EditMesh *em)
{
Material *ma;
@@ -2378,7 +2306,7 @@ void vertexnoise(Object *obedit, EditMesh *em)
}
recalc_editnormals(em);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
@@ -2435,23 +2363,23 @@ static void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMe
}
recalc_editnormals(em);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
static int vertices_to_sphere_exec(bContext *C, wmOperator *op)
{
+ Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
- Scene *scene = CTX_data_scene(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
vertices_to_sphere(scene, v3d, obedit, em, RNA_float_get(op->ptr,"percent"));
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9346bde648c..2024e7d5ab9 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -101,8 +101,6 @@ static void waitcursor(int val) {}
static int pupmenu() {return 0;}
static int qtest() {return 0;}
#define add_numbut(a, b, c, d, e, f, g) {}
-static int snap_sel_to_curs() {return 0;}
-static int snap_to_center() {return 0;}
/* XXX */
@@ -647,7 +645,7 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
* This shouldn't be necessary, derived queries should be
* automatically building this data if invalid. Or something.
*/
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
object_handle_update(scene, obedit);
/* individual faces? */
@@ -683,8 +681,8 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
RNA_enum_set(op->ptr, "proportional", 0);
RNA_boolean_set(op->ptr, "mirror", 0);
@@ -708,8 +706,8 @@ static int mesh_extrude_exec(bContext *C, wmOperator *op)
extrude_mesh(scene, obedit, em, op);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -739,7 +737,6 @@ void MESH_OT_extrude(wmOperatorType *ot)
static int split_mesh(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -753,8 +750,8 @@ static int split_mesh(bContext *C, wmOperator *op)
WM_cursor_wait(0);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -779,7 +776,6 @@ void MESH_OT_split(wmOperatorType *ot)
//needs changes ported over to new extrude code too
static int extrude_repeat_mesh(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -815,8 +811,8 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
EM_fgon_flags(em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -846,7 +842,7 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float degr, int dupli )
{
Object *obedit= CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditVert *eve,*nextve;
float nor[3]= {0.0f, 0.0f, 0.0f};
@@ -868,7 +864,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
phi= degr*M_PI/360.0;
phi/= steps;
- if(scene->toolsettings->editbutflag & B_CLOCKWISE) phi= -phi;
+ if(ts->editbutflag & B_CLOCKWISE) phi= -phi;
RNA_float_get_array(op->ptr, "axis", n);
Normalize(n);
@@ -884,7 +880,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
Mat3MulMat3(bmat,imat,tmat);
if(dupli==0)
- if(scene->toolsettings->editbutflag & B_KEEPORIG)
+ if(ts->editbutflag & B_KEEPORIG)
adduplicateflag(em, 1);
for(a=0; a<steps; a++) {
@@ -918,7 +914,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
EM_fgon_flags(em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
BKE_mesh_end_editmesh(obedit->data, em);
@@ -927,7 +923,6 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
static int spin_mesh_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
int ok;
@@ -937,8 +932,8 @@ static int spin_mesh_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -982,7 +977,6 @@ void MESH_OT_spin(wmOperatorType *ot)
static int screw_mesh_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditVert *eve,*v1=0,*v2=0;
@@ -1038,8 +1032,8 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
}
if(spin_mesh(C, op, dvec, turns*steps, 360.0f*turns, 0)) {
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -2512,7 +2506,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float
}
}
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
// Now for each face in the mesh we need to figure out How many edges were cut
// and which filling method to use for that face
for(ef = em->faces.first;ef;ef = ef->next) {
@@ -3299,184 +3293,8 @@ void edge_flip(EditMesh *em)
static const EnumPropertyItem axis_items[]= {
{AXIS_X, "X", 0, "X", ""},
{AXIS_Y, "Y", 0, "Y", ""},
- {0, NULL, 0, NULL, NULL}};
-
-#if 0
-static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir)
-{
- EditVert **verts[2];
- EditFace *face[2], *efa, *newFace[2];
- EditEdge **edges[2], **hiddenedges, *srchedge;
- int facecount, p1, p2, p3, p4, fac1, fac2, i, j;
- int numhidden, numshared, p[2][4];
-
- /* check to make sure that the edge is only part of 2 faces */
- facecount = 0;
- for(efa = em->faces.first;efa;efa = efa->next) {
- if((efa->e1 == eed || efa->e2 == eed) || (efa->e3 == eed || efa->e4 == eed)) {
- if(facecount >= 2) {
- /* more than two faces with this edge */
- return;
- }
- else {
- face[facecount] = efa;
- facecount++;
- }
- }
- }
-
- if(facecount < 2)
- return;
-
- /* how many edges does each face have */
- if(face[0]->e4) fac1= 4;
- else fac1= 3;
-
- if(face[1]->e4) fac2= 4;
- else fac2= 3;
-
- /* make a handy array for verts and edges */
- verts[0]= &face[0]->v1;
- edges[0]= &face[0]->e1;
- verts[1]= &face[1]->v1;
- edges[1]= &face[1]->e1;
-
- /* we don't want to rotate edges between faces that share more than one edge */
- numshared= 0;
- for(i=0; i<fac1; i++)
- for(j=0; j<fac2; j++)
- if (edges[0][i] == edges[1][j])
- numshared++;
-
- if(numshared > 1)
- return;
-
- /* we want to construct an array of vertex indicis in both faces, starting at
- the last vertex of the edge being rotated.
- - first we find the two vertices that lie on the rotating edge
- - then we make sure they are ordered according to the face vertex order
- - and then we construct the array */
- p1= p2= p3= p4= 0;
-
- for(i=0; i<4; i++) {
- if(eed->v1 == verts[0][i]) p1 = i;
- if(eed->v2 == verts[0][i]) p2 = i;
- if(eed->v1 == verts[1][i]) p3 = i;
- if(eed->v2 == verts[1][i]) p4 = i;
- }
-
- if((p1+1)%fac1 == p2)
- SWAP(int, p1, p2);
- if((p3+1)%fac2 == p4)
- SWAP(int, p3, p4);
-
- for (i = 0; i < 4; i++) {
- p[0][i]= (p1 + i)%fac1;
- p[1][i]= (p3 + i)%fac2;
- }
-
- /* create an Array of the Edges who have h set prior to rotate */
- numhidden = 0;
- for(srchedge = em->edges.first;srchedge;srchedge = srchedge->next)
- if(srchedge->h && ((srchedge->v1->f & SELECT) || (srchedge->v2->f & SELECT)))
- numhidden++;
-
- hiddenedges = MEM_mallocN(sizeof(EditVert*)*numhidden+1, "RotateEdgeHiddenVerts");
- if(!hiddenedges) {
- BKE_report(op->reports, RPT_ERROR, "Memory allocation failed");
- return;
- }
-
- numhidden = 0;
- for(srchedge=em->edges.first; srchedge; srchedge=srchedge->next)
- if(srchedge->h && (srchedge->v1->f & SELECT || srchedge->v2->f & SELECT))
- hiddenedges[numhidden++] = srchedge;
-
- /* create the 2 new faces */
- if(fac1 == 3 && fac2 == 3) {
- /* no need of reverse setup */
-
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
- }
- else if(fac1 == 4 && fac2 == 3) {
- if(dir == DIRECTION_CW) {
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
- } else if (dir == DIRECTION_CCW) {
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1);
-
- verts[0][p[0][2]]->f |= SELECT;
- verts[1][p[1][1]]->f |= SELECT;
- }
- }
- else if(fac1 == 3 && fac2 == 4) {
- if(dir == DIRECTION_CW) {
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
- } else if (dir == DIRECTION_CCW) {
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]);
-
- verts[0][p[0][1]]->f |= SELECT;
- verts[1][p[1][2]]->f |= SELECT;
- }
-
- }
- else if(fac1 == 4 && fac2 == 4) {
- if(dir == DIRECTION_CW) {
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
- } else if (dir == DIRECTION_CCW) {
- newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]);
- newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]);
-
- verts[0][p[0][2]]->f |= SELECT;
- verts[1][p[1][2]]->f |= SELECT;
- }
- }
- else
- return; /* This should never happen */
-
- if(dir == DIRECTION_CW || (fac1 == 3 && fac2 == 3)) {
- verts[0][p[0][1]]->f |= SELECT;
- verts[1][p[1][1]]->f |= SELECT;
- }
-
- /* copy old edge's flags to new center edge*/
- for(srchedge=em->edges.first;srchedge;srchedge=srchedge->next) {
- if((srchedge->v1->f & SELECT) && (srchedge->v2->f & SELECT)) {
- srchedge->f = eed->f;
- srchedge->h = eed->h;
- srchedge->dir = eed->dir;
- srchedge->seam = eed->seam;
- srchedge->crease = eed->crease;
- srchedge->bweight = eed->bweight;
- }
- }
-
- /* resetting hidden flag */
- for(numhidden--; numhidden>=0; numhidden--)
- hiddenedges[numhidden]->h= 1;
-
- /* check for orhphan edges */
- for(srchedge=em->edges.first; srchedge; srchedge=srchedge->next)
- srchedge->f1= -1;
-
- /* cleanup */
- MEM_freeN(hiddenedges);
-
- /* get rid of the old edge and faces*/
- remedge(em, eed);
- free_editedge(em, eed);
- BLI_remlink(&em->faces, face[0]);
- free_editface(em, face[0]);
- BLI_remlink(&em->faces, face[1]);
- free_editface(em, face[1]);
-}
-
-#endif
+ {0, NULL, 0, NULL, NULL},
+};
/******************* BEVEL CODE STARTS HERE ********************/
@@ -4304,7 +4122,7 @@ useless:
} else {
draw = 0;
}
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
@@ -4324,7 +4142,7 @@ useless:
if(!immediate)
EM_automerge(0);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
// scrarea_queue_winredraw(curarea);
//BLI_ghash_free(edgesgh, freeGHash, NULL);
@@ -4464,7 +4282,6 @@ static void mesh_rip_setface(EditMesh *em, EditFace *sefa)
static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
#if 0 //BMESH_TODO
- Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= ar->regiondata;
Object *obedit= CTX_data_edit_object(C);
@@ -4660,8 +4477,8 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -4732,7 +4549,7 @@ void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
}
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
return;
}
@@ -4778,7 +4595,7 @@ void shape_copy_from_lerp(EditMesh *em, KeyBlock* thisBlock, KeyBlock* fromBlock
}
}
sprintf(str,"Blending at %d%c MMB to Copy at 100%c",(int)(perc*100),'%','%');
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
// headerprint(str);
// force_draw(0);
@@ -5552,7 +5369,7 @@ int select_vertex_path_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -5619,7 +5436,7 @@ static int region_to_loop(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -5672,8 +5489,8 @@ static int validate_loop(EditMesh *em, Collection *edgecollection)
return(1);
}
-static int loop_bisect(EditMesh *em, Collection *edgecollection){
-
+static int loop_bisect(EditMesh *em, Collection *edgecollection)
+{
EditFace *efa, *sf1, *sf2;
EditEdge *eed, *sed;
CollectedEdge *curredge;
@@ -5794,7 +5611,7 @@ static int loop_to_region(bContext *C, wmOperator *op)
freecollections(&allcollections);
BKE_mesh_end_editmesh(obedit->data, em);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -5813,6 +5630,8 @@ void MESH_OT_loop_to_region(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/********************** Fill Operators *************************/
+
/* note; the EM_selectmode_set() calls here illustrate how badly constructed it all is... from before the
edge/face flags, with very mixed results.... */
static void beauty_fill(EditMesh *em)
@@ -6059,7 +5878,6 @@ static void fill_mesh(EditMesh *em)
static int fill_mesh_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -6067,8 +5885,8 @@ static int fill_mesh_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -6090,7 +5908,6 @@ void MESH_OT_fill(wmOperatorType *ot)
static int beauty_fill_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -6098,8 +5915,8 @@ static int beauty_fill_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -6122,7 +5939,6 @@ void MESH_OT_beauty_fill(wmOperatorType *ot)
static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
@@ -6130,8 +5946,8 @@ static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
if (!EDBM_CallOpf(em, op, "triangulate faces=%hf", BM_SELECT))
return OPERATOR_CANCELLED;
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -6152,14 +5968,13 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
static int tris_convert_to_quads_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
join_triangles(em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -6181,14 +5996,13 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
static int edge_flip_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
edge_flip(em);
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -6207,4 +6021,3 @@ void MESH_OT_edge_flip(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index ec7383a9bd0..3aff91f0825 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -304,5 +304,8 @@ void MESH_OT_extrude_edges_indiv(struct wmOperatorType *ot);
void MESH_OT_extrude_faces_indiv(struct wmOperatorType *ot);
void MESH_OT_bm_test(struct wmOperatorType *ot);
+void MESH_OT_edgering_select(struct wmOperatorType *ot);
+void MESH_OT_loopcut(struct wmOperatorType *ot);
+
#endif // MESH_INTERN_H
diff --git a/source/blender/editors/mesh/mesh_layers.c b/source/blender/editors/mesh/mesh_layers.c
index 2430ecdd110..be476b07a3f 100644
--- a/source/blender/editors/mesh/mesh_layers.c
+++ b/source/blender/editors/mesh/mesh_layers.c
@@ -169,20 +169,21 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
/*********************** UV texture operators ************************/
+static int layers_poll(bContext *C)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+ ID *data= (ob)? ob->data: NULL;
+ return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib);
+}
+
static int uv_texture_add_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- Mesh *me;
+ Mesh *me= ob->data;
BMEditMesh *em;
int layernum;
- if(!ob || ob->type!=OB_MESH)
- return OPERATOR_CANCELLED;
-
- me= (Mesh*)ob->data;
-
- if(scene->obedit == ob) {
+ if(me->edit_btmesh) {
em= me->edit_btmesh;
layernum= CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY);
@@ -193,7 +194,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
BM_add_data_layer(em->bm, &em->bm->ldata, CD_MLOOPUV);
CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
}
- else if(ob) {
+ else {
layernum= CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
if(layernum >= MAX_MTFACE)
return OPERATOR_CANCELLED;
@@ -214,8 +215,8 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
mesh_update_customdata_pointers(me);
}
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
}
@@ -228,6 +229,7 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot)
ot->idname= "MESH_OT_uv_texture_add";
/* api callbacks */
+ ot->poll= layers_poll;
ot->exec= uv_texture_add_exec;
/* flags */
@@ -236,16 +238,11 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot)
static int uv_texture_remove_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- Mesh *me;
+ Mesh *me= ob->data;
CustomDataLayer *cdl, *cdl2;
int index;
- if(!ob || ob->type!=OB_MESH)
- return OPERATOR_CANCELLED;
-
- me= (Mesh*)ob->data;
index= CustomData_get_active_layer_index(&me->pdata, CD_MTEXPOLY);
cdl= (index == -1)? NULL: &me->pdata.layers[index];
@@ -258,8 +255,8 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *op)
delete_customdata_layer(C, ob, cdl, 0);
delete_customdata_layer(C, ob, cdl2, 1);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
}
@@ -272,6 +269,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot)
ot->idname= "MESH_OT_uv_texture_remove";
/* api callbacks */
+ ot->poll= layers_poll;
ot->exec= uv_texture_remove_exec;
/* flags */
@@ -284,17 +282,12 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- Mesh *me;
+ Mesh *me= ob->data;
BMEditMesh *em;
MLoopCol *mcol;
int layernum;
- if(!ob || ob->type!=OB_MESH)
- return OPERATOR_CANCELLED;
-
- me= (Mesh*)ob->data;
-
- if(scene->obedit == ob) {
+ if(me->edit_btmesh) {
em= me->edit_btmesh;
layernum= CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
@@ -328,8 +321,8 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
// shadeMeshMCol(scene, ob, me);
}
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
}
@@ -342,6 +335,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot)
ot->idname= "MESH_OT_vertex_color_add";
/* api callbacks */
+ ot->poll= layers_poll;
ot->exec= vertex_color_add_exec;
/* flags */
@@ -350,16 +344,11 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot)
static int vertex_color_remove_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- Mesh *me;
+ Mesh *me= ob->data;
CustomDataLayer *cdl;
int index;
- if(!ob || ob->type!=OB_MESH)
- return OPERATOR_CANCELLED;
-
- me= (Mesh*)ob->data;
index= CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL);
cdl= (index == -1)? NULL: &me->ldata.layers[index];
@@ -368,8 +357,8 @@ static int vertex_color_remove_exec(bContext *C, wmOperator *op)
delete_customdata_layer(C, ob, cdl, 1);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
}
@@ -383,6 +372,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec= vertex_color_remove_exec;
+ ot->poll= layers_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -392,22 +382,16 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
static int sticky_add_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- Mesh *me;
-
- if(!ob || ob->type!=OB_MESH)
- return OPERATOR_CANCELLED;
-
- me= (Mesh*)ob->data;
+ Mesh *me= ob->data;
if(me->msticky)
return OPERATOR_CANCELLED;
// XXX RE_make_sticky();
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
}
@@ -420,6 +404,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot)
ot->idname= "MESH_OT_sticky_add";
/* api callbacks */
+ ot->poll= layers_poll;
ot->exec= sticky_add_exec;
/* flags */
@@ -428,14 +413,8 @@ void MESH_OT_sticky_add(wmOperatorType *ot)
static int sticky_remove_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- Mesh *me;
-
- if(!ob || ob->type!=OB_MESH)
- return OPERATOR_CANCELLED;
-
- me= (Mesh*)ob->data;
+ Mesh *me= ob->data;
if(!me->msticky)
return OPERATOR_CANCELLED;
@@ -443,8 +422,8 @@ static int sticky_remove_exec(bContext *C, wmOperator *op)
CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
me->msticky= NULL;
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
}
@@ -457,6 +436,7 @@ void MESH_OT_sticky_remove(wmOperatorType *ot)
ot->idname= "MESH_OT_sticky_remove";
/* api callbacks */
+ ot->poll= layers_poll;
ot->exec= sticky_remove_exec;
/* flags */
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 3d42b958d18..af3b26f8804 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -338,7 +338,18 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_bm_test);
+ WM_operatortype_append(MESH_OT_edgering_select);
+ WM_operatortype_append(MESH_OT_loopcut);
+
/* macros */
+
+ /*combining operators with invoke and exec portions doesn't work yet.
+
+ ot= WM_operatortype_append_macro("MESH_OT_loopcut", "Loopcut", OPTYPE_UNDO|OPTYPE_REGISTER);
+ WM_operatortype_macro_define(ot, "MESH_OT_edgering_select");
+ WM_operatortype_macro_define(ot, "MESH_OT_subdivide");
+ */
+
ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
WM_operatortype_macro_define(ot, "TFM_OT_translate");
@@ -356,7 +367,7 @@ void ED_operatortypes_mesh(void)
RNA_enum_set(otm->ptr, "constraint_orientation", V3D_MANIP_NORMAL);
RNA_boolean_set_array(otm->ptr, "constraint_axis", constraint_axis);*/
-
+
}
/* note mesh keymap also for other space? */
@@ -365,19 +376,20 @@ void ED_keymap_mesh(wmWindowManager *wm)
ListBase *keymap= WM_keymap_listbase(wm, "EditMesh", 0, 0);
wmKeymapItem *kmi;
+ WM_keymap_add_item(keymap, "MESH_OT_loopcut", ACTIONMOUSE, KM_PRESS, KM_CTRL, RKEY);
+
/* selecting */
/* standard mouse selection goes via space_view3d */
WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", 1);
- kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "ring", 1);
- kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
+
+ kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", 1);
- RNA_boolean_set(kmi->ptr, "ring", 1);
WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
-
+
WM_keymap_add_item(keymap, "MESH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
@@ -459,7 +471,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
WM_keymap_add_item(keymap, "MESH_OT_fgon_make", FKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "MESH_OT_fgon_clear", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
- WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, XKEY);
/* menus */
WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 49e721f34e8..4e356479f9e 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#include <float.h>
#include "MEM_guardedalloc.h"
@@ -736,7 +737,7 @@ void sort_faces(Scene *scene, View3D *v3d)
MEM_freeN(index);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
}